UNPKG

phaser4-rex-plugins

Version:
16 lines 761 kB
var t,e;t=void 0,e=function(){function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function n(t,e,s,n,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new r(s,n||t,a),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],o]:t._events[h].push(o):(t._events[h]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,r=[];if(0===this._eventsCount)return r;for(s in t=this._events)e.call(t,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,n=s.length,a=new Array(n);r<n;r++)a[r]=s[r].fn;return a},o.prototype.listenerCount=function(t){var e=i?i+t:t,s=this._events[e];return s?s.fn?1:s.length:0},o.prototype.emit=function(t,e,s,r,n,a){var o=i?i+t:t;if(!this._events[o])return!1;var h,l,c=this._events[o],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,s),!0;case 4:return c.fn.call(c.context,e,s,r),!0;case 5:return c.fn.call(c.context,e,s,r,n),!0;case 6:return c.fn.call(c.context,e,s,r,n,a),!0}for(l=1,h=new Array(u-1);l<u;l++)h[l-1]=arguments[l];c.fn.apply(c.context,h)}else{var d,p=c.length;for(l=0;l<p;l++)switch(c[l].once&&this.removeListener(t,c[l].fn,void 0,!0),u){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,e);break;case 3:c[l].fn.call(c[l].context,e,s);break;case 4:c[l].fn.call(c[l].context,e,s,r);break;default:if(!h)for(d=1,h=new Array(u-1);d<u;d++)h[d-1]=arguments[d];c[l].fn.apply(c[l].context,h)}}return!0},o.prototype.on=function(t,e,i){return n(this,t,e,i,!1)},o.prototype.once=function(t,e,i){return n(this,t,e,i,!0)},o.prototype.removeListener=function(t,e,s,r){var n=i?i+t:t;if(!this._events[n])return this;if(!e)return a(this,n),this;var o=this._events[n];if(o.fn)o.fn!==e||r&&!o.once||s&&o.context!==s||a(this,n);else{for(var h=0,l=[],c=o.length;h<c;h++)(o[h].fn!==e||r&&!o[h].once||s&&o[h].context!==s)&&l.push(o[h]);l.length?this._events[n]=1===l.length?l[0]:l:a(this,n)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&a(this,e)):(this._events=new s,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,t.exports=o}(e);var i=t(e.exports);let s=class extends i{shutdown(){this.removeAllListeners()}destroy(){this.removeAllListeners()}};var r=function(t){if("object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0};const n="tree",a="composite",o="decorator",h="action",l="$state",c=window.crypto&&window.crypto.randomUUID;var u=null,d="#",p=function(t){void 0===t&&(t=null),u=t},g=function(){return u},f=function(){return null===u?c?window.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})):`${d}${u+=1}`},v={getTreeMemory(t){return t.getTreeMemory(this.id)},getData(t,e){return t.get(e,this.id)},setData(t,e,i){return t.set(e,i,this.id),this},getState(t){return this.getData(t,l)},resetState(t){return this.setData(t,l,0),this}},m=function(t,e,i){for(var s=[t];s.length>0;){var r=s.shift();if(!e.call(i,r))switch(r.category){case a:s.push(...r.children),(n=r.services)&&s.push(...n);break;case o:s.push(r.child);break;case h:var n;(n=r.services)&&s.push(...n)}}};function y(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>y(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let i in t)t.hasOwnProperty(i)&&(e[i]=y(t[i]));return e}class b{setExpressionHandler(t){return this.expressionHandler=t,this}eval(t){return this.expressionHandler(t)}}function x(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var S={};!function(t){var e=function(){var t=function(t,e,i,s){for(i=i||{},s=t.length;s--;i[t[s]]=e);return i},e=[1,11],i=[1,3],s=[1,4],r=[1,5],n=[1,6],a=[1,8],o=[1,9],h=[1,10],l=[1,13],c=[1,14],u=[1,15],d=[1,16],p=[1,17],g=[1,18],f=[1,19],v=[1,20],m=[1,21],y=[1,22],b=[1,23],x=[1,24],S=[1,25],C=[1,26],w=[5,7,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,30],k=[5,7,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,30],_=[5,7,12,13,14,19,20,21,22,23,24,25,26,28,30],T=[5,7,12,13,14,15,16,17,19,20,21,22,23,24,25,26,28,30],P=[5,7,12,19,20,21,22,23,24,25,26,28,30],O=[5,7,12,25,26,28,30],E=[7,28],M={trace:function(){},yy:{},symbols_:{error:2,expressions:3,e:4,EOF:5,expression_list:6,",":7,dot_name:8,".":9,NAME:10,"[":11,"]":12,"+":13,"-":14,"*":15,"/":16,"%":17,"^":18,">":19,"<":20,"==":21,"!=":22,">=":23,"<=":24,"||":25,"&&":26,"(":27,")":28,"?":29,":":30,true:31,false:32,QUOTED_STRING:33,NUMBER:34,HEXNUMBER:35,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",7:",",9:".",10:"NAME",11:"[",12:"]",13:"+",14:"-",15:"*",16:"/",17:"%",18:"^",19:">",20:"<",21:"==",22:"!=",23:">=",24:"<=",25:"||",26:"&&",27:"(",28:")",29:"?",30:":",31:"true",32:"false",33:"QUOTED_STRING",34:"NUMBER",35:"HEXNUMBER"},productions_:[0,[3,2],[6,3],[6,1],[8,3],[8,4],[8,1],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,3],[4,7],[4,1],[4,1],[4,1],[4,3],[4,4],[4,1],[4,1],[4,1]],performAction:function(t,e,i,s,r,n,a){var o=n.length-1;switch(r){case 1:var h=n[o-1];return"function"==typeof h?h:function(t){return h};case 2:case 4:this.$=n[o-2].concat([n[o]]);break;case 3:case 6:this.$=[n[o]];break;case 5:this.$=n[o-3].concat([n[o-1]]);break;case 7:this.$=function(t){return A(s.parser,t,"_add",[n[o-2],n[o]])};break;case 8:this.$=function(t){return A(s.parser,t,"_subtract",[n[o-2],n[o]])};break;case 9:this.$=function(t){return A(s.parser,t,"_multiply",[n[o-2],n[o]])};break;case 10:this.$=function(t){return A(s.parser,t,"_divide",[n[o-2],n[o]])};break;case 11:this.$=function(t){return A(s.parser,t,"_mod",[n[o-2],n[o]])};break;case 12:this.$=function(t){return A(s.parser,t,"_pow",[n[o-2],n[o]])};break;case 13:this.$=function(t){return 1==A(s.parser,t,"_greaterThen",[n[o-2],n[o]])};break;case 14:this.$=function(t){return 1==A(s.parser,t,"_lessThen",[n[o-2],n[o]])};break;case 15:this.$=function(t){return 1==A(s.parser,t,"_equalTo",[n[o-2],n[o]])};break;case 16:this.$=function(t){return 0==A(s.parser,t,"_equalTo",[n[o-2],n[o]])};break;case 17:this.$=function(t){return 0==A(s.parser,t,"_lessThen",[n[o-2],n[o]])};break;case 18:this.$=function(t){return 0==A(s.parser,t,"_greaterThen",[n[o-2],n[o]])};break;case 19:this.$=function(t){return 1==A(s.parser,t,"_or",[n[o-2],n[o]])};break;case 20:this.$=function(t){return 1==A(s.parser,t,"_and",[n[o-2],n[o]])};break;case 21:this.$=function(t){return-L(n[o],t)};break;case 22:this.$=function(t){return L(n[o-1],t)};break;case 23:this.$=function(t){return L(n[o-5],t)?L(n[o-2],t):L(n[o],t)};break;case 24:this.$=!0;break;case 25:this.$=!1;break;case 26:this.$=function(t){return s.parser.getDotProperty(t,R(n[o],t),0)};break;case 27:this.$=function(t){return D(s.parser,t,R(n[o-2],t),void 0,!0)};break;case 28:this.$=function(t){return D(s.parser,t,R(n[o-3],t),n[o-1],!0)};break;case 29:this.$=t.slice(1,-1);break;case 30:this.$=Number(t);break;case 31:this.$=parseInt(t,16)}},table:[{3:1,4:2,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{1:[3]},{5:[1,12],13:l,14:c,15:u,16:d,17:p,18:g,19:f,20:v,21:m,22:y,23:b,24:x,25:S,26:C},{4:27,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:28,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},t(w,[2,24]),t(w,[2,25]),t(w,[2,26],{9:[1,30],11:[1,31],27:[1,29]}),t(w,[2,29]),t(w,[2,30]),t(w,[2,31]),t(k,[2,6]),{1:[2,1]},{4:32,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:33,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:34,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:35,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:36,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:37,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:38,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:39,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:40,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:41,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:42,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:43,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:44,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},{4:45,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},t(w,[2,21]),{13:l,14:c,15:u,16:d,17:p,18:g,19:f,20:v,21:m,22:y,23:b,24:x,25:S,26:C,28:[1,46]},{4:49,6:48,8:7,10:e,14:i,27:s,28:[1,47],31:r,32:n,33:a,34:o,35:h},{10:[1,50]},{4:51,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},t(_,[2,7],{15:u,16:d,17:p,18:g}),t(_,[2,8],{15:u,16:d,17:p,18:g}),t(T,[2,9],{18:g}),t(T,[2,10],{18:g}),t([5,7,12,13,14,17,19,20,21,22,23,24,25,26,28,30],[2,11],{15:u,16:d,18:g}),t(w,[2,12]),t(P,[2,13],{13:l,14:c,15:u,16:d,17:p,18:g}),t(P,[2,14],{13:l,14:c,15:u,16:d,17:p,18:g}),t(P,[2,15],{13:l,14:c,15:u,16:d,17:p,18:g}),t(P,[2,16],{13:l,14:c,15:u,16:d,17:p,18:g}),t(P,[2,17],{13:l,14:c,15:u,16:d,17:p,18:g}),t(P,[2,18],{13:l,14:c,15:u,16:d,17:p,18:g}),t(O,[2,19],{13:l,14:c,15:u,16:d,17:p,18:g,19:f,20:v,21:m,22:y,23:b,24:x}),t(O,[2,20],{13:l,14:c,15:u,16:d,17:p,18:g,19:f,20:v,21:m,22:y,23:b,24:x}),t(w,[2,22],{29:[1,52]}),t(w,[2,27]),{7:[1,54],28:[1,53]},t(E,[2,3],{13:l,14:c,15:u,16:d,17:p,18:g,19:f,20:v,21:m,22:y,23:b,24:x,25:S,26:C}),t(k,[2,4]),{12:[1,55],13:l,14:c,15:u,16:d,17:p,18:g,19:f,20:v,21:m,22:y,23:b,24:x,25:S,26:C},{4:56,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},t(w,[2,28]),{4:57,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},t(k,[2,5]),{13:l,14:c,15:u,16:d,17:p,18:g,19:f,20:v,21:m,22:y,23:b,24:x,25:S,26:C,30:[1,58]},t(E,[2,2],{13:l,14:c,15:u,16:d,17:p,18:g,19:f,20:v,21:m,22:y,23:b,24:x,25:S,26:C}),{4:59,8:7,10:e,14:i,27:s,31:r,32:n,33:a,34:o,35:h},t([5,7,12,28,30],[2,23],{13:l,14:c,15:u,16:d,17:p,18:g,19:f,20:v,21:m,22:y,23:b,24:x,25:S,26:C})],defaultActions:{12:[2,1]},parseError:function(t,e){if(!e.recoverable){var i=new Error(t);throw i.hash=e,i}this.trace(t)},parse:function(t){var e=this,i=[0],s=[null],r=[],n=this.table,a="",o=0,h=0,l=r.slice.call(arguments,1),c=Object.create(this.lexer),u={yy:{}};for(var d in this.yy)Object.prototype.hasOwnProperty.call(this.yy,d)&&(u.yy[d]=this.yy[d]);c.setInput(t,u.yy),u.yy.lexer=c,u.yy.parser=this,void 0===c.yylloc&&(c.yylloc={});var p=c.yylloc;r.push(p);var g=c.options&&c.options.ranges;"function"==typeof u.yy.parseError?this.parseError=u.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var f,v,m,y,b,x,S,C,w,k={};;){if(v=i[i.length-1],this.defaultActions[v]?m=this.defaultActions[v]:(null==f&&(w=void 0,"number"!=typeof(w=c.lex()||1)&&(w=e.symbols_[w]||w),f=w),m=n[v]&&n[v][f]),void 0===m||!m.length||!m[0]){var _="";for(b in C=[],n[v])this.terminals_[b]&&b>2&&C.push("'"+this.terminals_[b]+"'");_=c.showPosition?"Parse error on line "+(o+1)+":\n"+c.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[f]||f)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==f?"end of input":"'"+(this.terminals_[f]||f)+"'"),this.parseError(_,{text:c.match,token:this.terminals_[f]||f,line:c.yylineno,loc:p,expected:C})}if(m[0]instanceof Array&&m.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+f);switch(m[0]){case 1:i.push(f),s.push(c.yytext),r.push(c.yylloc),i.push(m[1]),f=null,h=c.yyleng,a=c.yytext,o=c.yylineno,p=c.yylloc;break;case 2:if(x=this.productions_[m[1]][1],k.$=s[s.length-x],k._$={first_line:r[r.length-(x||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(x||1)].first_column,last_column:r[r.length-1].last_column},g&&(k._$.range=[r[r.length-(x||1)].range[0],r[r.length-1].range[1]]),void 0!==(y=this.performAction.apply(k,[a,h,o,u.yy,m[1],s,r].concat(l))))return y;x&&(i=i.slice(0,-1*x*2),s=s.slice(0,-1*x),r=r.slice(0,-1*x)),i.push(this.productions_[m[1]][0]),s.push(k.$),r.push(k._$),S=n[i[i.length-2]][i[i.length-1]],i.push(S);break;case 3:return!0}}return!0}};function L(t,e){return"function"==typeof t?t(e):t}function R(t,e){return t&&(t=t.map((function(t){return L(t,e)}))),t}function A(t,e,i,s){return t[i].apply(t,R(s,e))}function D(t,e,i,s,r){var n,a,o;if((n="string"==typeof i?r?i.split("."):[i]:i).length>1){var h=n.pop();a=(o=t.getDotProperty(e,n))[h]}else a=t.getProperty(e,i),o=t;return null==a&&(a=t.getProperty(e,"defaultHandler"),o=t),a.apply(o,R(s,e))}var I=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===s.length?this.yylloc.first_column:0)+s[s.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var i,s,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],i=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),i)return i;if(this._backtrack){for(var n in r)this[n]=r[n];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,i,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),n=0;n<r.length;n++)if((i=this._input.match(this.rules[r[n]]))&&(!e||i[0].length>e[0].length)){if(e=i,s=n,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,r[n])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,i,s){switch(i){case 0:break;case 1:return 34;case 2:return 35;case 3:return 15;case 4:return 16;case 5:return 14;case 6:return 13;case 7:return 18;case 8:return 17;case 9:return">=";case 10:return"<=";case 11:return 19;case 12:return 20;case 13:return"==";case 14:return"!=";case 15:return"||";case 16:return"&&";case 17:return"?";case 18:return":";case 19:return 27;case 20:return 28;case 21:return 11;case 22:return 12;case 23:return 7;case 24:return 9;case 25:return 31;case 26:return 32;case 27:return 10;case 28:return 33;case 29:return 5;case 30:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:[0-9]+(\.[0-9]+)?\b)/,/^(?:\b0x[0-9A-Fa-f]+\b)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:%)/,/^(?:>=)/,/^(?:<=)/,/^(?:>)/,/^(?:<)/,/^(?:==)/,/^(?:!=)/,/^(?:\|\|)/,/^(?:&&)/,/^(?:\?)/,/^(?::)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?:\.)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:[^\s\*\/\-\+\^\%\>\=\<\!\|\&\?\:\(\)\[\]\,\.\"\']+)/,/^(?:"(\\.|[^\"\\])*"|'(\\.|[^\'\\])*')/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],inclusive:!0}}};return t}();function N(){this.yy={}}return M.lexer=I,N.prototype=M,M.Parser=N,new N}();void 0!==x&&(t.parser=e,t.Parser=e.Parser,t.parse=function(){return e.parse.apply(e,arguments)})}(S);var C=t(S),w=function(t,e,i,s){if(void 0===s&&(s=!0),t&&"number"!=typeof t&&"string"!=typeof t){if(e in t)return t[e];if(s&&(Array.isArray(e)||-1!==e.indexOf("."))){for(var r=Array.isArray(e)?e:e.split("."),n=t,a=0;a<r.length;a++){if(!((e=r[a])in n)){n=i;break}n=n[e]}return n}return i}return i};class k extends C.Parser{getProperty(t,e,i){var s=w(t,e,void 0,!1);return void 0!==s?s:w(this,e,i,!1)}getDotProperty(t,e,i){var s=w(t,e,void 0,!0);return void 0!==s?s:w(this,e,i,!0)}static GetProperty(t,e,i,s){return w(t,e,i,s)}_add(t,e){return t+e}_subtract(t,e){return t-e}_multiply(t,e){return t*e}_divide(t,e){return t/e}_mod(t,e){return t%e}_pow(t,e){return Math.pow(t,e)}_greaterThen(t,e){return t>e}_lessThen(t,e){return t<e}_equalTo(t,e){return t==e}_or(t,e){return t||e}_and(t,e){return t&&e}defaultHandler(t,e){return 0}compile(t){return this.parse(t)}exec(t,e){return"string"==typeof t&&(t=this.compile(t)),t(e)}}var _=new k,T=function(t){return _.compile(t)};class P extends b{constructor(t){var e;super(),e="number"==typeof t?function(){return t}:T(t),this.setExpressionHandler(e)}}class O extends P{eval(t){return!!super.eval(t)}}var E=new class{constructor(t){void 0===t&&(t={});var e=t.delimiters;void 0===e&&(e=["{{","}}"]),this.setDelimiters(e[0],e[1]);var i=t.expressionParser;void 0===i&&(i=new k),this.setExpressionParser(i)}setDelimiters(t,e){return void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,this.reDelimiter=RegExp(`${t}|${e}`,"gi"),this.reSplit=RegExp(`${t}.*?${e}`,"gi"),this}setExpressionParser(t){return this.expressionParser=t,this}compile(t,e){var i,s,r;if(e)if(e instanceof k)(h=e)&&(r=this.expressionParser,this.setExpressionParser(h));else{var n=e.delimiters;n&&(i=this.delimiterLeft,s=this.delimiterRight,this.setDelimiters(n[0],n[1])),(h=e.expressionParser)&&(r=this.expressionParser,this.setExpressionParser(h))}for(var a=this.reDelimiter,o=this.reSplit,h=this.expressionParser,l=[],c=0;;){var u=o.exec(t);if(!u)break;var d=u[0],p=o.lastIndex,g=p-d.length;c<g&&l.push(t.substring(c,g));var f=t.substring(g,p).replace(a,"");l.push(h.compile(f)),c=p}var v=t.length;return c<v&&l.push(t.substring(c,v)),i&&this.setDelimiters(i,s),r&&this.setExpressionParser(r),function(t){return l.map((function(e){return"function"==typeof e&&(e=e(t)),e})).join("")}}render(t,e,i){return("string"==typeof t?this.compile(t,i):t)(e)}};class M extends b{constructor(t){super();var e,i,s=(e=t,E.compile(e,i));this.setExpressionHandler(s)}}class L{constructor({id:t,category:e,name:i,title:s,description:r,properties:n}={}){void 0===t&&(t=f()),this.parent=null,this.id=t,this.category=e||"",this.name=i||"",this.title=s||this.name,this.description=r||"",this.properties=n||{}}destroy(){this.parent=void 0,this.properties=void 0}setTitle(t){return this.title=t,this}setName(t){return this.name=t,this}setDescription(t){return this.description=t,this}setParent(t){return this.parent=t,this}getParent(){return this.parent}getTree(t){if(t)return t.tree;for(var e=this.parent;e;){if(e.category===n)return e;e=e.parent}return null}addExpression(t){return new P(t)}addBooleanExpression(t){return new O(t)}addStringTemplateExpression(t){return new M(t)}_execute(t){this._enter(t),this.getOpenState(t)||this._open(t);var e=this._tick(t);return 1!==e&&2!==e&&5!==e&&9!==e||this._close(t),this._exit(t),e}_enter(t){t._enterNode(this),this.enter(t)}_open(t){t._openNode(this),this.setOpenState(t,!0),this.open(t)}_tick(t){return t._tickNode(this),this.tick(t)}_close(t){t._closeNode(this),this.setOpenState(t,!1),this.close(t),this.abortChildren(t)}_exit(t){t._exitNode(this),this.exit(t)}_abort(t){this._close(t),this.abort(t)}enter(t){}open(t){}tick(t){}close(t){}exit(t){}abortChildren(t){}abort(t){}getNodeMemory(t){return t.getNodeMemory(this.id)}getOpenState(t){return this.getNodeMemory(t).$isOpen}setOpenState(t,e){return void 0===e&&(e=!0),this.getNodeMemory(t).$isOpen=e,this}get SUCCESS(){return 1}get FAILURE(){return 2}get RUNNING(){return 3}get ERROR(){return 9}}class R extends L{constructor({name:t="Action",title:e,properties:i,services:s}={},r){if(super({category:h,name:t,title:e,properties:i}),s)for(var n=0,a=s.length;n<a;n++)this.addService(s[n],r)}destroy(){if(this.services)for(var t=0,e=this.services.length;t<e;t++)this.services[t].destroy();this.services=void 0,super.destroy()}addService(t,e){return"string"==typeof t&&(t=e[t]),void 0===this.services&&(this.services=[]),-1===this.services.indexOf(t)&&(this.services.push(t),t.setParent(this)),this}_tick(t){if(t._tickNode(this),this.services)for(var e=0,i=this.services.length;e<i;e++)this.services[e]._tick(t);return this.tick(t)}}class A extends L{constructor({children:t=[],name:e="Composite",title:i,properties:s,services:r}={},n){super({category:a,name:e,title:i,properties:s}),this.children=[];for(var o=0,h=t.length;o<h;o++)this.addChild(t[o],n);if(r)for(o=0,h=r.length;o<h;o++)this.addService(r[o],n)}destroy(){for(var t=0,e=this.children.length;t<e;t++)this.children[t].destroy();if(this.services)for(t=0,e=this.services.length;t<e;t++)this.services[t].destroy();this.children=void 0,this.services=void 0,super.destroy()}insertChild(t,e,i){return"string"==typeof t&&(t=e[t]),-1===this.children.indexOf(t)&&(i<0&&(i=this.children.length+i),void 0===i||i>=this.children.length?this.children.push(t):this.children.splice(i,0,t),t.setParent(this)),this}addChild(t,e){return this.insertChild(t,e),this}addService(t,e){return"string"==typeof t&&(t=e[t]),void 0===this.services&&(this.services=[]),-1===this.services.indexOf(t)&&(this.services.push(t),t.setParent(this)),this}_tick(t){if(t._tickNode(this),this.services)for(var e=0,i=this.services.length;e<i;e++)this.services[e]._tick(t);return this.tick(t)}abortChildren(t){for(var e=0,i=this.children.length;e<i;e++){var s=this.children[e];s.getOpenState(t)&&s._abort(t)}}}class D extends L{constructor({child:t=null,name:e="Decorator",title:i,properties:s}={},r){super({category:o,name:e,title:i,properties:s}),this.child=null,t&&this.addChild(t,r)}destroy(){this.child&&this.child.destroy(),this.child=void 0,super.destroy()}addChild(t,e){return"string"==typeof t&&(t=e[t]),this.child=t,t.setParent(this),this}chainChild(t,e){for(var i=this;i.child instanceof D;)i=i.child;return i.addChild(t,e),this}isChildRunning(t){return this.child.getOpenState(t)}abortChildren(t){this.isChildRunning(t)&&this.child._abort(t)}openChild(t){return this.child.setOpenState(t,!0),this}}class I extends R{constructor({services:t,title:e,name:i="Succeeder"}={}){super({services:t,title:e,name:i})}tick(t){return 1}}class N extends R{constructor({services:t,title:e,name:i="Abort"}={}){super({services:t,title:e,name:i})}tick(t){return 5}}let j=class extends D{constructor({child:t=null,title:e,name:i="Break",tag:s}={},r){super({child:t,title:e,name:i,properties:{tag:s}},r),this.breakFlag=!1,this.tag=s}setBreakFlag(t){return void 0===t&&(t=!0),this.breakFlag=t,this}tick(t){if(!this.child)return 1;var e=this.child._execute(t);return this.breakFlag&&(e=1,this.breakFlag=!1),e}},B=class extends R{constructor({breakDecoratorTitle:t,tag:e,services:i,title:s,name:r="Break"}={}){super({name:r,title:s,properties:{breakDecoratorTitle:t,tag:e},services:i}),this.breakDecoratorTitle=t,this.tag=e}tick(t){for(var e,i=this.getParent();!(i instanceof j)||this.tag&&this.tag!==i.tag||this.breakDecoratorTitle&&this.breakDecoratorTitle!==i.title;){if(!i.getParent){i=null;break}i=i.getParent()}return i?(i.setBreakFlag(),e=5):(console.error("[EventSheet] Can't get responded BreakDecorator, ignore this break action node."),e=1),e}};class z extends A{constructor({children:t=[],services:e,title:i,name:s="Selector"}={},r){super({children:t,services:e,title:i,name:s},r)}open(t){this.getNodeMemory(t).$runningChild=-1}tick(t){if(0===this.children.length)return 9;var e,i=this.getNodeMemory(t),s=i.$runningChild;if(s<0){for(var r=0,n=this.children.length;r<n;r++)if(3===(e=this.children[r]._execute(t))||1===e||5===e){s=r;break}}else e=this.children[s]._execute(t);return i.$runningChild=3===e?s:-1,e}abortChildren(t){var e=this.getNodeMemory(t),i=this.children[e.$runningChild];i&&(i._abort(t),e.$runningChild=-1)}}class F extends A{constructor({children:t=[],services:e,title:i,name:s="Sequence"}={},r){super({children:t,services:e,title:i,name:s},r)}open(t){this.getNodeMemory(t).$runningChild=0}tick(t){if(0===this.children.length)return 9;for(var e,i=this.getNodeMemory(t),s=i.$runningChild,r=this.children.length;s<r&&3!==(e=this.children[s]._execute(t))&&2!==e&&5!==e;s++);return i.$runningChild=3===e?s:-1,e}abortChildren(t){var e=this.getNodeMemory(t),i=this.children[e.$runningChild];i&&(i._abort(t),e.$runningChild=-1)}} /** * @author Richard Davey <rich@photonstorm.com> * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */var G=function(t,e){if(!(e>=t.length)){for(var i=t.length-1,s=t[e],r=e;r<i;r++)t[r]=t[r+1];return t.length=i,s}},Y=function(t,e,i,s){var r;if(void 0===s&&(s=t),!Array.isArray(e))return-1!==(r=t.indexOf(e))?(G(t,r),i&&i.call(s,e),e):null;for(var n=e.length-1;n>=0;){var a=e[n];-1!==(r=t.indexOf(a))?(G(t,r),i&&i.call(s,a)):e.pop(),n--}return e}; /** * @author Richard Davey <rich@photonstorm.com> * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */class W extends A{constructor({expression:t="true",conditionEvalBreak:e=!1,children:i=[],services:s,title:r,name:n="IfSelector"}={},a){super({children:i,services:s,title:r,name:n,properties:{expression:t,conditionEvalBreak:e}},a),this.expression=this.addBooleanExpression(t),this.conditionEvalBreak=e,this.forceSelectChildIndex=void 0}open(t){this.getNodeMemory(t).$runningChild=-1}setSelectChildIndex(t){return this.forceSelectChildIndex=t,this}evalCondition(t){return void 0!==this.forceSelectChildIndex?this.forceSelectChildIndex:t.evalExpression(this.expression)?0:1}tick(t){if(0===this.children.length)return 9;var e=this.getNodeMemory(t),i=e.$runningChild;if(i<0&&(i=this.evalCondition(t),this.conditionEvalBreak))return e.$runningChild=i,3;var s=this.children[i]._execute(t);return e.$runningChild=3===s?i:-1,s}abortChildren(t){var e=this.getNodeMemory(t),i=this.children[e.$runningChild];i&&(i._abort(t),e.$runningChild=-1)}}class X extends D{constructor({child:t=null,title:e,name:i="ForceFailure"}={},s){super({child:t,title:e,name:i,properties:{}},s)}tick(t){if(!this.child)return 9;var e=this.child._execute(t);return 1===e?2:e}}class V extends D{constructor({maxLoop:t=-1,child:e=null,title:i,name:s="Repeat"}={},r){super({child:e,title:i,name:s,properties:{maxLoop:t}},r),this.maxLoopExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$maxLoop=t.evalExpression(this.maxLoopExpression),e.$i=0}tick(t){if(!this.child)return 9;for(var e=this.getNodeMemory(t),i=e.$maxLoop,s=e.$i,r=1;(i<0||s<i)&&(1===(r=this.child._execute(t))||2===r);)s++;return e.$i=s,r}}class H extends D{constructor({maxLoop:t=-1,returnSuccess:e=!1,child:i=null,title:s,name:r="RepeatUntilFailure"}={},n){super({child:i,title:s,name:r,properties:{returnSuccess:e,maxLoop:t}},n),this.maxLoopExpression=this.addExpression(t),this.returnSuccess=e}open(t){var e=this.getNodeMemory(t);e.$maxLoop=t.evalExpression(this.maxLoopExpression),e.$i=0}tick(t){if(!this.child)return 9;for(var e=this.getNodeMemory(t),i=e.$maxLoop,s=e.$i,r=9;(i<0||s<i)&&1===(r=this.child._execute(t));)s++;return e.$i=s,r===this.FAILURE&&this.returnSuccess&&(r=1),r}}class U extends D{constructor({expression:t="true",conditionEvalBreak:e=!1,onFailState:i=2,child:s=null,title:r,name:n="If"}={},a){super({child:s,title:r,name:n,properties:{expression:t,conditionEvalBreak:e,onFailState:i}},a),this.expression=this.addBooleanExpression(t),this.conditionEvalBreak=e,this.onFailState=i}tick(t){if(!this.child)return 9;if(!this.isChildRunning(t)){if(!t.evalExpression(this.expression))return this.onFailState;if(this.conditionEvalBreak)return this.openChild(),RUNNING}return this.child._execute(t)}}var $=Object.freeze({__proto__:null,Abort:N,AbortIf:class extends D{constructor({expression:t="true",returnSuccess:e=!0,child:i=null,title:s,name:r="AbortIf"}={},n){super({child:i,title:s,name:r,properties:{expression:t,returnSuccess:e}},n),this.expression=this.addBooleanExpression(t),this.returnSuccess=e}tick(t){return this.child?this.isChildRunning(t)&&t.evalExpression(this.expression)?this.returnSuccess?1:2:this.child._execute(t):9}},Action:R,BaseNode:L,BreakAction:B,BreakDecorator:j,Bypass:class extends D{constructor({child:t=null,title:e,name:i="Bypass"}={},s){super({child:t,title:e,name:i},s)}tick(t){return this.child?this.child._execute(t):9}},Composite:A,ContinueIf:class extends D{constructor({expression:t="true",returnSuccess:e=!0,child:i=null,title:s,name:r="ContinueIf"}={},n){super({child:i,title:s,name:r,properties:{expression:t,returnSuccess:e}},n),this.expression=this.addBooleanExpression(t),this.returnSuccess=e}tick(t){return this.child?this.isChildRunning(t)&&!t.evalExpression(this.expression)?this.returnSuccess?1:2:this.child._execute(t):9}},Cooldown:class extends D{constructor({duration:t=0,child:e=null,title:i,name:s="Cooldown"}={},r){super({child:e,title:i,name:s,properties:{duration:t}},r),this.durationExpression=this.addExpression(t)}open(t){this.getNodeMemory(t).$cooldownTime=t.evalExpression(this.durationExpression)}tick(t){if(!this.child)return 9;var e=this.getNodeMemory(t),i=t.currentTime,s=e.$lastEndTime,r=e.$cooldownTime;if(void 0!==s&&i-s<r)return 2;var n=this.child._execute(t);return 1!==n&&2!==n&&5!==n||(e.$lastEndTime=i),n}},Decorator:D,Error:class extends R{constructor({services:t,title:e,name:i="Error"}={}){super({services:t,title:e,name:i})}tick(t){return 9}},Failer:class extends R{constructor({services:t,title:e,name:i="Failer"}={}){super({services:t,title:e,name:i})}tick(t){return 2}},ForceFailure:X,ForceSuccess:class extends D{constructor({child:t=null,title:e,name:i="ForceSuccess"}={},s){super({child:t,title:e,name:i,properties:{}},s)}tick(t){if(!this.child)return 9;var e=this.child._execute(t);return 2===e?1:e}},If:U,IfSelector:W,Invert:class extends D{constructor({child:t=null,title:e,name:i="Invert"}={},s){super({child:t,title:e,name:i},s)}tick(t){if(!this.child)return 9;var e=this.child._execute(t);return 1===e?e=2:2===e&&(e=1),e}},Limiter:class extends D{constructor({maxLoop:t=1,child:e=null,title:i,name:s="Limiter"}={},r){super({child:e,title:i,name:s,properties:{maxLoop:t}},r),this.maxLoopExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$maxLoop=t.evalExpression(this.maxLoopExpression),e.$i=0}tick(t){if(!this.child)return 9;var e=this.getNodeMemory(t),i=e.$maxLoop,s=e.$i;if(s>=i)return 2;var r=this.child._execute(t);return 1!==r&&2!==r||(e.$i=s+1),r}},Parallel:class extends A{constructor({finishMode:t=0,returnSuccess:e=!0,children:i=[],services:s,title:r,name:n="Parallel"}={},a){super({children:i,services:s,title:r,name:n,properties:{finishMode:t,returnSuccess:e}},a),this.finishMode=t,this.returnSuccess=e}open(t){this.getNodeMemory(t).$runningChildren=this.children.map(((t,e)=>e))}tick(t){if(0===this.children.length)return 9;for(var e=this.getNodeMemory(t),i=e.$runningChildren,s={},r=!1,n=!1,a=!1,o=!1,h=0,l=i.length;h<l;h++){var c=i[h],u=this.children[c]._execute(t);switch(s[c]=u,0===c&&(e.$mainTaskStatus=u),u){case 1:case 2:r=!0;break;case 3:n=!0;break;case 5:a=!0;break;case 9:o=!0}}if(r)for(var c in s)1!==(u=s[c])&&2!==u||Y(i,parseInt(c));return 0===this.finishMode?e.$mainTaskStatus:o?9:a?5:n?3:this.returnSuccess?1:e.$mainTaskStatus}abortChildren(t){for(var e=this.getNodeMemory(t),i=e.$runningChildren,s=0,r=i.length;s<r;s++){var n=i[s];this.children[n]._abort(t)}e.$runningChildren.length=0}},RandomSelector:class extends A{constructor({children:t=[],services:e,title:i,name:s="RandomSelector"}={},r){super({children:t,services:e,title:i,name:s},r)}open(t){this.getNodeMemory(t).$runningChild=-1}tick(t){if(0===this.children.length)return ERROR;var e=this.getNodeMemory(t),i=e.$runningChild;i<0&&(i=Math.floor(Math.random()*this.children.length));var s=this.children[i]._execute(t);return e.$runningChild=s===RUNNING?i:-1,s}abortChildren(t){var e=this.getNodeMemory(t),i=this.children[e.$runningChild];i&&(i._abort(t),e.$runningChild=-1)}} /** * @author Richard Davey <rich@photonstorm.com> * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */,Repeat:V,RepeatUntilFailure:H,RepeatUntilSuccess:class extends D{constructor({maxLoop:t=-1,child:e=null,title:i,name:s="RepeatUntilSuccess"}={},r){super({child:e,title:i,name:s,properties:{maxLoop:t}},r),this.maxLoopExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$maxLoop=t.evalExpression(this.maxLoopExpression),e.$i=0}tick(t){if(!this.child)return 9;for(var e=this.getNodeMemory(t),i=e.$maxLoop,s=e.$i,r=9;(i<0||s<i)&&2===(r=this.child._execute(t));)s++;return e.$i=s,r}},Runner:class extends R{constructor({services:t,title:e,name:i="Runner"}={}){super({services:t,title:e,name:i})}tick(t){return 3}},Selector:z,Sequence:F,Service:class extends L{constructor({interval:t=0,randomDeviation:e=0,name:i="Service",title:s,properties:r}={}){void 0===r&&(r={}),r.interval=t,r.randomDeviation=e,super({category:"service",name:i,title:s,properties:r}),this.intervalExpression=this.addExpression(t),this.randomDeviationExpression=this.addExpression(e)}_tick(t){this.canTick(t)&&this.tick(t)}canTick(t){var e=this.getNodeMemory(t),i=t.currentTime,s=e.$lastEndTime,r=e.$interval,n=void 0===s||i-s>=r;if(n){e.$lastEndTime=i,r=t.evalExpression(this.intervalExpression);var a=t.evalExpression(this.randomDeviationExpression);a>0&&(r+=(.5-Math.random())*a),e.$interval=r}return n}},ShuffleSelector:class extends A{constructor({children:t=[],services:e,title:i,name:s="ShuffleSelector"}={},r){super({children:t,services:e,title:i,name:s},r)}open(t){var e=this.getNodeMemory(t);e.$runningChild=0,e.$children||(e.$children=this.children.map(((t,e)=>e))),function(t){for(var e=t.length-1;e>0;e--){var i=Math.floor(Math.random()*(e+1)),s=t[e];t[e]=t[i],t[i]=s}}(e.$children)}tick(t){if(0===this.children.length)return 9;for(var e,i=this.getNodeMemory(t),s=i.$runningChild,r=i.$children,n=s,a=r.length;n<a&&3!==(e=this.children[r[n]]._execute(t))&&1!==e&&5!==e;n++);return i.$runningChild=3===e?n:-1,e}abortChildren(t){var e=this.getNodeMemory(t),i=this.children[e.$runningChild];i&&(i._abort(t),e.$runningChild=-1)}},Succeeder:I,SwitchSelector:class extends A{constructor({expression:t=null,keys:e,conditionEvalBreak:i=!1,children:s={},services:r,title:n,name:a="SwitchSelector"}={},o){void 0===e&&(e=Object.keys(s),s=Object.values(s)),super({children:s,services:r,title:n,name:a,properties:{expression:t,keys:e,conditionEvalBreak:i}},o),this.expression=this.addExpression(t),this.keys=e,this.conditionEvalBreak=i,this.forceSelectChildIndex=void 0}open(t){this.getNodeMemory(t).$runningChild=-1}setSelectChildIndex(t){return this.forceSelectChildIndex=t,this}evalCondition(t){if(void 0!==this.forceSelectChildIndex)return"number"==typeof this.forceSelectChildIndex?this.forceSelectChildIndex:this.keys.indexOf(this.forceSelectChildIndex);var e=t.evalExpression(this.expression);return this.keys.indexOf(e)}tick(t){if(0===this.children.length)return 9;var e=this.getNodeMemory(t),i=e.$runningChild;if(i<0){if(-1===(i=this.evalCondition(t))&&(i=this.keys.indexOf("default")),-1===i)return 9;if(this.conditionEvalBreak)return e.$runningChild=i,3}var s=this.children[i]._execute(t);return e.$runningChild=3===s?i:-1,s}abortChildren(t){var e=this.getNodeMemory(t),i=this.children[e.$runningChild];i&&(i._abort(t),e.$runningChild=-1)}},TimeLimit:class extends D{constructor({duration:t=0,returnSuccess:e=!0,child:i=null,title:s,name:r="TimeLimit"}={},n){super({child:i,title:s,name:r,properties:{duration:t,returnSuccess:e}},n),this.durationExpression=this.addExpression(t),this.returnSuccess=e}open(t){var e=this.getNodeMemory(t);e.$startTime=t.currentTime,e.$duration=t.evalExpression(this.durationExpression)}tick(t){if(!this.child)return 9;var e=this.getNodeMemory(t);return t.currentTime-e.$startTime>=e.$duration?this.returnSuccess?SUCCESS:2:this.child._execute(t)}},Wait:class extends R{constructor({duration:t=0,services:e,title:i,name:s="Wait"}={}){super({title:i,name:s,properties:{duration:t},services:e}),this.durationExpression=this.addExpression(t)}open(t){var e=this.getNodeMemory(t);e.$startTime=t.currentTime,e.$duration=t.evalExpression(this.durationExpression)}tick(t){var e=this.getNodeMemory(t),i=t.currentTime,s=e.$startTime,r=e.$duration;if(r>0){if(i-s<r)return 3}else if(0===r&&i===s)return 3;return 1}},WeightSelector:class extends A{constructor({expression:t=null,weights:e,conditionEvalBreak:i=!1,children:s=[],services:r,title:n,name:a="WeightSelector"}={},o){if(void 0===e){e=[];for(var h=0,l=0,c=s.length;l<c;l++){var u,d=s[l];d instanceof L||"string"==typeof d?u=1:(u=d.weight,s[l]=d.node),e.push(u),h+=u}for(l=0,c=e.length;l<c;l++)e[l]/=h}super({children:s,services:r,title:n,name:a,properties:{expression:t,weights:e,conditionEvalBreak:i}},o),this.expression=t?this.addExpression(t):null,this.weights=e,this.conditionEvalBreak=i,this.forceSelectChildIndex=void 0}open(t){this.getNodeMemory(t).$runningChild=-1}setSelectChildIndex(t){return void 0!==this.forceSelectChildIndex?this.forceSelectChildIndex:(this.forceSelectChildIndex=t,this)}evalCondition(t){if(void 0!==this.forceSelectChildIndex)return this.forceSelectChildIndex;for(var e=this.expression?t.evalExpression(this.expression):Math.random(),i=0,s=this.weights.length;i<s;i++)if((e-=this.weights[i])<0)return i}tick(t){if(0===this.children.length)return 9;var e=this.getNodeMemory(t),i=e.$runningChild;if(i<0&&(void 0===(i=this.evalCondition(t))&&(i=this.children.length-1),this.conditionEvalBreak))return e.$runningChild=i,3;var s=this.children[i]._execute(t);return e.$runningChild=3===s?i:-1,s}abortChildren(t){var e=this.getNodeMemory(t),i=this.children[e.$runningChild];i&&(i._abort(t),e.$runningChild=-1)}}});class J{constructor(){this.tree=null,this.blackboard=null,this.target=null,this._openNodes=[],this._nodeCount=0,this._currentNode=null,this._currentTime=void 0}destroy(){this.tree=null,this.blackboard=null,this.target=null,this._openNodes.length=0}setTree(t){return this.tree=t,this}setBlackBoard(t){return this.blackboard=t,this}setTarget(t){return this.target=t,this}reset(){return this._openNodes.length=0,this._nodeCount=0,this._currentTime=void 0,this}getGlobalMemory(){return this.blackboard.getGlobalMemory()}getTreeMemory(){return this.blackboard.getTreeMemory(this.tree.id)}getNodeMemory(t){return this.blackboard.getNodeMemory(this.tree.id,t)}get currentTime(){return this.blackboard.hasValidCurrentTime()?this.blackboard.getCurrentTime():(void 0===this._currentTime&&(this._currentTime=(new Date).getTime()),this._currentTime)}evalExpression(t){return t.eval(this.blackboard.getGlobalMemory())}_enterNode(t){this._nodeCount++,this._openNodes.push(t),this._currentNode=t}_openNode(t){this._currentNode=t}_tickNode(t){this._currentNode=t}_closeNode(t){Y(this._openNodes,t),this._currentNode=t}_exitNode(t){this._currentNode=t}}class K{constructor({id:t,title:e,description:i,properties:s,root:r=null}={}){void 0===t&&(t=f()),this.id=t,this.name="",this.category=n,this.title=e||"",this.description=i||"",this.properties=s||{},this._root=r,this.ticker=(new J).setTree(this)}destroy(){this._root.destroy(),this.ticker.destroy(),this._root=void 0,this.ticker=void 0}setTitle(t){return this.title=t,this}setName(t){return this.name=t,this}setDescription(t){return this.description=t,this}setRoot(t){return this.root=t,this}getRoot(){return this.root}get root(){return this._root}set root(t){t?(this._root=t,t.setParent(this)):(this._root&&this._root.setParent(null),this._root=null)}forEachNode(t,e){return m(this.root,t,e),this}getAllNodes(t){return void 0===t&&(t=[]),this.forEachNode((function(e){t.push(e)})),t}getChildrenNodes(t,e){return void 0===t&&(t=this.root),void 0===e&&(e=[]),m(t,(function(t){e.push(t)})),e}tick(t,e){if(!t)throw"The blackboard parameter is obligatory and must be an instance of Blackboard";var i=this.ticker;i.setBlackBoard(t).setTarget(e).reset();var s=this.root._execute(i);return t.set(l,s,this.id),s}abort(t,e){if(!t)throw"The blackboard parameter is obligatory and must be an instance of Blackboard";var i=this.ticker;return i.setBlackBoard(t).setTarget(e).reset(),this.root.abortChildren(i),t.set(l,0,this.id),0}static setStartIDValue(t){p(t)}static getSerialNumber(){return g()}static setSerialIDPrefix(t){!function(t){d=t}(t)}}var q={dump:function(){var t={sn:g(),id:this.id,title:this.title,description:this.description,root:this.root?this.root.id:null,properties:y(this.properties),nodes:[]};if(!this.root)return t;var e=[];m(this.root,(function(t){e.push(t)}));for(var i=0,s=e.length;i<s;i++){var r=e[i],n={id:r.id,name:r.name,title:r.title,description:r.description,properties:y(r.properties)};switch(r.category){case a:n.children=r.children.map((t=>t.id)),r.services&&(n.services=r.services.map((t=>t.id)));break;case o:r.child&&(n.child=r.child.id);break;case h:r.services&&(n.services=r.services.map((t=>t.id)))}t.nodes.push(n)}return t},load:function(t,e){var i=t.sn;null!=i&&p(Math.max(g(),i)),e=e||{},this.title=t.title||this.title,this.description=t.description||this.description,this.properties=t.properties||this.properties;for(var s=t.nodes,r={},n=s.length-1;n>=0;n--){var a,o=s[n],h=o.name;if(h in e)a=e[h];else{if(!(h in $))throw new EvalError(`BehaviorTree.load: Invalid node name "${h}".`);a=$[h]}var l={};o.hasOwnProperty("children")&&(l.children=o.children),o.hasOwnProperty("child")&&(l.child=o.child),o.hasOwnProperty("services")&&(l.services=o.services);var c=new a(l=Object.assign(l,o.properties),r);c.id=o.id||c.id,c.title=o.title||c.title,c.description=o.description||c.description,c.properties=o.properties||c.properties,r[c.id]=c}return this.root=r[t.root],this}};Object.assign(K.prototype,q,v);var Z=function(t){return null==t||""===t||0===t.length},Q=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Z(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(Z(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n<a;n++){var o;null!=s[r=e[n]]&&"object"==typeof s[r]||(o=n===a-1?void 0===i?{}:i:{},s[r]=o),s=s[r]}}return s}(t,e);n[r]=i}return t}},tt=function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,n=i,a=0;a<s.length;a++){if(e=s[a],!r.hasOwnProperty(e)){n=i;break}r=n=r[e]}return n},et=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;r<i.length;r++){if(!s.hasOwnProperty(i[r]))return!1;s=s[i[r]]}return!0}return!1}return!1},it=function(t){return null==t||""===t||0===t.length},st=function(t,e,i){if(void 0===i&&(i="."),"object"==typeof t){if(it(e));else{"string"==typeof e&&(e=e.split(i));var s=e.pop(),r=function(t,e){var i=t;if(it(e));else{var s;"string"==typeof e&&(e=e.split("."));for(var r=0,n=e.length;r<n;r++){if(null==i[s=e[r]]||"object"!=typeof i[s])return;i=i[s]}}return i}(t,e);r&&delete r[s]}return t}};let rt=class{constructor(){this._baseMemory={},this._treeMemory={}}destroy(){this._baseMemory=void 0,this._treeMemory=void 0}_getTreeMemory(t){return this._treeMemory[t]||(this._treeMemory[t]={nodeMemory:{}}),this._treeMemory[t]}_getNodeMemory(t,e){var i=t.nodeMemory;return i[e]||(i[e]={}),i[e]}_getMemory(t,e){var i;return void 0!==t?(i=this._getTreeMemory(t),void 0!==e&&(i=this._getNodeMemory(i,e))):i=this._baseMemory,i}set(t,e,i,s){var r=this._getMemory(i,s);return Q(r,t,e),this}setData(t,e,i,s){return this.set(t,e,i,s)}get(t,e,i){var s=this._getMemory(e,i);return tt(s,t)}getData(t,e,i){return this.get(t,e,i)}has(t,e,i){var s;return void 0!==e?(s=this._treeMemory[e])&&void 0!==i&&(s=treeMemory.nodeMemory[i]):s=this._baseMemory,!!s&&et(s,t)}hasData(t,e,i){return this.has(t,e,i)}inc(t,e,i,s,r){var n;return this.has(t,i,s)?n=this.get(t,i,s)+e:(void 0===r&&(r=0),n=r),this.set(t,n,i,s),this}incData(t,e,i,s,r){return this.inc(t,e,i,s,r)}toggle(t,e,i,s){var r;return this.has(t,e,i)?r=!this.get(t,e,i):(void 0===s&&(s=!1),r=s),this.set(t,r,e,i),this}toggleData(t,e,i,s){return this.toggle(t,e,i,s)}removeData(t,e,i){var s=this._getMemory(e,i);st(s,t)}removeTree(t){return this._treeMemory[t]&&delete this._treeMemory[t],this}removeTreeData(t){return this.removeTree(t)}removeNode(t,e){var i=this._treeMemory[t];return i&&i.nodeMemory[e]&&delete i.nodeMemory[e],this}removeNodeData(t,e){return this.removeNode(t,e)}getGlobalMemory(){return this._baseMemory}getTreeMemory(t){return this._getTreeMemory(t)}getNodeMemory(t,e){return this._getNodeMemory(this._getTreeMemory(t),e)}dump(){return{base:y(this._baseMemory),tree:y(this._treeMemory)}}load(t){return this._baseMemory=y(t.base),this._treeMemory=y(t.tree),this}};class nt extends rt{constructor({currentTimeKey:t="$currentTime"}={}){super(),this.currentTimeKey=t}getTreeState(t){return this.get(l,t)}setTreeState(t,e){return this.set(l,e,t),this}hasValidCurrentTime(){return this.has(this.currentTimeKey)}setCurrentTime(t){return this.set(this.currentTimeKey,t),this}getCurrentTime(){return this.get(this.currentTimeKey)}incCurrentTime(t){return this.inc(this.currentTimeKey,t),this}}var at={bindTaskActionNode(t,e){this.__bindTick||(this.__bindTick=[],this.__bindNode=[]),this.__bindTick.push(t),this.__bindNode.push(e)},unBindTaskAction(){this.__bindTick&&(this.__bindTick.pop(),this.__bindNode.pop())},pauseEventSheet(){var t=this.__bindNode[this.__bindNode.length-1];if(!t)return null;var e=this.__bindTick[this.__bindTick.length-1];return t.pauseEventSheet(e)},pauseEventSheetUnitlEvent(t,e){var i=this.__bindNode[this.__bindNode.length-1];if(!i)return null;var s=this.__bindTick[this.__bindTick.length-1];return i.pauseEventSheetUnitlEvent(s,t,e),this}},ot={getTree(t){for(var e=this.trees,i=0,s=e.length;i<s;i++){var r=e[i];if(r.title===t)return r}},getTreeState(t){var e="string"==typeof t?t:t.id;return this.blackboard.getTreeState(e)},getEventSheetTitleList(t){return void 0===t&&(t=[]),this.trees.forEach((function(e){t.push(e.title)})),t}},ht={addTree(t){return this.trees.push(t),this}},lt={removeAllEventSheets(){return this.trees.forEach((function(t){this.blackboard.remo