- md5
- 9bc30b15a4a73fa04133183531b3da14
- sha1
- 1ed0926e9c031d08175da0360b4e0acf55efa3c4
- sha256
- a86f686b3a14374b92d58ea62d044cd8ddee31b9167389980768552f387de385
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}((function(e){"use strict";function o(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function n(e){return e.state.search||(e.state.search=new o)}function t(e){return"string"==typeof e&&e==e.toLowerCase()}function r(e,o,n){return e.getSearchCursor(o,n,{caseFold:t(o),multiline:!0})}function i(e,o,n,t,r){e.openDialog?e.openDialog(o,r,{value:t,selectValueOnOpen:!0,bottom:e.options.search.bottom}):r(prompt(n,t))}function a(e){return e.replace(/\\([nrt\\])/g,(function(e,o){return"n"==o?"\n":"r"==o?"\r":"t"==o?"\t":"\\"==o?"\\":e}))}function s(e){var o=e.match(/^\/(.*)\/([a-z]*)$/);if(o)try{e=new RegExp(o[1],-1==o[2].indexOf("i")?"":"i")}catch(e){}else e=a(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function c(e,o,n){o.queryText=n,o.query=s(n),e.removeOverlay(o.overlay,t(o.query)),o.overlay=function(e,o){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),o?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(o){e.lastIndex=o.pos;var n=e.exec(o.string);if(n&&n.index==o.pos)return o.pos+=n[0].length||1,"searching";n?o.pos=n.index:o.skipToEnd()}}}(o.query,t(o.query)),e.addOverlay(o.overlay),e.showMatchesOnScrollbar&&(o.annotate&&(o.annotate.clear(),o.annotate=null),o.annotate=e.showMatchesOnScrollbar(o.query,t(o.query)))}function l(o,t,r,a){var s=n(o);if(s.query)return u(o,t);var l=o.getSelection()||s.lastQuery;if(l instanceof RegExp&&"x^"==l.source&&(l=null),r&&o.openDialog){var d=null,m=function(n,t){e.e_stop(t),n&&(n!=s.queryText&&(c(o,s,n),s.posFrom=s.posTo=o.getCursor()),d&&(d.style.opacity=1),u(o,t.shiftKey,(function(e,n){var t;n.line<3&&document.querySelector&&(t=o.display.wrapper.querySelector(".CodeMirror-dialog"))&&t.getBoundingClientRect().bottom-4>o.cursorCoords(n,"window").top&&((d=t).style.opacity=.4)})))};!function(e,o,n,t,r){e.openDialog(o,t,{value:n,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){f(e)},onKeyDown:r,bottom:e.options.search.bottom})}(o,p(o),l,m,(function(t,r){var i=e.keyName(t),a=o.getOption("extraKeys"),s=a&&a[i]||e.keyMap[o.getOption("keyMap")][i];"findNext"==s||"findPrev"==s||"findPersistentNext"==s||"findPersistentPrev"==s?(e.e_stop(t),c(o,n(o),r),o.execCommand(s)):"find"!=s&&"findPersistent"!=s||(e.e_stop(t),m(r,t))})),a&&l&&(c(o,s,l),u(o,t))}else i(o,p(o),"Search for:",l,(function(e){e&&!s.query&&o.operation((function(){c(o,s,e),s.posFrom=s.posTo=o.getCursor(),u(o,t)}))}))}function u(o,t,i){o.operation((function(){var a=n(o),s=r(o,a.query,t?a.posFrom:a.posTo);(s.find(t)||(s=r(o,a.query,t?e.Pos(o.lastLine()):e.Pos(o.firstLine(),0))).find(t))&&(o.setSelection(s.from(),s.to()),o.scrollIntoView({from:s.from(),to:s.to()},20),a.posFrom=s.from(),a.posTo=s.to(),i&&i(s.from(),s.to()))}))}function f(e){e.operation((function(){var o=n(e);o.lastQuery=o.query,o.query&&(o.query=o.queryText=null,e.removeOverlay(o.overlay),o.annotate&&(o.annotate.clear(),o.annotate=null))}))}function p(e){return'<span class="CodeMirror-search-label">'+e.phrase("Search:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+e.phrase("(Use /re/ syntax for regexp search)")+"</span>"}function d(e,o,n){e.operation((function(){for(var t=r(e,o);t.findNext();)if("string"!=typeof o){var i=e.getRange(t.from(),t.to()).match(o);t.replace(n.replace(/\$(\d)/g,(function(e,o){return i[o]})))}else t.replace(n)}))}function m(e,o){if(!e.getOption("readOnly")){var t=e.getSelection()||n(e).lastQuery,c='<span class="CodeMirror-search-label">'+(o?e.phrase("Replace all:"):e.phrase("Replace:"))+"</span>";i(e,c+function(e){return' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+e.phrase("(Use /re/ syntax for regexp search)")+"</span>"}(e),c,t,(function(n){n&&(n=s(n),i(e,function(e){return'<span class="CodeMirror-search-label">'+e.phrase("With:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>'}(e),e.phrase("Replace with:"),"",(function(t){if(t=a(t),o)d(e,n,t);else{f(e);var i=r(e,n,e.getCursor("from")),s=function(){var o,a=i.from();!(o=i.findNext())&&(i=r(e,n),!(o=i.findNext())||a&&i.from().line==a.line&&i.from().ch==a.ch)||(e.setSelection(i.from(),i.to()),e.scrollIntoView({from:i.from(),to:i.to()}),function(e,o,n,t){e.openConfirm?e.openConfirm(o,t):confirm(n)&&t[0]()}(e,function(e){return'<span class="CodeMirror-search-label">'+e.phrase("Replace?")+"</span> <button>"+e.phrase("Yes")+"</button> <button>"+e.phrase("No")+"</button> <button>"+e.phrase("All")+"</button> <button>"+e.phrase("Stop")+"</button> "}(e),e.phrase("Replace?"),[function(){c(o)},s,function(){d(e,n,t)}]))},c=function(e){i.replace("string"==typeof n?t:t.replace(/\$(\d)/g,(function(o,n){return e[n]}))),s()};s()}})))}))}}e.defineOption("search",{bottom:!1}),e.commands.find=function(e){f(e),l(e)},e.commands.findPersistent=function(e){f(e),l(e,!1,!0)},e.commands.findPersistentNext=function(e){l(e,!1,!0,!0)},e.commands.findPersistentPrev=function(e){l(e,!0,!0,!0)},e.commands.findNext=l,e.commands.findPrev=function(e){l(e,!0)},e.commands.clearSearch=f,e.commands.replace=m,e.commands.replaceAll=function(e){m(e,!0)}}));
The same content is in 5 releases, Joomla 4.0.0-rc1 to 4.0.0-rc5. See them all, or every version of this file.