ext-language_tools-819757f6.js 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import{g as Q}from"./index-b2e76ed2.js";function q(V,K){for(var v=0;v<K.length;v++){const C=K[v];if(typeof C!="string"&&!Array.isArray(C)){for(const I in C)if(I!=="default"&&!(I in V)){const R=Object.getOwnPropertyDescriptor(C,I);R&&Object.defineProperty(V,I,R.get?R:{enumerable:!0,get:()=>C[I]})}}}return Object.freeze(Object.defineProperty(V,Symbol.toStringTag,{value:"Module"}))}var Y={exports:{}};(function(V,K){ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"],function(v,C,I){var R=v("./lib/dom"),E=v("./lib/oop"),L=v("./lib/event_emitter").EventEmitter,S=v("./lib/lang"),x=v("./range").Range,y=v("./range_list").RangeList,M=v("./keyboard/hash_handler").HashHandler,O=v("./tokenizer").Tokenizer,k=v("./clipboard"),P={CURRENT_WORD:function(o){return o.session.getTextRange(o.session.getWordRange())},SELECTION:function(o,n,e){var s=o.session.getTextRange();return e?s.replace(/\n\r?([ \t]*\S)/g,`
  2. `+e+"$1"):s},CURRENT_LINE:function(o){return o.session.getLine(o.getCursorPosition().row)},PREV_LINE:function(o){return o.session.getLine(o.getCursorPosition().row-1)},LINE_INDEX:function(o){return o.getCursorPosition().row},LINE_NUMBER:function(o){return o.getCursorPosition().row+1},SOFT_TABS:function(o){return o.session.getUseSoftTabs()?"YES":"NO"},TAB_SIZE:function(o){return o.session.getTabSize()},CLIPBOARD:function(o){return k.getText&&k.getText()},FILENAME:function(o){return/[^/\\]*$/.exec(this.FILEPATH(o))[0]},FILENAME_BASE:function(o){return/[^/\\]*$/.exec(this.FILEPATH(o))[0].replace(/\.[^.]*$/,"")},DIRECTORY:function(o){return this.FILEPATH(o).replace(/[^/\\]*$/,"")},FILEPATH:function(o){return"/not implemented.txt"},WORKSPACE_NAME:function(){return"Unknown"},FULLNAME:function(){return"Unknown"},BLOCK_COMMENT_START:function(o){var n=o.session.$mode||{};return n.blockComment&&n.blockComment.start||""},BLOCK_COMMENT_END:function(o){var n=o.session.$mode||{};return n.blockComment&&n.blockComment.end||""},LINE_COMMENT:function(o){var n=o.session.$mode||{};return n.lineCommentStart||""},CURRENT_YEAR:T.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:T.bind(null,{year:"2-digit"}),CURRENT_MONTH:T.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:T.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:T.bind(null,{month:"short"}),CURRENT_DATE:T.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:T.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:T.bind(null,{weekday:"short"}),CURRENT_HOUR:T.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:T.bind(null,{minute:"2-digit"}),CURRENT_SECOND:T.bind(null,{second:"2-digit"})};P.SELECTED_TEXT=P.SELECTION;function T(o){var n=new Date().toLocaleString("en-us",o);return n.length==1?"0"+n:n}var A=function(){function o(){this.snippetMap={},this.snippetNameMap={},this.variables=P}return o.prototype.getTokenizer=function(){return o.$tokenizer||this.createTokenizer()},o.prototype.createTokenizer=function(){function n(t){return t=t.substr(1),/^\d+$/.test(t)?[{tabstopId:parseInt(t,10)}]:[{text:t}]}function e(t){return"(?:[^\\\\"+t+"]|\\\\.)"}var s={regex:"/("+e("/")+"+)/",onMatch:function(t,r,l){var a=l[0];return a.fmtString=!0,a.guard=t.slice(1,-1),a.flag="",""},next:"formatString"};return o.$tokenizer=new O({start:[{regex:/\\./,onMatch:function(t,r,l){var a=t[1];return(a=="}"&&l.length||"`$\\".indexOf(a)!=-1)&&(t=a),[t]}},{regex:/}/,onMatch:function(t,r,l){return[l.length?l.shift():t]}},{regex:/\$(?:\d+|\w+)/,onMatch:n},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(t,r,l){var a=n(t.substr(1));return l.unshift(a[0]),a},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+e("\\|")+"*\\|",onMatch:function(t,r,l){var a=t.slice(1,-1).replace(/\\[,|\\]|,/g,function(f){return f.length==2?f[1]:"\0"}).split("\0").map(function(f){return{value:f}});return l[0].choices=a,[a[0]]},next:"start"},s,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(t,r,l){return l.length&&l[0].expectElse?(l[0].expectElse=!1,l[0].ifEnd={elseEnd:l[0]},[l[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(t,r,l){var a=t[1];return a=="}"&&l.length||"`$\\".indexOf(a)!=-1?t=a:a=="n"?t=`
  3. `:a=="t"?t=" ":"ulULE".indexOf(a)!=-1&&(t={changeCase:a,local:a>"a"}),[t]}},{regex:"/\\w*}",onMatch:function(t,r,l){var a=l.shift();return a&&(a.flag=t.slice(1,-1)),this.next=a&&a.tabstopId?"start":"",[a||t]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(t,r,l){return[{text:t.slice(1)}]}},{regex:/\${\w+/,onMatch:function(t,r,l){var a={text:t.slice(2)};return l.unshift(a),[a]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(t,r,l){var a=l.shift();return this.next=a&&a.tabstopId?"start":"",[a||t]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(t,r,l){var a=l[0];return a.formatFunction=t.slice(2,-1),[l.shift()]},next:"formatString"},s,{regex:/:[\?\-+]?/,onMatch:function(t,r,l){t[1]=="+"&&(l[0].ifEnd=l[0]),t[1]=="?"&&(l[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),o.$tokenizer},o.prototype.tokenizeTmSnippet=function(n,e){return this.getTokenizer().getLineTokens(n,e).tokens.map(function(s){return s.value||s})},o.prototype.getVariableValue=function(n,e,s){if(/^\d+$/.test(e))return(this.variables.__||{})[e]||"";if(/^[A-Z]\d+$/.test(e))return(this.variables[e[0]+"__"]||{})[e.substr(1)]||"";if(e=e.replace(/^TM_/,""),!this.variables.hasOwnProperty(e))return"";var t=this.variables[e];return typeof t=="function"&&(t=this.variables[e](n,e,s)),t??""},o.prototype.tmStrFormat=function(n,e,s){if(!e.fmt)return n;var t=e.flag||"",r=e.guard;r=new RegExp(r,t.replace(/[^gim]/g,""));var l=typeof e.fmt=="string"?this.tokenizeTmSnippet(e.fmt,"formatString"):e.fmt,a=this,f=n.replace(r,function(){var u=a.variables.__;a.variables.__=[].slice.call(arguments);for(var m=a.resolveVariables(l,s),d="E",b=0;b<m.length;b++){var g=m[b];if(typeof g=="object")if(m[b]="",g.changeCase&&g.local){var w=m[b+1];w&&typeof w=="string"&&(g.changeCase=="u"?m[b]=w[0].toUpperCase():m[b]=w[0].toLowerCase(),m[b+1]=w.substr(1))}else g.changeCase&&(d=g.changeCase);else d=="U"?m[b]=g.toUpperCase():d=="L"&&(m[b]=g.toLowerCase())}return a.variables.__=u,m.join("")});return f},o.prototype.tmFormatFunction=function(n,e,s){return e.formatFunction=="upcase"?n.toUpperCase():e.formatFunction=="downcase"?n.toLowerCase():n},o.prototype.resolveVariables=function(n,e){for(var s=[],t="",r=!0,l=0;l<n.length;l++){var a=n[l];if(typeof a=="string"){s.push(a),a==`
  4. `?(r=!0,t=""):r&&(t=/^\t*/.exec(a)[0],r=/\S/.test(a));continue}if(a){if(r=!1,a.fmtString){var f=n.indexOf(a,l+1);f==-1&&(f=n.length),a.fmt=n.slice(l+1,f),l=f}if(a.text){var u=this.getVariableValue(e,a.text,t)+"";a.fmtString&&(u=this.tmStrFormat(u,a,e)),a.formatFunction&&(u=this.tmFormatFunction(u,a,e)),u&&!a.ifEnd?(s.push(u),m(a)):!u&&a.ifEnd&&m(a.ifEnd)}else a.elseEnd?m(a.elseEnd):(a.tabstopId!=null||a.changeCase!=null)&&s.push(a)}}function m(d){var b=n.indexOf(d,l+1);b!=-1&&(l=b)}return s},o.prototype.getDisplayTextForSnippet=function(n,e){var s=$.call(this,n,e);return s.text},o.prototype.insertSnippetForSelection=function(n,e,s){s===void 0&&(s={});var t=$.call(this,n,e,s),r=n.getSelectionRange();s.range&&s.range.compareRange(r)===0&&(r=s.range);var l=n.session.replace(r,t.text),a=new i(n),f=n.inVirtualSelectionMode&&n.selection.index;a.addTabstops(t.tabstops,r.start,l,f)},o.prototype.insertSnippet=function(n,e,s){s===void 0&&(s={});var t=this;if(s.range&&!(s.range instanceof x)&&(s.range=x.fromPoints(s.range.start,s.range.end)),n.inVirtualSelectionMode)return t.insertSnippetForSelection(n,e,s);n.forEachSelection(function(){t.insertSnippetForSelection(n,e,s)},null,{keepOrder:!0}),n.tabstopManager&&n.tabstopManager.tabNext()},o.prototype.$getScope=function(n){var e=n.session.$mode.$id||"";if(e=e.split("/").pop(),e==="html"||e==="php"){e==="php"&&!n.session.$mode.inlinePhp&&(e="html");var s=n.getCursorPosition(),t=n.session.getState(s.row);typeof t=="object"&&(t=t[0]),t.substring&&(t.substring(0,3)=="js-"?e="javascript":t.substring(0,4)=="css-"?e="css":t.substring(0,4)=="php-"&&(e="php"))}return e},o.prototype.getActiveScopes=function(n){var e=this.$getScope(n),s=[e],t=this.snippetMap;return t[e]&&t[e].includeScopes&&s.push.apply(s,t[e].includeScopes),s.push("_"),s},o.prototype.expandWithTab=function(n,e){var s=this,t=n.forEachSelection(function(){return s.expandSnippetForSelection(n,e)},null,{keepOrder:!0});return t&&n.tabstopManager&&n.tabstopManager.tabNext(),t},o.prototype.expandSnippetForSelection=function(n,e){var s=n.getCursorPosition(),t=n.session.getLine(s.row),r=t.substring(0,s.column),l=t.substr(s.column),a=this.snippetMap,f;return this.getActiveScopes(n).some(function(u){var m=a[u];return m&&(f=this.findMatchingSnippet(m,r,l)),!!f},this),f?(e&&e.dryRun||(n.session.doc.removeInLine(s.row,s.column-f.replaceBefore.length,s.column+f.replaceAfter.length),this.variables.M__=f.matchBefore,this.variables.T__=f.matchAfter,this.insertSnippetForSelection(n,f.content),this.variables.M__=this.variables.T__=null),!0):!1},o.prototype.findMatchingSnippet=function(n,e,s){for(var t=n.length;t--;){var r=n[t];if(!(r.startRe&&!r.startRe.test(e))&&!(r.endRe&&!r.endRe.test(s))&&!(!r.startRe&&!r.endRe))return r.matchBefore=r.startRe?r.startRe.exec(e):[""],r.matchAfter=r.endRe?r.endRe.exec(s):[""],r.replaceBefore=r.triggerRe?r.triggerRe.exec(e)[0]:"",r.replaceAfter=r.endTriggerRe?r.endTriggerRe.exec(s)[0]:"",r}},o.prototype.register=function(n,e){var s=this.snippetMap,t=this.snippetNameMap,r=this;n||(n=[]);function l(u){return u&&!/^\^?\(.*\)\$?$|^\\b$/.test(u)&&(u="(?:"+u+")"),u||""}function a(u,m,d){return u=l(u),m=l(m),d?(u=m+u,u&&u[u.length-1]!="$"&&(u=u+"$")):(u=u+m,u&&u[0]!="^"&&(u="^"+u)),new RegExp(u)}function f(u){u.scope||(u.scope=e||"_"),e=u.scope,s[e]||(s[e]=[],t[e]={});var m=t[e];if(u.name){var d=m[u.name];d&&r.unregister(d),m[u.name]=u}s[e].push(u),u.prefix&&(u.tabTrigger=u.prefix),!u.content&&u.body&&(u.content=Array.isArray(u.body)?u.body.join(`
  5. `):u.body),u.tabTrigger&&!u.trigger&&(!u.guard&&/^\w/.test(u.tabTrigger)&&(u.guard="\\b"),u.trigger=S.escapeRegExp(u.tabTrigger)),!(!u.trigger&&!u.guard&&!u.endTrigger&&!u.endGuard)&&(u.startRe=a(u.trigger,u.guard,!0),u.triggerRe=new RegExp(u.trigger),u.endRe=a(u.endTrigger,u.endGuard,!0),u.endTriggerRe=new RegExp(u.endTrigger))}Array.isArray(n)?n.forEach(f):Object.keys(n).forEach(function(u){f(n[u])}),this._signal("registerSnippets",{scope:e})},o.prototype.unregister=function(n,e){var s=this.snippetMap,t=this.snippetNameMap;function r(l){var a=t[l.scope||e];if(a&&a[l.name]){delete a[l.name];var f=s[l.scope||e],u=f&&f.indexOf(l);u>=0&&f.splice(u,1)}}n.content?r(n):Array.isArray(n)&&n.forEach(r)},o.prototype.parseSnippetFile=function(n){n=n.replace(/\r/g,"");for(var e=[],s={},t=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm,r;r=t.exec(n);){if(r[1])try{s=JSON.parse(r[1]),e.push(s)}catch{}if(r[4])s.content=r[4].replace(/^\t/gm,""),e.push(s),s={};else{var l=r[2],a=r[3];if(l=="regex"){var f=/\/((?:[^\/\\]|\\.)*)|$/g;s.guard=f.exec(a)[1],s.trigger=f.exec(a)[1],s.endTrigger=f.exec(a)[1],s.endGuard=f.exec(a)[1]}else l=="snippet"?(s.tabTrigger=a.match(/^\S*/)[0],s.name||(s.name=a)):l&&(s[l]=a)}}return e},o.prototype.getSnippetByName=function(n,e){var s=this.snippetNameMap,t;return this.getActiveScopes(e).some(function(r){var l=s[r];return l&&(t=l[n]),!!t},this),t},o}();E.implement(A.prototype,L);var $=function(o,n,e){e===void 0&&(e={});var s=o.getCursorPosition(),t=o.session.getLine(s.row),r=o.session.getTabString(),l=t.match(/^\s*/)[0];s.column<l.length&&(l=l.slice(0,s.column)),n=n.replace(/\r/g,"");var a=this.tokenizeTmSnippet(n);a=this.resolveVariables(a,o),a=a.map(function(_){return _==`
  6. `&&!e.excludeExtraIndent?_+l:typeof _=="string"?_.replace(/\t/g,r):_});var f=[];a.forEach(function(_,D){if(typeof _=="object"){var U=_.tabstopId,N=f[U];if(N||(N=f[U]=[],N.index=U,N.value="",N.parents={}),N.indexOf(_)===-1){_.choices&&!N.choices&&(N.choices=_.choices),N.push(_);var W=a.indexOf(_,D+1);if(W!==-1){var j=a.slice(D+1,W),X=j.some(function(J){return typeof J=="object"});X&&!N.value?N.value=j:j.length&&(!N.value||typeof N.value!="string")&&(N.value=j.join(""))}}}}),f.forEach(function(_){_.length=0});var u={};function m(_){for(var D=[],U=0;U<_.length;U++){var N=_[U];if(typeof N=="object"){if(u[N.tabstopId])continue;var W=_.lastIndexOf(N,U-1);N=D[W]||{tabstopId:N.tabstopId}}D[U]=N}return D}for(var d=0;d<a.length;d++){var b=a[d];if(typeof b=="object"){var g=b.tabstopId,w=f[g],H=a.indexOf(b,d+1);if(u[g]){u[g]===b&&(delete u[g],Object.keys(u).forEach(function(_){w.parents[_]=!0}));continue}u[g]=b;var F=w.value;typeof F!="string"?F=m(F):b.fmt&&(F=this.tmStrFormat(F,b,o)),a.splice.apply(a,[d+1,Math.max(0,H-d)].concat(F,b)),w.indexOf(b)===-1&&w.push(b)}}var z=0,B=0,G="";return a.forEach(function(_){if(typeof _=="string"){var D=_.split(`
  7. `);D.length>1?(B=D[D.length-1].length,z+=D.length-1):B+=_.length,G+=_}else _&&(_.start?_.end={row:z,column:B}:_.start={row:z,column:B})}),{text:G,tabstops:f,tokens:a}},i=function(){function o(n){if(this.index=0,this.ranges=[],this.tabstops=[],n.tabstopManager)return n.tabstopManager;n.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=S.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(n)}return o.prototype.attach=function(n){this.$openTabstops=null,this.selectedTabstop=null,this.editor=n,this.session=n.session,this.editor.on("change",this.$onChange),this.editor.on("changeSelection",this.$onChangeSelection),this.editor.on("changeSession",this.$onChangeSession),this.editor.commands.on("afterExec",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},o.prototype.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges.length=0,this.tabstops.length=0,this.selectedTabstop=null,this.editor.off("change",this.$onChange),this.editor.off("changeSelection",this.$onChangeSelection),this.editor.off("changeSession",this.$onChangeSession),this.editor.commands.off("afterExec",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.session=null,this.editor=null},o.prototype.onChange=function(n){for(var e=n.action[0]=="r",s=this.selectedTabstop||{},t=s.parents||{},r=this.tabstops.slice(),l=0;l<r.length;l++){var a=r[l],f=a==s||t[a.index];if(a.rangeList.$bias=f?0:1,n.action=="remove"&&a!==s){var u=a.parents&&a.parents[s.index],m=a.rangeList.pointIndex(n.start,u);m=m<0?-m-1:m+1;var d=a.rangeList.pointIndex(n.end,u);d=d<0?-d-1:d-1;for(var b=a.rangeList.ranges.slice(m,d),g=0;g<b.length;g++)this.removeRange(b[g])}a.rangeList.$onChange(n)}var w=this.session;!this.$inChange&&e&&w.getLength()==1&&!w.getValue()&&this.detach()},o.prototype.updateLinkedFields=function(){var n=this.selectedTabstop;if(!(!n||!n.hasLinkedRanges||!n.firstNonLinked)){this.$inChange=!0;for(var e=this.session,s=e.getTextRange(n.firstNonLinked),t=0;t<n.length;t++){var r=n[t];if(r.linked){var l=r.original,a=C.snippetManager.tmStrFormat(s,l,this.editor);e.replace(r,a)}}this.$inChange=!1}},o.prototype.onAfterExec=function(n){n.command&&!n.command.readOnly&&this.updateLinkedFields()},o.prototype.onChangeSelection=function(){if(this.editor){for(var n=this.editor.selection.lead,e=this.editor.selection.anchor,s=this.editor.selection.isEmpty(),t=0;t<this.ranges.length;t++)if(!this.ranges[t].linked){var r=this.ranges[t].contains(n.row,n.column),l=s||this.ranges[t].contains(e.row,e.column);if(r&&l)return}this.detach()}},o.prototype.onChangeSession=function(){this.detach()},o.prototype.tabNext=function(n){var e=this.tabstops.length,s=this.index+(n||1);s=Math.min(Math.max(s,1),e),s==e&&(s=0),this.selectTabstop(s),s===0&&this.detach()},o.prototype.selectTabstop=function(n){this.$openTabstops=null;var e=this.tabstops[this.index];if(e&&this.addTabstopMarkers(e),this.index=n,e=this.tabstops[this.index],!(!e||!e.length)){this.selectedTabstop=e;var s=e.firstNonLinked||e;if(e.choices&&(s.cursor=s.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(s);else{var t=this.editor.multiSelect;t.toSingleRange(s);for(var r=0;r<e.length;r++)e.hasLinkedRanges&&e[r].linked||t.addRange(e[r].clone(),!0)}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler),this.selectedTabstop&&this.selectedTabstop.choices&&this.editor.execCommand("startAutocomplete",{matches:this.selectedTabstop.choices})}},o.prototype.addTabstops=function(n,e,s){var t=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!n[0]){var r=x.fromPoints(s,s);p(r.start,e),p(r.end,e),n[0]=[r],n[0].index=0}var l=this.index,a=[l+1,0],f=this.ranges;n.forEach(function(u,m){for(var d=this.$openTabstops[m]||u,b=0;b<u.length;b++){var g=u[b],w=x.fromPoints(g.start,g.end||g.start);c(w.start,e),c(w.end,e),w.original=g,w.tabstop=d,f.push(w),d!=u?d.unshift(w):d[b]=w,g.fmtString||d.firstNonLinked&&t?(w.linked=!0,d.hasLinkedRanges=!0):d.firstNonLinked||(d.firstNonLinked=w)}d.firstNonLinked||(d.hasLinkedRanges=!1),d===u&&(a.push(d),this.$openTabstops[m]=d),this.addTabstopMarkers(d),d.rangeList=d.rangeList||new y,d.rangeList.$bias=0,d.rangeList.addList(d)},this),a.length>2&&(this.tabstops.length&&a.push(a.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,a))},o.prototype.addTabstopMarkers=function(n){var e=this.session;n.forEach(function(s){s.markerId||(s.markerId=e.addMarker(s,"ace_snippet-marker","text"))})},o.prototype.removeTabstopMarkers=function(n){var e=this.session;n.forEach(function(s){e.removeMarker(s.markerId),s.markerId=null})},o.prototype.removeRange=function(n){var e=n.tabstop.indexOf(n);e!=-1&&n.tabstop.splice(e,1),e=this.ranges.indexOf(n),e!=-1&&this.ranges.splice(e,1),e=n.tabstop.rangeList.ranges.indexOf(n),e!=-1&&n.tabstop.splice(e,1),this.session.removeMarker(n.markerId),n.tabstop.length||(e=this.tabstops.indexOf(n.tabstop),e!=-1&&this.tabstops.splice(e,1),this.tabstops.length||this.detach())},o}();i.prototype.keyboardHandler=new M,i.prototype.keyboardHandler.bindKeys({Tab:function(o){C.snippetManager&&C.snippetManager.expandWithTab(o)||(o.tabstopManager.tabNext(1),o.renderer.scrollCursorIntoView())},"Shift-Tab":function(o){o.tabstopManager.tabNext(-1),o.renderer.scrollCursorIntoView()},Esc:function(o){o.tabstopManager.detach()}});var c=function(o,n){o.row==0&&(o.column+=n.column),o.row+=n.row},p=function(o,n){o.row==n.row&&(o.column-=n.column),o.row-=n.row};R.importCssString(`
  8. .ace_snippet-marker {
  9. -moz-box-sizing: border-box;
  10. box-sizing: border-box;
  11. background: rgba(194, 193, 208, 0.09);
  12. border: 1px dotted rgba(211, 208, 235, 0.62);
  13. position: absolute;
  14. }`,"snippets.css",!1),C.snippetManager=new A;var h=v("./editor").Editor;(function(){this.insertSnippet=function(o,n){return C.snippetManager.insertSnippet(this,o,n)},this.expandSnippet=function(o){return C.snippetManager.expandWithTab(this,o)}}).call(h.prototype)}),ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config"],function(v,C,I){var R=v("../virtual_renderer").VirtualRenderer,E=v("../editor").Editor,L=v("../range").Range,S=v("../lib/event"),x=v("../lib/lang"),y=v("../lib/dom"),M=v("../config").nls,O=function(T){return"suggest-aria-id:".concat(T)},k=function(T){var A=new R(T);A.$maxLines=4;var $=new E(A);return $.setHighlightActiveLine(!1),$.setShowPrintMargin(!1),$.renderer.setShowGutter(!1),$.renderer.setHighlightGutterLine(!1),$.$mouseHandler.$focusTimeout=0,$.$highlightTagPending=!0,$},P=function(){function T(A){var $=y.createElement("div"),i=new k($);A&&A.appendChild($),$.style.display="none",i.renderer.content.style.cursor="default",i.renderer.setStyle("ace_autocomplete"),i.renderer.container.setAttribute("role","listbox"),i.renderer.container.setAttribute("aria-label",M("Autocomplete suggestions")),i.setOption("displayIndentGuides",!1),i.setOption("dragDelay",150);var c=function(){};i.focus=c,i.$isFocused=!0,i.renderer.$cursorLayer.restartTimer=c,i.renderer.$cursorLayer.element.style.opacity=0,i.renderer.$maxLines=8,i.renderer.$keepTextAreaAtCursor=!1,i.setHighlightActiveLine(!1),i.session.highlight(""),i.session.$searchHighlight.clazz="ace_highlight-marker",i.on("mousedown",function(t){var r=t.getDocumentPosition();i.selection.moveToPosition(r),o.start.row=o.end.row=r.row,t.stop()});var p,h=new L(-1,0,-1,1/0),o=new L(-1,0,-1,1/0);o.id=i.session.addMarker(o,"ace_active-line","fullLine"),i.setSelectOnHover=function(t){t?h.id&&(i.session.removeMarker(h.id),h.id=null):h.id=i.session.addMarker(h,"ace_line-hover","fullLine")},i.setSelectOnHover(!1),i.on("mousemove",function(t){if(!p){p=t;return}if(!(p.x==t.x&&p.y==t.y)){p=t,p.scrollTop=i.renderer.scrollTop;var r=p.getDocumentPosition().row;h.start.row!=r&&(h.id||i.setRow(r),e(r))}}),i.renderer.on("beforeRender",function(){if(p&&h.start.row!=-1){p.$pos=null;var t=p.getDocumentPosition().row;h.id||i.setRow(t),e(t,!0)}}),i.renderer.on("afterRender",function(){var t=i.getRow(),r=i.renderer.$textLayer,l=r.element.childNodes[t-r.config.firstRow],a=document.activeElement;if(l!==r.selectedNode&&r.selectedNode&&(y.removeCssClass(r.selectedNode,"ace_selected"),a.removeAttribute("aria-activedescendant"),r.selectedNode.removeAttribute("id")),r.selectedNode=l,l){y.addCssClass(l,"ace_selected");var f=O(t);l.id=f,i.renderer.container.setAttribute("aria-activedescendant",f),a.setAttribute("aria-activedescendant",f),l.setAttribute("role","option"),l.setAttribute("aria-label",i.getData(t).value),l.setAttribute("aria-setsize",i.data.length),l.setAttribute("aria-posinset",t),l.setAttribute("aria-describedby","doc-tooltip")}});var n=function(){e(-1)},e=function(t,r){t!==h.start.row&&(h.start.row=h.end.row=t,r||i.session._emit("changeBackMarker"),i._emit("changeHoverMarker"))};i.getHoveredRow=function(){return h.start.row},S.addListener(i.container,"mouseout",n),i.on("hide",n),i.on("changeSelection",n),i.session.doc.getLength=function(){return i.data.length},i.session.doc.getLine=function(t){var r=i.data[t];return typeof r=="string"?r:r&&r.value||""};var s=i.session.bgTokenizer;return s.$tokenizeRow=function(t){var r=i.data[t],l=[];if(!r)return l;typeof r=="string"&&(r={value:r});var a=r.caption||r.value||r.name;function f(F,z){F&&l.push({type:(r.className||"")+(z||""),value:F})}for(var u=a.toLowerCase(),m=(i.filterText||"").toLowerCase(),d=0,b=0,g=0;g<=m.length;g++)if(g!=b&&(r.matchMask&1<<g||g==m.length)){var w=m.slice(b,g);b=g;var H=u.indexOf(w,d);if(H==-1)continue;f(a.slice(d,H),""),d=H+w.length,f(a.slice(H,d),"completion-highlight")}return f(a.slice(d,a.length),""),l.push({type:"completion-spacer",value:" "}),r.meta&&l.push({type:"completion-meta",value:r.meta}),r.message&&l.push({type:"completion-message",value:r.message}),l},s.$updateOnChange=c,s.start=c,i.session.$computeWidth=function(){return this.screenWidth=0},i.isOpen=!1,i.isTopdown=!1,i.autoSelect=!0,i.filterText="",i.data=[],i.setData=function(t,r){i.filterText=r||"",i.setValue(x.stringRepeat(`
  15. `,t.length),-1),i.data=t||[],i.setRow(0)},i.getData=function(t){return i.data[t]},i.getRow=function(){return o.start.row},i.setRow=function(t){t=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,t)),o.start.row!=t&&(i.selection.clearSelection(),o.start.row=o.end.row=t||0,i.session._emit("changeBackMarker"),i.moveCursorTo(t||0,0),i.isOpen&&i._signal("select"))},i.on("changeSelection",function(){i.isOpen&&i.setRow(i.selection.lead.row),i.renderer.scrollCursorIntoView()}),i.hide=function(){this.container.style.display="none",i.anchorPos=null,i.anchor=null,i.isOpen&&(i.isOpen=!1,this._signal("hide"))},i.tryShow=function(t,r,l,a){if(!a&&i.isOpen&&i.anchorPos&&i.anchor&&i.anchorPos.top===t.top&&i.anchorPos.left===t.left&&i.anchor===l)return!0;var f=this.container,u=window.innerHeight,m=window.innerWidth,d=this.renderer,b=d.$maxLines*r*1.4,g={top:0,bottom:0,left:0},w=u-t.top-3*this.$borderSize-r,H=t.top-3*this.$borderSize;l||(H<=w||w>=b?l="bottom":l="top"),l==="top"?(g.bottom=t.top-this.$borderSize,g.top=g.bottom-b):l==="bottom"&&(g.top=t.top+r+this.$borderSize,g.bottom=g.top+b);var F=g.top>=0&&g.bottom<=u;if(!a&&!F)return!1;F?d.$maxPixelHeight=null:l==="top"?d.$maxPixelHeight=H:d.$maxPixelHeight=w,l==="top"?(f.style.top="",f.style.bottom=u-g.bottom+"px",i.isTopdown=!1):(f.style.top=g.top+"px",f.style.bottom="",i.isTopdown=!0),f.style.display="";var z=t.left;return z+f.offsetWidth>m&&(z=m-f.offsetWidth),f.style.left=z+"px",f.style.right="",i.isOpen||(i.isOpen=!0,this._signal("show"),p=null),i.anchorPos=t,i.anchor=l,!0},i.show=function(t,r,l){this.tryShow(t,r,l?"bottom":void 0,!0)},i.goTo=function(t){var r=this.getRow(),l=this.session.getLength()-1;switch(t){case"up":r=r<=0?l:r-1;break;case"down":r=r>=l?-1:r+1;break;case"start":r=0;break;case"end":r=l;break}this.setRow(r)},i.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},i.$imageSize=0,i.$borderSize=1,i}return T}();y.importCssString(`
  16. .ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
  17. background-color: #CAD6FA;
  18. z-index: 1;
  19. }
  20. .ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
  21. background-color: #3a674e;
  22. }
  23. .ace_editor.ace_autocomplete .ace_line-hover {
  24. border: 1px solid #abbffe;
  25. margin-top: -1px;
  26. background: rgba(233,233,253,0.4);
  27. position: absolute;
  28. z-index: 2;
  29. }
  30. .ace_dark.ace_editor.ace_autocomplete .ace_line-hover {
  31. border: 1px solid rgba(109, 150, 13, 0.8);
  32. background: rgba(58, 103, 78, 0.62);
  33. }
  34. .ace_completion-meta {
  35. opacity: 0.5;
  36. margin-left: 0.9em;
  37. }
  38. .ace_completion-message {
  39. color: blue;
  40. }
  41. .ace_editor.ace_autocomplete .ace_completion-highlight{
  42. color: #2d69c7;
  43. }
  44. .ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{
  45. color: #93ca12;
  46. }
  47. .ace_editor.ace_autocomplete {
  48. width: 300px;
  49. z-index: 200000;
  50. border: 1px lightgray solid;
  51. position: fixed;
  52. box-shadow: 2px 3px 5px rgba(0,0,0,.2);
  53. line-height: 1.4;
  54. background: #fefefe;
  55. color: #111;
  56. }
  57. .ace_dark.ace_editor.ace_autocomplete {
  58. border: 1px #484747 solid;
  59. box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);
  60. line-height: 1.4;
  61. background: #25282c;
  62. color: #c1c1c1;
  63. }
  64. .ace_autocomplete .ace_text-layer {
  65. width: calc(100% - 8px);
  66. }
  67. .ace_autocomplete .ace_line {
  68. display: flex;
  69. align-items: center;
  70. }
  71. .ace_autocomplete .ace_line > * {
  72. min-width: 0;
  73. flex: 0 0 auto;
  74. }
  75. .ace_autocomplete .ace_line .ace_ {
  76. flex: 0 1 auto;
  77. overflow: hidden;
  78. white-space: nowrap;
  79. text-overflow: ellipsis;
  80. }
  81. .ace_autocomplete .ace_completion-spacer {
  82. flex: 1;
  83. }
  84. `,"autocompletion.css",!1),C.AcePopup=P,C.$singleLineEditor=k,C.getAriaId=O}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets"],function(v,C,I){var R=v("../snippets").snippetManager,E=function(){function L(){this.editor=null}return L.prototype.show=function(S,x,y){if(y=y||"",S&&this.editor&&this.editor!==S&&(this.hide(),this.editor=null),!S||!x)return!1;var M=x.snippet?R.getDisplayTextForSnippet(S,x.snippet):x.value;return!M||!M.startsWith(y)?!1:(this.editor=S,M=M.slice(y.length),M===""?S.removeGhostText():S.setGhostText(M),!0)},L.prototype.isOpen=function(){return this.editor?!!this.editor.renderer.$ghostText:!1},L.prototype.hide=function(){return this.editor?(this.editor.removeGhostText(),!0):!1},L.prototype.destroy=function(){this.hide(),this.editor=null},L}();C.AceInline=E}),ace.define("ace/autocomplete/util",["require","exports","module"],function(v,C,I){C.parForEach=function(E,L,S){var x=0,y=E.length;y===0&&S();for(var M=0;M<y;M++)L(E[M],function(O,k){x++,x===y&&S(O,k)})};var R=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;C.retrievePrecedingIdentifier=function(E,L,S){S=S||R;for(var x=[],y=L-1;y>=0&&S.test(E[y]);y--)x.push(E[y]);return x.reverse().join("")},C.retrieveFollowingIdentifier=function(E,L,S){S=S||R;for(var x=[],y=L;y<E.length&&S.test(E[y]);y++)x.push(E[y]);return x},C.getCompletionPrefix=function(E){var L=E.getCursorPosition(),S=E.session.getLine(L.row),x;return E.completers.forEach(function(y){y.identifierRegexps&&y.identifierRegexps.forEach(function(M){!x&&M&&(x=this.retrievePrecedingIdentifier(S,L.column,M))}.bind(this))}.bind(this)),x||this.retrievePrecedingIdentifier(S,L.column)},C.triggerAutocomplete=function(E){var L=E.getCursorPosition(),S=E.session.getLine(L.row),x=L.column===0?0:L.column-1,y=S[x];return E.completers.some(function(M){if(M.triggerCharacters&&Array.isArray(M.triggerCharacters))return M.triggerCharacters.includes(y)})}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config"],function(v,C,I){var R=v("./keyboard/hash_handler").HashHandler,E=v("./autocomplete/popup").AcePopup,L=v("./autocomplete/inline").AceInline,S=v("./autocomplete/popup").getAriaId,x=v("./autocomplete/util"),y=v("./lib/lang"),M=v("./lib/dom"),O=v("./snippets").snippetManager,k=v("./config"),P=function(i,c){c.completer&&c.completer.destroy()},T=function(){function i(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new R,this.keyboardHandler.bindKeys(this.commands),this.parentNode=null,this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.onLayoutChange=this.onLayoutChange.bind(this),this.changeTimer=y.delayedCall(function(){this.updateCompletions(!0)}.bind(this)),this.tooltipTimer=y.delayedCall(this.updateDocTooltip.bind(this),50)}return i.prototype.$init=function(){return this.popup=new E(this.parentNode||document.body||document.documentElement),this.popup.on("click",function(c){this.insertMatch(),c.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.$onPopupChange.bind(this)),this.popup.on("hide",this.$onHidePopup.bind(this)),this.popup.on("select",this.$onPopupChange.bind(this)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup},i.prototype.$initInline=function(){if(!(!this.inlineEnabled||this.inlineRenderer))return this.inlineRenderer=new L,this.inlineRenderer},i.prototype.getPopup=function(){return this.popup||this.$init()},i.prototype.$onHidePopup=function(){this.inlineRenderer&&this.inlineRenderer.hide(),this.hideDocTooltip()},i.prototype.$onPopupChange=function(c){if(this.inlineRenderer&&this.inlineEnabled){var p=c?null:this.popup.getData(this.popup.getRow()),h=x.getCompletionPrefix(this.editor);this.inlineRenderer.show(this.editor,p,h)||this.inlineRenderer.hide(),this.$updatePopupPosition()}this.tooltipTimer.call(null,null)},i.prototype.observeLayoutChanges=function(){if(!(this.$elements||!this.editor)){window.addEventListener("resize",this.onLayoutChange,{passive:!0}),window.addEventListener("wheel",this.mousewheelListener);for(var c=this.editor.container.parentNode,p=[];c;)p.push(c),c.addEventListener("scroll",this.onLayoutChange,{passive:!0}),c=c.parentNode;this.$elements=p}},i.prototype.unObserveLayoutChanges=function(){var c=this;window.removeEventListener("resize",this.onLayoutChange,{passive:!0}),window.removeEventListener("wheel",this.mousewheelListener),this.$elements&&this.$elements.forEach(function(p){p.removeEventListener("scroll",c.onLayoutChange,{passive:!0})}),this.$elements=null},i.prototype.onLayoutChange=function(){if(!this.popup.isOpen)return this.unObserveLayoutChanges();this.$updatePopupPosition(),this.updateDocTooltip()},i.prototype.$updatePopupPosition=function(){var c=this.editor,p=c.renderer,h=p.layerConfig.lineHeight,o=p.$cursorLayer.getPixelPosition(this.base,!0);o.left-=this.popup.getTextLeftOffset();var n=c.container.getBoundingClientRect();o.top+=n.top-p.layerConfig.offset,o.left+=n.left-c.renderer.scrollLeft,o.left+=p.gutterWidth;var e={top:o.top,left:o.left};p.$ghostText&&p.$ghostTextWidget&&this.base.row===p.$ghostText.position.row&&(e.top+=p.$ghostTextWidget.el.offsetHeight),!this.popup.tryShow(e,h,"bottom")&&(this.popup.tryShow(o,h,"top")||this.popup.show(o,h))},i.prototype.openPopup=function(c,p,h){this.popup||this.$init(),this.inlineEnabled&&!this.inlineRenderer&&this.$initInline(),this.popup.autoSelect=this.autoSelect,this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions&&this.editor.textInput.setAriaOptions({activeDescendant:S(this.popup.getRow()),inline:this.inlineEnabled}),c.keyBinding.addKeyboardHandler(this.keyboardHandler),this.popup.setRow(this.autoSelect?0:-1),h?h&&!p&&this.detach():(this.popup.setTheme(c.getTheme()),this.popup.setFontSize(c.getFontSize()),this.$updatePopupPosition(),this.tooltipNode&&this.updateDocTooltip()),this.changeTimer.cancel(),this.observeLayoutChanges()},i.prototype.detach=function(){this.editor&&(this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener)),this.changeTimer.cancel(),this.hideDocTooltip(),this.completionProvider&&this.completionProvider.detach(),this.popup&&this.popup.isOpen&&this.popup.hide(),this.base&&this.base.detach(),this.activated=!1,this.completionProvider=this.completions=this.base=null,this.unObserveLayoutChanges()},i.prototype.changeListener=function(c){var p=this.editor.selection.lead;(p.row!=this.base.row||p.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},i.prototype.blurListener=function(c){var p=document.activeElement,h=this.editor.textInput.getElement(),o=c.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(c.relatedTarget),n=this.popup&&this.popup.container;p!=h&&p.parentNode!=n&&!o&&p!=this.tooltipNode&&c.relatedTarget!=h&&this.detach()},i.prototype.mousedownListener=function(c){this.detach()},i.prototype.mousewheelListener=function(c){this.detach()},i.prototype.goTo=function(c){this.popup.goTo(c)},i.prototype.insertMatch=function(c,p){if(c||(c=this.popup.getData(this.popup.getRow())),!c)return!1;if(c.value==="")return this.detach();var h=this.completions,o=this.getCompletionProvider().insertMatch(this.editor,c,h.filterText,p);return this.completions==h&&this.detach(),o},i.prototype.showPopup=function(c,p){this.editor&&this.detach(),this.activated=!0,this.editor=c,c.completer!=this&&(c.completer&&c.completer.detach(),c.completer=this),c.on("changeSelection",this.changeListener),c.on("blur",this.blurListener),c.on("mousedown",this.mousedownListener),c.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,p)},i.prototype.getCompletionProvider=function(){return this.completionProvider||(this.completionProvider=new A),this.completionProvider},i.prototype.gatherCompletions=function(c,p){return this.getCompletionProvider().gatherCompletions(c,p)},i.prototype.updateCompletions=function(c,p){if(c&&this.base&&this.completions){var o=this.editor.getCursorPosition(),n=this.editor.session.getTextRange({start:this.base,end:o});if(n==this.completions.filterText)return;if(this.completions.setFilter(n),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==n&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,n,c);return}if(p&&p.matches){var o=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(o.row,o.column),this.base.$insertRight=!0,this.completions=new $(p.matches),this.openPopup(this.editor,"",c)}var h=this.editor.getSession(),o=this.editor.getCursorPosition(),n=x.getCompletionPrefix(this.editor);this.base=h.doc.createAnchor(o.row,o.column-n.length),this.base.$insertRight=!0;var e={exactMatch:this.exactMatch};this.getCompletionProvider().provideCompletions(this.editor,e,function(s,t,r){var l=t.filtered,a=x.getCompletionPrefix(this.editor);if(r){if(!l.length){var f=!this.autoShown&&this.emptyMessage;if(typeof f=="function"&&(f=this.emptyMessage(a)),f){var u=[{caption:this.emptyMessage(a),value:""}];this.completions=new $(u),this.openPopup(this.editor,a,c);return}return this.detach()}if(l.length==1&&l[0].value==a&&!l[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&l.length==1)return this.insertMatch(l[0])}this.completions=t,this.openPopup(this.editor,a,c)}.bind(this))},i.prototype.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},i.prototype.updateDocTooltip=function(){var c=this.popup,p=c.data,h=p&&(p[c.getHoveredRow()]||p[c.getRow()]),o=null;if(!h||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var n=this.editor.completers.length,e=0;e<n;e++){var s=this.editor.completers[e];if(s.getDocTooltip&&h.completerId===s.id){o=s.getDocTooltip(h);break}}if(!o&&typeof h!="string"&&(o=h),typeof o=="string"&&(o={docText:o}),!o||!(o.docHTML||o.docText))return this.hideDocTooltip();this.showDocTooltip(o)},i.prototype.showDocTooltip=function(c){this.tooltipNode||(this.tooltipNode=M.createElement("div"),this.tooltipNode.style.margin=0,this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this),this.tooltipNode.id="doc-tooltip",this.tooltipNode.setAttribute("role","tooltip"));var p=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(p.isDark?"ace_dark ":"")+(p.cssClass||"");var h=this.tooltipNode;c.docHTML?h.innerHTML=c.docHTML:c.docText&&(h.textContent=c.docText),h.parentNode||this.popup.container.appendChild(this.tooltipNode);var o=this.popup,n=o.container.getBoundingClientRect();h.style.top=o.container.style.top,h.style.bottom=o.container.style.bottom,h.style.display="block",window.innerWidth-n.right<320?n.left<320?o.isTopdown?(h.style.top=n.bottom+"px",h.style.left=n.left+"px",h.style.right="",h.style.bottom=""):(h.style.top=o.container.offsetTop-h.offsetHeight+"px",h.style.left=n.left+"px",h.style.right="",h.style.bottom=""):(h.style.right=window.innerWidth-n.left+"px",h.style.left=""):(h.style.left=n.right+1+"px",h.style.right="")},i.prototype.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),!!this.tooltipNode){var c=this.tooltipNode;!this.editor.isFocused()&&document.activeElement==c&&this.editor.focus(),this.tooltipNode=null,c.parentNode&&c.parentNode.removeChild(c)}},i.prototype.onTooltipClick=function(c){for(var p=c.target;p&&p!=this.tooltipNode;){if(p.nodeName=="A"&&p.href){p.rel="noreferrer",p.target="_blank";break}p=p.parentNode}},i.prototype.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var c=this.popup.container;c&&c.parentNode&&c.parentNode.removeChild(c)}this.editor&&this.editor.completer==this&&(this.editor.off("destroy",P),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},i}();T.prototype.commands={Up:function(i){i.completer.goTo("up")},Down:function(i){i.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(i){i.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(i){i.completer.goTo("end")},Esc:function(i){i.completer.detach()},Return:function(i){return i.completer.insertMatch()},"Shift-Return":function(i){i.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(i){var c=i.completer.insertMatch();if(!c&&!i.tabstopManager)i.completer.goTo("down");else return c},PageUp:function(i){i.completer.popup.gotoPageUp()},PageDown:function(i){i.completer.popup.gotoPageDown()}},T.for=function(i){return i.completer instanceof T||(i.completer&&(i.completer.destroy(),i.completer=null),k.get("sharedPopups")?(T.$sharedInstance||(T.$sharedInstance=new T),i.completer=T.$sharedInstance):(i.completer=new T,i.once("destroy",P))),i.completer},T.startCommand={name:"startAutocomplete",exec:function(i,c){var p=T.for(i);p.autoInsert=!1,p.autoSelect=!0,p.autoShown=!1,p.showPopup(i,c),p.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var A=function(){function i(){this.active=!0}return i.prototype.insertByIndex=function(c,p,h){return!this.completions||!this.completions.filtered?!1:this.insertMatch(c,this.completions.filtered[p],h)},i.prototype.insertMatch=function(c,p,h){if(!p)return!1;if(c.startOperation({command:{name:"insertMatch"}}),p.completer&&p.completer.insertMatch)p.completer.insertMatch(c,p);else{if(!this.completions)return!1;if(this.completions.filterText){var o;c.selection.getAllRanges?o=c.selection.getAllRanges():o=[c.getSelectionRange()];for(var n=0,e;e=o[n];n++)e.start.column-=this.completions.filterText.length,c.session.remove(e)}p.snippet?O.insertSnippet(c,p.snippet,{range:p.range}):this.$insertString(c,p),p.command&&p.command==="startAutocomplete"&&c.execCommand(p.command)}return c.endOperation(),!0},i.prototype.$insertString=function(c,p){var h=p.value||p;if(p.range){if(c.inVirtualSelectionMode)return c.session.replace(p.range,h);c.forEachSelection(function(){var o=c.getSelectionRange();p.range.compareRange(o)===0?c.session.replace(p.range,h):c.insert(h)},null,{keepOrder:!0})}else c.execCommand("insertstring",h)},i.prototype.gatherCompletions=function(c,p){var h=c.getSession(),o=c.getCursorPosition(),n=x.getCompletionPrefix(c),e=[];this.completers=c.completers;var s=c.completers.length;return c.completers.forEach(function(t,r){t.getCompletions(c,h,o,n,function(l,a){!l&&a&&(e=e.concat(a)),p(null,{prefix:x.getCompletionPrefix(c),matches:e,finished:--s===0})})}),!0},i.prototype.provideCompletions=function(c,p,h){var o=function(t){var r=t.prefix,l=t.matches;this.completions=new $(l),p.exactMatch&&(this.completions.exactMatch=!0),p.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter(r),(t.finished||this.completions.filtered.length)&&h(null,this.completions,t.finished)}.bind(this),n=!0,e=null;if(this.gatherCompletions(c,function(t,r){if(this.active){t&&(h(t,[],!0),this.detach());var l=r.prefix;if(l.indexOf(r.prefix)===0){if(n){e=r;return}o(r)}}}.bind(this)),n=!1,e){var s=e;e=null,o(s)}},i.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(c){typeof c.cancel=="function"&&c.cancel()})},i}(),$=function(){function i(c,p){this.all=c,this.filtered=c,this.filterText=p||"",this.exactMatch=!1,this.ignoreCaption=!1}return i.prototype.setFilter=function(c){if(c.length>this.filterText&&c.lastIndexOf(this.filterText,0)===0)var p=this.filtered;else var p=this.all;this.filterText=c,p=this.filterCompletions(p,this.filterText),p=p.sort(function(o,n){return n.exactMatch-o.exactMatch||n.$score-o.$score||(o.caption||o.value).localeCompare(n.caption||n.value)});var h=null;p=p.filter(function(o){var n=o.snippet||o.caption||o.value;return n===h?!1:(h=n,!0)}),this.filtered=p},i.prototype.filterCompletions=function(c,p){var h=[],o=p.toUpperCase(),n=p.toLowerCase();e:for(var e=0,s;s=c[e];e++){var t=!this.ignoreCaption&&s.caption||s.value||s.snippet;if(t){var r=-1,l=0,a=0,f,u;if(this.exactMatch){if(p!==t.substr(0,p.length))continue e}else{var m=t.toLowerCase().indexOf(n);if(m>-1)a=m;else for(var d=0;d<p.length;d++){var b=t.indexOf(n[d],r+1),g=t.indexOf(o[d],r+1);if(f=b>=0&&(g<0||b<g)?b:g,f<0)continue e;u=f-r-1,u>0&&(r===-1&&(a+=10),a+=u,l=l|1<<d),r=f}}s.matchMask=l,s.exactMatch=a?0:1,s.$score=(s.score||0)-a,h.push(s)}}return h},i}();C.Autocomplete=T,C.CompletionProvider=A,C.FilteredList=$}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(v,C,I){var R=v("../range").Range,E=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function L(x,y){var M=x.getTextRange(R.fromPoints({row:0,column:0},y));return M.split(E).length-1}function S(x,y){var M=L(x,y),O=x.getValue().split(E),k=Object.create(null),P=O[M];return O.forEach(function(T,A){if(!(!T||T===P)){var $=Math.abs(M-A),i=O.length-$;k[T]?k[T]=Math.max(i,k[T]):k[T]=i}}),k}C.getCompletions=function(x,y,M,O,k){var P=S(y,M),T=Object.keys(P);k(null,T.map(function(A){return{caption:A,value:A,score:P[A],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"],function(v,C,I){var R=v("../snippets").snippetManager,E=v("../autocomplete").Autocomplete,L=v("../config"),S=v("../lib/lang"),x=v("../autocomplete/util"),y=v("../autocomplete/text_completer"),M={getCompletions:function(e,s,t,r,l){if(s.$mode.completer)return s.$mode.completer.getCompletions(e,s,t,r,l);var a=e.session.getState(t.row),f=s.$mode.getCompletions(a,s,t,r);f=f.map(function(u){return u.completerId=M.id,u}),l(null,f)},id:"keywordCompleter"},O=function(e){var s={};return e.replace(/\${(\d+)(:(.*?))?}/g,function(t,r,l,a){return s[r]=a||""}).replace(/\$(\d+?)/g,function(t,r){return s[r]})},k={getCompletions:function(e,s,t,r,l){var a=[],f=s.getTokenAt(t.row,t.column);f&&f.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?a.push("html-tag"):a=R.getActiveScopes(e);var u=R.snippetMap,m=[];a.forEach(function(d){for(var b=u[d]||[],g=b.length;g--;){var w=b[g],H=w.name||w.tabTrigger;H&&m.push({caption:H,snippet:w.content,meta:w.tabTrigger&&!w.name?w.tabTrigger+"⇥ ":"snippet",completerId:k.id})}},this),l(null,m)},getDocTooltip:function(e){e.snippet&&!e.docHTML&&(e.docHTML=["<b>",S.escapeHTML(e.caption),"</b>","<hr></hr>",S.escapeHTML(O(e.snippet))].join(""))},id:"snippetCompleter"},P=[k,y,M];C.setCompleters=function(e){P.length=0,e&&P.push.apply(P,e)},C.addCompleter=function(e){P.push(e)},C.textCompleter=y,C.keyWordCompleter=M,C.snippetCompleter=k;var T={name:"expandSnippet",exec:function(e){return R.expandWithTab(e)},bindKey:"Tab"},A=function(e,s){$(s.session.$mode)},$=function(e){typeof e=="string"&&(e=L.$modes[e]),e&&(R.files||(R.files={}),i(e.$id,e.snippetFileId),e.modes&&e.modes.forEach($))},i=function(e,s){!s||!e||R.files[e]||(R.files[e]={},L.loadModule(s,function(t){t&&(R.files[e]=t,!t.snippets&&t.snippetText&&(t.snippets=R.parseSnippetFile(t.snippetText)),R.register(t.snippets||[],t.scope),t.includeScopes&&(R.snippetMap[t.scope].includeScopes=t.includeScopes,t.includeScopes.forEach(function(r){$("ace/mode/"+r)})))}))},c=function(e){var s=e.editor,t=s.completer&&s.completer.activated;if(e.command.name==="backspace")t&&!x.getCompletionPrefix(s)&&s.completer.detach();else if(e.command.name==="insertstring"&&!t){p=e;var r=e.editor.$liveAutocompletionDelay;r?h.delay(r):o(e)}},p,h=S.delayedCall(function(){o(p)},0),o=function(e){var s=e.editor,t=x.getCompletionPrefix(s),r=x.triggerAutocomplete(s);if((t||r)&&t.length>=s.$liveAutocompletionThreshold){var l=E.for(s);l.autoShown=!0,l.showPopup(s)}},n=v("../editor").Editor;v("../config").defineOptions(n.prototype,"editor",{enableBasicAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:P),this.commands.addCommand(E.startCommand)):this.commands.removeCommand(E.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:P),this.commands.on("afterExec",c)):this.commands.off("afterExec",c)},value:!1},liveAutocompletionDelay:{initialValue:0},liveAutocompletionThreshold:{initialValue:0},enableSnippets:{set:function(e){e?(this.commands.addCommand(T),this.on("changeMode",A),A(null,this)):(this.commands.removeCommand(T),this.off("changeMode",A))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(v){V&&(V.exports=v)})}()})(Y);var Z=Y.exports;const ee=Q(Z),ne=q({__proto__:null,default:ee},[Z]);export{ne as e};