ext-searchbox-8d7b3480.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. import{g as R}from"./index-63ed8a66.js";function I(u,x){for(var a=0;a<x.length;a++){const h=x[a];if(typeof h!="string"&&!Array.isArray(h)){for(const p in h)if(p!=="default"&&!(p in u)){const i=Object.getOwnPropertyDescriptor(h,p);i&&Object.defineProperty(u,p,i.get?i:{enumerable:!0,get:()=>h[p]})}}}return Object.freeze(Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}))}var k={exports:{}};(function(u,x){ace.define("ace/ext/searchbox.css",["require","exports","module"],function(a,h,p){p.exports=`
  2. /* ------------------------------------------------------------------------------------------
  3. * Editor Search Form
  4. * --------------------------------------------------------------------------------------- */
  5. .ace_search {
  6. background-color: #ddd;
  7. color: #666;
  8. border: 1px solid #cbcbcb;
  9. border-top: 0 none;
  10. overflow: hidden;
  11. margin: 0;
  12. padding: 4px 6px 0 4px;
  13. position: absolute;
  14. top: 0;
  15. z-index: 99;
  16. white-space: normal;
  17. }
  18. .ace_search.left {
  19. border-left: 0 none;
  20. border-radius: 0px 0px 5px 0px;
  21. left: 0;
  22. }
  23. .ace_search.right {
  24. border-radius: 0px 0px 0px 5px;
  25. border-right: 0 none;
  26. right: 0;
  27. }
  28. .ace_search_form, .ace_replace_form {
  29. margin: 0 20px 4px 0;
  30. overflow: hidden;
  31. line-height: 1.9;
  32. }
  33. .ace_replace_form {
  34. margin-right: 0;
  35. }
  36. .ace_search_form.ace_nomatch {
  37. outline: 1px solid red;
  38. }
  39. .ace_search_field {
  40. border-radius: 3px 0 0 3px;
  41. background-color: white;
  42. color: black;
  43. border: 1px solid #cbcbcb;
  44. border-right: 0 none;
  45. outline: 0;
  46. padding: 0;
  47. font-size: inherit;
  48. margin: 0;
  49. line-height: inherit;
  50. padding: 0 6px;
  51. min-width: 17em;
  52. vertical-align: top;
  53. min-height: 1.8em;
  54. box-sizing: content-box;
  55. }
  56. .ace_searchbtn {
  57. border: 1px solid #cbcbcb;
  58. line-height: inherit;
  59. display: inline-block;
  60. padding: 0 6px;
  61. background: #fff;
  62. border-right: 0 none;
  63. border-left: 1px solid #dcdcdc;
  64. cursor: pointer;
  65. margin: 0;
  66. position: relative;
  67. color: #666;
  68. }
  69. .ace_searchbtn:last-child {
  70. border-radius: 0 3px 3px 0;
  71. border-right: 1px solid #cbcbcb;
  72. }
  73. .ace_searchbtn:disabled {
  74. background: none;
  75. cursor: default;
  76. }
  77. .ace_searchbtn:hover {
  78. background-color: #eef1f6;
  79. }
  80. .ace_searchbtn.prev, .ace_searchbtn.next {
  81. padding: 0px 0.7em
  82. }
  83. .ace_searchbtn.prev:after, .ace_searchbtn.next:after {
  84. content: "";
  85. border: solid 2px #888;
  86. width: 0.5em;
  87. height: 0.5em;
  88. border-width: 2px 0 0 2px;
  89. display:inline-block;
  90. transform: rotate(-45deg);
  91. }
  92. .ace_searchbtn.next:after {
  93. border-width: 0 2px 2px 0 ;
  94. }
  95. .ace_searchbtn_close {
  96. background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;
  97. border-radius: 50%;
  98. border: 0 none;
  99. color: #656565;
  100. cursor: pointer;
  101. font: 16px/16px Arial;
  102. padding: 0;
  103. height: 14px;
  104. width: 14px;
  105. top: 9px;
  106. right: 7px;
  107. position: absolute;
  108. }
  109. .ace_searchbtn_close:hover {
  110. background-color: #656565;
  111. background-position: 50% 100%;
  112. color: white;
  113. }
  114. .ace_button {
  115. margin-left: 2px;
  116. cursor: pointer;
  117. -webkit-user-select: none;
  118. -moz-user-select: none;
  119. -o-user-select: none;
  120. -ms-user-select: none;
  121. user-select: none;
  122. overflow: hidden;
  123. opacity: 0.7;
  124. border: 1px solid rgba(100,100,100,0.23);
  125. padding: 1px;
  126. box-sizing: border-box!important;
  127. color: black;
  128. }
  129. .ace_button:hover {
  130. background-color: #eee;
  131. opacity:1;
  132. }
  133. .ace_button:active {
  134. background-color: #ddd;
  135. }
  136. .ace_button.checked {
  137. border-color: #3399ff;
  138. opacity:1;
  139. }
  140. .ace_search_options{
  141. margin-bottom: 3px;
  142. text-align: right;
  143. -webkit-user-select: none;
  144. -moz-user-select: none;
  145. -o-user-select: none;
  146. -ms-user-select: none;
  147. user-select: none;
  148. clear: both;
  149. }
  150. .ace_search_counter {
  151. float: left;
  152. font-family: arial;
  153. padding: 0 8px;
  154. }`}),ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/ext/searchbox.css","ace/keyboard/hash_handler","ace/lib/keys","ace/config"],function(a,h,p){var i=a("../lib/dom"),O=a("../lib/lang"),l=a("../lib/event"),y=a("./searchbox.css"),_=a("../keyboard/hash_handler").HashHandler,A=a("../lib/keys"),o=a("../config").nls,b=999;i.importCssString(y,"ace_searchbox",!1);var f=function(){function e(n,t,r){var s=i.createElement("div");i.buildDom(["div",{class:"ace_search right"},["span",{action:"hide",class:"ace_searchbtn_close"}],["div",{class:"ace_search_form"},["input",{class:"ace_search_field",placeholder:o("Search for"),spellcheck:"false"}],["span",{action:"findPrev",class:"ace_searchbtn prev"},"​"],["span",{action:"findNext",class:"ace_searchbtn next"},"​"],["span",{action:"findAll",class:"ace_searchbtn",title:"Alt-Enter"},o("All")]],["div",{class:"ace_replace_form"},["input",{class:"ace_search_field",placeholder:o("Replace with"),spellcheck:"false"}],["span",{action:"replaceAndFindNext",class:"ace_searchbtn"},o("Replace")],["span",{action:"replaceAll",class:"ace_searchbtn"},o("All")]],["div",{class:"ace_search_options"},["span",{action:"toggleReplace",class:"ace_button",title:o("Toggle Replace mode"),style:"float:left;margin-top:-2px;padding:0 5px;"},"+"],["span",{class:"ace_search_counter"}],["span",{action:"toggleRegexpMode",class:"ace_button",title:o("RegExp Search")},".*"],["span",{action:"toggleCaseSensitive",class:"ace_button",title:o("CaseSensitive Search")},"Aa"],["span",{action:"toggleWholeWords",class:"ace_button",title:o("Whole Word Search")},"\\b"],["span",{action:"searchInSelection",class:"ace_button",title:o("Search In Selection")},"S"]]],s),this.element=s.firstChild,this.setSession=this.setSession.bind(this),this.$init(),this.setEditor(n),i.importCssString(y,"ace_searchbox",n.container)}return e.prototype.setEditor=function(n){n.searchBox=this,n.renderer.scroller.appendChild(this.element),this.editor=n},e.prototype.setSession=function(n){this.searchRange=null,this.$syncOptions(!0)},e.prototype.$initElements=function(n){this.searchBox=n.querySelector(".ace_search_form"),this.replaceBox=n.querySelector(".ace_replace_form"),this.searchOption=n.querySelector("[action=searchInSelection]"),this.replaceOption=n.querySelector("[action=toggleReplace]"),this.regExpOption=n.querySelector("[action=toggleRegexpMode]"),this.caseSensitiveOption=n.querySelector("[action=toggleCaseSensitive]"),this.wholeWordOption=n.querySelector("[action=toggleWholeWords]"),this.searchInput=this.searchBox.querySelector(".ace_search_field"),this.replaceInput=this.replaceBox.querySelector(".ace_search_field"),this.searchCounter=n.querySelector(".ace_search_counter")},e.prototype.$init=function(){var n=this.element;this.$initElements(n);var t=this;l.addListener(n,"mousedown",function(r){setTimeout(function(){t.activeInput.focus()},0),l.stopPropagation(r)}),l.addListener(n,"click",function(r){var s=r.target||r.srcElement,c=s.getAttribute("action");c&&t[c]?t[c]():t.$searchBarKb.commands[c]&&t.$searchBarKb.commands[c].exec(t),l.stopPropagation(r)}),l.addCommandKeyListener(n,function(r,s,c){var g=A.keyCodeToString(c),d=t.$searchBarKb.findKeyCommand(s,g);d&&d.exec&&(d.exec(t),l.stopEvent(r))}),this.$onChange=O.delayedCall(function(){t.find(!1,!1)}),l.addListener(this.searchInput,"input",function(){t.$onChange.schedule(20)}),l.addListener(this.searchInput,"focus",function(){t.activeInput=t.searchInput,t.searchInput.value&&t.highlight()}),l.addListener(this.replaceInput,"focus",function(){t.activeInput=t.replaceInput,t.searchInput.value&&t.highlight()})},e.prototype.setSearchRange=function(n){this.searchRange=n,n?this.searchRangeMarker=this.editor.session.addMarker(n,"ace_active-line"):this.searchRangeMarker&&(this.editor.session.removeMarker(this.searchRangeMarker),this.searchRangeMarker=null)},e.prototype.$syncOptions=function(n){i.setCssClass(this.replaceOption,"checked",this.searchRange),i.setCssClass(this.searchOption,"checked",this.searchOption.checked),this.replaceOption.textContent=this.replaceOption.checked?"-":"+",i.setCssClass(this.regExpOption,"checked",this.regExpOption.checked),i.setCssClass(this.wholeWordOption,"checked",this.wholeWordOption.checked),i.setCssClass(this.caseSensitiveOption,"checked",this.caseSensitiveOption.checked);var t=this.editor.getReadOnly();this.replaceOption.style.display=t?"none":"",this.replaceBox.style.display=this.replaceOption.checked&&!t?"":"none",this.find(!1,!1,n)},e.prototype.highlight=function(n){this.editor.session.highlight(n||this.editor.$search.$options.re),this.editor.renderer.updateBackMarkers()},e.prototype.find=function(n,t,r){var s=this.editor.find(this.searchInput.value,{skipCurrent:n,backwards:t,wrap:!0,regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked,preventScroll:r,range:this.searchRange}),c=!s&&this.searchInput.value;i.setCssClass(this.searchBox,"ace_nomatch",c),this.editor._emit("findSearchBox",{match:!c}),this.highlight(),this.updateCounter()},e.prototype.updateCounter=function(){var n=this.editor,t=n.$search.$options.re,r=0,s=0;if(t){var c=this.searchRange?n.session.getTextRange(this.searchRange):n.getValue(),g=n.session.doc.positionToIndex(n.selection.anchor);this.searchRange&&(g-=n.session.doc.positionToIndex(this.searchRange.start));for(var d=t.lastIndex=0,v;(v=t.exec(c))&&(r++,d=v.index,d<=g&&s++,!(r>b||!v[0]&&(t.lastIndex=d+=1,d>=c.length))););}this.searchCounter.textContent=o("$0 of $1",[s,r>b?b+"+":r])},e.prototype.findNext=function(){this.find(!0,!1)},e.prototype.findPrev=function(){this.find(!0,!0)},e.prototype.findAll=function(){var n=this.editor.findAll(this.searchInput.value,{regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked}),t=!n&&this.searchInput.value;i.setCssClass(this.searchBox,"ace_nomatch",t),this.editor._emit("findSearchBox",{match:!t}),this.highlight(),this.hide()},e.prototype.replace=function(){this.editor.getReadOnly()||this.editor.replace(this.replaceInput.value)},e.prototype.replaceAndFindNext=function(){this.editor.getReadOnly()||(this.editor.replace(this.replaceInput.value),this.findNext())},e.prototype.replaceAll=function(){this.editor.getReadOnly()||this.editor.replaceAll(this.replaceInput.value)},e.prototype.hide=function(){this.active=!1,this.setSearchRange(null),this.editor.off("changeSession",this.setSession),this.element.style.display="none",this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb),this.editor.focus()},e.prototype.show=function(n,t){this.active=!0,this.editor.on("changeSession",this.setSession),this.element.style.display="",this.replaceOption.checked=t,n&&(this.searchInput.value=n),this.searchInput.focus(),this.searchInput.select(),this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb),this.$syncOptions(!0)},e.prototype.isFocused=function(){var n=document.activeElement;return n==this.searchInput||n==this.replaceInput},e}(),m=new _;m.bindKeys({"Ctrl-f|Command-f":function(e){var n=e.isReplace=!e.isReplace;e.replaceBox.style.display=n?"":"none",e.replaceOption.checked=!1,e.$syncOptions(),e.searchInput.focus()},"Ctrl-H|Command-Option-F":function(e){e.editor.getReadOnly()||(e.replaceOption.checked=!0,e.$syncOptions(),e.replaceInput.focus())},"Ctrl-G|Command-G":function(e){e.findNext()},"Ctrl-Shift-G|Command-Shift-G":function(e){e.findPrev()},esc:function(e){setTimeout(function(){e.hide()})},Return:function(e){e.activeInput==e.replaceInput&&e.replace(),e.findNext()},"Shift-Return":function(e){e.activeInput==e.replaceInput&&e.replace(),e.findPrev()},"Alt-Return":function(e){e.activeInput==e.replaceInput&&e.replaceAll(),e.findAll()},Tab:function(e){(e.activeInput==e.replaceInput?e.searchInput:e.replaceInput).focus()}}),m.addCommands([{name:"toggleRegexpMode",bindKey:{win:"Alt-R|Alt-/",mac:"Ctrl-Alt-R|Ctrl-Alt-/"},exec:function(e){e.regExpOption.checked=!e.regExpOption.checked,e.$syncOptions()}},{name:"toggleCaseSensitive",bindKey:{win:"Alt-C|Alt-I",mac:"Ctrl-Alt-R|Ctrl-Alt-I"},exec:function(e){e.caseSensitiveOption.checked=!e.caseSensitiveOption.checked,e.$syncOptions()}},{name:"toggleWholeWords",bindKey:{win:"Alt-B|Alt-W",mac:"Ctrl-Alt-B|Ctrl-Alt-W"},exec:function(e){e.wholeWordOption.checked=!e.wholeWordOption.checked,e.$syncOptions()}},{name:"toggleReplace",exec:function(e){e.replaceOption.checked=!e.replaceOption.checked,e.$syncOptions()}},{name:"searchInSelection",exec:function(e){e.searchOption.checked=!e.searchRange,e.setSearchRange(e.searchOption.checked&&e.editor.getSelectionRange()),e.$syncOptions()}}]);var C=new _([{bindKey:"Esc",name:"closeSearchBar",exec:function(e){e.searchBox.hide()}}]);f.prototype.$searchBarKb=m,f.prototype.$closeSearchBarKb=C,h.SearchBox=f,h.Search=function(e,n){var t=e.searchBox||new f(e);t.show(e.session.getTextRange(),n)}}),function(){ace.require(["ace/ext/searchbox"],function(a){u&&(u.exports=a)})}()})(k);var S=k.exports;const w=R(S),$=I({__proto__:null,default:w},[S]);export{$ as e};
  155. //# sourceMappingURL=ext-searchbox-8d7b3480.js.map