worker-lua-6a4fa3ae.js 46 KB

12345678910
  1. import{c as Et}from"./index-d7fba904.js";function At(h,y){for(var I=0;I<y.length;I++){const d=y[I];if(typeof d!="string"&&!Array.isArray(d)){for(const s in d)if(s!=="default"&&!(s in h)){const n=Object.getOwnPropertyDescriptor(d,s);n&&Object.defineProperty(h,s,n.get?n:{enumerable:!0,get:()=>d[s]})}}}return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}var Be={};(function(h){if(typeof h.window<"u"&&h.document||h.require&&h.define)return;h.console||(h.console=function(){var s=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:s})},h.console.error=h.console.warn=h.console.log=h.console.trace=h.console),h.window=h,h.ace=h,h.onerror=function(s,n,r,i,c){postMessage({type:"error",data:{message:s,data:c&&c.data,file:n,line:r,col:i,stack:c&&c.stack}})},h.normalizeModule=function(s,n){if(n.indexOf("!")!==-1){var r=n.split("!");return h.normalizeModule(s,r[0])+"!"+h.normalizeModule(s,r[1])}if(n.charAt(0)=="."){var i=s.split("/").slice(0,-1).join("/");for(n=(i?i+"/":"")+n;n.indexOf(".")!==-1&&c!=n;){var c=n;n=n.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return n},h.require=function(n,r){if(r||(r=n,n=null),!r.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");r=h.normalizeModule(n,r);var i=h.require.modules[r];if(i)return i.initialized||(i.initialized=!0,i.exports=i.factory().exports),i.exports;if(!h.require.tlns)return console.log("unable to load "+r);var c=y(r,h.require.tlns);return c.slice(-3)!=".js"&&(c+=".js"),h.require.id=r,h.require.modules[r]={},importScripts(c),h.require(n,r)};function y(s,n){for(var r=s,i="";r;){var c=n[r];if(typeof c=="string")return c+i;if(c)return c.location.replace(/\/*$/,"/")+(i||c.main||c.name);if(c===!1)return"";var l=r.lastIndexOf("/");if(l===-1)break;i=r.substr(l)+i,r=r.slice(0,l)}return s}h.require.modules={},h.require.tlns={},h.define=function(s,n,r){if(arguments.length==2?(r=n,typeof s!="string"&&(n=s,s=h.require.id)):arguments.length==1&&(r=s,n=[],s=h.require.id),typeof r!="function"){h.require.modules[s]={exports:r,initialized:!0};return}n.length||(n=["require","exports","module"]);var i=function(c){return h.require(s,c)};h.require.modules[s]={exports:{},factory:function(){var c=this,l=r.apply(this,n.slice(0,r.length).map(function(a){switch(a){case"require":return i;case"exports":return c.exports;case"module":return c;default:return i(a)}}));return l&&(c.exports=l),c}}},h.define.amd={},h.require.tlns={},h.initBaseUrls=function(n){for(var r in n)this.require.tlns[r]=n[r]},h.initSender=function(){var n=h.require("ace/lib/event_emitter").EventEmitter,r=h.require("ace/lib/oop"),i=function(){};return function(){r.implement(this,n),this.callback=function(c,l){postMessage({type:"call",id:l,data:c})},this.emit=function(c,l){postMessage({type:"event",name:c,data:l})}}.call(i.prototype),new i};var I=h.main=null,d=h.sender=null;h.onmessage=function(s){var n=s.data;if(n.event&&d)d._signal(n.event,n.data);else if(n.command)if(I[n.command])I[n.command].apply(I,n.args);else if(h[n.command])h[n.command].apply(h,n.args);else throw new Error("Unknown command:"+n.command);else if(n.init){h.initBaseUrls(n.tlns),d=h.sender=h.initSender();var r=this.require(n.module)[n.classname];I=h.main=new r(d)}}})(Et);ace.define("ace/lib/oop",[],function(h,y,I){y.inherits=function(d,s){d.super_=s,d.prototype=Object.create(s.prototype,{constructor:{value:d,enumerable:!1,writable:!0,configurable:!0}})},y.mixin=function(d,s){for(var n in s)d[n]=s[n];return d},y.implement=function(d,s){y.mixin(d,s)}});ace.define("ace/apply_delta",[],function(h,y,I){y.applyDelta=function(d,s,n){var r=s.start.row,i=s.start.column,c=d[r]||"";switch(s.action){case"insert":var l=s.lines;if(l.length===1)d[r]=c.substring(0,i)+s.lines[0]+c.substring(i);else{var a=[r,1].concat(s.lines);d.splice.apply(d,a),d[r]=c.substring(0,i)+d[r],d[r+s.lines.length-1]+=c.substring(i)}break;case"remove":var f=s.end.column,v=s.end.row;r===v?d[r]=c.substring(0,i)+c.substring(f):d.splice(r,v-r+1,c.substring(0,i)+d[v].substring(f));break}}});ace.define("ace/lib/event_emitter",[],function(h,y,I){var d={},s=function(){this.propagationStopped=!0},n=function(){this.defaultPrevented=!0};d._emit=d._dispatchEvent=function(r,i){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var c=this._eventRegistry[r]||[],l=this._defaultHandlers[r];if(!(!c.length&&!l)){(typeof i!="object"||!i)&&(i={}),i.type||(i.type=r),i.stopPropagation||(i.stopPropagation=s),i.preventDefault||(i.preventDefault=n),c=c.slice();for(var a=0;a<c.length&&(c[a](i,this),!i.propagationStopped);a++);if(l&&!i.defaultPrevented)return l(i,this)}},d._signal=function(r,i){var c=(this._eventRegistry||{})[r];if(c){c=c.slice();for(var l=0;l<c.length;l++)c[l](i,this)}},d.once=function(r,i){var c=this;if(this.on(r,function l(){c.off(r,l),i.apply(null,arguments)}),!i)return new Promise(function(l){i=l})},d.setDefaultHandler=function(r,i){var c=this._defaultHandlers;if(c||(c=this._defaultHandlers={_disabled_:{}}),c[r]){var l=c[r],a=c._disabled_[r];a||(c._disabled_[r]=a=[]),a.push(l);var f=a.indexOf(i);f!=-1&&a.splice(f,1)}c[r]=i},d.removeDefaultHandler=function(r,i){var c=this._defaultHandlers;if(c){var l=c._disabled_[r];if(c[r]==i)l&&this.setDefaultHandler(r,l.pop());else if(l){var a=l.indexOf(i);a!=-1&&l.splice(a,1)}}},d.on=d.addEventListener=function(r,i,c){this._eventRegistry=this._eventRegistry||{};var l=this._eventRegistry[r];return l||(l=this._eventRegistry[r]=[]),l.indexOf(i)==-1&&l[c?"unshift":"push"](i),i},d.off=d.removeListener=d.removeEventListener=function(r,i){this._eventRegistry=this._eventRegistry||{};var c=this._eventRegistry[r];if(c){var l=c.indexOf(i);l!==-1&&c.splice(l,1)}},d.removeAllListeners=function(r){r||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[r]=void 0),this._defaultHandlers&&(this._defaultHandlers[r]=void 0)},y.EventEmitter=d});ace.define("ace/range",[],function(h,y,I){var d=function(n,r){return n.row-r.row||n.column-r.column},s=function(){function n(r,i,c,l){this.start={row:r,column:i},this.end={row:c,column:l}}return n.prototype.isEqual=function(r){return this.start.row===r.start.row&&this.end.row===r.end.row&&this.start.column===r.start.column&&this.end.column===r.end.column},n.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},n.prototype.contains=function(r,i){return this.compare(r,i)==0},n.prototype.compareRange=function(r){var i,c=r.end,l=r.start;return i=this.compare(c.row,c.column),i==1?(i=this.compare(l.row,l.column),i==1?2:i==0?1:0):i==-1?-2:(i=this.compare(l.row,l.column),i==-1?-1:i==1?42:0)},n.prototype.comparePoint=function(r){return this.compare(r.row,r.column)},n.prototype.containsRange=function(r){return this.comparePoint(r.start)==0&&this.comparePoint(r.end)==0},n.prototype.intersects=function(r){var i=this.compareRange(r);return i==-1||i==0||i==1},n.prototype.isEnd=function(r,i){return this.end.row==r&&this.end.column==i},n.prototype.isStart=function(r,i){return this.start.row==r&&this.start.column==i},n.prototype.setStart=function(r,i){typeof r=="object"?(this.start.column=r.column,this.start.row=r.row):(this.start.row=r,this.start.column=i)},n.prototype.setEnd=function(r,i){typeof r=="object"?(this.end.column=r.column,this.end.row=r.row):(this.end.row=r,this.end.column=i)},n.prototype.inside=function(r,i){return this.compare(r,i)==0?!(this.isEnd(r,i)||this.isStart(r,i)):!1},n.prototype.insideStart=function(r,i){return this.compare(r,i)==0?!this.isEnd(r,i):!1},n.prototype.insideEnd=function(r,i){return this.compare(r,i)==0?!this.isStart(r,i):!1},n.prototype.compare=function(r,i){return!this.isMultiLine()&&r===this.start.row?i<this.start.column?-1:i>this.end.column?1:0:r<this.start.row?-1:r>this.end.row?1:this.start.row===r?i>=this.start.column?0:-1:this.end.row===r?i<=this.end.column?0:1:0},n.prototype.compareStart=function(r,i){return this.start.row==r&&this.start.column==i?-1:this.compare(r,i)},n.prototype.compareEnd=function(r,i){return this.end.row==r&&this.end.column==i?1:this.compare(r,i)},n.prototype.compareInside=function(r,i){return this.end.row==r&&this.end.column==i?1:this.start.row==r&&this.start.column==i?-1:this.compare(r,i)},n.prototype.clipRows=function(r,i){if(this.end.row>i)var c={row:i+1,column:0};else if(this.end.row<r)var c={row:r,column:0};if(this.start.row>i)var l={row:i+1,column:0};else if(this.start.row<r)var l={row:r,column:0};return n.fromPoints(l||this.start,c||this.end)},n.prototype.extend=function(r,i){var c=this.compare(r,i);if(c==0)return this;if(c==-1)var l={row:r,column:i};else var a={row:r,column:i};return n.fromPoints(l||this.start,a||this.end)},n.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},n.prototype.isMultiLine=function(){return this.start.row!==this.end.row},n.prototype.clone=function(){return n.fromPoints(this.start,this.end)},n.prototype.collapseRows=function(){return this.end.column==0?new n(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new n(this.start.row,0,this.end.row,0)},n.prototype.toScreenRange=function(r){var i=r.documentToScreenPosition(this.start),c=r.documentToScreenPosition(this.end);return new n(i.row,i.column,c.row,c.column)},n.prototype.moveBy=function(r,i){this.start.row+=r,this.start.column+=i,this.end.row+=r,this.end.column+=i},n}();s.fromPoints=function(n,r){return new s(n.row,n.column,r.row,r.column)},s.comparePoints=d,s.comparePoints=function(n,r){return n.row-r.row||n.column-r.column},y.Range=s});ace.define("ace/anchor",[],function(h,y,I){var d=h("./lib/oop"),s=h("./lib/event_emitter").EventEmitter,n=function(){function c(l,a,f){this.$onChange=this.onChange.bind(this),this.attach(l),typeof f>"u"?this.setPosition(a.row,a.column):this.setPosition(a,f)}return c.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},c.prototype.getDocument=function(){return this.document},c.prototype.onChange=function(l){if(!(l.start.row==l.end.row&&l.start.row!=this.row)&&!(l.start.row>this.row)){var a=i(l,{row:this.row,column:this.column},this.$insertRight);this.setPosition(a.row,a.column,!0)}},c.prototype.setPosition=function(l,a,f){var v;if(f?v={row:l,column:a}:v=this.$clipPositionToDocument(l,a),!(this.row==v.row&&this.column==v.column)){var b={row:this.row,column:this.column};this.row=v.row,this.column=v.column,this._signal("change",{old:b,value:v})}},c.prototype.detach=function(){this.document.off("change",this.$onChange)},c.prototype.attach=function(l){this.document=l||this.document,this.document.on("change",this.$onChange)},c.prototype.$clipPositionToDocument=function(l,a){var f={};return l>=this.document.getLength()?(f.row=Math.max(0,this.document.getLength()-1),f.column=this.document.getLine(f.row).length):l<0?(f.row=0,f.column=0):(f.row=l,f.column=Math.min(this.document.getLine(f.row).length,Math.max(0,a))),a<0&&(f.column=0),f},c}();n.prototype.$insertRight=!1,d.implement(n.prototype,s);function r(c,l,a){var f=a?c.column<=l.column:c.column<l.column;return c.row<l.row||c.row==l.row&&f}function i(c,l,a){var f=c.action=="insert",v=(f?1:-1)*(c.end.row-c.start.row),b=(f?1:-1)*(c.end.column-c.start.column),E=c.start,k=f?E:c.end;return r(l,E,a)?{row:l.row,column:l.column}:r(k,l,!a)?{row:l.row+v,column:l.column+(l.row==k.row?b:0)}:{row:E.row,column:E.column}}y.Anchor=n});ace.define("ace/document",[],function(h,y,I){var d=h("./lib/oop"),s=h("./apply_delta").applyDelta,n=h("./lib/event_emitter").EventEmitter,r=h("./range").Range,i=h("./anchor").Anchor,c=function(){function l(a){this.$lines=[""],a.length===0?this.$lines=[""]:Array.isArray(a)?this.insertMergedLines({row:0,column:0},a):this.insert({row:0,column:0},a)}return l.prototype.setValue=function(a){var f=this.getLength()-1;this.remove(new r(0,0,f,this.getLine(f).length)),this.insert({row:0,column:0},a||"")},l.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},l.prototype.createAnchor=function(a,f){return new i(this,a,f)},l.prototype.$detectNewLine=function(a){var f=a.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=f?f[1]:`
  2. `,this._signal("changeNewLineMode")},l.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return`\r
  3. `;case"unix":return`
  4. `;default:return this.$autoNewLine||`
  5. `}},l.prototype.setNewLineMode=function(a){this.$newLineMode!==a&&(this.$newLineMode=a,this._signal("changeNewLineMode"))},l.prototype.getNewLineMode=function(){return this.$newLineMode},l.prototype.isNewLine=function(a){return a==`\r
  6. `||a=="\r"||a==`
  7. `},l.prototype.getLine=function(a){return this.$lines[a]||""},l.prototype.getLines=function(a,f){return this.$lines.slice(a,f+1)},l.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},l.prototype.getLength=function(){return this.$lines.length},l.prototype.getTextRange=function(a){return this.getLinesForRange(a).join(this.getNewLineCharacter())},l.prototype.getLinesForRange=function(a){var f;if(a.start.row===a.end.row)f=[this.getLine(a.start.row).substring(a.start.column,a.end.column)];else{f=this.getLines(a.start.row,a.end.row),f[0]=(f[0]||"").substring(a.start.column);var v=f.length-1;a.end.row-a.start.row==v&&(f[v]=f[v].substring(0,a.end.column))}return f},l.prototype.insertLines=function(a,f){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(a,f)},l.prototype.removeLines=function(a,f){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(a,f)},l.prototype.insertNewLine=function(a){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(a,["",""])},l.prototype.insert=function(a,f){return this.getLength()<=1&&this.$detectNewLine(f),this.insertMergedLines(a,this.$split(f))},l.prototype.insertInLine=function(a,f){var v=this.clippedPos(a.row,a.column),b=this.pos(a.row,a.column+f.length);return this.applyDelta({start:v,end:b,action:"insert",lines:[f]},!0),this.clonePos(b)},l.prototype.clippedPos=function(a,f){var v=this.getLength();a===void 0?a=v:a<0?a=0:a>=v&&(a=v-1,f=void 0);var b=this.getLine(a);return f==null&&(f=b.length),f=Math.min(Math.max(f,0),b.length),{row:a,column:f}},l.prototype.clonePos=function(a){return{row:a.row,column:a.column}},l.prototype.pos=function(a,f){return{row:a,column:f}},l.prototype.$clipPosition=function(a){var f=this.getLength();return a.row>=f?(a.row=Math.max(0,f-1),a.column=this.getLine(f-1).length):(a.row=Math.max(0,a.row),a.column=Math.min(Math.max(a.column,0),this.getLine(a.row).length)),a},l.prototype.insertFullLines=function(a,f){a=Math.min(Math.max(a,0),this.getLength());var v=0;a<this.getLength()?(f=f.concat([""]),v=0):(f=[""].concat(f),a--,v=this.$lines[a].length),this.insertMergedLines({row:a,column:v},f)},l.prototype.insertMergedLines=function(a,f){var v=this.clippedPos(a.row,a.column),b={row:v.row+f.length-1,column:(f.length==1?v.column:0)+f[f.length-1].length};return this.applyDelta({start:v,end:b,action:"insert",lines:f}),this.clonePos(b)},l.prototype.remove=function(a){var f=this.clippedPos(a.start.row,a.start.column),v=this.clippedPos(a.end.row,a.end.column);return this.applyDelta({start:f,end:v,action:"remove",lines:this.getLinesForRange({start:f,end:v})}),this.clonePos(f)},l.prototype.removeInLine=function(a,f,v){var b=this.clippedPos(a,f),E=this.clippedPos(a,v);return this.applyDelta({start:b,end:E,action:"remove",lines:this.getLinesForRange({start:b,end:E})},!0),this.clonePos(b)},l.prototype.removeFullLines=function(a,f){a=Math.min(Math.max(0,a),this.getLength()-1),f=Math.min(Math.max(0,f),this.getLength()-1);var v=f==this.getLength()-1&&a>0,b=f<this.getLength()-1,E=v?a-1:a,k=v?this.getLine(E).length:0,$=b?f+1:f,F=b?0:this.getLine($).length,H=new r(E,k,$,F),K=this.$lines.slice(a,f+1);return this.applyDelta({start:H.start,end:H.end,action:"remove",lines:this.getLinesForRange(H)}),K},l.prototype.removeNewLine=function(a){a<this.getLength()-1&&a>=0&&this.applyDelta({start:this.pos(a,this.getLine(a).length),end:this.pos(a+1,0),action:"remove",lines:["",""]})},l.prototype.replace=function(a,f){if(a instanceof r||(a=r.fromPoints(a.start,a.end)),f.length===0&&a.isEmpty())return a.start;if(f==this.getTextRange(a))return a.end;this.remove(a);var v;return f?v=this.insert(a.start,f):v=a.start,v},l.prototype.applyDeltas=function(a){for(var f=0;f<a.length;f++)this.applyDelta(a[f])},l.prototype.revertDeltas=function(a){for(var f=a.length-1;f>=0;f--)this.revertDelta(a[f])},l.prototype.applyDelta=function(a,f){var v=a.action=="insert";(v?a.lines.length<=1&&!a.lines[0]:!r.comparePoints(a.start,a.end))||(v&&a.lines.length>2e4?this.$splitAndapplyLargeDelta(a,2e4):(s(this.$lines,a,f),this._signal("change",a)))},l.prototype.$safeApplyDelta=function(a){var f=this.$lines.length;(a.action=="remove"&&a.start.row<f&&a.end.row<f||a.action=="insert"&&a.start.row<=f)&&this.applyDelta(a)},l.prototype.$splitAndapplyLargeDelta=function(a,f){for(var v=a.lines,b=v.length-f+1,E=a.start.row,k=a.start.column,$=0,F=0;$<b;$=F){F+=f-1;var H=v.slice($,F);H.push(""),this.applyDelta({start:this.pos(E+$,k),end:this.pos(E+F,k=0),action:a.action,lines:H},!0)}a.lines=v.slice($),a.start.row=E+$,a.start.column=k,this.applyDelta(a,!0)},l.prototype.revertDelta=function(a){this.$safeApplyDelta({start:this.clonePos(a.start),end:this.clonePos(a.end),action:a.action=="insert"?"remove":"insert",lines:a.lines.slice()})},l.prototype.indexToPosition=function(a,f){for(var v=this.$lines||this.getAllLines(),b=this.getNewLineCharacter().length,E=f||0,k=v.length;E<k;E++)if(a-=v[E].length+b,a<0)return{row:E,column:a+v[E].length+b};return{row:k-1,column:a+v[k-1].length+b}},l.prototype.positionToIndex=function(a,f){for(var v=this.$lines||this.getAllLines(),b=this.getNewLineCharacter().length,E=0,k=Math.min(a.row,v.length),$=f||0;$<k;++$)E+=v[$].length+b;return E+a.column},l.prototype.$split=function(a){return a.split(/\r\n|\r|\n/)},l}();c.prototype.$autoNewLine="",c.prototype.$newLineMode="auto",d.implement(c.prototype,n),y.Document=c});ace.define("ace/lib/lang",[],function(h,y,I){y.last=function(n){return n[n.length-1]},y.stringReverse=function(n){return n.split("").reverse().join("")},y.stringRepeat=function(n,r){for(var i="";r>0;)r&1&&(i+=n),(r>>=1)&&(n+=n);return i};var d=/^\s\s*/,s=/\s\s*$/;y.stringTrimLeft=function(n){return n.replace(d,"")},y.stringTrimRight=function(n){return n.replace(s,"")},y.copyObject=function(n){var r={};for(var i in n)r[i]=n[i];return r},y.copyArray=function(n){for(var r=[],i=0,c=n.length;i<c;i++)n[i]&&typeof n[i]=="object"?r[i]=this.copyObject(n[i]):r[i]=n[i];return r},y.deepCopy=function n(r){if(typeof r!="object"||!r)return r;var i;if(Array.isArray(r)){i=[];for(var c=0;c<r.length;c++)i[c]=n(r[c]);return i}if(Object.prototype.toString.call(r)!=="[object Object]")return r;i={};for(var c in r)i[c]=n(r[c]);return i},y.arrayToMap=function(n){for(var r={},i=0;i<n.length;i++)r[n[i]]=1;return r},y.createMap=function(n){var r=Object.create(null);for(var i in n)r[i]=n[i];return r},y.arrayRemove=function(n,r){for(var i=0;i<=n.length;i++)r===n[i]&&n.splice(i,1)},y.escapeRegExp=function(n){return n.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},y.escapeHTML=function(n){return(""+n).replace(/&/g,"&#38;").replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"&#60;")},y.getMatchOffsets=function(n,r){var i=[];return n.replace(r,function(c){i.push({offset:arguments[arguments.length-2],length:c.length})}),i},y.deferredCall=function(n){var r=null,i=function(){r=null,n()},c=function(l){return c.cancel(),r=setTimeout(i,l||0),c};return c.schedule=c,c.call=function(){return this.cancel(),n(),c},c.cancel=function(){return clearTimeout(r),r=null,c},c.isPending=function(){return r},c},y.delayedCall=function(n,r){var i=null,c=function(){i=null,n()},l=function(a){i==null&&(i=setTimeout(c,a||r))};return l.delay=function(a){i&&clearTimeout(i),i=setTimeout(c,a||r)},l.schedule=l,l.call=function(){this.cancel(),n()},l.cancel=function(){i&&clearTimeout(i),i=null},l.isPending=function(){return i},l}});ace.define("ace/worker/mirror",[],function(h,y,I){var d=h("../document").Document,s=h("../lib/lang"),n=y.Mirror=function(r){this.sender=r;var i=this.doc=new d(""),c=this.deferredUpdate=s.delayedCall(this.onUpdate.bind(this)),l=this;r.on("change",function(a){var f=a.data;if(f[0].start)i.applyDeltas(f);else for(var v=0;v<f.length;v+=2){var b,E;if(Array.isArray(f[v+1])?b={action:"insert",start:f[v],lines:f[v+1]}:b={action:"remove",start:f[v],end:f[v+1]},(b.action=="insert"?b.start:b.end).row>=i.$lines.length)throw E=new Error("Invalid delta"),E.data={path:l.$path,linesLength:i.$lines.length,start:b.start,end:b.end},E;i.applyDelta(b,!0)}if(l.$timeout)return c.schedule(l.$timeout);l.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(r){this.$timeout=r},this.setValue=function(r){this.doc.setValue(r),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(r){this.sender.callback(this.doc.getValue(),r)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(n.prototype)});ace.define("ace/mode/lua/luaparse",[],function(h,y,I){(function(d,s,n){n(y)})(this,"luaparse",function(d){d.version="0.3.1";var s,n,r,i,c,l=d.defaultOptions={wait:!1,comments:!0,scope:!1,locations:!1,ranges:!1,onCreateNode:null,onCreateScope:null,onDestroyScope:null,onLocalDeclaration:null,luaVersion:"5.3",encodingMode:"none"};function a(e,t){return t=t||0,e<128?String.fromCharCode(e):e<2048?String.fromCharCode(t|192|e>>6,t|128|e&63):e<65536?String.fromCharCode(t|224|e>>12,t|128|e>>6&63,t|128|e&63):e<1114112?String.fromCharCode(t|240|e>>18,t|128|e>>12&63,t|128|e>>6&63,t|128|e&63):null}function f(e,t){for(var o=e.toString(16);o.length<t;)o="0"+o;return o}function v(e){return function(t){var o=e.exec(t);if(!o)return t;w(null,A.invalidCodeUnit,f(o[0].charCodeAt(0),4).toUpperCase())}}var b={"pseudo-latin1":{fixup:v(/[^\x00-\xff]/),encodeByte:function(e){return e===null?"":String.fromCharCode(e)},encodeUTF8:function(e){return a(e)}},"x-user-defined":{fixup:v(/[^\x00-\x7f\uf780-\uf7ff]/),encodeByte:function(e){return e===null?"":e>=128?String.fromCharCode(e|63232):String.fromCharCode(e)},encodeUTF8:function(e){return a(e,63232)}},none:{discardStrings:!0,fixup:function(e){return e},encodeByte:function(e){return""},encodeUTF8:function(e){return""}}},E=1,k=2,$=4,F=8,H=16,K=32,se=64,oe=128,ue=256;d.tokenTypes={EOF:E,StringLiteral:k,Keyword:$,Identifier:F,NumericLiteral:H,Punctuator:K,BooleanLiteral:se,NilLiteral:oe,VarargLiteral:ue};var A=d.errors={unexpected:"unexpected %1 '%2' near '%3'",unexpectedEOF:"unexpected symbol near '<eof>'",expected:"'%1' expected near '%2'",expectedToken:"%1 expected near '%2'",unfinishedString:"unfinished string near '%1'",malformedNumber:"malformed number near '%1'",decimalEscapeTooLarge:"decimal escape too large near '%1'",invalidEscape:"invalid escape sequence near '%1'",hexadecimalDigitExpected:"hexadecimal digit expected near '%1'",braceExpected:"missing '%1' near '%2'",tooLargeCodepoint:"UTF-8 value too large near '%1'",unfinishedLongString:"unfinished long string (starting at line %1) near '%2'",unfinishedLongComment:"unfinished long comment (starting at line %1) near '%2'",ambiguousSyntax:"ambiguous syntax (function call x new statement) near '%1'",noLoopToBreak:"no loop to break near '%1'",labelAlreadyDefined:"label '%1' already defined on line %2",labelNotVisible:"no visible label '%1' for <goto>",gotoJumpInLocalScope:"<goto %1> jumps into the scope of local '%2'",cannotUseVararg:"cannot use '...' outside a vararg function near '%1'",invalidCodeUnit:"code unit U+%1 is not allowed in the current encoding mode"},S=d.ast={labelStatement:function(e){return{type:"LabelStatement",label:e}},breakStatement:function(){return{type:"BreakStatement"}},gotoStatement:function(e){return{type:"GotoStatement",label:e}},returnStatement:function(e){return{type:"ReturnStatement",arguments:e}},ifStatement:function(e){return{type:"IfStatement",clauses:e}},ifClause:function(e,t){return{type:"IfClause",condition:e,body:t}},elseifClause:function(e,t){return{type:"ElseifClause",condition:e,body:t}},elseClause:function(e){return{type:"ElseClause",body:e}},whileStatement:function(e,t){return{type:"WhileStatement",condition:e,body:t}},doStatement:function(e){return{type:"DoStatement",body:e}},repeatStatement:function(e,t){return{type:"RepeatStatement",condition:e,body:t}},localStatement:function(e,t){return{type:"LocalStatement",variables:e,init:t}},assignmentStatement:function(e,t){return{type:"AssignmentStatement",variables:e,init:t}},callStatement:function(e){return{type:"CallStatement",expression:e}},functionStatement:function(e,t,o,p){return{type:"FunctionDeclaration",identifier:e,isLocal:o,parameters:t,body:p}},forNumericStatement:function(e,t,o,p,m){return{type:"ForNumericStatement",variable:e,start:t,end:o,step:p,body:m}},forGenericStatement:function(e,t,o){return{type:"ForGenericStatement",variables:e,iterators:t,body:o}},chunk:function(e){return{type:"Chunk",body:e}},identifier:function(e){return{type:"Identifier",name:e}},literal:function(e,t,o){return e=e===k?"StringLiteral":e===H?"NumericLiteral":e===se?"BooleanLiteral":e===oe?"NilLiteral":"VarargLiteral",{type:e,value:t,raw:o}},tableKey:function(e,t){return{type:"TableKey",key:e,value:t}},tableKeyString:function(e,t){return{type:"TableKeyString",key:e,value:t}},tableValue:function(e){return{type:"TableValue",value:e}},tableConstructorExpression:function(e){return{type:"TableConstructorExpression",fields:e}},binaryExpression:function(e,t,o){var p=e==="and"||e==="or"?"LogicalExpression":"BinaryExpression";return{type:p,operator:e,left:t,right:o}},unaryExpression:function(e,t){return{type:"UnaryExpression",operator:e,argument:t}},memberExpression:function(e,t,o){return{type:"MemberExpression",indexer:t,identifier:o,base:e}},indexExpression:function(e,t){return{type:"IndexExpression",base:e,index:t}},callExpression:function(e,t){return{type:"CallExpression",base:e,arguments:t}},tableCallExpression:function(e,t){return{type:"TableCallExpression",base:e,arguments:t}},stringCallExpression:function(e,t){return{type:"StringCallExpression",base:e,argument:t}},comment:function(e,t){return{type:"Comment",value:e,raw:t}}};function L(e){if(N){var t=B.pop();t.complete(),t.bless(e)}return n.onCreateNode&&n.onCreateNode(e),e}var Se=Array.prototype.slice,Le=function(e,t){for(var o=0,p=e.length;o<p;++o)if(e[o]===t)return o;return-1};Array.prototype.indexOf&&(Le=function(e,t){return e.indexOf(t)});function He(e,t,o){for(var p=0,m=e.length;p<m;++p)if(e[p][t]===o)return p;return-1}function ce(e){var t=Se.call(arguments,1);return e=e.replace(/%(\d)/g,function(o,p){return""+t[p-1]||""}),e}var xe=function(e){for(var t=Se.call(arguments,1),o,p,m=0,x=t.length;m<x;++m){o=t[m];for(p in o)Object.prototype.hasOwnProperty.call(o,p)&&(e[p]=o[p])}return e};Object.assign&&(xe=Object.assign),d.SyntaxError=SyntaxError;function Te(e){return Object.create?Object.create(e,{line:{writable:!0,value:e.line},index:{writable:!0,value:e.index},column:{writable:!0,value:e.column}}):e}function w(e){var t=ce.apply(null,Se.call(arguments,1)),o,p;throw e===null||typeof e.line>"u"?(p=u-V+1,o=Te(new SyntaxError(ce("[%1:%2] %3",R,p,t))),o.index=u,o.line=R,o.column=p):(p=e.range[0]-e.lineStart,o=Te(new SyntaxError(ce("[%1:%2] %3",e.line,p,t))),o.line=e.line,o.index=e.range[0],o.column=p),o}function le(e){var t=s.slice(e.range[0],e.range[1]);return t||e.value}function ee(e,t){w(t,A.expectedToken,e,le(t))}function fe(e){var t=le(te);if(typeof e.type<"u"){var o;switch(e.type){case k:o="string";break;case $:o="keyword";break;case F:o="identifier";break;case H:o="number";break;case K:o="symbol";break;case se:o="boolean";break;case oe:return w(e,A.unexpected,"symbol","nil",t);case E:return w(e,A.unexpectedEOF)}return w(e,A.unexpected,o,le(e),t)}return w(e,A.unexpected,"symbol",e,t)}var u,g,G,te,Ee,T,R,V;d.lex=Ae;function Ae(){for(we();s.charCodeAt(u)===45&&s.charCodeAt(u+1)===45;)tt(),we();if(u>=r)return{type:E,value:"<eof>",line:R,lineStart:V,range:[u,u]};var e=s.charCodeAt(u),t=s.charCodeAt(u+1);if(T=u,nt(e))return Ge();switch(e){case 39:case 34:return We();case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return _e();case 46:return Y(t)?_e():t===46?s.charCodeAt(u+2)===46?Ke():U(".."):U(".");case 61:return U(t===61?"==":"=");case 62:return i.bitwiseOperators&&t===62?U(">>"):U(t===61?">=":">");case 60:return i.bitwiseOperators&&t===60?U("<<"):U(t===61?"<=":"<");case 126:if(t===61)return U("~=");if(!i.bitwiseOperators)break;return U("~");case 58:return i.labels&&t===58?U("::"):U(":");case 91:return t===91||t===61?ze():U("[");case 47:return i.integerDivision&&t===47?U("//"):U("/");case 38:case 124:if(!i.bitwiseOperators)break;case 42:case 94:case 37:case 44:case 123:case 125:case 93:case 40:case 41:case 59:case 35:case 45:case 43:return U(s.charAt(u))}return fe(s.charAt(u))}function de(){var e=s.charCodeAt(u),t=s.charCodeAt(u+1);return pe(e)?(e===10&&t===13&&++u,e===13&&t===10&&++u,++R,V=++u,!0):!1}function we(){for(;u<r;){var e=s.charCodeAt(u);if(rt(e))++u;else if(!de())break}}function Ge(){for(var e,t;it(s.charCodeAt(++u)););return e=c.fixup(s.slice(T,u)),at(e)?t=$:e==="true"||e==="false"?(t=se,e=e==="true"):e==="nil"?(t=oe,e=null):t=F,{type:t,value:e,line:R,lineStart:V,range:[T,u]}}function U(e){return u+=e.length,{type:K,value:e,line:R,lineStart:V,range:[T,u]}}function Ke(){return u+=3,{type:ue,value:"...",line:R,lineStart:V,range:[T,u]}}function We(){for(var e=s.charCodeAt(u++),t=R,o=V,p=u,m=c.discardStrings?null:"",x;x=s.charCodeAt(u++),e!==x;)if((u>r||pe(x))&&(m+=s.slice(p,u-1),w(null,A.unfinishedString,s.slice(T,u-1))),x===92){if(!c.discardStrings){var P=s.slice(p,u-1);m+=c.fixup(P)}var C=et();c.discardStrings||(m+=C),p=u}return c.discardStrings||(m+=c.encodeByte(null),m+=c.fixup(s.slice(p,u-1))),{type:k,value:m,line:t,lineStart:o,lastLine:R,lastLineStart:V,range:[T,u]}}function ze(){var e=R,t=V,o=Ce(!1);return o===!1&&w(g,A.expected,"[",le(g)),{type:k,value:c.discardStrings?null:c.fixup(o),line:e,lineStart:t,lastLine:R,lastLineStart:V,range:[T,u]}}function _e(){var e=s.charAt(u),t=s.charAt(u+1),o=e==="0"&&"xX".indexOf(t||null)>=0?Xe():Ye(),p=Je(),m=Qe();return m&&(p||o.hasFractionPart)&&w(null,A.malformedNumber,s.slice(T,u)),{type:H,value:o.value,line:R,lineStart:V,range:[T,u]}}function Je(){if(i.imaginaryNumbers)return"iI".indexOf(s.charAt(u)||null)>=0?(++u,!0):!1}function Qe(){if(i.integerSuffixes){if("uU".indexOf(s.charAt(u)||null)>=0)if(++u,"lL".indexOf(s.charAt(u)||null)>=0){if(++u,"lL".indexOf(s.charAt(u)||null)>=0)return++u,"ULL";w(null,A.malformedNumber,s.slice(T,u))}else w(null,A.malformedNumber,s.slice(T,u));else if("lL".indexOf(s.charAt(u)||null)>=0){if(++u,"lL".indexOf(s.charAt(u)||null)>=0)return++u,"LL";w(null,A.malformedNumber,s.slice(T,u))}}}function Xe(){var e=0,t=1,o=1,p,m,x,P;for(P=u+=2,re(s.charCodeAt(u))||w(null,A.malformedNumber,s.slice(T,u));re(s.charCodeAt(u));)++u;p=parseInt(s.slice(P,u),16);var C=!1;if(s.charAt(u)==="."){for(C=!0,m=++u;re(s.charCodeAt(u));)++u;e=s.slice(m,u),e=m===u?0:parseInt(e,16)/Math.pow(16,u-m)}var be=!1;if("pP".indexOf(s.charAt(u)||null)>=0){for(be=!0,++u,"+-".indexOf(s.charAt(u)||null)>=0&&(o=s.charAt(u++)==="+"?1:-1),x=u,Y(s.charCodeAt(u))||w(null,A.malformedNumber,s.slice(T,u));Y(s.charCodeAt(u));)++u;t=s.slice(x,u),t=Math.pow(2,t*o)}return{value:(p+e)*t,hasFractionPart:C||be}}function Ye(){for(;Y(s.charCodeAt(u));)++u;var e=!1;if(s.charAt(u)===".")for(e=!0,++u;Y(s.charCodeAt(u));)++u;var t=!1;if("eE".indexOf(s.charAt(u)||null)>=0)for(t=!0,++u,"+-".indexOf(s.charAt(u)||null)>=0&&++u,Y(s.charCodeAt(u))||w(null,A.malformedNumber,s.slice(T,u));Y(s.charCodeAt(u));)++u;return{value:parseFloat(s.slice(T,u)),hasFractionPart:e||t}}function Ze(){var e=u++;for(s.charAt(u++)!=="{"&&w(null,A.braceExpected,"{","\\"+s.slice(e,u)),re(s.charCodeAt(u))||w(null,A.hexadecimalDigitExpected,"\\"+s.slice(e,u));s.charCodeAt(u)===48;)++u;for(var t=u;re(s.charCodeAt(u));)++u,u-t>6&&w(null,A.tooLargeCodepoint,"\\"+s.slice(e,u));var o=s.charAt(u++);o!=="}"&&(o==='"'||o==="'"?w(null,A.braceExpected,"}","\\"+s.slice(e,u--)):w(null,A.hexadecimalDigitExpected,"\\"+s.slice(e,u)));var p=parseInt(s.slice(t,u-1)||"0",16),m="\\"+s.slice(e,u);return p>1114111&&w(null,A.tooLargeCodepoint,m),c.encodeUTF8(p,m)}function et(){var e=u;switch(s.charAt(u)){case"a":return++u,"\x07";case"n":return++u,`
  8. `;case"r":return++u,"\r";case"t":return++u," ";case"v":return++u,"\v";case"b":return++u,"\b";case"f":return++u,"\f";case"\r":case`
  9. `:return de(),`
  10. `;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;Y(s.charCodeAt(u))&&u-e<3;)++u;var t=s.slice(e,u),o=parseInt(t,10);return o>255&&w(null,A.decimalEscapeTooLarge,"\\"+o),c.encodeByte(o,"\\"+t);case"z":if(i.skipWhitespaceEscape)return++u,we(),"";break;case"x":if(i.hexEscapes){if(re(s.charCodeAt(u+1))&&re(s.charCodeAt(u+2)))return u+=3,c.encodeByte(parseInt(s.slice(e+1,u),16),"\\"+s.slice(e,u));w(null,A.hexadecimalDigitExpected,"\\"+s.slice(e,u+2))}break;case"u":if(i.unicodeEscapes)return Ze();break;case"\\":case'"':case"'":return s.charAt(u++)}return i.strictEscapes&&w(null,A.invalidEscape,"\\"+s.slice(e,u+1)),s.charAt(u++)}function tt(){T=u,u+=2;var e=s.charAt(u),t="",o=!1,p=u,m=V,x=R;if(e==="["&&(t=Ce(!0),t===!1?t=e:o=!0),!o){for(;u<r&&!pe(s.charCodeAt(u));)++u;n.comments&&(t=s.slice(p,u))}if(n.comments){var P=S.comment(t,s.slice(T,u));n.locations&&(P.loc={start:{line:x,column:T-m},end:{line:R,column:u-V}}),n.ranges&&(P.range=[T,u]),n.onCreateNode&&n.onCreateNode(P),Ee.push(P)}}function Ce(e){var t=0,o="",p=!1,m,x,P=R;for(++u;s.charAt(u+t)==="=";)++t;if(s.charAt(u+t)!=="[")return!1;for(u+=t+1,pe(s.charCodeAt(u))&&de(),x=u;u<r;){for(;pe(s.charCodeAt(u));)de();if(m=s.charAt(u++),m==="]"){p=!0;for(var C=0;C<t;++C)s.charAt(u+C)!=="="&&(p=!1);s.charAt(u+t)!=="]"&&(p=!1)}if(p)return o+=s.slice(x,u-1),u+=t+1,o}w(null,e?A.unfinishedLongComment:A.unfinishedLongString,P,"<eof>")}function D(){G=g,g=te,te=Ae()}function M(e){return e===g.value?(D(),!0):!1}function O(e){e===g.value?D():w(g,A.expected,e,le(g))}function rt(e){return e===9||e===32||e===11||e===12}function pe(e){return e===10||e===13}function Y(e){return e>=48&&e<=57}function re(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function nt(e){return!!(e>=65&&e<=90||e>=97&&e<=122||e===95||i.extendedIdentifiers&&e>=128)}function it(e){return!!(e>=65&&e<=90||e>=97&&e<=122||e===95||e>=48&&e<=57||i.extendedIdentifiers&&e>=128)}function at(e){switch(e.length){case 2:return e==="do"||e==="if"||e==="in"||e==="or";case 3:return e==="and"||e==="end"||e==="for"||e==="not";case 4:return e==="else"||e==="then"?!0:i.labels&&!i.contextualGoto?e==="goto":!1;case 5:return e==="break"||e==="local"||e==="until"||e==="while";case 6:return e==="elseif"||e==="repeat"||e==="return";case 8:return e==="function"}return!1}function st(e){return K===e.type?"#-~".indexOf(e.value)>=0:$===e.type?e.value==="not":!1}function ot(e){if(E===e.type)return!0;if($!==e.type)return!1;switch(e.value){case"else":case"elseif":case"end":case"until":return!0;default:return!1}}var ne,ie,ge;function W(){var e=ne[ie++].slice();ne.push(e),n.onCreateScope&&n.onCreateScope()}function z(){ne.pop(),--ie,n.onDestroyScope&&n.onDestroyScope()}function Pe(e){n.onLocalDeclaration&&n.onLocalDeclaration(e),Le(ne[ie],e)===-1&&ne[ie].push(e)}function he(e){Pe(e.name),me(e,!0)}function me(e,t){!t&&He(ge,"name",e.name)===-1&&ge.push(e),e.isLocal=t}function De(e){return Le(ne[ie],e)!==-1}var B=[],N;function Q(){return new ve(g)}function ve(e){n.locations&&(this.loc={start:{line:e.line,column:e.range[0]-e.lineStart},end:{line:0,column:0}}),n.ranges&&(this.range=[e.range[0],0])}ve.prototype.complete=function(){n.locations&&(this.loc.end.line=G.lastLine||G.line,this.loc.end.column=G.range[1]-(G.lastLineStart||G.lineStart)),n.ranges&&(this.range[1]=G.range[1])},ve.prototype.bless=function(e){if(this.loc){var t=this.loc;e.loc={start:{line:t.start.line,column:t.start.column},end:{line:t.end.line,column:t.end.column}}}this.range&&(e.range=[this.range[0],this.range[1]])};function ae(){N&&B.push(Q())}function j(e){N&&B.push(e)}function X(){this.scopes=[],this.pendingGotos=[]}X.prototype.isInLoop=function(){for(var e=this.scopes.length;e-- >0;)if(this.scopes[e].isLoop)return!0;return!1},X.prototype.pushScope=function(e){var t={labels:{},locals:[],deferredGotos:[],isLoop:!!e};this.scopes.push(t)},X.prototype.popScope=function(){for(var e=0;e<this.pendingGotos.length;++e){var t=this.pendingGotos[e];t.maxDepth>=this.scopes.length&&--t.maxDepth<=0&&w(t.token,A.labelNotVisible,t.target)}this.scopes.pop()},X.prototype.addGoto=function(e,t){for(var o=[],p=0;p<this.scopes.length;++p){var m=this.scopes[p];if(o.push(m.locals.length),Object.prototype.hasOwnProperty.call(m.labels,e))return}this.pendingGotos.push({maxDepth:this.scopes.length,target:e,token:t,localCounts:o})},X.prototype.addLabel=function(e,t){var o=this.currentScope();if(Object.prototype.hasOwnProperty.call(o.labels,e))w(t,A.labelAlreadyDefined,e,o.labels[e].line);else{for(var p=[],m=0;m<this.pendingGotos.length;++m){var x=this.pendingGotos[m];if(x.maxDepth>=this.scopes.length&&x.target===e){x.localCounts[this.scopes.length-1]<o.locals.length&&o.deferredGotos.push(x);continue}p.push(x)}this.pendingGotos=p}o.labels[e]={localCount:o.locals.length,line:t.line}},X.prototype.addLocal=function(e,t){this.currentScope().locals.push({name:e,token:t})},X.prototype.currentScope=function(){return this.scopes[this.scopes.length-1]},X.prototype.raiseDeferredErrors=function(){for(var e=this.currentScope(),t=e.deferredGotos,o=0;o<t.length;++o){var p=t[o];w(p.token,A.gotoJumpInLocalScope,p.target,e.locals[p.localCounts[this.scopes.length-1]].name)}};function Z(){this.level=0,this.loopLevels=[]}Z.prototype.isInLoop=function(){return!!this.loopLevels.length},Z.prototype.pushScope=function(e){++this.level,e&&this.loopLevels.push(this.level)},Z.prototype.popScope=function(){var e=this.loopLevels,t=e.length;t&&e[t-1]===this.level&&e.pop(),--this.level},Z.prototype.addGoto=Z.prototype.addLabel=function(){throw new Error("This should never happen")},Z.prototype.addLocal=Z.prototype.raiseDeferredErrors=function(){};function Ie(){return i.labels?new X:new Z}function ut(){D(),ae(),n.scope&&W();var e=Ie();e.allowVararg=!0,e.pushScope();var t=J(e);return e.popScope(),n.scope&&z(),E!==g.type&&fe(g),N&&!t.length&&(G=g),L(S.chunk(t))}function J(e){for(var t=[],o;!ot(g);){if(g.value==="return"||!i.relaxedBreak&&g.value==="break"){t.push(Fe(e));break}o=Fe(e),M(";"),o&&t.push(o)}return t}function Fe(e){if(ae(),K===g.type&&M("::"))return ct(e);if(i.emptyStatement&&M(";")){N&&B.pop();return}if(e.raiseDeferredErrors(),$===g.type)switch(g.value){case"local":return D(),vt(e);case"if":return D(),dt(e);case"return":return D(),mt(e);case"function":D();var t=bt();return Oe(t);case"while":return D(),pt(e);case"for":return D(),gt(e);case"repeat":return D(),ht(e);case"break":return D(),e.isInLoop()||w(g,A.noLoopToBreak,g.value),lt();case"do":return D(),ft(e);case"goto":return D(),Ue(e)}return i.contextualGoto&&g.type===F&&g.value==="goto"&&te.type===F&&te.value!=="goto"?(D(),Ue(e)):(N&&B.pop(),yt(e))}function ct(e){var t=g,o=q();return n.scope&&(Pe("::"+t.value+"::"),me(o,!0)),O("::"),e.addLabel(t.value,t),L(S.labelStatement(o))}function lt(){return L(S.breakStatement())}function Ue(e){var t=g.value,o=G,p=q();return e.addGoto(t,o),L(S.gotoStatement(p))}function ft(e){n.scope&&W(),e.pushScope();var t=J(e);return e.popScope(),n.scope&&z(),O("end"),L(S.doStatement(t))}function pt(e){var t=_(e);O("do"),n.scope&&W(),e.pushScope(!0);var o=J(e);return e.popScope(),n.scope&&z(),O("end"),L(S.whileStatement(t,o))}function ht(e){n.scope&&W(),e.pushScope(!0);var t=J(e);O("until"),e.raiseDeferredErrors();var o=_(e);return e.popScope(),n.scope&&z(),L(S.repeatStatement(o,t))}function mt(e){var t=[];if(g.value!=="end"){var o=ye(e);for(o!=null&&t.push(o);M(",");)o=_(e),t.push(o);M(";")}return L(S.returnStatement(t))}function dt(e){var t=[],o,p,m;for(N&&(m=B[B.length-1],B.push(m)),o=_(e),O("then"),n.scope&&W(),e.pushScope(),p=J(e),e.popScope(),n.scope&&z(),t.push(L(S.ifClause(o,p))),N&&(m=Q());M("elseif");)j(m),o=_(e),O("then"),n.scope&&W(),e.pushScope(),p=J(e),e.popScope(),n.scope&&z(),t.push(L(S.elseifClause(o,p))),N&&(m=Q());return M("else")&&(N&&(m=new ve(G),B.push(m)),n.scope&&W(),e.pushScope(),p=J(e),e.popScope(),n.scope&&z(),t.push(L(S.elseClause(p)))),O("end"),L(S.ifStatement(t))}function gt(e){var t=q(),o;if(n.scope&&(W(),he(t)),M("=")){var p=_(e);O(",");var m=_(e),x=M(",")?_(e):null;return O("do"),e.pushScope(!0),o=J(e),e.popScope(),O("end"),n.scope&&z(),L(S.forNumericStatement(t,p,m,x,o))}else{for(var P=[t];M(",");)t=q(),n.scope&&he(t),P.push(t);O("in");var C=[];do{var be=_(e);C.push(be)}while(M(","));return O("do"),e.pushScope(!0),o=J(e),e.popScope(),O("end"),n.scope&&z(),L(S.forGenericStatement(P,C,o))}}function vt(e){var t,o=G;if(F===g.type){var p=[],m=[];do t=q(),p.push(t),e.addLocal(t.name,o);while(M(","));if(M("="))do{var x=_(e);m.push(x)}while(M(","));if(n.scope)for(var P=0,C=p.length;P<C;++P)he(p[P]);return L(S.localStatement(p,m))}if(M("function"))return t=q(),e.addLocal(t.name,o),n.scope&&(he(t),W()),Oe(t,!0);ee("<name>",g)}function yt(e){var t,o,p,m,x,P=[];N&&(o=Q());do{if(N&&(t=Q()),F===g.type)x=g.value,m=q(),n.scope&&me(m,De(x)),p=!0;else if(g.value==="(")D(),m=_(e),O(")"),p=!1;else return fe(g);e:for(;;){switch(k===g.type?'"':g.value){case".":case"[":p=!0;break;case":":case"(":case"{":case'"':p=null;break;default:break e}m=Re(m,t,e)}if(P.push(m),g.value!==",")break;if(!p)return fe(g);D()}while(!0);if(P.length===1&&p===null)return j(t),L(S.callStatement(P[0]));if(!p)return fe(g);O("=");var C=[];do C.push(_(e));while(M(","));return j(o),L(S.assignmentStatement(P,C))}function q(){ae();var e=g.value;return F!==g.type&&ee("<name>",g),D(),L(S.identifier(e))}function Oe(e,t){var o=Ie();o.pushScope();var p=[];if(O("("),!M(")"))for(;;){if(F===g.type){var m=q();if(n.scope&&he(m),p.push(m),M(","))continue}else ue===g.type?(o.allowVararg=!0,p.push($e(o))):ee("<name> or '...'",g);O(")");break}var x=J(o);return o.popScope(),O("end"),n.scope&&z(),t=t||!1,L(S.functionStatement(e,p,t,x))}function bt(){var e,t,o;for(N&&(o=Q()),e=q(),n.scope&&(me(e,De(e.name)),W());M(".");)j(o),t=q(),e=L(S.memberExpression(e,".",t));return M(":")&&(j(o),t=q(),e=L(S.memberExpression(e,":",t)),n.scope&&Pe("self")),e}function Ne(e){for(var t=[],o,p;;){if(ae(),K===g.type&&M("["))o=_(e),O("]"),O("="),p=_(e),t.push(L(S.tableKey(o,p)));else if(F===g.type)te.value==="="?(o=q(),D(),p=_(e),t.push(L(S.tableKeyString(o,p)))):(p=_(e),t.push(L(S.tableValue(p))));else{if((p=ye(e))==null){B.pop();break}t.push(L(S.tableValue(p)))}if(",;".indexOf(g.value)>=0){D();continue}break}return O("}"),L(S.tableConstructorExpression(t))}function ye(e){var t=ke(0,e);return t}function _(e){var t=ye(e);if(t==null)ee("<expression>",g);else return t}function St(e){var t=e.charCodeAt(0),o=e.length;if(o===1)switch(t){case 94:return 12;case 42:case 47:case 37:return 10;case 43:case 45:return 9;case 38:return 6;case 126:return 5;case 124:return 4;case 60:case 62:return 3}else if(o===2)switch(t){case 47:return 10;case 46:return 8;case 60:case 62:return e==="<<"||e===">>"?7:3;case 61:case 126:return 3;case 111:return 1}else if(t===97&&e==="and")return 2;return 0}function ke(e,t){var o=g.value,p,m;if(N&&(m=Q()),st(g)){ae(),D();var x=ke(10,t);x==null&&ee("<expression>",g),p=L(S.unaryExpression(o,x))}if(p==null&&(p=$e(t),p==null&&(p=Lt(t))),p==null)return null;for(var P;o=g.value,P=K===g.type||$===g.type?St(o):0,!(P===0||P<=e);){(o==="^"||o==="..")&&--P,D();var C=ke(P,t);C==null&&ee("<expression>",g),N&&B.push(m),p=L(S.binaryExpression(o,p,C))}return p}function Re(e,t,o){var p,m;if(K===g.type)switch(g.value){case"[":return j(t),D(),p=_(o),O("]"),L(S.indexExpression(e,p));case".":return j(t),D(),m=q(),L(S.memberExpression(e,".",m));case":":return j(t),D(),m=q(),e=L(S.memberExpression(e,":",m)),j(t),Me(e,o);case"(":case"{":return j(t),Me(e,o)}else if(k===g.type)return j(t),Me(e,o);return null}function Lt(e){var t,o,p;if(N&&(p=Q()),F===g.type)o=g.value,t=q(),n.scope&&me(t,De(o));else if(M("("))t=_(e),O(")");else return null;for(;;){var m=Re(t,p,e);if(m===null)break;t=m}return t}function Me(e,t){if(K===g.type)switch(g.value){case"(":i.emptyStatement||g.line!==G.line&&w(null,A.ambiguousSyntax,g.value),D();var o=[],p=ye(t);for(p!=null&&o.push(p);M(",");)p=_(t),o.push(p);return O(")"),L(S.callExpression(e,o));case"{":ae(),D();var m=Ne(t);return L(S.tableCallExpression(e,m))}else if(k===g.type)return L(S.stringCallExpression(e,$e(t)));ee("function arguments",g)}function $e(e){var t=k|H|se|oe|ue,o=g.value,p=g.type,m;if(N&&(m=Q()),p===ue&&!e.allowVararg&&w(g,A.cannotUseVararg,g.value),p&t){j(m);var x=s.slice(g.range[0],g.range[1]);return D(),L(S.literal(p,o,x))}else{if($===p&&o==="function")return j(m),D(),n.scope&&W(),Oe(null);if(M("{"))return j(m),Ne(e)}}d.parse=xt;var qe={"5.1":{},"5.2":{labels:!0,emptyStatement:!0,hexEscapes:!0,skipWhitespaceEscape:!0,strictEscapes:!0,relaxedBreak:!0},"5.3":{labels:!0,emptyStatement:!0,hexEscapes:!0,skipWhitespaceEscape:!0,strictEscapes:!0,unicodeEscapes:!0,bitwiseOperators:!0,integerDivision:!0,relaxedBreak:!0},LuaJIT:{labels:!0,contextualGoto:!0,hexEscapes:!0,skipWhitespaceEscape:!0,strictEscapes:!0,unicodeEscapes:!0,imaginaryNumbers:!0,integerSuffixes:!0}};function xt(e,t){if(typeof t>"u"&&typeof e=="object"&&(t=e,e=void 0),t||(t={}),s=e||"",n=xe({},l,t),u=0,R=1,V=0,r=s.length,ne=[[]],ie=0,ge=[],B=[],!Object.prototype.hasOwnProperty.call(qe,n.luaVersion))throw new Error(ce("Lua version '%1' not supported",n.luaVersion));if(i=xe({},qe[n.luaVersion]),n.extendedIdentifiers!==void 0&&(i.extendedIdentifiers=!!n.extendedIdentifiers),!Object.prototype.hasOwnProperty.call(b,n.encodingMode))throw new Error(ce("Encoding mode '%1' not supported",n.encodingMode));return c=b[n.encodingMode],n.comments&&(Ee=[]),n.wait?d:je()}d.write=Ve;function Ve(e){return s+=String(e),r=s.length,d}d.end=je;function je(e){typeof e<"u"&&Ve(e),s&&s.substr(0,2)==="#!"&&(s=s.replace(/^.*/,function(o){return o.replace(/./g," ")})),r=s.length,N=n.locations||n.ranges,te=Ae();var t=ut();if(n.comments&&(t.comments=Ee),n.scope&&(t.globals=ge),B.length>0)throw new Error("Location tracking failed. This is most likely a bug in luaparse");return t}})});ace.define("ace/mode/lua_worker",[],function(h,y,I){var d=h("../lib/oop"),s=h("../worker/mirror").Mirror,n=h("../mode/lua/luaparse"),r=y.Worker=function(i){s.call(this,i),this.setTimeout(500)};d.inherits(r,s),function(){this.onUpdate=function(){var i=this.doc.getValue(),c=[];try{n.parse(i)}catch(l){l instanceof n.SyntaxError&&c.push({row:l.line-1,column:l.column,text:l.message,type:"error"})}this.sender.emit("annotate",c)}}.call(r.prototype)});const Pt=At({__proto__:null,default:Be},[Be]);export{Pt as w};