var isSame;!function(t){"object"==typeof exports&&"object"==typeof module?t(require("codemirror")):"function"==typeof define&&define.amd?define(["codemirror"],mod):t(CodeMirror)}((function(t){"use strict";var e=/[\w?.,%]+/;t.registerHelper("hint","anyword",(function(n,i){for(var o=i&&i.word||e,r=i&&i.range||500,s=i&&i.extraWords||EXTRAWORDS,a=n.getCursor(),c=n.getLine(a.line),l=a.ch,h=l;h&&o.test(c.charAt(h-1));)--h;var u=h!=l&&c.slice(h,l);u&&(u=u.toLowerCase()),isSame=s.some((t=>t.toLowerCase()===u));for(var f=i&&i.list||[],d={},p=new RegExp(o.source,"gi"),m=-1;m<=1;m+=2)for(var g=a.line,v=Math.min(Math.max(g+m*r,n.firstLine()),n.lastLine())+m;g!=v;g+=m){var y,C=n.getLine(g),x=(C=(C=C.replace(/\/{2}.*/g,"")).replace(/(=|-|\+|\*|<|>)\d+/g,"")).match(/\w+(?:,(\S+)){2}/);for(x&&(C=C.replace(x[1]," "+x[1])),C.includes("#")&&(p=new RegExp(/[\w?#.,%]+/,"gi"));y=p.exec(C);)g==a.line&&y[0].toLowerCase()===u||u&&0!=y[0].toLowerCase().lastIndexOf(u,0)||Object.prototype.hasOwnProperty.call(d,y[0])||(d[y[0]]=!0,f.push(y[0]))}f.sort(),f.reverse();let b=new Map(f.map((t=>[t.toLowerCase(),t])));(f=[...b.values()]).sort();var w=s.filter((t=>t.toLowerCase().startsWith(u||"")));w.sort(),f=f.concat(w);let N=new Map(f.map((t=>[t.toLowerCase(),t])));return(f=[...N.values()]).sort((function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())})),{list:f,from:t.Pos(a.line,h),to:t.Pos(a.line,l)}}))})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("codemirror")):"function"==typeof define&&define.amd?define(["codemirror"],mod):t(CodeMirror)}((function(t){"use strict";function e(e,n){if(this.cm=e,this.options=n,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length,this.options.updateOnCursorActivity){var i=this;e.on("cursorActivity",this.activityFunc=function(){i.cursorActivity()})}t.signal(this,"startCompletion",this)}t.showHint=function(t,e,n){if(!e)return t.showHint(n);n&&n.async&&(e.async=!0);var i={hint:e};if(n)for(var o in n)i[o]=n[o];return t.showHint(i)},t.defineExtension("showHint",(function(n){n=function(t,e,n){var i=t.options.hintOptions,o={};for(var r in c)o[r]=c[r];if(i)for(var r in i)void 0!==i[r]&&(o[r]=i[r]);if(n)for(var r in n)void 0!==n[r]&&(o[r]=n[r]);o.hint.resolve&&(o.hint=o.hint.resolve(t,e));return o}(this,this.getCursor("start"),n);var i=this.listSelections();if(!(i.length>1)){if(this.somethingSelected()){if(!n.hint.supportsSelection)return;for(var o=0;ol.clientHeight+1;if(setTimeout((function(){H=s.getScrollInfo()})),L.bottom-E>0){var k=L.bottom-L.top;if(v.top-(v.bottom-L.top)-k>0)l.style.top=(C=v.top-k-w)+"px",x=!1;else if(k>E){l.style.height=E-5+"px",l.style.top=(C=v.bottom-L.top-w)+"px";var A=s.getCursor();n.from.ch!=A.ch&&(v=s.cursorCoords(A),l.style.left=(y=v.left-b)+"px",L=l.getBoundingClientRect())}}var P,F=L.right-M;if(T&&(F+=s.display.nativeBarWidth),F>0&&(L.right-L.left>M&&(l.style.width=M-5+"px",F-=L.right-L.left-M),l.style.left=(y=v.left-F-b)+"px"),T)for(var q=l.firstChild;q;q=q.nextSibling)q.style.paddingRight=s.display.nativeBarWidth+"px";(s.addKeyMap(this.keyMap=function(t,e){var n={Up:function(){e.moveFocus(-1)},Down:function(){e.moveFocus(1)},PageUp:function(){e.moveFocus(1-e.menuSize(),!0)},PageDown:function(){e.moveFocus(e.menuSize()-1,!0)},Home:function(){e.setFocus(0)},End:function(){e.setFocus(e.length-1)},Enter:e.pick,Tab:e.pick,Esc:e.close},i=/Mac/.test(navigator.platform);isSame&&(n.Space=e.pick,n[","]=e.pick),i&&(n["Ctrl-P"]=function(){e.moveFocus(-1)},n["Ctrl-N"]=function(){e.moveFocus(1)});var o=t.options.customKeys,r=o?{}:n;function s(t,i){var o;o="string"!=typeof i?function(t){return i(t,e)}:n.hasOwnProperty(i)?n[i]:i,r[t]=o}if(o)for(var a in o)o.hasOwnProperty(a)&&s(a,o[a]);var c=t.options.extraKeys;if(c)for(var a in c)c.hasOwnProperty(a)&&s(a,c[a]);return r}(e,{moveFocus:function(t,e){i.changeActive(i.selectedHint+t,e)},setFocus:function(t){i.changeActive(t)},menuSize:function(){return i.screenAmount()},length:u.length,close:function(){e.close()},pick:function(){i.pick()},data:n})),e.options.closeOnUnfocus)&&(s.on("blur",this.onBlur=function(){P=setTimeout((function(){e.close()}),100)}),s.on("focus",this.onFocus=function(){clearTimeout(P)}));s.on("scroll",this.onScroll=function(){var t=s.getScrollInfo(),n=s.getWrapperElement().getBoundingClientRect();H||(H=s.getScrollInfo());var i=C+H.top-t.top,o=i-(c.pageYOffset||(a.documentElement||a.body).scrollTop);if(x||(o+=l.offsetHeight),o<=n.top||o>=n.bottom)return e.close();l.style.top=i+"px",l.style.left=y+H.left-t.left+"px"}),t.on(l,"dblclick",(function(t){var e=r(l,t.target||t.srcElement);e&&null!=e.hintId&&(i.changeActive(e.hintId),i.pick())})),t.on(l,"click",(function(t){var n=r(l,t.target||t.srcElement);n&&null!=n.hintId&&(i.changeActive(n.hintId),e.options.completeOnSingleClick&&i.pick())})),t.on(l,"mousedown",(function(){setTimeout((function(){s.focus()}),20)}));var R=this.getSelectedHintRange();return 0===R.from&&0===R.to||this.scrollToActive(),t.signal(n,"select",u[this.selectedHint],l.childNodes[this.selectedHint]),!0}function a(t,e,n,i){if(t.async)t(e,i,n);else{var o=t(e,n);o&&o.then?o.then(i):i(o)}}e.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.options.updateOnCursorActivity&&this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&t.signal(this.data,"close"),this.widget&&this.widget.close(),t.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(e,n){var i=e.list[n],r=this;this.cm.operation((function(){i.hint?i.hint(r.cm,e,i):r.cm.replaceRange(o(i),i.from||e.from,i.to||e.to,"complete"),t.signal(e,"pick",i),r.cm.scrollIntoView()})),this.options.closeOnPick&&this.close()},cursorActivity:function(){this.debounce&&(i(this.debounce),this.debounce=0);var t=this.startPos;this.data&&(t=this.data.from);var e=this.cm.getCursor(),o=this.cm.getLine(e.line);if(e.line!=this.startPos.line||o.length-e.ch!=this.startLen-this.startPos.ch||e.ch0?" ".repeat(o):""),isSame&&"Space"===nameKey?"If"===this.data.list[0]?this.data.list[0]=this.data.list[0]+" ":"Do"!=this.data.list[0]&&(this.data.list[0]=this.data.list[0]+" ",isSame=!1,t=0):isSame&&"Enter"===nameKey?("If"===this.data.list[0]?(this.data.list[0]=this.data.list[0]+" \n"+e+"Endif",t=1):"On"===this.data.list[0]?(this.data.list[0]=this.data.list[0]+" Do\n\nEndon",t=2):"Do"===this.data.list[0]?(this.data.list[0]=this.data.list[0]+"\n\nEndon",t=2.2):(this.data.list[0]=this.data.list[0]+"\n"+n,t=0),isSame=!1):isSame&&","===nameKey&&(this.data.list[0]=this.data.list[0]+",",t=0,isSame=!1),"LogEntry"===this.data.list[this.selectedHint]&&(this.data.list[this.selectedHint]=this.data.list[this.selectedHint]+",''",t=3),this.completion.pick(this.data,this.selectedHint);var r=rEdit.getCursor().line,s=rEdit.getCursor().ch;if(1===t)rEdit.setCursor({line:r-1});else if(2===t)for(rEdit.setCursor({line:r-1}),rEdit.execCommand("insertSoftTab"),rEdit.setCursor({line:r-2,ch:i+1});rEdit.getCursor().ch>3;)rEdit.execCommand("indentLess");else 2.2===t?(rEdit.setCursor({line:r-1}),rEdit.execCommand("insertSoftTab")):3===t&&rEdit.setCursor({line:r,ch:s-1})},changeActive:function(e,n){if(e>=this.data.list.length?e=n?this.data.list.length-1:0:e<0&&(e=n?0:this.data.list.length-1),this.selectedHint!=e){var i=this.hints.childNodes[this.selectedHint];i&&(i.className=i.className.replace(" CodeMirror-hint-active",""),i.removeAttribute("aria-selected")),(i=this.hints.childNodes[this.selectedHint=e]).className+=" CodeMirror-hint-active",i.setAttribute("aria-selected","true"),this.completion.cm.getInputField().setAttribute("aria-activedescendant",i.id),this.scrollToActive(),t.signal(this.data,"select",this.data.list[this.selectedHint],i)}},scrollToActive:function(){var t=this.getSelectedHintRange(),e=this.hints.childNodes[t.from],n=this.hints.childNodes[t.to],i=this.hints.firstChild;e.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=n.offsetTop+n.offsetHeight-this.hints.clientHeight+i.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var t=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-t),to:Math.min(this.data.list.length-1,this.selectedHint+t)}}},t.registerHelper("hint","auto",{resolve:function(e,n){var i,o=e.getHelpers(n,"hint");if(o.length){var r=function(t,e,n){var i=function(t,e){if(!t.somethingSelected())return e;for(var n=[],i=0;i0?e(t):o(r+1)}))}(0)};return r.async=!0,r.supportsSelection=!0,r}return(i=e.getHelper(e.getCursor(),"hintWords"))?function(e){return t.hint.fromList(e,{words:i})}:t.hint.anyword?function(e,n){return t.hint.anyword(e,n)}:function(){}}}),t.registerHelper("hint","fromList",(function(e,n){var i,o=e.getCursor(),r=e.getTokenAt(o),s=t.Pos(o.line,r.start),a=o;r.start]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};t.defineOption("hintOptions",null)})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],t):t(CodeMirror)}((function(t){"use strict";function e(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function n(t){return t.state.search||(t.state.search=new e)}function i(t){return"string"==typeof t&&t==t.toLowerCase()}function o(t,e,n){return t.getSearchCursor(e,n,{caseFold:i(e),multiline:!0})}function r(t,e,n,i,o){t.openDialog?t.openDialog(e,o,{value:i,selectValueOnOpen:!0,bottom:t.options.search.bottom}):o(prompt(n,i))}function s(t){return t.replace(/\\([nrt\\])/g,(function(t,e){return"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\"==e?"\\":t}))}function a(t){var e=t.match(/^\/(.*)\/([a-z]*)$/);if(e)try{t=new RegExp(e[1],-1==e[2].indexOf("i")?"":"i")}catch(t){}else t=s(t);return("string"==typeof t?""==t:t.test(""))&&(t=/x^/),t}function c(t,e,n){e.queryText=n,e.query=a(n),t.removeOverlay(e.overlay,i(e.query)),e.overlay=function(t,e){return"string"==typeof t?t=new RegExp(t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),e?"gi":"g"):t.global||(t=new RegExp(t.source,t.ignoreCase?"gi":"g")),{token:function(e){t.lastIndex=e.pos;var n=t.exec(e.string);if(n&&n.index==e.pos)return e.pos+=n[0].length||1,"searching";n?e.pos=n.index:e.skipToEnd()}}}(e.query,i(e.query)),t.addOverlay(e.overlay),t.showMatchesOnScrollbar&&(e.annotate&&(e.annotate.clear(),e.annotate=null),e.annotate=t.showMatchesOnScrollbar(e.query,i(e.query)))}function l(e,i,o,s){var a=n(e);if(a.query)return h(e,i);var l=e.getSelection()||a.lastQuery;if(l instanceof RegExp&&"x^"==l.source&&(l=null),o&&e.openDialog){var f=null,p=function(n,i){t.e_stop(i),n&&(n!=a.queryText&&(c(e,a,n),a.posFrom=a.posTo=e.getCursor()),f&&(f.style.opacity=1),h(e,i.shiftKey,(function(t,n){var i;n.line<3&&document.querySelector&&(i=e.display.wrapper.querySelector(".CodeMirror-dialog"))&&i.getBoundingClientRect().bottom-4>e.cursorCoords(n,"window").top&&((f=i).style.opacity=.4)})))};!function(t,e,n,i,o){t.openDialog(e,i,{value:n,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){u(t)},onKeyUp:o,bottom:t.options.search.bottom})}(e,d(e),l,p,(function(i,o){var r=t.keyName(i);"Enter"!=r&&o!=a.queryText&&(c(e,a,o),e.execCommand("goLineUp"),a.posFrom=a.posTo=e.getCursor(),h(e,i.shiftKey));var s=e.getOption("extraKeys"),l=s&&s[r]||t.keyMap[e.getOption("keyMap")][r];"findNext"==l||"findPrev"==l||"findPersistentNext"==l||"findPersistentPrev"==l?(t.e_stop(i),c(e,n(e),o),e.execCommand(l)):"find"!=l&&"findPersistent"!=l||(t.e_stop(i),p(o,i))})),s&&l&&(c(e,a,l),h(e,i))}else r(e,d(e),"Search for:",l,(function(t){t&&!a.query&&e.operation((function(){c(e,a,t),a.posFrom=a.posTo=e.getCursor(),h(e,i)}))}))}function h(e,i,r){e.operation((function(){const s=n(e);let a=o(e,s.query,i?s.posFrom:s.posTo);var c,l;(a.find(i)||(a=o(e,s.query,i?t.Pos(e.lastLine()):t.Pos(e.firstLine(),0)),a.find(i)))&&(c=a.from(),l=a.to(),e.__searchNextHighlight&&e.__searchNextHighlight.clear(),e.__searchNextHighlight=e.markText(c,l,{className:"search-next-highlight"}),e.setSelection(a.from(),a.to()),e.scrollTo(null,e.charCoords(a.from(),"local").top),s.posFrom=a.from(),s.posTo=a.to(),r&&r(a.from(),a.to()))}))}function u(t){t.operation((function(){var e=n(t);e.lastQuery=e.query,e.query&&(e.query=e.queryText=null,t.removeOverlay(e.overlay),e.annotate&&(e.annotate.clear(),e.annotate=null))}))}function f(t,e){var n=t?document.createElement(t):document.createDocumentFragment();for(var i in e)n[i]=e[i];for(var o=2;oh);u++){var f=t.getLine(l++);a=null==a?f:a+"\n"+f}c*=2,e.lastIndex=n.ch;var d=e.exec(a);if(d){var p=a.slice(0,d.index).split("\n"),m=d[0].split("\n"),g=n.line+p.length-1,v=p[p.length-1].length;return{from:i(g,v),to:i(g+m.length-1,1==m.length?v+m[0].length:m[m.length-1].length),match:d}}}}function c(t,e,n){for(var i,o=0;o<=t.length;){e.lastIndex=o;var r=e.exec(t);if(!r)break;var s=r.index+r[0].length;if(s>t.length-n)break;(!i||s>i.index+i[0].length)&&(i=r),o=r.index+1}return i}function l(t,e,n){e=o(e,"g");for(var r=n.line,s=n.ch,a=t.firstLine();r>=a;r--,s=-1){var l=t.getLine(r),h=c(l,e,s<0?0:l.length-s);if(h)return{from:i(r,h.index),to:i(r,h.index+h[0].length),match:h}}}function h(t,e,n){if(!r(e))return l(t,e,n);e=o(e,"gm");for(var s,a=1,h=t.getLine(n.line).length-n.ch,u=n.line,f=t.firstLine();u>=f;){for(var d=0;d=f;d++){var p=t.getLine(u--);s=null==s?p:p+"\n"+s}a*=2;var m=c(s,e,h);if(m){var g=s.slice(0,m.index).split("\n"),v=m[0].split("\n"),y=u+g.length,C=g[g.length-1].length;return{from:i(y,C),to:i(y+v.length-1,1==v.length?C+v[0].length:v[v.length-1].length),match:m}}}}function u(t,e,n,i){if(t.length==e.length)return n;for(var o=0,r=n+Math.max(0,t.length-e.length);;){if(o==r)return o;var s=o+r>>1,a=i(t.slice(0,s)).length;if(a==n)return s;a>n?r=s:o=s+1}}function f(t,o,r,s){if(!o.length)return null;var a=s?e:n,c=a(o).split(/\r|\n\r?/);t:for(var l=r.line,h=r.ch,f=t.lastLine()+1-c.length;l<=f;l++,h=0){var d=t.getLine(l).slice(h),p=a(d);if(1==c.length){var m=p.indexOf(c[0]);if(-1==m)continue t;r=u(d,p,m,a)+h;return{from:i(l,u(d,p,m,a)+h),to:i(l,u(d,p,m+c[0].length,a)+h)}}var g=p.length-c[0].length;if(p.slice(g)==c[0]){for(var v=1;v=f;l--,h=-1){var d=t.getLine(l);h>-1&&(d=d.slice(0,h));var p=a(d);if(1==c.length){var m=p.lastIndexOf(c[0]);if(-1==m)continue t;return{from:i(l,u(d,p,m,a)),to:i(l,u(d,p,m+c[0].length,a))}}var g=c[c.length-1];if(p.slice(0,g.length)==g){var v=1;for(r=l-c.length+1;v(this.doc.getLine(n.line)||"").length&&(n.ch=0,n.line++)),0!=t.cmpPos(n,this.doc.clipPos(n))))return this.atOccurrence=!1;var o=this.matches(e,n);if(this.afterEmptyMatch=o&&0==t.cmpPos(o.from,o.to),o)return this.pos=o,this.atOccurrence=!0,this.pos.match||!0;var r=i(e?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:r,to:r},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(e,n){if(this.atOccurrence){var o=t.splitLines(e);this.doc.replaceRange(o,this.pos.from,this.pos.to,n),this.pos.to=i(this.pos.from.line+o.length-1,o[o.length-1].length+(1==o.length?this.pos.from.ch:0))}}},t.defineExtension("getSearchCursor",(function(t,e,n){return new p(this.doc,t,e,n)})),t.defineDocExtension("getSearchCursor",(function(t,e,n){return new p(this,t,e,n)})),t.defineExtension("selectMatches",(function(e,n){for(var i=[],o=this.getSearchCursor(e,this.getCursor("from"),n);o.findNext()&&!(t.cmpPos(o.to(),this.getCursor("to"))>0);)i.push({anchor:o.from(),head:o.to()});i.length&&this.setSelections(i,0)}))})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}((function(t){function e(e,n,i){var o,r=document.body;return(o=r.appendChild(document.createElement("div"))).className=i?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof n?o.innerHTML=n:o.appendChild(n),t.addClass(r,"dialog-opened"),o}function n(t,e){t.state.currentNotificationClose&&t.state.currentNotificationClose(),t.state.currentNotificationClose=e}t.defineExtension("openDialog",(function(i,o,r){r||(r={}),n(this,null);var s=e(0,i,r.bottom),a=!1,c=this;function l(e){if("string"==typeof e)u.value=e;else{if(a)return;a=!0,t.rmClass(s.parentNode,"dialog-opened"),s.parentNode.removeChild(s),c.focus(),r.onClose&&r.onClose(s)}}var h,u=s.getElementsByTagName("input")[0];return u?(u.focus(),r.value&&(u.value=r.value,!1!==r.selectValueOnOpen&&u.select()),r.onInput&&t.on(u,"input",(function(t){r.onInput(t,u.value,l)})),r.onKeyUp&&t.on(u,"keyup",(function(t){r.onKeyUp(t,u.value,l)})),t.on(u,"keydown",(function(e){r&&r.onKeyDown&&r.onKeyDown(e,u.value,l)||((27==e.keyCode||!1!==r.closeOnEnter&&13==e.keyCode)&&(u.blur(),t.e_stop(e),l()),13==e.keyCode&&o(u.value,e))})),!1!==r.closeOnBlur&&t.on(s,"focusout",(function(t){null!==t.relatedTarget&&l()}))):(h=s.getElementsByTagName("button")[0])&&(t.on(h,"click",(function(){l(),c.focus()})),!1!==r.closeOnBlur&&t.on(h,"blur",l),h.focus()),l})),t.defineExtension("openConfirm",(function(i,o,r){n(this,null);var s=e(0,i,r&&r.bottom),a=s.getElementsByTagName("button"),c=!1,l=this,h=1;function u(){c||(c=!0,t.rmClass(s.parentNode,"dialog-opened"),s.parentNode.removeChild(s),l.focus())}a[0].focus();for(var f=0;f