{"size": 12626, "ext": "js", "max_stars_repo_path": "public/plugin/ckeditor-back/plugins/codemirror/js/codemirror.addons.search.min.js", "max_stars_repo_name": "rahadyandgusti/lumen", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/plugin/ckeditor-back/plugins/codemirror/js/codemirror.addons.search.min.js", "max_issues_repo_name": "rahadyandgusti/lumen", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/plugin/ckeditor-back/plugins/codemirror/js/codemirror.addons.search.min.js", "max_forks_repo_name": "rahadyandgusti/lumen", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 485.6153846154, "max_line_length": 532, "alphanum_fraction": 0.6690955172}
﻿!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/search/searchcursor",["../../lib/codemirror"],a):a(CodeMirror)}(function(a){function x(d){if(!d.global){var b=d.flags;d=new RegExp(d.source,(null!=b?b:(d.ignoreCase?"i":"")+(d.global?"g":"")+(d.multiline?"m":""))+"g")}return d}function z(d,b,e){b=x(b);var k=e.line,f=e.ch;for(e=d.lastLine();k<=e;k++,f=0)if(b.lastIndex=f,f=d.getLine(k),f=b.exec(f))return{from:m(k,
f.index),to:m(k,f.index+f[0].length),match:f}}function q(d,b,e){if(!/\\s|\\n|\n|\\W|\\D|\[\^/.test(b.source))return z(d,b,e);b=x(b);for(var k,f=1,a=e.line,c=d.lastLine();a<=c;){for(var h=0;h<f;h++){var t=d.getLine(a++);k=null==k?t:k+"\n"+t}f*=2;b.lastIndex=e.ch;if(h=b.exec(k))return b=k.slice(0,h.index).split("\n"),d=h[0].split("\n"),e=e.line+b.length-1,b=b[b.length-1].length,{from:m(e,b),to:m(e+d.length-1,1==d.length?b+d[0].length:d[d.length-1].length),match:h}}}function n(d,b){for(var e,k=0;;){b.lastIndex=
k;var f=b.exec(d);if(!f||(e=f,(k=e.index+(e[0].length||1))==d.length))return e}}function c(d,b,e){b=x(b);var k=e.line,f=e.ch;for(e=d.firstLine();k>=e;k--,f=-1){var a=d.getLine(k);-1<f&&(a=a.slice(0,f));if(f=n(a,b))return{from:m(k,f.index),to:m(k,f.index+f[0].length),match:f}}}function g(d,b,e){b=x(b);for(var k,a=1,c=e.line,p=d.firstLine();c>=p;){for(var h=0;h<a;h++){var t=d.getLine(c--);k=null==k?t.slice(0,e.ch):t+"\n"+k}a*=2;if(h=n(k,b))return b=k.slice(0,h.index).split("\n"),d=h[0].split("\n"),
c+=b.length,b=b[b.length-1].length,{from:m(c,b),to:m(c+d.length-1,1==d.length?b+d[0].length:d[d.length-1].length),match:h}}}function l(d,b,e,a){if(d.length==b.length)return e;var f=0;for(b=e+Math.max(0,d.length-b.length);;){if(f==b)return f;var c=f+b>>1,m=a(d.slice(0,c)).length;if(m==e)return c;m>e?b=c:f=c+1}}function r(d,b,e,a){if(!b.length)return null;a=a?p:y;b=a(b).split(/\r|\n\r?/);var f=e.line;e=e.ch;var c=d.lastLine()+1-b.length;a:for(;f<=c;f++,e=0){var g=d.getLine(f).slice(e),h=a(g);if(1==
b.length){var t=h.indexOf(b[0]);if(-1==t)continue a;l(g,h,t,a);return{from:m(f,l(g,h,t,a)+e),to:m(f,l(g,h,t+b[0].length,a)+e)}}t=h.length-b[0].length;if(h.slice(t)==b[0]){for(var u=1;u<b.length-1;u++)if(a(d.getLine(f+u))!=b[u])continue a;var u=d.getLine(f+b.length-1),E=a(u),A=b[b.length-1];if(u.slice(0,A.length)==A)return{from:m(f,l(g,h,t,a)+e),to:m(f+b.length-1,l(u,E,A.length,a))}}}}function v(d,b,a,c){if(!b.length)return null;c=c?p:y;b=c(b).split(/\r|\n\r?/);var f=a.line,g=a.ch,q=d.firstLine()-
1+b.length;a:for(;f>=q;f--,g=-1){var h=d.getLine(f);-1<g&&(h=h.slice(0,g));g=c(h);if(1==b.length){a=g.lastIndexOf(b[0]);if(-1==a)continue a;return{from:m(f,l(h,g,a,c)),to:m(f,l(h,g,a+b[0].length,c))}}var t=b[b.length-1];if(g.slice(0,t.length)==t){var u=1;for(a=f-b.length+1;u<b.length-1;u++)if(c(d.getLine(a+u))!=b[u])continue a;a=d.getLine(f+1-b.length);u=c(a);if(u.slice(u.length-b[0].length)==b[0])return{from:m(f+1-b.length,l(a,u,a.length-b[0].length,c)),to:m(f,l(h,g,t.length,c))}}}}function w(a,
b,e,k){this.atOccurrence=!1;this.doc=a;e=e?a.clipPos(e):m(0,0);this.pos={from:e,to:e};var f;"object"==typeof k?f=k.caseFold:(f=k,k=null);"string"==typeof b?(null==f&&(f=!1),this.matches=function(c,e){return(c?v:r)(a,b,e,f)}):(b=x(b),k&&!1===k.multiline?this.matches=function(e,f){return(e?c:z)(a,b,f)}:this.matches=function(c,e){return(c?g:q)(a,b,e)})}var p,y,m=a.Pos;String.prototype.normalize?(p=function(a){return a.normalize("NFD").toLowerCase()},y=function(a){return a.normalize("NFD")}):(p=function(a){return a.toLowerCase()},
y=function(a){return a});w.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(d){for(var b=this.matches(d,this.doc.clipPos(d?this.pos.from:this.pos.to));b&&0==a.cmpPos(b.from,b.to);)d?b.from.ch?b.from=m(b.from.line,b.from.ch-1):b=b.from.line==this.doc.firstLine()?null:this.matches(d,this.doc.clipPos(m(b.from.line-1))):b.to.ch<this.doc.getLine(b.to.line).length?b.to=m(b.to.line,b.to.ch+1):b=b.to.line==this.doc.lastLine()?null:this.matches(d,
m(b.to.line+1,0));if(b)return this.pos=b,this.atOccurrence=!0,this.pos.match||!0;d=m(d?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:d,to:d},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(d,b){if(this.atOccurrence){var c=a.splitLines(d);this.doc.replaceRange(c,this.pos.from,this.pos.to,b);this.pos.to=m(this.pos.from.line+c.length-1,c[c.length-1].length+(1==c.length?this.pos.from.ch:
0))}}};a.defineExtension("getSearchCursor",function(a,b,c){return new w(this.doc,a,b,c)});a.defineDocExtension("getSearchCursor",function(a,b,c){return new w(this,a,b,c)});a.defineExtension("selectMatches",function(c,b){for(var e=[],k=this.getSearchCursor(c,this.getCursor("from"),b);k.findNext()&&!(0<a.cmpPos(k.to(),this.getCursor("to")));)e.push({anchor:k.from(),head:k.to()});e.length&&this.setSelections(e,0)})});
(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("addon/dialog/dialog",["../../lib/codemirror"],a):a(CodeMirror)})(function(a){function x(a,n,c){var g;return g=a.getWrapperElement().appendChild(document.createElement("div")),g.className=c?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof n?g.innerHTML=n:g.appendChild(n),g}function z(a,n){a.state.currentNotificationClose&&
a.state.currentNotificationClose();a.state.currentNotificationClose=n}a.defineExtension("openDialog",function(q,n,c){function g(a){"string"==typeof a?p.value=a:v||(v=!0,r.parentNode.removeChild(r),w.focus(),c.onClose&&c.onClose(r))}c||(c={});z(this,null);var l,r=x(this,q,c.bottom),v=!1,w=this,p=r.getElementsByTagName("input")[0];return p?(p.focus(),c.value&&(p.value=c.value,!1!==c.selectValueOnOpen&&p.select()),c.onInput&&a.on(p,"input",function(a){c.onInput(a,p.value,g)}),c.onKeyUp&&a.on(p,"keyup",
function(a){c.onKeyUp(a,p.value,g)}),a.on(p,"keydown",function(l){c&&c.onKeyDown&&c.onKeyDown(l,p.value,g)||((27==l.keyCode||!1!==c.closeOnEnter&&13==l.keyCode)&&(p.blur(),a.e_stop(l),g()),13==l.keyCode&&n(p.value,l))}),!1!==c.closeOnBlur&&a.on(p,"blur",g)):(l=r.getElementsByTagName("button")[0])&&(a.on(l,"click",function(){g();w.focus()}),!1!==c.closeOnBlur&&a.on(l,"blur",g),l.focus()),g});a.defineExtension("openConfirm",function(q,n,c){function g(){r||(r=!0,l.parentNode.removeChild(l),v.focus())}
z(this,null);var l=x(this,q,c&&c.bottom);q=l.getElementsByTagName("button");var r=!1,v=this,w=1;q[0].focus();for(c=0;c<q.length;++c){var p=q[c];!function(c){a.on(p,"click",function(l){a.e_preventDefault(l);g();c&&c(v)})}(n[c]);a.on(p,"blur",function(){--w;setTimeout(function(){0>=w&&g()},200)});a.on(p,"focus",function(){++w})}});a.defineExtension("openNotification",function(q,n){function c(){r||(r=!0,clearTimeout(g),l.parentNode.removeChild(l))}z(this,c);var g,l=x(this,q,n&&n.bottom),r=!1,v=n&&void 0!==
n.duration?n.duration:5E3;return a.on(l,"click",function(g){a.e_preventDefault(g);c()}),v&&(g=setTimeout(c,v)),c})});
(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define("addon/search/search.js",["../../lib/codemirror","./searchcursor","../dialog/dialog"],a):a(CodeMirror)})(function(a){function x(h,a){return"string"==typeof h?h=new RegExp(h.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$\x26"),a?"gi":"g"):h.global||(h=new RegExp(h.source,h.ignoreCase?"gi":"g")),{token:function(a){h.lastIndex=
a.pos;var b=h.exec(a.string);if(b&&b.index==a.pos)return a.pos+=b[0].length||1,"searching";b?a.pos=b.index:a.skipToEnd()}}}function z(){this.overlay=this.posFrom=this.posTo=this.lastQuery=this.query=null}function q(h){return h.state.search||(h.state.search=new z)}function n(h){return"string"==typeof h&&h==h.toLowerCase()}function c(h,a,b){return h.getSearchCursor(a,b,{caseFold:n(a),multiline:!0})}function g(h,a,b,c,f){h.openDialog(a,c,{value:b,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){d(h)},
onKeyDown:f})}function l(h,a,b,c,d){h.openDialog?h.openDialog(a,d,{value:c,selectValueOnOpen:!0}):d(prompt(b,c))}function r(a,b,c,d){a.openConfirm?a.openConfirm(b,d):confirm(c)&&d[0]()}function v(a){return a.replace(/\\(.)/g,function(a,h){return"n"==h?"\n":"r"==h?"\r":h})}function w(a){var b=a.match(/^\/(.*)\/([a-z]*)$/);if(b)try{a=new RegExp(b[1],-1==b[2].indexOf("i")?"":"i")}catch(c){}else a=v(a);return("string"==typeof a?""==a:a.test(""))&&(a=/x^/),a}function p(a,b,c){b.queryText=c;b.query=w(c);
a.removeOverlay(b.overlay,n(b.query));b.overlay=x(b.query,n(b.query));a.addOverlay(b.overlay);a.showMatchesOnScrollbar&&(b.annotate&&(b.annotate.clear(),b.annotate=null),b.annotate=a.showMatchesOnScrollbar(b.query,n(b.query)))}function y(b,c,d,f){var e=q(b);if(e.query)return m(b,c);var n=b.getSelection()||e.lastQuery;if(n instanceof RegExp&&"x^"==n.source&&(n=null),d&&b.openDialog){var B=null,r=function(c,d){a.e_stop(d);c&&(c!=e.queryText&&(p(b,e,c),e.posFrom=e.posTo=b.getCursor()),B&&(B.style.opacity=
1),m(b,d.shiftKey,function(a,c){var d;3>c.line&&document.querySelector&&(d=b.display.wrapper.querySelector(".CodeMirror-dialog"))&&d.getBoundingClientRect().bottom-4>b.cursorCoords(c,"window").top&&((B=d).style.opacity=.4)}))};g(b,k,n,r,function(c,d){var e=a.keyName(c),f=b.getOption("extraKeys"),e=f&&f[e]||a.keyMap[b.getOption("keyMap")][e];"findNext"==e||"findPrev"==e||"findPersistentNext"==e||"findPersistentPrev"==e?(a.e_stop(c),p(b,q(b),d),b.execCommand(e)):"find"!=e&&"findPersistent"!=e||(a.e_stop(c),
r(d,c))});f&&n&&(p(b,e,n),m(b,c))}else l(b,k,"Search for:",n,function(a){a&&!e.query&&b.operation(function(){p(b,e,a);e.posFrom=e.posTo=b.getCursor();m(b,c)})})}function m(b,d,e){b.operation(function(){var f=q(b),g=c(b,f.query,d?f.posFrom:f.posTo);(g.find(d)||(g=c(b,f.query,d?a.Pos(b.lastLine()):a.Pos(b.firstLine(),0)),g.find(d)))&&(b.setSelection(g.from(),g.to()),b.scrollIntoView({from:g.from(),to:g.to()},20),f.posFrom=g.from(),f.posTo=g.to(),e&&e(g.from(),g.to()))})}function d(b){b.operation(function(){var a=
q(b);(a.lastQuery=a.query)&&(a.query=a.queryText=null,b.removeOverlay(a.overlay),a.annotate&&(a.annotate.clear(),a.annotate=null))})}function b(b,a,d){b.operation(function(){for(var e=c(b,a);e.findNext();)if("string"!=typeof a){var f=b.getRange(e.from(),e.to()).match(a);e.replace(d.replace(/\$(\d)/g,function(b,a){return f[a]}))}else e.replace(d)})}function e(a,e){if(!a.getOption("readOnly")){var g=a.getSelection()||q(a).lastQuery,k='\x3cspan class\x3d"CodeMirror-search-label"\x3e'+(e?"Replace all:":
"Replace:")+"\x3c/span\x3e";l(a,k+f,k,g,function(f){f&&(f=w(f),l(a,C,"Replace with:","",function(g){if(g=v(g),e)b(a,f,g);else{d(a);var k=c(a,f,a.getCursor("from")),l=function(){var d,e=k.from();!(d=k.findNext())&&(k=c(a,f),!(d=k.findNext())||e&&k.from().line==e.line&&k.from().ch==e.ch)||(a.setSelection(k.from(),k.to()),a.scrollIntoView({from:k.from(),to:k.to()}),r(a,D,"Replace?",[function(){m(d)},l,function(){b(a,f,g)}]))},m=function(a){k.replace("string"==typeof f?g:g.replace(/\$(\d)/g,function(b,
c){return a[c]}));l()};l()}}))})}}var k='\x3cspan class\x3d"CodeMirror-search-label"\x3eSearch:\x3c/span\x3e \x3cinput type\x3d"text" style\x3d"width: 10em" class\x3d"CodeMirror-search-field"/\x3e \x3cspan style\x3d"color: #888" class\x3d"CodeMirror-search-hint"\x3e(Use /re/ syntax for regexp search)\x3c/span\x3e',f=' \x3cinput type\x3d"text" style\x3d"width: 10em" class\x3d"CodeMirror-search-field"/\x3e \x3cspan style\x3d"color: #888" class\x3d"CodeMirror-search-hint"\x3e(Use /re/ syntax for regexp search)\x3c/span\x3e',
C='\x3cspan class\x3d"CodeMirror-search-label"\x3eWith:\x3c/span\x3e \x3cinput type\x3d"text" style\x3d"width: 10em" class\x3d"CodeMirror-search-field"/\x3e',D='\x3cspan class\x3d"CodeMirror-search-label"\x3eReplace?\x3c/span\x3e \x3cbutton\x3eYes\x3c/button\x3e \x3cbutton\x3eNo\x3c/button\x3e \x3cbutton\x3eAll\x3c/button\x3e \x3cbutton\x3eStop\x3c/button\x3e';a.commands.find=function(a){d(a);y(a)};a.commands.findPersistent=function(a){d(a);y(a,!1,!0)};a.commands.findPersistentNext=function(a){y(a,
!1,!0,!0)};a.commands.findPersistentPrev=function(a){y(a,!0,!0,!0)};a.commands.findNext=y;a.commands.findPrev=function(a){y(a,!0)};a.commands.clearSearch=d;a.commands.replace=e;a.commands.replaceAll=function(a){e(a,!0)}});(function(a){"function"==typeof a.define&&a.define("addonSearch",["addon/search/search.js"],function(){})})(this);