pixospritz-core 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js ADDED
@@ -0,0 +1,3 @@
1
+ /*! For license information please see bundle.js.LICENSE.txt */
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports["calliope-pixos"]=e(require("react"),require("react-dom")):t["calliope-pixos"]=e(t.React,t.ReactDOM)}(this,((t,e)=>(()=>{var r={5019:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>n});const n={init:function(t,e,r){console.log({msg:"initializing animation",length:t,untilFrame:e,finish:r}),this.length=t,this.untilFrame=e,this.finish=r},tick:function(t){if(this.loaded){this.facing&&this.facing!=this.sprite.facing&&this.sprite.setFacing(this.facing);var e=this.startTime+this.length,r=(t-this.startTime)/this.length;t>=e&&(r=1,this.finish&&this.finish(!0));var n=Math.floor(r*this.untilFrame);return n!=this.sprite.animFrame&&this.sprite.setFrame(n),t>=e}}}},4146:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>d});var n=r(9010),o=r(4395);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(){a=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",s=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};u(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,a,s,c){var u=f(t[o],t,a);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==i(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,c)}),(function(t){n("throw",t,s,c)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(b,"constructor",y),u(y,"constructor",p),p.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,c,"Generator"),u(b,o,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function s(t,e,r){return s=c()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&u(o,r.prototype),o},s.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function l(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function h(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}const d={init:(p=a().mark((function t(e,r,i,c,u){var f,h,d,p,y,g,m,v,b,w,x,_,k,E,A,S,L,O,P,T,C,M,j,I,B,z,D,N,R=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==(g=null===(f=this.sprite.zone)||void 0===f||null===(h=f.world)||void 0===h?void 0:h.engine)||!g.renderManager){t.next=5;break}return console.log("fading out..."),t.next=5,g.renderManager.startTransition({effect:"cross",direction:"out",duration:500});case 5:return t.next=7,this.sprite.zone.world.loadZone(e,!1,!1,null);case 7:return this.fromZone=t.sent,t.next=10,this.sprite.zone.world.loadZone(i,!1,!1,null);case 10:this.toZone=t.sent,this.from=s(n.OW,l(r)),this.to=s(n.OW,l(c)),this.facing=o.Nm.fromOffset([Math.round(c.x-r.x),Math.round(c.y-r.y)]),this.length=u;try{m=this.toZone?this.toZone.spriteList.filter((function(t){return t.pos.x===R.to.x&&t.pos.y===R.to.y})):[],this.preserveHeight=m.some((function(t){return!0===t.preserveHeightOnWalk})),this.preserveHeight&&this.from&&(null===this.from.z||void 0===this.from.z)&&(E=this.from.x+(null!==(v=null===(b=this.sprite)||void 0===b||null===(w=b.hotspotOffset)||void 0===w?void 0:w.x)&&void 0!==v?v:0),A=this.from.y+(null!==(x=null===(_=this.sprite)||void 0===_||null===(k=_.hotspotOffset)||void 0===k?void 0:k.y)&&void 0!==x?x:0),this.from.z="function"==typeof this.fromZone.getHeight?this.fromZone.getHeight(E,A):0,this.preserveHeightSourceZ=this.from.z)}catch(t){}this.preserveHeight&&null!==(d=this.sprite)&&void 0!==d&&null!==(p=d.zone)&&void 0!==p&&null!==(y=p.engine)&&void 0!==y&&y.debug&&console.log("[changezone.init] preserveHeight true for transition from",null!==(S=null===(L=(O=this.from).toArray)||void 0===L?void 0:L.call(O))&&void 0!==S?S:this.from,"to",null!==(P=null===(T=(C=this.to).toArray)||void 0===T?void 0:T.call(C))&&void 0!==P?P:this.to);try{M=this.from.x+(this.sprite?this.sprite.hotspotOffset.x:0),j=this.from.y+(this.sprite?this.sprite.hotspotOffset.y:0),I=this.to.x+(this.sprite?this.sprite.hotspotOffset.x:0),B=this.to.y+(this.sprite?this.sprite.hotspotOffset.y:0),!this.from||null!==this.from.z&&void 0!==this.from.z||(this.from.z="function"==typeof this.fromZone.getHeight?this.fromZone.getHeight(M,j):0),!this.to||null!==this.to.z&&void 0!==this.to.z||(this.to.z="function"==typeof this.toZone.getHeight?this.toZone.getHeight(I,B):0)}catch(t){null!==(z=this.sprite)&&void 0!==z&&null!==(D=z.zone)&&void 0!==D&&null!==(N=D.engine)&&void 0!==N&&N.debug&&console.warn("changezone.init failed to compute z for from/to",(null==t?void 0:t.message)||t)}if(console.log({renderManager:null==g?void 0:g.renderManager,fromZoneId:e,toZoneId:i,from:r,to:c,length:u}),null==g||!g.renderManager){t.next=23;break}return console.log("fading in..."),t.next=23,g.renderManager.startTransition({effect:"cross",direction:"in",duration:500});case 23:case"end":return t.stop()}}),t,this)})),y=function(){var t=this,e=arguments;return new Promise((function(r,n){var o=p.apply(t,e);function i(t){h(o,r,n,i,a,"next",t)}function a(t){h(o,r,n,i,a,"throw",t)}i(void 0)}))},function(t,e,r,n,o){return y.apply(this,arguments)}),tick:function(t){if(this.toZone.loaded&&this.fromZone.loaded){this.facing&&this.facing!=this.sprite.facing&&(this.sprite.facing=this.facing,this.sprite.setFrame(0));var e=this.startTime+this.length,r=(t-this.startTime)/this.length;if(t>=e)(0,n.t8)(this.to,this.sprite.pos),r=1;else{this.sprite.pos.x=this.from.x+r*(this.to.x-this.from.x),this.sprite.pos.y=this.from.y+r*(this.to.y-this.from.y);var o=this.sprite.pos.x+this.sprite.hotspotOffset.x,i=this.sprite.pos.y+this.sprite.hotspotOffset.y,a="number"==typeof this.from.z&&"number"==typeof this.to.z?this.from.z+r*(this.to.z-this.from.z):null;if(this.switchRenderZone||this.fromZone.isInZone(o,i)||(this.switchRenderZone=!0),this.preserveHeight){var s,c;this.sprite.pos.z=null!==(s=this.preserveHeightSourceZ)&&void 0!==s?s:this.sprite.pos.z,null!==(c=this.sprite.zone.engine)&&void 0!==c&&c.debug&&!this.__preserveLog&&(this.__preserveLog=!0,console.log("[changezone.tick] preserveHeight applied for sprite",this.sprite.id,"sourceZ=",this.preserveHeightSourceZ))}else{var u,l=(this.switchRenderZone?this.toZone:this.fromZone).getHeight(o,i);this.sprite.pos.z=null!==a?a:l,null!==(u=this.sprite.zone.engine)&&void 0!==u&&u.debug&&this.__tickLogCount<3&&(this.__tickLogCount||(this.__tickLogCount=0),this.__tickLogCount++,console.log("[changezone.tick] sprite",this.sprite.id,"frac=",r.toFixed(2),"hx,hy=",o.toFixed(2),i.toFixed(2),"zLerp=",null==a?void 0:a.toFixed(2),"zZone=",null==l?void 0:l.toFixed(2),"pos.z=",this.sprite.pos.z.toFixed(2)))}}var f=Math.floor(4*r);return f!=this.sprite.animFrame&&this.sprite.setFrame(f),this.sprite.zone.isInZone(this.sprite.pos.x,this.sprite.pos.y)||(this.fromZone.removeSprite(this.sprite.id),this.sprite.zone.world.runAfterTick(function(){this.toZone.addSprite(this.sprite)}.bind(this))),t>=e}}};var p,y},6023:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>n});const n={init:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.engine=this.sprite.engine,this.text="",this.prompt=t,this.scrolling=e,this.line=0,this.options=r,this.completed=!1,this.lastKey=(new Date).getTime()},tick:function(t){return!!this.loaded&&(this.options&&this.options.autoclose&&(this.endTime=this.endTime?this.endTime:null!==(e=this.options.endTime)&&void 0!==e?e:(new Date).getTime()+1e4,t>this.endTime&&(this.completed=!0)),this.checkInput(t),this.textbox=this.engine.hud.scrollText(this.prompt+this.text,this.scrolling,this.options),this.completed);var e},checkInput:function(t){if(t>this.lastKey+100){var e=!1;switch(this.engine.keyboard.lastPressedCode()){case"Escape":this.completed=!0,e=!0;break;case"Backspace":var r=this.text.split("");r.pop(),this.text=r.join(""),this.lastKey=t,e=!0;break;case"Enter":this.sprite.setGreeting(this.text),this.sprite.speech.clearHud&&this.sprite.speech.clearHud(),this.speechbox=this.sprite.speech.scrollText(this.text),this.sprite.speech.loadImage(),this.completed=!0,e=!0}if(!e){var n=this.engine.keyboard.lastPressedKey();n&&(this.lastKey=t,this.text+=""+n)}}}}},3582:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>s});var n=r(4395);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(){i=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",s=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};u(g,a,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,a)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(i,a,s,c){var u=f(t[i],t,a);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==o(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,c)}),(function(t){n("throw",t,s,c)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,c)}))}c(u.arg)}var i;this._invoke=function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(b,"constructor",y),u(y,"constructor",p),p.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,c,"Generator"),u(b,a,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function a(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}const s={init:(c=i().mark((function t(e,r){var n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.zone=r,this.moveLength=e,this.startTime=(new Date).getTime(),this.lastKey=(new Date).getTime(),this.completed=!1,t.next=7,this.zone.engine.resourceManager.audioLoader.loadFromZip(this.sprite.zip,null!==(n=this.sprite.danceSound)&&void 0!==n?n:"/pixospritz/audio/sewer-beat.mp3",!0);case 7:this.audio=t.sent,this.zone.audio&&this.zone.audio.pauseAudio(),this.audio&&this.audio.playAudio();case 10:case"end":return t.stop()}}),t,this)})),u=function(){var t=this,e=arguments;return new Promise((function(r,n){var o=c.apply(t,e);function i(t){a(o,r,n,i,s,"next",t)}function s(t){a(o,r,n,i,s,"throw",t)}i(void 0)}))},function(t,e){return u.apply(this,arguments)}),tick:function(t){if(this.loaded){var e=new Uint8Array(this.audio.analyser.frequencyBinCount);if(this.audio.analyser.getByteFrequencyData(e),this.checkInput(t),t>this.startTime+this.moveLength){for(var r=this.sprite.facing==n.Nm.Right?n.Nm.Left:n.Nm.Right,o=null,i=0;i<16;i++)o=-e[i]/2;r=o>80?this.sprite.facing==n.Nm.Right?n.Nm.Down:n.Nm.Left:this.sprite.facing==n.Nm.Up?n.Nm.Left:n.Nm.Down,this.sprite.addAction(this.sprite.faceDir(r)).then((function(){})),this.startTime=t}return this.completed}},checkInput:function(t){if(t>this.lastKey+this.moveLength)return"q"===this.sprite.engine.keyboard.lastPressed("q")&&(this.audio&&this.audio.pauseAudio(),this.completed=!0),this.lastKey=(new Date).getTime(),null}};var c,u},3419:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>n});const n={init:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.engine=this.sprite.engine,this.text=t,this.displayText="string"==typeof t?t:this.text.shift(),this.scrolling=e,this.options=r,this.completed=!1,this.lastText=!1,this.speechOutput=!0,this.lastKey=(new Date).getTime(),this.loaded=!0},tick:function(t){var e,r;if(this.loaded)return this.options&&this.options.autoclose&&(this.endTime=this.endTime?this.endTime:null!==(e=this.options.endTime)&&void 0!==e?e:(new Date).getTime()+(null!==(r=1e3*this.options.duration)&&void 0!==r?r:1e4),t>this.endTime&&(this.completed=!0)),this.checkInput(t),this.sprite.speak(this.displayText,!1,this),this.completed&&this.options.onClose&&(this.sprite.speech.clearHud&&this.sprite.speech.clearHud(),this.options.onClose()),this.completed},checkInput:function(t){if(t>this.lastKey+100){switch(this.engine.keyboard.lastPressedCode()){case"Escape":this.sprite.speak(!1),this.completed=!0;break;case"Enter":"string"==typeof this.text||0===this.text.length?(this.sprite.speak(!1),this.completed=!0):(this.completed=!1,this.displayText=this.text.shift(),window.speechSynthesis.cancel(),this.speechOutput=!0,this.sprite.speak(this.displayText,!1,this))}if(this.engine.gamepad.keyPressed("a"))return void("string"==typeof this.text||0===this.text.length?(this.sprite.speak(!1),this.completed=!0):(this.completed=!1,this.displayText=this.text.shift(),window.speechSynthesis.cancel(),this.speechOutput=!0,this.sprite.speak(this.displayText,!1,this)))}}}},8463:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>n});const n={init:function(t){this.facing=t},tick:function(t){return this.facing&&this.facing!=this.sprite.facing&&this.sprite.setFacing(this.facing),!0}}},3972:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>n});const n={init:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.engine=this.sprite.engine,this.greeting=t,this.options=e,this.completed=!1},tick:function(t){if(this.loaded)return this.sprite.setGreeting(this.text),!0}}},1726:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>p});var n=r(9010),o=r(4395);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(){a=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",s=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};u(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,a,s,c){var u=f(t[o],t,a);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==i(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,c)}),(function(t){n("throw",t,s,c)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(b,"constructor",y),u(y,"constructor",p),p.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,c,"Generator"),u(b,o,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function s(t,e,r){return s=c()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&u(o,r.prototype),o},s.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}function l(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function h(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function d(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){h(i,n,o,a,s,"next",t)}function s(t){h(i,n,o,a,s,"throw",t)}a(void 0)}))}}const p={init:(g=d(a().mark((function t(e,r,i){var c=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.world=i,this.from=s(n.OW,l(e)),this.facing=r,this.offset=o.Nm.toOffset(r),this.lastKey=(new Date).getTime(),this.completed=!1,this.to=[e[0]+this.offset[0],e[1]+this.offset[1]],this.zone=i.zoneContaining.apply(i,l(this.to)),this.spriteList=this.zone.spriteList.filter((function(t){return t.pos.x===c.to[0]&&t.pos.y===c.to[1]})),this.objectList=this.zone.objectList.filter((function(t){return t.pos.x===c.to[0]&&t.pos.y===c.to[1]})),this.finish=this.finish.bind(this),this.interact();case 12:case"end":return t.stop()}}),t,this)}))),function(t,e,r){return g.apply(this,arguments)}),interact:(y=d(a().mark((function t(){var e=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return 0===this.spriteList.length&&0===this.objectList.length&&(this.completed=!0),t.next=3,Promise.all(this.objectList.map(function(){var t=d(a().mark((function t(r){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((n=r.faceDir(o.Nm.reverse(e.facing)))&&r.addAction(n),!r.interact){t.next=8;break}return t.next=5,e.zone.objectDict[r.id].interact(e.sprite,e.finish);case 5:t.t0=t.sent,t.next=9;break;case 8:t.t0=null;case 9:return t.abrupt("return",t.t0);case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 3:return t.next=5,Promise.all(this.spriteList.map(function(){var t=d(a().mark((function t(r){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((n=r.faceDir(o.Nm.reverse(e.facing)))&&r.addAction(n),!r.interact){t.next=8;break}return t.next=5,e.zone.spriteDict[r.id].interact(e.sprite,e.finish);case 5:t.t0=t.sent,t.next=9;break;case 8:t.t0=null;case 9:return t.abrupt("return",t.t0);case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 5:case"end":return t.stop()}}),t,this)}))),function(){return y.apply(this,arguments)}),finish:function(t){t&&(this.completed=!0)},tick:function(t){if(this.loaded)return this.checkInput(t),this.completed},checkInput:function(t){if(t>this.lastKey+Math.max(this.length,200)){if("q"!==this.sprite.engine.keyboard.lastPressed("q"))return this.lastKey=(new Date).getTime(),null;this.completed=!0}this.sprite.engine.gamepad.keyPressed("a")&&(this.completed=!0)}};var y,g},6481:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>p});var n=r(9010),o=r(4395);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(){a=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",s=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};u(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,a,s,c){var u=f(t[o],t,a);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==i(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,c)}),(function(t){n("throw",t,s,c)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(b,"constructor",y),u(y,"constructor",p),p.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,c,"Generator"),u(b,o,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function s(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function c(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){s(i,n,o,a,c,"next",t)}function c(t){s(i,n,o,a,c,"throw",t)}a(void 0)}))}}function u(t,e,r){return u=l()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&f(o,r.prototype),o},u.apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function f(t,e){return f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},f(t,e)}function h(t){return function(t){if(Array.isArray(t))return d(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return d(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const p={init:function(t,e,r,i){var a=this;this.zone=i,this.from=u(n.OW,h(t)),this.to=u(n.OW,h(e)),this.facing=o.Nm.fromOffset([Math.round(e.x-t.x),Math.round(e.y-t.y)]),this.length=r,this.spriteList=this.zone.spriteList.filter((function(t){return t.pos.x===a.to.x&&t.pos.y===a.to.y}))},tick:function(t){if(this.loaded){this.facing&&this.facing!=this.sprite.facing&&this.sprite.setFacing(this.facing);var e=this.startTime+this.length,r=(t-this.startTime)/this.length;if(t>=e){this.sprite.pos.x=this.to.x,this.sprite.pos.y=this.to.y;var n=this.sprite.pos.x+this.sprite.hotspotOffset.x,o=this.sprite.pos.y+this.sprite.hotspotOffset.y;this.sprite.pos.z=this.sprite.zone.getHeight(n,o),r=1,this.onStep();var i=Math.floor(4*r);return i!=this.sprite.animFrame&&this.sprite.setFrame(i),t>=e}this.sprite.pos.x=this.from.x+r*(this.to.x-this.from.x),this.sprite.pos.y=this.from.y+r*(this.to.y-this.from.y);var a=this.sprite.pos.x+this.sprite.hotspotOffset.x,s=this.sprite.pos.y+this.sprite.hotspotOffset.y;this.sprite.pos.z=this.sprite.zone.getHeight(a,s);var c=Math.floor(4*r);return c!=this.sprite.animFrame&&this.sprite.setFrame(c),!1}},onStep:(y=c(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return 0===this.spriteList.length&&(this.completed=!0),t.next=3,Promise.all(this.spriteList.map(function(){var t=c(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.onStep){t.next=6;break}return t.next=3,e.onStep(e,e);case 3:t.t0=t.sent,t.next=7;break;case 6:t.t0=null;case 7:return t.abrupt("return",t.t0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 3:case"end":return t.stop()}}),t,this)}))),function(){return y.apply(this,arguments)})};var y},955:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>y});var n=r(9010),o=r(4395),i=r(679);function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function s(){s=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};u(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,s,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==a(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,c)}),(function(t){n("throw",t,s,c)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(b,"constructor",y),u(y,"constructor",p),p.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,c,"Generator"),u(b,o,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function c(t,e,r){return c=u()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&l(o,r.prototype),o},c.apply(null,arguments)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function l(t,e){return l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},l(t,e)}function f(t){return function(t){if(Array.isArray(t))return d(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||h(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){if(t){if("string"==typeof t)return d(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(t,e):void 0}}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function p(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}const y={init:(g=s().mark((function t(e,r,o,i){var a,u,l;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.zone=i,this.from=c(n.OW,f(e)),this.to=c(n.OW,f(r)),this.lastKey=(new Date).getTime(),this.completed=!1,this.direction=1,t.next=8,this.zone.engine.resourceManager.audioLoader.loadFromZip(this.sprite.zip,null!==(a=this.sprite.patrolSound)&&void 0!==a?a:"sewer-beat.mp3",!0);case 8:this.audio=t.sent,u=this.sprite.zone.world.pathFind(e,r),d=2,l=function(t){if(Array.isArray(t))return t}(s=u)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}}(s,d)||h(s,d)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),this.hasMoves=l[0],this.moveList=l[1],this.hasMoves||(this.completed=!0),this.moveIndex=1,this.moveLength=o,this.zone.audio&&this.zone.audio.pauseAudio(),this.audio&&this.audio.playAudio();case 18:case"end":return t.stop()}var s,d}),t,this)})),m=function(){var t=this,e=arguments;return new Promise((function(r,n){var o=g.apply(t,e);function i(t){p(o,r,n,i,a,"next",t)}function a(t){p(o,r,n,i,a,"throw",t)}i(void 0)}))},function(t,e,r,n){return m.apply(this,arguments)}),tick:function(t){if(this.loaded){if(this.checkInput(t),t>this.startTime+this.moveLength){var e=this.moveList[this.moveIndex];if(this.moveList.length>2){var r=0==this.moveIndex?this.moveList[this.moveIndex+1]:this.moveIndex+1>=this.moveList.length?this.moveList[this.moveList.length-1]:this.moveList[this.moveIndex-1],n=o.Nm.fromOffset([Math.round(e[0]-r[0]),Math.round(e[1]-r[1])]);if(this.sprite.zone.isInZone(e[0],e[1]))this.currentAction=new i.aW(this.sprite.engine,"move",[r,e,this.moveLength,this.zone],this.sprite);else{var a=this.sprite.zone.world.zoneContaining(e[0],e[1]);a&&a.loaded&&a.isWalkable(e[0],e[1],o.Nm.reverse(n))?this.currentAction=new i.aW(this.sprite.engine,"changezone",[this.sprite.zone.id,this.sprite.pos.toArray(),a.id,e,this.moveLength],this.sprite):this.currentAction=this.sprite.faceDir(n)}this.sprite.facing!==n&&(this.currentAction=this.sprite.faceDir(n)),this.currentAction&&(this.currentAction.facing=n,this.sprite.addAction(Promise.resolve(this.currentAction)).then((function(){})))}this.moveIndex+this.direction>=this.moveList.length&&(this.direction*=-1,this.completed=!0,this.zone.audio&&this.zone.audio.playAudio(),this.audio&&this.audio.pauseAudio()),this.moveIndex+=this.direction,this.startTime=t}return this.completed}},checkInput:function(t){if(t>this.lastKey+Math.max(this.moveLength,200))return"q"===this.sprite.engine.keyboard.lastPressed("q")&&(this.zone.audio&&this.zone.audio.playAudio(),this.audio&&this.audio.pauseAudio(),this.completed=!0),this.lastKey=(new Date).getTime(),null}};var g,m},5214:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>n});const n={init:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.engine=this.sprite.engine,this.text="",this.scrolling=r,this.line=0,this.options=n,this.completed=!1,this.lastKey=(new Date).getTime(),this.listenerId=this.engine.gamepad.attachListener(this.hookListener()),this.touches=[],this.menuDict=null!=t?t:{},this.activeMenus=null!=e?e:[],this.selectedMenu={},this.selectedMenuId=null,this.isTouched=!1},tick:function(t){var e,r=this;if(this.loaded)return this.options&&this.options.autoclose&&(this.endTime=this.endTime?this.endTime:null!==(e=this.options.endTime)&&void 0!==e?e:(new Date).getTime()+1e4,t>this.endTime&&(this.completed=!0)),this.checkInput(t),Object.keys(this.menuDict).filter((function(t){return r.activeMenus.includes(t)})).map((function(t){var e=r.menuDict[t],n=e.colours;e.active&&(n.background="#555"),r.engine.hud.drawButton(e.text,e.x,e.y,e.w,e.h,e.colours)})),this.textbox=this.engine.hud.scrollText(this.prompt+this.text,this.scrolling,this.options),this.completed&&this.unhookListener(),this.completed},unhookListener:function(){this.engine.gamepad.removeListener(this.listenerId),this.listenerId=null},hookListener:function(){var t=this,e=function(e){var r=e.touches;if(t.isTouched=!0,t.touches=r,t.isTouched&&t.touches.length>0&&t.lastKey+100<(new Date).getTime()){var n=t.touches[0].x,o=t.touches[0].y,i=t;i.activeMenus.filter((function(t){var e=i.menuDict[t];return n<e.x+e.w&&n>e.x&&o<e.y+e.h&&o>e.y})).map((function(e){var r=i.menuDict[e];r.trigger&&r.trigger(t),r.children&&(i.activeMenus=r.children)}))}},r=function(e){t.touches=e},n=function(e){t.isTouched=!1,t.touches=e};return{touchstart:e,touchmove:r,touchend:n,mousedown:e,mousemove:r,mouseup:n}},checkInput:function(t){if(t>this.lastKey+200){var e=!1;switch(this.engine.keyboard.lastPressedCode()){case"Escape":this.completed=!0,e=!0;break;case"Backspace":var r=this.text.split("");r.pop(),this.text=r.join(""),this.lastKey=t,e=!0;break;case"Enter":this.sprite.setGreeting(this.text),this.sprite.speech.clearHud&&this.sprite.speech.clearHud(),this.speechbox=this.sprite.speech.scrollText(this.text),this.sprite.speech.loadImage(),this.completed=!0,e=!0}if(!e){var n=this.engine.keyboard.lastPressedKey();n&&(this.lastKey=t,this.text+=""+n)}}}}},6027:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){o=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};u(g,a,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,a)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(i,a,s,c){var u=f(t[i],t,a);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==n(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){o("next",t,s,c)}),(function(t){o("throw",t,s,c)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return o("throw",t,s,c)}))}c(u.arg)}var i;this._invoke=function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(b,"constructor",y),u(y,"constructor",p),p.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,c,"Generator"),u(b,a,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function i(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}r.r(e),r.d(e,{default:()=>a});const a={init:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.zone=e,this.world=e.world,this.lastKey=(new Date).getTime(),this.completed=!1,this.onCompleted=function(){return console.log("script finished")},r&&(this.onCompleted=r),this.triggerId=t,this.triggerScript()},triggerScript:function(){var t=this;this.triggerId||(this.completed=!0),Promise.all(this.zone.scripts.filter((function(e){return e.id===t.triggerId})).map(function(){var e,r=(e=o().mark((function e(r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.trigger.call(t.zone);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function s(t){i(a,n,o,s,c,"next",t)}function c(t){i(a,n,o,s,c,"throw",t)}s(void 0)}))});return function(t){return r.apply(this,arguments)}}())).then((function(){t.completed=!0}))},tick:function(t){if(this.loaded)return this.completed&&this.onCompleted(),this.completed}}},5490:(t,e,r)=>{"use strict";function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,{Ky:()=>s,ZP:()=>c,_C:()=>u}),r(9124);var s=new FontFace("minecraftia","url(/pixospritz/font/minecraftia.ttf)"),c=o((function t(e){var r=this;return i(this,t),a(this,"init",(function(){r.ctx=r.engine.ctx})),a(this,"drawButton",(function(t,e,n,o,i,a){var s=r.ctx;r.applyStyle({font:"20px invasion2000",textAlign:"center",textBaseline:"middle",fillStyle:a.background,globalAlpha:1}),s.fillStyle=a.background,s.beginPath(),s.rect(e,n,o,i),s.fill();var c=s.createLinearGradient(e,n,e,n+i/2);c.addColorStop(0,"rgba(255, 255, 255, 0.8)"),c.addColorStop(1,"rgba(0, 0, 0, 0.3)"),s.fillStyle=c,s.globalAlpha=.7,s.fillRect(e,n,o,i/2),s.fillStyle=a.text,s.fillText(t,e+o/2,n+i/2),s.beginPath(),s.strokeStyle="#fff",s.rect(e,n,o,i),s.stroke()})),a(this,"clearHud",(function(){r.ctx.clearRect(0,0,r.engine.ctx.canvas.width,r.engine.ctx.canvas.height)})),a(this,"setBackdrop",(function(t){r.backdropImage=t})),a(this,"setCutouts",(function(t){r.cutoutImages=t})),a(this,"applyStyle",(function(t){Object.assign(r.ctx,{font:"20px invasion2000",textAlign:"center",textBaseline:"middle",fillStyle:"#ffffff",globalAlpha:1},t)})),a(this,"writeText",(function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;r.applyStyle({font:"24px invasion2000",textAlign:"center",textBaseline:"middle",fillStyle:"#ffffff"}),o?(r.ctx.drawImage(o,null!=e?e:r.ctx.canvas.clientWidth/2,null!=n?n:r.ctx.canvas.clientHeight/2,76,76),r.ctx.fillText(t,null!=e?e:r.ctx.canvas.clientWidth/2+80,null!=n?n:r.ctx.canvas.clientHeight/2)):r.ctx.fillText(t,null!=e?e:r.ctx.canvas.clientWidth/2,null!=n?n:r.ctx.canvas.clientHeight/2)})),a(this,"drawModeLabel",(function(){try{var t,e,n,o,i=null===(t=r.engine)||void 0===t||null===(e=t.spritz)||void 0===e||null===(n=e.world)||void 0===n||null===(o=n.modeManager)||void 0===o?void 0:o.getMode();if(!i)return;r.applyStyle({font:"18px invasion2000",textAlign:"left",textBaseline:"top",fillStyle:"#ff0"}),r.ctx.fillText("MODE: ".concat(i),12,12)}catch(t){}})),a(this,"drawHeightDebugOverlay",(function(){var t;if(null!==(t=r.engine)&&void 0!==t&&t.debugHeightOverlay)try{var e,n,o,i,a=null===(e=r.engine)||void 0===e||null===(n=e.spritz)||void 0===n?void 0:n.world;if(!a)return;var s=r.ctx,c=null===(o=r.engine)||void 0===o||null===(i=o.renderManager)||void 0===i?void 0:i.camera;if(!c)return;var u=function(t,e,n){var o=r.engine.gl,i=r.engine.renderManager,a=i.uModelMat,s=c.uViewMat,u=i.uProjMat,l=[t,e,n,1],f=a[0]*l[0]+a[4]*l[1]+a[8]*l[2]+a[12],h=a[1]*l[0]+a[5]*l[1]+a[9]*l[2]+a[13],d=a[2]*l[0]+a[6]*l[1]+a[10]*l[2]+a[14],p=a[3]*l[0]+a[7]*l[1]+a[11]*l[2]+a[15],y=s[0]*f+s[4]*h+s[8]*d+s[12]*p,g=s[1]*f+s[5]*h+s[9]*d+s[13]*p,m=s[2]*f+s[6]*h+s[10]*d+s[14]*p,v=s[3]*f+s[7]*h+s[11]*d+s[15]*p,b=u[0]*y+u[4]*g+u[8]*m+u[12]*v,w=u[1]*y+u[5]*g+u[9]*m+u[13]*v,x=u[3]*y+u[7]*g+u[11]*m+u[15]*v;if(Math.abs(x)<1e-4)return null;var _=w/x;return{x:(b/x*.5+.5)*o.canvas.width,y:(1-(.5*_+.5))*o.canvas.height,behind:x<0}};r.applyStyle({font:"12px monospace",textAlign:"center",textBaseline:"middle",fillStyle:"#0f0"}),a.zoneList.forEach((function(t){var e;if(t.loaded&&null!==(e=t.zoneData)&&void 0!==e&&e.cells)for(var r=t.zoneData.cells,n=0;n<r.length;n++)for(var o=0;o<r[n].length;o++)try{var i=t.getHeight(o+.5,n+.5),a=u(o+.5,n+.5,i);a&&!a.behind&&(s.fillStyle="#0ff",s.fillText("".concat(i.toFixed(2)),a.x,a.y))}catch(t){}})),r.applyStyle({font:"14px monospace",textAlign:"center",textBaseline:"bottom",fillStyle:"#ff0"}),a.spriteList.forEach((function(t){if(t.pos)try{var e=u(t.pos.x,t.pos.y,t.pos.z+.5);e&&!e.behind&&(s.fillStyle="#ff0",s.fillText("".concat(t.id,": z=").concat(t.pos.z.toFixed(2)),e.x,e.y))}catch(t){}})),r.applyStyle({font:"14px monospace",textAlign:"center",textBaseline:"bottom",fillStyle:"#f0f"}),a.objectList.forEach((function(t){if(t.pos)try{var e=u(t.pos.x,t.pos.y,t.pos.z+.5);e&&!e.behind&&(s.fillStyle="#f0f",s.fillText("".concat(t.id,": z=").concat(t.pos.z.toFixed(2)),e.x,e.y))}catch(t){}}))}catch(t){console.warn("drawHeightDebugOverlay error:",t)}})),a(this,"drawCutsceneElements",(function(){var t=r.ctx,e=t.canvas.width,n=t.canvas.height;r.backdropImage&&t.drawImage(r.backdropImage,0,0,e,n),r.cutoutImages.forEach((function(r){var o=r.image,i=r.position;if(o){var a="left"===i?50:e-250,s=n/2-100;"right"===i?(t.save(),t.scale(-1,1),t.drawImage(o,-a-200,s,200,200),t.restore()):t.drawImage(o,a,s,200,200)}}))})),a(this,"scrollText",(function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.drawCutsceneElements();var o=new u(r.engine.ctx);return o.init(t,10,2*r.engine.ctx.canvas.height/3,r.engine.ctx.canvas.width-20,r.engine.ctx.canvas.height/3-20,n),o.setOptions(n),e&&o.scroll((Math.sin((new Date).getTime()/3e3)+1)*o.maxScroll*.5),o.render(),o})),t._instance||(this.engine=e,this.backdropImage=null,this.cutoutImages=[],t._instance=this),t._instance})),u=o((function t(e){var r=this;i(this,t),a(this,"init",(function(t,e,n,o,i){var a,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};r.text=t,r.x=e,r.y=n,r.width=o,r.height=i,r.portrait=null!==(a=s.portrait)&&void 0!==a?a:null,r.setOptions(s),r.cleanit()})),a(this,"cleanit",(function(t){r.dirty&&(r.setFont(),r.getTextPos(),r.dirty=!1,t||r.fitText())})),a(this,"setOptions",(function(t){Object.keys(r).forEach((function(e){void 0!==t[e]&&(r[e]=t[e],r.dirty=!0)}))})),a(this,"setFont",(function(){r.fontStr=r.fontSize+"px "+r.font,r.textHeight=r.fontSize+Math.ceil(.05*r.fontSize)})),a(this,"getTextPos",(function(){"left"===r.align?r.textPos=2:"right"===r.align?r.textPos=Math.floor(r.width-r.scrollBox.width-r.fontSize/4):r.textPos=Math.floor((r.width- -r.scrollBox.width)/2)})),a(this,"fitText",(function(){var t=r.ctx;r.cleanit(!0),t.font=r.fontStr,t.textAlign=r.align,t.textBaseline="top";var e=r.text.split(" ");r.lines.length=0;for(var n="",o="";e.length>0;){var i=e.shift();t.measureText(n+o+i).width<r.width-r.scrollBox.width-r.scrollBox.width-(r.portrait?84:0)?(n+=o+i,o=" "):(""===o?n+=i:e.unshift(i),r.lines.push(n),o="",n="")}""!==n&&r.lines.push(n),r.maxScroll=(r.lines.length+.5)*r.textHeight-r.height})),a(this,"drawBorder",(function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=r.ctx,n=r.border.lineWidth/2;e.lineJoin=r.border.corner,e.lineWidth=r.border.lineWidth,e.strokeStyle=r.border.style,t?e.strokeRect(r.x-n+84,r.y-n,r.width+2*n-84,r.height+2*n):e.strokeRect(r.x-n,r.y-n,r.width+2*n,r.height+2*n)})),a(this,"drawScrollBox",(function(){var t=r.ctx,e=r.height/(r.lines.length*r.textHeight);t.fillStyle=r.scrollBox.background,t.fillRect(r.x+r.width-r.scrollBox.width,r.y,r.scrollBox.width,r.height),t.fillStyle=r.scrollBox.color;var n=r.height*e;n>r.height&&(n=r.height),t.fillRect(r.x+r.width-r.scrollBox.width,r.y-r.scrollY*e,r.scrollBox.width,n)})),a(this,"drawPortrait",(function(){r.ctx.drawImage(r.portrait.image,r.x,r.y+38,76,76)})),a(this,"scroll",(function(t){r.cleanit(),r.scrollY=-t,r.scrollY>0?r.scrollY=0:r.scrollY<-r.maxScroll&&(r.scrollY=-r.maxScroll)})),a(this,"scrollLines",(function(t){r.cleanit(),r.scrollY=-r.textHeight*t,r.scrollY>0?r.scrollY=0:r.scrollY<-r.maxScroll&&(r.scrollY=-r.maxScroll)})),a(this,"render",(function(){var t=r.ctx;r.cleanit(),t.font=r.fontStr,t.textAlign=r.align,r.portrait?(r.drawBorder(!0),r.drawPortrait(),t.save(),t.fillStyle=r.background,t.fillRect(r.x+84,r.y,r.width-84,r.height)):(r.drawBorder(),t.save(),t.fillStyle=r.background,t.fillRect(r.x,r.y,r.width,r.height)),r.drawScrollBox(),r.portrait?(t.beginPath(),t.rect(r.x+84,r.y,r.width-r.scrollBox.width-84,r.height),t.clip(),t.setTransform(1,0,0,1,r.x+84,Math.floor(r.y+r.scrollY))):(t.beginPath(),t.rect(r.x,r.y,r.width-r.scrollBox.width,r.height),t.clip(),t.setTransform(1,0,0,1,r.x,Math.floor(r.y+r.scrollY))),t.fillStyle=r.fontStyle;for(var e=0;e<r.lines.length;e++)t.fillText(r.lines[e],r.textPos,Math.floor(e*r.textHeight)+2);t.restore()})),this.ctx=e,this.dirty=!0,this.scrollY=0,this.fontSize=24,this.font="minecraftia",this.align="left",this.background="#333",this.border={lineWidth:2,style:"#fff",corner:"round"},this.scrollBox={width:5,background:"#777",color:"#999"},this.fontStyle="#fff",this.lines=[],this.x=0,this.y=0}))},9124:(t,e,r)=>{"use strict";r.d(e,{Z:()=>Fo});var n=r(9010);const o={Vector:n.OW,Vector4:n.Lt,clamp:function(t,e,r){return Math.max(e,Math.min(t,r))}},i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,a=Object.keys,s=Array.isArray;function c(t,e){return"object"!=typeof e||a(e).forEach((function(r){t[r]=e[r]})),t}"undefined"==typeof Promise||i.Promise||(i.Promise=Promise);const u=Object.getPrototypeOf,l={}.hasOwnProperty;function f(t,e){return l.call(t,e)}function h(t,e){"function"==typeof e&&(e=e(u(t))),("undefined"==typeof Reflect?a:Reflect.ownKeys)(e).forEach((r=>{p(t,r,e[r])}))}const d=Object.defineProperty;function p(t,e,r,n){d(t,e,c(r&&f(r,"get")&&"function"==typeof r.get?{get:r.get,set:r.set,configurable:!0}:{value:r,configurable:!0,writable:!0},n))}function y(t){return{from:function(e){return t.prototype=Object.create(e.prototype),p(t.prototype,"constructor",t),{extend:h.bind(null,t.prototype)}}}}const g=Object.getOwnPropertyDescriptor;function m(t,e){let r;return g(t,e)||(r=u(t))&&m(r,e)}const v=[].slice;function b(t,e,r){return v.call(t,e,r)}function w(t,e){return e(t)}function x(t){if(!t)throw new Error("Assertion Failed")}function _(t){i.setImmediate?setImmediate(t):setTimeout(t,0)}function k(t,e){return t.reduce(((t,r,n)=>{var o=e(r,n);return o&&(t[o[0]]=o[1]),t}),{})}function E(t,e){if(f(t,e))return t[e];if(!e)return t;if("string"!=typeof e){for(var r=[],n=0,o=e.length;n<o;++n){var i=E(t,e[n]);r.push(i)}return r}var a=e.indexOf(".");if(-1!==a){var s=t[e.substr(0,a)];return void 0===s?void 0:E(s,e.substr(a+1))}}function A(t,e,r){if(t&&void 0!==e&&(!("isFrozen"in Object)||!Object.isFrozen(t)))if("string"!=typeof e&&"length"in e){x("string"!=typeof r&&"length"in r);for(var n=0,o=e.length;n<o;++n)A(t,e[n],r[n])}else{var i=e.indexOf(".");if(-1!==i){var a=e.substr(0,i),c=e.substr(i+1);if(""===c)void 0===r?s(t)&&!isNaN(parseInt(a))?t.splice(a,1):delete t[a]:t[a]=r;else{var u=t[a];u||(u=t[a]={}),A(u,c,r)}}else void 0===r?s(t)&&!isNaN(parseInt(e))?t.splice(e,1):delete t[e]:t[e]=r}}function S(t){var e={};for(var r in t)f(t,r)&&(e[r]=t[r]);return e}const L=[].concat;function O(t){return L.apply([],t)}const P="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(O([8,16,32,64].map((t=>["Int","Uint","Float"].map((e=>e+t+"Array")))))).filter((t=>i[t])),T=P.map((t=>i[t]));k(P,(t=>[t,!0]));let C=null;function M(t){C="undefined"!=typeof WeakMap&&new WeakMap;const e=j(t);return C=null,e}function j(t){if(!t||"object"!=typeof t)return t;let e=C&&C.get(t);if(e)return e;if(s(t)){e=[],C&&C.set(t,e);for(var r=0,n=t.length;r<n;++r)e.push(j(t[r]))}else if(T.indexOf(t.constructor)>=0)e=t;else{const r=u(t);for(var o in e=r===Object.prototype?{}:Object.create(r),C&&C.set(t,e),t)f(t,o)&&(e[o]=j(t[o]))}return e}const{toString:I}={};function B(t){return I.call(t).slice(8,-1)}const z="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",D="symbol"==typeof z?function(t){var e;return null!=t&&(e=t[z])&&e.apply(t)}:function(){return null},N={};function R(t){var e,r,n,o;if(1===arguments.length){if(s(t))return t.slice();if(this===N&&"string"==typeof t)return[t];if(o=D(t)){for(r=[];!(n=o.next()).done;)r.push(n.value);return r}if(null==t)return[t];if("number"==typeof(e=t.length)){for(r=new Array(e);e--;)r[e]=t[e];return r}return[t]}for(e=arguments.length,r=new Array(e);e--;)r[e]=arguments[e];return r}const F="undefined"!=typeof Symbol?t=>"AsyncFunction"===t[Symbol.toStringTag]:()=>!1;var U="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function G(t,e){U=t,W=e}var W=()=>!0;const V=!new Error("").stack;function Z(){if(V)try{throw Z.arguments,new Error}catch(t){return t}return new Error}function $(t,e){var r=t.stack;return r?(e=e||0,0===r.indexOf(t.name)&&(e+=(t.name+t.message).split("\n").length),r.split("\n").slice(e).filter(W).map((t=>"\n"+t)).join("")):""}var Y=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],K=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Y),H={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function q(t,e){this._e=Z(),this.name=t,this.message=e}function X(t,e){return t+". Errors: "+Object.keys(e).map((t=>e[t].toString())).filter(((t,e,r)=>r.indexOf(t)===e)).join("\n")}function J(t,e,r,n){this._e=Z(),this.failures=e,this.failedKeys=n,this.successCount=r,this.message=X(t,e)}function Q(t,e){this._e=Z(),this.name="BulkError",this.failures=Object.keys(e).map((t=>e[t])),this.failuresByPos=e,this.message=X(t,e)}y(q).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+$(this._e,2))}},toString:function(){return this.name+": "+this.message}}),y(J).from(q),y(Q).from(q);var tt=K.reduce(((t,e)=>(t[e]=e+"Error",t)),{});const et=q;var rt=K.reduce(((t,e)=>{var r=e+"Error";function n(t,n){this._e=Z(),this.name=r,t?"string"==typeof t?(this.message=`${t}${n?"\n "+n:""}`,this.inner=n||null):"object"==typeof t&&(this.message=`${t.name} ${t.message}`,this.inner=t):(this.message=H[e]||r,this.inner=null)}return y(n).from(et),t[e]=n,t}),{});rt.Syntax=SyntaxError,rt.Type=TypeError,rt.Range=RangeError;var nt=Y.reduce(((t,e)=>(t[e+"Error"]=rt[e],t)),{}),ot=K.reduce(((t,e)=>(-1===["Syntax","Type","Range"].indexOf(e)&&(t[e+"Error"]=rt[e]),t)),{});function it(){}function at(t){return t}function st(t,e){return null==t||t===at?e:function(r){return e(t(r))}}function ct(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function ut(t,e){return t===it?e:function(){var r=t.apply(this,arguments);void 0!==r&&(arguments[0]=r);var n=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var i=e.apply(this,arguments);return n&&(this.onsuccess=this.onsuccess?ct(n,this.onsuccess):n),o&&(this.onerror=this.onerror?ct(o,this.onerror):o),void 0!==i?i:r}}function lt(t,e){return t===it?e:function(){t.apply(this,arguments);var r=this.onsuccess,n=this.onerror;this.onsuccess=this.onerror=null,e.apply(this,arguments),r&&(this.onsuccess=this.onsuccess?ct(r,this.onsuccess):r),n&&(this.onerror=this.onerror?ct(n,this.onerror):n)}}function ft(t,e){return t===it?e:function(r){var n=t.apply(this,arguments);c(r,n);var o=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var a=e.apply(this,arguments);return o&&(this.onsuccess=this.onsuccess?ct(o,this.onsuccess):o),i&&(this.onerror=this.onerror?ct(i,this.onerror):i),void 0===n?void 0===a?void 0:a:c(n,a)}}function ht(t,e){return t===it?e:function(){return!1!==e.apply(this,arguments)&&t.apply(this,arguments)}}function dt(t,e){return t===it?e:function(){var r=t.apply(this,arguments);if(r&&"function"==typeof r.then){for(var n=this,o=arguments.length,i=new Array(o);o--;)i[o]=arguments[o];return r.then((function(){return e.apply(n,i)}))}return e.apply(this,arguments)}}ot.ModifyError=J,ot.DexieError=q,ot.BulkError=Q;var pt={};const[yt,gt,mt]="undefined"==typeof Promise?[]:(()=>{let t=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[t,u(t),t];const e=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[e,u(e),t]})(),vt=gt&&gt.then,bt=yt&&yt.constructor,wt=!!mt;var xt=!1,_t=mt?()=>{mt.then(Zt)}:i.setImmediate?setImmediate.bind(null,Zt):i.MutationObserver?()=>{var t=document.createElement("div");new MutationObserver((()=>{Zt(),t=null})).observe(t,{attributes:!0}),t.setAttribute("i","1")}:()=>{setTimeout(Zt,0)},kt=function(t,e){Mt.push([t,e]),At&&(_t(),At=!1)},Et=!0,At=!0,St=[],Lt=[],Ot=null,Pt=at,Tt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ge,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((t=>{try{ge(t[0],t[1])}catch(t){}}))}},Ct=Tt,Mt=[],jt=0,It=[];function Bt(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=it,this._lib=!1;var e=this._PSD=Ct;if(U&&(this._stackHolder=Z(),this._prev=null,this._numPrev=0),"function"!=typeof t){if(t!==pt)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Rt(this,this._value))}this._state=null,this._value=null,++e.ref,Nt(this,t)}const zt={get:function(){var t=Ct,e=ee;function r(r,n){var o=!t.global&&(t!==Ct||e!==ee);const i=o&&!ie();var a=new Bt(((e,a)=>{Ut(this,new Dt(de(r,t,o,i),de(n,t,o,i),e,a,t))}));return U&&Vt(a,this),a}return r.prototype=pt,r},set:function(t){p(this,"then",t&&t.prototype===pt?zt:{get:function(){return t},set:zt.set})}};function Dt(t,e,r,n,o){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=r,this.reject=n,this.psd=o}function Nt(t,e){try{e((e=>{if(null===t._state){if(e===t)throw new TypeError("A promise cannot be resolved with itself.");var r=t._lib&&$t();e&&"function"==typeof e.then?Nt(t,((t,r)=>{e instanceof Bt?e._then(t,r):e.then(t,r)})):(t._state=!0,t._value=e,Ft(t)),r&&Yt()}}),Rt.bind(null,t))}catch(e){Rt(t,e)}}function Rt(t,e){if(Lt.push(e),null===t._state){var r=t._lib&&$t();e=Pt(e),t._state=!1,t._value=e,U&&null!==e&&"object"==typeof e&&!e._promise&&function(r,n,o){try{(()=>{var r=m(e,"stack");e._promise=t,p(e,"stack",{get:()=>xt?r&&(r.get?r.get.apply(e):r.value):t.stack})}).apply(null,void 0)}catch(t){}}(),function(t){St.some((e=>e._value===t._value))||St.push(t)}(t),Ft(t),r&&Yt()}}function Ft(t){var e=t._listeners;t._listeners=[];for(var r=0,n=e.length;r<n;++r)Ut(t,e[r]);var o=t._PSD;--o.ref||o.finalize(),0===jt&&(++jt,kt((()=>{0==--jt&&Kt()}),[]))}function Ut(t,e){if(null!==t._state){var r=t._state?e.onFulfilled:e.onRejected;if(null===r)return(t._state?e.resolve:e.reject)(t._value);++e.psd.ref,++jt,kt(Gt,[r,t,e])}else t._listeners.push(e)}function Gt(t,e,r){try{Ot=e;var n,o=e._value;e._state?n=t(o):(Lt.length&&(Lt=[]),n=t(o),-1===Lt.indexOf(o)&&function(t){for(var e=St.length;e;)if(St[--e]._value===t._value)return void St.splice(e,1)}(e)),r.resolve(n)}catch(t){r.reject(t)}finally{Ot=null,0==--jt&&Kt(),--r.psd.ref||r.psd.finalize()}}function Wt(t,e,r){if(e.length===r)return e;var n="";if(!1===t._state){var o,i,a=t._value;null!=a?(o=a.name||"Error",i=a.message||a,n=$(a,0)):(o=a,i=""),e.push(o+(i?": "+i:"")+n)}return U&&((n=$(t._stackHolder,2))&&-1===e.indexOf(n)&&e.push(n),t._prev&&Wt(t._prev,e,r)),e}function Vt(t,e){var r=e?e._numPrev+1:0;r<100&&(t._prev=e,t._numPrev=r)}function Zt(){$t()&&Yt()}function $t(){var t=Et;return Et=!1,At=!1,t}function Yt(){var t,e,r;do{for(;Mt.length>0;)for(t=Mt,Mt=[],r=t.length,e=0;e<r;++e){var n=t[e];n[0].apply(null,n[1])}}while(Mt.length>0);Et=!0,At=!0}function Kt(){var t=St;St=[],t.forEach((t=>{t._PSD.onunhandled.call(null,t._value,t)}));for(var e=It.slice(0),r=e.length;r;)e[--r]()}function Ht(t){return new Bt(pt,!1,t)}function qt(t,e){var r=Ct;return function(){var n=$t(),o=Ct;try{return ue(r,!0),t.apply(this,arguments)}catch(t){e&&e(t)}finally{ue(o,!1),n&&Yt()}}}h(Bt.prototype,{then:zt,_then:function(t,e){Ut(this,new Dt(null,null,t,e,Ct))},catch:function(t){if(1===arguments.length)return this.then(null,t);var e=arguments[0],r=arguments[1];return"function"==typeof e?this.then(null,(t=>t instanceof e?r(t):Ht(t))):this.then(null,(t=>t&&t.name===e?r(t):Ht(t)))},finally:function(t){return this.then((e=>(t(),e)),(e=>(t(),Ht(e))))},stack:{get:function(){if(this._stack)return this._stack;try{xt=!0;var t=Wt(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=t),t}finally{xt=!1}}},timeout:function(t,e){return t<1/0?new Bt(((r,n)=>{var o=setTimeout((()=>n(new rt.Timeout(e))),t);this.then(r,n).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&p(Bt.prototype,Symbol.toStringTag,"Dexie.Promise"),Tt.env=le(),h(Bt,{all:function(){var t=R.apply(null,arguments).map(ae);return new Bt((function(e,r){0===t.length&&e([]);var n=t.length;t.forEach(((o,i)=>Bt.resolve(o).then((r=>{t[i]=r,--n||e(t)}),r)))}))},resolve:t=>{if(t instanceof Bt)return t;if(t&&"function"==typeof t.then)return new Bt(((e,r)=>{t.then(e,r)}));var e=new Bt(pt,!0,t);return Vt(e,Ot),e},reject:Ht,race:function(){var t=R.apply(null,arguments).map(ae);return new Bt(((e,r)=>{t.map((t=>Bt.resolve(t).then(e,r)))}))},PSD:{get:()=>Ct,set:t=>Ct=t},totalEchoes:{get:()=>ee},newPSD:ne,usePSD:fe,scheduler:{get:()=>kt,set:t=>{kt=t}},rejectionMapper:{get:()=>Pt,set:t=>{Pt=t}},follow:(t,e)=>new Bt(((r,n)=>ne(((e,r)=>{var n=Ct;n.unhandleds=[],n.onunhandled=r,n.finalize=ct((function(){!function(t){It.push((function e(){t(),It.splice(It.indexOf(e),1)})),++jt,kt((()=>{0==--jt&&Kt()}),[])}((()=>{0===this.unhandleds.length?e():r(this.unhandleds[0])}))}),n.finalize),t()}),e,r,n)))}),bt&&(bt.allSettled&&p(Bt,"allSettled",(function(){const t=R.apply(null,arguments).map(ae);return new Bt((e=>{0===t.length&&e([]);let r=t.length;const n=new Array(r);t.forEach(((t,o)=>Bt.resolve(t).then((t=>n[o]={status:"fulfilled",value:t}),(t=>n[o]={status:"rejected",reason:t})).then((()=>--r||e(n)))))}))})),bt.any&&"undefined"!=typeof AggregateError&&p(Bt,"any",(function(){const t=R.apply(null,arguments).map(ae);return new Bt(((e,r)=>{0===t.length&&r(new AggregateError([]));let n=t.length;const o=new Array(n);t.forEach(((t,i)=>Bt.resolve(t).then((t=>e(t)),(t=>{o[i]=t,--n||r(new AggregateError(o))}))))}))})));const Xt={awaits:0,echoes:0,id:0};var Jt=0,Qt=[],te=0,ee=0,re=0;function ne(t,e,r,n){var o=Ct,i=Object.create(o);i.parent=o,i.ref=0,i.global=!1,i.id=++re;var a=Tt.env;i.env=wt?{Promise:Bt,PromiseProp:{value:Bt,configurable:!0,writable:!0},all:Bt.all,race:Bt.race,allSettled:Bt.allSettled,any:Bt.any,resolve:Bt.resolve,reject:Bt.reject,nthen:pe(a.nthen,i),gthen:pe(a.gthen,i)}:{},e&&c(i,e),++o.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=fe(i,t,r,n);return 0===i.ref&&i.finalize(),s}function oe(){return Xt.id||(Xt.id=++Jt),++Xt.awaits,Xt.echoes+=100,Xt.id}function ie(){return!!Xt.awaits&&(0==--Xt.awaits&&(Xt.id=0),Xt.echoes=100*Xt.awaits,!0)}function ae(t){return Xt.echoes&&t&&t.constructor===bt?(oe(),t.then((t=>(ie(),t)),(t=>(ie(),me(t))))):t}function se(t){++ee,Xt.echoes&&0!=--Xt.echoes||(Xt.echoes=Xt.id=0),Qt.push(Ct),ue(t,!0)}function ce(){var t=Qt[Qt.length-1];Qt.pop(),ue(t,!1)}function ue(t,e){var r=Ct;if((e?!Xt.echoes||te++&&t===Ct:!te||--te&&t===Ct)||he(e?se.bind(null,t):ce),t!==Ct&&(Ct=t,r===Tt&&(Tt.env=le()),wt)){var n=Tt.env.Promise,o=t.env;gt.then=o.nthen,n.prototype.then=o.gthen,(r.global||t.global)&&(Object.defineProperty(i,"Promise",o.PromiseProp),n.all=o.all,n.race=o.race,n.resolve=o.resolve,n.reject=o.reject,o.allSettled&&(n.allSettled=o.allSettled),o.any&&(n.any=o.any))}}function le(){var t=i.Promise;return wt?{Promise:t,PromiseProp:Object.getOwnPropertyDescriptor(i,"Promise"),all:t.all,race:t.race,allSettled:t.allSettled,any:t.any,resolve:t.resolve,reject:t.reject,nthen:gt.then,gthen:t.prototype.then}:{}}function fe(t,e,r,n,o){var i=Ct;try{return ue(t,!0),e(r,n,o)}finally{ue(i,!1)}}function he(t){vt.call(yt,t)}function de(t,e,r,n){return"function"!=typeof t?t:function(){var o=Ct;r&&oe(),ue(e,!0);try{return t.apply(this,arguments)}finally{ue(o,!1),n&&he(ie)}}}function pe(t,e){return function(r,n){return t.call(this,de(r,e),de(n,e))}}-1===(""+vt).indexOf("[native code]")&&(oe=ie=it);const ye="unhandledrejection";function ge(t,e){var r;try{r=e.onuncatched(t)}catch(t){}if(!1!==r)try{var n,o={promise:e,reason:t};if(i.document&&document.createEvent?((n=document.createEvent("Event")).initEvent(ye,!0,!0),c(n,o)):i.CustomEvent&&c(n=new CustomEvent(ye,{detail:o}),o),n&&i.dispatchEvent&&(dispatchEvent(n),!i.PromiseRejectionEvent&&i.onunhandledrejection))try{i.onunhandledrejection(n)}catch(t){}U&&n&&!n.defaultPrevented&&console.warn(`Unhandled rejection: ${t.stack||t}`)}catch(t){}}var me=Bt.reject;function ve(t,e,r,n){if(t.idbdb&&(t._state.openComplete||Ct.letThrough||t._vip)){var o=t._createTransaction(e,r,t._dbSchema);try{o.create()}catch(t){return me(t)}return o._promise(e,((t,e)=>ne((()=>(Ct.trans=o,n(t,e,o)))))).then((t=>o._completion.then((()=>t))))}if(t._state.openComplete)return me(new rt.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._options.autoOpen)return me(new rt.DatabaseClosed);t.open().catch(it)}return t._state.dbReadyPromise.then((()=>ve(t,e,r,n)))}const be="3.2.0",we=String.fromCharCode(65535),xe=-1/0,_e="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",ke="String expected.",Ee=[],Ae="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Se=Ae,Le=Ae,Oe=t=>!/(dexie\.js|dexie\.min\.js)/.test(t),Pe="__dbnames",Te="readonly",Ce="readwrite";function Me(t,e){return t?e?function(){return t.apply(this,arguments)&&e.apply(this,arguments)}:t:e}const je={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Ie(t){return"string"!=typeof t||/\./.test(t)?t=>t:e=>(void 0===e[t]&&t in e&&delete(e=M(e))[t],e)}class Be{_trans(t,e,r){const n=this._tx||Ct.trans,o=this.name;function i(t,r,n){if(!n.schema[o])throw new rt.NotFound("Table "+o+" not part of transaction");return e(n.idbtrans,n)}const a=$t();try{return n&&n.db===this.db?n===Ct.trans?n._promise(t,i,r):ne((()=>n._promise(t,i,r)),{trans:n,transless:Ct.transless||Ct}):ve(this.db,t,[this.name],i)}finally{a&&Yt()}}get(t,e){return t&&t.constructor===Object?this.where(t).first(e):this._trans("readonly",(e=>this.core.get({trans:e,key:t}).then((t=>this.hook.reading.fire(t))))).then(e)}where(t){if("string"==typeof t)return new this.db.WhereClause(this,t);if(s(t))return new this.db.WhereClause(this,`[${t.join("+")}]`);const e=a(t);if(1===e.length)return this.where(e[0]).equals(t[e[0]]);const r=this.schema.indexes.concat(this.schema.primKey).filter((t=>t.compound&&e.every((e=>t.keyPath.indexOf(e)>=0))&&t.keyPath.every((t=>e.indexOf(t)>=0))))[0];if(r&&this.db._maxKey!==we)return this.where(r.name).equals(r.keyPath.map((e=>t[e])));!r&&U&&console.warn(`The query ${JSON.stringify(t)} on ${this.name} would benefit of a compound index [${e.join("+")}]`);const{idxByName:n}=this.schema,o=this.db._deps.indexedDB;function i(t,e){try{return 0===o.cmp(t,e)}catch(t){return!1}}const[c,u]=e.reduce((([e,r],o)=>{const a=n[o],c=t[o];return[e||a,e||!a?Me(r,a&&a.multi?t=>{const e=E(t,o);return s(e)&&e.some((t=>i(c,t)))}:t=>i(c,E(t,o))):r]}),[null,null]);return c?this.where(c.name).equals(t[c.keyPath]).filter(u):r?this.filter(u):this.where(e).equals("")}filter(t){return this.toCollection().and(t)}count(t){return this.toCollection().count(t)}offset(t){return this.toCollection().offset(t)}limit(t){return this.toCollection().limit(t)}each(t){return this.toCollection().each(t)}toArray(t){return this.toCollection().toArray(t)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(t){return new this.db.Collection(new this.db.WhereClause(this,s(t)?`[${t.join("+")}]`:t))}reverse(){return this.toCollection().reverse()}mapToClass(t){this.schema.mappedClass=t;const e=e=>{if(!e)return e;const r=Object.create(t.prototype);for(var n in e)if(f(e,n))try{r[n]=e[n]}catch(t){}return r};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=e,this.hook("reading",e),t}defineClass(){return this.mapToClass((function(t){c(this,t)}))}add(t,e){const{auto:r,keyPath:n}=this.schema.primKey;let o=t;return n&&r&&(o=Ie(n)(t)),this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"add",keys:null!=e?[e]:null,values:[o]}))).then((t=>t.numFailures?Bt.reject(t.failures[0]):t.lastResult)).then((e=>{if(n)try{A(t,n,e)}catch(t){}return e}))}update(t,e){if("object"!=typeof t||s(t))return this.where(":id").equals(t).modify(e);{const r=E(t,this.schema.primKey.keyPath);if(void 0===r)return me(new rt.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof e?a(e).forEach((r=>{A(t,r,e[r])})):e(t,{value:t,primKey:r})}catch(t){}return this.where(":id").equals(r).modify(e)}}put(t,e){const{auto:r,keyPath:n}=this.schema.primKey;let o=t;return n&&r&&(o=Ie(n)(t)),this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"put",values:[o],keys:null!=e?[e]:null}))).then((t=>t.numFailures?Bt.reject(t.failures[0]):t.lastResult)).then((e=>{if(n)try{A(t,n,e)}catch(t){}return e}))}delete(t){return this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"delete",keys:[t]}))).then((t=>t.numFailures?Bt.reject(t.failures[0]):void 0))}clear(){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"deleteRange",range:je}))).then((t=>t.numFailures?Bt.reject(t.failures[0]):void 0))}bulkGet(t){return this._trans("readonly",(e=>this.core.getMany({keys:t,trans:e}).then((t=>t.map((t=>this.hook.reading.fire(t)))))))}bulkAdd(t,e,r){const n=Array.isArray(e)?e:void 0,o=(r=r||(n?void 0:e))?r.allKeys:void 0;return this._trans("readwrite",(e=>{const{auto:r,keyPath:i}=this.schema.primKey;if(i&&n)throw new rt.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(n&&n.length!==t.length)throw new rt.InvalidArgument("Arguments objects and keys must have the same length");const a=t.length;let s=i&&r?t.map(Ie(i)):t;return this.core.mutate({trans:e,type:"add",keys:n,values:s,wantResults:o}).then((({numFailures:t,results:e,lastResult:r,failures:n})=>{if(0===t)return o?e:r;throw new Q(`${this.name}.bulkAdd(): ${t} of ${a} operations failed`,n)}))}))}bulkPut(t,e,r){const n=Array.isArray(e)?e:void 0,o=(r=r||(n?void 0:e))?r.allKeys:void 0;return this._trans("readwrite",(e=>{const{auto:r,keyPath:i}=this.schema.primKey;if(i&&n)throw new rt.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(n&&n.length!==t.length)throw new rt.InvalidArgument("Arguments objects and keys must have the same length");const a=t.length;let s=i&&r?t.map(Ie(i)):t;return this.core.mutate({trans:e,type:"put",keys:n,values:s,wantResults:o}).then((({numFailures:t,results:e,lastResult:r,failures:n})=>{if(0===t)return o?e:r;throw new Q(`${this.name}.bulkPut(): ${t} of ${a} operations failed`,n)}))}))}bulkDelete(t){const e=t.length;return this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"delete",keys:t}))).then((({numFailures:t,lastResult:r,failures:n})=>{if(0===t)return r;throw new Q(`${this.name}.bulkDelete(): ${t} of ${e} operations failed`,n)}))}}function ze(t){var e={},r=function(r,n){if(n){for(var o=arguments.length,i=new Array(o-1);--o;)i[o-1]=arguments[o];return e[r].subscribe.apply(null,i),t}if("string"==typeof r)return e[r]};r.addEventType=i;for(var n=1,o=arguments.length;n<o;++n)i(arguments[n]);return r;function i(t,n,o){if("object"==typeof t)return c(t);n||(n=ht),o||(o=it);var i={subscribers:[],fire:o,subscribe:function(t){-1===i.subscribers.indexOf(t)&&(i.subscribers.push(t),i.fire=n(i.fire,t))},unsubscribe:function(t){i.subscribers=i.subscribers.filter((function(e){return e!==t})),i.fire=i.subscribers.reduce(n,o)}};return e[t]=r[t]=i,i}function c(t){a(t).forEach((function(e){var r=t[e];if(s(r))i(e,t[e][0],t[e][1]);else{if("asap"!==r)throw new rt.InvalidArgument("Invalid event config");var n=i(e,at,(function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];n.subscribers.forEach((function(t){_((function(){t.apply(null,e)}))}))}))}}))}}function De(t,e){return y(e).from({prototype:t}),e}function Ne(t,e){return!(t.filter||t.algorithm||t.or)&&(e?t.justLimit:!t.replayFilter)}function Re(t,e){t.filter=Me(t.filter,e)}function Fe(t,e,r){var n=t.replayFilter;t.replayFilter=n?()=>Me(n(),e()):e,t.justLimit=r&&!n}function Ue(t,e){if(t.isPrimKey)return e.primaryKey;const r=e.getIndexByKeyPath(t.index);if(!r)throw new rt.Schema("KeyPath "+t.index+" on object store "+e.name+" is not indexed");return r}function Ge(t,e,r){const n=Ue(t,e.schema);return e.openCursor({trans:r,values:!t.keysOnly,reverse:"prev"===t.dir,unique:!!t.unique,query:{index:n,range:t.range}})}function We(t,e,r,n){const o=t.replayFilter?Me(t.filter,t.replayFilter()):t.filter;if(t.or){const i={},a=(t,r,n)=>{if(!o||o(r,n,(t=>r.stop(t)),(t=>r.fail(t)))){var a=r.primaryKey,s=""+a;"[object ArrayBuffer]"===s&&(s=""+new Uint8Array(a)),f(i,s)||(i[s]=!0,e(t,r,n))}};return Promise.all([t.or._iterate(a,r),Ve(Ge(t,n,r),t.algorithm,a,!t.keysOnly&&t.valueMapper)])}return Ve(Ge(t,n,r),Me(t.algorithm,o),e,!t.keysOnly&&t.valueMapper)}function Ve(t,e,r,n){var o=qt(n?(t,e,o)=>r(n(t),e,o):r);return t.then((t=>{if(t)return t.start((()=>{var r=()=>t.continue();e&&!e(t,(t=>r=t),(e=>{t.stop(e),r=it}),(e=>{t.fail(e),r=it}))||o(t.value,t,(t=>r=t)),r()}))}))}function Ze(t,e){try{const r=$e(t),n=$e(e);if(r!==n)return"Array"===r?1:"Array"===n?-1:"binary"===r?1:"binary"===n?-1:"string"===r?1:"string"===n?-1:"Date"===r?1:"Date"!==n?NaN:-1;switch(r){case"number":case"Date":case"string":return t>e?1:t<e?-1:0;case"binary":return function(t,e){const r=t.length,n=e.length,o=r<n?r:n;for(let r=0;r<o;++r)if(t[r]!==e[r])return t[r]<e[r]?-1:1;return r===n?0:r<n?-1:1}(Ye(t),Ye(e));case"Array":return function(t,e){const r=t.length,n=e.length,o=r<n?r:n;for(let r=0;r<o;++r){const n=Ze(t[r],e[r]);if(0!==n)return n}return r===n?0:r<n?-1:1}(t,e)}}catch(t){}return NaN}function $e(t){const e=typeof t;if("object"!==e)return e;if(ArrayBuffer.isView(t))return"binary";const r=B(t);return"ArrayBuffer"===r?"binary":r}function Ye(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}class Ke{_read(t,e){var r=this._ctx;return r.error?r.table._trans(null,me.bind(null,r.error)):r.table._trans("readonly",t).then(e)}_write(t){var e=this._ctx;return e.error?e.table._trans(null,me.bind(null,e.error)):e.table._trans("readwrite",t,"locked")}_addAlgorithm(t){var e=this._ctx;e.algorithm=Me(e.algorithm,t)}_iterate(t,e){return We(this._ctx,t,e,this._ctx.table.core)}clone(t){var e=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return t&&c(r,t),e._ctx=r,e}raw(){return this._ctx.valueMapper=null,this}each(t){var e=this._ctx;return this._read((r=>We(e,t,r,e.table.core)))}count(t){return this._read((t=>{const e=this._ctx,r=e.table.core;if(Ne(e,!0))return r.count({trans:t,query:{index:Ue(e,r.schema),range:e.range}}).then((t=>Math.min(t,e.limit)));var n=0;return We(e,(()=>(++n,!1)),t,r).then((()=>n))})).then(t)}sortBy(t,e){const r=t.split(".").reverse(),n=r[0],o=r.length-1;function i(t,e){return e?i(t[r[e]],e-1):t[n]}var a="next"===this._ctx.dir?1:-1;function s(t,e){var r=i(t,o),n=i(e,o);return r<n?-a:r>n?a:0}return this.toArray((function(t){return t.sort(s)})).then(e)}toArray(t){return this._read((t=>{var e=this._ctx;if("next"===e.dir&&Ne(e,!0)&&e.limit>0){const{valueMapper:r}=e,n=Ue(e,e.table.core.schema);return e.table.core.query({trans:t,limit:e.limit,values:!0,query:{index:n,range:e.range}}).then((({result:t})=>r?t.map(r):t))}{const r=[];return We(e,(t=>r.push(t)),t,e.table.core).then((()=>r))}}),t)}offset(t){var e=this._ctx;return t<=0||(e.offset+=t,Ne(e)?Fe(e,(()=>{var e=t;return(t,r)=>0===e||(1===e?(--e,!1):(r((()=>{t.advance(e),e=0})),!1))})):Fe(e,(()=>{var e=t;return()=>--e<0}))),this}limit(t){return this._ctx.limit=Math.min(this._ctx.limit,t),Fe(this._ctx,(()=>{var e=t;return function(t,r,n){return--e<=0&&r(n),e>=0}}),!0),this}until(t,e){return Re(this._ctx,(function(r,n,o){return!t(r.value)||(n(o),e)})),this}first(t){return this.limit(1).toArray((function(t){return t[0]})).then(t)}last(t){return this.reverse().first(t)}filter(t){var e,r;return Re(this._ctx,(function(e){return t(e.value)})),e=this._ctx,r=t,e.isMatch=Me(e.isMatch,r),this}and(t){return this.filter(t)}or(t){return new this.db.WhereClause(this._ctx.table,t,this)}reverse(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(t){var e=this._ctx;return e.keysOnly=!e.isMatch,this.each((function(e,r){t(r.key,r)}))}eachUniqueKey(t){return this._ctx.unique="unique",this.eachKey(t)}eachPrimaryKey(t){var e=this._ctx;return e.keysOnly=!e.isMatch,this.each((function(e,r){t(r.primaryKey,r)}))}keys(t){var e=this._ctx;e.keysOnly=!e.isMatch;var r=[];return this.each((function(t,e){r.push(e.key)})).then((function(){return r})).then(t)}primaryKeys(t){var e=this._ctx;if("next"===e.dir&&Ne(e,!0)&&e.limit>0)return this._read((t=>{var r=Ue(e,e.table.core.schema);return e.table.core.query({trans:t,values:!1,limit:e.limit,query:{index:r,range:e.range}})})).then((({result:t})=>t)).then(t);e.keysOnly=!e.isMatch;var r=[];return this.each((function(t,e){r.push(e.primaryKey)})).then((function(){return r})).then(t)}uniqueKeys(t){return this._ctx.unique="unique",this.keys(t)}firstKey(t){return this.limit(1).keys((function(t){return t[0]})).then(t)}lastKey(t){return this.reverse().firstKey(t)}distinct(){var t=this._ctx,e=t.index&&t.table.schema.idxByName[t.index];if(!e||!e.multi)return this;var r={};return Re(this._ctx,(function(t){var e=t.primaryKey.toString(),n=f(r,e);return r[e]=!0,!n})),this}modify(t){var e=this._ctx;return this._write((r=>{var n;if("function"==typeof t)n=t;else{var o=a(t),i=o.length;n=function(e){for(var r=!1,n=0;n<i;++n){var a=o[n],s=t[a];E(e,a)!==s&&(A(e,a,s),r=!0)}return r}}const s=e.table.core,{outbound:c,extractKey:u}=s.schema.primaryKey,l=this.db._options.modifyChunkSize||200,f=[];let h=0;const d=[],p=(t,e)=>{const{failures:r,numFailures:n}=e;h+=t-n;for(let t of a(r))f.push(r[t])};return this.clone().primaryKeys().then((o=>{const i=a=>{const f=Math.min(l,o.length-a);return s.getMany({trans:r,keys:o.slice(a,a+f),cache:"immutable"}).then((h=>{const d=[],y=[],g=c?[]:null,m=[];for(let t=0;t<f;++t){const e=h[t],r={value:M(e),primKey:o[a+t]};!1!==n.call(r,r.value,r)&&(null==r.value?m.push(o[a+t]):c||0===Ze(u(e),u(r.value))?(y.push(r.value),c&&g.push(o[a+t])):(m.push(o[a+t]),d.push(r.value)))}const v=Ne(e)&&e.limit===1/0&&("function"!=typeof t||t===He)&&{index:e.index,range:e.range};return Promise.resolve(d.length>0&&s.mutate({trans:r,type:"add",values:d}).then((t=>{for(let e in t.failures)m.splice(parseInt(e),1);p(d.length,t)}))).then((()=>(y.length>0||v&&"object"==typeof t)&&s.mutate({trans:r,type:"put",keys:g,values:y,criteria:v,changeSpec:"function"!=typeof t&&t}).then((t=>p(y.length,t))))).then((()=>(m.length>0||v&&t===He)&&s.mutate({trans:r,type:"delete",keys:m,criteria:v}).then((t=>p(m.length,t))))).then((()=>o.length>a+f&&i(a+l)))}))};return i(0).then((()=>{if(f.length>0)throw new J("Error modifying one or more objects",f,h,d);return o.length}))}))}))}delete(){var t=this._ctx,e=t.range;return Ne(t)&&(t.isPrimKey&&!Le||3===e.type)?this._write((r=>{const{primaryKey:n}=t.table.core.schema,o=e;return t.table.core.count({trans:r,query:{index:n,range:o}}).then((e=>t.table.core.mutate({trans:r,type:"deleteRange",range:o}).then((({failures:t,lastResult:r,results:n,numFailures:o})=>{if(o)throw new J("Could not delete some values",Object.keys(t).map((e=>t[e])),e-o);return e-o}))))})):this.modify(He)}}const He=(t,e)=>e.value=null;function qe(t,e){return t<e?-1:t===e?0:1}function Xe(t,e){return t>e?-1:t===e?0:1}function Je(t,e,r){var n=t instanceof or?new t.Collection(t):t;return n._ctx.error=r?new r(e):new TypeError(e),n}function Qe(t){return new t.Collection(t,(()=>nr(""))).limit(0)}function tr(t,e,r,n,o,i){for(var a=Math.min(t.length,n.length),s=-1,c=0;c<a;++c){var u=e[c];if(u!==n[c])return o(t[c],r[c])<0?t.substr(0,c)+r[c]+r.substr(c+1):o(t[c],n[c])<0?t.substr(0,c)+n[c]+r.substr(c+1):s>=0?t.substr(0,s)+e[s]+r.substr(s+1):null;o(t[c],u)<0&&(s=c)}return a<n.length&&"next"===i?t+r.substr(t.length):a<t.length&&"prev"===i?t.substr(0,r.length):s<0?null:t.substr(0,s)+n[s]+r.substr(s+1)}function er(t,e,r,n){var o,i,a,s,c,u,l,f=r.length;if(!r.every((t=>"string"==typeof t)))return Je(t,ke);function h(t){o=function(t){return"next"===t?t=>t.toUpperCase():t=>t.toLowerCase()}(t),i=function(t){return"next"===t?t=>t.toLowerCase():t=>t.toUpperCase()}(t),a="next"===t?qe:Xe;var e=r.map((function(t){return{lower:i(t),upper:o(t)}})).sort((function(t,e){return a(t.lower,e.lower)}));s=e.map((function(t){return t.upper})),c=e.map((function(t){return t.lower})),u=t,l="next"===t?"":n}h("next");var d=new t.Collection(t,(()=>rr(s[0],c[f-1]+n)));d._ondirectionchange=function(t){h(t)};var p=0;return d._addAlgorithm((function(t,r,n){var o=t.key;if("string"!=typeof o)return!1;var h=i(o);if(e(h,c,p))return!0;for(var d=null,y=p;y<f;++y){var g=tr(o,h,s[y],c[y],a,u);null===g&&null===d?p=y+1:(null===d||a(d,g)>0)&&(d=g)}return r(null!==d?function(){t.continue(d+l)}:n),!1})),d}function rr(t,e,r,n){return{type:2,lower:t,upper:e,lowerOpen:r,upperOpen:n}}function nr(t){return{type:1,lower:t,upper:t}}class or{get Collection(){return this._ctx.table.db.Collection}between(t,e,r,n){r=!1!==r,n=!0===n;try{return this._cmp(t,e)>0||0===this._cmp(t,e)&&(r||n)&&(!r||!n)?Qe(this):new this.Collection(this,(()=>rr(t,e,!r,!n)))}catch(t){return Je(this,_e)}}equals(t){return null==t?Je(this,_e):new this.Collection(this,(()=>nr(t)))}above(t){return null==t?Je(this,_e):new this.Collection(this,(()=>rr(t,void 0,!0)))}aboveOrEqual(t){return null==t?Je(this,_e):new this.Collection(this,(()=>rr(t,void 0,!1)))}below(t){return null==t?Je(this,_e):new this.Collection(this,(()=>rr(void 0,t,!1,!0)))}belowOrEqual(t){return null==t?Je(this,_e):new this.Collection(this,(()=>rr(void 0,t)))}startsWith(t){return"string"!=typeof t?Je(this,ke):this.between(t,t+we,!0,!0)}startsWithIgnoreCase(t){return""===t?this.startsWith(t):er(this,((t,e)=>0===t.indexOf(e[0])),[t],we)}equalsIgnoreCase(t){return er(this,((t,e)=>t===e[0]),[t],"")}anyOfIgnoreCase(){var t=R.apply(N,arguments);return 0===t.length?Qe(this):er(this,((t,e)=>-1!==e.indexOf(t)),t,"")}startsWithAnyOfIgnoreCase(){var t=R.apply(N,arguments);return 0===t.length?Qe(this):er(this,((t,e)=>e.some((e=>0===t.indexOf(e)))),t,we)}anyOf(){const t=R.apply(N,arguments);let e=this._cmp;try{t.sort(e)}catch(t){return Je(this,_e)}if(0===t.length)return Qe(this);const r=new this.Collection(this,(()=>rr(t[0],t[t.length-1])));r._ondirectionchange=r=>{e="next"===r?this._ascending:this._descending,t.sort(e)};let n=0;return r._addAlgorithm(((r,o,i)=>{const a=r.key;for(;e(a,t[n])>0;)if(++n,n===t.length)return o(i),!1;return 0===e(a,t[n])||(o((()=>{r.continue(t[n])})),!1)})),r}notEqual(t){return this.inAnyRange([[xe,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const t=R.apply(N,arguments);if(0===t.length)return new this.Collection(this);try{t.sort(this._ascending)}catch(t){return Je(this,_e)}const e=t.reduce(((t,e)=>t?t.concat([[t[t.length-1][1],e]]):[[xe,e]]),null);return e.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(e,{includeLowers:!1,includeUppers:!1})}inAnyRange(t,e){const r=this._cmp,n=this._ascending,o=this._descending,i=this._min,a=this._max;if(0===t.length)return Qe(this);if(!t.every((t=>void 0!==t[0]&&void 0!==t[1]&&n(t[0],t[1])<=0)))return Je(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",rt.InvalidArgument);const s=!e||!1!==e.includeLowers,c=e&&!0===e.includeUppers;let u,l=n;function f(t,e){return l(t[0],e[0])}try{u=t.reduce((function(t,e){let n=0,o=t.length;for(;n<o;++n){const o=t[n];if(r(e[0],o[1])<0&&r(e[1],o[0])>0){o[0]=i(o[0],e[0]),o[1]=a(o[1],e[1]);break}}return n===o&&t.push(e),t}),[]),u.sort(f)}catch(t){return Je(this,_e)}let h=0;const d=c?t=>n(t,u[h][1])>0:t=>n(t,u[h][1])>=0,p=s?t=>o(t,u[h][0])>0:t=>o(t,u[h][0])>=0;let y=d;const g=new this.Collection(this,(()=>rr(u[0][0],u[u.length-1][1],!s,!c)));return g._ondirectionchange=t=>{"next"===t?(y=d,l=n):(y=p,l=o),u.sort(f)},g._addAlgorithm(((t,e,r)=>{for(var o=t.key;y(o);)if(++h,h===u.length)return e(r),!1;return!!function(t){return!d(t)&&!p(t)}(o)||(0===this._cmp(o,u[h][1])||0===this._cmp(o,u[h][0])||e((()=>{l===n?t.continue(u[h][0]):t.continue(u[h][1])})),!1)})),g}startsWithAnyOf(){const t=R.apply(N,arguments);return t.every((t=>"string"==typeof t))?0===t.length?Qe(this):this.inAnyRange(t.map((t=>[t,t+we]))):Je(this,"startsWithAnyOf() only works with strings")}}function ir(t){return qt((function(e){return ar(e),t(e.target.error),!1}))}function ar(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()}const sr="storagemutated",cr="x-storagemutated-1",ur=ze(null,sr);class lr{_lock(){return x(!Ct.global),++this._reculock,1!==this._reculock||Ct.global||(Ct.lockOwnerFor=this),this}_unlock(){if(x(!Ct.global),0==--this._reculock)for(Ct.global||(Ct.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{fe(t[1],t[0])}catch(t){}}return this}_locked(){return this._reculock&&Ct.lockOwnerFor!==this}create(t){if(!this.mode)return this;const e=this.db.idbdb,r=this.db._state.dbOpenError;if(x(!this.idbtrans),!t&&!e)switch(r&&r.name){case"DatabaseClosedError":throw new rt.DatabaseClosed(r);case"MissingAPIError":throw new rt.MissingAPI(r.message,r);default:throw new rt.OpenFailed(r)}if(!this.active)throw new rt.TransactionInactive;return x(null===this._completion._state),(t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):e.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=qt((e=>{ar(e),this._reject(t.error)})),t.onabort=qt((e=>{ar(e),this.active&&this._reject(new rt.Abort(t.error)),this.active=!1,this.on("abort").fire(e)})),t.oncomplete=qt((()=>{this.active=!1,this._resolve(),"mutatedParts"in t&&ur.storagemutated.fire(t.mutatedParts)})),this}_promise(t,e,r){if("readwrite"===t&&"readwrite"!==this.mode)return me(new rt.ReadOnly("Transaction is readonly"));if(!this.active)return me(new rt.TransactionInactive);if(this._locked())return new Bt(((n,o)=>{this._blockedFuncs.push([()=>{this._promise(t,e,r).then(n,o)},Ct])}));if(r)return ne((()=>{var t=new Bt(((t,r)=>{this._lock();const n=e(t,r,this);n&&n.then&&n.then(t,r)}));return t.finally((()=>this._unlock())),t._lib=!0,t}));var n=new Bt(((t,r)=>{var n=e(t,r,this);n&&n.then&&n.then(t,r)}));return n._lib=!0,n}_root(){return this.parent?this.parent._root():this}waitFor(t){var e=this._root();const r=Bt.resolve(t);if(e._waitingFor)e._waitingFor=e._waitingFor.then((()=>r));else{e._waitingFor=r,e._waitingQueue=[];var n=e.idbtrans.objectStore(e.storeNames[0]);!function t(){for(++e._spinCount;e._waitingQueue.length;)e._waitingQueue.shift()();e._waitingFor&&(n.get(-1/0).onsuccess=t)}()}var o=e._waitingFor;return new Bt(((t,n)=>{r.then((r=>e._waitingQueue.push(qt(t.bind(null,r)))),(t=>e._waitingQueue.push(qt(n.bind(null,t))))).finally((()=>{e._waitingFor===o&&(e._waitingFor=null)}))}))}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new rt.Abort))}table(t){const e=this._memoizedTables||(this._memoizedTables={});if(f(e,t))return e[t];const r=this.schema[t];if(!r)throw new rt.NotFound("Table "+t+" not part of transaction");const n=new this.db.Table(t,r,this);return n.core=this.db.core.table(t),e[t]=n,n}}function fr(t,e,r,n,o,i,a){return{name:t,keyPath:e,unique:r,multi:n,auto:o,compound:i,src:(r&&!a?"&":"")+(n?"*":"")+(o?"++":"")+hr(e)}}function hr(t){return"string"==typeof t?t:t?"["+[].join.call(t,"+")+"]":""}function dr(t,e,r){return{name:t,primKey:e,indexes:r,mappedClass:null,idxByName:k(r,(t=>[t.name,t]))}}let pr=t=>{try{return t.only([[]]),pr=()=>[[]],[[]]}catch(t){return pr=()=>we,we}};function yr(t){return null==t?()=>{}:"string"==typeof t?function(t){return 1===t.split(".").length?e=>e[t]:e=>E(e,t)}(t):e=>E(e,t)}function gr(t){return[].slice.call(t)}let mr=0;function vr(t){return null==t?":id":"string"==typeof t?t:`[${t.join("+")}]`}function br({_novip:t},e){const r=e.db,n=function(t,e,{IDBKeyRange:r,indexedDB:n},o){const i=function(t,e){return e.reduce(((t,{create:e})=>({...t,...e(t)})),t)}(function(t,e,r){function n(t){if(3===t.type)return null;if(4===t.type)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:r,upper:n,lowerOpen:o,upperOpen:i}=t;return void 0===r?void 0===n?null:e.upperBound(n,!!i):void 0===n?e.lowerBound(r,!!o):e.bound(r,n,!!o,!!i)}const{schema:o,hasGetAll:i}=function(t,e){const r=gr(t.objectStoreNames);return{schema:{name:t.name,tables:r.map((t=>e.objectStore(t))).map((t=>{const{keyPath:e,autoIncrement:r}=t,n=s(e),o=null==e,i={},a={name:t.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:o,compound:n,keyPath:e,autoIncrement:r,unique:!0,extractKey:yr(e)},indexes:gr(t.indexNames).map((e=>t.index(e))).map((t=>{const{name:e,unique:r,multiEntry:n,keyPath:o}=t,a={name:e,compound:s(o),keyPath:o,unique:r,multiEntry:n,extractKey:yr(o)};return i[vr(o)]=a,a})),getIndexByKeyPath:t=>i[vr(t)]};return i[":id"]=a.primaryKey,null!=e&&(i[vr(e)]=a.primaryKey),a}))},hasGetAll:r.length>0&&"getAll"in e.objectStore(r[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(t,r),a=o.tables.map((t=>function(t){const e=t.name;return{name:e,schema:t,mutate:function({trans:t,type:r,keys:o,values:i,range:a}){return new Promise(((s,c)=>{s=qt(s);const u=t.objectStore(e),l=null==u.keyPath,f="put"===r||"add"===r;if(!f&&"delete"!==r&&"deleteRange"!==r)throw new Error("Invalid operation type: "+r);const{length:h}=o||i||{length:1};if(o&&i&&o.length!==i.length)throw new Error("Given keys array must have same length as given values array.");if(0===h)return s({numFailures:0,failures:{},results:[],lastResult:void 0});let d;const p=[],y=[];let g=0;const m=t=>{++g,ar(t)};if("deleteRange"===r){if(4===a.type)return s({numFailures:g,failures:y,results:[],lastResult:void 0});3===a.type?p.push(d=u.clear()):p.push(d=u.delete(n(a)))}else{const[t,e]=f?l?[i,o]:[i,null]:[o,null];if(f)for(let n=0;n<h;++n)p.push(d=e&&void 0!==e[n]?u[r](t[n],e[n]):u[r](t[n])),d.onerror=m;else for(let e=0;e<h;++e)p.push(d=u[r](t[e])),d.onerror=m}const v=t=>{const e=t.target.result;p.forEach(((t,e)=>null!=t.error&&(y[e]=t.error))),s({numFailures:g,failures:y,results:"delete"===r?o:p.map((t=>t.result)),lastResult:e})};d.onerror=t=>{m(t),v(t)},d.onsuccess=v}))},getMany:({trans:t,keys:r})=>new Promise(((n,o)=>{n=qt(n);const i=t.objectStore(e),a=r.length,s=new Array(a);let c,u=0,l=0;const f=t=>{const e=t.target;s[e._pos]=e.result,++l===u&&n(s)},h=ir(o);for(let t=0;t<a;++t)null!=r[t]&&(c=i.get(r[t]),c._pos=t,c.onsuccess=f,c.onerror=h,++u);0===u&&n(s)})),get:({trans:t,key:r})=>new Promise(((n,o)=>{n=qt(n);const i=t.objectStore(e).get(r);i.onsuccess=t=>n(t.target.result),i.onerror=ir(o)})),query:function(t){return r=>new Promise(((o,i)=>{o=qt(o);const{trans:a,values:s,limit:c,query:u}=r,l=c===1/0?void 0:c,{index:f,range:h}=u,d=a.objectStore(e),p=f.isPrimaryKey?d:d.index(f.name),y=n(h);if(0===c)return o({result:[]});if(t){const t=s?p.getAll(y,l):p.getAllKeys(y,l);t.onsuccess=t=>o({result:t.target.result}),t.onerror=ir(i)}else{let t=0;const e=s||!("openKeyCursor"in p)?p.openCursor(y):p.openKeyCursor(y),r=[];e.onsuccess=n=>{const i=e.result;return i?(r.push(s?i.value:i.primaryKey),++t===c?o({result:r}):void i.continue()):o({result:r})},e.onerror=ir(i)}}))}(i),openCursor:function({trans:t,values:r,query:o,reverse:i,unique:a}){return new Promise(((s,c)=>{s=qt(s);const{index:u,range:l}=o,f=t.objectStore(e),h=u.isPrimaryKey?f:f.index(u.name),d=i?a?"prevunique":"prev":a?"nextunique":"next",p=r||!("openKeyCursor"in h)?h.openCursor(n(l),d):h.openKeyCursor(n(l),d);p.onerror=ir(c),p.onsuccess=qt((e=>{const r=p.result;if(!r)return void s(null);r.___id=++mr,r.done=!1;const n=r.continue.bind(r);let o=r.continuePrimaryKey;o&&(o=o.bind(r));const i=r.advance.bind(r),a=()=>{throw new Error("Cursor not stopped")};r.trans=t,r.stop=r.continue=r.continuePrimaryKey=r.advance=()=>{throw new Error("Cursor not started")},r.fail=qt(c),r.next=function(){let t=1;return this.start((()=>t--?this.continue():this.stop())).then((()=>this))},r.start=t=>{const e=new Promise(((t,e)=>{t=qt(t),p.onerror=ir(e),r.fail=e,r.stop=e=>{r.stop=r.continue=r.continuePrimaryKey=r.advance=a,t(e)}})),s=()=>{if(p.result)try{t()}catch(t){r.fail(t)}else r.done=!0,r.start=()=>{throw new Error("Cursor behind last entry")},r.stop()};return p.onsuccess=qt((t=>{p.onsuccess=s,s()})),r.continue=n,r.continuePrimaryKey=o,r.advance=i,s(),e},s(r)}),c)}))},count({query:t,trans:r}){const{index:o,range:i}=t;return new Promise(((t,a)=>{const s=r.objectStore(e),c=o.isPrimaryKey?s:s.index(o.name),u=n(i),l=u?c.count(u):c.count();l.onsuccess=qt((e=>t(e.target.result))),l.onerror=ir(a)}))}}}(t))),c={};return a.forEach((t=>c[t.name]=t)),{stack:"dbcore",transaction:t.transaction.bind(t),table(t){if(!c[t])throw new Error(`Table '${t}' not found`);return c[t]},MIN_KEY:-1/0,MAX_KEY:pr(e),schema:o}}(e,r,o),t.dbcore);return{dbcore:i}}(t._middlewares,r,t._deps,e);t.core=n.dbcore,t.tables.forEach((e=>{const r=e.name;t.core.schema.tables.some((t=>t.name===r))&&(e.core=t.core.table(r),t[r]instanceof t.Table&&(t[r].core=e.core))}))}function wr({_novip:t},e,r,n){r.forEach((r=>{const o=n[r];e.forEach((e=>{const n=m(e,r);(!n||"value"in n&&void 0===n.value)&&(e===t.Transaction.prototype||e instanceof t.Transaction?p(e,r,{get(){return this.table(r)},set(t){d(this,r,{value:t,writable:!0,configurable:!0,enumerable:!0})}}):e[r]=new t.Table(r,o))}))}))}function xr({_novip:t},e){e.forEach((e=>{for(let r in e)e[r]instanceof t.Table&&delete e[r]}))}function _r(t,e){return t._cfg.version-e._cfg.version}function kr(t,e){const r={del:[],add:[],change:[]};let n;for(n in t)e[n]||r.del.push(n);for(n in e){const o=t[n],i=e[n];if(o){const t={name:n,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(o.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||o.primKey.auto!==i.primKey.auto&&!Ae)t.recreate=!0,r.change.push(t);else{const e=o.idxByName,n=i.idxByName;let a;for(a in e)n[a]||t.del.push(a);for(a in n){const r=e[a],o=n[a];r?r.src!==o.src&&t.change.push(o):t.add.push(o)}(t.del.length>0||t.add.length>0||t.change.length>0)&&r.change.push(t)}}else r.add.push([n,i])}return r}function Er(t,e,r,n){const o=t.db.createObjectStore(e,r.keyPath?{keyPath:r.keyPath,autoIncrement:r.auto}:{autoIncrement:r.auto});return n.forEach((t=>Ar(o,t))),o}function Ar(t,e){t.createIndex(e.name,e.keyPath,{unique:e.unique,multiEntry:e.multi})}function Sr(t,e,r){const n={};return b(e.objectStoreNames,0).forEach((t=>{const e=r.objectStore(t);let o=e.keyPath;const i=fr(hr(o),o||"",!1,!1,!!e.autoIncrement,o&&"string"!=typeof o,!0),a=[];for(let t=0;t<e.indexNames.length;++t){const r=e.index(e.indexNames[t]);o=r.keyPath;var s=fr(r.name,o,!!r.unique,!!r.multiEntry,!1,o&&"string"!=typeof o,!1);a.push(s)}n[t]=dr(t,i,a)})),n}function Lr({_novip:t},e,r){const n=r.db.objectStoreNames;for(let o=0;o<n.length;++o){const i=n[o],a=r.objectStore(i);t._hasGetAll="getAll"in a;for(let t=0;t<a.indexNames.length;++t){const r=a.indexNames[t],n=a.index(r).keyPath,o="string"==typeof n?n:"["+b(n).join("+")+"]";if(e[i]){const t=e[i].idxByName[o];t&&(t.name=r,delete e[i].idxByName[o],e[i].idxByName[r]=t)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&i.WorkerGlobalScope&&i instanceof i.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(t._hasGetAll=!1)}class Or{_parseStoresSpec(t,e){a(t).forEach((r=>{if(null!==t[r]){var n=t[r].split(",").map(((t,e)=>{const r=(t=t.trim()).replace(/([&*]|\+\+)/g,""),n=/^\[/.test(r)?r.match(/^\[(.*)\]$/)[1].split("+"):r;return fr(r,n||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),s(n),0===e)})),o=n.shift();if(o.multi)throw new rt.Schema("Primary key cannot be multi-valued");n.forEach((t=>{if(t.auto)throw new rt.Schema("Only primary key can be marked as autoIncrement (++)");if(!t.keyPath)throw new rt.Schema("Index must have a name and cannot be an empty string")})),e[r]=dr(r,o,n)}}))}stores(t){const e=this.db;this._cfg.storesSource=this._cfg.storesSource?c(this._cfg.storesSource,t):t;const r=e._versions,n={};let o={};return r.forEach((t=>{c(n,t._cfg.storesSource),o=t._cfg.dbschema={},t._parseStoresSpec(n,o)})),e._dbSchema=o,xr(e,[e._allTables,e,e.Transaction.prototype]),wr(e,[e._allTables,e,e.Transaction.prototype,this._cfg.tables],a(o),o),e._storeNames=a(o),this}upgrade(t){return this._cfg.contentUpgrade=dt(this._cfg.contentUpgrade||it,t),this}}function Pr(t,e){let r=t._dbNamesDB;return r||(r=t._dbNamesDB=new Xr(Pe,{addons:[],indexedDB:t,IDBKeyRange:e}),r.version(1).stores({dbnames:"name"})),r.table("dbnames")}function Tr(t){return t&&"function"==typeof t.databases}function Cr(t){return ne((function(){return Ct.letThrough=!0,t()}))}function Mr(){var t;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(e){var r=function(){return indexedDB.databases().finally(e)};t=setInterval(r,100),r()})).finally((function(){return clearInterval(t)})):Promise.resolve()}function jr(t){const e=t._state,{indexedDB:r}=t._deps;if(e.isBeingOpened||t.idbdb)return e.dbReadyPromise.then((()=>e.dbOpenError?me(e.dbOpenError):t));U&&(e.openCanceller._stackHolder=Z()),e.isBeingOpened=!0,e.dbOpenError=null,e.openComplete=!1;const n=e.openCanceller;function o(){if(e.openCanceller!==n)throw new rt.DatabaseClosed("db.open() was cancelled")}let i=e.dbReadyResolve,s=null,c=!1;return Bt.race([n,("undefined"==typeof navigator?Bt.resolve():Mr()).then((()=>new Bt(((n,i)=>{if(o(),!r)throw new rt.MissingAPI;const u=t.name,l=e.autoSchema?r.open(u):r.open(u,Math.round(10*t.verno));if(!l)throw new rt.MissingAPI;l.onerror=ir(i),l.onblocked=qt(t._fireOnBlocked),l.onupgradeneeded=qt((n=>{if(s=l.transaction,e.autoSchema&&!t._options.allowEmptyDB){l.onerror=ar,s.abort(),l.result.close();const t=r.deleteDatabase(u);t.onsuccess=t.onerror=qt((()=>{i(new rt.NoSuchDatabase(`Database ${u} doesnt exist`))}))}else{s.onerror=ir(i);var o=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;c=o<1,t._novip.idbdb=l.result,function(t,e,r,n){const o=t._dbSchema,i=t._createTransaction("readwrite",t._storeNames,o);i.create(r),i._completion.catch(n);const s=i._reject.bind(i),c=Ct.transless||Ct;ne((()=>{Ct.trans=i,Ct.transless=c,0===e?(a(o).forEach((t=>{Er(r,t,o[t].primKey,o[t].indexes)})),br(t,r),Bt.follow((()=>t.on.populate.fire(i))).catch(s)):function({_novip:t},e,r,n){const o=[],i=t._versions;let s=t._dbSchema=Sr(0,t.idbdb,n),c=!1;return i.filter((t=>t._cfg.version>=e)).forEach((i=>{o.push((()=>{const o=s,u=i._cfg.dbschema;Lr(t,o,n),Lr(t,u,n),s=t._dbSchema=u;const l=kr(o,u);l.add.forEach((t=>{Er(n,t[0],t[1].primKey,t[1].indexes)})),l.change.forEach((t=>{if(t.recreate)throw new rt.Upgrade("Not yet support for changing primary key");{const e=n.objectStore(t.name);t.add.forEach((t=>Ar(e,t))),t.change.forEach((t=>{e.deleteIndex(t.name),Ar(e,t)})),t.del.forEach((t=>e.deleteIndex(t)))}}));const f=i._cfg.contentUpgrade;if(f&&i._cfg.version>e){br(t,n),r._memoizedTables={},c=!0;let e=S(u);l.del.forEach((t=>{e[t]=o[t]})),xr(t,[t.Transaction.prototype]),wr(t,[t.Transaction.prototype],a(e),e),r.schema=e;const i=F(f);let s;i&&oe();const h=Bt.follow((()=>{if(s=f(r),s&&i){var t=ie.bind(null,null);s.then(t,t)}}));return s&&"function"==typeof s.then?Bt.resolve(s):h.then((()=>s))}})),o.push((e=>{c&&Se||function(t,e){[].slice.call(e.db.objectStoreNames).forEach((r=>null==t[r]&&e.db.deleteObjectStore(r)))}(i._cfg.dbschema,e),xr(t,[t.Transaction.prototype]),wr(t,[t.Transaction.prototype],t._storeNames,t._dbSchema),r.schema=t._dbSchema}))})),function t(){return o.length?Bt.resolve(o.shift()(r.idbtrans)).then(t):Bt.resolve()}().then((()=>{var t,e;e=n,a(t=s).forEach((r=>{e.db.objectStoreNames.contains(r)||Er(e,r,t[r].primKey,t[r].indexes)}))}))}(t,e,i,r).catch(s)}))}(t,o/10,s,i)}}),i),l.onsuccess=qt((()=>{s=null;const r=t._novip.idbdb=l.result,o=b(r.objectStoreNames);if(o.length>0)try{const n=r.transaction(1===(i=o).length?i[0]:i,"readonly");e.autoSchema?function({_novip:t},e,r){t.verno=e.version/10;const n=t._dbSchema=Sr(0,e,r);t._storeNames=b(e.objectStoreNames,0),wr(t,[t._allTables],a(n),n)}(t,r,n):(Lr(t,t._dbSchema,n),function(t,e){const r=kr(Sr(0,t.idbdb,e),t._dbSchema);return!(r.add.length||r.change.some((t=>t.add.length||t.change.length)))}(t,n)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),br(t,n)}catch(t){}var i;Ee.push(t),r.onversionchange=qt((r=>{e.vcFired=!0,t.on("versionchange").fire(r)})),r.onclose=qt((e=>{t.on("close").fire(e)})),c&&function({indexedDB:t,IDBKeyRange:e},r){!Tr(t)&&r!==Pe&&Pr(t,e).put({name:r}).catch(it)}(t._deps,u),n()}),i)}))))]).then((()=>(o(),e.onReadyBeingFired=[],Bt.resolve(Cr((()=>t.on.ready.fire(t.vip)))).then((function r(){if(e.onReadyBeingFired.length>0){let n=e.onReadyBeingFired.reduce(dt,it);return e.onReadyBeingFired=[],Bt.resolve(Cr((()=>n(t.vip)))).then(r)}}))))).finally((()=>{e.onReadyBeingFired=null,e.isBeingOpened=!1})).then((()=>t)).catch((r=>{e.dbOpenError=r;try{s&&s.abort()}catch(t){}return n===e.openCanceller&&t._close(),me(r)})).finally((()=>{e.openComplete=!0,i()}))}function Ir(t){var e=e=>t.next(e),r=o(e),n=o((e=>t.throw(e)));function o(t){return e=>{var o=t(e),i=o.value;return o.done?i:i&&"function"==typeof i.then?i.then(r,n):s(i)?Promise.all(i).then(r,n):r(i)}}return o(e)()}function Br(t,e,r){var n=arguments.length;if(n<2)throw new rt.InvalidArgument("Too few arguments");for(var o=new Array(n-1);--n;)o[n-1]=arguments[n];r=o.pop();var i=O(o);return[t,i,r]}function zr(t,e,r,n,o){return Bt.resolve().then((()=>{const i=Ct.transless||Ct,a=t._createTransaction(e,r,t._dbSchema,n),s={trans:a,transless:i};n?a.idbtrans=n.idbtrans:a.create();const c=F(o);let u;c&&oe();const l=Bt.follow((()=>{if(u=o.call(a,a),u)if(c){var t=ie.bind(null,null);u.then(t,t)}else"function"==typeof u.next&&"function"==typeof u.throw&&(u=Ir(u))}),s);return(u&&"function"==typeof u.then?Bt.resolve(u).then((t=>a.active?t:me(new rt.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))):l.then((()=>u))).then((t=>(n&&a._resolve(),a._completion.then((()=>t))))).catch((t=>(a._reject(t),me(t))))}))}function Dr(t,e,r){const n=s(t)?t.slice():[t];for(let t=0;t<r;++t)n.push(e);return n}const Nr={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(t){return{...t,table(e){const r=t.table(e),{schema:n}=r,o={},i=[];function a(t,e,r){const n=vr(t),s=o[n]=o[n]||[],c=null==t?0:"string"==typeof t?1:t.length,u=e>0,l={...r,isVirtual:u,keyTail:e,keyLength:c,extractKey:yr(t),unique:!u&&r.unique};return s.push(l),l.isPrimaryKey||i.push(l),c>1&&a(2===c?t[0]:t.slice(0,c-1),e+1,r),s.sort(((t,e)=>t.keyTail-e.keyTail)),l}const s=a(n.primaryKey.keyPath,0,n.primaryKey);o[":id"]=[s];for(const t of n.indexes)a(t.keyPath,0,t);function c(e){const r=e.query.index;return r.isVirtual?{...e,query:{index:r,range:(n=e.query.range,o=r.keyTail,{type:1===n.type?2:n.type,lower:Dr(n.lower,n.lowerOpen?t.MAX_KEY:t.MIN_KEY,o),lowerOpen:!0,upper:Dr(n.upper,n.upperOpen?t.MIN_KEY:t.MAX_KEY,o),upperOpen:!0})}}:e;var n,o}const u={...r,schema:{...n,primaryKey:s,indexes:i,getIndexByKeyPath:function(t){const e=o[vr(t)];return e&&e[0]}},count:t=>r.count(c(t)),query:t=>r.query(c(t)),openCursor(e){const{keyTail:n,isVirtual:o,keyLength:i}=e.query.index;return o?r.openCursor(c(e)).then((r=>r&&function(r){const o=Object.create(r,{continue:{value:function(o){null!=o?r.continue(Dr(o,e.reverse?t.MAX_KEY:t.MIN_KEY,n)):e.unique?r.continue(r.key.slice(0,i).concat(e.reverse?t.MIN_KEY:t.MAX_KEY,n)):r.continue()}},continuePrimaryKey:{value(e,o){r.continuePrimaryKey(Dr(e,t.MAX_KEY,n),o)}},primaryKey:{get:()=>r.primaryKey},key:{get(){const t=r.key;return 1===i?t[0]:t.slice(0,i)}},value:{get:()=>r.value}});return o}(r))):r.openCursor(e)}};return u}}}};function Rr(t,e,r,n){return r=r||{},n=n||"",a(t).forEach((o=>{if(f(e,o)){var i=t[o],a=e[o];if("object"==typeof i&&"object"==typeof a&&i&&a){const t=B(i);t!==B(a)?r[n+o]=e[o]:"Object"===t?Rr(i,a,r,n+o+"."):i!==a&&(r[n+o]=e[o])}else i!==a&&(r[n+o]=e[o])}else r[n+o]=void 0})),a(e).forEach((o=>{f(t,o)||(r[n+o]=e[o])})),r}const Fr={stack:"dbcore",name:"HooksMiddleware",level:2,create:t=>({...t,table(e){const r=t.table(e),{primaryKey:n}=r.schema,o={...r,mutate(t){const o=Ct.trans,{deleting:i,creating:a,updating:s}=o.table(e).hook;switch(t.type){case"add":if(a.fire===it)break;return o._promise("readwrite",(()=>c(t)),!0);case"put":if(a.fire===it&&s.fire===it)break;return o._promise("readwrite",(()=>c(t)),!0);case"delete":if(i.fire===it)break;return o._promise("readwrite",(()=>c(t)),!0);case"deleteRange":if(i.fire===it)break;return o._promise("readwrite",(()=>function(t){return u(t.trans,t.range,1e4)}(t)),!0)}return r.mutate(t);function c(t){const e=Ct.trans,o=t.keys||function(t,e){return"delete"===e.type?e.keys:e.keys||e.values.map(t.extractKey)}(n,t);if(!o)throw new Error("Keys missing");return"delete"!==(t="add"===t.type||"put"===t.type?{...t,keys:o}:{...t}).type&&(t.values=[...t.values]),t.keys&&(t.keys=[...t.keys]),function(t,e,r){return"add"===e.type?Promise.resolve([]):t.getMany({trans:e.trans,keys:r,cache:"immutable"})}(r,t,o).then((c=>{const u=o.map(((r,o)=>{const u=c[o],l={onerror:null,onsuccess:null};if("delete"===t.type)i.fire.call(l,r,u,e);else if("add"===t.type||void 0===u){const i=a.fire.call(l,r,t.values[o],e);null==r&&null!=i&&(r=i,t.keys[o]=r,n.outbound||A(t.values[o],n.keyPath,r))}else{const n=Rr(u,t.values[o]),i=s.fire.call(l,n,r,u,e);if(i){const e=t.values[o];Object.keys(i).forEach((t=>{f(e,t)?e[t]=i[t]:A(e,t,i[t])}))}}return l}));return r.mutate(t).then((({failures:e,results:r,numFailures:n,lastResult:i})=>{for(let n=0;n<o.length;++n){const i=r?r[n]:o[n],a=u[n];null==i?a.onerror&&a.onerror(e[n]):a.onsuccess&&a.onsuccess("put"===t.type&&c[n]?t.values[n]:i)}return{failures:e,results:r,numFailures:n,lastResult:i}})).catch((t=>(u.forEach((e=>e.onerror&&e.onerror(t))),Promise.reject(t))))}))}function u(t,e,o){return r.query({trans:t,values:!1,query:{index:n,range:e},limit:o}).then((({result:r})=>c({type:"delete",keys:r,trans:t}).then((n=>n.numFailures>0?Promise.reject(n.failures[0]):r.length<o?{failures:[],numFailures:0,lastResult:void 0}:u(t,{...e,lower:r[r.length-1],lowerOpen:!0},o)))))}}};return o}})};function Ur(t,e,r){try{if(!e)return null;if(e.keys.length<t.length)return null;const n=[];for(let o=0,i=0;o<e.keys.length&&i<t.length;++o)0===Ze(e.keys[o],t[i])&&(n.push(r?M(e.values[o]):e.values[o]),++i);return n.length===t.length?n:null}catch(t){return null}}const Gr={stack:"dbcore",level:-1,create:t=>({table:e=>{const r=t.table(e);return{...r,getMany:t=>{if(!t.cache)return r.getMany(t);const e=Ur(t.keys,t.trans._cache,"clone"===t.cache);return e?Bt.resolve(e):r.getMany(t).then((e=>(t.trans._cache={keys:t.keys,values:"clone"===t.cache?M(e):e},e)))},mutate:t=>("add"!==t.type&&(t.trans._cache=null),r.mutate(t))}}})};function Wr(t){return!("from"in t)}const Vr=function(t,e){if(!this){const e=new Vr;return t&&"d"in t&&c(e,t),e}c(this,arguments.length?{d:1,from:t,to:arguments.length>1?e:t}:{d:0})};function Zr(t,e,r){const n=Ze(e,r);if(isNaN(n))return;if(n>0)throw RangeError();if(Wr(t))return c(t,{from:e,to:r,d:1});const o=t.l,i=t.r;if(Ze(r,t.from)<0)return o?Zr(o,e,r):t.l={from:e,to:r,d:1,l:null,r:null},Kr(t);if(Ze(e,t.to)>0)return i?Zr(i,e,r):t.r={from:e,to:r,d:1,l:null,r:null},Kr(t);Ze(e,t.from)<0&&(t.from=e,t.l=null,t.d=i?i.d+1:1),Ze(r,t.to)>0&&(t.to=r,t.r=null,t.d=t.l?t.l.d+1:1);const a=!t.r;o&&!t.l&&$r(t,o),i&&a&&$r(t,i)}function $r(t,e){Wr(e)||function t(e,{from:r,to:n,l:o,r:i}){Zr(e,r,n),o&&t(e,o),i&&t(e,i)}(t,e)}function Yr(t){let e=Wr(t)?null:{s:0,n:t};return{next(t){const r=arguments.length>0;for(;e;)switch(e.s){case 0:if(e.s=1,r)for(;e.n.l&&Ze(t,e.n.from)<0;)e={up:e,n:e.n.l,s:1};else for(;e.n.l;)e={up:e,n:e.n.l,s:1};case 1:if(e.s=2,!r||Ze(t,e.n.to)<=0)return{value:e.n,done:!1};case 2:if(e.n.r){e.s=3,e={up:e,n:e.n.r,s:0};continue}case 3:e=e.up}return{done:!0}}}}function Kr(t){var e,r;const n=((null===(e=t.r)||void 0===e?void 0:e.d)||0)-((null===(r=t.l)||void 0===r?void 0:r.d)||0),o=n>1?"r":n<-1?"l":"";if(o){const e="r"===o?"l":"r",r={...t},n=t[o];t.from=n.from,t.to=n.to,t[o]=n[o],r[o]=n[e],t[e]=r,r.d=Hr(r)}t.d=Hr(t)}function Hr({r:t,l:e}){return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}h(Vr.prototype,{add(t){return $r(this,t),this},addKey(t){return Zr(this,t,t),this},addKeys(t){return t.forEach((t=>Zr(this,t,t))),this},[z](){return Yr(this)}});const qr={stack:"dbcore",level:0,create:t=>{const e=t.schema.name,r=new Vr(t.MIN_KEY,t.MAX_KEY);return{...t,table:n=>{const o=t.table(n),{schema:i}=o,{primaryKey:c}=i,{extractKey:u,outbound:l}=c,f={...o,mutate:t=>{const a=t.trans,c=a.mutatedParts||(a.mutatedParts={}),u=t=>{const r=`idb://${e}/${n}/${t}`;return c[r]||(c[r]=new Vr)},l=u(""),f=u(":dels"),{type:h}=t;let[d,p]="deleteRange"===t.type?[t.range]:"delete"===t.type?[t.keys]:t.values.length<50?[[],t.values]:[];const y=t.trans._cache;return o.mutate(t).then((t=>{if(s(d)){"delete"!==h&&(d=t.results),l.addKeys(d);const e=Ur(d,y);e||"add"===h||f.addKeys(d),(e||p)&&function(t,e,r,n){e.indexes.forEach((function(e){const o=t(e.name||"");function i(t){return null!=t?e.extractKey(t):null}const a=t=>e.multiEntry&&s(t)?t.forEach((t=>o.addKey(t))):o.addKey(t);(r||n).forEach(((t,e)=>{const o=r&&i(r[e]),s=n&&i(n[e]);0!==Ze(o,s)&&(null!=o&&a(o),null!=s&&a(s))}))}))}(u,i,e,p)}else if(d){const t={from:d.lower,to:d.upper};f.add(t),l.add(t)}else l.add(r),f.add(r),i.indexes.forEach((t=>u(t.name).add(r)));return t}))}},h=({query:{index:e,range:r}})=>{var n,o;return[e,new Vr(null!==(n=r.lower)&&void 0!==n?n:t.MIN_KEY,null!==(o=r.upper)&&void 0!==o?o:t.MAX_KEY)]},d={get:t=>[c,new Vr(t.key)],getMany:t=>[c,(new Vr).addKeys(t.keys)],count:h,query:h,openCursor:h};return a(d).forEach((t=>{f[t]=function(i){const{subscr:a}=Ct;if(a){const s=t=>{const r=`idb://${e}/${n}/${t}`;return a[r]||(a[r]=new Vr)},c=s(""),f=s(":dels"),[h,p]=d[t](i);if(s(h.name||"").add(p),!h.isPrimaryKey){if("count"!==t){const e="query"===t&&l&&i.values&&o.query({...i,values:!1});return o[t].apply(this,arguments).then((r=>{if("query"===t){if(l&&i.values)return e.then((({result:t})=>(c.addKeys(t),r)));const t=i.values?r.result.map(u):r.result;i.values?c.addKeys(t):f.addKeys(t)}else if("openCursor"===t){const t=r,e=i.values;return t&&Object.create(t,{key:{get:()=>(f.addKey(t.primaryKey),t.key)},primaryKey:{get(){const e=t.primaryKey;return f.addKey(e),e}},value:{get:()=>(e&&c.addKey(t.primaryKey),t.value)}})}return r}))}f.add(r)}}return o[t].apply(this,arguments)}})),f}}}};class Xr{constructor(t,e){this._middlewares={},this.verno=0;const r=Xr.dependencies;this._options=e={addons:Xr.addons,autoOpen:!0,indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange,...e},this._deps={indexedDB:e.indexedDB,IDBKeyRange:e.IDBKeyRange};const{addons:n}=e;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const o={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:it,dbReadyPromise:null,cancelOpen:it,openCanceller:null,autoSchema:!0};var i;o.dbReadyPromise=new Bt((t=>{o.dbReadyResolve=t})),o.openCanceller=new Bt(((t,e)=>{o.cancelOpen=e})),this._state=o,this.name=t,this.on=ze(this,"populate","blocked","versionchange","close",{ready:[dt,it]}),this.on.ready.subscribe=w(this.on.ready.subscribe,(t=>(e,r)=>{Xr.vip((()=>{const n=this._state;if(n.openComplete)n.dbOpenError||Bt.resolve().then(e),r&&t(e);else if(n.onReadyBeingFired)n.onReadyBeingFired.push(e),r&&t(e);else{t(e);const n=this;r||t((function t(){n.on.ready.unsubscribe(e),n.on.ready.unsubscribe(t)}))}}))})),this.Collection=(i=this,De(Ke.prototype,(function(t,e){this.db=i;let r=je,n=null;if(e)try{r=e()}catch(t){n=t}const o=t._ctx,a=o.table,s=a.hook.reading.fire;this._ctx={table:a,index:o.index,isPrimKey:!o.index||a.schema.primKey.keyPath&&o.index===a.schema.primKey.name,range:r,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:n,or:o.or,valueMapper:s!==at?s:null}}))),this.Table=function(t){return De(Be.prototype,(function(e,r,n){this.db=t,this._tx=n,this.name=e,this.schema=r,this.hook=t._allTables[e]?t._allTables[e].hook:ze(null,{creating:[ut,it],reading:[st,at],updating:[ft,it],deleting:[lt,it]})}))}(this),this.Transaction=function(t){return De(lr.prototype,(function(e,r,n,o,i){this.db=t,this.mode=e,this.storeNames=r,this.schema=n,this.chromeTransactionDurability=o,this.idbtrans=null,this.on=ze(this,"complete","error","abort"),this.parent=i||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new Bt(((t,e)=>{this._resolve=t,this._reject=e})),this._completion.then((()=>{this.active=!1,this.on.complete.fire()}),(t=>{var e=this.active;return this.active=!1,this.on.error.fire(t),this.parent?this.parent._reject(t):e&&this.idbtrans&&this.idbtrans.abort(),me(t)}))}))}(this),this.Version=function(t){return De(Or.prototype,(function(e){this.db=t,this._cfg={version:e,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(t){return De(or.prototype,(function(e,r,n){this.db=t,this._ctx={table:e,index:":id"===r?null:r,or:n};const o=t._deps.indexedDB;if(!o)throw new rt.MissingAPI;this._cmp=this._ascending=o.cmp.bind(o),this._descending=(t,e)=>o.cmp(e,t),this._max=(t,e)=>o.cmp(t,e)>0?t:e,this._min=(t,e)=>o.cmp(t,e)<0?t:e,this._IDBKeyRange=t._deps.IDBKeyRange}))}(this),this.on("versionchange",(t=>{t.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()})),this.on("blocked",(t=>{!t.newVersion||t.newVersion<t.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${t.oldVersion/10}`)})),this._maxKey=pr(e.IDBKeyRange),this._createTransaction=(t,e,r,n)=>new this.Transaction(t,e,r,this._options.chromeTransactionDurability,n),this._fireOnBlocked=t=>{this.on("blocked").fire(t),Ee.filter((t=>t.name===this.name&&t!==this&&!t._state.vcFired)).map((e=>e.on("versionchange").fire(t)))},this.use(Nr),this.use(Fr),this.use(qr),this.use(Gr),this.vip=Object.create(this,{_vip:{value:!0}}),n.forEach((t=>t(this)))}version(t){if(isNaN(t)||t<.1)throw new rt.Type("Given version is not a positive number");if(t=Math.round(10*t)/10,this.idbdb||this._state.isBeingOpened)throw new rt.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);const e=this._versions;var r=e.filter((e=>e._cfg.version===t))[0];return r||(r=new this.Version(t),e.push(r),e.sort(_r),r.stores({}),this._state.autoSchema=!1,r)}_whenReady(t){return this.idbdb&&(this._state.openComplete||Ct.letThrough||this._vip)?t():new Bt(((t,e)=>{if(this._state.openComplete)return e(new rt.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void e(new rt.DatabaseClosed);this.open().catch(it)}this._state.dbReadyPromise.then(t,e)})).then(t)}use({stack:t,create:e,level:r,name:n}){n&&this.unuse({stack:t,name:n});const o=this._middlewares[t]||(this._middlewares[t]=[]);return o.push({stack:t,create:e,level:null==r?10:r,name:n}),o.sort(((t,e)=>t.level-e.level)),this}unuse({stack:t,name:e,create:r}){return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter((t=>r?t.create!==r:!!e&&t.name!==e))),this}open(){return jr(this)}_close(){const t=this._state,e=Ee.indexOf(this);if(e>=0&&Ee.splice(e,1),this.idbdb){try{this.idbdb.close()}catch(t){}this._novip.idbdb=null}t.dbReadyPromise=new Bt((e=>{t.dbReadyResolve=e})),t.openCanceller=new Bt(((e,r)=>{t.cancelOpen=r}))}close(){this._close();const t=this._state;this._options.autoOpen=!1,t.dbOpenError=new rt.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)}delete(){const t=arguments.length>0,e=this._state;return new Bt(((r,n)=>{const o=()=>{this.close();var t=this._deps.indexedDB.deleteDatabase(this.name);t.onsuccess=qt((()=>{!function({indexedDB:t,IDBKeyRange:e},r){!Tr(t)&&r!==Pe&&Pr(t,e).delete(r).catch(it)}(this._deps,this.name),r()})),t.onerror=ir(n),t.onblocked=this._fireOnBlocked};if(t)throw new rt.InvalidArgument("Arguments not allowed in db.delete()");e.isBeingOpened?e.dbReadyPromise.then(o):o()}))}backendDB(){return this.idbdb}isOpen(){return null!==this.idbdb}hasBeenClosed(){const t=this._state.dbOpenError;return t&&"DatabaseClosed"===t.name}hasFailed(){return null!==this._state.dbOpenError}dynamicallyOpened(){return this._state.autoSchema}get tables(){return a(this._allTables).map((t=>this._allTables[t]))}transaction(){const t=Br.apply(this,arguments);return this._transaction.apply(this,t)}_transaction(t,e,r){let n=Ct.trans;n&&n.db===this&&-1===t.indexOf("!")||(n=null);const o=-1!==t.indexOf("?");let i,a;t=t.replace("!","").replace("?","");try{if(a=e.map((t=>{var e=t instanceof this.Table?t.name:t;if("string"!=typeof e)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e})),"r"==t||t===Te)i=Te;else{if("rw"!=t&&t!=Ce)throw new rt.InvalidArgument("Invalid transaction mode: "+t);i=Ce}if(n){if(n.mode===Te&&i===Ce){if(!o)throw new rt.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");n=null}n&&a.forEach((t=>{if(n&&-1===n.storeNames.indexOf(t)){if(!o)throw new rt.SubTransaction("Table "+t+" not included in parent transaction.");n=null}})),o&&n&&!n.active&&(n=null)}}catch(t){return n?n._promise(null,((e,r)=>{r(t)})):me(t)}const s=zr.bind(null,this,i,a,n,r);return n?n._promise(i,s,"lock"):Ct.trans?fe(Ct.transless,(()=>this._whenReady(s))):this._whenReady(s)}table(t){if(!f(this._allTables,t))throw new rt.InvalidTable(`Table ${t} does not exist`);return this._allTables[t]}}const Jr="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class Qr{constructor(t){this._subscribe=t}subscribe(t,e,r){return this._subscribe(t&&"function"!=typeof t?t:{next:t,error:e,complete:r})}[Jr](){return this}}function tn(t,e){return a(e).forEach((r=>{$r(t[r]||(t[r]=new Vr),e[r])})),t}let en;try{en={indexedDB:i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,IDBKeyRange:i.IDBKeyRange||i.webkitIDBKeyRange}}catch(t){en={indexedDB:null,IDBKeyRange:null}}const rn=Xr;function nn(t){let e=on;try{on=!0,ur.storagemutated.fire(t)}finally{on=e}}h(rn,{...ot,delete:t=>new rn(t,{addons:[]}).delete(),exists:t=>new rn(t,{addons:[]}).open().then((t=>(t.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(t){try{return function({indexedDB:t,IDBKeyRange:e}){return Tr(t)?Promise.resolve(t.databases()).then((t=>t.map((t=>t.name)).filter((t=>t!==Pe)))):Pr(t,e).toCollection().primaryKeys()}(rn.dependencies).then(t)}catch(t){return me(new rt.MissingAPI)}},defineClass:()=>function(t){c(this,t)},ignoreTransaction:t=>Ct.trans?fe(Ct.transless,t):t(),vip:Cr,async:function(t){return function(){try{var e=Ir(t.apply(this,arguments));return e&&"function"==typeof e.then?e:Bt.resolve(e)}catch(t){return me(t)}}},spawn:function(t,e,r){try{var n=Ir(t.apply(r,e||[]));return n&&"function"==typeof n.then?n:Bt.resolve(n)}catch(t){return me(t)}},currentTransaction:{get:()=>Ct.trans||null},waitFor:function(t,e){const r=Bt.resolve("function"==typeof t?rn.ignoreTransaction(t):t).timeout(e||6e4);return Ct.trans?Ct.trans.waitFor(r):r},Promise:Bt,debug:{get:()=>U,set:t=>{G(t,"dexie"===t?()=>!0:Oe)}},derive:y,extend:c,props:h,override:w,Events:ze,on:ur,liveQuery:function(t){return new Qr((e=>{const r=F(t);let n=!1,o={},i={};const s={get closed(){return n},unsubscribe:()=>{n=!0,ur.storagemutated.unsubscribe(f)}};e.start&&e.start(s);let c=!1,u=!1;function l(){return a(i).some((t=>o[t]&&function(t,e){const r=Yr(e);let n=r.next();if(n.done)return!1;let o=n.value;const i=Yr(t);let a=i.next(o.from),s=a.value;for(;!n.done&&!a.done;){if(Ze(s.from,o.to)<=0&&Ze(s.to,o.from)>=0)return!0;Ze(o.from,s.from)<0?o=(n=r.next(s.from)).value:s=(a=i.next(o.from)).value}return!1}(o[t],i[t])))}const f=t=>{tn(o,t),l()&&h()},h=()=>{if(c||n)return;o={};const a={},d=function(e){r&&oe();const n=()=>ne(t,{subscr:e,trans:null}),o=Ct.trans?fe(Ct.transless,n):n();return r&&o.then(ie,ie),o}(a);u||(ur(sr,f),u=!0),c=!0,Promise.resolve(d).then((t=>{c=!1,n||(l()?h():(o={},i=a,e.next&&e.next(t)))}),(t=>{c=!1,e.error&&e.error(t),s.unsubscribe()}))};return h(),s}))},extendObservabilitySet:tn,getByKeyPath:E,setByKeyPath:A,delByKeyPath:function(t,e){"string"==typeof e?A(t,e,void 0):"length"in e&&[].map.call(e,(function(e){A(t,e,void 0)}))},shallowClone:S,deepClone:M,getObjectDiff:Rr,cmp:Ze,asap:_,minKey:xe,addons:[],connections:Ee,errnames:tt,dependencies:en,semVer:be,version:be.split(".").map((t=>parseInt(t))).reduce(((t,e,r)=>t+e/Math.pow(10,2*r)))}),rn.maxKey=pr(rn.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(ur(sr,(t=>{if(!on){let e;Ae?(e=document.createEvent("CustomEvent"),e.initCustomEvent(cr,!0,!0,t)):e=new CustomEvent(cr,{detail:t}),on=!0,dispatchEvent(e),on=!1}})),addEventListener(cr,(({detail:t})=>{on||nn(t)})));let on=!1;if("undefined"!=typeof BroadcastChannel){const t=new BroadcastChannel(cr);ur(sr,(e=>{on||t.postMessage(e)})),t.onmessage=t=>{t.data&&nn(t.data)}}else if("undefined"!=typeof self&&"undefined"!=typeof navigator){ur(sr,(t=>{try{on||("undefined"!=typeof localStorage&&localStorage.setItem(cr,JSON.stringify({trig:Math.random(),changedParts:t})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((e=>e.postMessage({type:cr,changedParts:t}))))}catch(t){}})),addEventListener("storage",(t=>{if(t.key===cr){const e=JSON.parse(t.newValue);e&&nn(e.changedParts)}}));const t=self.document&&navigator.serviceWorker;t&&t.addEventListener("message",(function({data:t}){t&&t.type===cr&&nn(t.changedParts)}))}function an(t){return an="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},an(t)}function sn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function cn(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?sn(Object(r),!0).forEach((function(e){pn(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function un(){un=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==an(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function ln(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function fn(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){ln(i,n,o,a,s,"next",t)}function s(t){ln(i,n,o,a,s,"throw",t)}a(void 0)}))}}function hn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function dn(t,e,r){return e&&hn(t.prototype,e),r&&hn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function pn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Bt.rejectionMapper=function(t,e){if(!t||t instanceof q||t instanceof TypeError||t instanceof SyntaxError||!t.name||!nt[t.name])return t;var r=new nt[t.name](e||t.message,t);return"stack"in t&&p(r,"stack",{get:function(){return this.inner.stack}}),r},G(U,Oe);var yn=dn((function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),pn(this,"dbGet",function(){var t=fn(un().mark((function t(r,n){return un().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.db[r].get(n);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),pn(this,"dbAdd",function(){var t=fn(un().mark((function t(r,n){return un().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.db[r].add(cn({},n));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),pn(this,"dbUpdate",function(){var t=fn(un().mark((function t(r,n,o){return un().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.db[r].update(n,cn({},o));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}()),pn(this,"dbRemove",function(){var t=fn(un().mark((function t(r,n){return un().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.db[r].delete(n);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),this.db=new Xr("hyperspace"),this.db.version(1).stores({tileset:"++id, name, creator, type, checksum, signature, timestamp",inventory:"++id, name, creator, type, checksum, signature, timestamp",spirits:"++id, name, creator, type, checksum, signature, timestamp",abilities:"++id, name, creator, type checksum, signature, timestamp",models:"++id, name, creator, type, checksum, signature, timestamp",accounts:"++id, name, type, checksum, signature, timestamp",dht:"++id, name, type, ip, checksum, signature, timestamp",msg:"++id, name, type, ip, checksum, signature, timestamp",tmp:"++id, key, value, timestamp"})}));function gn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function mn(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?gn(Object(r),!0).forEach((function(e){wn(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gn(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function vn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function bn(t,e,r){return e&&vn(t.prototype,e),r&&vn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function wn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var xn=bn((function t(){var e=this;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),wn(this,"all",(function(){return Object.assign({},e.store)})),wn(this,"keys",(function(){return Object.keys(e.store)})),wn(this,"values",(function(){return Object.keys(e.store).map((function(t){return e.store[t]}))})),wn(this,"size",(function(){return Object.keys(e.store).length})),wn(this,"get",(function(t){if(!e.store[t])throw"no key set";return e.store[t]})),wn(this,"add",(function(t,r){if(e.store[t])throw"key already exists";return e.store[t]=mn({},r)})),wn(this,"set",(function(t,r){return e.store[t]=mn({},r)})),wn(this,"delete",(function(t){return e.store[t]=null})),t._instance||(this.store={},t._instance=this),t._instance})),_n=r(5490),kn=r(9327),En=r(7122),An=r(7974);function Sn(t){return Sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sn(t)}function Ln(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function On(t,e){return On=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},On(t,e)}function Pn(t,e){if(e&&("object"===Sn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Tn(t)}function Tn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Cn(t){return Cn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Cn(t)}var Mn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&On(t,e)}(s,t);var e,r,n,o,i,a=(e=s,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=Cn(e);if(r){var o=Cn(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return Pn(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=a.call(this)).engine=e,r.src=t,r.glTexture=e.gl.createTexture(),r.image=new Image,r.image.onload=r.onImageLoaded.bind(Tn(r)),r.image.src=t,r.loaded=!1,r.onLoadActions=new An.Z,r}return n=s,(o=[{key:"onImageLoaded",value:function(){var t=this.engine.gl;t.bindTexture(t.TEXTURE_2D,this.glTexture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.image),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.bindTexture(t.TEXTURE_2D,null),this.loaded=!0,this.onLoadActions.run()}},{key:"attach",value:function(){var t=this.engine.gl;t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.glTexture),t.uniform1i(this.engine.renderManager.shaderProgram.samplerUniform,0)}}])&&Ln(n.prototype,o),i&&Ln(n,i),Object.defineProperty(n,"prototype",{writable:!1}),s}(r(5849).Z);function jn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function In(t,e,r){return e&&jn(t.prototype,e),r&&jn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Bn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var zn=In((function t(e,r,n){var o=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Bn(this,"runWhenLoaded",(function(t){o.loaded?t():o.onLoadActions.add(t)})),Bn(this,"loadImage",(function(){var t=o.engine.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.bindTexture(t.TEXTURE_2D,o.glTexture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o.canvas),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),o.loaded=!0,o.onLoadActions.run()})),Bn(this,"attach",(function(){var t=o.engine.gl;t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,o.glTexture),t.uniform1i(o.engine.renderManager.shaderProgram.samplerUniform,0)})),Bn(this,"clearHud",(function(){var t=o.ctx;t.clearRect(0,0,t.canvas.width,t.canvas.height),o.loadImage()})),Bn(this,"writeText",(function(t,e,r){var n=o.ctx;n.save(),n.font="32px minecraftia",n.textAlign="center",n.textBaseline="middle",n.fillStyle="white",n.fillText(t,null!=e?e:n.canvas.width/2,null!=r?r:n.canvas.height/2),n.restore()})),Bn(this,"scrollText",(function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=new _n._C(o.ctx);return r.portrait?n.init(t,10,10,o.canvas.width-20-84,2*o.canvas.height/3-20,r):n.init(t,10,10,o.canvas.width-20,2*o.canvas.height/3-20,r),n.setOptions(r),e&&n.scroll((Math.sin((new Date).getTime()/3e3)+1)*n.maxScroll*.5),n.render(),n})),this.id=n,this.engine=r,this.canvas=e,this.ctx=e.getContext("2d"),this.glTexture=r.gl.createTexture(),this.loaded=!1,this.onLoadActions=new An.Z,this.loadImage()})),Dn=r(6345);function Nn(t){return Nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nn(t)}function Rn(){Rn=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==Nn(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Fn(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function Un(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Gn(t,e,r){return e&&Un(t.prototype,e),r&&Un(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Vn=Gn((function t(e){var r=this;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Wn(this,"loadTexture",(function(t){return r.textures[t]||(r.textures[t]=new Mn(t,r.engine)),r.textures[t]})),Wn(this,"loadTextureFromZip",function(){var t,e=(t=Rn().mark((function t(e,n){var o,i,a,s;return Rn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r.textures[e]){t.next=2;break}return t.abrupt("return",r.textures[e]);case 2:return t.next=4,n.file("textures/".concat(e)).async("arrayBuffer");case 4:return o=t.sent,i=new Uint8Array(o),a=new Blob([i.buffer]),s=URL.createObjectURL(a),r.textures[e]=new Mn(s,r.engine),t.abrupt("return",r.textures[e]);case 10:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Fn(i,n,o,a,s,"next",t)}function s(t){Fn(i,n,o,a,s,"throw",t)}a(void 0)}))});return function(t,r){return e.apply(this,arguments)}}()),Wn(this,"loadSpeech",(function(t,e){return r.speeches[t]||(r.speeches[t]=new zn(e,r.engine,t)),r.speeches[t]})),t._instance||(this.engine=e,this.objLoader=Dn.NQ,this.audioLoader=new En.m(this),this.textures={},this.speeches={},t._instance=this),t._instance}));function Zn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function $n(t,e,r){return e&&Zn(t.prototype,e),r&&Zn(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Kn=$n((function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Yn(this,"register",(function(t,e){r.scenes[t]=Array.isArray(e)?e.slice():[]})),Yn(this,"start",(function(t){var e=r.scenes[t];e?(r.queue=e.slice(),r.active=!0,r._currentPromise=null,r.currentBackdrop=null,r.currentCutouts=[]):console.warn("Cutscene not found:",t)})),Yn(this,"skip",(function(){r.queue=[],r.active=!1})),Yn(this,"isRunning",(function(){return r.active})),Yn(this,"update",(function(){if(r.active&&!r._currentPromise){var t=r.queue.shift();if(t){var e;switch(t.type){case"action":e=r.runAction(t);break;case"wait":e=r.wait(t.ms||0);break;case"transition":e=r.transition(t);break;case"load_zone":e=r.loadZone(t);break;case"set_backdrop":e=r.setBackdrop(t);break;case"show_cutout":e=r.showCutout(t);break;default:console.warn("Unknown cutscene step:",t.type),e=Promise.resolve()}r._currentPromise=e,e.then((function(){r._currentPromise=null,r.update()}))}else r.active=!1}})),Yn(this,"wait",(function(t){return new Promise((function(e){return setTimeout(e,t)}))})),Yn(this,"transition",(function(t){var e=r.engine.renderManager;if(!e)return Promise.resolve();var n=t.effect||"fade",o=t.direction||"out",i=t.duration||500;return e.startTransition({effect:n,direction:o,duration:i})})),Yn(this,"runAction",(function(t){var e=t.action;return e?e():Promise.resolve()})),Yn(this,"loadZone",(function(t){var e=t.zone,n=t.remotely,o=void 0!==n&&n,i=t.zip;return e&&r.engine.spritz&&r.engine.spritz.world?(t.effect,t.duration,i?r.engine.spritz.world.loadZoneFromZip(e,i,!1,null):r.engine.spritz.world.loadZone(e,o,!1,null)):Promise.resolve()})),Yn(this,"setBackdrop",(function(t){return r.currentBackdrop=t.backdrop||null,Promise.resolve()})),Yn(this,"showCutout",(function(t){var e=t.sprite,n=t.cutout,o=t.position,i=void 0===o?"left":o;return e&&n&&(r.currentCutouts=r.currentCutouts.filter((function(t){return t.sprite!==e})),r.currentCutouts.push({sprite:e,cutout:n,position:i})),Promise.resolve()})),this.engine=e,this.scenes={},this.queue=[],this.active=!1,this._currentPromise=null,this.currentBackdrop=null,this.currentCutouts=[]})),Hn=r(1248);function qn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var Xn=function(){function t(e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),t._instance||(this.activeKeys=[],this.activeCodes=[],this.hooks=[],this.shift=!1,this.engine=e,t._instance=this),t._instance}var e,r;return e=t,r=[{key:"init",value:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)}},{key:"onKeyDown",value:function(e){e.preventDefault();var r=String.fromCharCode(e.keyCode).toLowerCase();t._instance.activeKeys.indexOf(r)<0&&t._instance.activeKeys.push(r),t._instance.activeCodes.indexOf(e.key)<0&&t._instance.activeCodes.push(e.key),t._instance.shift=e.shiftKey;try{(t._instance.hooks||[]).forEach((function(t){return t(e,"down")}))}catch(t){}}},{key:"onKeyUp",value:function(e){var r=String.fromCharCode(e.keyCode).toLowerCase(),n=t._instance.activeKeys.indexOf(r);n>-1&&t._instance.activeKeys.splice(n,1),(n=t._instance.activeCodes.indexOf(e.key))>-1&&t._instance.activeCodes.splice(n,1),t._instance.shift=e.shiftKey;try{(t._instance.hooks||[]).forEach((function(t){return t(e,"up")}))}catch(t){}}},{key:"addHook",value:function(t){t&&(this.hooks=this.hooks||[],this.hooks.push(t))}},{key:"removeHook",value:function(t){if(t&&this.hooks){var e=this.hooks.indexOf(t);e>=0&&this.hooks.splice(e,1)}}},{key:"isKeyPressed",value:function(t){return this.activeKeys.includes(t.toLowerCase())}},{key:"isCodePressed",value:function(t){return this.activeCodes.includes(t)}},{key:"lastPressed",value:function(e){for(var r=e.toLowerCase(),n=null,o=-1,i=0;i<r.length;i++){var a=r[i],s=t._instance.activeKeys.indexOf(a);s>o&&(n=a,o=s)}return n}},{key:"lastPressedCode",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=null,n=e.toLowerCase();t._instance.activeCodes.length>0;)if(r=t._instance.activeCodes.pop(),-1===n.indexOf(r.toLowerCase()))return r;return null}},{key:"lastPressedKey",value:function(){return t._instance.activeKeys[t._instance.activeKeys.length-1]||null}}],r&&qn(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Jn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var Qn=function(){function t(e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),t._instance||(this.engine=e,this.buttons=[!1,!1,!1],this.position={x:0,y:0},this.movement={x:0,y:0},this._hooks=[],t._instance=this),t._instance}var e,r;return e=t,r=[{key:"init",value:function(){var t=this.engine.canvas;t.addEventListener("mousedown",this.onMouseDown.bind(this)),t.addEventListener("mouseup",this.onMouseUp.bind(this)),t.addEventListener("mousemove",this.onMouseMove.bind(this)),t.addEventListener("contextmenu",(function(t){return t.preventDefault()}))}},{key:"onMouseDown",value:function(t){t.preventDefault();var e=t.target,r=e.getBoundingClientRect(),n=e.width/r.width,o=e.height/r.height;this.position.x=(t.clientX-r.left)*n,this.position.y=(t.clientY-r.top)*o,t.button>=0&&t.button<3&&(this.buttons[t.button]=!0),this._notifyHooks(t,"down")}},{key:"onMouseUp",value:function(t){t.preventDefault();var e=t.target,r=e.getBoundingClientRect(),n=e.width/r.width,o=e.height/r.height;this.position.x=(t.clientX-r.left)*n,this.position.y=(t.clientY-r.top)*o,t.button>=0&&t.button<3&&(this.buttons[t.button]=!1),this._notifyHooks(t,"up")}},{key:"onMouseMove",value:function(t){var e=t.target,r=e.getBoundingClientRect(),n=e.width/r.width,o=e.height/r.height,i=(t.clientX-r.left)*n,a=(t.clientY-r.top)*o;this.movement.x=i-this.position.x,this.movement.y=a-this.position.y,this.position.x=i,this.position.y=a,this._notifyHooks(t,"move")}},{key:"_notifyHooks",value:function(t,e){try{this._hooks.forEach((function(r){try{r(t,e)}catch(t){}}))}catch(t){}}},{key:"isButtonPressed",value:function(t){return"string"==typeof t&&(t={left:0,middle:1,right:2}[t]),this.buttons[t]||!1}},{key:"getPosition",value:function(){return this.position}},{key:"getMovement",value:function(){return this.movement}},{key:"addHook",value:function(t){"function"==typeof t&&this._hooks.push(t)}},{key:"removeHook",value:function(t){var e=this._hooks.indexOf(t);e>=0&&this._hooks.splice(e,1)}}],r&&Jn(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function to(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function eo(t,e,r){return e&&to(t.prototype,e),r&&to(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ro(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var no=eo((function t(e,r,n,o,i,a){var s=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),ro(this,"init",(function(){var t=s.layout,e=s.width;s.x=e-t.x,s.y=t.y+3*s.radius/8,s.dx=s.x,s.dy=s.y,s.gamepad.map["x-dir"]=0,s.gamepad.map["y-dir"]=0,s.gamepad.map["x-axis"]=0,s.gamepad.map["y-axis"]=0})),ro(this,"draw",(function(){var t=s.ctx;t.fillStyle=s.colours.joystick.base,t.beginPath(),t.arc(s.x,s.y,s.radius,0,2*Math.PI,!1),t.fill(),t.closePath(),t.fillStyle=s.colours.joystick.dust,t.beginPath(),t.arc(s.x,s.y,s.radius-5,0,2*Math.PI,!1),t.fill(),t.closePath(),t.fillStyle=s.colours.joystick.stick,t.beginPath(),t.arc(s.x,s.y,10,0,2*Math.PI,!1),t.fill(),t.closePath(),t.fillStyle=s.colours.joystick.ball,t.beginPath(),t.arc(s.dx,s.dy,s.radius-10,0,2*Math.PI,!1),t.fill(),t.closePath()})),ro(this,"state",(function(t,e){var r=s.gamepad,n=r.touches,o=r.map,i=r.checkInput,a=n[t].x,c=n[t].y,u=parseInt(a-s.x),l=parseInt(c-s.y),f=parseInt(Math.sqrt(u*u+l*l));f<1.2*s.radius&&(e?"mousedown"===e&&(n[t].id="stick"):n[t].id="stick"),f<2.5*s.radius&&(e?"stick"==n[t].id&&"mouseup"===e&&(delete n[t].id,s.reset()):n[t].id="stick"),"stick"==n[t].id&&(Math.abs(parseInt(u))<s.radius/2&&(s.dx=s.x+u),Math.abs(parseInt(l))<s.radius/2&&(s.dy=s.y+l),o["x-axis"]=(s.dx-s.x)/(s.radius/2),o["y-axis"]=(s.dy-s.y)/(s.radius/2),o["x-dir"]=Math.round(o["x-axis"]),o["y-dir"]=Math.round(o["y-axis"]),f>2.5*s.radius&&(s.reset(),delete n[t].id),"function"==typeof i&&s.gamepad.checkInput())})),ro(this,"reset",(function(){var t=s.gamepad.map;s.dx=s.x,s.dy=s.y,t["x-dir"]=0,t["y-dir"]=0,t["x-axis"]=0,t["y-axis"]=0})),this.ctx=e,this.gamepad=a,this.width=e.canvas.width,this.height=e.canvas.height,this.layout=r,this.touches=n,this.radius=i,this.x=0,this.y=0,this.dx=0,this.dy=0,this.gamepad.map["x-dir"]=0,this.gamepad.map["y-dir"]=0,this.gamepad.map["x-axis"]=0,this.gamepad.map["y-axis"]=0,this.colours=o}));function oo(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}CanvasRenderingContext2D.prototype.roundRect=function(t,e,r,n,o){return r<2*o&&(o=r/2),n<2*o&&(o=n/2),this.beginPath(),this.moveTo(t+o,e),this.arcTo(t+r,e,t+r,e+n,o),this.arcTo(t+r,e+n,t,e+n,o),this.arcTo(t,e+n,t,e,o),this.arcTo(t,e,t+r,e,o),this.closePath(),this};var io=function(){function t(e,r,n,o,i,a,s,c){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ctx=e,this.gamepad=c,this.layout=r,this.radius=s,this.touches=n,this.start=o,this.select=i,this.colours=a}var e,r;return e=t,r=[{key:"init",value:function(){for(var t=this.layout,e=this.ctx,r=this.gamepad.buttonsLayout,n=e.canvas.width,o=0;o<r.length;o++){var i=r[o],a=t.x-i.x,s=t.y-i.y;if(i.r){var c=i.r;r[o].hit={x:[a-c,a+2*c],y:[s-c,s+2*c],active:!1}}else{if(i.x=n/3-i.w,this.start&&this.select)switch(i.name){case"select":i.x=n/2-i.w-2*i.h;break;case"start":i.x=n/2}a=i.x,s=t.y-i.y,r[o].hit={x:[a,a+i.w],y:[s,s+i.h],active:!1}}this.gamepad.map[i.name]=0}}},{key:"draw",value:function(){for(var t=this.ctx,e=this.layout,r=0;r<this.gamepad.buttonsLayout.length;r++){var n=this.gamepad.buttonsLayout[r],o=n.color,i=e.x-n.x,a=e.y-n.y;if(n.dx=i,n.dy=a,n.r){var s=n.r;n.hit&&n.hit.active&&(t.fillStyle=o,t.beginPath(),t.arc(i,a,s+5,0,2*Math.PI,!1),t.fill(),t.closePath()),t.fillStyle=o,t.beginPath(),t.arc(i,a,s,0,2*Math.PI,!1),t.fill(),t.closePath(),t.strokeStyle=o,t.lineWidth=2,t.stroke(),t.fillStyle="rgba(255,255,255,1)",t.textAlign="center",t.textBaseline="middle",t.font="minecraftia 12px",t.fillText(n.name,i,a)}else{var c=n.w,u=n.h;i=isNaN(n.x)?t.canvas.width/2:n.x,s=10,t.fillStyle=o,n.hit&&n.hit.active&&t.roundRect(i-5,a-5,c+10,u+10,2*s).fill(),t.roundRect(i,a,c,u,s).fill(),t.strokeStyle=o,t.lineWidth=2,t.stroke(),t.fillStyle="rgba(0,0,0,0.5)",t.textAlign="center",t.textBaseline="middle",t.font="minecraftia 12px",t.fillText(n.name,i+c/2,a+2*u)}n.key&&(t.fillStyle="rgba(0,0,0,0.25)",t.textAlign="center",t.textBaseline="middle",t.font="minecraftia 12px","start"!=n.name&&"select"!=n.name||(i+=c/2),t.fillText(n.key,i,a-1.5*s))}}},{key:"state",value:function(t,e,r){var n=this.gamepad,o=n.touches,i=n.checkInput,a=n.width;if("stick"!=o[t].id){var s={x:o[t].x,y:o[t].y},c=this.gamepad.buttonsLayout[e],u=c.name,l=parseInt(s.x-c.dx),f=parseInt(s.y-c.dy),h=a;if(c.r?h=parseInt(Math.sqrt(l*l+f*f)):s.x>c.hit.x[0]&&s.x<c.hit.x[1]&&s.y>c.hit.y[0]&&s.y<c.hit.y[1]&&(h=0),h<this.radius&&"stick"!=o[t].id)if(r)switch(r){case"mousedown":o[t].id=u;break;case"mouseup":delete o[t].id,this.reset(e)}else o[t].id=u;o[t].id==u&&(this.gamepad.map[u]=1,c.hit.active=!0,h>this.radius&&(c.hit.active=!1,this.gamepad.map[u]=0,delete o[t].id),"function"==typeof i&&this.gamepad.checkInput())}}},{key:"reset",value:function(t){this.gamepad.buttonsLayout[t].hit.active=!1,this.gamepad.map[this.gamepad.buttonsLayout[t].name]=0}}],r&&oo(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ao(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var so=function(){function t(e,r,n,o,i,a,s){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ctx=e,this.gamepad=s,this.width=e.canvas.width,this.height=e.canvas.height,this.radius=e.canvas.width/10,this.touches=n,this.start=o,this.select=i,this.buttonOffset=r,this.colours=a,this.layout={x:this.width-this.buttonOffset.x,y:this.height-this.buttonOffset.y},this.stick=new no(this.ctx,this.layout,this.touches,this.colours,this.radius,this.gamepad),this.buttons=new io(this.ctx,this.layout,this.touches,this.start,this.select,this.colours,this.radius,this.gamepad)}var e,r;return e=t,(r=[{key:"init",value:function(){this.stick.init(),this.buttons.init()}},{key:"draw",value:function(){this.stick.draw(),this.buttons.draw()}}])&&ao(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function co(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var uo=function(){function t(e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),t._instance||(this.engine=e,this.dirty=!0,this.showTrace=!0,this.showDebug=!0,this.opacity=.4,this.font="minecraftia",this.start=!1,this.select=!1,this.touches={},this.lastKey=(new Date).getTime(),this.listeners=[],this.map={},this.x=0,this.y=0,this.colours={red:"rgba(255,0,0,".concat(this.opacity,")"),green:"rgba(5,220,30,".concat(this.opacity,")"),blue:"rgba(5,30,220,".concat(this.opacity,")"),purple:"rgba(240,5,240,".concat(this.opacity,")"),yellow:"rgba(240,240,5,".concat(this.opacity,")"),cyan:"rgba(5,240,240,".concat(this.opacity,")"),black:"rgba(5,5,5,".concat(this.opacity,")"),white:"rgba(250,250,250,".concat(this.opacity,")"),joystick:{base:"rgba(0,0,0,".concat(this.opacity,")"),dust:"rgba(0,0,0,".concat(this.opacity,")"),stick:"rgba(214,214,214,1)",ball:"rgba(245,245,245,1)"}},t._instance=this),t._instance}var e,r;return e=t,r=[{key:"init",value:function(){this.fontSize=this.engine.gp.canvas.width/12,this.radius=this.engine.gp.canvas.width/12,this.buttonOffset={x:2.5*this.radius,y:105};var t=[{x:-this.radius-this.radius/2+this.radius/4,y:-this.radius/4,r:3/4*this.radius,color:this.colours.red,name:"b"},{x:this.radius-this.radius/2,y:-(this.radius+this.radius/2),r:3/4*this.radius,color:this.colours.green,name:"a"},{x:this.radius-this.radius/2,y:this.radius,r:3/4*this.radius,color:this.colours.blue,name:"x"},{x:3*this.radius-this.radius/2-this.radius/4,y:0-this.radius/4,r:3/4*this.radius,color:this.colours.yellow,name:"y"}];this.start&&t.push({color:this.colours.black,y:-55,w:50,h:15,name:"start"}),this.select&&t.push({y:-55,w:50,h:15,color:this.colours.black,name:"select"}),this.buttonsLayout=t,this.controller=new so(this.engine.gp,this.buttonOffset,this.touches,this.start,this.select,this.colours,this),this.initOptions()}},{key:"initOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setOptions(t),this.resize(),this.loadCanvas()}},{key:"attachListener",value:function(t){return this.listeners.push(t)}},{key:"removeListener",value:function(t){this.listeners.splice(t-1,1)}},{key:"checkInput",value:function(){return this.map}},{key:"resize",value:function(){this.width=this.engine.gp.canvas.width,this.height=this.engine.gp.canvas.height,this.controller.init()}},{key:"loadCanvas",value:function(){var t=this,e=this.controller,r=this.width,n=this.height;this.engine.gp.fillStyle="rgba(70,70,70,0.5)",this.engine.gp.textAlign="center",this.engine.gp.textBaseline="middle",this.engine.gp.font="minecraftia 14px",this.engine.gp.fillText("loading",r/2,n/2),e.stick.draw(),e.buttons.draw(),window.addEventListener("resize",(function(){return t.resize()})),setTimeout((function(){this.ready=!0}),250)}},{key:"setOptions",value:function(t){var e=this;Object.keys(this).forEach((function(r){void 0!==t[r]&&(e[r]=t[r],e.dirty=!0)}))}},{key:"debounce",value:function(){var t=this.controller,e=this.buttonsLayout,r=this.lastKey;this.lastKey=(new Date).getTime()+100;for(var n=0;n<e.length;n++)t.buttons.reset(n);return r<this.lastKey}},{key:"keyPressed",value:function(t){return 1===this.map[t]&&this.debounce()}},{key:"listen",value:function(t){var e,r=this.touches,n=this.controller,o=this.buttonsLayout;if(t.type){var i=t.type;-1!=t.type.indexOf("mouse")&&(t.identifier="desktop",t={touches:[t]});var a=this.getPosition(this.engine.gp.canvas);this.listeners.map((function(e){if(e[i])return e[i](t)}));for(var s=0;s<(t.touches.length>5?5:t.touches.length);s++)r[c=t.touches[s].identifier]?(r[c].x=t.touches[s].pageX-a.x,r[c].y=t.touches[s].pageY-a.y):r[c]={x:t.touches[s].pageX-a.x,y:t.touches[s].pageY-a.y,leftClick:!1,rightClick:!1};for(var c in r)switch(i){case"touchstart":case"touchmove":if(this.disableScroll(),n.stick.state(c),(new Date).getTime()>this.lastKey+150){for(s=0;s<o.length;s++)n.buttons.state(c,s);this.lastKey=(new Date).getTime()}break;case"touchend":for(s=0;s<o.length;s++)n.buttons.reset(s);break;case"mousemove":r[c].leftClick,this.x=r[c].x,this.y=r[c].y;break;case"mousedown":t.touches&&null!==(e=t.touches[0])&&void 0!==e&&e.which?(r[c].leftClick=1===t.touches[0].which,r[c].rightClick=3===t.touches[0].which):"button"in t&&(r[c].leftClick=1==t.button,r[c].rightClick=2==t.button),n.stick.state(c,i);for(s=0;s<o.length;s++)n.buttons.state(c,s,i);break;case"mouseup":for(n.stick.state(c,i),s=0;s<o.length;s++)n.buttons.state(c,s,i);r[c].leftClick=0,r[c].rightClick=0}if("touchend"==t.type){for("stick"==r[c=t.changedTouches[0].identifier].id&&n.stick.reset(),s=0;s<o.length;s++)r[c].id==o[s].name&&n.buttons.reset(s);if(r[c]&&delete r[c],t.changedTouches.length>t.touches.length){var u=0,l=t.changedTouches.length-t.touches.length;for(var c in r)u>=l&&delete r[c],u++}if(0==t.touches.length){for(r={},s=0;s<o.length;s++)n.buttons.reset(s);n.stick.reset()}this.enableScroll()}}else{var f=t,h=0;for(var d in f){switch(d){case"%":f[d]&&(h+=1);break;case"&":f[d]&&(h+=2);break;case"'":f[d]&&(h+=4);break;case"(":f[d]&&(h+=8);break;default:if(f[d])for(s=0;s<o.length;s++)o[s].key&&o[s].key==d&&(r[o[s].name]={id:o[s].name,x:o[s].hit.x[0]+o[s].w/2,y:o[s].hit.y[0]+o[s].h/2},n.buttons.state(o[s].name,s,"mousedown"));else if(!f[d]){for(s=0;s<o.length;s++)o[s].key&&o[s].key==d&&(n.buttons.reset(s),delete r[o[s].name]);delete f[d]}}switch(n.stick.dx=n.stick.x,n.stick.dy=n.stick.y,h){case 1:n.stick.dx=n.stick.x-n.stick.radius/2;break;case 2:n.stick.dy=n.stick.y-n.stick.radius/2;break;case 3:n.stick.dx=n.stick.x-n.stick.radius/2,n.stick.dy=n.stick.y-n.stick.radius/2;break;case 4:n.stick.dx=n.stick.x+n.stick.radius/2;break;case 6:n.stick.dx=n.stick.x+n.stick.radius/2,n.stick.dy=n.stick.y-n.stick.radius/2;break;case 8:n.stick.dy=n.stick.y+n.stick.radius/2;break;case 9:n.stick.dx=n.stick.x-n.stick.radius/2,n.stick.dy=n.stick.y+n.stick.radius/2;break;case 12:n.stick.dx=n.stick.x+n.stick.radius/2,n.stick.dy=n.stick.y+n.stick.radius/2;break;default:n.stick.dx=n.stick.x,n.stick.dy=n.stick.y}0!=h?(r.stick={id:"stick"},n.stick.state("stick","mousemove")):(n.stick.reset(),delete r.stick)}}return this.map}},{key:"render",value:function(){this.engine.gp.clearRect(0,0,this.engine.gp.canvas.width,this.engine.gp.canvas.height),this.showDebug&&this.debug(),this.showTrace&&this.trace(),this.controller.stick.draw(),this.controller.buttons.draw()}},{key:"debug",value:function(){this.gp,this.map;var t=this.touches;for(var e in this.dy=30,this.engine.gp.fillStyle="rgba(70,70,70,0.5)",this.engine.gp.textAlign="left",this.engine.gp.textBaseline="middle",this.engine.gp.font="minecraftia 20px",this.engine.gp.fillText("debug",10,this.dy),this.engine.gp.font="minecraftia 14px",this.dy+=5,t){this.dy+=10;var r=e+" : "+JSON.stringify(t[e]).slice(1,-1);this.engine.gp.fillText(r,10,this.dy)}}},{key:"trace",value:function(){var t=this.map;for(var e in this.dy=30,this.engine.gp.fillStyle="rgba(70,70,70,0.5)",this.engine.gp.textAlign="right",this.engine.gp.textBaseline="middle",this.engine.gp.font="minecraftia 20px",this.engine.gp.fillText("trace",this.width-10,this.dy),this.engine.gp.font="minecraftia 14px",this.dy+=5,t){this.dy+=10;var r=e+" : "+t[e];this.engine.gp.fillText(r,this.width-10,this.dy)}}},{key:"getPosition",value:function(t){for(var e=0,r=0;t;)e+=t.offsetLeft-t.scrollLeft+t.clientLeft,r+=t.offsetTop-t.scrollTop+t.clientTop,t=t.offsetParent;return{x:e,y:r}}},{key:"enableScroll",value:function(){document.body.removeEventListener("touchmove",this.preventDefault)}},{key:"disableScroll",value:function(){document.body.addEventListener("touchmove",this.preventDefault,{passive:!1})}},{key:"preventDefault",value:function(t){t.preventDefault(),t.stopPropagation()}}],r&&co(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function lo(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var fo=function(){function t(e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),t._instance||(this.engine=e,this.touches=[],this.gestures={},this.hooks=[],this.startTime=0,this.startPos={x:0,y:0},t._instance=this),t._instance}var e,r;return e=t,r=[{key:"init",value:function(){var t=this.engine.canvas;t.addEventListener("touchstart",this.onTouchStart.bind(this),{passive:!1}),t.addEventListener("touchmove",this.onTouchMove.bind(this),{passive:!1}),t.addEventListener("touchend",this.onTouchEnd.bind(this),{passive:!1})}},{key:"onTouchStart",value:function(t){if(t.preventDefault(),this.touches=Array.from(t.touches),1===this.touches.length){var e=this.touches[0];this.startTime=Date.now(),this.startPos={x:e.clientX,y:e.clientY}}this._notifyHooks(t,"start")}},{key:"onTouchMove",value:function(t){t.preventDefault(),this.touches=Array.from(t.touches),this._notifyHooks(t,"move")}},{key:"onTouchEnd",value:function(t){var e=this;if(t.preventDefault(),this.touches=Array.from(t.touches),0===this.touches.length&&this.startTime>0){var r=Date.now()-this.startTime,n=t.changedTouches[0],o={x:n.clientX,y:n.clientY},i=o.x-this.startPos.x,a=o.y-this.startPos.y,s=Math.sqrt(i*i+a*a);r<300&&s<10?(this.gestures.tap=!0,setTimeout((function(){return delete e.gestures.tap}),100)):Math.abs(i)>Math.abs(a)&&Math.abs(i)>50?i>0?(this.gestures.swipe_right=!0,setTimeout((function(){return delete e.gestures.swipe_right}),100)):(this.gestures.swipe_left=!0,setTimeout((function(){return delete e.gestures.swipe_left}),100)):Math.abs(a)>Math.abs(i)&&Math.abs(a)>50&&(a>0?(this.gestures.swipe_down=!0,setTimeout((function(){return delete e.gestures.swipe_down}),100)):(this.gestures.swipe_up=!0,setTimeout((function(){return delete e.gestures.swipe_up}),100)))}this._notifyHooks(t,"end")}},{key:"_notifyHooks",value:function(t,e){try{this.hooks.forEach((function(r){return r(t,e)}))}catch(t){}}},{key:"isGestureActive",value:function(t){return!!this.gestures[t]}},{key:"getTouches",value:function(){return this.touches}},{key:"addHook",value:function(t){t&&this.hooks.push(t)}},{key:"removeHook",value:function(t){var e=this.hooks.indexOf(t);e>=0&&this.hooks.splice(e,1)}}],r&&lo(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),ho=r(679),po=r(4395);function yo(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function go(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?yo(Object(r),!0).forEach((function(e){mo(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yo(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function mo(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vo(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var bo=function(){function t(e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),t._instance||(this.engine=e,this.keyboard=new Xn(e),this.mouse=new Qn(e),this.gamepad=new uo(e),this.touch=new fo(e),this.mappings={},this.hooks={},this.currentMode="default",this.actionStates={},this.lastActionTime={},this.actionPressed={},t._instance=this),t._instance}var e,r;return e=t,(r=[{key:"init",value:function(){this.keyboard.init(),this.mouse.init(),this.gamepad.init(),this.touch.init(),this.setModeMappings("default",{actions:{move_up:{keyboard:"w",gamepad:"up",touch:"swipe_up"},move_down:{keyboard:"s",gamepad:"down",touch:"swipe_down"},move_left:{keyboard:"a",gamepad:"left",touch:"swipe_left"},move_right:{keyboard:"d",gamepad:"right",touch:"swipe_right"},interact:{keyboard:"k",gamepad:"a",touch:"tap"},select:{mouse:"left",touch:"tap"},select_right:{mouse:"right"},camera_pan_left:{keyboard:"ArrowLeft"},camera_pan_right:{keyboard:"ArrowRight"},camera_pan_up:{keyboard:"ArrowUp"},camera_pan_down:{keyboard:"ArrowDown"},camera_zoom_in:{keyboard:"q"},camera_zoom_out:{keyboard:"e"},camera_rotate_left:{keyboard:"z"},camera_rotate_right:{keyboard:"x"},menu:{keyboard:"m",gamepad:"y"},run:{keyboard:"r",gamepad:"y"},bind_camera:{keyboard:"b"},fixed_camera:{keyboard:"c"},help:{keyboard:"h"},chat:{keyboard:" "},clear_speech:{keyboard:"Escape"},patrol:{keyboard:"p"},dance:{keyboard:"u"},height_up:{keyboard:"y"},height_down:{keyboard:"f"}}})}},{key:"setModeMappings",value:function(t,e){this.mappings[t]=e}},{key:"addActionHook",value:function(t,e){this.hooks[t]||(this.hooks[t]=[]),this.hooks[t].push(e)}},{key:"registerActionHook",value:function(t,e){this.hooks[t]||(this.hooks[t]=[]),this.hooks[t].push(e)}},{key:"removeActionHook",value:function(t,e){if(this.hooks[t]){var r=this.hooks[t].indexOf(e);r>-1&&this.hooks[t].splice(r,1)}}},{key:"update",value:function(){var t=this,e=this.mappings[this.currentMode]||this.mappings.default,r=go(go({},this.mappings.default.actions),e.actions),n=function(e){var n,o=r[e],i=!1;o.keyboard&&((n=o.keyboard).length>1?t.keyboard.isCodePressed(n):t.keyboard.isKeyPressed(n))&&(i=!0),o.gamepad&&(t.gamepad.keyPressed(o.gamepad)||"up"===o.gamepad&&t.gamepad.map["y-axis"]<-.5||"down"===o.gamepad&&t.gamepad.map["y-axis"]>.5||"left"===o.gamepad&&t.gamepad.map["x-axis"]<-.5||"right"===o.gamepad&&t.gamepad.map["x-axis"]>.5)&&(i=!0),o.mouse&&t.mouse.isButtonPressed(o.mouse)&&(i=!0),o.touch&&t.touch.isGestureActive(o.touch)&&(i=!0);var a=t.actionStates[e];t.actionStates[e]=i,t.actionPressed[e]=i&&!a,i&&!a&&(t.lastActionTime[e]=Date.now(),t.hooks[e]&&t.hooks[e].forEach((function(r){return r(e,t.currentMode)})))};for(var o in r)n(o)}},{key:"isActionActive",value:function(t){return!!this.actionStates[t]}},{key:"isActionPressed",value:function(t){return!!this.actionPressed[t]}},{key:"setMode",value:function(t){this.mappings[t]||"default"===t?(this.currentMode=t,this.engine&&this.engine.modeManager&&this.engine.modeManager.set(t)):console.warn('Input mode "'.concat(t,'" not found, staying in "').concat(this.currentMode,'"'))}},{key:"handleInput",value:function(t){return!(!this.engine||!this.engine.modeManager)&&this.engine.modeManager.handleInput(t)}},{key:"getActionInput",value:function(t){var e=(this.mappings[this.currentMode]||this.mappings.default).actions[t];if(!e)return null;if(e.keyboard&&this.keyboard.isKeyPressed(e.keyboard))return"keyboard:"+e.keyboard;if(e.gamepad){if(this.gamepad.keyPressed(e.gamepad))return"gamepad:"+e.gamepad;if("up"===e.gamepad&&this.gamepad.map["y-axis"]<-.5)return"gamepad:up";if("down"===e.gamepad&&this.gamepad.map["y-axis"]>.5)return"gamepad:down";if("left"===e.gamepad&&this.gamepad.map["x-axis"]<-.5)return"gamepad:left";if("right"===e.gamepad&&this.gamepad.map["x-axis"]>.5)return"gamepad:right"}return e.mouse&&this.mouse.isButtonPressed(e.mouse)?"mouse:"+e.mouse:e.touch&&this.touch.isGestureActive(e.touch)?"touch:"+e.touch:null}},{key:"getMode",value:function(){return this.currentMode}},{key:"getAvatarAction",value:function(t){var e,r=this.mappings[this.currentMode]||this.mappings.default,o=go(go({},this.mappings.default.actions),r.actions);for(var i in o)if(this.isActionActive(i))switch(i){case"menu":return t.openMenu({main:{text:"Close Menu",x:100,y:100,w:150,h:75,colours:{top:"#333",bottom:"#777",background:"#999"},trigger:function(t){t.completed=!0}}},["main"]);case"chat":return new ho.aW(this.engine,"chat",[">:",!0,{autoclose:!1}],t);case"dance":return new ho.aW(this.engine,"dance",[300,t.zone],t);case"patrol":return new ho.aW(this.engine,"patrol",[t.pos.toArray(),new n.OW(8,13,t.pos.z).toArray(),600,t.zone],t);case"run":return new ho.aW(this.engine,"patrol",[t.pos.toArray(),new n.OW(8,13,t.pos.z).toArray(),200,t.zone],t);case"interact":return new ho.aW(this.engine,"interact",[t.pos.toArray(),t.facing,t.zone.world],t);case"help":return new ho.aW(this.engine,"dialogue",["Welcome! You pressed help! Press Escape to close",!1,{autoclose:!0}],t);case"clear_speech":return t.speech.clearHud();case"move_up":var a=po.Nm.getCameraRelativeDirection("forward",this.engine.renderManager.camera.cameraDir);return t.handleWalk("w",{},a);case"move_down":var s=po.Nm.getCameraRelativeDirection("backward",this.engine.renderManager.camera.cameraDir);return t.handleWalk("s",{},s);case"move_left":var c=po.Nm.getCameraRelativeDirection("left",this.engine.renderManager.camera.cameraDir);return t.handleWalk("a",{},c);case"move_right":var u=po.Nm.getCameraRelativeDirection("right",this.engine.renderManager.camera.cameraDir);return t.handleWalk("d",{},u);case"face_up":return t.faceDir("N");case"face_down":return t.faceDir("S");case"face_left":return t.faceDir("W");case"face_right":return t.faceDir("E");default:if(i.startsWith("camera_")){var l=this.engine.renderManager.camera.cameraVector,f=this.engine.renderManager.camera.cameraVector,h=po.Nm.adjustCameraDirection(f);switch(i){case"camera_rotate_left":(f=l.sub(new n.OW(0,0,1))).z=Math.round(f.z%9),0===f.z&&8===l.z&&(l.z=0),0===f.z&&7===l.z&&(f.z=8),t.faceDir(po.Nm.spriteSequence(h)),t.zone.world.addEvent(new ho.q1(this.engine,"camera",["pan",{from:l,to:f,duration:1}],t.zone.world));break;case"camera_rotate_right":(f=l.add(new n.OW(0,0,1))).z=Math.round(null!==(e=f.z%9)&&void 0!==e?e:8),0===f.z&&8===l.z&&(l.z=0),0===f.z&&7===l.z&&(f.z=8),t.faceDir(po.Nm.spriteSequence(h)),t.zone.world.addEvent(new ho.q1(this.engine,"camera",["pan",{from:l,to:f,duration:1}],t.zone.world));break;case"camera_zoom_in":case"camera_zoom_out":case"camera_pan_left":case"camera_pan_right":case"camera_pan_up":case"camera_pan_down":break;case"camera_bind":t.bindCamera=!0;break;case"camera_unbind":t.bindCamera=!1}return null}return new ho.aW(this.engine,i,[],t)}return null}},{key:"bindAction",value:function(t,e,r){this.mappings[this.currentMode]||(this.mappings[this.currentMode]={actions:{}}),this.mappings[this.currentMode].actions[t]||(this.mappings[this.currentMode].actions[t]={}),this.mappings[this.currentMode].actions[t][e]=r}},{key:"unbindAction",value:function(t,e){this.mappings[this.currentMode]&&this.mappings[this.currentMode].actions[t]&&delete this.mappings[this.currentMode].actions[t][e]}}])&&vo(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function wo(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function xo(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?wo(Object(r),!0).forEach((function(e){Co(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wo(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function _o(t,e,r){return _o=ko()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&Eo(o,r.prototype),o},_o.apply(null,arguments)}function ko(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function Eo(t,e){return Eo=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Eo(t,e)}function Ao(t,e){if(t){if("string"==typeof t)return So(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?So(t,e):void 0}}function So(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Lo(t){return Lo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lo(t)}function Oo(){Oo=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==Lo(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Po(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function To(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Co(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Mo=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.engine=e,this.ws=null,this.clientId=null,this.players=new Map,this.authority="server",this.zoneId=null,this.setAuthorityFromManifest()}var e,n,o,i;return e=t,n=[{key:"connect",value:(o=Oo().mark((function t(e){var r=this;return Oo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.ws&&this.disconnect(),this.ws=new WebSocket(e),t.abrupt("return",new Promise((function(t,e){r.ws.onopen=function(){console.log("WebSocket connection established"),t()},r.ws.onmessage=function(t){r.handleMessage(t.data)},r.ws.onclose=function(){console.log("WebSocket connection closed")},r.ws.onerror=function(t){console.error("WebSocket error:",t),e(t)}})));case 3:case"end":return t.stop()}}),t,this)})),i=function(){var t=this,e=arguments;return new Promise((function(r,n){var i=o.apply(t,e);function a(t){Po(i,r,n,a,s,"next",t)}function s(t){Po(i,r,n,a,s,"throw",t)}a(void 0)}))},function(t){return i.apply(this,arguments)})},{key:"safeStringify",value:function(t){try{return JSON.stringify(t)}catch(r){try{var e={};return Object.keys(t||{}).forEach((function(r){var n=t[r];n&&"object"===Lo(n)?e[r]=Array.isArray(n)?"[Array(".concat(n.length,")]"):"{".concat(n.constructor&&n.constructor.name,"}"):e[r]=n})),JSON.stringify(e)}catch(e){return String(t)}}}},{key:"disconnect",value:function(){this.ws&&(this.ws.close(),this.ws=null)}},{key:"send",value:function(t,e){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:t,payload:e}))}},{key:"handleMessage",value:function(t){try{var e=JSON.parse(t);switch(console.log("Received message from server:",e),e.type){case"connected":this.clientId=e.clientId,this.engine.store.set("clientId",this.clientId),console.log("Connected to server with client ID: ".concat(this.clientId));break;case"zone-loaded":this.handleZoneLoaded(e.payload);break;case"zone-change":this.handleZoneChange(e.payload);break;case"zone-joined":this.handleZoneJoined(e.payload);break;case"player-joined":this.handlePlayerJoined(e.payload);break;case"player-left":this.handlePlayerLeft(e.payload);break;case"players-update":this.handlePlayersUpdate(e.payload);break;case"zone-state":this.handleZoneState(e.payload);break;case"avatar-update":this.handleAvatarUpdate(e.payload);break;case"action":this.handleAction(e.payload);break;default:console.log("Unknown message type: ".concat(e.type))}}catch(e){var r="string"==typeof t?t.length>1e3?t.slice(0,1e3)+"... (truncated)":t:this.safeStringify(t);console.error("Failed to parse message from server. Parse error:",e),console.error("Raw message preview:",r)}}},{key:"loadZone",value:function(t,e){var r,n=e.getZoneData?e.getZoneData():e;try{r=JSON.parse(JSON.stringify(n))}catch(n){console.warn("Zone data contains circular refs, sending minimal zone info instead"),r={id:t,name:e&&e.name}}this.send("load-zone",{zoneId:t,zone:r})}},{key:"joinZone",value:function(t){this.zoneId=t;var e=this.engine.spritz.world.getAvatar(),r=e.getAvatarData(),n={id:r.id||e.objId||e.id||"avatar",templateLoaded:!!r.templateLoaded,animFrame:r.animFrame||0,facing:r.facing||0,fixed:!!r.fixed,isSelected:!!r.isSelected,x:e&&e.pos?e.pos.x:r.pos&&r.pos.x||0,y:e&&e.pos?e.pos.y:r.pos&&r.pos.y||0,z:e&&e.pos?e.pos.z:r.pos&&r.pos.z||0,drawOffset:r.drawOffset?{x:r.drawOffset.x,y:r.drawOffset.y}:void 0,hotspotOffset:r.hotspotOffset?{x:r.hotspotOffset.x,y:r.hotspotOffset.y}:void 0,scale:r.scale?{x:r.scale.x,y:r.scale.y}:void 0};this.send("join-zone",{zoneId:t,avatar:n})}},{key:"sendAction",value:function(t,e){if("server"===this.authority){var r={action:t.constructor.name.toLowerCase(),params:t.params,spriteId:e.id};this.send("action",r)}else this.handleAction({clientId:this.clientId,action:t.constructor.name.toLowerCase(),params:t.params,spriteId:e.id})}},{key:"updateAvatarPosition",value:function(t){if(this.ws&&this.ws.readyState===WebSocket.OPEN){var e={avatar:{id:t.id,x:t.pos.x,y:t.pos.y,z:t.pos.z,facing:t.facing}},r=JSON.parse(JSON.stringify(e));this.send("update-avatar",r)}}},{key:"handleZoneLoaded",value:function(t){console.log("Loaded zone ".concat(t.zoneId)),this.joinZone(t.zoneId)}},{key:"handleZoneJoined",value:function(t){var e=this;console.log("Joined zone ".concat(t.zoneId," with players:"),t.players),t.players.forEach((function(t){return e.handlePlayerJoined({client:t})})),this.send("zone-state-request",{zoneId:t.zoneId})}},{key:"getZoneSprites",value:function(t){var e=this.engine.spritz.world;if(!e)return[];var r=e.getZoneById(t);return r?r.spriteList.map((function(t){return{id:t.id,objId:t.objId,x:t.pos.x,y:t.pos.y,z:t.pos.z,avatar:t.getAvatarData?t.getAvatarData():t}})):[]}},{key:"handleZoneChange",value:function(t){console.log("Change zone ".concat(t.zoneId))}},{key:"handlePlayerJoined",value:function(t){if(t.client.clientId!==this.clientId){console.log("Player ".concat(t.client.clientId," joined the zone"));try{this.engine&&this.engine.hud&&"function"==typeof this.engine.hud.scrollText&&this.engine.hud.scrollText("Player ".concat(t.client.clientId," joined"),!0,{autoclose:!0,duration:3e3})}catch(t){}var e=this.engine.spritz.world;e&&(e.addRemoteAvatar(t.client.clientId,t.client.avatar),this.players.set(t.client.clientId,Object.assign({},t.client.avatar,{clientId:t.client.clientId})))}}},{key:"handlePlayerLeft",value:function(t){console.log("Player ".concat(t.clientId," left the zone"));try{this.engine&&this.engine.hud&&"function"==typeof this.engine.hud.scrollText&&this.engine.hud.scrollText("Player ".concat(t.clientId," left"),!0,{autoclose:!0,duration:3e3})}catch(t){}var e=this.players.get(t.clientId);if(e){var r=this.engine.spritz.world;r&&r.removeAvatar(e),this.players.delete(t.clientId)}}},{key:"handlePlayersUpdate",value:function(t){var e=this;console.log("Players update:",t.players);try{this.engine&&this.engine.hud&&"function"==typeof this.engine.hud.scrollText&&this.engine.hud.scrollText("Players in zone: ".concat(t.players.map((function(t){return t.clientId})).join(", ")),!0,{autoclose:!0,duration:3e3})}catch(t){}var r,n=new Set(this.players.keys()),o=new Set(t.players.map((function(t){return t.clientId}))),i=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ao(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(!o.has(a)){var s=this.engine.spritz.world;s&&s.removeRemoteAvatar(a),this.players.delete(a)}}}catch(t){i.e(t)}finally{i.f()}t.players.forEach((function(t){if(t.clientId!==e.clientId){var r=e.engine.spritz.world;r&&(e.players.has(t.clientId)?(r.updateRemoteAvatar(t.clientId,t.avatar),e.players.set(t.clientId,t.avatar)):(r.addRemoteAvatar(t.clientId,t.avatar),e.players.set(t.clientId,t.avatar)))}}))}},{key:"handleAction",value:function(e){if(e.clientId!==this.clientId){console.log("Received action from ".concat(e.clientId,":"),e);var n=this.engine.spritz.world.remoteAvatars.get(e.clientId);if(n)try{var o=null,i=this.engine.spritz&&this.engine.spritz.world;if(i&&"function"==typeof i.actionFactory&&(o=i.actionFactory(e.action)),o){var a=_o(o,[n].concat(function(t){if(Array.isArray(t))return So(t)}(c=Object.values(e.params||{}))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(c)||Ao(c)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()));n.addAction(a)}else{t._ActionLoader||(t._ActionLoader=r(1183).a);var s=new t._ActionLoader(this.engine,e.action,e.params||{},n,(function(){}));s&&null==s.instances&&console.warn("ActionLoader returned unexpected instance for action",e.action,s)}}catch(t){console.warn("Failed to handle action payload",e,t)}}var c}},{key:"handleZoneState",value:function(t){var e=this;console.log("Received zone state for ".concat(t.zoneId,":"),t.sprites);var r=this.engine.spritz.world;if(r){var n=r.getZoneById(t.zoneId);n&&t.sprites.forEach((function(t){if(t.clientId!==e.clientId)try{if(t.clientId&&r.remoteAvatars&&r.remoteAvatars.has(t.clientId))r.updateRemoteAvatar(t.clientId,xo({x:t.x,y:t.y,z:t.z||0,facing:t.avatar&&t.avatar.facing||t.facing,animFrame:t.avatar&&t.avatar.animFrame||t.animFrame},t.avatar||{}));else{var o=n.spriteDict[t.id];if(o)o.pos.x=t.x,o.pos.y=t.y,o.pos.z=t.z||0,t.avatar&&(null!=t.avatar.facing&&(o.facing=t.avatar.facing),null!=t.avatar.animFrame&&(o.animFrame=t.avatar.animFrame));else{var i=xo({id:t.id||"player-".concat(t.clientId),x:t.x,y:t.y,z:t.z||0,facing:t.avatar&&t.avatar.facing||t.facing,animFrame:t.avatar&&t.avatar.animFrame||t.animFrame},t.avatar||{});t.clientId&&"function"==typeof r.addRemoteAvatar?r.addRemoteAvatar(t.clientId,i):"function"==typeof r.createAvatar&&r.createAvatar(i)}}}catch(t){console.warn("Error handling zone state sprite update:",t)}}))}}},{key:"setAuthorityFromManifest",value:function(){this.engine&&this.engine.spritz&&this.engine.spritz.manifest&&this.engine.spritz.manifest.network&&(this.authority=this.engine.spritz.manifest.network.authority||"server")}},{key:"handleAvatarUpdate",value:function(t){console.log("Received avatar update for ".concat(t.clientId,":"),t.avatar);var e=this.engine.spritz.world;e&&(e.updateRemoteAvatar(t.clientId,t.avatar)||e.addRemoteAvatar(t.clientId,xo({id:t.avatar.id||"player-".concat(t.clientId)},t.avatar)),this.players.set(t.clientId,t.avatar))}},{key:"setAuthority",value:function(t){this.authority=t}}],n&&To(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();Co(Mo,"_ActionLoader",null);var jo=r(3203),Io=function(t){var e=document.createElement("div");e.style.position="absolute",e.style.top="0",e.style.right="0",e.style.background="rgba(0, 0, 0, 0.6)",e.style.color="#0f0",e.style.padding="4px",e.style.fontFamily="monospace",e.style.fontSize="12px",e.style.zIndex="10000",e.style.pointerEvents="none",e.style.display="none",t.flagDebugDiv=e,document.body.appendChild(e),window.addEventListener("keydown",(function(e){"F4"===e.key&&(t.showFlagDebug=!t.showFlagDebug,t.store.set("Debug::Flag::showDebug",t.showFlagDebug),t.flagDebugDiv.style.display=t.showFlagDebug?"block":"none")}))},Bo=function(t){var e=document.createElement("div");e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.background="rgba(0, 0, 0, 0.6)",e.style.color="#0f0",e.style.padding="4px",e.style.fontFamily="monospace",e.style.fontSize="12px",e.style.zIndex="10000",e.style.pointerEvents="none",e.style.display="none",t.webglDebugDiv=e,document.body.appendChild(e),window.addEventListener("keydown",(function(e){"F3"===e.key&&(t.showWebglDebug=!t.showWebglDebug,t.store.set("Debug::Webgl::showDebug",t.showWebglDebug),t.webglDebugDiv.style.display=t.showWebglDebug?"block":"none")}));try{var r=t.keyboard,o=function(e,r){if("down"===r&&"F5"===e.key){try{e.preventDefault(),e.stopPropagation()}catch(t){}t.showFreeCam=!t.showFreeCam,t.store.set("Debug::FreeCam::show",t.showFreeCam);var n=new CustomEvent("pixos:freecam:toggle");window.dispatchEvent(n)}};r.addHook&&r.addHook(o),t._debugFreeCamHook=o}catch(t){}window.addEventListener("pixos:freecam:toggle",(function(){var e=t.renderManager;if(e&&e.camera){var r=t.canvas||document.body,o=function(t){try{t.preventDefault(),t.stopPropagation()}catch(t){}var r=.5*(t.deltaY>0?1:-1);try{e.camera.zoom&&e.camera.zoom(r),c++}catch(t){}},i=function(t){var r=.002*(t.movementX||0),n=.002*(t.movementY||0);try{var o=1.5*-r,i=1.5*-n;e.camera&&(e.camera.yaw+=o,e.camera.pitch=Math.max(-Math.PI/2+.01,Math.min(Math.PI/2-.01,e.camera.pitch+i)),e.camera.updateViewFromAngles&&e.camera.updateViewFromAngles(),c++)}catch(t){}},a=null,s=null,c=0,u=!0;if(t.showFreeCam){var l;t._freeCamSaved=(0,jo.Ue)();try{console.log("[FreeCam] ENTER - current viewMat:",Array.from(e.camera.uViewMat))}catch(t){}(0,jo.t8)(e.camera.uViewMat,t._freeCamSaved);try{t._freeCamSavedState={position:new n.OW(e.camera.cameraPosition.x,e.camera.cameraPosition.y,e.camera.cameraPosition.z),yaw:e.camera.yaw,pitch:e.camera.pitch,distance:e.camera.cameraDistance,target:e.camera.cameraTarget?new n.OW(e.camera.cameraTarget.x,e.camera.cameraTarget.y,e.camera.cameraTarget.z):null,viewMat:(0,jo.Ue)()},(0,jo.t8)(e.camera.uViewMat,t._freeCamSavedState.viewMat);try{console.log("[FreeCam] ENTER - savedState.viewMat:",Array.from(t._freeCamSavedState.viewMat))}catch(t){}}catch(t){}null!==(l=t.spritz)&&void 0!==l&&l.world&&(t.spritz.world.isPaused=!0),t._freecamActive=!0;var f=document.createElement("div");f.style.position="absolute",f.style.bottom="8px",f.style.left="50%",f.style.transform="translateX(-50%)",f.style.background="rgba(0,0,0,0.6)",f.style.color="#fff",f.style.padding="6px 10px",f.style.fontFamily="monospace",f.style.fontSize="12px",f.style.zIndex="10001",f.id="pixos-freecam-info",f.innerHTML="FREE CAM (F5 to exit) &nbsp; WASD/Arrows: move & strafe &nbsp; Q/E: yaw &nbsp; R/F: pitch &nbsp; Wheel: zoom",document.body.appendChild(f);var h=function(){var n=document.pointerLockElement===r||document.mozPointerLockElement===r;try{var o=document.getElementById("pixos-freecam-status");o&&(o.innerText="Keys: "+JSON.stringify(t.keyboard&&t.keyboard.activeCodes||[])+" | pointerLock: "+(n?"yes":"no"));try{console.log("[FreeCam] pointerLock change - locked:",n,"viewMat:",Array.from(e.camera.uViewMat))}catch(t){}}catch(t){}};document.addEventListener("pointerlockchange",h),document.addEventListener("mozpointerlockchange",h);try{t._bodyOverflowSaved=document.body.style.overflow,document.body.style.overflow="hidden"}catch(t){}try{r.requestPointerLock=r.requestPointerLock||r.mozRequestPointerLock,r.requestPointerLock()}catch(t){}window.addEventListener("wheel",o,{passive:!1,capture:!0}),document.addEventListener("pointermove",i,{capture:!0}),document.addEventListener("mousemove",i,{capture:!0}),a=requestAnimationFrame((function n(){var o=(t.keyboard&&t.keyboard.activeCodes||[]).map((function(t){return(t||"").toString().toLowerCase()}));try{e.camera&&((o.indexOf("w")>=0||o.indexOf("arrowup")>=0)&&(e.camera.translateCam("UP"),c++),(o.indexOf("s")>=0||o.indexOf("arrowdown")>=0)&&(e.camera.translateCam("DOWN"),c++),(o.indexOf("a")>=0||o.indexOf("arrowleft")>=0)&&(e.camera.translateCam("LEFT"),c++),(o.indexOf("d")>=0||o.indexOf("arrowright")>=0)&&(e.camera.translateCam("RIGHT"),c++),o.indexOf("q")>=0&&(e.camera.yaw-=.03,e.camera.updateViewFromAngles(),c++),o.indexOf("e")>=0&&(e.camera.yaw+=.03,e.camera.updateViewFromAngles(),c++),o.indexOf("r")>=0&&(e.camera.pitch=Math.max(-Math.PI/2+.01,e.camera.pitch-.03),e.camera.updateViewFromAngles(),c++),o.indexOf("f")>=0&&(e.camera.pitch=Math.min(Math.PI/2-.01,e.camera.pitch+.03),e.camera.updateViewFromAngles(),c++))}catch(t){}a=requestAnimationFrame(n),s||((s=document.createElement("div")).id="pixos-freecam-status",s.style.position="absolute",s.style.top="8px",s.style.left="50%",s.style.transform="translateX(-50%)",s.style.background="rgba(0,0,0,0.6)",s.style.color="#fff",s.style.padding="6px 10px",s.style.fontFamily="monospace",s.style.fontSize="12px",s.style.zIndex="10002",document.body.appendChild(s));try{var i=e.camera||{};if(u){try{console.log("[FreeCam] FIRST TICK viewMat:",Array.from(e.camera.uViewMat))}catch(t){}u=!1}var l=i.cameraPosition?[i.cameraPosition.x,i.cameraPosition.y,i.cameraPosition.z]:["n/a"],f=void 0!==i.yaw?i.yaw.toFixed(3):"n/a",h=void 0!==i.pitch?i.pitch.toFixed(3):"n/a",d=e.camera&&e.camera.uViewMat?Array.from(e.camera.uViewMat).slice(0,8).map((function(t){return t.toFixed(3)})):[];s.innerText="Keys: "+JSON.stringify(o)+"\npointerLock: "+(document.pointerLockElement===r?"yes":"no")+"\npos: "+JSON.stringify(l)+" yaw:"+f+" pitch:"+h+"\nuViewMat (trim): "+JSON.stringify(d)+"\nmoves: "+c}catch(t){}})),t._freecamHandlers={onWheel:o,onPointerMove:i,rafId:a,captureClick:function(t){t&&t.preventDefault();try{r&&r.parentElement&&r.parentElement.focus&&r.parentElement.focus()}catch(t){}try{r.requestPointerLock=r.requestPointerLock||r.mozRequestPointerLock,r.requestPointerLock()}catch(t){}},onPointerLockChange:h}}else{var d;if(t._freeCamSavedState){try{try{console.log("[FreeCam] EXIT - restoring savedState.viewMat:",Array.from(t._freeCamSavedState.viewMat))}catch(t){}(0,jo.t8)(t._freeCamSavedState.viewMat,e.camera.uViewMat);try{e.camera&&(void 0!==t._freeCamSavedState.yaw&&(e.camera.yaw=t._freeCamSavedState.yaw),void 0!==t._freeCamSavedState.pitch&&(e.camera.pitch=t._freeCamSavedState.pitch),void 0!==t._freeCamSavedState.distance&&(e.camera.cameraDistance=t._freeCamSavedState.distance),t._freeCamSavedState.target&&(e.camera.cameraTarget=t._freeCamSavedState.target),e.camera.updateViewFromAngles&&e.camera.updateViewFromAngles())}catch(t){}}catch(t){}t._freeCamSavedState=null}else if(t._freeCamSaved)try{try{console.log("[FreeCam] EXIT - restoring _freeCamSaved:",Array.from(t._freeCamSaved))}catch(t){}(0,jo.t8)(t._freeCamSaved,e.camera.uViewMat);try{e.camera.setFromViewMatrix(e.camera.uViewMat)}catch(t){}}catch(t){}null!==(d=t.spritz)&&void 0!==d&&d.world&&(t.spritz.world.isPaused=!1),t._freecamActive=!1;var p=document.getElementById("pixos-freecam-info");p&&document.body.removeChild(p);try{document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock,document.exitPointerLock()}catch(t){}if(t._freecamHandlers){window.removeEventListener("wheel",t._freecamHandlers.onWheel,{capture:!0}),document.removeEventListener("pointermove",t._freecamHandlers.onPointerMove,{capture:!0}),document.removeEventListener("mousemove",t._freecamHandlers.onPointerMove,{capture:!0});try{t._freecamHandlers.onPointerLockChange&&(document.removeEventListener("pointerlockchange",t._freecamHandlers.onPointerLockChange),document.removeEventListener("mozpointerlockchange",t._freecamHandlers.onPointerLockChange))}catch(t){}cancelAnimationFrame(t._freecamHandlers.rafId),t._freecamHandlers=null}try{var y;document.body.style.overflow=null!==(y=t._bodyOverflowSaved)&&void 0!==y?y:""}catch(t){}try{var g=document.getElementById("pixos-freecam-status");g&&document.body.removeChild(g)}catch(t){}}}}))};function zo(t){return zo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zo(t)}function Do(){Do=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==zo(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function No(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function Ro(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var Fo=function(){function t(e,r,n,i,a,s,c){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.canvas=e,this.hudCanvas=r,this.gamepadCanvas=i,this.mipmap=n,this.fileUpload=a,this.width=s,this.height=c,this.utils=o,this.networkManager=new Mo(this),this.resourceManager=new Vn(this),this.renderManager=new kn.Z(this),this.hud=new _n.ZP(this),this.inputManager=new bo(this),this.voice=new SpeechSynthesisUtterance,this.database=new yn,this.store=new xn,this.cutsceneManager=new Kn(this),this.modeManager=new Hn.Z(this),this.debug=!1,this.debugHeightOverlay=!1,this.running=!1,this.gl=null,this.ctx=null,this.gp=null,this.frameCount=0,this.spritz=null,this.fullscreen=!1,this.time=0,this.requestId=null,this.screenSize=this.screenSize.bind(this),this.render=this.render.bind(this),this.init=this.init.bind(this),this.close=this.close.bind(this)}var e,r,n,i;return e=t,r=[{key:"init",value:(n=Do().mark((function t(e){var r,n,o,i,a;return Do().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=this.hudCanvas.getContext("2d"),i=this.canvas.getContext("webgl2",{antialias:!0,depth:!0,preserveDrawingBuffer:!1}),a=this.gamepadCanvas.getContext("2d"),i){t.next=5;break}throw new Error("WebGL: unable to initialize");case 5:if(o){t.next=7;break}throw new Error("Canvas: unable to initialize HUD");case 7:if(a){t.next=9;break}throw new Error("Gamepad: unable to initialize Mobile Canvas");case 9:if(o.canvas.width=i.canvas.clientWidth,o.canvas.height=i.canvas.clientHeight,this.gl=i,this.ctx=o,this.gp=a,this.frameCount=0,this.spritz=e,this.fullscreen=!1,this.time=(new Date).getTime(),this.inputManager.init(),this.hud.init(),this.renderManager.init(),this.gamepad=this.inputManager.gamepad,this.keyboard=this.inputManager.keyboard,this.mouse=this.inputManager.mouse,this.touch=this.inputManager.touch,this.touchHandler=this.gamepad.listen.bind(this.gamepad),null===(r=e.manifest)||void 0===r||null===(n=r.network)||void 0===n||!n.enabled){t.next=30;break}return t.next=29,this.networkManager.connect(e.manifest.network.url);case 29:e.manifest.network.authority&&this.networkManager.setAuthority(e.manifest.network.authority);case 30:return t.next=32,e.init(this);case 32:Bo(this),Io(this);case 34:case"end":return t.stop()}}),t,this)})),i=function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){No(i,r,o,a,s,"next",t)}function s(t){No(i,r,o,a,s,"throw",t)}a(void 0)}))},function(t){return i.apply(this,arguments)})},{key:"render",value:function(){this.frameCount++,this.renderManager&&this.renderManager.resetDebugCounters&&this.renderManager.resetDebugCounters(),this.hud.clearHud(),this.hud.drawModeLabel&&this.hud.drawModeLabel(),this.renderManager.clearScreen();var t=(new Date).getTime();this.inputManager.update(),this.modeManager.hasPicker()&&(this.renderManager.activatePickerShaderProgram(!1),this.spritz.render(this,t),this.getSelectedObject("sprite|object|tile",!1)),this.inputManager.handleInput(t)||this.spritz.update(t);var e=this.modeManager.getMode();e&&this.inputManager.getMode()!==e&&this.inputManager.setMode(e);var r=this.renderManager.engine.gl;if(this.renderManager.clearScreen(),r.depthMask(!1),this.renderManager.renderSkybox(),r.depthMask(!0),this.renderManager.activateShaderProgram(),this.modeManager.update(t),this.renderManager&&this.renderManager.updateParticles)try{this.renderManager.updateParticles(t)}catch(t){console.warn("updateParticles failed",t)}if(this.spritz.render(this),this.cutsceneManager.update(),this.renderManager.updateTransition(),this.renderManager&&this.renderManager.renderParticles)try{this.renderManager.renderParticles()}catch(t){console.warn("renderParticles failed",t)}if(this.gamepad.render(),this.debugHeightOverlay&&this.hud.drawHeightDebugOverlay)try{this.hud.drawHeightDebugOverlay()}catch(t){console.warn("drawHeightDebugOverlay failed",t)}!function(t){(function(t){if(t.showWebglDebug&&t.webglDebugDiv){var e="undefined"!=typeof performance?performance.now():Date.now(),r=e-t.lastDebugTime,n=r>0?(1e3/r).toFixed(1):"0";t.lastDebugTime=e;var o=t.gl,i="",a="",s="";if(o)try{i=o.getParameter(o.RENDERER),a=o.getParameter(o.VENDOR),s=o.getParameter(o.VERSION)}catch(t){}var c=t.renderManager.debug||{};t.webglDebugDiv.innerHTML="FPS: "+n+"<br>Tiles Drawn: "+(c.tilesDrawn||0)+"<br>Sprites Drawn: "+(c.spritesDrawn||0)+"<br>Objects Drawn: "+(c.objectsDrawn||0)+"<br>Renderer: "+i+"<br>Vendor: "+a+"<br>GL Version: "+s}})(t),function(t){if(t.showFlagDebug&&t.flagDebugDiv){t.store.set("Debug::Flag::UpdateTime",Date.now());var e=t.store.all();console.log({self:t,keys:JSON.stringify(e),store:t.store.keys()});var r=Object.keys(e).map((function(t){return t+": "+JSON.stringify(e[t])+"<br>"}));t.flagDebugDiv.innerHTML="FLAGS:<br>"+r.join("")}}(t)}(this),this.requestId=requestAnimationFrame(this.render)}},{key:"close",value:function(){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=null)}},{key:"getSelectedObject",value:function(){var t,e,r,n,o,i,a=this,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"sprite|object|tile",c=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._freecamActive)return null;if((null===(t=this.spritz.world)||void 0===t||null===(e=t.spriteList)||void 0===e?void 0:e.length)<=0&&(null===(r=this.spritz.world)||void 0===r||null===(n=r.objectList)||void 0===n?void 0:n.length)<=0&&(null===(o=this.spritz.world)||void 0===o||null===(i=o.zoneList)||void 0===i?void 0:i.length)<=0)return null;var u=this.gl,l=new Uint8Array(4),f=this.gamepad.x||0,h=this.gamepad.y||0,d=c?0:f*u.canvas.width/u.canvas.clientWidth,p=c?0:u.canvas.height-h*u.canvas.height/u.canvas.clientHeight-1;u.readPixels(d,p,1,1,u.RGBA,u.UNSIGNED_BYTE,l);var y=l[0]+(l[1]<<8)+(l[2]<<16);return this.inputManager.isActionPressed("select")?(s.split("|").forEach((function(t){switch(t){case"sprite":a.spritz.world.spriteList=a.spritz.world.spriteList.map((function(t){return t.objId===y?(t.isSelected=!0,a.spritz.world.spriteDict[t.id]&&(a.spritz.world.spriteDict[t.id].isSelected=!0,a.modeManager.handleSelect(t.zone,t,null,"sprite")||"function"==typeof a.spritz.world.spriteDict[t.id].onSelect&&a.spritz.world.spriteDict[t.id].onSelect(t.zone,t))):t.isSelected=!1,t}));break;case"object":a.spritz.world.objectList=a.spritz.world.objectList.map((function(t){return t.objId===y?(t.isSelected=!0,a.spritz.world.objectDict[t.id]&&(a.spritz.world.objectDict[t.id].isSelected=!0,a.modeManager.handleSelect(t.zone,t,null,"object")||"function"==typeof a.spritz.world.objectDict[t.id].onSelect&&a.spritz.world.objectDict[t.id].onSelect(t.zone,t))):t.isSelected=!1,t}));break;case"tile":var e=l[0],r=l[1],n=l[2];a.spritz.world.zoneList.forEach((function(t){t.objId===e&&(a.modeManager.handleSelect(t,r,n,"tile")||"function"==typeof t.onSelect&&t.onSelect(r,n))})),0!==y&&console.log("TILE SELECTION:",{zoneObjId:e,row:r,cell:n,zones:a.spritz.world.zoneList})}})),y):y}},{key:"setGreeting",value:function(t){this.globalStore?this.globalStore.greeting=t:console.warn("globalStore is not available to set greeting.")}},{key:"speechSynthesis",value:function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s=this.voice,c=null!==(e=window.speechSynthesis.getVoices())&&void 0!==e?e:[];s.voice=r||c[0],o&&(s.rate=o),i&&(s.volume=i),a&&(s.pitch=a),s.text=t,s.lang=n,window.speechSynthesis.speak(s)}},{key:"screenSize",value:function(){return{width:this.canvas.clientWidth,height:this.canvas.clientHeight}}}],r&&Ro(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}()},1248:(t,e,r)=>{"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(){a=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};u(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==s(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(b,"constructor",y),u(y,"constructor",p),p.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,c,"Generator"),u(b,o,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function c(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){c(i,n,o,a,s,"next",t)}function s(t){c(i,n,o,a,s,"throw",t)}a(void 0)}))}}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}r.d(e,{Z:()=>f});var f=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.engine=e,this.currentMode=null,this.registered=Object.create(null)}var e,r,n;return e=t,r=[{key:"register",value:function(t,e){var r=this;if(this.registered[t]=e,this.currentMode&&this.currentMode.name===t){var n=this.currentMode.params||{};u(a().mark((function e(){var o,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,o=r.registered[t],r.currentMode.handlers=o,!o||!o.setup){e.next=8;break}return e.next=6,o.setup(n);case 6:(i=e.sent)&&"object"===s(i)&&(Object.assign(o,i),r.registered[t]=o,r.currentMode.handlers=o);case 8:e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),console.warn('Mode late-register setup failed for mode "'.concat(t,'":'),e.t0);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})))()}}},{key:"set",value:function(t){var e=this;this.registered[t]?(this.currentMode&&this.currentMode.handlers.teardown&&u(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.currentMode.handlers.teardown(e.currentMode.params);case 3:t.next=8;break;case 5:t.prev=5,t.t0=t.catch(0),console.warn('Mode teardown failed for mode "'.concat(e.currentMode.name,'":'),t.t0);case 8:case"end":return t.stop()}}),t,null,[[0,5]])})))(),this.currentMode={name:t,handlers:this.registered[t],params:{}},this.currentMode.handlers.setup&&u(a().mark((function r(){var n;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e.currentMode.handlers.setup(e.currentMode.params);case 3:(n=r.sent)&&(e.currentMode.handlers=o(o({},e.currentMode.handlers),n)),r.next=10;break;case 7:r.prev=7,r.t0=r.catch(0),console.warn('Mode setup failed for mode "'.concat(t,'":'),r.t0);case 10:case"end":return r.stop()}}),r,null,[[0,7]])})))()):console.warn('Mode "'.concat(t,'" not registered'))}},{key:"update",value:(n=u(a().mark((function t(e){var r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.currentMode){t.next=2;break}return t.abrupt("return");case 2:if(!(r=this.currentMode.handlers)||!r.update){t.next=12;break}return t.prev=4,t.next=7,r.update(e,this.currentMode.params);case 7:t.next=12;break;case 9:t.prev=9,t.t0=t.catch(4),console.warn('Mode update failed for mode "'.concat(this.currentMode.name,'":'),t.t0);case 12:case"end":return t.stop()}}),t,this,[[4,9]])}))),function(t){return n.apply(this,arguments)})},{key:"handleInput",value:function(t){if(!this.currentMode)return!1;var e=this.currentMode.handlers;try{if(e&&e.checkInput)return!!e.checkInput(t,this.currentMode.params)}catch(t){console.warn('Mode input handler failed for mode "'.concat(this.currentMode.name,'":'),t)}return!1}},{key:"handleSelect",value:function(t,e,r,n){if(!this.currentMode)return!1;var o=this.currentMode.handlers;try{if(o&&o.onSelect)return!!o.onSelect(t,e,r,n,this.currentMode.params)}catch(t){console.warn('Mode onSelect handler failed for mode "'.concat(this.currentMode.name,'":'),t)}return!1}},{key:"getMode",value:function(){var t;return(null===(t=this.currentMode)||void 0===t?void 0:t.name)||null}},{key:"hasPicker",value:function(){var t,e;return!0===(null===(t=this.currentMode)||void 0===t||null===(e=t.handlers)||void 0===e?void 0:e.picker)}}],r&&l(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}()},7974:(t,e,r)=>{"use strict";function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}r.d(e,{Z:()=>o});var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actions=[]}var e,r;return e=t,r=[{key:"add",value:function(t){this.actions.push(t)}},{key:"run",value:function(){var t=arguments;this.actions=this.actions.filter((function(e){return e(t)}))}}],r&&n(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}()},5849:(t,e,r)=>{"use strict";function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}r.d(e,{Z:()=>o});var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,r;return e=t,(r=[{key:"runWhenLoaded",value:function(t){this.loaded?t():this.onLoadActions.add(t)}},{key:"update",value:function(t){Object.assign(this,t)}}])&&n(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}()},4013:(t,e,r)=>{"use strict";r.d(e,{Z:()=>y});var n=r(3203),o=r(9010),i=r(4395);function a(t,e,r){return a=s()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&c(o,r.prototype),o},a.apply(null,arguments)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function c(t,e){return c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},c(t,e)}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function f(t,e,r){return e&&l(t.prototype,e),r&&l(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r(9327);var p=f((function t(e){var r=this;h(this,t),d(this,"setTarget",(function(t){r.cameraTarget=t,r.updateViewFromAngles()})),d(this,"setCamera",(function(){(0,n.t8)((0,n.Ue)(),r.uViewMat),(0,n.Iu)(r.uViewMat,r.uViewMat,[0,0,-15]),(0,n.U1)(r.uViewMat,r.uViewMat,(0,o.Id)(r.cameraAngle*r.cameraVector.x),[1,0,0]),(0,n.U1)(r.uViewMat,r.uViewMat,(0,o.Id)(r.cameraAngle*r.cameraVector.y),[0,1,0]),(0,n.U1)(r.uViewMat,r.uViewMat,(0,o.Id)(r.cameraAngle*r.cameraVector.z),[0,0,1]),(0,o.tk)(r.cameraPosition,r.cameraOffset),(0,n.Iu)(r.uViewMat,r.uViewMat,r.cameraOffset.toArray()),r.cameraDir=i.Nm.adjustCameraDirection(r.cameraVector)})),d(this,"changeAngle",(function(t){r.lookAt(r.cameraPosition.toArray(),r.cameraOffset.toArray(),t)})),d(this,"lookAt",(function(t,e,i){var s=(0,n.Fv)((0,n.fk)(t,e));Number.isFinite(s[0])&&Number.isFinite(s[1])&&Number.isFinite(s[2])||(s=[0,0,1]);var c,l=a(o.OW,function(t){if(Array.isArray(t))return u(t)}(c=s)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(c)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(c)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());0===l.length()&&(l=new o.OW(0,0,1));var f=i.cross(l).normal();0===f.length()&&(f=new o.OW(1,0,0));var h=l.cross(f).normal(),d=[f.x,f.y,f.z,0,h.x,h.y,h.z,0,l.x,l.y,l.z,0,t.x,t.y,t.z,1];r.uViewMat=(0,n.t8)(d,r.uViewMat)})),d(this,"setFromViewMatrix",(function(t){if(t)try{r.cameraPosition=new o.OW(t[12],t[13],t[14]);var e=t[8],n=t[9],i=t[10],a=-e,s=-n,c=-i;r.yaw=Math.atan2(s,a),r.pitch=Math.asin(c/Math.max(1e-6,Math.hypot(a,s,c)));var u=Math.hypot(a,s,c),l=new o.OW(a/(u||1),s/(u||1),c/(u||1));r.cameraDistance=r.cameraDistance||15,r.cameraTarget=r.cameraPosition.add(l.mul(-1*r.cameraDistance))}catch(t){}})),d(this,"updateViewFromAngles",(function(){Number.isFinite(r.yaw)||(r.yaw=0),Number.isFinite(r.pitch)||(r.pitch=0),(!Number.isFinite(r.cameraDistance)||r.cameraDistance<=0)&&(r.cameraDistance=Math.max(.1,Math.abs(r.cameraDistance)||15));var t=r.cameraTarget.x+r.cameraDistance*Math.cos(r.pitch)*Math.cos(r.yaw),e=r.cameraTarget.y+r.cameraDistance*Math.cos(r.pitch)*Math.sin(r.yaw),n=r.cameraTarget.z+r.cameraDistance*Math.sin(r.pitch),i=new o.OW(t,e,n);r.cameraPosition=new o.OW(i.x,i.y,i.z);var a=new o.OW(r.cameraTarget.x,r.cameraTarget.y,r.cameraTarget.z),s=new o.OW(0,0,1);r.lookAt(i,a,s);var c=180*r.yaw/Math.PI%360;c<0&&(c+=360);var u=(90-c+360)%360,l=Math.round(u/45)%8;r.cameraDir=["N","NE","E","SE","S","SW","W","NW"][l],r.cameraVector.z=l})),d(this,"translateCam",(function(t){var e=new o.OW(Math.cos(r.pitch)*Math.cos(r.yaw),Math.cos(r.pitch)*Math.sin(r.yaw),Math.sin(r.pitch)).normal(),n=new o.OW(-Math.sin(r.yaw),Math.cos(r.yaw),0).normal();switch(t){case"UP":r.cameraTarget=r.cameraTarget.add(e.mul(.5));break;case"DOWN":r.cameraTarget=r.cameraTarget.add(e.mul(-.5));break;case"LEFT":r.cameraTarget=r.cameraTarget.add(n.mul(-.5));break;case"RIGHT":r.cameraTarget=r.cameraTarget.add(n.mul(.5))}r.updateViewFromAngles()})),d(this,"rotateCam",(function(t){var e=.05;switch(t){case"LEFT":r.yaw-=e;break;case"RIGHT":r.yaw+=e;break;case"UP":r.pitch=Math.max(-Math.PI/2+.01,r.pitch-e);break;case"DOWN":r.pitch=Math.min(Math.PI/2-.01,r.pitch+e)}r.updateViewFromAngles()})),d(this,"zoom",(function(t){r.cameraDistance=Math.max(.1,r.cameraDistance+t),r.updateViewFromAngles()})),d(this,"panCW",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.PI/4;r.yaw-=t,r.updateViewFromAngles()})),d(this,"panCCW",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.PI/4;r.yaw+=t,r.updateViewFromAngles()})),d(this,"pitchCW",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.PI/4;r.pitch-=t,r.updateViewFromAngles()})),d(this,"pitchCCW",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.PI/4;r.pitch+=t,r.updateViewFromAngles()})),d(this,"tiltCW",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.PI/4;r.pitch-=.1*t,r.updateViewFromAngles()})),d(this,"tiltCCW",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.PI/4;r.pitch+=.1*t,r.updateViewFromAngles()})),Number.prototype.clamp=function(t,e){return this<t?t:this>e?e:this},this.renderingManager=e,this.uViewMat=(0,n.Ue)(),this.fov=45,this.thetaLimits=a(o.OW,[1.5*Math.PI,1.8*Math.PI,0]),this.cameraAngle=45,this.cameraVector=a(o.OW,[1,0,0]),this.cameraDir="N",this.cameraPosition=new o.OW(8,8,-1),this.yaw=0,this.pitch=0,this.cameraDistance=15,this.cameraTarget=new o.OW(8,8,-1),this.cameraOffset=new o.OW(0,0,0)})),y=f((function t(e){return h(this,t),t.instance||(this.camera=new p(e),t.instance=this),t.instance}))},9327:(t,e,r)=>{"use strict";r.d(e,{Z:()=>T});var n=r(3203),o=r(9010),i=r(6345),a=r(4013);function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function c(t,e,r){return e&&s(t.prototype,e),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r(9124);var f=c((function t(e){var r=this;return u(this,t),l(this,"addLight",(function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[.8,.8,.8],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[1,1,1],a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[1,1,1],c=!(arguments.length>7&&void 0!==arguments[7])||arguments[7],u=r.renderManager.shaderProgram,l=r.lights.length;if(!(l>=u.maxLights)){var f=new h(r.renderManager.engine,t,n,e,o,i,a,s,c);return r.lights[t]=f,t}})),l(this,"updateLight",(function(t,e,n,o,i,a,s,c){var u=r.lights[t];u&&(e&&(u.pos=e),n&&(u.color=n),o&&(u.attenuation=o),i&&(u.direction=i),a&&(u.density=a),s&&(u.scatteringCoefficients=s),c&&(u.enabled=c),r.lights[t]=u)})),l(this,"removeLight",(function(t){delete r.lights[t]})),l(this,"tick",(function(){for(var t=Object.keys(r.lights),e=0;e<t.length;e++)r.lights[t[e]].tick()})),l(this,"render",(function(){var t=r.renderManager.shaderProgram,e=t.uLights;if(e)for(var n=0;n<t.maxLights;n++){var o=Object.keys(r.lights);r.lights[o[n]]&&r.lights[o[n]].enabled&&r.lights[o[n]].draw(e[n])}})),l(this,"setMatrixUniforms",(function(){r.tick(),r.render()})),t.instance||(this.lights={},this.renderManager=e,this.engine=e.engine,t.instance=this),t.instance})),h=c((function t(e,r,n,o,i,a,s,c,f){var h=this;u(this,t),l(this,"tick",(function(){h.frame++})),l(this,"draw",(function(t){var e=h.engine.gl;e.uniform1f(t.enabled,h.enabled),e.uniform3fv(t.position,h.pos),e.uniform3fv(t.color,h.color),e.uniform3fv(t.attenuation,h.attenuation),e.uniform3fv(t.direction,h.direction),e.uniform3fv(t.scatteringCoefficients,h.scatteringCoefficients),e.uniform1f(t.density,h.density)})),this.engine=e,this.id=null!=r?r:"light",this.color=null!=n?n:[1,1,1],this.pos=null!=o?o:[0,0,0],this.attenuation=null!=i?i:[.5,.1,0],this.density=null!=s?s:.8,this.scatteringCoefficients=null!=c?c:[.5,.5,.5],this.direction=null!=a?a:[1,1,1],this.enabled=null==f||f,this.frame=0}));function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function p(){p=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function y(){}var g={};s(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=f.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==d(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return h.prototype=y,s(b,"constructor",y),s(y,"constructor",h),h.displayName=s(y,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,a,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,a,"Generator"),s(b,o,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function y(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function g(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){y(i,n,o,a,s,"next",t)}function s(t){y(i,n,o,a,s,"throw",t)}a(void 0)}))}}function m(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function v(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var b=function(){function t(e){var r=this;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),v(this,"loadShader",(function(t,e){var n=r.engine.gl,o=n.createShader(t);if(n.shaderSource(o,e),n.compileShader(o),!n.getShaderParameter(o,n.COMPILE_STATUS)){var i=n.getShaderInfoLog(o);throw n.deleteShader(o),new Error("An error occurred compiling the shaders: ".concat(i))}return o})),v(this,"initTextureShaderProgram",(function(t){var e=t.vs,n=t.fs,o=r.engine.gl,i=r,a=r.loadShader(o.VERTEX_SHADER,e),s=r.loadShader(o.FRAGMENT_SHADER,n),c=o.createProgram();if(o.attachShader(c,a),o.attachShader(c,s),o.linkProgram(c),!o.getProgramParameter(c,o.LINK_STATUS))throw new Error("WebGL unable to initialize the shader program: ".concat(c));return c.aVertexPosition=o.getAttribLocation(c,"aVertexPosition"),o.enableVertexAttribArray(c.aVertexPosition),c.uSkyboxTexture=o.getUniformLocation(c,"uSkyboxTexture"),c.uSkyboxCenter=o.getUniformLocation(c,"uSkyboxCenter"),c.uProjectionMatrix=o.getUniformLocation(c,"uProjectionMatrix"),c.uModelMatrix=o.getUniformLocation(c,"uModelMatrix"),c.uViewMatrix=o.getUniformLocation(c,"uViewMatrix"),c.setMatrixUniforms=function(){var t=i.uModelMat,e=i.camera.uViewMat,r=i.uProjMat;o.uniformMatrix4fv(this.uProjectionMatrix,!1,r),o.uniformMatrix4fv(this.uModelMatrix,!1,t),o.uniformMatrix4fv(this.uViewMatrix,!1,e)},r.shaderProgram=c,c})),t.instance||(this.renderManager=e,this.engine=e.engine,t.instance=this),t.instance}var e,n,o,i;return e=t,n=[{key:"setSkyboxShader",value:(i=g(p().mark((function t(e){var n,o;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.engine.gl){t.next=2;break}return t.abrupt("return");case 2:return this.gl=this.engine.gl,t.next=5,r(4970)("./".concat(e,"/vs.js"));case 5:return n=t.sent.default(),t.next=8,r(746)("./".concat(e,"/fs.js"));case 8:o=t.sent.default(),this.shaderProgram=this.initSkyboxShaderProgram(n,o);case 10:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"init",value:(o=g(p().mark((function t(){var e,n,o,i,a,s=arguments;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=s.length>0&&void 0!==s[0]?s[0]:null,n=s.length>1&&void 0!==s[1]?s[1]:"cosmic",o=s.length>2&&void 0!==s[2]?s[2]:[0,0,0],this.engine.gl){t.next=5;break}return t.abrupt("return");case 5:if(this.gl=this.engine.gl,!e){t.next=13;break}return t.next=9,this.engine.resourceManager.loadTextureFromZip(e,this.engine.spritz.zip);case 9:this.texture=t.sent,this.texture.runWhenLoaded(this.createTextureSkyboxProgram),t.next=20;break;case 13:return t.next=15,r(4970)("./"+n+"/vs.js");case 15:return i=t.sent.default(),t.next=18,r(746)("./"+n+"/fs.js");case 18:a=t.sent.default(),this.shaderProgram=this.initSkyboxShaderProgram(i,a);case 20:this.cubeMap=this.createDefaultCubeMap(),this.skyboxCenter=o,this.buffer=this.createSkyboxBuffer(),this.initialized=!0;case 24:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"createDefaultCubeMap",value:function(){var t=this.gl,e=t.createTexture();return t.bindTexture(t.TEXTURE_CUBE_MAP,e),[{target:t.TEXTURE_CUBE_MAP_POSITIVE_X,color:[255,0,0,255]},{target:t.TEXTURE_CUBE_MAP_NEGATIVE_X,color:[0,255,0,255]},{target:t.TEXTURE_CUBE_MAP_POSITIVE_Y,color:[0,0,255,255]},{target:t.TEXTURE_CUBE_MAP_NEGATIVE_Y,color:[255,255,0,255]},{target:t.TEXTURE_CUBE_MAP_POSITIVE_Z,color:[0,255,255,255]},{target:t.TEXTURE_CUBE_MAP_NEGATIVE_Z,color:[255,0,255,255]}].forEach((function(e){var r=e.target,n=e.color,o=new Uint8Array(n);t.texImage2D(r,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,o)})),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}},{key:"createSkyboxBuffer",value:function(){this.vertices=[-1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,1],this.numVertices=this.vertices.length/3;var t=this.gl.createBuffer();return this.gl.bindBuffer(this.gl.ARRAY_BUFFER,t),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(this.vertices),this.gl.STATIC_DRAW),t}},{key:"initSkyboxShaderProgram",value:function(t,e){var r=this.engine.gl,n=this.loadShader(r.VERTEX_SHADER,t),o=this.loadShader(r.FRAGMENT_SHADER,e),i=r.createProgram();if(r.attachShader(i,n),r.attachShader(i,o),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS))throw new Error("WebGL unable to initialize the skybox shader program");return i.aPosition=r.getAttribLocation(i,"aPosition"),r.enableVertexAttribArray(i.aPosition),i.pMatrixUniform=r.getUniformLocation(i,"uProjectionMatrix"),i.uSkybox=r.getUniformLocation(i,"uSkybox"),i.uViewDirectionProjectionInverse=r.getUniformLocation(i,"uViewDirectionProjectionInverse"),i.uTime=r.getUniformLocation(i,"uTime"),i.uResolution=r.getUniformLocation(i,"uResolution"),i}},{key:"renderSkybox",value:function(t){if(this.initialized&&this.shaderProgram){var e=this.engine.gl;e.useProgram(this.shaderProgram),e.bindBuffer(e.ARRAY_BUFFER,this.buffer),e.enableVertexAttribArray(this.shaderProgram.aPosition),e.vertexAttribPointer(this.shaderProgram.aPosition,3,e.FLOAT,!1,0,0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,this.cubeMap),e.uniform1i(this.shaderProgram.uSkybox,0),e.uniformMatrix4fv(this.shaderProgram.uViewDirectionProjectionInverse,!1,t);var r=.001*Date.now();if(-1!==this.shaderProgram.uTime&&null!==this.shaderProgram.uTime&&e.uniform1f(this.shaderProgram.uTime,r),void 0!==this.shaderProgram.uResolution){var n=e.drawingBufferWidth||this.engine.canvas.width||800,o=e.drawingBufferHeight||this.engine.canvas.height||600;e.uniform2f(this.shaderProgram.uResolution,n,o)}e.drawArrays(e.TRIANGLE_STRIP,0,this.numVertices),e.bindBuffer(e.ARRAY_BUFFER,null),e.useProgram(null)}}},{key:"createTextureSkyboxProgram",value:function(){return this.initShaderProgram({vs:"#version 300 es\n in vec3 aVertexPosition;\n uniform mat4 uProjectionMatrix;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n void main() {\n gl_Position = uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(aVertexPosition, 1.0);\n }\n ",fs:"#version 300 es\n precision highp float;\n uniform sampler2D uSkyboxTexture;\n uniform vec3 uSkyboxCenter;\n out vec4 outColor;\n void main() {\n vec3 direction = normalize(gl_FragCoord.xyz - uSkyboxCenter);\n vec4 skyboxColor = texture(uSkyboxTexture, direction.xy);\n float dotProduct = dot(direction, skyboxColor.rgb);\n if (dotProduct < 0.01) {\n discard;\n } else {\n outColor = vec4(dotProduct, dotProduct, dotProduct, 1.0);\n }\n }\n "})}}],n&&m(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function x(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _(t,e,r){return e&&x(t.prototype,e),r&&x(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function k(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var E=_((function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),k(this,"init",(function(){var t=r.engine.gl;t&&(r.vertexPosBuf=r.renderManager.createBuffer([-.5,-.5,0,-.5,.5,0,.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0],t.STATIC_DRAW,3),r.vertexTexBuf=r.renderManager.createBuffer([0,0,0,1,1,1,0,0,1,1,1,0],t.STATIC_DRAW,2),r.initialized=!0)})),k(this,"emit",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Array.isArray(t)?t:t.toArray?t.toArray():[0,0,0],o=n[0],i=n[1],a=n[2]||0,s=r.engine.spritz.world.zoneContaining(o,i),c=a;s&&(c+=s.getHeight(o,i)),n=[o,i,c];for(var u=Object.assign({count:8,life:1e3,speed:.02,spread:.5,size:.5,color:[1,.7,.2],gravity:[0,-98e-5,0],drag:.995},e),l=0;l<u.count;l++){var f=(2*Math.random()-1)*u.spread,h=(2*Math.random()-1)*u.spread,d=(2*Math.random()-1)*u.spread,p=f*u.speed*(.5+1.5*Math.random()),y=h*u.speed*(.5+1.5*Math.random()),g=d*u.speed*(.5+1.5*Math.random()),m={pos:[n[0],n[1],n[2]],vel:[p,y,g],life:u.life,age:0,size:u.size*(.8+.8*Math.random()),color:u.color,gravity:u.gravity,drag:u.drag};r.particles.push(m)}})),k(this,"preset",(function(t){switch((t||"").toLowerCase()){case"sparks":return{count:12,life:700,speed:.06,spread:1.2,size:.15,color:[1,.8,.2],gravity:[0,-.002,0]};case"flame":return{count:200,life:2e3,speed:.02,spread:.8,size:.06,color:[1,.5,.1],gravity:[0,-3e-4,0],drag:.995};case"water":return{count:20,life:800,speed:.05,spread:1.5,size:.12,color:[.6,.7,1],gravity:[0,-.003,0],drag:.996};case"weapon":return{count:6,life:600,speed:.08,spread:.3,size:.18,color:[1,1,.6],gravity:[0,-.001,0]};default:return null}})),k(this,"update",(function(t){r.lastUpdateTime||(r.lastUpdateTime=t);var e=t-r.lastUpdateTime;if(r.lastUpdateTime=t,e)for(var n=r.particles.length-1;n>=0;n--){var o=r.particles[n];o.vel[0]+=(o.gravity[0]||0)*e,o.vel[1]+=(o.gravity[1]||0)*e,o.vel[2]+=(o.gravity[2]||0)*e,o.vel[0]*=Math.pow(o.drag||1,e/16.6667),o.vel[1]*=Math.pow(o.drag||1,e/16.6667),o.vel[2]*=Math.pow(o.drag||1,e/16.6667),o.pos[0]+=o.vel[0]*e,o.pos[1]+=o.vel[1]*e,o.pos[2]+=o.vel[2]*e,o.age+=e,o.age>=o.life&&r.particles.splice(n,1)}})),k(this,"render",(function(){if(r.initialized||r.init(),r.initialized&&r.particles.length){var t=r.renderManager,e=r.engine.gl,i=t.particleShaderProgram;if(i){e.useProgram(i),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.enableVertexAttribArray(i.aVertexPosition),e.enableVertexAttribArray(i.aTextureCoord);var a,s=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return w(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(r.particles);try{for(s.s();!(a=s.n()).done;){var c=a.value;t.mvPushMatrix();var u=t.uModelMat;u[12]=c.pos[0],u[13]=c.pos[1],u[14]=c.pos[2],(0,n.U1)(t.uModelMat,t.uModelMat,(0,o.Id)(t.camera.cameraAngle*t.camera.cameraVector.z),[0,0,-1]);var l=new o.OW(c.size,c.size,c.size);i.setMatrixUniforms({scale:l,color:c.color}),t.bindBuffer(r.vertexPosBuf,i.aVertexPosition),t.bindBuffer(r.vertexTexBuf,i.aTextureCoord),e.drawArrays(e.TRIANGLES,0,r.vertexPosBuf.numItems),t.mvPopMatrix()}}catch(t){s.e(t)}finally{s.f()}e.bindBuffer(e.ARRAY_BUFFER,null),e.useProgram(null)}}})),this.renderManager=e,this.engine=e.engine,this.particles=[],this.initialized=!1,this.vertexPosBuf=null,this.vertexTexBuf=null,this.lastUpdateTime=null}));function A(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return S(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?S(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function L(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function O(t,e,r){return e&&L(t.prototype,e),r&&L(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function P(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var T=O((function t(e){var s=this;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),P(this,"init",(function(){var t=s.engine,e=t.spritz,n=t.gl;if(n.clearColor(0,1,0,1),n.clearDepth(1),n.enable(n.DEPTH_TEST),n.depthFunc(n.LEQUAL),s.framebuffer=n.createFramebuffer(),s.initShaderProgram(e.shaders),s.initParticleShaderProgram(),s.initShaderEffects({id:"picker",vs:r(1704).Z(),fs:r(1108).Z(),init:r(5911).Z}),e.effects)for(var o in e.effects);s.initProjection(),s.skyboxManager.init(),s.initializedWebGl=!0})),P(this,"loadShader",(function(t,e){var r=s.engine.gl,n=r.createShader(t);if(r.shaderSource(n,e),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS)){var o=r.getShaderInfoLog(n);throw r.deleteShader(n),new Error("An error occurred compiling the shaders: ".concat(o))}return n})),P(this,"initShaderProgram",(function(t){var e=t.vs,r=t.fs,o=s.engine.gl,a=s,c=s.loadShader(o.VERTEX_SHADER,e),u=s.loadShader(o.FRAGMENT_SHADER,r),l=o.createProgram();if(o.attachShader(l,c),o.attachShader(l,u),o.bindAttribLocation(l,0,"aVertexPosition"),o.bindAttribLocation(l,1,"aTextureCoord"),o.linkProgram(l),!o.getProgramParameter(l,o.LINK_STATUS))throw new Error("WebGL unable to initialize the shader program: ".concat(o.getProgramInfoLog(l)));l.aVertexNormal=o.getAttribLocation(l,"aVertexNormal"),l.aVertexNormal>=0&&o.enableVertexAttribArray(l.aVertexNormal),l.aVertexPosition=o.getAttribLocation(l,"aVertexPosition"),l.aVertexPosition>=0&&o.enableVertexAttribArray(l.aVertexPosition),l.aTextureCoord=o.getAttribLocation(l,"aTextureCoord"),l.aTextureCoord>=0&&o.enableVertexAttribArray(l.aTextureCoord),l.uDiffuse=o.getUniformLocation(l,"uDiffuse"),l.uSpecular=o.getUniformLocation(l,"uSpecular"),l.uSpecularExponent=o.getUniformLocation(l,"uSpecularExponent"),l.pMatrixUniform=o.getUniformLocation(l,"uProjectionMatrix"),l.mMatrixUniform=o.getUniformLocation(l,"uModelMatrix"),l.vMatrixUniform=o.getUniformLocation(l,"uViewMatrix"),l.nMatrixUniform=o.getUniformLocation(l,"uNormalMatrix"),l.samplerUniform=o.getUniformLocation(l,"uSampler"),l.diffuseMapUniform=o.getUniformLocation(l,"uDiffuseMap"),l.cameraPosition=o.getUniformLocation(l,"uCameraPosition"),l.runTransition=o.getUniformLocation(l,"runTransition"),l.useSampler=o.getUniformLocation(l,"useSampler"),l.useDiffuse=o.getUniformLocation(l,"useDiffuse"),l.isSelected=o.getUniformLocation(l,"isSelected"),l.colorMultiplier=o.getUniformLocation(l,"uColorMultiplier"),l.scale=o.getUniformLocation(l,"u_scale"),l.id=o.getUniformLocation(l,"u_id"),l.maxLights=32,l.uLights=[];for(var f=0;f<l.maxLights;f++)l.uLights[f]={enabled:o.getUniformLocation(l,"uLights[".concat(f,"].enabled")),color:o.getUniformLocation(l,"uLights[".concat(f,"].color")),position:o.getUniformLocation(l,"uLights[".concat(f,"].position")),attenuation:o.getUniformLocation(l,"uLights[".concat(f,"].attenuation")),direction:o.getUniformLocation(l,"uLights[".concat(f,"].direction")),scatteringCoefficients:o.getUniformLocation(l,"uLights[".concat(f,"].scatteringCoefficients")),density:o.getUniformLocation(l,"uLights[".concat(f,"].density"))};l.setMatrixUniforms=function(t){var e=t.id,r=void 0===e?null:e,i=t.scale,s=void 0===i?null:i,c=t.sampler,u=void 0===c?1:c,f=t.isSelected,h=void 0!==f&&f,d=t.colorMultiplier,p=void 0===d?null:d;o.useProgram(l),o.uniformMatrix4fv(this.pMatrixUniform,!1,a.uProjMat),o.uniformMatrix4fv(this.mMatrixUniform,!1,a.uModelMat),o.uniformMatrix4fv(this.vMatrixUniform,!1,a.camera.uViewMat),a.normalMatrix=(0,n.Ez)(),(0,n.XL)(a.normalMatrix,a.uModelMat),o.uniformMatrix3fv(this.nMatrixUniform,!1,a.normalMatrix),o.uniform3fv(this.scale,s?s.toArray():a.scale.toArray()),o.uniform4fv(this.id,r||[1,0,0,0]),o.uniform1f(this.isSelected,h?1:0),o.uniform4fv(this.colorMultiplier,p||[1,1,1,1]),o.uniform1f(this.useSampler,u),o.uniform1f(this.runTransition,a.isTransitioning?1:0),o.uniform3fv(this.cameraPosition,a.camera.cameraPosition.toArray()),a.lightManager.setMatrixUniforms()};var h={aVertexPosition:i.NQ.Layout.POSITION.key,aVertexNormal:i.NQ.Layout.NORMAL.key,aTextureCoord:i.NQ.Layout.UV.key};return l.applyAttributePointers=function(t){var e=t.vertexBuffer.layout;for(var r in h)if(h.hasOwnProperty(r)&&-1!==l[r]){var n=h[r];if(-1!==l[r]){var i=e.attributeMap[n];o.vertexAttribPointer(l[r],i.size,o[i.type],i.normalized,i.stride,i.offset)}}},s.shaderProgram=l,l})),P(this,"initParticleShaderProgram",(function(){var t=s.engine.gl,e=s,n=r(8062).Z(),o=r(4399).Z(),i=s.loadShader(t.VERTEX_SHADER,n),a=s.loadShader(t.FRAGMENT_SHADER,o),c=t.createProgram();if(t.attachShader(c,i),t.attachShader(c,a),t.bindAttribLocation(c,0,"aVertexPosition"),t.bindAttribLocation(c,1,"aTextureCoord"),t.linkProgram(c),!t.getProgramParameter(c,t.LINK_STATUS))throw new Error("WebGL unable to initialize the particle shader program: ".concat(t.getProgramInfoLog(c)));return c.aVertexPosition=t.getAttribLocation(c,"aVertexPosition"),t.enableVertexAttribArray(c.aVertexPosition),c.aTextureCoord=t.getAttribLocation(c,"aTextureCoord"),t.enableVertexAttribArray(c.aTextureCoord),c.pMatrixUniform=t.getUniformLocation(c,"uProjectionMatrix"),c.mMatrixUniform=t.getUniformLocation(c,"uModelMatrix"),c.vMatrixUniform=t.getUniformLocation(c,"uViewMatrix"),c.scaleUniform=t.getUniformLocation(c,"uScale"),c.particleColorUniform=t.getUniformLocation(c,"uParticleColor"),c.setMatrixUniforms=function(r){var n=r.color,o=void 0===n?null:n,i=r.scale,a=void 0===i?null:i;t.useProgram(c),t.uniformMatrix4fv(this.pMatrixUniform,!1,e.uProjMat),t.uniformMatrix4fv(this.mMatrixUniform,!1,e.uModelMat),t.uniformMatrix4fv(this.vMatrixUniform,!1,e.camera.uViewMat),t.uniform3fv(this.scaleUniform,a?a.toArray():e.scale.toArray()),t.uniform3fv(this.particleColorUniform,o||[1,1,1])},s.particleShaderProgram=c,c})),P(this,"updateParticles",(function(t){s.particleManager&&"function"==typeof s.particleManager.update&&s.particleManager.update(t)})),P(this,"renderParticles",(function(){s.particleManager&&"function"==typeof s.particleManager.render&&s.particleManager.render()})),P(this,"activateShaderProgram",(function(){var t=s.engine.gl;t.useProgram(s.shaderProgram),t.bindFramebuffer(t.FRAMEBUFFER,null),s.initProjection()})),P(this,"activatePickerShaderProgram",(function(t){var e=s.engine.gl;e.useProgram(s.effectPrograms.picker),t?(e.bindFramebuffer(e.FRAMEBUFFER,s.framebuffer),s.initProjection(),s.applyPixelFrustum()):(e.bindFramebuffer(e.FRAMEBUFFER,null),s.initProjection())})),P(this,"activateShaderEffectProgram",(function(t){s.engine.gl.useProgram(s.effectPrograms[t])})),P(this,"initShaderEffects",(function(t){var e=t.vs,r=t.fs,n=t.id,o=t.init,i=s.engine.gl,a=s,c=s.loadShader(i.VERTEX_SHADER,e),u=s.loadShader(i.FRAGMENT_SHADER,r),l=i.createProgram();if(i.attachShader(l,c),i.attachShader(l,u),i.bindAttribLocation(l,0,"aVertexPosition"),i.bindAttribLocation(l,1,"aTextureCoord"),i.linkProgram(l),!i.getProgramParameter(l,i.LINK_STATUS))throw new Error("WebGL unable to initialize the shader effect program: ".concat(i.getProgramInfoLog(l)));return s.effectPrograms[n]=o.call(a,l),s.effects.push(n),i.deleteShader(c),i.deleteShader(u),s.effectPrograms[n]})),P(this,"initProjection",(function(){var t=s.engine.gl,e=(0,o.Id)(s.camera.fov),r=t.canvas.clientWidth/t.canvas.clientHeight;t.enable(t.DEPTH_TEST),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.enable(t.BLEND),t.viewport(0,0,t.canvas.width,t.canvas.height),s.uProjMat=(0,n.G3)(e,r,.1,100),s.camera.uViewMat||(s.camera.uViewMat=(0,n.Ue)()),s.uProjMat[5]*=-1})),P(this,"enableCulling",(function(){var t=s.engine.gl;t.enable(t.CULL_FACE),t.cullFace(t.BACK)})),P(this,"disableCulling",(function(){var t=s.engine.gl;t.disable(t.CULL_FACE)})),P(this,"enableBlending",(function(){var t=s.engine.gl;t.enable(t.BLEND)})),P(this,"disableBlending",(function(){var t=s.engine.gl;t.disable(t.BLEND)})),P(this,"clearScreen",(function(){var t=s.engine.gl;t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)})),P(this,"applyPixelFrustum",(function(){var t=s.engine.gl,e=t.canvas.clientWidth/t.canvas.clientHeight,r=.1*Math.tan(.5*(0,o.Id)(s.camera.fov)),i=-r,a=e*i,c=e*r,u=Math.abs(c-a),l=Math.abs(r-i),f=s.engine.gamepad.x||0,h=s.engine.gamepad.y||0,d=f*t.canvas.width/t.canvas.clientWidth,p=t.canvas.height-h*t.canvas.height/t.canvas.clientHeight-1,y=a+d*u/t.canvas.width,g=i+p*l/t.canvas.height,m=u/t.canvas.width,v=l/t.canvas.height;t.enable(t.DEPTH_TEST),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.enable(t.BLEND),t.viewport(0,0,1,1),s.uProjMat=(0,n.oy)(y,y+m,g,g+v,.1,100),s.uProjMat[5]*=-1})),P(this,"toggleFullscreen",(function(){if(s.fullscreen){try{document.exitFullscreen()}catch(t){}s.fullscreen=!1}else try{s.engine.gamepadcanvas.parentElement.requestFullscreen(),s.fullscreen=!0}catch(t){}})),P(this,"mvPushMatrix",(function(){var t=(0,n.Ue)();(0,n.t8)(s.uModelMat,t);var e=(0,n.Ue)();(0,n.t8)(s.camera.uViewMat,e),s.modelViewMatrixStack.push([t,e])})),P(this,"mvPopMatrix",(function(){if(0===s.modelViewMatrixStack.length)throw new Error("Invalid popMatrix! Matrix stack is empty.");var t=A(s.modelViewMatrixStack.pop(),2);s.uModelMat=t[0],s.camera.uViewMat=t[1]})),P(this,"transition",(function(){(new Date).getMilliseconds()>=s.transitionTime&&(s.isTransitioning=!1)})),P(this,"createBuffer",(function(t,e,r){var n=s.engine.gl,o=n.createBuffer();return o.itemSize=r,o.numItems=t.length/r,n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,new Float32Array(t),e),n.bindBuffer(n.ARRAY_BUFFER,null),o})),P(this,"updateBuffer",(function(t,e){var r=s.engine.gl;r.bindBuffer(r.ARRAY_BUFFER,t),r.bufferSubData(r.ARRAY_BUFFER,0,new Float32Array(e)),r.bindBuffer(r.ARRAY_BUFFER,null)})),P(this,"bindBuffer",(function(t,e){var r=s.engine.gl;r.bindBuffer(r.ARRAY_BUFFER,t),r.enableVertexAttribArray(e),r.vertexAttribPointer(e,t.itemSize,r.FLOAT,!1,0,0)})),P(this,"startTransition",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.effect,r=void 0===e?"fade":e,n=t.direction,o=void 0===n?"out":n,i=t.duration,a=void 0===i?1e3:i,c=function(){return s.isTransitioning=!0,s.transitionEffect=r,s.transitionDirection=o,s.transitionDuration=a,s.transitionStartTime=performance.now(),new Promise((function(t){s.transitionCallback=t}))};if(s.isTransitioning){var u=s.transitionCallback;return new Promise((function(t){s.transitionCallback=function(){null==u||u(),c().then(t)}}))}return c()})),P(this,"updateTransition",(function(){if(s.isTransitioning){var t=(performance.now()-s.transitionStartTime)/s.transitionDuration;if(t>=1&&(t=1),s.renderTransition(t),t>=1){s.isTransitioning=!1;var e=s.transitionCallback;s.transitionCallback=null,e&&e()}}})),P(this,"initTransitionProgram",(function(t){var e=s.engine.gl;if(!s.transitionGL[t]){var n=t;n.startsWith("fade")&&(n="fade");var o=function(t){var e=null,n=null,o=(t||"").toLowerCase();return"cross"===o?(e=r(6404).Z(),n=r(4522).Z()):"crossblur"===o||"cross-blur"===o?(e=r(9357).Z(),n=r(7319).Z()):"swirl"===o?(e=r(9188).Z(),n=r(8946).Z()):"blur"===o||"blur-in"===o||"blur-out"===o?(e=r(1564).Z(),n=r(5311).Z()):(e=r(8900).Z(),n=r(2913).Z()),[e,n]}(n),i=A(o,2),a=i[0],c=i[1],u=s.loadShader(e.VERTEX_SHADER,a),l=s.loadShader(e.FRAGMENT_SHADER,c),f=e.createProgram();if(e.attachShader(f,u),e.attachShader(f,l),e.bindAttribLocation(f,0,"aPosition"),e.linkProgram(f),!e.getProgramParameter(f,e.LINK_STATUS))throw new Error('Could not link transition shader program for effect "'.concat(t,'": ').concat(e.getProgramInfoLog(f)));var h=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,h);var d=new Float32Array([-1,-1,-1,1,1,-1,1,1]);e.bufferData(e.ARRAY_BUFFER,d,e.STATIC_DRAW);var p=e.getUniformLocation(f,"uProgress"),y=e.getUniformLocation(f,"uDirection");s.transitionGL[t]={program:f,buffer:h,uProgress:p,uDirection:y},e.deleteShader(u),e.deleteShader(l)}})),P(this,"renderTransition",(function(t){if(s.engine.spritz.loaded){var e=s.engine.gl,r=s.transitionEffect||"fade";s.initTransitionProgram(r);var n=s.transitionGL[r];if(n){var o=e.isEnabled(e.DEPTH_TEST),i=e.isEnabled(e.BLEND),a=e.getParameter(e.BLEND_SRC_RGB),c=e.getParameter(e.BLEND_DST_RGB);e.useProgram(n.program),e.bindBuffer(e.ARRAY_BUFFER,n.buffer),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.uniform1f(n.uProgress,t);var u="in"===s.transitionDirection?1:0;e.uniform1f(n.uDirection,u),e.disable(e.DEPTH_TEST),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.drawArrays(e.TRIANGLE_STRIP,0,4),o?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),i||e.disable(e.BLEND),e.blendFunc(a,c),e.bindBuffer(e.ARRAY_BUFFER,null),e.useProgram(null)}}})),P(this,"renderSkybox",(function(){s.engine.spritz.loaded&&s.skyboxManager.renderSkybox(s.uProjMat)})),P(this,"resetDebugCounters",(function(){s.debug&&(s.debug.tilesDrawn=0,s.debug.spritesDrawn=0,s.debug.objectsDrawn=0)})),t._instance||(this.engine=e,this.fullscreen=e.fullscreen,this.uProjMat=(0,n.Ue)(),this.uModelMat=(0,n.Ue)(),this.normalMatrix=(0,n.Ez)(),this.modelViewMatrixStack=[],this.scale=new o.OW(1,1,1),this.initializedWebGl=!1,this.effects=[],this.effectPrograms={},this.framebuffer=null,this.isTransitioning=!1,this.transitionEffect=null,this.transitionDirection="out",this.transitionDuration=0,this.transitionStartTime=0,this.transitionCallback=null,this.transitionGL={},this.debug={tilesDrawn:0,spritesDrawn:0,objectsDrawn:0},this.cameraManager=new a.Z(this),this.camera=this.cameraManager.camera,this.lightManager=new f(this),this.skyboxManager=new b(this),this.particleManager=new E(this),this.particleShaderProgram=null,this.shaderProgram=null,t._instance=this),t._instance}))},2737:(t,e,r)=>{"use strict";r.d(e,{Z:()=>p});var n=r(9010),o=r(4395),i=r(679);function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function s(t,e,r){return s=f()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&c(o,r.prototype),o},s.apply(null,arguments)}function c(t,e){return c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},c(t,e)}function u(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function d(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}(y,t);var e,r,a,p=(e=y,r=f(),function(){var t,n=h(e);if(r){var o=h(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return u(this,t)});function y(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,y),d(l(e=p.call(this,t)),"getAvatarData",(function(){return{id:e.objId,templateLoaded:e.templateLoaded,drawOffset:e.drawOffset,hotspotOffset:e.hotspotOffset,animFrame:e.animFrame,fixed:e.fixed,pos:e.pos,scale:e.scale,facing:e.facing,actionDict:e.actionDict,actionList:e.actionList,gender:e.gender,speech:e.speech,portrait:e.portrait,inventory:e.inventory,blocking:e.blocking,override:e.override,isLit:e.isLit,lightIndex:e.lightIndex,lightColor:e.lightColor,density:e.density,isSelected:e.isSelected}})),d(l(e),"init",(function(){console.log({msg:"- avatar hook",id:e.id,pos:e.pos,avatar:l(e)})})),d(l(e),"tick",(function(t){if(!e.actionList.length){var r=e.checkInput();r&&e.addAction(r).then((function(){e.engine.networkManager&&e.engine.networkManager.ws&&e.engine.networkManager.ws.readyState===WebSocket.OPEN&&e.engine.networkManager.sendAction(r,l(e))}))}e.engine.networkManager&&e.engine.networkManager.ws&&e.engine.networkManager.ws.readyState===WebSocket.OPEN&&e.engine.networkManager.updateAvatarPosition(l(e)),e.bindCamera&&(0,n.t8)(e.pos,e.engine.renderManager.camera.cameraPosition)})),d(l(e),"checkInput",(function(){return e.engine.inputManager.getAvatarAction(l(e))})),d(l(e),"openMenu",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return new i.aW(e.engine,"prompt",[t,r,!1,{autoclose:!1}],l(e))})),d(l(e),"handleWalk",(function(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=600,u=null!==a?a:o.Nm.None;if(null===a)switch(t){case"w":u=o.Nm.Up;break;case"s":u=o.Nm.Down;break;case"a":u=o.Nm.Left;break;case"d":u=o.Nm.Right;break;case"u":return new i.aW(e.engine,"dance",[300,e.zone],l(e));case"p":return new i.aW(e.engine,"patrol",[e.pos.toArray(),new n.OW(8,13,e.pos.z).toArray(),600,e.zone],l(e));case"r":return new i.aW(e.engine,"patrol",[e.pos.toArray(),new n.OW(8,13,e.pos.z).toArray(),200,e.zone],l(e))}if(1===r["x-dir"]&&(u=o.Nm.Right),-1===r["x-dir"]&&(u=o.Nm.Left),1===r["y-dir"]&&(u=o.Nm.Down),-1===r["y-dir"]&&(u=o.Nm.Up),c=e.engine.keyboard.shift||e.engine.gamepad.keyPressed("y")?200:600,e.facing!==u)return e.faceDir(u);var f=e.pos,h=o.Nm.toOffset(u),d=s(n.OW,[Math.round(f.x+h[0]),Math.round(f.y+h[1]),0]);if(!e.zone.isInZone(d.x,d.y)){var p=e.zone.world.zoneContaining(d.x,d.y);return p&&p.loaded&&p.isWalkable(d.x,d.y,o.Nm.reverse(u))?new i.aW(e.engine,"changezone",[e.zone.id,e.pos.toArray(),p.id,d.toArray(),c],l(e)):e.faceDir(u)}return e.zone.isWalkable(d.x,d.y,o.Nm.reverse(u))?new i.aW(e.engine,"move",[e.pos.toArray(),d.toArray(),c,e.zone],l(e)):e.faceDir(u)})),e.isLit=!0,e.isSelected=!0,e}return a=y,Object.defineProperty(a,"prototype",{writable:!1}),a}(r(4485).Z)},4485:(t,e,r)=>{"use strict";r.d(e,{Z:()=>b});var n=r(9010),o=r(4395),i=r(7974),a=r(679),s=r(3203);function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function u(t,e,r){return u=g()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&d(o,r.prototype),o},u.apply(null,arguments)}function l(){l=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function d(){}function p(){}function y(){}var g={};s(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==c(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,s(b,"constructor",y),s(y,"constructor",p),p.displayName=s(y,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,a,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,a,"Generator"),s(b,o,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function f(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function h(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){f(i,n,o,a,s,"next",t)}function s(t){f(i,n,o,a,s,"throw",t)}a(void 0)}))}}function d(t,e){return d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},d(t,e)}function p(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return y(t)}function y(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function v(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var b=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(b,t);var e,r,c,f=(e=b,r=g(),function(){var t,n=m(e);if(r){var o=m(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return p(this,t)});function b(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,b),v(y(e=f.call(this)),"onLoad",(function(t){if(!e.loaded)if(e.src&&e.sheetSize&&e.tileSize&&e.frames){if(console.log({msg:"sprite load",instanceData:t,objId:e.objId}),e.zone=t.zone,t.id&&(e.id=t.id),t.pos&&(e.pos=t.pos,e.pos&&(null===e.pos.z||void 0===e.pos.z)))try{var r,n,o,i,a=e.pos.x+(null!==(r=null===(n=e.hotspotOffset)||void 0===n?void 0:n.x)&&void 0!==r?r:0),s=e.pos.y+(null!==(o=null===(i=e.hotspotOffset)||void 0===i?void 0:i.y)&&void 0!==o?o:0),c=e.zone.getHeight(a,s);e.pos.z="number"==typeof c?c:0}catch(t){console.warn("Error computing sprite height from zone",t),e.pos.z=0}if(t.isLit&&(e.isLit=t.isLit),t.attenuation&&(e.attenuation=t.attenuation),t.direction&&(e.direction=t.direction),t.lightColor&&(e.lightColor=t.lightColor),t.density&&(e.density=t.density),t.scatteringCoefficients&&(e.scatteringCoefficients=t.scatteringCoefficients),t.rotation&&(e.rotation=t.rotation),t.facing&&0!==t.facing&&(e.facing=t.facing),t.zones&&null!==t.zones&&(e.zones=t.zones),t.onStep&&"function"==typeof t.onStep){var u=e.onStep;e.onStep=h(l().mark((function r(){return l().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.onStep(y(e),y(e));case 2:return r.next=4,u(y(e),y(e));case 4:case"end":return r.stop()}}),r)})))}if(t.onSelect&&"function"==typeof t.onSelect){var f=e.onSelect;e.onSelect=h(l().mark((function r(){return l().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.onSelect(y(e),y(e));case 2:return r.next=4,f(y(e),y(e));case 4:case"end":return r.stop()}}),r)})))}var d;e.texture=e.engine.resourceManager.loadTexture(e.src),e.texture.runWhenLoaded(e.onTilesetOrTextureLoaded),e.vertexTexBuf=e.engine.renderManager.createBuffer(e.getTexCoords(),e.engine.gl.DYNAMIC_DRAW,2),e.enableSpeech&&(e.speech=e.engine.resourceManager.loadSpeech(e.id,e.engine.mipmap),e.speech.runWhenLoaded(e.onTilesetOrTextureLoaded),e.speechTexBuf=e.engine.renderManager.createBuffer(e.getSpeechBubbleTexture(),e.engine.gl.DYNAMIC_DRAW,2)),e.portraitSrc&&(e.portrait=e.engine.resourceManager.loadTexture(e.portraitSrc),e.portrait.runWhenLoaded(e.onTilesetOrTextureLoaded)),e.isLit&&(console.log({msg:"Adding Light Loaded",id:e.id,pos:e.pos.toArray()}),e.lightIndex=e.engine.renderManager.lightManager.addLight(e.id,e.pos.toArray(),e.lightColor,null!==(d=e.attenuation)&&void 0!==d?d:[.01,.01,.01],e.direction,e.density,e.scatteringCoefficients,!0)),e.zone.tileset.runWhenDefinitionLoaded(e.onTilesetDefinitionLoaded)}else console.error("Invalid sprite definition")})),v(y(e),"onLoadFromZip",function(){var t=h(l().mark((function t(r,n){var o,i,a,s,c,u,f,d,p;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.loaded){t.next=2;break}return t.abrupt("return");case 2:if(e.src&&e.sheetSize&&e.tileSize&&e.frames){t.next=5;break}return console.error("Invalid sprite definition"),t.abrupt("return");case 5:if(console.log({msg:"sprite load from zip",instanceData:r}),e.update(r),e.zone=r.zone,r.id&&(e.id=r.id),r.isLit&&(e.isLit=r.isLit),r.lightColor&&(e.lightColor=r.lightColor),r.density&&(e.density=r.density),r.attenuation&&(e.attenuation=r.attenuation),r.direction&&(e.direction=r.direction),r.scatteringCoefficients&&(e.scatteringCoefficients=r.scatteringCoefficients),r.fixed&&(e.fixed=r.fixed),r.pos&&(e.pos=r.pos,e.pos&&(null===e.pos.z||void 0===e.pos.z)))try{c=e.pos.x+(null!==(o=null===(i=e.hotspotOffset)||void 0===i?void 0:i.x)&&void 0!==o?o:0),u=e.pos.y+(null!==(a=null===(s=e.hotspotOffset)||void 0===s?void 0:s.y)&&void 0!==a?a:0),f=e.zone.getHeight(c,u),e.pos.z="number"==typeof f?f:0}catch(t){console.warn("Error computing sprite height from zone",t),e.pos.z=0}return r.facing&&0!==r.facing&&(e.facing=r.facing),r.zones&&null!==r.zones&&(e.zones=r.zones),r.onStep&&"function"==typeof r.onStep&&(d=e.onStep,e.onStep=h(l().mark((function t(){return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.onStep(y(e),y(e));case 2:return t.next=4,d(y(e),y(e));case 4:case"end":return t.stop()}}),t)})))),t.next=22,e.engine.resourceManager.loadTextureFromZip(e.src,n);case 22:if(e.texture=t.sent,e.texture.runWhenLoaded(e.onTilesetOrTextureLoaded),e.vertexTexBuf=e.engine.renderManager.createBuffer(e.getTexCoords(),e.engine.gl.DYNAMIC_DRAW,2),e.enableSpeech&&(e.speech=e.engine.resourceManager.loadSpeech(e.id,e.engine.mipmap),e.speech.runWhenLoaded(e.onTilesetOrTextureLoaded),e.speechTexBuf=e.engine.renderManager.createBuffer(e.getSpeechBubbleTexture(),e.engine.gl.DYNAMIC_DRAW,2)),!e.portraitSrc){t.next=31;break}return t.next=29,e.engine.resourceManager.loadTextureFromZip(e.portraitSrc,n);case 29:e.portrait=t.sent,e.portrait.runWhenLoaded(e.onTilesetOrTextureLoaded);case 31:e.isLit&&(e.lightIndex=e.engine.renderManager.lightManager.addLight(e.id,e.pos.toArray(),e.lightColor,null!==(p=e.attenuation)&&void 0!==p?p:[.01,.01,.01],e.direction,e.density,e.scatteringCoefficients,!0)),e.zone.tileset.runWhenDefinitionLoaded(e.onTilesetDefinitionLoaded);case 33:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),v(y(e),"onTilesetDefinitionLoaded",(function(){var t=e.zone.tileset.tileSize,r=[e.tileSize[0]/t,e.tileSize[1]/t],n=[[0,0,0],[r[0],0,0],[r[0],0,r[1]],[0,0,r[1]]],o=[[n[2],n[3],n[0]],[n[2],n[0],n[1]]].flat(3);e.vertexPosBuf=e.engine.renderManager.createBuffer(o,e.engine.gl.STATIC_DRAW,3),e.enableSpeech&&(e.speechVerBuf=e.engine.renderManager.createBuffer(e.getSpeechBubbleVertices(),e.engine.gl.STATIC_DRAW,3)),e.zone.tileset.runWhenLoaded(e.onTilesetOrTextureLoaded)})),v(y(e),"onTilesetOrTextureLoaded",(function(){!y(e)||e.loaded||!e.zone.tileset.loaded||!e.texture.loaded||e.enableSpeech&&e.speech&&!e.speech.loaded||e.portrait&&!e.portrait.loaded||(e.init(),e.enableSpeech&&e.speech&&e.speech.clearHud&&(e.speech.clearHud(),e.speech.writeText(e.id),e.speech.loadImage()),e.loaded=!0,e.onLoadActions.run())})),v(y(e),"getTexCoords",(function(){var t,r=o.Nm.spriteSequence(e.facing,e.engine.renderManager.camera.cameraDir),n=null!==(t=e.frames[r])&&void 0!==t?t:e.frames.N,i=n.length,a=n[e.animFrame%i],s=e.sheetSize,c=e.tileSize,u=[(a[0]+c[0])/s[0],a[1]/s[1]],l=[a[0]/s[0],(a[1]+c[1])/s[1]],f=[u,[l[0],u[1]],l,[u[0],l[1]]];return[[f[0],f[1],f[2]],[f[0],f[2],f[3]]].flat(3)})),v(y(e),"getSpeechBubbleTexture",(function(){return[[1,1],[0,1],[0,0],[1,1],[0,0],[1,0]].flat(3)})),v(y(e),"getSpeechBubbleVertices",(function(){return[u(n.OW,[2,0,4]).toArray(),u(n.OW,[0,0,4]).toArray(),u(n.OW,[0,0,2]).toArray(),u(n.OW,[2,0,4]).toArray(),u(n.OW,[0,0,2]).toArray(),u(n.OW,[2,0,2]).toArray()].flat(3)})),v(y(e),"draw",(function(){var t;if(e.loaded){if(e.engine&&e.engine.renderManager&&e.engine.renderManager.debug&&e.engine.renderManager.debug.spritesDrawn++,e.isLit){var r=e.pos.toArray();e.engine.renderManager.lightManager.updateLight(e.lightIndex,r)}var o;e.engine.renderManager.mvPushMatrix(),(0,s.Iu)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,(null!==(t=e.drawOffset[e.engine.renderManager.camera.cameraDir])&&void 0!==t?t:e.drawOffset.N).toArray()),(0,s.Iu)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,e.pos.toArray()),e.fixed||(e.engine.renderManager.shaderProgram.setMatrixUniforms({id:e.getPickingId(),scale:new n.OW(1,Math.cos(e.engine.renderManager.camera.cameraAngle/180),1)}),(0,s.Iu)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,[.5*e.engine.renderManager.camera.cameraVector.x,.5*e.engine.renderManager.camera.cameraVector.y,0]),(0,s.U1)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,(0,n.Id)(e.engine.renderManager.camera.cameraAngle*e.engine.renderManager.camera.cameraVector.z),[0,0,-1]),(0,s.Iu)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,[-.5*e.engine.renderManager.camera.cameraVector.x,-.5*e.engine.renderManager.camera.cameraVector.y,0])),e.engine.renderManager.bindBuffer(e.vertexPosBuf,e.engine.renderManager.shaderProgram.aVertexPosition),e.engine.renderManager.bindBuffer(e.vertexTexBuf,e.engine.renderManager.shaderProgram.aTextureCoord),e.texture.attach(),e.engine.renderManager.effectPrograms.picker.setMatrixUniforms({sampler:1,id:e.getPickingId()}),e.isSelected?e.engine.renderManager.shaderProgram.setMatrixUniforms({id:e.getPickingId(),isSelected:!0,sampler:1,colorMultiplier:8&e.engine.frameCount?[1,0,0,1]:[1,1,0,1]}):e.engine.renderManager.shaderProgram.setMatrixUniforms({id:e.getPickingId(),sampler:1}),e.engine.gl.depthFunc(e.engine.gl.ALWAYS),e.engine.gl.drawArrays(e.engine.gl.TRIANGLES,0,e.vertexPosBuf.numItems),e.engine.gl.depthFunc(e.engine.gl.LESS),e.engine.renderManager.mvPopMatrix(),e.enableSpeech&&(e.engine.renderManager.mvPushMatrix(),(0,s.Iu)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,(null!==(o=e.drawOffset[e.engine.renderManager.camera.cameraDir])&&void 0!==o?o:e.drawOffset.N).toArray()),(0,s.Iu)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,e.pos.toArray()),(0,s.U1)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,(0,n.Id)(e.engine.renderManager.camera.cameraAngle*e.engine.renderManager.camera.cameraVector.z),[0,0,-1]),e.engine.renderManager.bindBuffer(e.speechVerBuf,e.engine.renderManager.shaderProgram.aVertexPosition),e.engine.renderManager.bindBuffer(e.speechTexBuf,e.engine.renderManager.shaderProgram.aTextureCoord),e.speech.attach(),e.engine.renderManager.shaderProgram.setMatrixUniforms({id:e.getPickingId()}),e.engine.gl.depthFunc(e.engine.gl.ALWAYS),e.engine.gl.drawArrays(e.engine.gl.TRIANGLES,0,e.speechVerBuf.numItems),e.engine.gl.depthFunc(e.engine.gl.LESS),e.engine.renderManager.mvPopMatrix())}})),v(y(e),"getPickingId",(function(){return[(e.objId>>0&255)/255,(e.objId>>8&255)/255,(e.objId>>16&255)/255,255]})),v(y(e),"setFrame",(function(t){e.animFrame=t,e.engine.renderManager.updateBuffer(e.vertexTexBuf,e.getTexCoords())})),v(y(e),"setFacing",(function(t){t&&(e.facing=t),e.setFrame(e.animFrame)})),v(y(e),"addAction",function(){var t=h(l().mark((function t(r){return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.resolve(r);case 2:r=t.sent,e.actionDict[r.id]&&e.removeAction(r.id),e.actionDict[r.id]=r,e.actionList.push(r);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),v(y(e),"removeAction",(function(t){e.actionList=e.actionList.filter((function(e){return e.id!==t})),delete e.actionDict[t]})),v(y(e),"removeAllActions",(function(){e.actionList=[],e.actionDict={}})),v(y(e),"tickOuter",(function(t){if(e.loaded){e.actionList.sort((function(t,e){var r=t.startTime-e.startTime;return r?t.id>e.id?1:-1:r}));var r=[];e.actionList.forEach((function(e){if(e.loaded&&!(e.startTime>t))try{e.tick(t)&&(r.push(e),e.onComplete())}catch(t){console.error(t),r.push(e)}})),r.forEach((function(t){return e.removeAction(t.id)})),e.tick&&e.tick(t)}})),v(y(e),"init",(function(){})),v(y(e),"loadRemote",function(){var t=h(l().mark((function t(r){var n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(r);case 2:if((n=t.sent).ok){t.next=5;break}throw new Error;case 5:e.update(n.json());case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),v(y(e),"speak",(function(t){var r,n,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!t&&e.speech.clearHud?e.speech.clearHud():(i.speechOutput&&(e.speechSynthesis(t),i.speechOutput=!1),e.textbox=e.engine.hud.scrollText(e.id+":> "+t,!0,{portrait:null!==(r=e.portrait)&&void 0!==r&&r}),o&&e.speech&&(e.speech.scrollText(t,!1,{portrait:null!==(n=e.portrait)&&void 0!==n&&n}),e.speech.loadImage()))})),v(y(e),"speechSynthesis",(function(t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s=e.voice,c=null!==(r=window.speechSynthesis.getVoices())&&void 0!==r?r:[];s.voice=e.gender?"male"==e.gender?c[7]:c[28]:c[0],o&&(s.rate=o),i&&(s.volume=i),a&&(s.pitch=a),s.text=t,s.lang=n,window.speechSynthesis.speak(s)})),v(y(e),"interact",function(){var t=h(l().mark((function t(r,n){var o;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=null,t.t0=e.state,t.next=4;break;case 4:return t.abrupt("break",5);case 5:return n&&n(!0),t.abrupt("return",o);case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),v(y(e),"faceDir",(function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!r&&e.facing==t||t===o.Nm.None?null:new a.aW(e.engine,"face",[t],y(e))})),v(y(e),"setGreeting",(function(t){return e.speech.clearHud&&e.speech.clearHud(),e.speech.writeText(t),e.speech.loadImage(),new a.aW(e.engine,"greeting",[t,{autoclose:!0}],y(e))})),e.objId=Math.round(100*Math.random())+11,e.engine=t,e.templateLoaded=!1,e.drawOffset=new n.OW(0,0,0),e.hotspotOffset=new n.OW(0,0,0),e.animFrame=0,e.fixed=!1,e.pos=new n.OW(0,0,0),e.scale=new n.OW(1,1,1),e.facing=o.Nm.Right,e.actionDict={},e.actionList=[],e.gender=null,e.speech={},e.portrait=null,e.onLoadActions=new i.Z,e.inventory=[],e.blocking=!0,e.override=!1,e.isLit=!0,e.lightIndex=null,e.lightColor=[.1,1,.1],e.density=1,e.voice=new SpeechSynthesisUtterance,e.isSelected=!1,e}return c=b,Object.defineProperty(c,"prototype",{writable:!1}),c}(r(5849).Z)},8826:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>i});var n=r(9010),o=(r(4013),r(4395));const i={init:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.engine=this.world.engine,this.cameraAction=t,this.options=e,this.completed=!1,this.startTime=(new Date).getTime(),this.endTime=null},tick:function(t){if(this.loaded){var e=this.engine.renderManager.camera,r=0;switch(this.options.duration&&(r=(t-this.startTime)/(1e3*this.options.duration))>=1&&(r=1,this.completed=!0),this.cameraAction){case"pan":if(this.options.from&&this.options.to){var i=this.options.from,a=this.options.to,s=(0,n.t7)(i,a,r,new n.OW(0,0,0));e.cameraVector.x=s.x,e.cameraVector.y=s.y,e.cameraVector.z=s.z,e.cameraDir=o.Nm.adjustCameraDirection(e.cameraVector)}break;case"zoom":if("number"==typeof this.options.zoomDelta){var c=e.cameraDistance,u=c+this.options.zoomDelta;e.cameraDistance=(0,n.t7)(c,u,r),e.updateViewFromAngles()}break;case"rotate":if("number"==typeof this.options.yawDelta||"number"==typeof this.options.pitchDelta){var l=e.yaw,f=e.pitch,h=l+(this.options.yawDelta||0),d=f+(this.options.pitchDelta||0);e.yaw=(0,n.t7)(l,h,r),e.pitch=(0,n.t7)(f,d,r),e.updateViewFromAngles()}break;case"translate":this.options.translateDirection&&(this.completed||e.translateCam(this.options.translateDirection));break;case"focus":console.warn('Camera action "focus" not yet implemented.')}return this.options.duration&&!this.endTime&&(this.endTime=this.startTime+1e3*this.options.duration),this.endTime&&t>this.endTime&&(this.completed=!0),this.completed}}}},3565:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>n});const n={init:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.engine=this.world.engine,this.text="",this.prompt=t,this.scrolling=e,this.line=0,this.options=r,this.completed=!1,this.lastKey=(new Date).getTime()},tick:function(t){var e;if(this.loaded)return this.options&&this.options.autoclose&&(this.endTime=this.endTime?this.endTime:null!==(e=this.options.endTime)&&void 0!==e?e:(new Date).getTime()+1e4,t>this.endTime&&(this.completed=!0)),this.checkInput(t),this.textbox=this.engine.hud.scrollText(this.prompt+this.text,this.scrolling,this.options),this.completed},checkInput:function(t){if(t>this.lastKey+200){var e=!1;switch(this.engine.keyboard.lastPressedCode()){case"Escape":this.completed=!0,e=!0;break;case"Backspace":var r=this.text.split("");r.pop(),this.text=r.join(""),this.lastKey=t,e=!0;break;case"Enter":this.engine.hud.scrollText(this.text),this.completed=!0,e=!0}if(!e){var n=this.engine.keyboard.lastPressedKey();n&&(this.lastKey=t,this.text+=""+n)}}}}},48:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>n});const n={init:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{autoclose:!1,closeOnEnter:!1};this.engine=this.world.engine,this.text="",this.prompt="",this.scrolling=r,this.line=0,this.options=n,this.completed=!1,this.onOpen=t.start.onOpen,this.lastKey=(new Date).getTime(),this.touches=[],this.menuDict=null!=t?t:{},this.activeMenus=null!=e?e:[],this.selectedMenu={},this.selectedMenuId=null,this.isTouched=!1,this.speechOutput=!1,this.quittable=!0,this.listenerId=this.engine.gamepad.attachListener(this.hookListener()),this.speechOutput=!0,window.speechSynthesis.onvoiceschanged=function(){}},tick:function(t){var e,r=this;if(this.loaded)return this.options&&this.options.autoclose&&(this.endTime=this.endTime?this.endTime:null!==(e=this.options.endTime)&&void 0!==e?e:(new Date).getTime()+1e4,t>this.endTime&&(this.completed=!0)),this.checkInput(t),Object.keys(this.menuDict).filter((function(t){return r.activeMenus.includes(t)})).map((function(t){var e=r.menuDict[t],n=e.colours;e.active&&(n.background="#555"),r.engine.hud.drawButton(e.text,e.x,e.y,e.w,e.h,e.colours),e.prompt&&(r.speechOutput&&r.engine.speechSynthesis(e.prompt),r.textbox=r.engine.hud.scrollText(e.prompt,r.scrolling,r.options))})),this.speechOutput=!1,this.completed&&(this.unhookListener(),window.speechSynthesis.cancel()),this.completed},unhookListener:function(){this.engine.gamepad.removeListener(this.listenerId),this.listenerId=null},hookListener:function(){var t=this;this.onOpen&&this.onOpen(this);var e=function(e){var r=e.touches;if(t.isTouched=!0,t.touches=r,t.isTouched&&t.touches.length>0&&t.lastKey+100<(new Date).getTime()){var n=t.touches[0].x,o=t.touches[0].y,i=t;i.activeMenus.filter((function(t){var e=i.menuDict[t];return n<e.x+e.w&&n>e.x&&o<e.y+e.h&&o>e.y})).map((function(e){var r=i.menuDict[e];r.trigger&&r.trigger(t),r.children&&(i.activeMenus=r.children)}))}},r=function(e){t.touches=e},n=function(e){t.isTouched=!1,t.touches=e};return{touchstart:e,touchmove:r,touchend:n,mousedown:e,mousemove:r,mouseup:n}},checkInput:function(t){var e=this;if(t>this.lastKey+200)switch(this.engine.keyboard.lastPressedCode()){case"Escape":this.quittable&&(this.completed=!0);break;case"Enter":Object.keys(this.menuDict).filter((function(t){return e.activeMenus.includes(t)})).map((function(t){var r=e.menuDict[t];r.onEnter&&r.trigger(e)})),(this.quittable||this.options.closeOnEnter)&&(this.completed=!0)}}}},6083:(t,e,r)=>{"use strict";r.d(e,{Z:()=>Te});var n={};r.r(n),r.d(n,{coerceArgToFunction:()=>Y,coerceArgToNumber:()=>V,coerceArgToString:()=>Z,coerceArgToTable:()=>$,coerceToBoolean:()=>F,coerceToNumber:()=>U,coerceToString:()=>G,ensureArray:()=>K,hasOwnProperty:()=>H,posrelat:()=>N,tostring:()=>D,type:()=>z});var o={};r.r(o),r.d(o,{sprintf:()=>_t,version:()=>gt,vsprintf:()=>xt});var i={};r.r(i),r.d(i,{LuaError:()=>M,Table:()=>j,createEnv:()=>ke,utils:()=>n});var a=r(679);function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function c(){c=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};u(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==s(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(b,"constructor",y),u(y,"constructor",p),p.displayName=u(y,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,a,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,a,"Generator"),u(b,o,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function u(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function l(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){u(i,n,o,a,s,"next",t)}function s(t){u(i,n,o,a,s,"throw",t)}a(void 0)}))}}function f(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=d(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function h(t){return function(t){if(Array.isArray(t))return t}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||d(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(t,e){if(t){if("string"==typeof t)return p(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(t,e):void 0}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var m=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y(this,t),this.engine=e,this.callbacks={onDialogueShow:r.onDialogueShow||null,onBackdropChange:r.onBackdropChange||null,onCutsceneEnd:r.onEnd||r.onCutsceneEnd||null},this.characters={},this.currentBackdrop=null,this.isPlaying=!1,this.isPaused=!1,this.bgmAudio=null,this.sfxAudio=null,this.voiceAudio=null}var e,r,n,o,i,a,s,u,d;return e=t,r=[{key:"parseScript",value:function(t){for(var e=t.split("\n"),r=[],n=null,o=!1,i=[],a=0;a<e.length;a++){var s=e[a].trim();if(s&&!s.startsWith("#"))if(o&&s.includes('"""'))(s=s.replace('"""',"").trim())&&i.push(s),n.text=i.join("\n"),r.push(n),n=null,o=!1,i=[];else if(o)i.push(s);else if(s.startsWith("@")){var c=this.parseCommand(s);c&&r.push(c)}else if(s.startsWith("wait "))r.push({type:"wait",duration:parseInt(s.replace("wait","").trim())});else if("waitInput"!==s&&"wait_input"!==s){if(s.includes(":")){var u=s.startsWith("*");u&&(s=s.substring(1).trim());var l=h(s.split(":")),f=l[0],d=l.slice(1).join(":").trim(),p=d.match(/^\[([^\]]+)\]/),y=p?this.parseBracket(p[1]):{},g=p?d.substring(p[0].length).trim():d;if(g.startsWith('"""')){o=!0,i=(g=g.replace('"""',"").trim())?[g]:[],n={type:"dialogue",actor:f.trim(),text:"",isCutin:u,meta:y};continue}r.push({type:"dialogue",actor:f.trim(),text:g.replace(/^["']|["']$/g,""),isCutin:u,meta:y})}}else r.push({type:"waitInput"})}return r}},{key:"parseCommand",value:function(t){var e=t.substring(1).trim().split(/\s+/),r=e[0],n=e.slice(1).join(" "),o=n.match(/\[([^\]]+)\]/),i=o?this.parseBracket(o[1]):{},a=o?n.replace(o[0],"").trim():n;switch(r){case"backdrop":return{type:"backdrop",url:a||i.url,options:i};case"char":return{type:"char",name:a.split(/\s+/)[0],sprite:i.sprite};case"do":return{type:"hook",action:a.split(/\s+/)[0],args:i};case"transition":return{type:"transition",effect:a||i.effect||"fade",options:i};case"end":return{type:"end"};default:return console.warn("[PxcPlayer] Unknown command:",r),null}}},{key:"parseBracket",value:function(t){var e,r={},n=f(t.split(","));try{for(n.s();!(e=n.n()).done;){var o=h(e.value.split("=")),i=o[0],a=o.slice(1).join("=").trim();r[i.trim()]=a||!0}}catch(t){n.e(t)}finally{n.f()}return r}},{key:"playCutscene",value:(d=l(c().mark((function t(e){var r,n,o,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.isPlaying){t.next=3;break}return console.warn("[PxcPlayer] Cutscene already playing"),t.abrupt("return");case 3:this.isPlaying=!0,r=this.parseScript(e),console.log("[PxcPlayer] Playing cutscene with",r.length,"events"),n=f(r),t.prev=7,n.s();case 9:if((o=n.n()).done){t.next=17;break}if(i=o.value,this.isPlaying){t.next=13;break}return t.abrupt("break",17);case 13:return t.next=15,this.handleEvent(i);case 15:t.next=9;break;case 17:t.next=22;break;case 19:t.prev=19,t.t0=t.catch(7),n.e(t.t0);case 22:return t.prev=22,n.f(),t.finish(22);case 25:this.isPlaying=!1,this.cleanup(),this.callbacks.onCutsceneEnd&&this.callbacks.onCutsceneEnd();case 28:case"end":return t.stop()}}),t,this,[[7,19,22,25]])}))),function(t){return d.apply(this,arguments)})},{key:"handleEvent",value:(u=l(c().mark((function t(e){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=e.type,t.next="backdrop"===t.t0?3:"char"===t.t0?6:"dialogue"===t.t0?8:"hook"===t.t0?11:"transition"===t.t0?14:"wait"===t.t0?17:"waitInput"===t.t0?20:"end"===t.t0?23:25;break;case 3:return t.next=5,this.showBackdrop(e.url,e.options);case 5:return t.abrupt("break",26);case 6:return this.defineCharacter(e.name,e.sprite),t.abrupt("break",26);case 8:return t.next=10,this.showDialogue(e);case 10:return t.abrupt("break",26);case 11:return t.next=13,this.doHook(e.action,e.args);case 13:return t.abrupt("break",26);case 14:return t.next=16,this.doTransition(e.effect,e.options);case 16:return t.abrupt("break",26);case 17:return t.next=19,this.wait(e.duration);case 19:return t.abrupt("break",26);case 20:return t.next=22,this.waitForInput();case 22:return t.abrupt("break",26);case 23:return this.isPlaying=!1,t.abrupt("break",26);case 25:console.warn("[PxcPlayer] Unknown event type:",e.type);case 26:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"showBackdrop",value:(s=l(c().mark((function t(e){var r,n=arguments;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=n.length>1&&void 0!==n[1]?n[1]:{},this.currentBackdrop=e,console.log("[PxcPlayer] Backdrop:",e,r),this.callbacks.onBackdropChange&&this.callbacks.onBackdropChange(e,r),!r.fadeIn){t.next=7;break}return t.next=7,this.wait(parseInt(r.fadeIn));case 7:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"defineCharacter",value:function(t,e){this.characters[t]={sprite:e},console.log("[PxcPlayer] Defined character:",t,e)}},{key:"showDialogue",value:(a=l(c().mark((function t(e){var r,n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.characters[e.actor],n=r?r.sprite:null,console.log("[PxcPlayer] Dialogue:",e.actor,e.text),!e.meta.voice){t.next=6;break}return t.next=6,this.playVoiceBlocking(e.meta.voice);case 6:return this.callbacks.onDialogueShow&&this.callbacks.onDialogueShow({actor:e.actor,text:e.text,sprite:n,expression:e.meta.expression||"neutral",position:e.meta.position||"center",isCutin:e.isCutin,meta:e.meta}),t.next=9,this.wait(100);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"doHook",value:(i=l(c().mark((function t(e,r){return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:console.log("[PxcPlayer] Hook:",e,r),t.t0=e,t.next="playBgm"===t.t0?4:"playSfx"===t.t0?6:"playVoice"===t.t0?8:"stopBgm"===t.t0?11:"stopAll"===t.t0?13:15;break;case 4:return this.playBgm(r.name),t.abrupt("break",16);case 6:return this.playSfx(r.name),t.abrupt("break",16);case 8:return t.next=10,this.playVoiceBlocking(r.name);case 10:return t.abrupt("break",16);case 11:return this.stopBgm(),t.abrupt("break",16);case 13:return this.stopAll(),t.abrupt("break",16);case 15:console.warn("[PxcPlayer] Unknown hook action:",e);case 16:case"end":return t.stop()}}),t,this)}))),function(t,e){return i.apply(this,arguments)})},{key:"playBgm",value:function(t){var e=this;this.stopBgm(),console.log("[PxcPlayer] Playing BGM:",t),this.engine&&this.engine.assetLoader&&this.engine.assetLoader.load(t).then((function(t){e.bgmAudio=new Audio(t),e.bgmAudio.loop=!0,e.bgmAudio.volume=.7,e.bgmAudio.play().catch((function(t){return console.warn("[PxcPlayer] BGM autoplay blocked:",t)}))})).catch((function(t){return console.error("[PxcPlayer] Failed to load BGM:",t)}))}},{key:"playSfx",value:function(t){console.log("[PxcPlayer] Playing SFX:",t),this.engine&&this.engine.assetLoader&&this.engine.assetLoader.load(t).then((function(t){var e=new Audio(t);e.volume=.8,e.play().catch((function(t){return console.warn("[PxcPlayer] SFX autoplay blocked:",t)}))})).catch((function(t){return console.error("[PxcPlayer] Failed to load SFX:",t)}))}},{key:"playVoiceBlocking",value:(o=l(c().mark((function t(e){var r=this;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log("[PxcPlayer] Playing Voice:",e),t.abrupt("return",new Promise((function(t){r.engine&&r.engine.assetLoader?r.engine.assetLoader.load(e).then((function(e){r.voiceAudio=new Audio(e),r.voiceAudio.volume=1,r.voiceAudio.onended=function(){return t()},r.voiceAudio.play().catch((function(e){console.warn("[PxcPlayer] Voice autoplay blocked:",e),t()}))})).catch((function(e){console.error("[PxcPlayer] Failed to load voice:",e),t()})):t()})));case 2:case"end":return t.stop()}}),t)}))),function(t){return o.apply(this,arguments)})},{key:"stopBgm",value:function(){this.bgmAudio&&(this.bgmAudio.pause(),this.bgmAudio=null)}},{key:"stopAll",value:function(){this.stopBgm(),this.sfxAudio&&(this.sfxAudio.pause(),this.sfxAudio=null),this.voiceAudio&&(this.voiceAudio.pause(),this.voiceAudio=null)}},{key:"doTransition",value:(n=l(c().mark((function t(e){var r,n,o,i=arguments;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=i.length>1&&void 0!==i[1]?i[1]:{},console.log("[PxcPlayer] Transition:",e,r),!this.engine||!this.engine.renderManager){t.next=9;break}return n=r.duration||500,o=r.direction||"out",t.next=7,this.engine.renderManager.startTransition({effect:e,direction:o,duration:n});case 7:t.next=11;break;case 9:return t.next=11,this.wait(r.duration||500);case 11:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"wait",value:function(t){return new Promise((function(e){return setTimeout(e,t)}))}},{key:"waitForInput",value:function(){return new Promise((function(t){var e=function e(){document.removeEventListener("click",e),document.removeEventListener("keydown",e),t()};document.addEventListener("click",e),document.addEventListener("keydown",e)}))}},{key:"cleanup",value:function(){this.stopAll(),this.characters={},this.currentBackdrop=null}},{key:"stop",value:function(){this.isPlaying=!1,this.cleanup()}}],r&&g(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function b(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=x(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}}(t,e)||x(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){if(t){if("string"==typeof t)return _(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(t,e):void 0}}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function k(){k=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=x(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function b(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==v(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},b(w.prototype),s(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function E(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function A(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){E(i,n,o,a,s,"next",t)}function s(t){E(i,n,o,a,s,"throw",t)}a(void 0)}))}}function S(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function L(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?S(Object(r),!0).forEach((function(e){T(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function O(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function P(t,e,r){return e&&O(t.prototype,e),r&&O(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function T(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var C=P((function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),T(this,"getLibrary",(function(t,e){return console.log({msg:"creating pixoscript library",envScope:e}),new r.pixoscript.Table(L(L({},e),{},{get_caller:function(){return e._this},get_subject:function(){return e.subject},get_map:function(){return e.map||e.zone},get_zone:function(){return e.map||e.zone},get_world:function(){return t.spritz.world},send_action:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=t.networkManager;if(r&&r.ws){var n=r.sendAction(e.toObject());return e?function(){return Promise.resolve(n)}:n}return!!e&&function(){return Promise.resolve(!1)}},all_flags:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=t.store.all();return e?function(){return Promise.resolve(r)}:r},has_flag:function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];console.log("checking flag via lua",e,r);var n=t.store.keys().includes(e);return r?function(){return Promise.resolve(n)}:n},set_flag:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];console.log("setting flag via lua",e,n);var o=t.store.set(e,r.toObject());return n?function(){return Promise.resolve(o)}:o},add_flag:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.log("adding flag via lua",e,n),t.store.add(e,r.toObject()),!n||function(){return Promise.resolve(!0)}},get_flag:function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];console.log("getting flag via lua",e,r);var n=t.store.get(e);return r?function(){return Promise.resolve(n)}:n},remove_all_zones:function(){return console.log({msg:"removing all zones via lua"}),t.spritz.world.removeAllZones()},load_zone_from_zip:function(e,r){return console.log({msg:"loading zone from zip via lua",world:t.spritz.world,z:e,zip:r}),t.spritz.world.loadZoneFromZip(e,r,!1)},register_cutscene:function(e,n){try{var o=r.pixoscript.utils.ensureArray(n.toObject()).map((function(t){return t&&"function"==typeof t.toObject?t.toObject():t}));t.cutsceneManager.register(e,o)}catch(t){console.warn("Failed to register cutscene from Lua",t)}},start_cutscene:function(e){try{t.cutsceneManager.start(e)}catch(t){console.warn("Failed to start cutscene",e,t)}},skip_cutscene:function(){try{t.cutsceneManager.skip()}catch(t){console.warn("Failed to skip cutscene",t)}},set_backdrop:function(e){try{t.cutsceneManager.setBackdrop({backdrop:e})}catch(t){console.warn("Failed to set backdrop",t)}},show_cutout:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"left";try{t.cutsceneManager.showCutout({sprite:e,cutout:r,position:n})}catch(t){console.warn("Failed to show cutout",t)}},play_cutscene:function(t){return function(){return new Promise((function(r){if(console.log({msg:"playing cutscene via lua",zone:e.zone,cutscene:t}),e.zone.playCutscene)return console.log({msg:"cutscene function found"}),e.zone.playCutscene(t).then((function(){r()}));r()}))}},run_cutscene:function(e){return function(){return new Promise((function(n){try{var o=r.pixoscript.utils.ensureArray(e.toObject()).map((function(t){return t&&"function"==typeof t.toObject?t.toObject():t})),i="__lua_cutscene_"+Date.now()+"_"+Math.floor(1e4*Math.random());t.cutsceneManager.register(i,o),t.cutsceneManager.start(i),function e(){t.cutsceneManager.isRunning()?setTimeout(e,30):n()}()}catch(t){console.warn("Failed to run cutscene",t),n()}}))}},run_transition:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"fade",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"out",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:500;return function(){new Promise((function(o){var i=t.renderManager;return i||o(),i.startTransition({effect:e,direction:r,duration:n}).then((function(){return o()}))}))}},sprite_dialogue:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(){return new Promise((function(o){return console.log({msg:"playing dialogue via lua",zone:e.zone,spriteId:t,dialogue:r}),n.onClose=function(){return o()},e.zone.spriteDialogue(t,r,n).then((function(){console.log({msg:"played dialogue via lua",zone:e.zone,spriteId:t,dialogue:r})}))}))}},move_sprite:function(t,n,o){return function(){return new Promise((function(i){return console.log({msg:"moving sprite via lua",zone:e.zone,spriteId:t,location:n,running:o}),e.zone.moveSprite(t,r.pixoscript.utils.ensureArray(n.toObject()),o).then((function(){console.log({msg:"moved sprite via lua",zone:e.zone,spriteId:t,location:n,running:o}),i()}))}))}},load_scripts:function(t){return console.log({msg:"loading scripts via lua",scripts:t,envScope:e}),e.zone.loadScripts(t)},play_pxc_cutscene:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(){return new Promise(function(){var n=A(k().mark((function n(o){var i,a,s;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,console.log("[PixoScript] Loading .pxc cutscene:",e),n.next=4,t.assetLoader.load(e);case 4:if(i=n.sent){n.next=9;break}return console.error("[PixoScript] Failed to load cutscene:",e),o(),n.abrupt("return");case 9:return a={onDialogueShow:r.onDialogueShow||function(t){console.log("[PxcPlayer] Dialogue:",t.actor,t.text)},onBackdropChange:r.onBackdropChange||function(t,e){console.log("[PxcPlayer] Backdrop:",t)},onEnd:function(){console.log("[PxcPlayer] Cutscene ended"),r.onEnd&&r.onEnd(),o()}},s=new m(t,a),n.next=13,s.playCutscene(i);case 13:n.next=19;break;case 15:n.prev=15,n.t0=n.catch(0),console.error("[PixoScript] Error playing .pxc cutscene:",n.t0),o();case 19:case"end":return n.stop()}}),n,null,[[0,15]])})));return function(t){return n.apply(this,arguments)}}())}},play_pxc_script:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(){return new Promise(function(){var n=A(k().mark((function n(o){var i,a;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,console.log("[PixoScript] Playing inline .pxc script"),i={onDialogueShow:r.onDialogueShow||function(t){console.log("[PxcPlayer] Dialogue:",t.actor,t.text)},onBackdropChange:r.onBackdropChange||function(t,e){console.log("[PxcPlayer] Backdrop:",t)},onEnd:function(){console.log("[PxcPlayer] Cutscene ended"),r.onEnd&&r.onEnd(),o()}},a=new m(t,i),n.next=6,a.playCutscene(e);case 6:n.next=12;break;case 8:n.prev=8,n.t0=n.catch(0),console.error("[PixoScript] Error playing inline .pxc script:",n.t0),o();case 12:case"end":return n.stop()}}),n,null,[[0,8]])})));return function(t){return n.apply(this,arguments)}}())}},set_camera:function(){t.renderManager.camera.setCamera()},get_camera_vector:function(){return t.renderManager.camera.cameraTarget},look_at:function(e,n,o){var i=r.pixoscript.utils.ensureArray(e.toObject()),a=r.pixoscript.utils.ensureArray(n.toObject()),s=r.pixoscript.utils.ensureArray(o.toObject());t.renderManager.camera.lookAt(i,a,s)},pan_camera:function(e,r,n){return console.log({msg:"panning camera via lua",from:e,to:r,duration:n}),function(){return new Promise((function(o){t.spritz.world.addEvent(new a.q1(t,"camera",["pan",{from:e,to:r,duration:n}],t.spritz.world,A(k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o();case 1:case"end":return t.stop()}}),t)})))))}))}},_pan:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Math.PI/4;"CCW"===e?t.renderManager.camera.panCCW(r.pixoscript.utils.coerceToNumber(n)):t.renderManager.camera.panCW(r.pixoscript.utils.coerceToNumber(n))},pitch:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Math.PI/4;"CCW"===e?t.renderManager.camera.pitchCCW(r.pixoscript.utils.coerceToNumber(n)):t.renderManager.camera.pitchCW(r.pixoscript.utils.coerceToNumber(n))},tilt:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Math.PI/4;"CCW"===e?t.renderManager.camera.tiltCCW(r.pixoscript.utils.coerceToNumber(n)):t.renderManager.camera.tiltCW(r.pixoscript.utils.coerceToNumber(n))},bind_action:function(e,r,n){try{t.inputManager&&t.inputManager.bindAction(e,r,n)}catch(t){console.warn("bind_action failed",t)}},unbind_action:function(e,r){try{t.inputManager&&t.inputManager.unbindAction(e,r)}catch(t){console.warn("unbind_action failed",t)}},register_action_hook:function(e,r){try{t.inputManager&&t.inputManager.registerActionHook(e,r)}catch(t){console.warn("register_action_hook failed",t)}},is_action_active:function(e){try{return!!t.inputManager&&t.inputManager.isActionActive(e)}catch(t){return console.warn("is_action_active failed",t),!1}},get_action_input:function(e){try{return t.inputManager?t.inputManager.getActionInput(e):null}catch(t){return console.warn("get_action_input failed",t),null}},vector:function(e){var n=w(r.pixoscript.utils.ensureArray(e.toObject()),3),o=n[0],i=n[1],a=n[2];return new t.utils.Vector(o,i,a)},vec_sub:function(t,e){return t.sub(e)},sync:(o=A(k().mark((function t(e){var r,n,o;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=b(e.toObject()),t.prev=1,r.s();case 3:if((n=r.n()).done){t.next=9;break}return o=n.value,t.next=7,o();case 7:t.next=3;break;case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(1),r.e(t.t0);case 14:return t.prev=14,r.f(),t.finish(14);case 17:case"end":return t.stop()}}),t,null,[[1,11,14,17]])}))),function(t){return o.apply(this,arguments)}),as_obj:function(t){return t.toObject()},as_array:function(t){return r.pixoscript.utils.ensureArray(t.toObject())},as_table:function(t){for(var e=new r.pixoscript.Table,n=0,o=Object.entries(t);n<o.length;n++){var i=w(o[n],2),a=i[0],s=i[1];e.set(a,s)}return e},log:function(t){console.log(t)},to:function(t,e){for(var r=0,n=Object.entries(e.toObject());r<n.length;r++){var o=w(n[r],2),i=o[0],a=o[1];t[i]=a}},set_mode:function(e,r){try{console.log("pixos.set_mode called ->",e,r);var n=t.spritz.world;if(n&&n.modeManager){var o=r&&"function"==typeof r.toObject?r.toObject():r;n.modeManager.set(e,o)}}catch(t){console.warn("set_mode failed",t)}},get_mode:function(){try{return t.spritz.world.modeManager.getMode()}catch(t){return null}},set_mode_mappings:function(e,r){try{if(console.log("pixos.set_mode_mappings called ->",e,r),t&&t.inputManager){var n=r&&"function"==typeof r.toObject?r.toObject():r;t.inputManager.setModeMappings(e,n)}}catch(t){console.warn("set_mode_mappings failed",t)}},register_mode:function(e,r){try{if(!e)return void console.warn("pixos.register_mode called with undefined name");console.log("pixos.register_mode called ->",e);var n=t.spritz.world;if(!n||!n.modeManager)return;var o={},i=r&&"function"==typeof r.toObject?r.toObject():r||{};i.setup&&(o.setup=i.setup),i.update&&(o.update=i.update),i.teardown&&(o.teardown=i.teardown),i.check_input&&(o.check_input=i.check_input),i.on_select&&(o.on_select=i.on_select),void 0!==i.picker&&(o.picker=i.picker),n.modeManager.register(e,o)}catch(t){console.warn("register_mode failed",t)}},from:function(t,e){return t[e]},length:function(t){return t.length||0},callback_finish:function(t){console.log({msg:"callback finish",success:t}),e.finish&&e.finish(t>0)},set_skybox_shader:(n=A(k().mark((function e(r){var n,o;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=t.renderManager)||void 0===n||null===(o=n.skyboxManager)||void 0===o||!o.setSkyboxShader){e.next=3;break}return e.next=3,t.renderManager.skyboxManager.setSkyboxShader(r);case 3:case"end":return e.stop()}}),e)}))),function(t){return n.apply(this,arguments)}),emit_particles:function(e,r){try{var n=e&&"function"==typeof e.toObject?e.toObject():e||[0,0,0],o=r&&"function"==typeof r.toObject?r.toObject():r||{};if(t.renderManager&&t.renderManager.particleManager){if(o.preset){var i=t.renderManager.particleManager.preset(o.preset);i&&Object.assign(o,i)}t.renderManager.particleManager.emit(n,o)}}catch(t){console.warn("emit_particles failed",t)}},create_particles:function(e,r){try{var n=e&&"function"==typeof e.toObject?e.toObject():e||[0,0,0],o=r||null;if(t.renderManager&&t.renderManager.particleManager){var i=o?t.renderManager.particleManager.preset(o):{};t.renderManager.particleManager.emit(n,i||{})}}catch(t){console.warn("create_particles failed",t)}},clear_particles:function(){try{t.renderManager&&t.renderManager.particleManager&&(t.renderManager.particleManager.particles=[])}catch(t){console.warn("clear_particles failed",t)}},get_particle_count:function(){try{return t.renderManager&&t.renderManager.particleManager?t.renderManager.particleManager.particles.length:0}catch(t){return console.warn("get_particle_count failed",t),0}}}));var n,o})),this.pixoscript=e}));class M extends Error{constructor(t){super(),this.message=t}toString(){return`LuaError: ${this.message}`}}class j{constructor(t){if(this.numValues=[void 0],this.strValues={},this.keys=[],this.values=[],this.metatable=null,void 0!==t)if("function"!=typeof t){if(Array.isArray(t))this.insert(...t);else for(const e in t)if(H(t,e)){let r=t[e];null===r&&(r=void 0),this.set(e,r)}}else t(this)}get(t){const e=this.rawget(t);if(void 0===e&&this.metatable){const e=this.metatable.get("__index");if(e instanceof j)return e.get(t);if("function"==typeof e){const r=e.call(void 0,this,t);return r instanceof Array?r[0]:r}}return e}rawget(t){switch(typeof t){case"string":if(H(this.strValues,t))return this.strValues[t];break;case"number":if(t>0&&t%1==0)return this.numValues[t]}const e=this.keys.indexOf(D(t));return-1===e?void 0:this.values[e]}getMetaMethod(t){return this.metatable&&this.metatable.rawget(t)}set(t,e){const r=this.metatable&&this.metatable.get("__newindex");if(r&&void 0===this.rawget(t)){if(r instanceof j)return r.set(t,e);if("function"==typeof r)return r(this,t,e)}this.rawset(t,e)}setFn(t){return e=>this.set(t,e)}rawset(t,e){switch(typeof t){case"string":return void(this.strValues[t]=e);case"number":if(t>0&&t%1==0)return void(this.numValues[t]=e)}const r=D(t),n=this.keys.indexOf(r);n>-1?this.values[n]=e:(this.values[this.keys.length]=e,this.keys.push(r))}insert(...t){this.numValues.push(...t)}toObject(){const t=0===Object.keys(this.strValues).length&&this.getn()>0,e=t?[]:{};for(let r=1;r<this.numValues.length;r++){const n=this.numValues[r],o=n instanceof j?n.toObject():n;t?e[r-1]=o:e[String(r-1)]=o}for(const t in this.strValues)if(H(this.strValues,t)){const r=this.strValues[t],n=r instanceof j?r.toObject():r;e[t]=n}return e}getn(){const t=this.numValues,e=[];for(const r in t)H(t,r)&&(e[r]=!0);let r=0;for(;e[r+1];)r+=1;if(r>0&&void 0===t[r]){let e=0;for(;r-e>1;){const n=Math.floor((e+r)/2);void 0===t[n]?r=n:e=n}return e}return r}}const I=/^[-+]?[0-9]*\.?([0-9]+([eE][-+]?[0-9]+)?)?$/,B=/^(-)?0x([0-9a-fA-F]*)\.?([0-9a-fA-F]*)$/;function z(t){const e=typeof t;switch(e){case"undefined":return"nil";case"number":case"string":case"boolean":case"function":return e;case"object":if(t instanceof j)return"table";if(t instanceof Function)return"function"}}function D(t){if(t instanceof j){const r=t.getMetaMethod("__tostring");return r?r(t)[0]:e(t,"table: 0x")}return t instanceof Function?e(t,"function: 0x"):G(t);function e(t,e){const r=t.toString();if(r.indexOf(e)>-1)return r;const n=e+Math.floor(4294967295*Math.random()).toString(16);return t.toString=()=>n,n}}function N(t,e){return t>=0?t:-t>e?0:e+t+1}function R(t,e){if(e)throw new M(`${e}`.replace(/%type/gi,z(t)))}function F(t){return!(!1===t||void 0===t)}function U(t,e){if("number"==typeof t)return t;switch(t){case void 0:return;case"inf":return 1/0;case"-inf":return-1/0;case"nan":return NaN}const r=`${t}`;if(r.match(I))return parseFloat(r);const n=r.match(B);if(n){const[,t,e,r]=n;let o=parseInt(e,16)||0;return r&&(o+=parseInt(r,16)/Math.pow(16,r.length)),t&&(o*=-1),o}void 0!==e&&R(t,e)}function G(t,e){if("string"==typeof t)return t;switch(t){case void 0:case null:return"nil";case 1/0:return"inf";case-1/0:return"-inf"}return"number"==typeof t?Number.isNaN(t)?"nan":`${t}`:"boolean"==typeof t?`${t}`:void 0===e?"nil":void R(t,e)}function W(t,e,r,n,o){return e(t,`bad argument #${o} to '${n}' (${r} expected, got %type)`)}function V(t,e,r){return W(t,U,"number",e,r)}function Z(t,e,r){return W(t,G,"string",e,r)}function $(t,e,r){if(t instanceof j)return t;{const n=z(t);throw new M(`bad argument #${r} to '${e}' (table expected, got ${n})`)}}function Y(t,e,r){if(t instanceof Function)return t;{const n=z(t);throw new M(`bad argument #${r} to '${e}' (function expected, got ${n})`)}}const K=t=>t instanceof Array?t:[t],H=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class q{constructor(t={}){this._variables=t}get(t){return this._variables[t]}set(t,e){H(this._variables,t)||!this.parent?this.setLocal(t,e):this.parent.set(t,e)}setLocal(t,e){this._variables[t]=e}setVarargs(t){this._varargs=t}getVarargs(){return this._varargs||this.parent&&this.parent.getVarargs()||[]}extend(){const t=Object.create(this._variables),e=new q(t);return e.parent=this,e}}var X=r(5233);const J=t=>"IfClause"===t.type||"ElseifClause"===t.type||"ElseClause"===t.type||"WhileStatement"===t.type||"DoStatement"===t.type||"RepeatStatement"===t.type||"FunctionDeclaration"===t.type||"ForNumericStatement"===t.type||"ForGenericStatement"===t.type||"Chunk"===t.type;class Q extends String{constructor(t,e){super(),this.base=t,this.property=e}get(){return`__lua.get(${this.base}, ${this.property})`}set(t){return`${this.base}.set(${this.property}, ${t})`}setFn(){return`${this.base}.setFn(${this.property})`}toString(){return this.get()}valueOf(){return this.get()}}const tt={not:"not","-":"unm","~":"bnot","#":"len"},et={"+":"add","-":"sub","*":"mul","%":"mod","^":"pow","/":"div","//":"idiv","&":"band","|":"bor","~":"bxor","<<":"shl",">>":"shr","..":"concat","~=":"neq","==":"eq","<":"lt","<=":"le",">":"gt",">=":"ge"},rt=t=>{switch(t.type){case"LabelStatement":return`case '${t.label.name}': label = undefined`;case"BreakStatement":return"break";case"GotoStatement":return`label = '${t.label.name}'; continue`;case"ReturnStatement":return`return ${it(t.arguments)}`;case"IfStatement":return t.clauses.map((t=>rt(t))).join(" else ");case"IfClause":case"ElseifClause":return`if (__lua.bool(${ot(t.condition)})) {\n${nt(t)}\n}`;case"ElseClause":return`{\n${nt(t)}\n}`;case"WhileStatement":return`while(${ot(t.condition)}) {\n${nt(t)}\n}`;case"DoStatement":return`\n${nt(t)}\n`;case"RepeatStatement":{const e=ot(t.condition);return`do {\n${nt(t)}\n} while (!(${e}))`}case"LocalStatement":case"AssignmentStatement":return st(t);case"CallStatement":return rt(t.expression);case"FunctionDeclaration":{const e=e=>{const r=e.join(";\n"),n=nt(t,r);return`(${0===e.length?"":"...args"}) => {\n${n}${-1===t.body.findIndex((t=>"ReturnStatement"===t.type))?"\nreturn []":""}\n}`},r=t.parameters.map((t=>"VarargLiteral"===t.type?`$${ht.get(t)}.setVarargs(args)`:`$${ht.get(t)}.setLocal('${t.name}', args.shift())`));if(null===t.identifier)return e(r);if("Identifier"===t.identifier.type)return`$${ht.get(t.identifier)}.${t.isLocal?"setLocal":"set"}('${t.identifier.name}', ${e(r)})`;const n=rt(t.identifier);return":"===t.identifier.indexer&&r.unshift(`$${ht.get(t)}.setLocal('self', args.shift())`),n.set(e(r))}case"ForNumericStatement":{const e=t.variable.name,r=`let ${e} = ${ot(t.start)}, end = ${ot(t.end)}, step = ${null===t.step?1:ot(t.step)}`,n=`step > 0 ? ${e} <= end : ${e} >= end`,o=`${e} += step`,i=`$${ht.get(t.variable)}.setLocal('${e}', ${e});`;return`for (${r}; ${n}; ${o}) {\n${nt(t,i)}\n}`}case"ForGenericStatement":{const e=it(t.iterators),r=t.variables.map(((t,e)=>`$${ht.get(t)}.setLocal('${t.name}', res[${e}])`)).join(";\n");return`for (let [iterator, table, next] = ${e}, res = __lua.call(iterator, table, next); res[0] !== undefined; res = __lua.call(iterator, table, res[0])) {\n${nt(t,r)}\n}`}case"Chunk":return`'use strict'\nconst $0 = __lua.globalScope\nlet vars\nlet vals\nlet label\n\n${nt(t)}`;case"Identifier":return`$${ht.get(t)}.get('${t.name}')`;case"StringLiteral":return`\`${t.value.replace(/([^\\])?\\(\d{1,3})/g,((t,e,r)=>`${e||""}${String.fromCharCode(r)}`)).replace(/\\/g,"\\\\").replace(/`/g,"\\`")}\``;case"NumericLiteral":return t.value.toString();case"BooleanLiteral":return t.value?"true":"false";case"NilLiteral":return"undefined";case"VarargLiteral":return`$${ht.get(t)}.getVarargs()`;case"TableConstructorExpression":return 0===t.fields.length?"new __lua.Table()":`new __lua.Table(t => {\n${t.fields.map(((t,e,r)=>"TableKey"===t.type?`t.rawset(${rt(t.key)}, ${ot(t.value)})`:"TableKeyString"===t.type?`t.rawset('${t.key.name}', ${ot(t.value)})`:"TableValue"===t.type?e===r.length-1&&ut(t.value)?`t.insert(...${rt(t.value)})`:`t.insert(${ot(t.value)})`:void 0)).join(";\n")}\n})`;case"UnaryExpression":{const e=tt[t.operator],r=ot(t.argument);if(!e)throw new Error(`Unhandled unary operator: ${t.operator}`);return`__lua.${e}(${r})`}case"BinaryExpression":{const e=ot(t.left),r=ot(t.right),n=et[t.operator];if(!n)throw new Error(`Unhandled binary operator: ${t.operator}`);return`__lua.${n}(${e}, ${r})`}case"LogicalExpression":{const e=ot(t.left),r=ot(t.right),n=t.operator;if("and"===n)return`__lua.and(${e},${r})`;if("or"===n)return`__lua.or(${e},${r})`;throw new Error(`Unhandled logical operator: ${t.operator}`)}case"MemberExpression":{const e=ot(t.base);return new Q(e,`'${t.identifier.name}'`)}case"IndexExpression":{const e=ot(t.base),r=ot(t.index);return new Q(e,r)}case"CallExpression":case"TableCallExpression":case"StringCallExpression":{const e=ot(t.base),r="CallExpression"===t.type?at(t.arguments).join(", "):ot("TableCallExpression"===t.type?t.arguments:t.argument);return e instanceof Q&&"MemberExpression"===t.base.type&&":"===t.base.indexer?`__lua.call(${e}, ${e.base}, ${r})`:`__lua.call(${e}, ${r})`}default:throw new Error(`No generator found for: ${t.type}`)}},nt=(t,e="")=>{const r=ht.get(t),n=void 0===r?"":`const $${r} = $${ft.get(r)}.extend();`,o=t.body.map((t=>rt(t))).join(";\n"),i=pt.get(t);if(void 0===i)return`${n}\n${e}\n${o}`;const a=`L${i}: do { switch(label) { case undefined:`,s=dt.get(i);return`${n}\n${a}\n${e}\n${o}\n${(void 0===s?"":`break; default: continue L${s}\n`)+"} } while (label)"}`},ot=t=>{const e=rt(t);return ut(t)?`${e}[0]`:e},it=t=>1===t.length&&ut(t[0])?rt(t[0]):`[${at(t).join(", ")}]`,at=t=>t.map(((t,e,r)=>{const n=rt(t);return ut(t)?e===r.length-1?`...${n}`:`${n}[0]`:n})),st=t=>{const e=[],r=[],n=t.variables.length>1&&t.init.length>0&&!t.init.every(lt);for(let o=0;o<t.variables.length;o++){const i=t.variables[o],a=t.init[o],s=n?`vars[${o}]`:void 0===a?"undefined":ot(a);if("Identifier"===i.type){const r="LocalStatement"===t.type?"setLocal":"set";e.push(`$${ht.get(i)}.${r}('${i.name}', ${s})`)}else{const t=rt(i);n?(e.push(`vals[${r.length}](${s})`),r.push(t.setFn())):e.push(t.set(s))}}for(let r=t.variables.length;r<t.init.length;r++){const n=t.init[r];ct(n)&&e.push(rt(n))}return n&&(e.unshift(`vars = ${it(t.init)}`),r.length>0&&e.unshift(`vals = [${r.join(", ")}]`)),e.join(";\n")},ct=t=>"CallExpression"===t.type||"StringCallExpression"===t.type||"TableCallExpression"===t.type,ut=t=>ct(t)||"VarargLiteral"===t.type,lt=t=>"StringLiteral"===t.type||"NumericLiteral"===t.type||"BooleanLiteral"===t.type||"NilLiteral"===t.type||"TableConstructorExpression"===t.type,ft=new Map,ht=new Map,dt=new Map,pt=new Map,yt=t=>{const e=X.parse(t.replace(/^#.*/,""),{scope:!1,comments:!1,luaVersion:"5.3",encodingMode:"x-user-defined"});return(t=>{const e=[];let r=0;const n=new Map,o=(()=>{let t=0;return()=>(t+=1,t)})(),i=t=>{if(J(t)){!function(){const t=r;r=o(),n.set(r,t)}();for(let n=0;n<t.body.length;n++){const o=t.body[n];switch(o.type){case"LocalStatement":e.push({type:"local",name:o.variables[0].name,scope:r});break;case"LabelStatement":if(e.find((t=>"label"===t.type&&t.name===o.label.name&&t.scope===r)))throw new Error(`label '${o.label.name}' already defined`);e.push({type:"label",name:o.label.name,scope:r,last:"RepeatStatement"!==t.type&&t.body.slice(n).every((t=>"LabelStatement"===t.type))});break;case"GotoStatement":e.push({type:"goto",name:o.label.name,scope:r});break;case"IfStatement":o.clauses.forEach((t=>i(t)));break;default:i(o)}}r=n.get(r)}};i(t);for(let t=0;t<e.length;t++){const r=e[t];if("goto"===r.type){const n=e.filter((t=>"label"===t.type&&t.name===r.name&&t.scope<=r.scope)).sort(((t,e)=>Math.abs(r.scope-t.scope)-Math.abs(r.scope-e.scope)))[0];if(!n)throw new Error(`no visible label '${r.name}' for <goto>`);const o=e.findIndex((t=>t===n));if(o>t){const i=e.slice(t,o).filter((t=>"local"===t.type&&t.scope===n.scope));if(!n.last&&i.length>0)throw new Error(`<goto ${r.name}> jumps into the scope of local '${i[0].name}'`)}}}})(e),(t=>{let e=0,r=0;const n=(t,o,i)=>{let a=o,s=i;J(t)?((-1!==t.body.findIndex((t=>"LocalStatement"===t.type||"FunctionDeclaration"===t.type&&t.isLocal))||"FunctionDeclaration"===t.type&&(t.parameters.length>0||t.identifier&&"MemberExpression"===t.identifier.type)||"ForNumericStatement"===t.type||"ForGenericStatement"===t.type)&&(e+=1,a=e,ht.set(t,e),ft.set(e,o)),-1!==t.body.findIndex((t=>"LabelStatement"===t.type||"GotoStatement"===t.type))&&(s=r,pt.set(t,r),"Chunk"!==t.type&&"FunctionDeclaration"!==t.type&&dt.set(r,i),r+=1)):"Identifier"!==t.type&&"VarargLiteral"!==t.type||ht.set(t,o),((t,e,r,n,o)=>{const i=(t,i=!0)=>{if(!t)return;const a=!1===i&&n?ft.get(r):r;Array.isArray(t)?t.forEach((t=>e(t,a,o))):e(t,a,o)};switch(t.type){case"LocalStatement":case"AssignmentStatement":i(t.variables),i(t.init);break;case"UnaryExpression":i(t.argument);break;case"BinaryExpression":case"LogicalExpression":i(t.left),i(t.right);break;case"FunctionDeclaration":i(t.identifier,!1),i(t.parameters),i(t.body);break;case"ForGenericStatement":i(t.variables),i(t.iterators,!1),i(t.body);break;case"IfClause":case"ElseifClause":case"WhileStatement":case"RepeatStatement":i(t.condition,!1);case"Chunk":case"ElseClause":case"DoStatement":i(t.body);break;case"ForNumericStatement":i(t.variable),i(t.start,!1),i(t.end,!1),i(t.step,!1),i(t.body);break;case"ReturnStatement":i(t.arguments);break;case"IfStatement":i(t.clauses);break;case"MemberExpression":i(t.base),i(t.identifier);break;case"IndexExpression":i(t.base),i(t.index);break;case"LabelStatement":i(t.label);break;case"CallStatement":i(t.expression);break;case"GotoStatement":i(t.label);break;case"TableConstructorExpression":i(t.fields);break;case"TableKey":case"TableKeyString":i(t.key);case"TableValue":i(t.value);break;case"CallExpression":case"TableCallExpression":i(t.base),i(t.arguments);break;case"StringCallExpression":i(t.base),i(t.argument)}})(t,n,a,o!==a,s)};n(t,e,r)})(e),rt(e).toString()};const gt="1.3.1";var mt={};function vt(t){if(mt[t])return mt[t];for(var e=[],r=0,n=0,o=!1,i="",a="",s="",c="",u="",l=0,f=t.length;n<f;++n)if(l=t.charCodeAt(n),o)if(l>=48&&l<58)c.length?c+=String.fromCharCode(l):48!=l||s.length?s+=String.fromCharCode(l):a+=String.fromCharCode(l);else switch(l){case 36:c.length?c+="$":"*"==s.charAt(0)?s+="$":(i=s+"$",s="");break;case 39:a+="'";break;case 45:a+="-";break;case 43:a+="+";break;case 32:a+=" ";break;case 35:a+="#";break;case 46:c=".";break;case 42:"."==c.charAt(0)?c+="*":s+="*";break;case 104:case 108:if(u.length>1)throw"bad length "+u+String(l);u+=String.fromCharCode(l);break;case 76:case 106:case 122:case 116:case 113:case 90:case 119:if(""!==u)throw"bad length "+u+String.fromCharCode(l);u=String.fromCharCode(l);break;case 73:if(""!==u)throw"bad length "+u+"I";u="I";break;case 100:case 105:case 111:case 117:case 120:case 88:case 102:case 70:case 101:case 69:case 103:case 71:case 97:case 65:case 99:case 67:case 115:case 83:case 112:case 110:case 68:case 85:case 79:case 109:case 98:case 66:case 121:case 89:case 74:case 86:case 84:case 37:o=!1,c.length>1&&(c=c.substr(1)),e.push([String.fromCharCode(l),t.substring(r,n+1),i,a,s,c,u]),r=n+1,u=c=s=a=i="";break;default:throw new Error("Invalid format string starting with |"+t.substring(r,n+1)+"|")}else{if(37!==l)continue;r<n&&e.push(["L",t.substring(r,n)]),r=n,o=!0}return r<t.length&&e.push(["L",t.substring(r)]),mt[t]=e}var bt=JSON.stringify;function wt(t,e){for(var r="",n=0,o=0,i=0,a="",s=0;s<t.length;++s){var c=t[s],u=c[0].charCodeAt(0);if(76!==u)if(37!==u){var l="",f=0,h=10,d=4,p=!1,y=c[3],g=y.indexOf("#")>-1;if(c[2])n=parseInt(c[2],10)-1;else if(109===u&&!g){r+="Success";continue}var m=0;c[4].length>0&&(m="*"!==c[4].charAt(0)?parseInt(c[4],10):1===c[4].length?e[o++]:e[parseInt(c[4].substr(1),10)-1]);var v=-1;c[5].length>0&&(v="*"!==c[5].charAt(0)?parseInt(c[5],10):1===c[5].length?e[o++]:e[parseInt(c[5].substr(1),10)-1]),c[2]||(n=o++);var b=e[n],w=c[6];switch(u){case 83:case 115:l=String(b),v>=0&&(l=l.substr(0,v)),(m>l.length||-m>l.length)&&((-1==y.indexOf("-")||m<0)&&-1!=y.indexOf("0")?l=(a=m-l.length>=0?"0".repeat(m-l.length):"")+l:(a=m-l.length>=0?" ".repeat(m-l.length):"",l=y.indexOf("-")>-1?l+a:a+l));break;case 67:case 99:switch(typeof b){case"number":var x=b;67==u||108===w.charCodeAt(0)?(x&=4294967295,l=String.fromCharCode(x)):(x&=255,l=String.fromCharCode(x));break;case"string":l=b.charAt(0);break;default:l=String(b).charAt(0)}(m>l.length||-m>l.length)&&((-1==y.indexOf("-")||m<0)&&-1!=y.indexOf("0")?l=(a=m-l.length>=0?"0".repeat(m-l.length):"")+l:(a=m-l.length>=0?" ".repeat(m-l.length):"",l=y.indexOf("-")>-1?l+a:a+l));break;case 68:d=8;case 100:case 105:f=-1,p=!0;break;case 85:d=8;case 117:f=-1;break;case 79:d=8;case 111:f=-1,h=8;break;case 120:f=-1,h=-16;break;case 88:f=-1,h=16;break;case 66:d=8;case 98:f=-1,h=2;break;case 70:case 102:f=1;break;case 69:case 101:f=2;break;case 71:case 103:f=3;break;case 65:case 97:f=4;break;case 112:i="number"==typeof b?b:b?Number(b.l):-1,isNaN(i)&&(i=-1),l=g?i.toString(10):"0x"+(i=Math.abs(i)).toString(16).toLowerCase();break;case 110:b&&(b.len=r.length);continue;case 109:l=b instanceof Error?b.message?b.message:b.errno?"Error number "+b.errno:"Error "+String(b):"Success";break;case 74:l=(g?bt:JSON.stringify)(b);break;case 86:l=null==b?"null":String(b.valueOf());break;case 84:l=g?(l=Object.prototype.toString.call(b).substr(8)).substr(0,l.length-1):typeof b;break;case 89:case 121:l=b?g?"yes":"true":g?"no":"false",89==u&&(l=l.toUpperCase()),v>=0&&(l=l.substr(0,v)),(m>l.length||-m>l.length)&&((-1==y.indexOf("-")||m<0)&&-1!=y.indexOf("0")?l=(a=m-l.length>=0?"0".repeat(m-l.length):"")+l:(a=m-l.length>=0?" ".repeat(m-l.length):"",l=y.indexOf("-")>-1?l+a:a+l))}if(m<0&&(m=-m,y+="-"),-1==f){switch(i=Number(b),w){case"hh":d=1;break;case"h":d=2;break;case"l":case"L":case"q":case"ll":case"j":case"t":case"z":case"Z":case"I":4==d&&(d=8)}switch(d){case 1:i&=255,p&&i>127&&(i-=256);break;case 2:i&=65535,p&&i>32767&&(i-=65536);break;case 4:i=p?0|i:i>>>0;break;default:i=isNaN(i)?0:Math.round(i)}if(d>4&&i<0&&!p)if(16==h||-16==h)l=(i>>>0).toString(16),l=(16-(l=((i=Math.floor((i-(i>>>0))/Math.pow(2,32)))>>>0).toString(16)+(8-l.length>=0?"0".repeat(8-l.length):"")+l).length>=0?"f".repeat(16-l.length):"")+l,16==h&&(l=l.toUpperCase());else if(8==h)l=(10-(l=(i>>>0).toString(8)).length>=0?"0".repeat(10-l.length):"")+l,l="1"+(21-(l=(l=((i=Math.floor((i-(i>>>0&1073741823))/Math.pow(2,30)))>>>0).toString(8)+l.substr(l.length-10)).substr(l.length-20)).length>=0?"7".repeat(21-l.length):"")+l;else{i=-i%1e16;for(var _=[1,8,4,4,6,7,4,4,0,7,3,7,0,9,5,5,1,6,1,6],k=_.length-1;i>0;)(_[k]-=i%10)<0&&(_[k]+=10,_[k-1]--),--k,i=Math.floor(i/10);l=_.join("")}else l=-16===h?i.toString(16).toLowerCase():16===h?i.toString(16).toUpperCase():i.toString(h);if(0!==v||"0"!=l||8==h&&g){if(l.length<v+("-"==l.substr(0,1)?1:0)&&(l="-"!=l.substr(0,1)?(v-l.length>=0?"0".repeat(v-l.length):"")+l:l.substr(0,1)+(v+1-l.length>=0?"0".repeat(v+1-l.length):"")+l.substr(1)),!p&&g&&0!==i)switch(h){case-16:l="0x"+l;break;case 16:l="0X"+l;break;case 8:"0"!=l.charAt(0)&&(l="0"+l);break;case 2:l="0b"+l}}else l="";p&&"-"!=l.charAt(0)&&(y.indexOf("+")>-1?l="+"+l:y.indexOf(" ")>-1&&(l=" "+l)),m>0&&l.length<m&&(y.indexOf("-")>-1?l+=m-l.length>=0?" ".repeat(m-l.length):"":y.indexOf("0")>-1&&v<0&&l.length>0?(v>l.length&&(l=(v-l.length>=0?"0".repeat(v-l.length):"")+l),a=m-l.length>=0?(v>0?" ":"0").repeat(m-l.length):"",l=l.charCodeAt(0)<48?"x"==l.charAt(2).toLowerCase()?l.substr(0,3)+a+l.substring(3):l.substr(0,1)+a+l.substring(1):"x"==l.charAt(1).toLowerCase()?l.substr(0,2)+a+l.substring(2):a+l):l=(m-l.length>=0?" ".repeat(m-l.length):"")+l)}else if(f>0){i=Number(b),null===b&&(i=NaN),"L"==w&&(d=12);var E=isFinite(i);if(E){var A=0;-1==v&&4!=f&&(v=6),3==f&&(0===v&&(v=1),v>(A=+(l=i.toExponential(1)).substr(l.indexOf("e")+1))&&A>=-4?(f=11,v-=A+1):(f=12,v-=1));var S=i<0||1/i==-1/0?"-":"";switch(i<0&&(i=-i),f){case 1:case 11:if(i<1e21){l=i.toFixed(v),1==f?0===v&&g&&-1==l.indexOf(".")&&(l+="."):g?-1==l.indexOf(".")&&(l+="."):l=l.replace(/(\.\d*[1-9])0*$/,"$1").replace(/\.0*$/,"");break}A=+(l=i.toExponential(20)).substr(l.indexOf("e")+1),l=l.charAt(0)+l.substr(2,l.indexOf("e")-2),l+=A-l.length+1>=0?"0".repeat(A-l.length+1):"",(g||v>0&&11!==f)&&(l=l+"."+(v>=0?"0".repeat(v):""));break;case 2:case 12:A=(l=i.toExponential(v)).indexOf("e"),l.length-A==3&&(l=l.substr(0,A+2)+"0"+l.substr(A+2)),g&&-1==l.indexOf(".")?l=l.substr(0,A)+"."+l.substr(A):g||12!=f||(l=l.replace(/\.0*e/,"e").replace(/\.(\d*[1-9])0*e/,".$1e"));break;case 4:if(0===i){l="0x0"+(g||v>0?"."+(v>=0?"0".repeat(v):""):"")+"p+0";break}var L=(l=i.toString(16)).charCodeAt(0);if(48==L){for(L=2,A=-4,i*=16;48==l.charCodeAt(L++);)A-=4,i*=16;L=(l=i.toString(16)).charCodeAt(0)}var O=l.indexOf(".");if(l.indexOf("(")>-1){var P=l.match(/\(e(.*)\)/),T=P?+P[1]:0;A+=4*T,i/=Math.pow(16,T)}else O>1?(A+=4*(O-1),i/=Math.pow(16,O-1)):-1==O&&(A+=4*(l.length-1),i/=Math.pow(16,l.length-1));if(d>8?L<50?(A-=3,i*=8):L<52?(A-=2,i*=4):L<56&&(A-=1,i*=2):L>=56?(A+=3,i/=8):L>=52?(A+=2,i/=4):L>=50&&(A+=1,i/=2),(l=i.toString(16)).length>1){if(l.length>v+2&&l.charCodeAt(v+2)>=56){var C=102==l.charCodeAt(0);l=(i+8*Math.pow(16,-v-1)).toString(16),C&&49==l.charCodeAt(0)&&(A+=4)}v>0?(l=l.substr(0,v+2)).length<v+2&&(l.charCodeAt(0)<48?l=l.charAt(0)+(v+2-l.length>=0?"0".repeat(v+2-l.length):"")+l.substr(1):l+=v+2-l.length>=0?"0".repeat(v+2-l.length):""):0===v&&(l=l.charAt(0)+(g?".":""))}else v>0?l=l+"."+(v>=0?"0".repeat(v):""):g&&(l+=".");l="0x"+l+"p"+(A>=0?"+"+A:A)}""===S&&(y.indexOf("+")>-1?S="+":y.indexOf(" ")>-1&&(S=" ")),l=S+l}else i<0?l="-":y.indexOf("+")>-1?l="+":y.indexOf(" ")>-1&&(l=" "),l+=isNaN(i)?"nan":"inf";m>l.length&&(y.indexOf("-")>-1?l+=m-l.length>=0?" ".repeat(m-l.length):"":y.indexOf("0")>-1&&l.length>0&&E?(a=m-l.length>=0?"0".repeat(m-l.length):"",l=l.charCodeAt(0)<48?"x"==l.charAt(2).toLowerCase()?l.substr(0,3)+a+l.substring(3):l.substr(0,1)+a+l.substring(1):"x"==l.charAt(1).toLowerCase()?l.substr(0,2)+a+l.substring(2):a+l):l=(m-l.length>=0?" ".repeat(m-l.length):"")+l),u<96&&(l=l.toUpperCase())}r+=l}else r+="%";else r+=c[1]}return r}function xt(t,e){return wt(vt(t),e)}function _t(){for(var t=new Array(arguments.length-1),e=0;e<t.length;++e)t[e]=arguments[e+1];return wt(vt(arguments[0]),t)}const{sprintf:kt}=o,Et={"([^a-zA-Z0-9%(])-":"$1*?","([^%])-([^a-zA-Z0-9?])":"$1*?$2","([^%])\\.":"$1[\\s\\S]","(.)-$":"$1*?","%a":"[a-zA-Z]","%A":"[^a-zA-Z]","%c":"[\0-]","%C":"[^\0-]","%d":"\\d","%D":"[^d]","%l":"[a-z]","%L":"[^a-z]","%p":"[.,\"'?!;:#$%&()*+-/<>=@\\[\\]\\\\^_{}|~]","%P":"[^.,\"'?!;:#$%&()*+-/<>=@\\[\\]\\\\^_{}|~]","%s":"[ \\t\\n\\f\\v\\r]","%S":"[^ \t\n\f\v\r]","%u":"[A-Z]","%U":"[^A-Z]","%w":"[a-zA-Z0-9]","%W":"[^a-zA-Z0-9]","%x":"[a-fA-F0-9]","%X":"[^a-fA-F0-9]","%([^a-zA-Z])":"\\$1"};function At(t){let e=t.replace(/\\/g,"\\\\");for(const t in Et)H(Et,t)&&(e=e.replace(new RegExp(t,"g"),Et[t]));let r=0;for(let t=0,n=e.length;t<n;t++){if(t&&"\\"===e.substr(t-1,1))continue;const o=e.substr(t,1);"["!==o&&"]"!==o||("]"===o&&(r-=1),r>0&&(e=e.substr(0,t)+e.substr(t+1),t-=1,n-=1),"["===o&&(r+=1))}return e}const St=new j({byte:function(t,e,r){const n=Z(t,"byte",1),o=void 0===e?1:V(e,"byte",2),i=void 0===r?o:V(r,"byte",3);return n.substring(o-1,i).split("").map((t=>t.charCodeAt(0)))},char:function(...t){return t.map(((t,e)=>{const r=V(t,"char",e);return String.fromCharCode(r)})).join("")},find:function(t,e,r,n){const o=Z(t,"find",1),i=Z(e,"find",2),a=void 0===r?1:V(r,"find",3);if(void 0===n||!V(n,"find",4)){const t=new RegExp(At(i)),e=o.substr(a-1).search(t);if(e<0)return;const r=o.substr(a-1).match(t),n=[e+a,e+a+r[0].length-1];return r.shift(),[...n,...r]}const s=o.indexOf(i,a-1);return-1===s?void 0:[s+1,s+i.length]},format:function(t,...e){let r=-1;return t.replace(/%%|%([-+ #0]*)?(\d*)?(?:\.(\d*))?(.)/g,((t,n,o,i,a)=>{if("%%"===t)return"%";if(!a.match(/[AEGXacdefgioqsux]/))throw new M(`invalid option '%${t}' to 'format'`);if(n&&n.length>5)throw new M("invalid format (repeated flags)");if(o&&o.length>2)throw new M("invalid format (width too long)");if(i&&i.length>2)throw new M("invalid format (precision too long)");r+=1;const s=e[r];if(void 0===s)throw new M(`bad argument #${r} to 'format' (no value)`);return/A|a|E|e|f|G|g/.test(a)||/c|d|i|o|u|X|x/.test(a)?kt(t,V(s,"format",r)):"q"===a?`"${s.replace(/([\n"])/g,"\\$1")}"`:kt(t,"s"===a?D(s):s)}))},gmatch:function(t,e){const r=Z(t,"gmatch",1),n=At(Z(e,"gmatch",2)),o=new RegExp(n,"g"),i=r.match(o);return()=>{const t=i.shift();if(void 0===t)return[];const e=new RegExp(n).exec(t);return e.shift(),e.length?e:[t]}},gsub:function(t,e,r,n){let o=Z(t,"gsub",1);const i=void 0===n?1/0:V(n,"gsub",3),a=At(Z(e,"gsub",2)),s="function"==typeof r?t=>{const e=r(t[0])[0];return void 0===e?t[0]:e}:r instanceof j?t=>r.get(t[0]).toString():t=>`${r}`.replace(/%([0-9])/g,((e,r)=>t[r]));let c,u,l="",f=0;for(;f<i&&o&&(c=o.match(a));){const t=c[0].length>0?o.substr(0,c.index):void 0===u?"":o.substr(0,1);u=c[0],l+=`${t}${s(c)}`,o=o.substr(`${t}${u}`.length),f+=1}return`${l}${o}`},len:function(t){return Z(t,"len",1).length},lower:function(t){return Z(t,"lower",1).toLowerCase()},match:function(t,e,r=0){let n=Z(t,"match",1);const o=Z(e,"match",2),i=V(r,"match",3);n=n.substr(i);const a=n.match(new RegExp(At(o)));if(a)return a[1]?(a.shift(),a):a[0]},rep:function(t,e,r){const n=Z(t,"rep",1),o=V(e,"rep",2),i=void 0===r?"":Z(r,"rep",3);return Array(o).fill(n).join(i)},reverse:function(t){return Z(t,"reverse",1).split("").reverse().join("")},sub:function(t,e=1,r=-1){const n=Z(t,"sub",1);let o=N(V(e,"sub",2),n.length),i=N(V(r,"sub",3),n.length);return o<1&&(o=1),i>n.length&&(i=n.length),o<=i?n.substr(o-1,i-o+1):""},upper:function(t){return Z(t,"upper",1).toUpperCase()}}),Lt=new j({__index:St});function Ot(t,e){if(void 0===e)throw new M("Bad argument #2 to ipairs() iterator");const r=e+1,n=t.numValues;if(n[r]&&void 0!==n[r])return[r,n[r]]}function Pt(t,e){if(F(t))return[t,e];const r=void 0===e?"Assertion failed!":Z(e,"assert",2);throw new M(r)}function Tt(){return[]}function Ct(t){const e=Z(t,"error",1);throw new M(e)}function Mt(t){if(t instanceof j&&t.metatable){return t.metatable.rawget("__metatable")||t.metatable}if("string"==typeof t)return Lt}function jt(t){const e=$(t,"ipairs",1),r=e.getMetaMethod("__pairs")||e.getMetaMethod("__ipairs");return r?r(e).slice(0,3):[Ot,e,0]}function It(t,e){const r=$(t,"next",1);let n=void 0===e;if(n||"number"==typeof e&&e>0){const t=r.numValues,o=Object.keys(t);let i=1;if(!n){const t=o.indexOf(`${e}`);t>=0&&(n=!0,i+=t)}if(n)for(;void 0!==o[i];i++){const e=Number(o[i]),r=t[e];if(void 0!==r)return[e,r]}}for(const t in r.strValues)if(H(r.strValues,t))if(n){if(void 0!==r.strValues[t])return[t,r.strValues[t]]}else t===e&&(n=!0);for(const t in r.keys)if(H(r.keys,t)){const o=r.keys[t];if(n){if(void 0!==r.values[t])return[o,r.values[t]]}else o===e&&(n=!0)}}function Bt(t){const e=$(t,"pairs",1),r=e.getMetaMethod("__pairs");return r?r(e).slice(0,3):[It,e,void 0]}function zt(t,...e){if("function"!=typeof t)throw new M("Attempt to call non-function");try{return[!0,...t(...e)]}catch(t){return[!1,t&&t.toString()]}}function Dt(t,e){return t===e}function Nt(t,e){return $(t,"rawget",1).rawget(e)}function Rt(t){if(t instanceof j)return t.getn();if("string"==typeof t)return t.length;throw new M("attempt to get length of an unsupported value")}function Ft(t,e,r){const n=$(t,"rawset",1);if(void 0===e)throw new M("table index is nil");return n.rawset(e,r),n}function Ut(t,...e){if("#"===t)return e.length;if("number"==typeof t){const r=N(Math.trunc(t),e.length);return e.slice(r-1)}throw new M(`bad argument #1 to 'select' (number expected, got ${z(t)})`)}function Gt(t,e){const r=$(t,"setmetatable",1);if(r.metatable&&r.metatable.rawget("__metatable"))throw new M("cannot change a protected metatable");return r.metatable=null==e?null:$(e,"setmetatable",2),r}function Wt(t,e){const r=G(t).trim(),n=void 0===e?10:V(e,"tonumber",2);if(10!==n&&"nil"===r)throw new M("bad argument #1 to 'tonumber' (string expected, got nil)");if(n<2||n>36)throw new M("bad argument #2 to 'tonumber' (base out of range)");if(""!==r)return 10===n?U(r):new RegExp(`^${16===n?"(0x)?":""}[${"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".substr(0,n)}]*$`,"gi").test(r)?parseInt(r,n):void 0}function Vt(t,e,...r){if("function"!=typeof t||"function"!=typeof e)throw new M("Attempt to call non-function");try{return[!0,...t(...r)]}catch(t){return[!1,e(t)[0]]}}const Zt=(t,e,r,n)=>{const o=t instanceof j&&t.getMetaMethod(r)||e instanceof j&&e.getMetaMethod(r);return o?o(t,e)[0]:n(U(t,"attempt to perform arithmetic on a %type value"),U(e,"attempt to perform arithmetic on a %type value"))},$t=(t,e,r,n)=>"string"==typeof t&&"string"==typeof e||"number"==typeof t&&"number"==typeof e?n(t,e):Zt(t,e,r,n),Yt=t=>F(t),Kt=(t,e)=>{const r=e!==t&&t instanceof j&&e instanceof j&&t.metatable===e.metatable&&t.getMetaMethod("__eq");return r?!!r(t,e)[0]:t===e},Ht=(t,e)=>$t(t,e,"__lt",((t,e)=>t<e)),qt=(t,e)=>$t(t,e,"__le",((t,e)=>t<=e)),Xt={bool:Yt,and:(t,e)=>F(t)?e:t,or:(t,e)=>F(t)?t:e,not:t=>!Yt(t),unm:t=>{const e=t instanceof j&&t.getMetaMethod("__unm");return e?e(t)[0]:-1*U(t,"attempt to perform arithmetic on a %type value")},bnot:t=>{const e=t instanceof j&&t.getMetaMethod("__bnot");return e?e(t)[0]:~U(t,"attempt to perform arithmetic on a %type value")},len:t=>{if(t instanceof j){const e=t.getMetaMethod("__len");return e?e(t)[0]:t.getn()}if("string"==typeof t)return t.length;throw new M("attempt to get length of an unsupported value")},add:(t,e)=>Zt(t,e,"__add",((t,e)=>t+e)),sub:(t,e)=>Zt(t,e,"__sub",((t,e)=>t-e)),mul:(t,e)=>Zt(t,e,"__mul",((t,e)=>t*e)),mod:(t,e)=>Zt(t,e,"__mod",((t,e)=>{if(0===e||e===-1/0||e===1/0||isNaN(t)||isNaN(e))return NaN;const r=Math.abs(e);let n=Math.abs(t)%r;return t*e<0&&(n=r-n),e<0&&(n*=-1),n})),pow:(t,e)=>Zt(t,e,"__pow",Math.pow),div:(t,e)=>Zt(t,e,"__div",((t,e)=>{if(void 0===e)throw new M("attempt to perform arithmetic on a nil value");return t/e})),idiv:(t,e)=>Zt(t,e,"__idiv",((t,e)=>{if(void 0===e)throw new M("attempt to perform arithmetic on a nil value");return Math.floor(t/e)})),band:(t,e)=>Zt(t,e,"__band",((t,e)=>t&e)),bor:(t,e)=>Zt(t,e,"__bor",((t,e)=>t|e)),bxor:(t,e)=>Zt(t,e,"__bxor",((t,e)=>t^e)),shl:(t,e)=>Zt(t,e,"__shl",((t,e)=>t<<e)),shr:(t,e)=>Zt(t,e,"__shr",((t,e)=>t>>e)),concat:(t,e)=>{const r=t instanceof j&&t.getMetaMethod("__concat")||e instanceof j&&e.getMetaMethod("__concat");return r?r(t,e)[0]:`${G(t,"attempt to concatenate a %type value")}${G(e,"attempt to concatenate a %type value")}`},neq:(t,e)=>!Kt(t,e),eq:Kt,lt:Ht,le:qt,gt:(t,e)=>!qt(t,e),ge:(t,e)=>!Ht(t,e)},Jt=Number.MAX_SAFE_INTEGER,Qt=Number.MIN_SAFE_INTEGER,te=Math.PI;let ee=1;function re(){return ee=16807*ee%2147483647,ee/2147483647}function ne(t,e){const r=V(t,"atan",1),n=void 0===e?1:V(e,"atan",2);return Math.atan2(r,n)}function oe(t){const e=V(t,"exp",1);return Math.exp(e)}function ie(t){const e=U(t);if(void 0!==e)return Math.floor(e)}const ae=new j({abs:function(t){const e=V(t,"abs",1);return Math.abs(e)},acos:function(t){const e=V(t,"acos",1);return Math.acos(e)},asin:function(t){const e=V(t,"asin",1);return Math.asin(e)},atan:ne,atan2:function(t,e){return ne(t,e)},ceil:function(t){const e=V(t,"ceil",1);return Math.ceil(e)},cos:function(t){const e=V(t,"cos",1);return Math.cos(e)},cosh:function(t){const e=V(t,"cosh",1);return(oe(e)+oe(-e))/2},deg:function(t){return 180*V(t,"deg",1)/Math.PI},exp:oe,floor:function(t){const e=V(t,"floor",1);return Math.floor(e)},fmod:function(t,e){return V(t,"fmod",1)%V(e,"fmod",2)},frexp:function(t){let e=V(t,"frexp",1);if(0===e)return[0,0];const r=e>0?1:-1;e*=r;const n=Math.floor(Math.log(e)/Math.log(2))+1;return[e/Math.pow(2,n)*r,n]},huge:1/0,ldexp:function(t,e){const r=V(t,"ldexp",1),n=V(e,"ldexp",2);return r*Math.pow(2,n)},log:function(t,e){const r=V(t,"log",1);if(void 0===e)return Math.log(r);{const t=V(e,"log",2);return Math.log(r)/Math.log(t)}},log10:function(t){const e=V(t,"log10",1);return Math.log(e)/Math.log(10)},max:function(...t){const e=t.map(((t,e)=>V(t,"max",e+1)));return Math.max(...e)},min:function(...t){const e=t.map(((t,e)=>V(t,"min",e+1)));return Math.min(...e)},maxinteger:Jt,mininteger:Qt,modf:function(t){const e=V(t,"modf",1),r=Math.floor(e);return[r,e-r]},pi:te,pow:function(t,e){const r=V(t,"pow",1),n=V(e,"pow",2);return Math.pow(r,n)},rad:function(t){const e=V(t,"rad",1);return Math.PI/180*e},random:function(t,e){if(void 0===t&&void 0===e)return re();const r=V(t,"random",1),n=void 0!==e?r:1,o=void 0!==e?V(e,"random",2):r;if(n>o)throw new Error("bad argument #2 to 'random' (interval is empty)");return Math.floor(re()*(o-n+1)+n)},randomseed:function(t){ee=V(t,"randomseed",1)},sin:function(t){const e=V(t,"sin",1);return Math.sin(e)},sinh:function(t){const e=V(t,"sinh",1);return(oe(e)-oe(-e))/2},sqrt:function(t){const e=V(t,"sqrt",1);return Math.sqrt(e)},tan:function(t){const e=V(t,"tan",1);return Math.tan(e)},tanh:function(t){const e=V(t,"tanh",1);return(oe(e)-oe(-e))/(oe(e)+oe(-e))},tointeger:ie,type:function(t){const e=U(t);if(void 0!==e)return ie(e)===e?"integer":"float"},ult:function(t,e){const r=V(t,"ult",1),n=V(e,"ult",2),o=t=>t>>>0;return o(r)<o(n)}});function se(t){return $(t,"maxn",1).numValues.length-1}const ce=new j({getn:function(t){return $(t,"getn",1).getn()},concat:function(t,e="",r=1,n){const o=$(t,"concat",1),i=Z(e,"concat",2),a=V(r,"concat",3),s=void 0===n?se(o):V(n,"concat",4);return[].concat(o.numValues).splice(a,s-a+1).join(i)},insert:function(t,e,r){const n=$(t,"insert",1),o=void 0===r?n.numValues.length:V(e,"insert",2),i=void 0===r?e:r;n.numValues.splice(o,0,void 0),n.set(o,i)},maxn:se,move:function(t,e,r,n,o){const i=$(t,"move",1),a=V(e,"move",2),s=V(r,"move",3),c=V(n,"move",4),u=void 0===o?i:$(o,"move",5);if(s>=a){if(a<=0&&s>=Number.MAX_SAFE_INTEGER+a)throw new M("too many elements to move");const t=s-a+1;if(c>Number.MAX_SAFE_INTEGER-t+1)throw new M("destination wrap around");if(c>s||c<=a||u!==i)for(let e=0;e<t;e++){const t=i.get(a+e);u.set(c+e,t)}else for(let e=t-1;e>=0;e--){const t=i.get(a+e);u.set(c+e,t)}}return u},pack:function(...t){const e=new j(t);return e.rawset("n",t.length),e},remove:function(t,e){const r=$(t,"remove",1),n=r.getn(),o=void 0===e?n:V(e,"remove",2);if(o>n||o<0)return;const i=r.numValues,a=i.splice(o,1)[0];let s=o;for(;s<n&&void 0===i[s];)delete i[s],s+=1;return a},sort:function(t,e){const r=$(t,"sort",1);let n;if(e){const t=Y(e,"sort",2);n=(e,r)=>F(t(e,r)[0])?-1:1}else n=(t,e)=>t<e?-1:1;const o=r.numValues;o.shift(),o.sort(n).unshift(void 0)},unpack:function(t,e,r){const n=$(t,"unpack",1),o=void 0===e?1:V(e,"unpack",2),i=void 0===r?n.getn():V(r,"unpack",3);return n.numValues.slice(o,i+1)}}),ue=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],le=["January","February","March","April","May","June","July","August","September","October","November","December"],fe=[31,28,31,30,31,30,31,31,30,31,30,31],he={"%":()=>"%",Y:(t,e)=>`${e?t.getUTCFullYear():t.getFullYear()}`,y:(t,e)=>he.Y(t,e).substr(-2),b:(t,e)=>he.B(t,e).substr(0,3),B:(t,e)=>le[e?t.getUTCMonth():t.getMonth()],m:(t,e)=>`0${(e?t.getUTCMonth():t.getMonth())+1}`.substr(-2),U:(t,e)=>pe(t,0,e),W:(t,e)=>pe(t,1,e),j:(t,e)=>{let r=e?t.getUTCDate():t.getDate();const n=e?t.getUTCMonth():t.getMonth(),o=e?t.getUTCFullYear():t.getFullYear();return r+=fe.slice(0,n).reduce(((t,e)=>t+e),0),n>1&&o%4==0&&(r+=1),`00${r}`.substr(-3)},d:(t,e)=>`0${e?t.getUTCDate():t.getDate()}`.substr(-2),a:(t,e)=>he.A(t,e).substr(0,3),A:(t,e)=>ue[e?t.getUTCDay():t.getDay()],w:(t,e)=>`${e?t.getUTCDay():t.getDay()}`,H:(t,e)=>`0${e?t.getUTCHours():t.getHours()}`.substr(-2),I:(t,e)=>`0${(e?t.getUTCHours():t.getHours())%12||12}`.substr(-2),M:(t,e)=>`0${e?t.getUTCMinutes():t.getMinutes()}`.substr(-2),S:(t,e)=>`0${e?t.getUTCSeconds():t.getSeconds()}`.substr(-2),c:(t,e)=>t.toLocaleString(void 0,e?{timeZone:"UTC"}:void 0),x:(t,e)=>`${he.m(t,e)}/${he.d(t,e)}/${he.y(t,e)}`,X:(t,e)=>`${he.H(t,e)}:${he.M(t,e)}:${he.S(t,e)}`,p:(t,e)=>(e?t.getUTCHours():t.getHours())<12?"AM":"PM",Z:(t,e)=>{if(e)return"UTC";const r=t.toString().match(/[A-Z][A-Z][A-Z]/);return r?r[0]:""}};function de(t){const e=t.getFullYear(),r=new Date(e,0);return t.getTimezoneOffset()!==r.getTimezoneOffset()}function pe(t,e,r){const n=parseInt(he.j(t,r),10),o=new Date(t.getFullYear(),0,1,12),i=(8-(r?o.getUTCDay():o.getDay())+e)%7;return`0${Math.floor((n-i)/7)+1}`.substr(-2)}function ye(t="%c",e){const r="!"===t.substr(0,1),n=r?t.substr(1):t,o=new Date;return e&&o.setTime(1e3*e),"*t"===n?new j({year:parseInt(he.Y(o,r),10),month:parseInt(he.m(o,r),10),day:parseInt(he.d(o,r),10),hour:parseInt(he.H(o,r),10),min:parseInt(he.M(o,r),10),sec:parseInt(he.S(o,r),10),wday:parseInt(he.w(o,r),10)+1,yday:parseInt(he.j(o,r),10),isdst:de(o)}):n.replace(/%[%YybBmUWjdaAwHIMScxXpZ]/g,(t=>he[t[1]](o,r)))}function ge(t="C"){if("C"===t)return"C"}function me(t){let e=Math.round(Date.now()/1e3);if(!t)return e;const r=t.rawget("year"),n=t.rawget("month"),o=t.rawget("day"),i=t.rawget("hour")||12,a=t.rawget("min"),s=t.rawget("sec");return r&&(e+=31557600*r),n&&(e+=2629800*n),o&&(e+=86400*o),i&&(e+=3600*i),a&&(e+=60*a),s&&(e+=s),e}function ve(t,e){return V(t,"difftime",1)-V(e,"difftime",2)}const be=(t,...e)=>{if(t instanceof Function)return K(t(...e));const r=t instanceof j&&t.getMetaMethod("__call");if(r)return K(r(t,...e));throw new M("attempt to call an uncallable type")},we=new j;we.metatable=Lt;const xe=(t,e)=>{if(t instanceof j)return t.get(e);if("string"==typeof t)return we.get(e);throw new M("no table or metatable found for given type")},_e=(t,e,r)=>{const n=new Function("__lua",e),o=new q(t.strValues).extend();r&&o.setVarargs([r]);const i=n({globalScope:o,...Xt,Table:j,call:be,get:xe});return void 0===i?[void 0]:i};function ke(t={}){const e={LUA_PATH:"./?.lua",stdin:"",stdout:console.log,...t},r=function(t,e){function r(t,r,n,i){let a,s="";if(t instanceof Function){let e=" ";for(;""!==e&&void 0!==e;)s+=e,e=t()[0]}else s=Z(t,"load",1);try{a=yt(s)}catch(t){return[void 0,t.message]}return()=>e(i||o,a)}function n(e,n,o){const i=void 0===e?t.stdin:Z(e,"loadfile",1);if(!t.fileExists)throw new M("loadfile requires the config.fileExists function");if(!t.fileExists(i))return[void 0,"file not found"];if(!t.loadFile)throw new M("loadfile requires the config.loadFile function");return r(t.loadFile(i),0,0,o)}const o=new j({_VERSION:"Lua 5.3",assert:Pt,dofile:function(t){const e=n(t);if(Array.isArray(e)&&void 0===e[0])throw new M(e[1]);return e()},collectgarbage:Tt,error:Ct,getmetatable:Mt,ipairs:jt,load:r,loadfile:n,next:It,pairs:Bt,pcall:zt,print:function(...e){const r=e.map((t=>D(t))).join("\t");t.stdout(r)},rawequal:Dt,rawget:Nt,rawlen:Rt,rawset:Ft,select:Ut,setmetatable:Gt,tonumber:Wt,tostring:D,type:z,xpcall:Vt});return o}(e,_e),{libPackage:n,_require:o}=((t,e)=>{const n=e.LUA_PATH,o=["/",";","?","!","-"].join("\n"),i=new j,a=new j,s=(t,r,n,o)=>{if(!e.fileExists)throw new M("package.searchpath requires the config.fileExists function");let i=Z(t,"searchpath",1);const a=Z(r,"searchpath",2),s=void 0===n?".":Z(n,"searchpath",3),c=void 0===o?"/":Z(o,"searchpath",4);i=i.replace(s,c);const u=a.split(";").map((t=>t.replace("?",i)));for(const t of u)if(e.fileExists(t))return t;return[void 0,`The following files don't exist: ${u.join(" ")}`]},c=new j([t=>{const e=a.rawget(t);return void 0===e?[void 0]:[e]},t=>{const n=s(t,u.rawget("path"));if(Array.isArray(n)&&void 0===n[0])return[n[1]];if(!e.loadFile)throw new M("package.searchers requires the config.loadFile function");return[(t,n)=>((t,e)=>_e(r,yt(t),e)[0])(e.loadFile(n),t),n]}]),u=new j({path:n,config:o,loaded:i,preload:a,searchers:c,searchpath:s});return{libPackage:u,_require:function(t){const e=Z(t,"require",1),r=i.rawget(e);if(r)return r;const n=c.numValues.filter((t=>!!t));for(const t of n){const r=t(e);if(void 0!==r[0]&&"string"!=typeof r[0]){const t=(0,r[0])(e,r[1]),n=void 0===t||t;return i.rawset(e,n),n}}throw new M(`Module '${e}' not found!`)}}})(0,e),i=n.get("loaded"),a=(t,e)=>{r.rawset(t,e),i.rawset(t,e)};a("_G",r),a("package",n),a("math",ae),a("table",ce),a("string",St),a("os",(t=>new j({date:ye,exit:function(e){if(!t.osExit)throw new M("os.exit requires the config.osExit function");let r=0;"boolean"==typeof e&&!1===e?r=1:"number"==typeof e&&(r=e),t.osExit(r)},setlocale:ge,time:me,difftime:ve}))(e)),r.rawset("require",o);const s=t=>{const e=yt(t);return{exec:()=>_e(r,e)[0]}};return{parse:s,parseFile:t=>{if(!e.fileExists)throw new M("parseFile requires the config.fileExists function");if(!e.loadFile)throw new M("parseFile requires the config.loadFile function");if(!e.fileExists(t))throw new M("file not found");return s(e.loadFile(t))},loadLib:a}}function Ee(t){return Ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ee(t)}function Ae(){Ae=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==Ee(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Se(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function Le(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Oe(t,e,r){return e&&Le(t.prototype,e),r&&Le(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Pe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Te=Oe((function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Pe(this,"setScope",(function(t){r.scope=t})),Pe(this,"getScope",(function(){return r.scope})),Pe(this,"createEnv",(function(){return r.env=r.pixoscript.createEnv({}),r.env})),Pe(this,"initLibrary",(function(){r.env||r.createEnv(),r.library=r.pixosLib.getLibrary(r.engine,r.scope),r.env.loadLib("pixos",r.library)})),Pe(this,"run",function(){var t,e=(t=Ae().mark((function t(e){return Ae().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r.env||r.createEnv(),r.library||r.initLibrary(),t.abrupt("return",r.env.parse(e).exec());case 3:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Se(i,n,o,a,s,"next",t)}function s(t){Se(i,n,o,a,s,"throw",t)}a(void 0)}))});return function(t){return e.apply(this,arguments)}}()),this.engine=e,this.pixoscript=i,this.pixosLib=new C(this.pixoscript),this.scope={},this.env=null,this.library=null}))},4399:(t,e,r)=>{"use strict";function n(){return"\n precision mediump float;\n\n varying vec2 vTextureCoord;\n varying vec3 vColor;\n\n void main(void) {\n // Simple particle color (could be extended with texture sampling)\n gl_FragColor = vec4(vColor, 1.0);\n }\n "}r.d(e,{Z:()=>n})},8062:(t,e,r)=>{"use strict";function n(){return"\n attribute vec3 aVertexPosition;\n attribute vec2 aTextureCoord;\n\n uniform mat4 uProjectionMatrix;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform vec3 uScale;\n uniform vec3 uParticleColor;\n\n varying vec2 vTextureCoord;\n varying vec3 vColor;\n\n void main(void) {\n // Apply model matrix for particle position and scale\n vec4 worldPosition = uModelMatrix * vec4(aVertexPosition * uScale, 1.0);\n\n // Output position\n gl_Position = uProjectionMatrix * uViewMatrix * worldPosition;\n\n // Pass texture coordinates and color to fragment shader\n vTextureCoord = aTextureCoord;\n vColor = uParticleColor;\n }\n "}r.d(e,{Z:()=>n})},1108:(t,e,r)=>{"use strict";function n(){return"\n precision highp float;\n \n uniform vec4 u_id;\n uniform float useSampler;\n uniform sampler2D uSampler;\n\n varying vec2 vTextureCoord;\n\n void main() {\n if(useSampler == 1.0) { // sampler\n vec4 texelColors = texture2D(uSampler, vTextureCoord);\n gl_FragColor= vec4(vec3(u_id),texelColors.a);\n } else {\n gl_FragColor = vec4(vec3(u_id),1.0);\n }\n }\n "}r.d(e,{Z:()=>n})},5911:(t,e,r)=>{"use strict";function n(t){var e=this.engine.gl,r=this;return t.aVertexPosition=e.getAttribLocation(t,"aVertexPosition"),t.aVertexPosition>=0&&e.enableVertexAttribArray(t.aVertexPosition),t.aTextureCoord=e.getAttribLocation(t,"aTextureCoord"),t.aTextureCoord>=0&&e.enableVertexAttribArray(t.aTextureCoord),t.aVertexNormal=e.getAttribLocation(t,"aVertexNormal"),t.aVertexNormal>=0&&e.enableVertexAttribArray(t.aVertexNormal),t.pMatrixUniform=e.getUniformLocation(t,"uProjectionMatrix"),t.mMatrixUniform=e.getUniformLocation(t,"uModelMatrix"),t.vMatrixUniform=e.getUniformLocation(t,"uViewMatrix"),t.samplerUniform=e.getUniformLocation(t,"uSampler"),t.useSampler=e.getUniformLocation(t,"useSampler"),t.scale=e.getUniformLocation(t,"u_scale"),t.id=e.getUniformLocation(t,"u_id"),t.setMatrixUniforms=function(n){var o=n.scale,i=void 0===o?null:o,a=n.id,s=void 0===a?null:a,c=n.sampler,u=void 0===c?1:c;e.useProgram(t),e.uniformMatrix4fv(t.pMatrixUniform,!1,r.uProjMat),e.uniformMatrix4fv(t.mMatrixUniform,!1,r.uModelMat),e.uniformMatrix4fv(t.vMatrixUniform,!1,r.camera.uViewMat),e.uniform3fv(t.scale,i?i.toArray():r.scale.toArray()),e.uniform4fv(t.id,s||[1,0,0,0]),e.uniform1f(t.useSampler,u),e.uniform1i(t.samplerUniform,0)},t}r.d(e,{Z:()=>n})},1704:(t,e,r)=>{"use strict";function n(){return"\n attribute vec3 aVertexPosition;\n attribute vec2 aTextureCoord;\n \n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n \n varying vec4 vWorldVertex;\n varying vec4 vPosition;\n varying vec2 vTextureCoord;\n\n uniform vec3 u_scale;\n \n void main() {\n // Multiply the position by the matrix.\n vec3 scaledPosition = aVertexPosition * u_scale;\n vTextureCoord = aTextureCoord;\n \n vWorldVertex = uModelMatrix * vec4(aVertexPosition, 1.0);\n vPosition = uModelMatrix * vec4(scaledPosition, 1.0);\n\n gl_Position = uProjectionMatrix * uViewMatrix * vPosition;\n }\n "}r.d(e,{Z:()=>n})},7745:(t,e,r)=>{"use strict";function n(){return"\n precision mediump float;\n uniform samplerCube uSkybox;\n uniform mat4 uViewDirectionProjectionInverse;\n varying vec4 vPosition;\n\n // Simple hash for star placement\n float hash(vec3 p) {\n return fract(sin(dot(p, vec3(12.9898,78.233,45.164))) * 43758.5453);\n }\n\n void main() {\n vec4 t = uViewDirectionProjectionInverse * vPosition;\n vec3 dir = normalize(t.xyz / t.w);\n\n // Starfield effect\n float starDensity = 0.0007; // Lower = more stars\n float brightness = 0.0;\n float star = step(1.0 - starDensity, hash(dir * 100.0));\n if (star > 0.0) {\n brightness = 0.8 + 0.2 * hash(dir * 200.0);\n }\n\n // Nebula color (subtle blue/purple)\n float nebula = pow(abs(dir.y), 2.0) * 0.3;\n vec3 nebulaColor = mix(vec3(0.05,0.05,0.15), vec3(0.2,0.1,0.3), nebula);\n\n // Combine star and nebula\n vec3 color = nebulaColor + brightness * vec3(1.0, 1.0, 1.0);\n gl_FragColor = vec4(color, 1.0);\n }\n"}r.r(e),r.d(e,{default:()=>n})},5564:(t,e,r)=>{"use strict";function n(){return"\n attribute vec4 aPosition;\n varying vec4 vPosition;\n void main() {\n vPosition = aPosition;\n gl_Position = aPosition;\n }\n"}r.r(e),r.d(e,{default:()=>n})},5401:(t,e,r)=>{"use strict";function n(){return'\n precision highp float;\n uniform mat4 uViewDirectionProjectionInverse;\n varying vec4 vPosition;\n uniform float uTime;\n uniform vec2 uResolution;\n\n const float PI = 3.141592653589793;\n\n // simple float hash from vec2\n float hash12(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);\n }\n\n // value noise (cheap)\n float noise2(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n float a = hash12(i + vec2(0.0, 0.0));\n float b = hash12(i + vec2(1.0, 0.0));\n float c = hash12(i + vec2(0.0, 1.0));\n float d = hash12(i + vec2(1.0, 1.0));\n vec2 u = f * f * (3.0 - 2.0 * f);\n return mix(a, b, u.x) + (c - a) * u.y * (1.0 - u.x) + (d - b) * u.x * u.y;\n }\n\n // smooth pulse shape\n float pulse(float x, float wid) {\n return smoothstep(0.0, wid, x) * (1.0 - smoothstep(1.0 - wid, 1.0, x));\n }\n\n void main() {\n // Reconstruct view direction from interpolated clip-space position\n vec4 t = uViewDirectionProjectionInverse * vPosition;\n vec3 dir = normalize(t.xyz / t.w);\n\n // convert direction -> equirectangular-like UV so "columns" wrap horizontally\n float u = atan(dir.z, dir.x) / (2.0 * PI) + 0.5;\n float v = asin(clamp(dir.y, -1.0, 1.0)) / PI + 0.5;\n vec2 uv = vec2(u, v);\n\n // Column layout\n float colsBase = mix(120.0, 240.0, clamp(uResolution.x / 1600.0, 0.0, 1.0));\n float horizonBias = 1.0 - abs(v - 0.5) * 2.0;\n float cols = max(32.0, colsBase * (0.6 + 0.8 * horizonBias));\n\n float colIndexF = floor(uv.x * cols);\n float colX = (colIndexF + 0.5) / cols;\n\n // per-column seed & speed variety\n float seed = hash12(vec2(colIndexF, floor(uTime * 10.0)));\n float speed = 0.8 + hash12(vec2(colIndexF, 9.0)) * 2.2;\n\n // vertical tiling for character cells\n float charSize = mix(0.018, 0.035, clamp(uResolution.y/900.0, 0.0, 1.0));\n float rows = 1.0 / charSize;\n\n float yScaled = uv.y * rows;\n float yCell = floor(yScaled);\n float yFrac = fract(yScaled);\n\n // falling offset based on time and column seed\n float fall = fract((uTime * speed * 0.25) + seed * 10.0);\n\n float dropPos = fract(seed * 7.3 + uTime * 0.25 * speed);\n float drop2 = fract(seed * 3.1 + uTime * 0.57 * speed * 0.7);\n\n float d1 = abs(yCell / rows - dropPos);\n float d2 = abs(yCell / rows - drop2);\n\n float head = exp(-pow((yFrac + fract(yCell*0.9183) * 0.35), 2.0) * 40.0);\n float tail = exp(-d1 * 8.0) + 0.5 * exp(-d2 * 12.0);\n\n float glyphSeed = hash12(vec2(colIndexF, yCell));\n float glyphPulse = pulse(fract(yScaled - (seed*3.0 + uTime*0.9*speed)), 0.12);\n float glyph = smoothstep(0.35, 0.55, glyphSeed + 0.2 * noise2(vec2(colIndexF * 0.13, yCell * 0.07 + uTime * 0.1)));\n\n float brightness = clamp( 1.6 * head + 0.9 * tail * glyph + 0.35 * glyph * glyphPulse, 0.0, 1.6);\n\n float colWidth = 1.0 / cols * 0.9;\n float colMask = smoothstep(0.0, 1.0, 1.0 - abs(uv.x - colX) / (colWidth * 0.6));\n\n float jitter = noise2(vec2(colIndexF * 0.7, yCell * 0.9 + uTime * 0.2)) * 0.5;\n float charV = smoothstep(0.0, 1.0, 1.0 - abs(yFrac - (0.5 + jitter*0.2)) * 2.0);\n\n float intensity = brightness * colMask * charV;\n\n vec3 baseGreen = vec3(0.1, 0.95, 0.15);\n vec3 headColor = mix(baseGreen * 0.6, vec3(1.0, 1.0, 0.9), clamp(head * 2.0, 0.0, 1.0));\n vec3 tailColor = baseGreen * (0.6 + 0.8 * glyph);\n\n float headFactor = clamp(head * 2.0, 0.0, 1.0);\n vec3 col = mix(tailColor, headColor, headFactor) * intensity;\n\n float bgNoise = 0.04 * (noise2(uv * 400.0 + uTime * 0.03));\n float verticalVignette = pow(1.0 - abs(v - 0.5) * 1.6, 1.8);\n vec3 bg = vec3(0.01, 0.03, 0.01) * verticalVignette + bgNoise;\n\n float stars = smoothstep(0.9996, 1.0, noise2(uv * 2000.0 + uTime * 0.1));\n vec3 starCol = vec3(0.6, 1.0, 0.6) * stars * 1.2;\n\n vec3 final = col + bg + starCol;\n\n float glow = pow(intensity, 1.6) * 0.9;\n final += vec3(glow * 0.14, glow * 0.22, glow * 0.06);\n\n final = 1.0 - exp(-final * 1.6);\n final = pow(final, vec3(0.9));\n\n gl_FragColor = vec4(final, 1.0);\n }\n'}r.r(e),r.d(e,{default:()=>n})},488:(t,e,r)=>{"use strict";function n(){return"\n attribute vec4 aPosition;\n varying vec4 vPosition;\n void main() {\n vPosition = aPosition;\n gl_Position = aPosition;\n }\n"}r.r(e),r.d(e,{default:()=>n})},2628:(t,e,r)=>{"use strict";function n(){return"\n precision mediump float;\n \n uniform samplerCube uSkybox;\n uniform mat4 uViewDirectionProjectionInverse;\n \n varying vec4 vPosition;\n void main() {\n vec4 t = uViewDirectionProjectionInverse * vPosition;\n gl_FragColor = textureCube(uSkybox, normalize(t.xyz / t.w));\n }\n"}r.r(e),r.d(e,{default:()=>n})},939:(t,e,r)=>{"use strict";function n(){return"\n attribute vec4 aPosition;\n varying vec4 vPosition;\n void main() {\n vPosition = aPosition;\n gl_Position = aPosition;\n }\n"}r.r(e),r.d(e,{default:()=>n})},471:(t,e,r)=>{"use strict";function n(){return"\n precision mediump float;\n uniform samplerCube uSkybox;\n varying vec4 vPosition; // Interpolated position of the vertex in world space.\n uniform mat4 uViewDirectionProjectionInverse; // Matrix to transform view direction into projection space for texture lookup.\n uniform float uTime; // Time uniform, if you want to animate your noise pattern\n\n // Simplex noise function (you can use a different type of noise if you prefer)\n float simplexNoise(vec3 p) {\n return fract(sin(dot(p, vec3(12.9898, 78.233, 45.123))) * 43758.5453);\n }\n\n void main() {\n // Transform the view direction to projection space for texture lookup\n vec4 t = uViewDirectionProjectionInverse * vPosition;\n vec3 dir = normalize(t.xyz / t.w);\n \n // Generate a simple abstract pattern based on noise and time\n float n = simplexNoise(vec3(vPosition.x, vPosition.y, uTime)); // Using the current time for animation\n \n // Map the noise value to a color: white for high values, black for low values\n vec3 skyColor = mix(vec3(1.0, 1.0, 1.0), vec3(0.0, 0.0, 0.0), n);\n \n // Apply the calculated color to the fragment\n gl_FragColor = vec4(skyColor, 1.0);\n }\n\n"}r.r(e),r.d(e,{default:()=>n})},202:(t,e,r)=>{"use strict";function n(){return"\n attribute vec4 aPosition;\n varying vec4 vPosition;\n void main() {\n vPosition = aPosition;\n gl_Position = aPosition;\n }\n"}r.r(e),r.d(e,{default:()=>n})},8143:(t,e,r)=>{"use strict";function n(){return"\n precision mediump float;\n \n uniform samplerCube uSkybox;\n uniform mat4 uViewDirectionProjectionInverse;\n \n varying vec4 vPosition;\n void main() {\n vec4 t = uViewDirectionProjectionInverse * vPosition;\n gl_FragColor = textureCube(uSkybox, normalize(t.xyz / t.w));\n }\n"}r.r(e),r.d(e,{default:()=>n})},6568:(t,e,r)=>{"use strict";function n(){return"\n attribute vec4 aPosition;\n varying vec4 vPosition;\n void main() {\n vPosition = aPosition;\n gl_Position = aPosition;\n }\n"}r.r(e),r.d(e,{default:()=>n})},8135:(t,e,r)=>{"use strict";function n(){return"\n precision mediump float;\n \n uniform samplerCube uSkybox;\n uniform mat4 uViewDirectionProjectionInverse;\n \n varying vec4 vPosition;\n void main() {\n vec4 t = uViewDirectionProjectionInverse * vPosition;\n gl_FragColor = textureCube(uSkybox, normalize(t.xyz / t.w));\n }\n"}r.r(e),r.d(e,{default:()=>n})},8299:(t,e,r)=>{"use strict";function n(){return"\n attribute vec4 aPosition;\n varying vec4 vPosition;\n void main() {\n vPosition = aPosition;\n gl_Position = aPosition;\n }\n"}r.r(e),r.d(e,{default:()=>n})},5311:(t,e,r)=>{"use strict";function n(){return"\n precision mediump float;\n varying vec2 vUV;\n uniform float uProgress;\n uniform float uDirection;\n\n void main() {\n vec2 center = vec2(0.5, 0.5);\n float dist = distance(vUV, center);\n\n // Radius grows [0..1] for OUT, shrinks for IN\n float radius = (uDirection > 0.5) ? (1.0 - uProgress) : uProgress;\n\n // Blur width relative to screen; tweak for softer/harder edge\n float feather = 0.20; // 20% of radius as feather\n float edge0 = radius - feather * 0.5;\n float edge1 = radius + feather * 0.5;\n\n float mask = smoothstep(edge0, edge1, dist);\n\n // Black overlay with soft edge\n gl_FragColor = vec4(0.0, 0.0, 0.0, mask);\n }\n "}r.d(e,{Z:()=>n})},1564:(t,e,r)=>{"use strict";function n(){return"\n attribute vec2 aPosition;\n varying vec2 vUV;\n void main() {\n vUV = (aPosition + 1.0) * 0.5;\n gl_Position = vec4(aPosition, 0.0, 1.0);\n }\n "}r.d(e,{Z:()=>n})},4522:(t,e,r)=>{"use strict";function n(){return"\n precision mediump float;\n varying vec2 vUV;\n uniform float uProgress;\n uniform float uDirection;\n void main() {\n float mask;\n // When uDirection == 1.0 (transition in), the black area shrinks\n // from right to left. Otherwise, it grows from left to right.\n if (uDirection > 0.5) {\n mask = step(1.0 - uProgress, vUV.x);\n } else {\n mask = step(vUV.x, uProgress);\n }\n gl_FragColor = vec4(0.0, 0.0, 0.0, mask);\n }\n "}r.d(e,{Z:()=>n})},6404:(t,e,r)=>{"use strict";function n(){return"\n attribute vec2 aPosition;\n varying vec2 vUV;\n void main() {\n vUV = (aPosition + 1.0) * 0.5;\n gl_Position = vec4(aPosition, 0.0, 1.0);\n }\n "}r.d(e,{Z:()=>n})},7319:(t,e,r)=>{"use strict";function n(){return"\n precision mediump float;\n varying vec2 vUV;\n uniform float uProgress;\n uniform float uDirection;\n\n void main() {\n // Determine wipe center position depending on direction\n float pos = (uDirection > 0.5) ? (1.0 - uProgress) : uProgress;\n\n // Feather width in UV space\n float feather = 0.12;\n\n // Distance from the moving edge (vertical line at x=pos)\n float d = vUV.x - pos;\n\n // Soft mask around the edge using smoothstep\n float mask = smoothstep(-feather, feather, d);\n\n // Black overlay with soft edge\n gl_FragColor = vec4(0.0, 0.0, 0.0, mask);\n }\n "}r.d(e,{Z:()=>n})},9357:(t,e,r)=>{"use strict";function n(){return"\n attribute vec2 aPosition;\n varying vec2 vUV;\n void main() {\n vUV = (aPosition + 1.0) * 0.5;\n gl_Position = vec4(aPosition, 0.0, 1.0);\n }\n "}r.d(e,{Z:()=>n})},2913:(t,e,r)=>{"use strict";function n(){return"\n precision mediump float;\n varying vec2 vUV;\n uniform float uProgress;\n uniform float uDirection;\n void main() {\n float alpha = uDirection > 0.5 ? (1.0 - uProgress) : uProgress;\n gl_FragColor = vec4(0.0, 0.0, 0.0, alpha);\n }\n "}r.d(e,{Z:()=>n})},8900:(t,e,r)=>{"use strict";function n(){return"\n attribute vec2 aPosition;\n varying vec2 vUV;\n void main() {\n vUV = (aPosition + 1.0) * 0.5;\n gl_Position = vec4(aPosition, 0.0, 1.0);\n }\n "}r.d(e,{Z:()=>n})},8946:(t,e,r)=>{"use strict";function n(){return"\n precision mediump float;\n varying vec2 vUV;\n uniform float uProgress;\n uniform float uDirection;\n void main() {\n vec2 center = vec2(0.5, 0.5);\n float dist = distance(vUV, center);\n float mask;\n if (uDirection > 0.5) {\n // transition in: shrink the black disc\n mask = step(uProgress, dist);\n } else {\n // transition out: grow the black disc\n mask = step(dist, uProgress);\n }\n gl_FragColor = vec4(0.0, 0.0, 0.0, mask);\n }\n "}r.d(e,{Z:()=>n})},9188:(t,e,r)=>{"use strict";function n(){return"\n attribute vec2 aPosition;\n varying vec2 vUV;\n void main() {\n vUV = (aPosition + 1.0) * 0.5;\n gl_Position = vec4(aPosition, 0.0, 1.0);\n }\n "}r.d(e,{Z:()=>n})},4395:(t,e,r)=>{"use strict";r.d(e,{Ee:()=>u,Nm:()=>s});var n=r(9010);function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(t){return t*Math.PI/180}var s={None:0,Right:1,Up:2,Left:4,Down:8,All:15,fromOffset:function(t){return t[0]>0?s.Right:t[0]<0?s.Left:t[1]>0?s.Down:t[1]<0?s.Up:0},toOffset:function(t){switch(t){case s.Right:return[1,0];case s.Up:return[0,-1];case s.Left:return[-1,0];case s.Down:return[0,1]}return[0,0]},reverse:function(t){switch(t){case s.Right:return s.Left;case s.Up:return s.Down;case s.Left:return s.Right;case s.Down:return s.Up}return s.None},rotate:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];switch(t){case s.Right:return e?s.Up:s.Down;case s.Up:return e?s.Left:s.Right;case s.Left:return e?s.Down:s.Up;case s.Down:return e?s.Right:s.Left}return s.None},adjustCameraDirection:function(t){switch(t.z%8){case 0:return"N";case 1:case-7:return"NW";case 2:case-6:return"W";case 3:case-5:return"SW";case 4:case-4:return"S";case 5:case-3:return"SE";case 6:case-2:return"E";case 7:case-1:return"NE"}},getCameraRelativeDirection:function(t,e){var r={N:{forward:s.Up,backward:s.Down,left:s.Left,right:s.Right},NE:{forward:s.Down,backward:s.Up,left:s.Left,right:s.Right},E:{forward:s.Right,backward:s.Left,left:s.Up,right:s.Down},SE:{forward:s.Down,backward:s.Up,left:s.Right,right:s.Left},S:{forward:s.Down,backward:s.Up,left:s.Right,right:s.Left},SW:{forward:s.Right,backward:s.Left,left:s.Down,right:s.Up},W:{forward:s.Left,backward:s.Right,left:s.Down,right:s.Up},NW:{forward:s.Right,backward:s.Left,left:s.Up,right:s.Down}};return(r[e]||r.N)[t]||s.None},spriteSequence:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"N";switch(e){case"N":switch(t){case s.Up:return"N";case s.Right:return"E";case s.Down:return"S";case s.Left:return"W"}case"E":switch(t){case s.Up:return"W";case s.Right:return"N";case s.Down:return"E";case s.Left:return"S"}case"S":switch(t){case s.Up:return"S";case s.Right:return"W";case s.Down:return"N";case s.Left:return"E"}case"W":switch(t){case s.Up:return"E";case s.Right:return"S";case s.Down:return"W";case s.Left:return"N"}case"NE":switch(t){case s.Up:return"NW";case s.Right:return"SE";case s.Down:return"NE";case s.Left:return"SW"}case"SE":switch(t){case s.Up:return"SW";case s.Right:return"NW";case s.Down:return"SE";case s.Left:return"NE"}case"SW":switch(t){case s.Up:return"NE";case s.Right:return"SW";case s.Down:return"NW";case s.Left:return"SE"}case"NW":switch(t){case s.Up:return"SE";case s.Right:return"NE";case s.Down:return"SW";case s.Left:return"NW"}}return"S"},drawOffset:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"N";switch(e){case"NE":return t.cross(new n.OW(Math.sin(a(315)),2*Math.cos(a(315)),0));case"NW":return t.cross(new n.OW(-2*Math.sin(a(315)),-Math.cos(a(315)),0));case"SE":return t.cross(new n.OW(Math.sin(a(225)),Math.cos(a(225)),0));case"SW":return t.cross(new n.OW(Math.sin(a(135)),Math.cos(a(135)),0));case"E":return t.cross(new n.OW(Math.sin(a(270)),Math.cos(a(270)),0));case"W":return t.cross(new n.OW(Math.sin(a(90)),Math.cos(a(90)),0));case"S":return t.cross(new n.OW(Math.sin(a(180)),Math.cos(a(180)),0));case"N":return t.cross(new n.OW(Math.sin(a(0)),Math.cos(a(0)),0));default:return t}},objectSequence:function(t){switch(t){case s.Right:return[0,90,0];case s.Up:return[0,0,0];case s.Left:return[0,-90,0];case s.Down:return[0,180,0]}return[0,0,0]}},c=function(t){return t&&"object"===i(t)&&!Array.isArray(t)},u=function t(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];if(!n.length)return e;var a=n.shift();if(c(e)&&c(a))for(var s in a){var u;c(a[s])?(e[s]||Object.assign(e,o({},s,{})),t(e[s],a[s])):Object.assign(e,o({},s,a[s]&&Array.isArray(a[s])?[].concat(null!==(u=e[s])&&void 0!==u?u:[],a[s]):a[s]))}return t.apply(void 0,[e].concat(n))}},1183:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){o=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};u(g,a,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,a)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(i,a,s,c){var u=f(t[i],t,a);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==n(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){o("next",t,s,c)}),(function(t){o("throw",t,s,c)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return o("throw",t,s,c)}))}c(u.arg)}var i;this._invoke=function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(b,"constructor",y),u(y,"constructor",p),p.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,c,"Generator"),u(b,a,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function i(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}r.d(e,{a:()=>d});var s=function(){function t(e,r,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.type=e,this.sprite=r,this.callback=n,this.time=(new Date).getTime(),this.id=r.id+"-"+e+"-"+this.time}var e,r,n,s;return e=t,r=[{key:"configure",value:function(t,e,r,n,o){this.sprite=e,this.id=r,this.type=t,this.startTime=n,this.creationArgs=o}},{key:"onLoad",value:(n=o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.init.apply(this,e);case 2:this.loaded=!0;case 3:case"end":return t.stop()}}),t,this)})),s=function(){var t=this,e=arguments;return new Promise((function(r,o){var a=n.apply(t,e);function s(t){i(a,r,o,s,c,"next",t)}function c(t){i(a,r,o,s,c,"throw",t)}s(void 0)}))},function(t){return s.apply(this,arguments)})},{key:"serialize",value:function(){return{id:this.id,time:this.startTime,zone:this.sprite.zone.id,sprite:this.sprite.id,type:this.type,args:this.creationArgs}}},{key:"onComplete",value:function(){return this.callback?this.callback():null}}],r&&a(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function u(){u=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};s(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==c(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,s(b,"constructor",y),s(y,"constructor",p),p.displayName=s(y,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,a,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,a,"Generator"),s(b,o,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function l(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function f(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){l(i,n,o,a,s,"next",t)}function s(t){l(i,n,o,a,s,"throw",t)}a(void 0)}))}}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var d=function(){function t(e,r,n,o,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.engine=e,this.type=r,this.args=n,this.sprite=o,this.callback=i,this.instances={},this.definitions=[],this.assets={};var a=(new Date).getTime(),s=o.id+"-"+r+"-"+a;return this.load(r,function(){var t=f(u().mark((function t(e){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.onLoad(n);case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),(function(t){t.configure(r,o,s,a,n)}))}var e,n,o;return e=t,n=[{key:"load",value:(o=f(u().mark((function t(e){var n,o,i,a=arguments;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log("Loading Action: "+e),n=a[1],o=a[2],this.instances[e]||(this.instances[e]=[]),console.log({afterLoad:n,runConfigure:o}),i=new s(this.type,this.sprite,this.callback),Object.assign(i,r(4668)("./"+e+".js").default),i.templateLoaded=!0,console.log("Notifying in Action: "+e),t.next=11,Promise.all(this.instances[e].map(function(){var t=f(u().mark((function t(e){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(console.log({instance:e}),!e.afterLoad){t.next=4;break}return t.next=4,e.afterLoad(e.instance);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 11:return o&&o(i),n&&(i.templateLoaded?n(i):this.instances[e].push({instance:i,afterLoad:n})),console.log("Ending load Action: "+e),t.abrupt("return",i);case 15:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&h(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},7122:(t,e,r)=>{"use strict";r.d(e,{m:()=>h});const n=new class{loopOnThresolds(t,e,r){let n=.95;"function"!=typeof e&&"boolean"!=typeof e||(r=e||r,e=.3),void 0===e&&(e=.3),"function"!=typeof r&&(r=this.noop);const o=e,i={};do{let e=!1;if(n-=.05,t(i,n,(t=>{e=t})),e)break}while(n>o);return r(i)}generateObjectModel(t,e){return this.loopOnThresolds(((e,r)=>{e[r.toString()]=JSON.parse(JSON.stringify(t))}),(t=>e?e(JSON.parse(JSON.stringify(t))):t))}noop(){}},o=new class{getLowPassSource(t,e){const{numberOfChannels:r,length:n,sampleRate:o}=t,i=new e(r,n,o),a=i.createBufferSource();a.buffer=t;const s=i.createBiquadFilter();return s.type="lowpass",a.connect(s),s.connect(i.destination),a}findPeaksAtThresold(t,e,r){let n=[];const{length:o}=t;for(let i=r;i<o;i+=1)t[i]>e&&(n.push(i),i+=1e4);return 0===n.length&&(n=void 0),{peaks:n,thresold:e}}computeBPM(t,e,r){let o=!1;n.loopOnThresolds(((n,i,a)=>o?a(!0):t[i].length>15?(o=!0,r(null,[this.identifyIntervals,this.groupByTempo(e),this.getTopCandidates].reduce(((t,e)=>e(t)),t[i]),i)):void 0),(()=>(o||r(new Error("Could not find enough samples for a reliable detection.")),!1)))}getTopCandidates(t){return t.sort(((t,e)=>e.count-t.count)).splice(0,5)}identifyIntervals(t){const e=[];for(const[r,n]of t.entries())for(let o=0;o<10;o+=1){const i=t[r+o]-n;e.some((t=>t.interval===i&&(t.count+=1,t.count)))||e.push({interval:i,count:1})}return e}groupByTempo(t){return e=>{const r=[];for(const n of e)if(0!==n.interval){n.interval=Math.abs(n.interval);let e=60/(n.interval/t);for(;e<90;)e*=2;for(;e>180;)e/=2;e=Math.round(e),r.some((t=>t.tempo===e&&(t.count+=n.count,t.count)))||r.push({tempo:e,count:n.count})}return r}}};class i{constructor(t={}){this.options={debug:!1,scriptNode:{bufferSize:4096},continuousAnalysis:!1,stabilizedBpmCount:2e3,computeBPMDelay:1e4,stabilizationTime:2e4,pushTime:2e3,pushCallback:(t,e)=>{if(t)throw new Error(t)},onBpmStabilized:t=>{this.clearValidPeaks(t)},OfflineAudioContext:"object"==typeof window&&(window.OfflineAudioContext||window.webkitOfflineAudioContext)},this.logger=(...t)=>{this.options.debug&&console.log(...t)},Object.assign(this.options,t),this.minValidThresold=.3,this.cumulatedPushTime=0,this.timeoutPushTime=null,this.timeoutStabilization=null,this.validPeaks=n.generateObjectModel([]),this.nextIndexPeaks=n.generateObjectModel(0),this.chunkCoeff=1}reset(){this.minValidThresold=.3,this.cumulatedPushTime=0,this.timeoutPushTime=null,this.timeoutStabilization=null,this.validPeaks=n.generateObjectModel([]),this.nextIndexPeaks=n.generateObjectModel(0),this.chunkCoeff=1}clearValidPeaks(t){this.logger(`[clearValidPeaks] function: under ${t}`),this.minValidThresold=t.toFixed(2),n.loopOnThresolds(((e,r)=>{r<t&&(delete this.validPeaks[r],delete this.nextIndexPeaks[r])}))}analyze(t){const e=this.options.scriptNode.bufferSize*this.chunkCoeff,r=e-this.options.scriptNode.bufferSize,i=o.getLowPassSource(t.inputBuffer,this.options.OfflineAudioContext);i.start(0),n.loopOnThresolds(((t,n)=>{if(this.nextIndexPeaks[n]>=e)return;const a=this.nextIndexPeaks[n]%this.options.scriptNode.bufferSize,{peaks:s,thresold:c}=o.findPeaksAtThresold(i.buffer.getChannelData(0),n,a);if(void 0!==s)for(const t of Object.keys(s)){const e=s[t];void 0!==e&&(this.nextIndexPeaks[c]=r+e+1e4,this.validPeaks[c].push(r+e))}}),this.minValidThresold,(()=>{this.chunkCoeff++,null===this.timeoutPushTime&&(this.timeoutPushTime=setTimeout((()=>{this.cumulatedPushTime+=this.options.pushTime,this.timeoutPushTime=null,o.computeBPM(this.validPeaks,t.inputBuffer.sampleRate,((t,e,r)=>{this.options.pushCallback(t,e,r),!t&&e&&e[0].count>=this.options.stabilizedBpmCount&&(this.logger("[freezePushBack]"),this.timeoutPushTime="never",this.minValidThresold=1),this.cumulatedPushTime>=this.options.computeBPMDelay&&this.minValidThresold<r&&(this.logger("[onBpmStabilized] function: Fired !"),this.options.onBpmStabilized(r),this.options.continuousAnalysis&&(clearTimeout(this.timeoutStabilization),this.timeoutStabilization=setTimeout((()=>{this.logger("[timeoutStabilization] setTimeout: Fired !"),this.options.computeBPMDelay=0,this.reset()}),this.options.stabilizationTime)))}))}),this.options.pushTime))}))}}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function s(){s=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};u(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,s,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==a(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,c)}),(function(t){n("throw",t,s,c)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(b,"constructor",y),u(y,"constructor",p),p.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,c,"Generator"),u(b,o,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function c(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function f(t,e,r){return e&&l(t.prototype,e),r&&l(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}"undefined"!=typeof window&&(window.RealTimeBPMAnalyzer=i);var h=function(){function t(e){u(this,t),this.engine=e,this.definitions=[],this.instances={}}var e,r;return f(t,[{key:"load",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.instances[t])return this.instances[t];var r=new d(t,e);this.instances[t]=r;var n=this;return e&&Object.keys(n.instances).filter((function(e){return t!==e})).forEach((function(t){n.instances[t]&&n.instances[t].pauseAudio()})),r.loaded=!0,r}},{key:"loadFromZip",value:(e=s().mark((function t(e,r){var n,o,i,a,c,u=arguments;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=u.length>2&&void 0!==u[2]&&u[2],!this.instances[r]){t.next=3;break}return t.abrupt("return",this.instances[r]);case 3:return console.log({msg:"let the beat roll in!"}),t.next=6,e.file("audio/".concat(r)).async("arrayBuffer").then((function(t){var e=new Uint8Array(t);return new Blob([e.buffer])}));case 6:return o=t.sent,i=URL.createObjectURL(o),console.log({msg:"loading audio track...",url:i}),a=new d(i,n),this.instances[r]=a,c=this,n&&Object.keys(c.instances).filter((function(t){return r!==t})).forEach((function(t){c.instances[t]&&c.instances[t].pauseAudio()})),a.loaded=!0,t.abrupt("return",a);case 15:case"end":return t.stop()}}),t,this)})),r=function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(t){c(i,n,o,a,s,"next",t)}function s(t){c(i,n,o,a,s,"throw",t)}a(void 0)}))},function(t,e){return r.apply(this,arguments)})}]),t}(),d=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];u(this,t),this.src=e,this.playing=!1,this.audio=new Audio(e),this.audioContext=new AudioContext,this.bpm=0,this.analyser=this.audioContext.createAnalyser(),this.audioSource=this.audioContext.createMediaElementSource(this.audio),this.audioSource.connect(this.analyser),this.audioNode=this.audioContext.createScriptProcessor(4096,1,1),this.audioNode.connect(this.audioContext.destination),this.audioSource.connect(this.audioNode),this.audioSource.connect(this.audioContext.destination);var o=new i({scriptNode:{bufferSize:4096},pushTime:2e3,pushCallback:function(t,e){r.bpm=e}});this.audioNode.onaudioprocess=function(t){o.analyze(t)},n&&this.audio.addEventListener("ended",(function(){this.currentTime=0,this.play()}),!1),this.audio.load()}return f(t,[{key:"isPlaying",value:function(){return this.playing}},{key:"playAudio",value:function(){var t=this.audio.play();this.playing=!0,void 0!==t&&t.then((function(t){})).catch((function(t){console.info(t)}))}},{key:"pauseAudio",value:function(){var t=this.audio.pause();this.playing=!1,void 0!==t&&t.then((function(t){})).catch((function(t){console.info(t)}))}}]),t}()},679:(t,e,r)=>{"use strict";r.d(e,{aW:()=>Ut.a,q1:()=>Kt,Gq:()=>Ft,jf:()=>wt,e5:()=>w});var n=r(7974),o=r(5849);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(){a=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",s=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function p(){}function y(){}var g={};u(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,a,s,c){var u=f(t[o],t,a);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==i(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,c)}),(function(t){n("throw",t,s,c)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(b,"constructor",y),u(y,"constructor",p),p.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,s,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,c,"Generator"),u(b,o,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function s(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function c(t,e){return c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},c(t,e)}function u(t,e){if(e&&("object"===i(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function h(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}(d,t);var e,r,o,i=(r=d,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=f(r);if(o){var n=f(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function d(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d),h(l(e=i.call(this)),"onJsonLoaded",(function(t){Object.keys(t).map((function(r){e[r]=t[r]})),e.definitionLoaded=!0,e.onDefinitionLoadActions.run(),e.texture=e.engine.resourceManager.loadTexture(e.src),e.texture.runWhenLoaded(e.onTextureLoaded),e.bgColor&&e.engine.gl.clearColor(e.bgColor[0]/255,e.bgColor[1]/255,e.bgColor[2]/255,1)})),h(l(e),"onJsonLoadedFromZip",function(){var t,r=(t=a().mark((function t(r,n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return Object.keys(r).map((function(t){e[t]=r[t]})),e.definitionLoaded=!0,e.onDefinitionLoadActions.run(),t.next=5,e.engine.resourceManager.loadTextureFromZip(e.src,n);case 5:e.texture=t.sent,e.texture.runWhenLoaded(e.onTextureLoaded),e.bgColor&&e.engine.gl.clearColor(e.bgColor[0]/255,e.bgColor[1]/255,e.bgColor[2]/255,1);case 8:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){s(i,n,o,a,c,"next",t)}function c(t){s(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(t,e){return r.apply(this,arguments)}}()),h(l(e),"onTextureLoaded",(function(){e.loaded=!0,e.onLoadActions.run()})),h(l(e),"runWhenDefinitionLoaded",(function(t){e.definitionLoaded?t():e.onDefinitionLoadActions.add(t)})),h(l(e),"getTileVertices",(function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=r[0],i=r[1],a=null!==n?n:r[2];if(null!==n&&console.log("[Tileset.getTileVertices] tile=".concat(t,", offset=[").concat(r,"], heightOverride=").concat(n,", zOffset=").concat(a)),!e.geometry[t]||!e.geometry[t].vertices){if(console.warn("[Tileset.getTileVertices] Missing geometry for tile id ".concat(t,". Attempting fallback.")),!e.geometry[0]||!e.geometry[0].vertices){var s=[[[0,0,0],[1,0,0],[1,0,1]],[[0,0,0],[1,0,1],[0,0,1]]];return s.map((function(t){return t.map((function(t){return[t[0]+r[0],t[1]+i,t[2]+a]}))})).flat(3)}t=0}return e.geometry[t].vertices.map((function(t){return t.map((function(t){return[t[0]+o,t[1]+i,t[2]+a]}))})).flat(3)})),h(l(e),"getTileTexCoords",(function(t,r){var n=e.textures[r],o=[e.tileSize/e.sheetSize[0],e.tileSize/e.sheetSize[1]];return e.geometry[t].surfaces.map((function(t){return t.map((function(t){return[(t[0]+n[0])*o[0],(t[1]+n[1])*o[1]]}))})).flat(3)})),h(l(e),"getWalkability",(function(t){return e.geometry[t].type})),h(l(e),"getTileWalkPoly",(function(t){return e.geometry[t].walkPoly})),h(l(e),"getTileMetadata",(function(t){return e.tileMetadata[t]||{}})),e.engine=t,e.src=null,e.sheetSize=[0,0],e.tileSize=0,e.tiles={},e.tileMetadata={},e.loaded=!1,e.onLoadActions=new n.Z,e.onDefinitionLoadActions=new n.Z,e}return e=d,Object.defineProperty(e,"prototype",{writable:!1}),e}(o.Z),p=r(4395);function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function g(){g=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(p=v);var b=d.prototype=f.prototype=Object.create(p);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==y(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return h.prototype=d,s(b,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,a,"Generator"),s(b,o,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function m(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function v(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){m(i,n,o,a,s,"next",t)}function s(t){m(i,n,o,a,s,"throw",t)}a(void 0)}))}}function b(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var w=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.engine=e,this.tilesets={}}var e,r,n,o;return e=t,r=[{key:"loadFromZip",value:(o=v(g().mark((function t(e,r,n){var o,i,a,s;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(console.log("loading tileset from zip: "+r+" for "+n),!(o=this.tilesets[r])){t.next=4;break}return t.abrupt("return",o);case 4:return i=new d(this.engine),this.tilesets[r]=i,i.name=r,t.t0=JSON,t.next=10,e.file("tilesets/".concat(r,"/tileset.json")).async("string");case 10:return t.t1=t.sent,a=t.t0.parse.call(t.t0,t.t1),t.next=14,this.loadTilesetData(a,e);case 14:return s=t.sent,t.next=17,i.onJsonLoadedFromZip(s,e);case 17:return t.abrupt("return",i);case 18:case"end":return t.stop()}}),t,this)}))),function(t,e,r){return o.apply(this,arguments)})},{key:"loadTilesetData",value:(n=v(g().mark((function t(e,r){return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.extends){t.next=4;break}return t.next=3,Promise.all(e.extends.map(function(){var t=v(g().mark((function t(n){var o;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=JSON,t.next=3,r.file("tilesets/"+n+"/tileset.json").async("string");case 3:t.t1=t.sent,o=t.t0.parse.call(t.t0,t.t1),e=(0,p.Ee)(e,o);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 3:e.extends=null;case 4:return console.log({tilesetJson:e}),t.abrupt("return",{name:e.name,src:e.src,sheetSize:e.sheetSize,sheetOffsetX:e.sheetOffsetX,sheetOffsetY:e.sheetOffsetY,tileSize:e.tileSize,bgColor:e.bgColor,textures:e.textures,geometry:e.geometry,tiles:e.tiles});case 6:case"end":return t.stop()}}),t)}))),function(t,e){return n.apply(this,arguments)})}],r&&b(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),x=r(9010),_=r(2737),k=r(6083);function E(t){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(t)}function A(t,e,r){return A=I()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&C(o,r.prototype),o},A.apply(null,arguments)}function S(t){return function(t){if(Array.isArray(t))return L(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return L(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?L(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function O(){O=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(A([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==E(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function A(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=A,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function P(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function T(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){P(i,n,o,a,s,"next",t)}function s(t){P(i,n,o,a,s,"throw",t)}a(void 0)}))}}function C(t,e){return C=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},C(t,e)}function M(t,e){if(e&&("object"===E(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return j(t)}function j(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function I(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function B(t){return B=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},B(t)}function z(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var D=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&C(t,e)}(i,t);var e,r,n,o=(e=i,r=I(),function(){var t,n=B(e);if(r){var o=B(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return M(this,t)});function i(t,e,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),z(j(n=o.call(this,t)),"loadJson",T(O().mark((function t(){var e;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n.json.extends){t.next=4;break}return t.next=3,Promise.all(n.json.extends.map(function(){var t=T(O().mark((function t(e){var r;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=JSON,t.next=3,n.zip.file("sprites/"+e+".json").async("string");case 3:t.t1=t.sent,r=t.t0.parse.call(t.t0,t.t1),Object.assign(n.json,r);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 3:n.json.extends=null;case 4:n.update(n.json),n.src=n.json.src,n.portraitSrc=n.json.portraitSrc,n.sheetSize=n.json.sheetSize,n.tileSize=n.json.tileSize,n.state=null!==(e=n.json.state)&&void 0!==e?e:"intro",n.frames=n.json.frames,n.hotspotOffset=A(x.OW,S(n.json.hotspotOffset)),n.drawOffset={},Object.keys(n.json.drawOffset).forEach((function(t){n.drawOffset[t]=A(x.OW,S(n.json.drawOffset[t]))})),n.bindCamera=n.json.bindCamera,n.enableSpeech=n.json.enableSpeech;case 16:case"end":return t.stop()}}),t)})))),z(j(n),"onSelect",function(){var t=T(O().mark((function t(e,r){var o,i,a;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n.selectTrigger){t.next=2;break}return t.abrupt("return");case 2:if("interact"!==n.selectTrigger){t.next=6;break}return t.next=5,n.interact(j(n));case 5:return t.abrupt("return",t.sent);case 6:if(t.prev=6,console.log({trigger:n.selectTrigger}),(o=n.zip.file("triggers/".concat(n.selectTrigger,".lua")))||(o=n.zip.file("triggers/".concat(n.selectTrigger,".pxs"))),o){t.next=12;break}throw new Error("No Lua Script Found");case 12:return t.next=14,o.async("string");case 14:return i=t.sent,console.log({msg:"trigger lua statement",luaScript:i}),(a=new k.Z(n.engine)).setScope({_this:e,zone:r.zone,subject:r}),a.initLibrary(),a.run('print("hello world lua")'),t.next=22,a.run(i);case 22:return t.abrupt("return",t.sent);case 25:t.prev=25,t.t0=t.catch(6),console.log({msg:"no lua script found",e:t.t0});case 28:case"end":return t.stop()}}),t,null,[[6,25]])})));return function(e,r){return t.apply(this,arguments)}}()),n.json=e,n.zip=r,n}return n=i,Object.defineProperty(n,"prototype",{writable:!1}),n}(_.Z);function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function R(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=G(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function F(t,e,r){return F=q()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&Y(o,r.prototype),o},F.apply(null,arguments)}function U(t){return function(t){if(Array.isArray(t))return W(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||G(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){if(t){if("string"==typeof t)return W(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?W(t,e):void 0}}function W(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function V(){V=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==N(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Z(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function $(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Z(i,n,o,a,s,"next",t)}function s(t){Z(i,n,o,a,s,"throw",t)}a(void 0)}))}}function Y(t,e){return Y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Y(t,e)}function K(t,e){if(e&&("object"===N(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return H(t)}function H(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function q(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function X(t){return X=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},X(t)}function J(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Q=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Y(t,e)}(i,t);var e,r,n,o=(e=i,r=q(),function(){var t,n=X(e);if(r){var o=X(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return K(this,t)});function i(t,e,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),J(H(n=o.call(this,t)),"loadJson",$(V().mark((function t(){var e;return V().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n.json.extends){t.next=4;break}return t.next=3,Promise.all(n.json.extends.map(function(){var t=$(V().mark((function t(e){var r;return V().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=JSON,t.next=3,n.zip.file("sprites/"+e+".json").async("string");case 3:t.t1=t.sent,r=t.t0.parse.call(t.t0,t.t1),console.log({old:n.json,new:r}),n.json=(0,p.Ee)(n.json,r);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 3:n.json.extends=null;case 4:n.update(n.json),n.src=n.json.src,n.portraitSrc=n.json.portraitSrc,n.sheetSize=n.json.sheetSize,n.tileSize=n.json.tileSize,n.isLit=n.json.isLit,n.direction=n.json.direction,n.attenuation=n.json.attenuation,n.density=n.json.density,n.lightColor=n.json.lightColor,n.state=null!==(e=n.json.state)&&void 0!==e?e:"intro",n.frames=n.json.frames,n.drawOffset={},Object.keys(n.json.drawOffset).forEach((function(t){n.drawOffset[t]=F(x.OW,U(n.json.drawOffset[t]))})),n.hotspotOffset=F(x.OW,U(n.json.hotspotOffset)),n.bindCamera=n.json.bindCamera,n.enableSpeech=n.json.enableSpeech;case 21:case"end":return t.stop()}}),t)})))),J(H(n),"interact",function(){var t=$(V().mark((function t(e){var r,o,i,a,s,c,u,l,f=arguments;return V().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=f.length>1&&void 0!==f[1]?f[1]:function(){},i=null,a=null!==(r=n.json.states)&&void 0!==r?r:[],s={},t.next=6,Promise.all(a.map(function(){var t=$(V().mark((function t(r){var i,a,c,u;return V().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.loadActionDynamically(r,e,o);case 2:i=t.sent,a=R(i);try{for(a.s();!(c=a.n()).done;)u=c.value,console.log({msg:"loading action",action:u})}catch(t){a.e(t)}finally{a.f()}console.log({msg:"switching state",state:r.name}),s[r.name]={next:r.next,actions:i};case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 6:console.log({msg:"loading stateMachine",stateMachine:s}),i=[],c=R(s[n.state].actions),t.prev=9,c.s();case 11:if((u=c.n()).done){t.next=20;break}return l=u.value,t.t0=i,t.next=16,l(H(n),e,o);case 16:t.t1=t.sent,t.t0.push.call(t.t0,t.t1);case 18:t.next=11;break;case 20:t.next=25;break;case 22:t.prev=22,t.t2=t.catch(9),c.e(t.t2);case 25:return t.prev=25,c.f(),t.finish(25);case 28:return n.state=s[n.state].next,o&&o(!1),t.abrupt("return",i);case 31:case"end":return t.stop()}}),t,null,[[9,22,25,28]])})));return function(e){return t.apply(this,arguments)}}()),J(H(n),"loadActionDynamically",function(){var t=$(V().mark((function t(e,r,o){return V().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log({sprite:r,state:e}),t.next=3,Promise.all(e.actions.map(function(){var t=$(V().mark((function t(e){var i,a;return V().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(console.log({msg:"preping actions",action:e}),!e.callback||""===e.callback){t.next=7;break}return t.next=4,n.zip.file("callbacks/"+e.callback+".lua").async("string");case 4:t.t0=t.sent,t.next=8;break;case 7:t.t0='print("no callback")';case 8:i=t.t0,a=function(){console.log("calling callback");var t=new k.Z(n.engine);return t.setScope({_this:H(n),zone:r.zone,subject:r,finish:o}),t.initLibrary(),t.run('print("hello world lua - sprite callback")'),t.run(i)},t.t1=e.type,t.next="dialogue"===t.t1?13:"animate"===t.t1?15:17;break;case 13:return console.log({_this:H(n),finish:o}),t.abrupt("return",function(){var t=$(V().mark((function t(r,n,o){var i;return V().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:console.log({msg:"dialogue"}),i=new r.ActionLoader(r.engine,"dialogue",[JSON.stringify(e.dialogue),!1,{autoclose:!0,onClose:function(){return o(!0)}}],r,a),console.log({msg:"action to load",actionToLoad:i}),r.addAction(i);case 4:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}());case 15:return console.log({_this:H(n),finish:o}),t.abrupt("return",function(){var t=$(V().mark((function t(r,n,o){var i;return V().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:console.log({msg:"animate",_this:r,sprite:n,finish:o,action:e}),i=new r.ActionLoader(r.engine,"animate",[].concat(U(e.animate),[function(){return o(!0)}]),r,a),console.log({msg:"action to load",actionToLoad:i}),r.addAction(i);case 4:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}());case 17:return t.abrupt("return",function(){var t=$(V().mark((function t(e,r,n){return V().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:console.log({msg:"no action found",_this:e,sprite:r,_finish:n});case 1:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}());case 18:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}()),J(H(n),"onSelect",function(){var t=$(V().mark((function t(e,r){var o,i,a;return V().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n.selectTrigger){t.next=2;break}return t.abrupt("return");case 2:if("interact"!==n.selectTrigger){t.next=6;break}return t.next=5,n.interact(r,(function(){}));case 5:return t.abrupt("return",t.sent);case 6:if(t.prev=6,console.log({trigger:n.selectTrigger}),(o=n.zip.file("triggers/".concat(n.selectTrigger,".lua")))||(o=n.zip.file("triggers/".concat(n.selectTrigger,".pxs"))),o){t.next=12;break}throw new Error("No Lua Script Found");case 12:return t.next=14,o.async("string");case 14:return i=t.sent,console.log({msg:"trigger lua statement",luaScript:i}),(a=new k.Z(n.engine)).setScope({_this:H(n),zone:r.zone,subject:r}),a.initLibrary(),a.run('print("hello world lua")'),t.next=22,a.run(i);case 22:return t.abrupt("return",t.sent);case 25:t.prev=25,t.t0=t.catch(6),console.log({msg:"no lua script found",e:t.t0});case 28:case"end":return t.stop()}}),t,null,[[6,25]])})));return function(e,r){return t.apply(this,arguments)}}()),J(H(n),"onStep",function(){var t=$(V().mark((function t(e,r){var o,i,a;return V().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n.stepTrigger){t.next=2;break}return t.abrupt("return");case 2:if(t.prev=2,console.log({trigger:n.stepTrigger}),(o=n.zip.file("triggers/".concat(n.stepTrigger,".lua")))||(o=n.zip.file("triggers/".concat(n.stepTrigger,".pxs"))),o){t.next=8;break}throw new Error("No Lua Script Found");case 8:return t.next=10,o.async("string");case 10:return i=t.sent,console.log({msg:"trigger lua statement",luaScript:i}),(a=new k.Z(n.engine)).setScope({_this:H(n),zone:r.zone,subject:r}),a.initLibrary(),a.run('print("hello world lua")'),t.next=18,a.run(i);case 18:return t.abrupt("return",t.sent);case 21:t.prev=21,t.t0=t.catch(2),console.log({msg:"no lua script found",e:t.t0});case 24:case"end":return t.stop()}}),t,null,[[2,21]])})));return function(e,r){return t.apply(this,arguments)}}()),n.engine=t,n.json=e,n.zip=r,n.ActionLoader=Ut.a,n}return n=i,Object.defineProperty(n,"prototype",{writable:!1}),n}(r(4485).Z);function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){return et=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},et(t,e)}function rt(t,e){if(e&&("object"===tt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return nt(t)}function nt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ot(t){return ot=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ot(t)}function it(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var at=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&et(t,e)}(i,t);var e,r,n,o=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=ot(r);if(n){var o=ot(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return rt(this,t)});function i(t,e,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),it(nt(n=o.call(this,t,e,r)),"init",(function(){n.json.randomJitter?n.triggerTime=n.json.triggerTime+Math.floor(Math.random()*n.json.randomJitter):n.triggerTime=n.json.triggerTime})),it(nt(n),"tick",(function(t){0!=n.lastTime?(n.accumTime+=t-n.lastTime,n.accumTime<n.frameTime||0==n.animFrame&&n.accumTime<n.triggerTime||(5==n.animFrame?(n.setFrame(0),n.triggerTime=1e3+Math.floor(4e3*Math.random())):(n.setFrame(n.animFrame+1),n.accumTime=0,n.lastTime=t))):n.lastTime=t})),n}return e=i,Object.defineProperty(e,"prototype",{writable:!1}),e}(Q),st=r(3203);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ut(t,e){return ut=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ut(t,e)}function lt(t,e){if(e&&("object"===ct(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return ft(t)}function ft(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ht(t){return ht=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ht(t)}function dt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var pt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ut(t,e)}(i,t);var e,r,n,o=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=ht(r);if(n){var o=ht(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return lt(this,t)});function i(t,e,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),dt(ft(n=o.call(this,t,e,r)),"init",(function(){n.json.randomJitter?n.triggerTime=n.json.triggerTime+Math.floor(Math.random()*n.json.randomJitter):n.triggerTime=n.json.triggerTime})),dt(ft(n),"tick",(function(t){0!=n.lastTime?(n.accumTime+=t-n.lastTime,n.accumTime<n.frameTime||0==n.animFrame&&n.accumTime<n.triggerTime||(4==n.animFrame?(n.setFrame(0),n.triggerTime=2e3+Math.floor(4e3*Math.random())):(n.setFrame(n.animFrame+1),n.accumTime=0,n.lastTime=t))):n.lastTime=t})),dt(ft(n),"draw",(function(t){var e;n.loaded&&(t.renderManager.mvPushMatrix(),(0,st.Iu)(t.renderManager.uModelMat,t.renderManager.uModelMat,n.pos.toArray()),(0,st.Iu)(t.renderManager.uModelMat,t.renderManager.uModelMat,(null!==(e=n.drawOffset[t.renderManager.camera.cameraDir])&&void 0!==e?e:n.drawOffset.N).toArray()),(0,st.U1)(t.renderManager.uModelMat,t.renderManager.uModelMat,(0,x.Id)(90),[1,0,0]),t.renderManager.bindBuffer(n.vertexPosBuf,t.renderManager.shaderProgram.aVertexPosition),t.renderManager.bindBuffer(n.vertexTexBuf,t.renderManager.shaderProgram.aTextureCoord),n.texture.attach(),t.renderManager.effectPrograms.picker.setMatrixUniforms({id:n.getPickingId()}),t.renderManager.shaderProgram.setMatrixUniforms({id:n.getPickingId()}),t.gl.drawArrays(t.gl.TRIANGLES,0,n.vertexPosBuf.numItems),t.renderManager.mvPopMatrix())})),n}return e=i,Object.defineProperty(e,"prototype",{writable:!1}),e}(Q);function yt(t){return yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(t)}function gt(){gt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==yt(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function mt(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function vt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){mt(i,n,o,a,s,"next",t)}function s(t){mt(i,n,o,a,s,"throw",t)}a(void 0)}))}}function bt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var wt=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.engine=e,this.definitions=[],this.instances={}}var e,r,n;return e=t,r=[{key:"loadFromZip",value:(n=vt(gt().mark((function t(e,r,n){var o,i,a,s,c=arguments;return gt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log("loading sprite from zip: "+r+" for "+n),o=c[3],i=c[4],this.instances[r]||(this.instances[r]=[]),a="",t.prev=5,t.t0=JSON,t.next=9,e.file("sprites/".concat(r,".json")).async("string");case 9:t.t1=t.sent,a=t.t0.parse.call(t.t0,t.t1),t.next=16;break;case 13:t.prev=13,t.t2=t.catch(5),console.error(t.t2);case 16:s={},t.t3=a.type,t.next="animated-sprite"===t.t3?20:"animated-tile"===t.t3?24:"avatar"===t.t3?28:32;break;case 20:return s=new at(this.engine,a,e),t.next=23,s.loadJson();case 23:return t.abrupt("break",36);case 24:return s=new pt(this.engine,a,e),t.next=27,s.loadJson();case 27:return t.abrupt("break",36);case 28:return s=new D(this.engine,a,e),t.next=31,s.loadJson();case 31:return t.abrupt("break",36);case 32:return s=new Q(this.engine,a,e),t.next=35,s.loadJson();case 35:return t.abrupt("break",36);case 36:if(s.templateLoaded=!0,this.instances[r].forEach(function(){var t=vt(gt().mark((function t(e){return gt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.afterLoad){t.next=3;break}return t.next=3,e.afterLoad(e.instance);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),!i){t.next=41;break}return t.next=41,i(s);case 41:if(!o){t.next=48;break}if(!s.templateLoaded){t.next=47;break}return t.next=45,o(s);case 45:t.next=48;break;case 47:this.instances[r].push({instance:s,afterLoad:o});case 48:return t.abrupt("return",s);case 49:case"end":return t.stop()}}),t,this,[[5,13]])}))),function(t,e,r){return n.apply(this,arguments)})}],r&&bt(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),xt=(r(5867),r(1073));function _t(t){return _t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_t(t)}function kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Et(t,e,r){return Et=Mt()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&Pt(o,r.prototype),o},Et.apply(null,arguments)}function At(){At=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==_t(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function St(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function Lt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){St(i,n,o,a,s,"next",t)}function s(t){St(i,n,o,a,s,"throw",t)}a(void 0)}))}}function Ot(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Pt(t,e){return Pt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Pt(t,e)}function Tt(t,e){if(e&&("object"===_t(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ct(t)}function Ct(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Mt(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function jt(t){return jt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},jt(t)}function It(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Bt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pt(t,e)}(c,t);var e,r,o,i,a,s=(e=c,r=Mt(),function(){var t,n=jt(e);if(r){var o=jt(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return Tt(this,t)});function c(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),It(Ct(e=s.call(this)),"onLoad",(function(t){if(!e.loaded){if(e.zone=t.zone,t.id&&(e.id=t.id),t.pos&&(e.pos=t.pos,e.pos&&(null===e.pos.z||void 0===e.pos.z)))try{var r,n,o,i,a=e.pos.x+(null!==(r=null===(n=e.hotspotOffset)||void 0===n?void 0:n.x)&&void 0!==r?r:0),s=e.pos.y+(null!==(o=null===(i=e.hotspotOffset)||void 0===i?void 0:i.y)&&void 0!==o?o:0),c=e.zone.getHeight(a,s);e.pos.z="number"==typeof c?c:0}catch(t){console.warn("Error computing object height from zone",t),e.pos.z=0}t.isLit&&(e.isLit=t.isLit),t.lightColor&&(e.lightColor=t.lightColor),t.attenuation&&(e.attenuation=t.attenuation),t.direction&&(e.direction=t.direction),t.rotation&&(e.rotation=t.rotation),t.facing&&0!==t.facing&&(e.facing=t.facing),t.zones&&null!==t.zones&&(e.zones=t.zones);for(var u,l,f,h=t.mesh,d=null,p=null,y=null,g=0;g<h.vertices.length;g+=3){var m=h.vertices.slice(g,g+3);(null==u||m[0]>u)&&(u=m[0]),(null==d||m[0]<d)&&(d=m[0]),(null==l||m[1]>l)&&(l=m[1]),(null==p||m[1]<p)&&(p=m[1]),(null==f||m[2]>f)&&(f=m[2]),(null==y||m[2]<y)&&(y=m[2])}var v=new x.OW(u-d,f-y,l-p);e.size=v,e.scale=new x.OW(1/Math.max(v.x,v.z),1/Math.max(v.x,v.z),1/Math.max(v.x,v.z)),t.useScale&&(e.scale=t.useScale),e.drawOffset=new x.OW(.5,.5,0),e.mesh=h,e.engine.resourceManager.objLoader.initMeshBuffers(e.engine.gl,e.mesh),e.enableSpeech&&(e.speech=e.engine.resourceManager.loadSpeech(e.id,e.engine.mipmap),e.speech.runWhenLoaded(e.onTilesetOrTextureLoaded),e.speechTexBuf=e.engine.renderManager.createBuffer(e.getSpeechBubbleTexture(),e.engine.gl.DYNAMIC_DRAW,2)),e.portraitSrc&&(e.portrait=e.engine.resourceManager.loadTexture(e.portraitSrc),e.portrait.runWhenLoaded(e.onTilesetOrTextureLoaded)),e.isLit&&(e.lightIndex=e.engine.renderManager.lightManager.addLight(e.id,e.pos.toArray(),e.lightColor,[.01,.01,.01])),e.zone.tileset.runWhenDefinitionLoaded(e.onTilesetDefinitionLoaded)}})),It(Ct(e),"onLoadFromZip",function(){var t=Lt(At().mark((function t(r,n){var o,i,a,s,c,u,l,f,h,d,p,y,g,m,v,b,w;return At().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.loaded){t.next=2;break}return t.abrupt("return");case 2:if(e.zone=r.zone,r.id&&(e.id=r.id),r.pos&&(e.pos=r.pos,e.pos&&(null===e.pos.z||void 0===e.pos.z)))try{c=e.pos.x+(null!==(o=null===(i=e.hotspotOffset)||void 0===i?void 0:i.x)&&void 0!==o?o:0),u=e.pos.y+(null!==(a=null===(s=e.hotspotOffset)||void 0===s?void 0:s.y)&&void 0!==a?a:0),l=e.zone.getHeight(c,u),e.pos.z="number"==typeof l?l:0}catch(t){console.warn("Error computing object height from zone",t),e.pos.z=0}for(r.isLit&&(e.isLit=r.isLit),r.lightColor&&(e.lightColor=r.lightColor),r.attenuation&&(e.attenuation=r.attenuation),r.density&&(e.density=r.density),r.scatteringCoefficients&&(e.scatteringCoefficients=r.scatteringCoefficients),r.direction&&(e.direction=r.direction),r.rotation&&(e.rotation=r.rotation),r.facing&&0!==r.facing&&(e.facing=r.facing),r.zones&&null!==r.zones&&(e.zones=r.zones),f=r.mesh,d=null,y=null,m=null,v=0;v<f.vertices.length;v+=3)b=f.vertices.slice(v,v+3),(null==h||b[0]>h)&&(h=b[0]),(null==d||b[0]<d)&&(d=b[0]),(null==p||b[1]>p)&&(p=b[1]),(null==y||b[1]<y)&&(y=b[1]),(null==g||b[2]>g)&&(g=b[2]),(null==m||b[2]<m)&&(m=b[2]);if(w=new x.OW(h-d,g-m,p-y),e.size=w,e.scale=new x.OW(1/Math.max(w.x,w.z),1/Math.max(w.x,w.z),1/Math.max(w.x,w.z)),r.useScale&&(e.scale=r.useScale),e.drawOffset=new x.OW(.5,.5,0),e.mesh=f,e.engine.resourceManager.objLoader.initMeshBuffers(e.engine.gl,e.mesh),e.enableSpeech&&(e.speech=e.engine.resourceManager.loadSpeech(e.id,e.engine.mipmap),e.speech.runWhenLoaded(e.onTilesetOrTextureLoaded),e.speechTexBuf=e.engine.renderManager.createBuffer(e.getSpeechBubbleTexture(),e.engine.gl.DYNAMIC_DRAW,2)),!e.portraitSrc){t.next=32;break}return t.next=30,e.engine.resourceManager.loadTextureFromZip(e.portraitSrc,n);case 30:e.portrait=t.sent,e.portrait.runWhenLoaded(e.onTilesetOrTextureLoaded);case 32:e.isLit&&(e.lightIndex=e.engine.renderManager.lightManager.addLight(e.id,e.pos.toArray(),e.lightColor,e.attenuation,e.direction,e.density,e.scatteringCoefficients,!0)),e.zone.tileset.runWhenDefinitionLoaded(e.onTilesetDefinitionLoaded);case 34:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),It(Ct(e),"onTilesetDefinitionLoaded",(function(){e.zone.tileset.runWhenLoaded(e.onTilesetOrTextureLoaded)})),It(Ct(e),"onTilesetOrTextureLoaded",(function(){!Ct(e)||e.loaded||e.enableSpeech&&e.speech&&!e.speech.loaded||e.portrait&&!e.portrait.loaded||(e.init(),e.enableSpeech&&e.speech&&e.speech.clearHud&&(e.speech.clearHud(),e.speech.writeText(e.id),e.speech.loadImage()),e.loaded=!0,e.onLoadActions.run())})),It(Ct(e),"getSpeechBubbleTexture",(function(){return[[1,1],[0,1],[0,0],[1,1],[0,0],[1,0]].flat(3)})),It(Ct(e),"getSpeechBubbleVertices",(function(){return[Et(x.OW,[2,0,4]).toArray(),Et(x.OW,[0,0,4]).toArray(),Et(x.OW,[0,0,2]).toArray(),Et(x.OW,[2,0,4]).toArray(),Et(x.OW,[0,0,2]).toArray(),Et(x.OW,[2,0,2]).toArray()].flat(3)})),It(Ct(e),"attach",(function(t){var r=e.engine.gl;r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,t),r.uniform1i(e.engine.renderManager.shaderProgram.diffuseMapUniform,0)})),It(Ct(e),"drawTexturedObj",(function(){var t=Ct(e),r=t.engine,n=t.mesh;n.indicesPerMaterial.length>=1&&Object.keys(n.materialsByIndex).length>0?n.indicesPerMaterial.forEach((function(t,o){var i,a;r.renderManager.bindBuffer(n.vertexBuffer,r.renderManager.shaderProgram.aVertexPosition),r.renderManager.bindBuffer(n.textureBuffer,r.renderManager.shaderProgram.aTextureCoord),r.renderManager.bindBuffer(n.normalBuffer,r.renderManager.shaderProgram.aVertexNormal),r.gl.uniform3fv(r.renderManager.shaderProgram.uDiffuse,n.materialsByIndex[o].diffuse),r.gl.uniform1f(r.renderManager.shaderProgram.uSpecularExponent,n.materialsByIndex[o].specularExponent),(null===(i=n.materialsByIndex[o])||void 0===i||null===(a=i.mapDiffuse)||void 0===a?void 0:a.glTexture)?(e.attach(n.materialsByIndex[o].mapDiffuse.glTexture),r.gl.uniform1f(r.renderManager.shaderProgram.useDiffuse,1)):r.gl.uniform1f(r.renderManager.shaderProgram.useDiffuse,0),r.gl.uniform3fv(r.renderManager.shaderProgram.uSpecular,n.materialsByIndex[o].specular),r.gl.uniform1f(r.renderManager.shaderProgram.uSpecularExponent,n.materialsByIndex[o].specularExponent);var s=(0,xt._buildBuffer)(r.gl,r.gl.ELEMENT_ARRAY_BUFFER,t,1);r.gl.bindBuffer(r.gl.ELEMENT_ARRAY_BUFFER,s),r.renderManager.effectPrograms.picker.setMatrixUniforms({scale:e.scale,id:e.getPickingId(),sampler:0}),r.renderManager.shaderProgram.setMatrixUniforms({isSelected:e.isSelected,colorMultiplier:8&e.engine.frameCount?[1,0,0,1]:[1,1,0,1],scale:e.scale,sampler:0}),r.gl.drawElements(r.gl.TRIANGLES,s.numItems,r.gl.UNSIGNED_SHORT,0)})):(r.renderManager.bindBuffer(n.vertexBuffer,r.renderManager.shaderProgram.aVertexPosition),r.renderManager.bindBuffer(n.normalBuffer,r.renderManager.shaderProgram.aVertexNormal),r.renderManager.bindBuffer(n.textureBuffer,r.renderManager.shaderProgram.aTextureCoord),r.gl.bindBuffer(r.gl.ELEMENT_ARRAY_BUFFER,n.indexBuffer),r.gl.uniform3fv(r.renderManager.shaderProgram.uDiffuse,[.6,.3,.6]),r.gl.uniform3fv(r.renderManager.shaderProgram.uSpecular,[.1,.1,.2]),r.gl.uniform1f(r.renderManager.shaderProgram.uSpecularExponent,2),r.renderManager.effectPrograms.picker.setMatrixUniforms({scale:e.scale,id:e.getPickingId(),sampler:0}),r.renderManager.shaderProgram.setMatrixUniforms({isSelected:e.isSelected,colorMultiplier:8&e.engine.frameCount?[1,0,0,1]:[1,1,0,1],scale:e.scale,sampler:0}),r.gl.drawElements(r.gl.TRIANGLES,n.indexBuffer.numItems,r.gl.UNSIGNED_SHORT,0))})),It(Ct(e),"getPickingId",(function(){return[(e.objId>>0&255)/255,(e.objId>>8&255)/255,(e.objId>>16&255)/255,255]})),It(Ct(e),"drawObj",(function(){var t=Ct(e),r=t.engine,n=t.mesh;r.gl.disableVertexAttribArray(r.renderManager.shaderProgram.aTextureCoord),r.renderManager.bindBuffer(n.vertexBuffer,r.renderManager.shaderProgram.aVertexPosition),r.renderManager.bindBuffer(n.normalBuffer,r.renderManager.shaderProgram.aVertexNormal),r.gl.bindBuffer(r.gl.ELEMENT_ARRAY_BUFFER,n.indexBuffer),r.renderManager.effectPrograms.picker.setMatrixUniforms({scale:e.scale,id:e.getPickingId(),sampler:1}),r.renderManager.shaderProgram.setMatrixUniforms({scale:e.scale,sampler:1}),r.gl.drawElements(r.gl.TRIANGLES,n.indexBuffer.numItems,r.gl.UNSIGNED_SHORT,0)})),It(Ct(e),"draw",(function(){if(e.loaded){e.engine&&e.engine.renderManager&&e.engine.renderManager.debug&&e.engine.renderManager.debug.objectsDrawn++;var t=Ct(e),r=t.engine,n=t.mesh;if(r.gl.enableVertexAttribArray(r.renderManager.shaderProgram.aVertexNormal),r.gl.enableVertexAttribArray(r.renderManager.shaderProgram.aTextureCoord),r.renderManager.mvPushMatrix(),(0,st.Iu)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,e.drawOffset.toArray()),(0,st.Iu)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,e.pos.toArray()),(0,st.U1)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,(0,x.Id)(90),[1,0,0]),e.rotation&&e.rotation.toArray){var o=Math.max.apply(Math,function(t){if(Array.isArray(t))return kt(t)}(i=e.rotation.toArray())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(i)||function(t,e){if(t){if("string"==typeof t)return kt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kt(t,e):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());o>0&&(0,st.U1)(e.engine.renderManager.uModelMat,e.engine.renderManager.uModelMat,(0,x.Id)(o),[e.rotation.x/o,e.rotation.y/o,e.rotation.z/o])}n.textures.length?e.drawTexturedObj():e.drawObj(),r.renderManager.mvPopMatrix(),r.gl.enableVertexAttribArray(r.renderManager.shaderProgram.aTextureCoord),r.gl.disableVertexAttribArray(r.renderManager.shaderProgram.aVertexNormal)}var i})),It(Ct(e),"setFacing",(function(t){t&&(e.facing=t),e.rotation=p.Nm.objectSequence(t)})),It(Ct(e),"removeAction",(function(t){e.actionList=e.actionList.filter((function(e){return e.id!==t})),delete e.actionDict[t]})),It(Ct(e),"removeAllActions",(function(){e.actionList=[],e.actionDict={}})),It(Ct(e),"tickOuter",(function(t){if(e.loaded){e.actionList.sort((function(t,e){var r=t.startTime-e.startTime;return r?t.id>e.id?1:-1:r}));var r=[];e.actionList.forEach((function(e){!e.loaded||e.startTime>t||e.tick(t)&&(r.push(e),e.onComplete())})),r.forEach((function(t){return e.removeAction(t.id)})),e.tick&&e.tick(t)}})),It(Ct(e),"init",(function(){console.log("- object hook",e.id,e.pos,e.objId)})),It(Ct(e),"speak",(function(t){var r,n,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?(e.textbox=e.engine.hud.scrollText(e.id+":> "+t,!0,{portrait:null!==(r=e.portrait)&&void 0!==r&&r}),o&&e.speech&&(e.speech.scrollText(t,!1,{portrait:null!==(n=e.portrait)&&void 0!==n&&n}),e.speech.loadImage())):e.speech.clearHud()})),It(Ct(e),"interact",function(){var t=Lt(At().mark((function t(r,n){var o;return At().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=null,t.t0=e.state,t.next=4;break;case 4:return t.abrupt("break",5);case 5:return n&&n(!0),t.abrupt("return",o);case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),It(Ct(e),"setFacing",(function(t){t&&(e.facing=t),e.rotation=p.Nm.objectSequence(t)})),It(Ct(e),"faceDir",(function(t){return e.facing==t||t===p.Nm.None?null:new Ut.a(e.engine,"face",[t],Ct(e))})),It(Ct(e),"setGreeting",(function(t){return e.speech.clearHud&&e.speech.clearHud(),e.speech.writeText(t),e.speech.loadImage(),new Ut.a(e.engine,"greeting",[t,{autoclose:!0}],Ct(e))})),e.objId=Math.floor(100*Math.random()),e.engine=t,e.templateLoaded=!1,e.drawOffset=new x.OW(0,0,0),e.hotspotOffset=new x.OW(0,0,0),e.pos=new x.OW(0,0,0),e.size=new x.OW(1,1,1),e.scale=new x.OW(1,1,1),e.rotation=new x.OW(0,0,0),e.facing=p.Nm.Right,e.actionDict={},e.actionList=[],e.speech={},e.portrait=null,e.isLit=!0,e.lightColor=[1,1,1],e.lightIndex=null,e.onLoadActions=new n.Z,e.inventory=[],e.blocking=!0,e.override=!1,e.isSelected=!1,e}return o=c,i=[{key:"addAction",value:(a=Lt(At().mark((function t(e){return At().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.resolve(e);case 2:e=t.sent,this.actionDict[e.id]&&this.removeAction(e.id),this.actionDict[e.id]=e,this.actionList.push(e);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})}],i&&Ot(o.prototype,i),Object.defineProperty(o,"prototype",{writable:!1}),c}(o.Z);function zt(t){return zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zt(t)}function Dt(){Dt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==zt(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Nt(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function Rt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var Ft=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.engine=e,this.definitions=[],this.instances={}}var e,r,n,o;return e=t,r=[{key:"loadFromZip",value:(n=Dt().mark((function t(e,r){var n,o,i,a,s,c,u=arguments;return Dt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=u[2],i=u[3],this.instances[r.id]||(this.instances[r.id]=[]),(a=new Bt(this.engine)).update(r),s={obj:"".concat(a.type,".obj"),mtl:null!==(n=r.mtl)&&void 0!==n&&n,mtlTextureRoot:"textures",downloadMtlTextures:!0,enableWTextureCoord:!1,name:a.id},t.next=8,this.engine.resourceManager.objLoader.downloadModelsFromZip(this.engine.gl,[s],e);case 8:return c=t.sent,a.mesh=c[r.type],a.templateLoaded=!0,this.instances[a.id].forEach((function(t){t.afterLoad&&t.afterLoad(t.instance)})),i&&i(a),o&&(a.templateLoaded?o(a):this.instances[a.id].push({instance:a,afterLoad:o})),a.loaded=!0,t.abrupt("return",a);case 16:case"end":return t.stop()}}),t,this)})),o=function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){Nt(i,r,o,a,s,"next",t)}function s(t){Nt(i,r,o,a,s,"throw",t)}a(void 0)}))},function(t,e){return o.apply(this,arguments)})}],r&&Rt(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Ut=r(1183);function Gt(t){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gt(t)}function Wt(){Wt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==Gt(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Vt(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function Zt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var $t=function(){function t(e,r,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.type=e,this.world=r,this.callback=n,this.time=(new Date).getTime(),this.id=r.id+"-"+e+"-"+this.time}var e,r,n,o;return e=t,r=[{key:"configure",value:function(t,e,r,n,o){this.world=e,this.id=r,this.type=t,this.startTime=n,this.creationArgs=o}},{key:"onLoad",value:(n=Wt().mark((function t(e){return Wt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.init.apply(this,e);case 2:this.loaded=!0;case 3:case"end":return t.stop()}}),t,this)})),o=function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){Vt(i,r,o,a,s,"next",t)}function s(t){Vt(i,r,o,a,s,"throw",t)}a(void 0)}))},function(t){return o.apply(this,arguments)})},{key:"serialize",value:function(){return{id:this.id,time:this.startTime,world:this.world.id,type:this.type,args:this.creationArgs}}},{key:"onComplete",value:function(){return this.callback?this.callback():null}}],r&&Zt(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Yt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var Kt=function(){function t(e,r,n,o,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.engine=e,this.type=r,this.args=n,this.world=o,this.callback=i,this.instances={},this.definitions=[],this.assets={};var a=(new Date).getTime(),s=o.id+"-"+r+"-"+a;return this.load(r,(function(t){t.onLoad(n)}),(function(t){t.configure(r,o,s,a,n)}))}var e,n;return e=t,n=[{key:"load",value:function(t){var e=arguments[1],n=arguments[2];this.instances[t]||(this.instances[t]=[]);var o=new $t(this.type,this.world,this.callback);return Object.assign(o,r(7996)("./"+t+".js").default),o.templateLoaded=!0,this.instances[t].forEach((function(t){t.afterLoad&&t.afterLoad(t.instance)})),n&&n(o),e&&(o.templateLoaded?e(o):this.instances[t].push({instance:o,afterLoad:e})),o}}],n&&Yt(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();r(7122)},3203:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}}(t,e)||o(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}r.d(e,{Ez:()=>c,Fv:()=>g,G3:()=>u,Iu:()=>f,U1:()=>d,Ue:()=>s,XL:()=>y,fk:()=>h,oy:()=>l,t8:()=>p});var a=1e-6,s=function(){var t=new Float32Array(16);return t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},c=function(){var t=new Float32Array(9);return t[0]=1,t[4]=1,t[8]=1,t},u=function(t,e,r,n){var o=new Float32Array(16),i=1/Math.tan(t/2);if(o[0]=i/e,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=i,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=-1,o[11]=-1,o[12]=0,o[13]=0,o[14]=-2*r,o[15]=0,null!=n&&n!==1/0&&n!==r){var a=1/(r-n);o[10]=(n+r)*a,o[14]=2*n*r*a}return o},l=function(t,e,r,n,o,i){var a=new Float32Array(16);return a[0]=2*o/(e-t),a[1]=0,a[2]=(e+t)/(e-t),a[3]=0,a[4]=0,a[5]=2*o/(n-r),a[6]=(n+r)/(n-r),a[7]=0,a[8]=0,a[9]=0,a[10]=-(i+o)/(i-o),a[11]=-2*i*o/(i-o),a[12]=0,a[13]=0,a[14]=-1,a[15]=0,a},f=function(t,e,r){var o=t,i=n(r,3),a=i[0],s=i[1],c=i[2],u=n(e,12),l=u[0],f=u[1],h=u[2],d=u[3],p=u[4],y=u[5],g=u[6],m=u[7],v=u[8],b=u[9],w=u[10],x=u[11];return t!==e&&(o[0]=l,o[1]=f,o[2]=h,o[3]=d,o[4]=p,o[5]=y,o[6]=g,o[7]=m,o[8]=v,o[9]=b,o[10]=w,o[11]=x),o[12]=l*a+p*s+v*c+e[12],o[13]=f*a+y*s+b*c+e[13],o[14]=h*a+g*s+w*c+e[14],o[15]=d*a+m*s+x*c+e[15],o},h=function(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]},d=function(t,e,r,o){var i=t,s=n(o,3),c=s[0],u=s[1],l=s[2],f=Math.hypot(c,u,l);if(f<a)throw new Error("Matrix4*4 rotate has wrong axis");c*=f=1/f,u*=f,l*=f;var h=Math.sin(r),d=Math.cos(r),p=1-d,y=n(e,12),g=y[0],m=y[1],v=y[2],b=y[3],w=y[4],x=y[5],_=y[6],k=y[7],E=y[8],A=y[9],S=y[10],L=y[11],O=c*c*p+d,P=u*c*p+l*h,T=l*c*p-u*h,C=c*u*p-l*h,M=u*u*p+d,j=l*u*p+c*h,I=c*l*p+u*h,B=u*l*p-c*h,z=l*l*p+d;return i[0]=g*O+w*P+E*T,i[1]=m*O+x*P+A*T,i[2]=v*O+_*P+S*T,i[3]=b*O+k*P+L*T,i[4]=g*C+w*M+E*j,i[5]=m*C+x*M+A*j,i[6]=v*C+_*M+S*j,i[7]=b*C+k*M+L*j,i[8]=g*I+w*B+E*z,i[9]=m*I+x*B+A*z,i[10]=v*I+_*B+S*z,i[11]=b*I+k*B+L*z,e!==t&&(i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i};function p(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function y(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=e[4],s=e[5],c=e[6],u=e[7],l=e[8],f=e[9],h=e[10],d=e[11],p=e[12],y=e[13],g=e[14],m=e[15],v=r*s-n*a,b=r*c-o*a,w=r*u-i*a,x=n*c-o*s,_=n*u-i*s,k=o*u-i*c,E=l*y-f*p,A=l*g-h*p,S=l*m-d*p,L=f*g-h*y,O=f*m-d*y,P=h*m-d*g,T=v*P-b*O+w*L+x*S-_*A+k*E;return T?(T=1/T,t[0]=(s*P-c*O+u*L)*T,t[1]=(c*S-a*P-u*A)*T,t[2]=(a*O-s*S+u*E)*T,t[3]=(o*O-n*P-i*L)*T,t[4]=(r*P-o*S+i*A)*T,t[5]=(n*S-r*O-i*E)*T,t[6]=(y*k-g*_+m*x)*T,t[7]=(g*w-p*k-m*b)*T,t[8]=(p*_-y*w+m*v)*T,t):null}var g=function(t){var e,r=Math.hypot.apply(Math,function(t){if(Array.isArray(t))return i(t)}(e=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||o(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return!r||Math.abs(r)<a?[0,0,1]:[t[0]/r,t[1]/r,t[2]/r]}},9010:(t,e,r)=>{"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}r.d(e,{Id:()=>f,Lt:()=>s,OW:()=>a,t7:()=>l,t8:()=>c,tk:()=>u});var a=function(){function t(e,r,o){n(this,t),this.x=e,this.y=r,this.z=o}return i(t,[{key:"add",value:function(e){return new t(this.x+e.x,this.y+e.y,this.z+e.z)}},{key:"sub",value:function(e){return new t(this.x-e.x,this.y-e.y,this.z-e.z)}},{key:"mul",value:function(e){return new t(this.x*e,this.y*e,this.z*e)}},{key:"mul3",value:function(e){return new t(this.x*e.x,this.y*e.y,this.z*e.z)}},{key:"cross",value:function(e){return new t(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"distance",value:function(t){return this.sub(t).length()}},{key:"normal",value:function(){if(0===this.x&&0===this.y&&0===this.z)return new t(0,0,0);var e=this.length();return new t(this.x/e,this.y/e,this.z/e)}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y+this.z*t.z}},{key:"toArray",value:function(){return[this.x,this.y,this.z]}},{key:"toString",value:function(){return"( ".concat(this.x,", ").concat(this.y,", ").concat(this.z," )")}},{key:"negate",value:function(){return new t(-1*this.x,-1*this.y,-1*this.z)}}]),t}(),s=function(){function t(e,r,o,i){n(this,t),this.x=e,this.y=r,this.z=o,this.w=i}return i(t,[{key:"add",value:function(e){return new t(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)}},{key:"sub",value:function(e){return new t(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)}},{key:"mul",value:function(e){return new t(this.x*e,this.y*e,this.z*e,this.w*e)}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"distance",value:function(t){return this.sub(t).length()}},{key:"normal",value:function(){if(0===this.x&&0===this.y&&0===this.z&&0===this.w)return new t(0,0,0,0);var e=this.length();return new t(this.x/e,this.y/e,this.z/e,this.w/e)}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}},{key:"toArray",value:function(){return[this.x,this.y,this.z,this.w]}},{key:"toString",value:function(){return"( ".concat(this.x,", ").concat(this.y,", ").concat(this.z,", ").concat(this.w," )")}},{key:"negate",value:function(){return new a(-1*this.x,-1*this.y,-1*this.z,-1*this.w)}}]),t}();function c(t,e){e.x=t.x,e.y=t.y,e.z=t.z}function u(t,e){return e||(e=new a(-t.x,-t.y,-t.z)),e.x=-t.x,e.y=-t.y,e.z=-t.z,e}function l(t,e,r,n){return n||(n=t),n.x=t.x+r*(e.x-t.x),n.y=t.y+r*(e.y-t.y),n.z=t.z+r*(e.z-t.z),n}function f(t){return t*Math.PI/180}},6345:(t,e,r)=>{"use strict";e.NQ=void 0;var n=r(8354);n.default;var o=r(5121);o.Material,o.MaterialLibrary;var i=r(3068);i.Layout,i.TYPES,i.DuplicateAttributeException,i.Attribute;var a=r(1073);a.downloadModelsFromZip,a.downloadModels,a.downloadMeshes,a.initMeshBuffers,a.deleteMeshBuffers;e.NQ={Attribute:i.Attribute,DuplicateAttributeException:i.DuplicateAttributeException,Layout:i.Layout,Material:o.Material,MaterialLibrary:o.MaterialLibrary,Mesh:n.default,TYPES:i.TYPES,downloadModelsFromZip:a.downloadModelsFromZip,downloadModels:a.downloadModels,downloadMeshes:a.downloadMeshes,initMeshBuffers:a.initMeshBuffers,deleteMeshBuffers:a.deleteMeshBuffers,version:"2.0.3"}},3068:function(t,e){"use strict";var r,n,o=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};e.__esModule=!0,e.Layout=e.Attribute=e.DuplicateAttributeException=e.TYPES=void 0,function(t){t.BYTE="BYTE",t.UNSIGNED_BYTE="UNSIGNED_BYTE",t.SHORT="SHORT",t.UNSIGNED_SHORT="UNSIGNED_SHORT",t.FLOAT="FLOAT"}(n=e.TYPES||(e.TYPES={}));var a=function(t){function e(e){return t.call(this,"found duplicate attribute: ".concat(e.key))||this}return o(e,t),e}(Error);e.DuplicateAttributeException=a;var s=function(t,e,r,n){switch(void 0===n&&(n=!1),this.key=t,this.size=e,this.type=r,this.normalized=n,r){case"BYTE":case"UNSIGNED_BYTE":this.sizeOfType=1;break;case"SHORT":case"UNSIGNED_SHORT":this.sizeOfType=2;break;case"FLOAT":this.sizeOfType=4;break;default:throw new Error("Unknown gl type: ".concat(r))}this.sizeInBytes=this.sizeOfType*e};e.Attribute=s;var c=function(){function t(){for(var t,e,r,n,o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];this.attributes=o,this.attributeMap={};var c=0,u=0;try{for(var l=i(o),f=l.next();!f.done;f=l.next()){var h=f.value;if(this.attributeMap[h.key])throw new a(h);c%h.sizeOfType!=0&&(c+=h.sizeOfType-c%h.sizeOfType,console.warn("Layout requires padding before "+h.key+" attribute")),this.attributeMap[h.key]={attribute:h,size:h.size,type:h.type,normalized:h.normalized,offset:c},c+=h.sizeInBytes,u=Math.max(u,h.sizeOfType)}}catch(e){t={error:e}}finally{try{f&&!f.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}c%u!=0&&(c+=u-c%u,console.warn("Layout requires padding at the back")),this.stride=c;try{for(var d=i(o),p=d.next();!p.done;p=d.next())h=p.value,this.attributeMap[h.key].stride=this.stride}catch(t){r={error:t}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}}return t.POSITION=new s("position",3,n.FLOAT),t.NORMAL=new s("normal",3,n.FLOAT),t.TANGENT=new s("tangent",3,n.FLOAT),t.BITANGENT=new s("bitangent",3,n.FLOAT),t.UV=new s("uv",2,n.FLOAT),t.MATERIAL_INDEX=new s("materialIndex",1,n.SHORT),t.MATERIAL_ENABLED=new s("materialEnabled",1,n.UNSIGNED_SHORT),t.AMBIENT=new s("ambient",3,n.FLOAT),t.DIFFUSE=new s("diffuse",3,n.FLOAT),t.SPECULAR=new s("specular",3,n.FLOAT),t.SPECULAR_EXPONENT=new s("specularExponent",3,n.FLOAT),t.EMISSIVE=new s("emissive",3,n.FLOAT),t.TRANSMISSION_FILTER=new s("transmissionFilter",3,n.FLOAT),t.DISSOLVE=new s("dissolve",1,n.FLOAT),t.ILLUMINATION=new s("illumination",1,n.UNSIGNED_SHORT),t.REFRACTION_INDEX=new s("refractionIndex",1,n.FLOAT),t.SHARPNESS=new s("sharpness",1,n.FLOAT),t.MAP_DIFFUSE=new s("mapDiffuse",1,n.SHORT),t.MAP_AMBIENT=new s("mapAmbient",1,n.SHORT),t.MAP_SPECULAR=new s("mapSpecular",1,n.SHORT),t.MAP_SPECULAR_EXPONENT=new s("mapSpecularExponent",1,n.SHORT),t.MAP_DISSOLVE=new s("mapDissolve",1,n.SHORT),t.ANTI_ALIASING=new s("antiAliasing",1,n.UNSIGNED_SHORT),t.MAP_BUMP=new s("mapBump",1,n.SHORT),t.MAP_DISPLACEMENT=new s("mapDisplacement",1,n.SHORT),t.MAP_DECAL=new s("mapDecal",1,n.SHORT),t.MAP_EMISSIVE=new s("mapEmissive",1,n.SHORT),t}();e.Layout=c},5121:function(t,e){"use strict";var r=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};e.__esModule=!0,e.MaterialLibrary=e.Material=void 0;var o=function(t){this.name=t,this.ambient=[0,0,0],this.diffuse=[0,0,0],this.specular=[0,0,0],this.emissive=[0,0,0],this.transmissionFilter=[0,0,0],this.dissolve=0,this.specularExponent=0,this.transparency=0,this.illumination=0,this.refractionIndex=1,this.sharpness=0,this.mapDiffuse={colorCorrection:!1,horizontalBlending:!0,verticalBlending:!0,boostMipMapSharpness:0,modifyTextureMap:{brightness:0,contrast:1},offset:{u:0,v:0,w:0},scale:{u:1,v:1,w:1},turbulence:{u:0,v:0,w:0},clamp:!1,textureResolution:null,bumpMultiplier:1,imfChan:null,filename:""},this.mapAmbient={colorCorrection:!1,horizontalBlending:!0,verticalBlending:!0,boostMipMapSharpness:0,modifyTextureMap:{brightness:0,contrast:1},offset:{u:0,v:0,w:0},scale:{u:1,v:1,w:1},turbulence:{u:0,v:0,w:0},clamp:!1,textureResolution:null,bumpMultiplier:1,imfChan:null,filename:""},this.mapSpecular={colorCorrection:!1,horizontalBlending:!0,verticalBlending:!0,boostMipMapSharpness:0,modifyTextureMap:{brightness:0,contrast:1},offset:{u:0,v:0,w:0},scale:{u:1,v:1,w:1},turbulence:{u:0,v:0,w:0},clamp:!1,textureResolution:null,bumpMultiplier:1,imfChan:null,filename:""},this.mapSpecularExponent={colorCorrection:!1,horizontalBlending:!0,verticalBlending:!0,boostMipMapSharpness:0,modifyTextureMap:{brightness:0,contrast:1},offset:{u:0,v:0,w:0},scale:{u:1,v:1,w:1},turbulence:{u:0,v:0,w:0},clamp:!1,textureResolution:null,bumpMultiplier:1,imfChan:null,filename:""},this.mapDissolve={colorCorrection:!1,horizontalBlending:!0,verticalBlending:!0,boostMipMapSharpness:0,modifyTextureMap:{brightness:0,contrast:1},offset:{u:0,v:0,w:0},scale:{u:1,v:1,w:1},turbulence:{u:0,v:0,w:0},clamp:!1,textureResolution:null,bumpMultiplier:1,imfChan:null,filename:""},this.antiAliasing=!1,this.mapBump={colorCorrection:!1,horizontalBlending:!0,verticalBlending:!0,boostMipMapSharpness:0,modifyTextureMap:{brightness:0,contrast:1},offset:{u:0,v:0,w:0},scale:{u:1,v:1,w:1},turbulence:{u:0,v:0,w:0},clamp:!1,textureResolution:null,bumpMultiplier:1,imfChan:null,filename:""},this.mapDisplacement={colorCorrection:!1,horizontalBlending:!0,verticalBlending:!0,boostMipMapSharpness:0,modifyTextureMap:{brightness:0,contrast:1},offset:{u:0,v:0,w:0},scale:{u:1,v:1,w:1},turbulence:{u:0,v:0,w:0},clamp:!1,textureResolution:null,bumpMultiplier:1,imfChan:null,filename:""},this.mapDecal={colorCorrection:!1,horizontalBlending:!0,verticalBlending:!0,boostMipMapSharpness:0,modifyTextureMap:{brightness:0,contrast:1},offset:{u:0,v:0,w:0},scale:{u:1,v:1,w:1},turbulence:{u:0,v:0,w:0},clamp:!1,textureResolution:null,bumpMultiplier:1,imfChan:null,filename:""},this.mapEmissive={colorCorrection:!1,horizontalBlending:!0,verticalBlending:!0,boostMipMapSharpness:0,modifyTextureMap:{brightness:0,contrast:1},offset:{u:0,v:0,w:0},scale:{u:1,v:1,w:1},turbulence:{u:0,v:0,w:0},clamp:!1,textureResolution:null,bumpMultiplier:1,imfChan:null,filename:""},this.mapReflections=[]};e.Material=o;var i=new o("sentinel"),a=function(){function t(t){this.data=t,this.currentMaterial=i,this.materials={},this.parse()}return t.prototype.parse_newmtl=function(t){var e=t[0];this.currentMaterial=new o(e),this.materials[e]=this.currentMaterial},t.prototype.parseColor=function(t){if("spectral"==t[0])throw new Error("The MTL parser does not support spectral curve files. You will need to convert the MTL colors to either RGB or CIEXYZ.");if("xyz"==t[0])throw new Error("The MTL parser does not currently support XYZ colors. Either convert the XYZ values to RGB or create an issue to add support for XYZ");if(3==t.length){var e=r(t,3),n=e[0],o=e[1],i=e[2];return[parseFloat(n),parseFloat(o),parseFloat(i)]}var a=parseFloat(t[0]);return[a,a,a]},t.prototype.parse_Ka=function(t){this.currentMaterial.ambient=this.parseColor(t)},t.prototype.parse_Kd=function(t){this.currentMaterial.diffuse=this.parseColor(t)},t.prototype.parse_Ks=function(t){this.currentMaterial.specular=this.parseColor(t)},t.prototype.parse_Ke=function(t){this.currentMaterial.emissive=this.parseColor(t)},t.prototype.parse_Tf=function(t){this.currentMaterial.transmissionFilter=this.parseColor(t)},t.prototype.parse_d=function(t){this.currentMaterial.dissolve=parseFloat(t.pop()||"0")},t.prototype.parse_illum=function(t){this.currentMaterial.illumination=parseInt(t[0])},t.prototype.parse_Ni=function(t){this.currentMaterial.refractionIndex=parseFloat(t[0])},t.prototype.parse_Ns=function(t){this.currentMaterial.specularExponent=parseInt(t[0])},t.prototype.parse_sharpness=function(t){this.currentMaterial.sharpness=parseInt(t[0])},t.prototype.parse_cc=function(t,e){e.colorCorrection="on"==t[0]},t.prototype.parse_blendu=function(t,e){e.horizontalBlending="on"==t[0]},t.prototype.parse_blendv=function(t,e){e.verticalBlending="on"==t[0]},t.prototype.parse_boost=function(t,e){e.boostMipMapSharpness=parseFloat(t[0])},t.prototype.parse_mm=function(t,e){e.modifyTextureMap.brightness=parseFloat(t[0]),e.modifyTextureMap.contrast=parseFloat(t[1])},t.prototype.parse_ost=function(t,e,r){for(;t.length<3;)t.push(r.toString());e.u=parseFloat(t[0]),e.v=parseFloat(t[1]),e.w=parseFloat(t[2])},t.prototype.parse_o=function(t,e){this.parse_ost(t,e.offset,0)},t.prototype.parse_s=function(t,e){this.parse_ost(t,e.scale,1)},t.prototype.parse_t=function(t,e){this.parse_ost(t,e.turbulence,0)},t.prototype.parse_texres=function(t,e){e.textureResolution=parseFloat(t[0])},t.prototype.parse_clamp=function(t,e){e.clamp="on"==t[0]},t.prototype.parse_bm=function(t,e){e.bumpMultiplier=parseFloat(t[0])},t.prototype.parse_imfchan=function(t,e){e.imfChan=t[0]},t.prototype.parse_type=function(t,e){e.reflectionType=t[0]},t.prototype.parseOptions=function(t){var e,r,n={colorCorrection:!1,horizontalBlending:!0,verticalBlending:!0,boostMipMapSharpness:0,modifyTextureMap:{brightness:0,contrast:1},offset:{u:0,v:0,w:0},scale:{u:1,v:1,w:1},turbulence:{u:0,v:0,w:0},clamp:!1,textureResolution:null,bumpMultiplier:1,imfChan:null,filename:""},o={};for(t.reverse();t.length;){var i=t.pop();i.startsWith("-")?o[e=i.substr(1)]=[]:e&&o[e].push(i)}for(e in o)if(o.hasOwnProperty(e)){r=o[e];var a=this["parse_".concat(e)];a&&a.bind(this)(r,n)}return n},t.prototype.parseMap=function(t){var e,n,o="";t[0].startsWith("-")?(o=t.pop(),n=t):(o=(e=r(t))[0],n=e.slice(1));var i=this.parseOptions(n);return i.filename=o.replace(/\\/g,"/"),i},t.prototype.parse_map_Ka=function(t){this.currentMaterial.mapAmbient=this.parseMap(t)},t.prototype.parse_map_Kd=function(t){this.currentMaterial.mapDiffuse=this.parseMap(t)},t.prototype.parse_map_Ks=function(t){this.currentMaterial.mapSpecular=this.parseMap(t)},t.prototype.parse_map_Ke=function(t){this.currentMaterial.mapEmissive=this.parseMap(t)},t.prototype.parse_map_Ns=function(t){this.currentMaterial.mapSpecularExponent=this.parseMap(t)},t.prototype.parse_map_d=function(t){this.currentMaterial.mapDissolve=this.parseMap(t)},t.prototype.parse_map_aat=function(t){this.currentMaterial.antiAliasing="on"==t[0]},t.prototype.parse_map_bump=function(t){this.currentMaterial.mapBump=this.parseMap(t)},t.prototype.parse_bump=function(t){this.parse_map_bump(t)},t.prototype.parse_disp=function(t){this.currentMaterial.mapDisplacement=this.parseMap(t)},t.prototype.parse_decal=function(t){this.currentMaterial.mapDecal=this.parseMap(t)},t.prototype.parse_refl=function(t){this.currentMaterial.mapReflections.push(this.parseMap(t))},t.prototype.parse=function(){var t,e,o=this.data.split(/\r?\n/);try{for(var a=n(o),s=a.next();!s.done;s=a.next()){var c=s.value;if((c=c.trim())&&!c.startsWith("#")){var u=r(c.split(/\s/)),l=u[0],f=u.slice(1),h=this["parse_".concat(l)];h?h.bind(this)(f):console.warn("Don't know how to parse the directive: \"".concat(l,'"'))}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}delete this.data,this.currentMaterial=i},t}();e.MaterialLibrary=a},8354:function(t,e,r){"use strict";var n=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};e.__esModule=!0;var s=r(3068),c=function(){function t(t,e){var r,n,s,c;this.name="",this.indicesPerMaterial=[],this.materialsByIndex={},this.tangents=[],this.bitangents=[],(e=e||{}).materials=e.materials||{},e.enableWTextureCoord=!!e.enableWTextureCoord,this.vertexNormals=[],this.textures=[],this.indices=[],this.textureStride=e.enableWTextureCoord?3:2;var l=[],f=[],h=[],d=[],p={},y=-1,g=0,m={verts:[],norms:[],textures:[],hashindices:{},indices:[[]],materialIndices:[],index:0},v=/^v\s/,b=/^vn\s/,w=/^vt\s/,x=/^f\s/,_=/\s+/,k=/^usemtl/,E=t.split("\n");try{for(var A=o(E),S=A.next();!S.done;S=A.next()){var L=S.value;if((L=L.trim())&&!L.startsWith("#")){var O=L.split(_);if(O.shift(),v.test(L))l.push.apply(l,a([],i(O),!1));else if(b.test(L))f.push.apply(f,a([],i(O),!1));else if(w.test(L)){var P=parseFloat(O[0]),T=O.length>1?1-parseFloat(O[1]):0;if(e.enableWTextureCoord){var C=O.length>2?parseFloat(O[2]):0;h.push(P.toString(),T.toString(),C.toString())}else h.push(P.toString(),T.toString())}else if(k.test(L)){var M=O[0];M in p||(d.push(M),p[M]=d.length-1,p[M]>0&&m.indices.push([])),g=y=p[M]}else if(x.test(L)){var j=u(O);try{for(var I=(s=void 0,o(j)),B=I.next();!B.done;B=I.next())for(var z=B.value,D=0,N=z.length;D<N;D++){var R=z[D]+","+y;if(R in m.hashindices)m.indices[g].push(m.hashindices[R]);else{var F=z[D].split("/"),U=F.length-1;if(m.verts.push(+l[3*(+F[0]-1)+0]),m.verts.push(+l[3*(+F[0]-1)+1]),m.verts.push(+l[3*(+F[0]-1)+2]),h.length){var G=e.enableWTextureCoord?3:2;m.textures.push(+h[(+F[1]-1)*G+0]),m.textures.push(+h[(+F[1]-1)*G+1]),e.enableWTextureCoord&&m.textures.push(+h[(+F[1]-1)*G+2])}m.norms.push(+f[3*(+F[U]-1)+0]),m.norms.push(+f[3*(+F[U]-1)+1]),m.norms.push(+f[3*(+F[U]-1)+2]),m.materialIndices.push(y),m.hashindices[R]=m.index,m.indices[g].push(m.hashindices[R]),m.index+=1}}}catch(t){s={error:t}}finally{try{B&&!B.done&&(c=I.return)&&c.call(I)}finally{if(s)throw s.error}}}}}}catch(t){r={error:t}}finally{try{S&&!S.done&&(n=A.return)&&n.call(A)}finally{if(r)throw r.error}}this.vertices=m.verts,this.vertexNormals=m.norms,this.textures=m.textures,this.vertexMaterialIndices=m.materialIndices,this.indices=m.indices[g],this.indicesPerMaterial=m.indices,this.materialNames=d,this.materialIndices=p,this.materialsByIndex={},e.calcTangentsAndBitangents&&this.calculateTangentsAndBitangents()}return t.prototype.calculateTangentsAndBitangents=function(){console.assert(!!(this.vertices&&this.vertices.length&&this.vertexNormals&&this.vertexNormals.length&&this.textures&&this.textures.length),"Missing attributes for calculating tangents and bitangents");for(var t={tangents:a([],i(new Array(this.vertices.length)),!1).map((function(t){return 0})),bitangents:a([],i(new Array(this.vertices.length)),!1).map((function(t){return 0}))},e=this.indices,r=this.vertices,n=this.vertexNormals,o=this.textures,s=0;s<e.length;s+=3){var c=e[s+0],u=e[s+1],l=e[s+2],f=r[3*c+0],h=r[3*c+1],d=r[3*c+2],p=o[2*c+0],y=o[2*c+1],g=r[3*u+0],m=r[3*u+1],v=r[3*u+2],b=o[2*u+0],w=o[2*u+1],x=g-f,_=m-h,k=v-d,E=r[3*l+0]-f,A=r[3*l+1]-h,S=r[3*l+2]-d,L=b-p,O=w-y,P=o[2*l+0]-p,T=o[2*l+1]-y,C=L*T-O*P,M=1/Math.abs(C<1e-4?1:C),j=(x*T-E*O)*M,I=(_*T-A*O)*M,B=(k*T-S*O)*M,z=(E*L-x*P)*M,D=(A*L-_*P)*M,N=(S*L-k*P)*M,R=n[3*c+0],F=n[3*c+1],U=n[3*c+2],G=n[3*u+0],W=n[3*u+1],V=n[3*u+2],Z=n[3*l+0],$=n[3*l+1],Y=n[3*l+2],K=j*R+I*F+B*U,H=j*G+I*W+B*V,q=j*Z+I*$+B*Y,X=j-R*K,J=I-F*K,Q=B-U*K,tt=j-G*H,et=I-W*H,rt=B-V*H,nt=j-Z*q,ot=I-$*q,it=B-Y*q,at=Math.sqrt(X*X+J*J+Q*Q),st=Math.sqrt(tt*tt+et*et+rt*rt),ct=Math.sqrt(nt*nt+ot*ot+it*it),ut=z*R+D*F+N*U,lt=z*G+D*W+N*V,ft=z*Z+D*$+N*Y,ht=z-R*ut,dt=D-F*ut,pt=N-U*ut,yt=z-G*lt,gt=D-W*lt,mt=N-V*lt,vt=z-Z*ft,bt=D-$*ft,wt=N-Y*ft,xt=Math.sqrt(ht*ht+dt*dt+pt*pt),_t=Math.sqrt(yt*yt+gt*gt+mt*mt),kt=Math.sqrt(vt*vt+bt*bt+wt*wt);t.tangents[3*c+0]+=X/at,t.tangents[3*c+1]+=J/at,t.tangents[3*c+2]+=Q/at,t.tangents[3*u+0]+=tt/st,t.tangents[3*u+1]+=et/st,t.tangents[3*u+2]+=rt/st,t.tangents[3*l+0]+=nt/ct,t.tangents[3*l+1]+=ot/ct,t.tangents[3*l+2]+=it/ct,t.bitangents[3*c+0]+=ht/xt,t.bitangents[3*c+1]+=dt/xt,t.bitangents[3*c+2]+=pt/xt,t.bitangents[3*u+0]+=yt/_t,t.bitangents[3*u+1]+=gt/_t,t.bitangents[3*u+2]+=mt/_t,t.bitangents[3*l+0]+=vt/kt,t.bitangents[3*l+1]+=bt/kt,t.bitangents[3*l+2]+=wt/kt}this.tangents=t.tangents,this.bitangents=t.bitangents},t.prototype.makeBufferData=function(t){var e,r,n=this.vertices.length/3,i=new ArrayBuffer(t.stride*n);i.numItems=n;for(var a=new DataView(i),c=0,u=0;c<n;c++){u=c*t.stride;try{for(var l=(e=void 0,o(t.attributes)),f=l.next();!f.done;f=l.next()){var h=f.value,d=u+t.attributeMap[h.key].offset;switch(h.key){case s.Layout.POSITION.key:a.setFloat32(d,this.vertices[3*c],!0),a.setFloat32(d+4,this.vertices[3*c+1],!0),a.setFloat32(d+8,this.vertices[3*c+2],!0);break;case s.Layout.UV.key:a.setFloat32(d,this.textures[2*c],!0),a.setFloat32(d+4,this.textures[2*c+1],!0);break;case s.Layout.NORMAL.key:a.setFloat32(d,this.vertexNormals[3*c],!0),a.setFloat32(d+4,this.vertexNormals[3*c+1],!0),a.setFloat32(d+8,this.vertexNormals[3*c+2],!0);break;case s.Layout.MATERIAL_INDEX.key:a.setInt16(d,this.vertexMaterialIndices[c],!0);break;case s.Layout.AMBIENT.key:var p=this.vertexMaterialIndices[c];if(!(y=this.materialsByIndex[p])){console.warn('Material "'+this.materialNames[p]+'" not found in mesh. Did you forget to call addMaterialLibrary(...)?"');break}a.setFloat32(d,y.ambient[0],!0),a.setFloat32(d+4,y.ambient[1],!0),a.setFloat32(d+8,y.ambient[2],!0);break;case s.Layout.DIFFUSE.key:if(p=this.vertexMaterialIndices[c],!(y=this.materialsByIndex[p])){console.warn('Material "'+this.materialNames[p]+'" not found in mesh. Did you forget to call addMaterialLibrary(...)?"');break}a.setFloat32(d,y.diffuse[0],!0),a.setFloat32(d+4,y.diffuse[1],!0),a.setFloat32(d+8,y.diffuse[2],!0);break;case s.Layout.SPECULAR.key:if(p=this.vertexMaterialIndices[c],!(y=this.materialsByIndex[p])){console.warn('Material "'+this.materialNames[p]+'" not found in mesh. Did you forget to call addMaterialLibrary(...)?"');break}a.setFloat32(d,y.specular[0],!0),a.setFloat32(d+4,y.specular[1],!0),a.setFloat32(d+8,y.specular[2],!0);break;case s.Layout.SPECULAR_EXPONENT.key:if(p=this.vertexMaterialIndices[c],!(y=this.materialsByIndex[p])){console.warn('Material "'+this.materialNames[p]+'" not found in mesh. Did you forget to call addMaterialLibrary(...)?"');break}a.setFloat32(d,y.specularExponent,!0);break;case s.Layout.EMISSIVE.key:if(p=this.vertexMaterialIndices[c],!(y=this.materialsByIndex[p])){console.warn('Material "'+this.materialNames[p]+'" not found in mesh. Did you forget to call addMaterialLibrary(...)?"');break}a.setFloat32(d,y.emissive[0],!0),a.setFloat32(d+4,y.emissive[1],!0),a.setFloat32(d+8,y.emissive[2],!0);break;case s.Layout.TRANSMISSION_FILTER.key:if(p=this.vertexMaterialIndices[c],!(y=this.materialsByIndex[p])){console.warn('Material "'+this.materialNames[p]+'" not found in mesh. Did you forget to call addMaterialLibrary(...)?"');break}a.setFloat32(d,y.transmissionFilter[0],!0),a.setFloat32(d+4,y.transmissionFilter[1],!0),a.setFloat32(d+8,y.transmissionFilter[2],!0);break;case s.Layout.DISSOLVE.key:if(p=this.vertexMaterialIndices[c],!(y=this.materialsByIndex[p])){console.warn('Material "'+this.materialNames[p]+'" not found in mesh. Did you forget to call addMaterialLibrary(...)?"');break}a.setFloat32(d,y.dissolve,!0);break;case s.Layout.ILLUMINATION.key:if(p=this.vertexMaterialIndices[c],!(y=this.materialsByIndex[p])){console.warn('Material "'+this.materialNames[p]+'" not found in mesh. Did you forget to call addMaterialLibrary(...)?"');break}a.setInt16(d,y.illumination,!0);break;case s.Layout.REFRACTION_INDEX.key:if(p=this.vertexMaterialIndices[c],!(y=this.materialsByIndex[p])){console.warn('Material "'+this.materialNames[p]+'" not found in mesh. Did you forget to call addMaterialLibrary(...)?"');break}a.setFloat32(d,y.refractionIndex,!0);break;case s.Layout.SHARPNESS.key:if(p=this.vertexMaterialIndices[c],!(y=this.materialsByIndex[p])){console.warn('Material "'+this.materialNames[p]+'" not found in mesh. Did you forget to call addMaterialLibrary(...)?"');break}a.setFloat32(d,y.sharpness,!0);break;case s.Layout.ANTI_ALIASING.key:var y;if(p=this.vertexMaterialIndices[c],!(y=this.materialsByIndex[p])){console.warn('Material "'+this.materialNames[p]+'" not found in mesh. Did you forget to call addMaterialLibrary(...)?"');break}a.setInt16(d,y.antiAliasing?1:0,!0)}}}catch(t){e={error:t}}finally{try{f&&!f.done&&(r=l.return)&&r.call(l)}finally{if(e)throw e.error}}}return i},t.prototype.makeIndexBufferData=function(){var t=new Uint16Array(this.indices);return t.numItems=this.indices.length,t},t.prototype.makeIndexBufferDataForMaterials=function(){for(var t,e=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=(t=new Array).concat.apply(t,a([],i(r.map((function(t){return e.indicesPerMaterial[t]}))),!1)),s=new Uint16Array(o);return s.numItems=o.length,s},t.prototype.addMaterialLibrary=function(t){for(var e in t.materials)if(e in this.materialIndices){var r=t.materials[e],n=this.materialIndices[r.name];this.materialsByIndex[n]=r}},t}();function u(t){var e;return n(this,(function(r){switch(r.label){case 0:return t.length<=3?[4,t]:[3,2];case 1:return r.sent(),[3,9];case 2:return 4!==t.length?[3,5]:[4,[t[0],t[1],t[2]]];case 3:return r.sent(),[4,[t[2],t[3],t[0]]];case 4:return r.sent(),[3,9];case 5:e=1,r.label=6;case 6:return e<t.length-1?[4,[t[0],t[e],t[e+1]]]:[3,9];case 7:r.sent(),r.label=8;case 8:return e++,[3,6];case 9:return[2]}}))}e.default=c},1073:function(t,e,r){"use strict";var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};e.__esModule=!0,e.deleteMeshBuffers=e.initMeshBuffers=e._buildBuffer=e.downloadMeshes=e.downloadModels=e.downloadModelsFromZip=void 0;var i=r(8354),a=r(5121);function s(t,e){var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(e)),r}function c(t,e,r){var o,i,a=["mapDiffuse","mapAmbient","mapSpecular","mapDissolve","mapBump","mapDisplacement","mapDecal","mapEmissive"];r.endsWith("/")||(r+="/");var c=[];for(var u in e.materials)if(e.materials.hasOwnProperty(u)){var l=e.materials[u],f=function(e){var n=l[e];if(!n||!n.filename)return"continue";var o=r+n.filename;c.push(fetch(o).then((function(t){if(!t.ok)throw new Error;return t.blob()})).then((function(e){var r=new Image;r.src=URL.createObjectURL(e),n.texture=r;var o=s(t,[128,192,86,255]);return n.glTexture=o,r.onload=function(){t.bindTexture(t.TEXTURE_2D,n.glTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n.texture);var e=function(t){return 0==(t&t-1)&&t>0};e(r.width)&&e(r.height)?(t.generateMipmap(t.TEXTURE_2D),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)},new Promise((function(t){return r.onload=function(){return t(n)}}))})).catch((function(){console.error("Unable to download texture: ".concat(o))})))};try{for(var h=(o=void 0,n(a)),d=h.next();!d.done;d=h.next())f(d.value)}catch(t){o={error:t}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(o)throw o.error}}}return Promise.all(c)}function u(t,e,r,o){var i,a,c=["mapDiffuse","mapAmbient","mapSpecular","mapDissolve","mapBump","mapDisplacement","mapDecal","mapEmissive"];r.endsWith("/")||(r+="/");var u=[];for(var l in e.materials)if(e.materials.hasOwnProperty(l)){var f=e.materials[l],h=function(e){var n=f[e];if(!n||!n.filename)return"continue";var i=r+n.filename;u.push(o.file(i).async("arrayBuffer").then((function(t){var e=new Uint8Array(t);return new Blob([e.buffer])})).then((function(e){var r=new Image;r.src=URL.createObjectURL(e),n.texture=r;var o=s(t,[128,192,86,255]);return n.glTexture=o,r.onload=function(){t.bindTexture(t.TEXTURE_2D,n.glTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n.texture);var e=function(t){return 0==(t&t-1)&&t>0};e(r.width)&&e(r.height)?(t.generateMipmap(t.TEXTURE_2D),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)},new Promise((function(t){return r.onload=function(){return t(n)}}))})).catch((function(){console.error("Unable to download texture from zip: ".concat(i))})))};try{for(var d=(i=void 0,n(c)),p=d.next();!p.done;p=d.next())h(p.value)}catch(t){i={error:t}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}}return Promise.all(u)}function l(t){return"string"!=typeof t.mtl?t.obj.replace(/\.obj$/,".mtl"):t.mtl}function f(t,e,r,n){var o=t.createBuffer(),i=e===t.ARRAY_BUFFER?Float32Array:Uint16Array;return t.bindBuffer(e,o),t.bufferData(e,new i(r),t.STATIC_DRAW),o.itemSize=n,o.numItems=r.length/n,o}e.downloadModelsFromZip=function(t,e,r){var s,c,f=[],h=function(e){if(!e.obj)throw new Error('"obj" attribute of model object not set. The .obj file is required to be set in order to use downloadModels()');var n={indicesPerMaterial:!!e.indicesPerMaterial,calcTangentsAndBitangents:!!e.calcTangentsAndBitangents},o=e.obj.split("/"),s=o[o.length-1].replace(".obj",""),c=Promise.resolve(s),h=r.file("models/".concat(s,".obj")).async("string").then((function(t){return new i.default(t,n)})),d=void 0;if(e.mtl){var p=l(e);d=r.file("models/".concat(s,".mtl")).async("string").then((function(n){var o=new a.MaterialLibrary(n);if(!1!==e.downloadMtlTextures){var i=e.mtlTextureRoot;return i||(i=p.substr(0,p.lastIndexOf("/"))),Promise.all([Promise.resolve(o),u(t,o,i,r)])}return Promise.all([Promise.resolve(o),void 0])})).then((function(t){return t}))}var y=[c,h,d];f.push(Promise.all(y))};try{for(var d=n(e),p=d.next();!p.done;p=d.next())h(p.value)}catch(t){s={error:t}}finally{try{p&&!p.done&&(c=d.return)&&c.call(d)}finally{if(s)throw s.error}}return Promise.all(f).then((function(t){var e,r,i={};try{for(var a=n(t),s=a.next();!s.done;s=a.next()){var c=s.value,u=o(c,3),l=u[0],f=u[1],h=u[2];f.name=l,h&&f.addMaterialLibrary(h[0]),i[l]=f}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return i}))},e.downloadModels=function(t,e){var r,s,u=[],f=function(e){if(!e.obj)throw new Error('"obj" attribute of model object not set. The .obj file is required to be set in order to use downloadModels()');var r={indicesPerMaterial:!!e.indicesPerMaterial,calcTangentsAndBitangents:!!e.calcTangentsAndBitangents},n=e.name;if(!n){var o=e.obj.split("/");n=o[o.length-1].replace(".obj","")}var s=Promise.resolve(n),f=fetch(e.obj).then((function(t){return t.text()})).then((function(t){return new i.default(t,r)})),h=void 0;if(e.mtl){var d=l(e);h=fetch(d).then((function(t){return t.text()})).then((function(r){var n=new a.MaterialLibrary(r);if(!1!==e.downloadMtlTextures){var o=e.mtlTextureRoot;return o||(o=d.substr(0,d.lastIndexOf("/"))),Promise.all([Promise.resolve(n),c(t,n,o)])}return Promise.all([Promise.resolve(n),void 0])})).then((function(t){return t}))}var p=[s,f,h];u.push(Promise.all(p))};try{for(var h=n(e),d=h.next();!d.done;d=h.next())f(d.value)}catch(t){r={error:t}}finally{try{d&&!d.done&&(s=h.return)&&s.call(h)}finally{if(r)throw r.error}}return Promise.all(u).then((function(t){var e,r,i={};try{for(var a=n(t),s=a.next();!s.done;s=a.next()){var c=s.value,u=o(c,3),l=u[0],f=u[1],h=u[2];f.name=l,h&&f.addMaterialLibrary(h[0]),i[l]=f}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return i}))},e.downloadMeshes=function(t,e,r){void 0===r&&(r={});var a=[],s=function(e){if(!t.hasOwnProperty(e))return"continue";var r=t[e];a.push(fetch(r).then((function(t){return t.text()})).then((function(t){return[e,new i.default(t)]})))};for(var c in t)s(c);Promise.all(a).then((function(t){var i,a;try{for(var s=n(t),c=s.next();!c.done;c=s.next()){var u=o(c.value,2),l=u[0],f=u[1];r[l]=f}}catch(t){i={error:t}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(i)throw i.error}}return e(r)}))},e._buildBuffer=f,e.initMeshBuffers=function(t,e){return e.normalBuffer=f(t,t.ARRAY_BUFFER,e.vertexNormals,3),e.textureBuffer=f(t,t.ARRAY_BUFFER,e.textures,e.textureStride),e.vertexBuffer=f(t,t.ARRAY_BUFFER,e.vertices,3),e.indexBuffer=f(t,t.ELEMENT_ARRAY_BUFFER,e.indices,1),e},e.deleteMeshBuffers=function(t,e){t.deleteBuffer(e.normalBuffer),t.deleteBuffer(e.textureBuffer),t.deleteBuffer(e.vertexBuffer),t.deleteBuffer(e.indexBuffer)}},5867:(t,e,r)=>{"use strict";r.d(e,{Z:()=>n});const n={tilesetRequestUrl:function(t){return"/pixospritz/tilesets/"+t+"/tileset.json"},zoneRequestUrl:function(t){return"/pixospritz/maps/"+t+"/map.json"},artResourceUrl:function(t){return"/pixospritz/art/"+t}}},9742:(t,e)=>{"use strict";e.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,i=c(t),a=i[0],s=i[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),l=0,f=s>0?a-4:a;for(r=0;r<f;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;return 2===s&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[l++]=255&e),1===s&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e),u},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],a=16383,s=0,c=n-o;s<c;s+=a)i.push(u(t,s,s+a>c?c:s+a));return 1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=i.length;a<s;++a)r[a]=i[a],n[i.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,n){for(var o,i,a=[],s=e;s<n;s+=3)o=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},8764:(t,e,r)=>{"use strict";const n=r(9742),o=r(645),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=c,e.SlowBuffer=function(t){return+t!=t&&(t=0),c.alloc(+t)},e.INSPECT_MAX_BYTES=50;const a=2147483647;function s(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|y(t,e);let n=s(r);const o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(H(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return h(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(H(t,ArrayBuffer)||t&&H(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(H(t,SharedArrayBuffer)||t&&H(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return c.from(n,e,r);const o=function(t){if(c.isBuffer(t)){const e=0|p(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||q(t.length)?s(0):h(t):"Buffer"===t.type&&Array.isArray(t.data)?h(t.data):void 0}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function f(t){return l(t),s(t<0?0:0|p(t))}function h(t){const e=t.length<0?0:0|p(t.length),r=s(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,c.prototype),n}function p(t){if(t>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function y(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||H(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(t).length;default:if(o)return n?-1:$(t).length;e=(""+e).toLowerCase(),o=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=c.from(e,n)),c.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,o){let i,a=1,s=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,c/=2,r/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){let n=-1;for(i=r;i<s;i++)if(u(t,i)===u(e,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===c)return n*a}else-1!==n&&(i-=i-n),n=-1}else for(r+c>s&&(r=s-c),i=r;i>=0;i--){let r=!0;for(let n=0;n<c;n++)if(u(t,i+n)!==u(e,n)){r=!1;break}if(r)return i}return-1}function w(t,e,r,n){r=Number(r)||0;const o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=e.length;let a;for(n>i/2&&(n=i/2),a=0;a<n;++a){const n=parseInt(e.substr(2*a,2),16);if(q(n))return a;t[r+a]=n}return a}function x(t,e,r,n){return K($(e,t.length-r),t,r,n)}function _(t,e,r,n){return K(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function k(t,e,r,n){return K(Y(e),t,r,n)}function E(t,e,r,n){return K(function(t,e){let r,n,o;const i=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);const n=[];let o=e;for(;o<r;){const e=t[o];let i=null,a=e>239?4:e>223?3:e>191?2:1;if(o+a<=r){let r,n,s,c;switch(a){case 1:e<128&&(i=e);break;case 2:r=t[o+1],128==(192&r)&&(c=(31&e)<<6|63&r,c>127&&(i=c));break;case 3:r=t[o+1],n=t[o+2],128==(192&r)&&128==(192&n)&&(c=(15&e)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:r=t[o+1],n=t[o+2],s=t[o+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(c=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=a}return function(t){const e=t.length;if(e<=L)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=L));return r}(n)}e.kMaxLength=a,c.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(t,e,r){return function(t,e,r){return l(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},c.allocUnsafe=function(t){return f(t)},c.allocUnsafeSlow=function(t){return f(t)},c.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==c.prototype},c.compare=function(t,e){if(H(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),H(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=c.allocUnsafe(e);let o=0;for(r=0;r<t.length;++r){let e=t[r];if(H(e,Uint8Array))o+e.length>n.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(n,o)):Uint8Array.prototype.set.call(n,e,o);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,o)}o+=e.length}return n},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},c.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},c.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},c.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?S(this,0,t):g.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(t,e,r,n,o){if(H(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0);const s=Math.min(i,a),u=this.slice(n,o),l=t.slice(e,r);for(let t=0;t<s;++t)if(u[t]!==l[t]){i=u[t],a=l[t];break}return i<a?-1:a<i?1:0},c.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},c.prototype.indexOf=function(t,e,r){return v(this,t,e,r,!0)},c.prototype.lastIndexOf=function(t,e,r){return v(this,t,e,r,!1)},c.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return x(this,t,e,r);case"ascii":case"latin1":case"binary":return _(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const L=4096;function O(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function P(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function T(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=e;n<r;++n)o+=X[t[n]];return o}function C(t,e,r){const n=t.slice(e,r);let o="";for(let t=0;t<n.length-1;t+=2)o+=String.fromCharCode(n[t]+256*n[t+1]);return o}function M(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function j(t,e,r,n,o,i){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function I(t,e,r,n,o){G(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,r}function B(t,e,r,n,o){G(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a>>=8,t[r+2]=a,a>>=8,t[r+1]=a,a>>=8,t[r]=a,r+8}function z(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return e=+e,r>>>=0,i||z(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,i){return e=+e,r>>>=0,i||z(t,0,r,8),o.write(t,e,r,n,52,8),r+8}c.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||M(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||M(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||M(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||M(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||M(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=J((function(t){W(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(t){W(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)})),c.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||M(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},c.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||M(t,e,this.length);let n=e,o=1,i=this[t+--n];for(;n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},c.prototype.readInt8=function(t,e){return t>>>=0,e||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||M(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(t,e){t>>>=0,e||M(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=J((function(t){W(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),c.prototype.readBigInt64BE=J((function(t){W(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),c.prototype.readFloatLE=function(t,e){return t>>>=0,e||M(t,4,this.length),o.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||M(t,4,this.length),o.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||M(t,8,this.length),o.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||M(t,8,this.length),o.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||j(this,t,e,r,Math.pow(2,8*r)-1,0);let o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||j(this,t,e,r,Math.pow(2,8*r)-1,0);let o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=J((function(t,e=0){return I(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(t,e=0){return B(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);j(this,t,e,r,n-1,-n)}let o=0,i=1,a=0;for(this[e]=255&t;++o<r&&(i*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/i>>0)-a&255;return e+r},c.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);j(this,t,e,r,n-1,-n)}let o=r-1,i=1,a=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/i>>0)-a&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||j(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=J((function(t,e=0){return I(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(t,e=0){return B(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,n){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},c.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{const i=c.isBuffer(t)?t:c.from(t,n),a=i.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=i[o%a]}return this};const R={};function F(t,e,r){R[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function U(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function G(t,e,r,n,o,i){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let o;throw o=i>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new R.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,r){W(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||V(e,t.length-(r+1))}(n,o,i)}function W(t,e){if("number"!=typeof t)throw new R.ERR_INVALID_ARG_TYPE(e,"number",t)}function V(t,e,r){if(Math.floor(t)!==t)throw W(t,r),new R.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new R.ERR_BUFFER_OUT_OF_BOUNDS;throw new R.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=U(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=U(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n}),RangeError);const Z=/[^+/0-9A-Za-z-_]/g;function $(t,e){let r;e=e||1/0;const n=t.length;let o=null;const i=[];for(let a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function Y(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(Z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function H(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},1895:(t,e,r)=>{"use strict";r.d(e,{Z:()=>s});var n=r(7537),o=r.n(n),i=r(3645),a=r.n(i)()(o());a.push([t.id,"/* *** ----------------------------------------------- **\n** Calliope - Site Generator \t **\n** ----------------------------------------------- **\n** Copyright (c) 2020-2025 - Kyle Derby MacInnis **\n** **\n** Any unauthorized distribution or transfer **\n** of this work is strictly prohibited. **\n** **\n** All Rights Reserved. **\n** ----------------------------------------------- **\n\\* */\n\n:root {\n --color-bg: #0a0a0f;\n --color-primary: #00ff88;\n --color-secondary: #00ccff;\n --color-accent: #ff0055;\n --color-border: #2a2a3e;\n --glow-primary: rgba(0, 255, 136, 0.5);\n --glow-secondary: rgba(0, 204, 255, 0.5);\n}\n\n.pixos {\n font-family: 'Press Start 2P', 'Courier New', monospace;\n font-size: 16px;\n width: 100%;\n text-shadow: #000 2px 2px 0px;\n position: relative;\n align-items: center;\n align-content: center;\n}\n\n.renderSurface {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.materialSelector {\n background: rgba(10, 10, 15, 0.95);\n margin: auto;\n position: relative;\n border: 2px solid var(--color-border);\n border-radius: 4px;\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);\n}\n.materialSelector tr {\n height: 70px;\n}\n.materialSelector td {\n background-position: 0px 0px;\n cursor: pointer;\n margin: 0;\n opacity: 0.5;\n padding: 0;\n width: 70px;\n transition: opacity 0.2s;\n}\n.materialSelector td:hover {\n opacity: 1;\n box-shadow: 0 0 10px var(--glow-primary);\n}\n\n.nickname {\n color: var(--color-primary);\n cursor: default;\n left: 42%;\n position: absolute;\n top: 40%;\n width: 300px;\n text-shadow: 0 0 10px var(--glow-primary);\n}\n.nickname input {\n background: rgba(10, 10, 15, 0.8);\n border-bottom: 2px solid var(--color-primary);\n border: 1px solid var(--color-border);\n border-radius: 4px;\n color: var(--color-primary);\n font-family: 'Press Start 2P', 'Courier New', monospace;\n font-size: 16px;\n outline: none;\n width: 100%;\n padding: 8px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);\n}\n.nickname input:focus {\n border-color: var(--color-primary);\n box-shadow: 0 0 15px var(--glow-primary);\n}\n\n.joininfo {\n color: var(--color-primary);\n cursor: default;\n font-size: 16px;\n position: absolute;\n text-align: center;\n top: 42%;\n width: 99%;\n text-shadow: 0 0 10px var(--glow-primary);\n}\n\n.chatbox {\n background: rgba(10, 10, 15, 0.95);\n border: 2px solid var(--color-border);\n border-radius: 8px;\n bottom: 55px;\n color: var(--color-primary);\n cursor: default;\n height: 195px;\n left: 20px;\n overflow: hidden;\n padding: 10px;\n position: absolute;\n width: 600px;\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(0, 0, 0, 0.5);\n}\n\n.chatbox_text {\n bottom: 8px;\n position: absolute;\n text-shadow: none;\n font-size: 12px;\n line-height: 1.6;\n}\n\n.chatbox_entry {\n background: rgba(10, 10, 15, 0.95);\n border: 2px solid var(--color-border);\n border-radius: 4px;\n bottom: 18px;\n color: var(--color-primary);\n font-family: 'Press Start 2P', 'Courier New', monospace;\n font-size: 12px;\n height: 30px;\n left: 20px;\n outline: none;\n padding: 8px 10px;\n position: absolute;\n width: 610px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);\n}\n.chatbox_entry:focus {\n border-color: var(--color-primary);\n box-shadow: 0 0 15px var(--glow-primary);\n}\n\nhtml {\n height: 100%;\n}\n\n.pixos-body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n background: linear-gradient(to bottom, #202020, #111119);\n}\n\n.rain {\n position: absolute;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 2;\n}\n\n.snow {\n position: absolute;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 2;\n}\n\n.rain.back-row {\n z-index: 1;\n bottom: 60px;\n opacity: 0.5;\n}\n.snow.back-row {\n z-index: 1;\n bottom: 60px;\n opacity: 0.8;\n}\n\nbody.back-row-toggle .rain.back-row .snow.back-row {\n display: block;\n}\n\n.drop {\n position: absolute;\n bottom: 100%;\n width: 15px;\n height: 120px;\n pointer-events: none;\n animation: drop 0.5s linear infinite;\n}\n\n.flake {\n position: absolute;\n bottom: 100%;\n width: 24px;\n height: 24px;\n pointer-events: none;\n animation: snow 2.5s linear infinite;\n}\n\n@keyframes drop {\n 0% {\n transform: translateY(0vh);\n }\n 75% {\n transform: translateY(90vh);\n }\n 100% {\n transform: translateY(90vh);\n }\n}\n\n@keyframes snow {\n 0% {\n transform: translateY(0vh);\n }\n 70% {\n transform: translateY(50vh);\n }\n 85% {\n transform: translateY(85vh);\n }\n 75% {\n transform: translateY(75vh);\n }\n 100% {\n transform: translateY(95vh);\n transform: translateX(30vw);\n }\n}\n\n.stem {\n width: 1px;\n height: 60%;\n margin-left: 7px;\n background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.25));\n animation: stem 0.5s linear infinite;\n}\n\n@keyframes stem {\n 0% {\n opacity: 1;\n }\n 65% {\n opacity: 1;\n }\n 75% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n }\n}\n\n.splat {\n width: 15px;\n height: 10px;\n border-top: 2px dotted rgba(255, 255, 255, 0.5);\n border-radius: 50%;\n opacity: 1;\n transform: scale(0);\n animation: splat 0.5s linear infinite;\n}\n\nbody.splat-toggle .splat {\n display: block;\n}\n\n@keyframes splat {\n 0% {\n opacity: 1;\n transform: scale(0);\n }\n 80% {\n opacity: 1;\n transform: scale(0);\n }\n 90% {\n opacity: 0.5;\n transform: scale(1);\n }\n 100% {\n opacity: 0;\n transform: scale(1.5);\n }\n}\n\n.toggles {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 3;\n}\n\n.toggle {\n position: absolute;\n left: 20px;\n width: 50px;\n height: 50px;\n line-height: 51px;\n box-sizing: border-box;\n text-align: center;\n font-family: sans-serif;\n font-size: 10px;\n font-weight: bold;\n background-color: rgba(255, 255, 255, 0.2);\n color: rgba(0, 0, 0, 0.5);\n border-radius: 50%;\n cursor: pointer;\n transition: background-color 0.3s;\n}\n\n.toggle:hover {\n background-color: rgba(255, 255, 255, 0.25);\n}\n\n.toggle:active {\n background-color: rgba(255, 255, 255, 0.3);\n}\n\n.toggle.active {\n background-color: rgba(255, 255, 255, 0.4);\n}\n\n.splat-toggle {\n top: 20px;\n}\n\n.back-row-toggle {\n top: 90px;\n line-height: 12px;\n padding-top: 14px;\n}\n\n.single-toggle {\n top: 160px;\n}\n\nbody.single-toggle .drop {\n display: none;\n}\n\nbody.single-toggle .drop:nth-child(10) {\n display: block;\n}\n","",{version:3,sources:["webpack://./pixospritz/src/css/pixos.css"],names:[],mappings:"AAAA;;;;;;;;;;oDAUoD;;AAEpD;EACE,mBAAmB;EACnB,wBAAwB;EACxB,0BAA0B;EAC1B,uBAAuB;EACvB,uBAAuB;EACvB,sCAAsC;EACtC,wCAAwC;AAC1C;;AAEA;EACE,uDAAuD;EACvD,eAAe;EACf,WAAW;EACX,6BAA6B;EAC7B,kBAAkB;EAClB,mBAAmB;EACnB,qBAAqB;AACvB;;AAEA;EACE,YAAY;EACZ,OAAO;EACP,kBAAkB;EAClB,MAAM;EACN,WAAW;AACb;;AAEA;EACE,kCAAkC;EAClC,YAAY;EACZ,kBAAkB;EAClB,qCAAqC;EACrC,kBAAkB;EAClB,uCAAuC;AACzC;AACA;EACE,YAAY;AACd;AACA;EACE,4BAA4B;EAC5B,eAAe;EACf,SAAS;EACT,YAAY;EACZ,UAAU;EACV,WAAW;EACX,wBAAwB;AAC1B;AACA;EACE,UAAU;EACV,wCAAwC;AAC1C;;AAEA;EACE,2BAA2B;EAC3B,eAAe;EACf,SAAS;EACT,kBAAkB;EAClB,QAAQ;EACR,YAAY;EACZ,yCAAyC;AAC3C;AACA;EACE,iCAAiC;EACjC,6CAA6C;EAC7C,qCAAqC;EACrC,kBAAkB;EAClB,2BAA2B;EAC3B,uDAAuD;EACvD,eAAe;EACf,aAAa;EACb,WAAW;EACX,YAAY;EACZ,uCAAuC;AACzC;AACA;EACE,kCAAkC;EAClC,wCAAwC;AAC1C;;AAEA;EACE,2BAA2B;EAC3B,eAAe;EACf,eAAe;EACf,kBAAkB;EAClB,kBAAkB;EAClB,QAAQ;EACR,UAAU;EACV,yCAAyC;AAC3C;;AAEA;EACE,kCAAkC;EAClC,qCAAqC;EACrC,kBAAkB;EAClB,YAAY;EACZ,2BAA2B;EAC3B,eAAe;EACf,aAAa;EACb,UAAU;EACV,gBAAgB;EAChB,aAAa;EACb,kBAAkB;EAClB,YAAY;EACZ,0EAA0E;AAC5E;;AAEA;EACE,WAAW;EACX,kBAAkB;EAClB,iBAAiB;EACjB,eAAe;EACf,gBAAgB;AAClB;;AAEA;EACE,kCAAkC;EAClC,qCAAqC;EACrC,kBAAkB;EAClB,YAAY;EACZ,2BAA2B;EAC3B,uDAAuD;EACvD,eAAe;EACf,YAAY;EACZ,UAAU;EACV,aAAa;EACb,iBAAiB;EACjB,kBAAkB;EAClB,YAAY;EACZ,uCAAuC;AACzC;AACA;EACE,kCAAkC;EAClC,wCAAwC;AAC1C;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,YAAY;EACZ,SAAS;EACT,gBAAgB;EAChB,wDAAwD;AAC1D;;AAEA;EACE,kBAAkB;EAClB,OAAO;EACP,WAAW;EACX,YAAY;EACZ,UAAU;AACZ;;AAEA;EACE,kBAAkB;EAClB,OAAO;EACP,WAAW;EACX,YAAY;EACZ,UAAU;AACZ;;AAEA;EACE,UAAU;EACV,YAAY;EACZ,YAAY;AACd;AACA;EACE,UAAU;EACV,YAAY;EACZ,YAAY;AACd;;AAEA;EACE,cAAc;AAChB;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,WAAW;EACX,aAAa;EACb,oBAAoB;EACpB,oCAAoC;AACtC;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,oBAAoB;EACpB,oCAAoC;AACtC;;AAEA;EACE;IACE,0BAA0B;EAC5B;EACA;IACE,2BAA2B;EAC7B;EACA;IACE,2BAA2B;EAC7B;AACF;;AAEA;EACE;IACE,0BAA0B;EAC5B;EACA;IACE,2BAA2B;EAC7B;EACA;IACE,2BAA2B;EAC7B;EACA;IACE,2BAA2B;EAC7B;EACA;IACE,2BAA2B;IAC3B,2BAA2B;EAC7B;AACF;;AAEA;EACE,UAAU;EACV,WAAW;EACX,gBAAgB;EAChB,yFAAyF;EACzF,oCAAoC;AACtC;;AAEA;EACE;IACE,UAAU;EACZ;EACA;IACE,UAAU;EACZ;EACA;IACE,UAAU;EACZ;EACA;IACE,UAAU;EACZ;AACF;;AAEA;EACE,WAAW;EACX,YAAY;EACZ,+CAA+C;EAC/C,kBAAkB;EAClB,UAAU;EACV,mBAAmB;EACnB,qCAAqC;AACvC;;AAEA;EACE,cAAc;AAChB;;AAEA;EACE;IACE,UAAU;IACV,mBAAmB;EACrB;EACA;IACE,UAAU;IACV,mBAAmB;EACrB;EACA;IACE,YAAY;IACZ,mBAAmB;EACrB;EACA;IACE,UAAU;IACV,qBAAqB;EACvB;AACF;;AAEA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,UAAU;AACZ;;AAEA;EACE,kBAAkB;EAClB,UAAU;EACV,WAAW;EACX,YAAY;EACZ,iBAAiB;EACjB,sBAAsB;EACtB,kBAAkB;EAClB,uBAAuB;EACvB,eAAe;EACf,iBAAiB;EACjB,0CAA0C;EAC1C,yBAAyB;EACzB,kBAAkB;EAClB,eAAe;EACf,iCAAiC;AACnC;;AAEA;EACE,2CAA2C;AAC7C;;AAEA;EACE,0CAA0C;AAC5C;;AAEA;EACE,0CAA0C;AAC5C;;AAEA;EACE,SAAS;AACX;;AAEA;EACE,SAAS;EACT,iBAAiB;EACjB,iBAAiB;AACnB;;AAEA;EACE,UAAU;AACZ;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,cAAc;AAChB",sourcesContent:["/* *** ----------------------------------------------- **\n** Calliope - Site Generator \t **\n** ----------------------------------------------- **\n** Copyright (c) 2020-2025 - Kyle Derby MacInnis **\n** **\n** Any unauthorized distribution or transfer **\n** of this work is strictly prohibited. **\n** **\n** All Rights Reserved. **\n** ----------------------------------------------- **\n\\* */\n\n:root {\n --color-bg: #0a0a0f;\n --color-primary: #00ff88;\n --color-secondary: #00ccff;\n --color-accent: #ff0055;\n --color-border: #2a2a3e;\n --glow-primary: rgba(0, 255, 136, 0.5);\n --glow-secondary: rgba(0, 204, 255, 0.5);\n}\n\n.pixos {\n font-family: 'Press Start 2P', 'Courier New', monospace;\n font-size: 16px;\n width: 100%;\n text-shadow: #000 2px 2px 0px;\n position: relative;\n align-items: center;\n align-content: center;\n}\n\n.renderSurface {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.materialSelector {\n background: rgba(10, 10, 15, 0.95);\n margin: auto;\n position: relative;\n border: 2px solid var(--color-border);\n border-radius: 4px;\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);\n}\n.materialSelector tr {\n height: 70px;\n}\n.materialSelector td {\n background-position: 0px 0px;\n cursor: pointer;\n margin: 0;\n opacity: 0.5;\n padding: 0;\n width: 70px;\n transition: opacity 0.2s;\n}\n.materialSelector td:hover {\n opacity: 1;\n box-shadow: 0 0 10px var(--glow-primary);\n}\n\n.nickname {\n color: var(--color-primary);\n cursor: default;\n left: 42%;\n position: absolute;\n top: 40%;\n width: 300px;\n text-shadow: 0 0 10px var(--glow-primary);\n}\n.nickname input {\n background: rgba(10, 10, 15, 0.8);\n border-bottom: 2px solid var(--color-primary);\n border: 1px solid var(--color-border);\n border-radius: 4px;\n color: var(--color-primary);\n font-family: 'Press Start 2P', 'Courier New', monospace;\n font-size: 16px;\n outline: none;\n width: 100%;\n padding: 8px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);\n}\n.nickname input:focus {\n border-color: var(--color-primary);\n box-shadow: 0 0 15px var(--glow-primary);\n}\n\n.joininfo {\n color: var(--color-primary);\n cursor: default;\n font-size: 16px;\n position: absolute;\n text-align: center;\n top: 42%;\n width: 99%;\n text-shadow: 0 0 10px var(--glow-primary);\n}\n\n.chatbox {\n background: rgba(10, 10, 15, 0.95);\n border: 2px solid var(--color-border);\n border-radius: 8px;\n bottom: 55px;\n color: var(--color-primary);\n cursor: default;\n height: 195px;\n left: 20px;\n overflow: hidden;\n padding: 10px;\n position: absolute;\n width: 600px;\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(0, 0, 0, 0.5);\n}\n\n.chatbox_text {\n bottom: 8px;\n position: absolute;\n text-shadow: none;\n font-size: 12px;\n line-height: 1.6;\n}\n\n.chatbox_entry {\n background: rgba(10, 10, 15, 0.95);\n border: 2px solid var(--color-border);\n border-radius: 4px;\n bottom: 18px;\n color: var(--color-primary);\n font-family: 'Press Start 2P', 'Courier New', monospace;\n font-size: 12px;\n height: 30px;\n left: 20px;\n outline: none;\n padding: 8px 10px;\n position: absolute;\n width: 610px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);\n}\n.chatbox_entry:focus {\n border-color: var(--color-primary);\n box-shadow: 0 0 15px var(--glow-primary);\n}\n\nhtml {\n height: 100%;\n}\n\n.pixos-body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n background: linear-gradient(to bottom, #202020, #111119);\n}\n\n.rain {\n position: absolute;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 2;\n}\n\n.snow {\n position: absolute;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 2;\n}\n\n.rain.back-row {\n z-index: 1;\n bottom: 60px;\n opacity: 0.5;\n}\n.snow.back-row {\n z-index: 1;\n bottom: 60px;\n opacity: 0.8;\n}\n\nbody.back-row-toggle .rain.back-row .snow.back-row {\n display: block;\n}\n\n.drop {\n position: absolute;\n bottom: 100%;\n width: 15px;\n height: 120px;\n pointer-events: none;\n animation: drop 0.5s linear infinite;\n}\n\n.flake {\n position: absolute;\n bottom: 100%;\n width: 24px;\n height: 24px;\n pointer-events: none;\n animation: snow 2.5s linear infinite;\n}\n\n@keyframes drop {\n 0% {\n transform: translateY(0vh);\n }\n 75% {\n transform: translateY(90vh);\n }\n 100% {\n transform: translateY(90vh);\n }\n}\n\n@keyframes snow {\n 0% {\n transform: translateY(0vh);\n }\n 70% {\n transform: translateY(50vh);\n }\n 85% {\n transform: translateY(85vh);\n }\n 75% {\n transform: translateY(75vh);\n }\n 100% {\n transform: translateY(95vh);\n transform: translateX(30vw);\n }\n}\n\n.stem {\n width: 1px;\n height: 60%;\n margin-left: 7px;\n background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.25));\n animation: stem 0.5s linear infinite;\n}\n\n@keyframes stem {\n 0% {\n opacity: 1;\n }\n 65% {\n opacity: 1;\n }\n 75% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n }\n}\n\n.splat {\n width: 15px;\n height: 10px;\n border-top: 2px dotted rgba(255, 255, 255, 0.5);\n border-radius: 50%;\n opacity: 1;\n transform: scale(0);\n animation: splat 0.5s linear infinite;\n}\n\nbody.splat-toggle .splat {\n display: block;\n}\n\n@keyframes splat {\n 0% {\n opacity: 1;\n transform: scale(0);\n }\n 80% {\n opacity: 1;\n transform: scale(0);\n }\n 90% {\n opacity: 0.5;\n transform: scale(1);\n }\n 100% {\n opacity: 0;\n transform: scale(1.5);\n }\n}\n\n.toggles {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 3;\n}\n\n.toggle {\n position: absolute;\n left: 20px;\n width: 50px;\n height: 50px;\n line-height: 51px;\n box-sizing: border-box;\n text-align: center;\n font-family: sans-serif;\n font-size: 10px;\n font-weight: bold;\n background-color: rgba(255, 255, 255, 0.2);\n color: rgba(0, 0, 0, 0.5);\n border-radius: 50%;\n cursor: pointer;\n transition: background-color 0.3s;\n}\n\n.toggle:hover {\n background-color: rgba(255, 255, 255, 0.25);\n}\n\n.toggle:active {\n background-color: rgba(255, 255, 255, 0.3);\n}\n\n.toggle.active {\n background-color: rgba(255, 255, 255, 0.4);\n}\n\n.splat-toggle {\n top: 20px;\n}\n\n.back-row-toggle {\n top: 90px;\n line-height: 12px;\n padding-top: 14px;\n}\n\n.single-toggle {\n top: 160px;\n}\n\nbody.single-toggle .drop {\n display: none;\n}\n\nbody.single-toggle .drop:nth-child(10) {\n display: block;\n}\n"],sourceRoot:""}]);const s=a},3645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r="",n=void 0!==e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),n&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),n&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r})).join("")},e.i=function(t,r,n,o,i){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(n)for(var s=0;s<this.length;s++){var c=this[s][0];null!=c&&(a[c]=!0)}for(var u=0;u<t.length;u++){var l=[].concat(t[u]);n&&a[l[0]]||(void 0!==i&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),r&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=r):l[2]=r),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},7537:t=>{"use strict";t.exports=function(t){var e=t[1],r=t[3];if(!r)return e;if("function"==typeof btoa){var n=btoa(unescape(encodeURIComponent(JSON.stringify(r)))),o="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n),i="/*# ".concat(o," */"),a=r.sources.map((function(t){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(t," */")}));return[e].concat(a).concat([i]).join("\n")}return[e].join("\n")}},3162:function(t,e,r){var n;void 0===(n=function(){"use strict";function e(t,e,r){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){s(n.response,e,r)},n.onerror=function(){console.error("could not download file")},n.send()}function n(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch(t){}return 200<=e.status&&299>=e.status}function o(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(r){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var i="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof r.g&&r.g.global===r.g?r.g:void 0,a=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=i.saveAs||("object"!=typeof window||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(t,r,a){var s=i.URL||i.webkitURL,c=document.createElement("a");r=r||t.name||"download",c.download=r,c.rel="noopener","string"==typeof t?(c.href=t,c.origin===location.origin?o(c):n(c.href)?e(t,r,a):o(c,c.target="_blank")):(c.href=s.createObjectURL(t),setTimeout((function(){s.revokeObjectURL(c.href)}),4e4),setTimeout((function(){o(c)}),0))}:"msSaveOrOpenBlob"in navigator?function(t,r,i){if(r=r||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(function(t,e){return void 0===e?e={autoBom:!1}:"object"!=typeof e&&(console.warn("Deprecated: Expected third argument to be a object"),e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}(t,i),r);else if(n(t))e(t,r,i);else{var a=document.createElement("a");a.href=t,a.target="_blank",setTimeout((function(){o(a)}))}}:function(t,r,n,o){if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof t)return e(t,r,n);var s="application/octet-stream"===t.type,c=/constructor/i.test(i.HTMLElement)||i.safari,u=/CriOS\/[\d]+/.test(navigator.userAgent);if((u||s&&c||a)&&"undefined"!=typeof FileReader){var l=new FileReader;l.onloadend=function(){var t=l.result;t=u?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=t:location=t,o=null},l.readAsDataURL(t)}else{var f=i.URL||i.webkitURL,h=f.createObjectURL(t);o?o.location=h:location.href=h,o=null,setTimeout((function(){f.revokeObjectURL(h)}),4e4)}});i.saveAs=s.saveAs=s,t.exports=s}.apply(e,[]))||(t.exports=n)},8679:(t,e,r)=>{"use strict";var n=r(9864),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};function c(t){return n.isMemo(t)?a:s[t.$$typeof]||o}s[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s[n.Memo]=a;var u=Object.defineProperty,l=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,h=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,p=Object.prototype;t.exports=function t(e,r,n){if("string"!=typeof r){if(p){var o=d(r);o&&o!==p&&t(e,o,n)}var a=l(r);f&&(a=a.concat(f(r)));for(var s=c(e),y=c(r),g=0;g<a.length;++g){var m=a[g];if(!(i[m]||n&&n[m]||y&&y[m]||s&&s[m])){var v=h(r,m);try{u(e,m,v)}catch(t){}}}}return e}},645:(t,e)=>{e.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,c=(1<<s)-1,u=c>>1,l=-7,f=r?o-1:0,h=r?-1:1,d=t[e+f];for(f+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+f],f+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+f],f+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=u}return(d?-1:1)*a*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var a,s,c,u=8*i-o-1,l=(1<<u)-1,f=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+f>=1?h/c:h*Math.pow(2,1-f))*c>=2&&(a++,c/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(e*c-1)*Math.pow(2,o),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<<o|s,u+=o;u>0;t[r+d]=255&a,d+=p,a/=256,u-=8);t[r+d-p]|=128*y}},5733:(t,e,r)=>{var n=r(8764).Buffer;t.exports=function t(e,r,n){function o(a,s){if(!r[a]){if(!e[a]){if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[a]={exports:{}};e[a][0].call(u.exports,(function(t){return o(e[a][1][t]||t)}),u,u.exports,t,e,r,n)}return r[a].exports}for(var i=void 0,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(t,e,r){"use strict";var n=t("./utils"),o=t("./support"),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(t){for(var e,r,o,a,s,c,u,l=[],f=0,h=t.length,d=h,p="string"!==n.getTypeOf(t);f<t.length;)d=h-f,o=p?(e=t[f++],r=f<h?t[f++]:0,f<h?t[f++]:0):(e=t.charCodeAt(f++),r=f<h?t.charCodeAt(f++):0,f<h?t.charCodeAt(f++):0),a=e>>2,s=(3&e)<<4|r>>4,c=1<d?(15&r)<<2|o>>6:64,u=2<d?63&o:64,l.push(i.charAt(a)+i.charAt(s)+i.charAt(c)+i.charAt(u));return l.join("")},r.decode=function(t){var e,r,n,a,s,c,u=0,l=0,f="data:";if(t.substr(0,f.length)===f)throw new Error("Invalid base64 input, it looks like a data url.");var h,d=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(t.charAt(t.length-1)===i.charAt(64)&&d--,t.charAt(t.length-2)===i.charAt(64)&&d--,d%1!=0)throw new Error("Invalid base64 input, bad content length.");for(h=o.uint8array?new Uint8Array(0|d):new Array(0|d);u<t.length;)e=i.indexOf(t.charAt(u++))<<2|(a=i.indexOf(t.charAt(u++)))>>4,r=(15&a)<<4|(s=i.indexOf(t.charAt(u++)))>>2,n=(3&s)<<6|(c=i.indexOf(t.charAt(u++))),h[l++]=e,64!==s&&(h[l++]=r),64!==c&&(h[l++]=n);return h}},{"./support":30,"./utils":32}],2:[function(t,e,r){"use strict";var n=t("./external"),o=t("./stream/DataWorker"),i=t("./stream/Crc32Probe"),a=t("./stream/DataLengthProbe");function s(t,e,r,n,o){this.compressedSize=t,this.uncompressedSize=e,this.crc32=r,this.compression=n,this.compressedContent=o}s.prototype={getContentWorker:function(){var t=new o(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),e=this;return t.on("end",(function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),t},getCompressedWorker:function(){return new o(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(t,e,r){return t.pipe(new i).pipe(new a("uncompressedSize")).pipe(e.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",e)},e.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,r){"use strict";var n=t("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(t){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,r){"use strict";var n=t("./utils"),o=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==n.getTypeOf(t)?function(t,e,r,n){var i=o,a=0+r;t^=-1;for(var s=0;s<a;s++)t=t>>>8^i[255&(t^e[s])];return-1^t}(0|e,t,t.length):function(t,e,r,n){var i=o,a=0+r;t^=-1;for(var s=0;s<a;s++)t=t>>>8^i[255&(t^e.charCodeAt(s))];return-1^t}(0|e,t,t.length):0}},{"./utils":32}],5:[function(t,e,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(t,e,r){"use strict";var n;n="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:n}},{lie:37}],7:[function(t,e,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,o=t("pako"),i=t("./utils"),a=t("./stream/GenericWorker"),s=n?"uint8array":"array";function c(t,e){a.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}r.magic="\b\0",i.inherits(c,a),c.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(i.transformTo(s,t.data),!1)},c.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},r.compressWorker=function(t){return new c("Deflate",t)},r.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,r){"use strict";function n(t,e){var r,n="";for(r=0;r<e;r++)n+=String.fromCharCode(255&t),t>>>=8;return n}function o(t,e,r,o,a,l){var f,h,d=t.file,p=t.compression,y=l!==s.utf8encode,g=i.transformTo("string",l(d.name)),m=i.transformTo("string",s.utf8encode(d.name)),v=d.comment,b=i.transformTo("string",l(v)),w=i.transformTo("string",s.utf8encode(v)),x=m.length!==d.name.length,_=w.length!==v.length,k="",E="",A="",S=d.dir,L=d.date,O={crc32:0,compressedSize:0,uncompressedSize:0};e&&!r||(O.crc32=t.crc32,O.compressedSize=t.compressedSize,O.uncompressedSize=t.uncompressedSize);var P=0;e&&(P|=8),y||!x&&!_||(P|=2048);var T=0,C=0;S&&(T|=16),"UNIX"===a?(C=798,T|=function(t,e){var r=t;return t||(r=e?16893:33204),(65535&r)<<16}(d.unixPermissions,S)):(C=20,T|=function(t){return 63&(t||0)}(d.dosPermissions)),f=L.getUTCHours(),f<<=6,f|=L.getUTCMinutes(),f<<=5,f|=L.getUTCSeconds()/2,h=L.getUTCFullYear()-1980,h<<=4,h|=L.getUTCMonth()+1,h<<=5,h|=L.getUTCDate(),x&&(E=n(1,1)+n(c(g),4)+m,k+="up"+n(E.length,2)+E),_&&(A=n(1,1)+n(c(b),4)+w,k+="uc"+n(A.length,2)+A);var M="";return M+="\n\0",M+=n(P,2),M+=p.magic,M+=n(f,2),M+=n(h,2),M+=n(O.crc32,4),M+=n(O.compressedSize,4),M+=n(O.uncompressedSize,4),M+=n(g.length,2),M+=n(k.length,2),{fileRecord:u.LOCAL_FILE_HEADER+M+g+k,dirRecord:u.CENTRAL_FILE_HEADER+n(C,2)+M+n(b.length,2)+"\0\0\0\0"+n(T,4)+n(o,4)+g+k+b}}var i=t("../utils"),a=t("../stream/GenericWorker"),s=t("../utf8"),c=t("../crc32"),u=t("../signature");function l(t,e,r,n){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(l,a),l.prototype.push=function(t){var e=t.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,a.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:r?(e+100*(r-n-1))/r:100}}))},l.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var r=o(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},l.prototype.closedSource=function(t){this.accumulate=!1;var e=this.streamFiles&&!t.file.dir,r=o(t,e,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),e)this.push({data:function(t){return u.DATA_DESCRIPTOR+n(t.crc32,4)+n(t.compressedSize,4)+n(t.uncompressedSize,4)}(t),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},l.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e<this.dirRecords.length;e++)this.push({data:this.dirRecords[e],meta:{percent:100}});var r=this.bytesWritten-t,o=function(t,e,r,o,a){var s=i.transformTo("string",a(o));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(t,2)+n(t,2)+n(e,4)+n(r,4)+n(s.length,2)+s}(this.dirRecords.length,r,t,this.zipComment,this.encodeFileName);this.push({data:o,meta:{percent:100}})},l.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},l.prototype.registerPrevious=function(t){this._sources.push(t);var e=this;return t.on("data",(function(t){e.processChunk(t)})),t.on("end",(function(){e.closedSource(e.previous.streamInfo),e._sources.length?e.prepareNextSource():e.end()})),t.on("error",(function(t){e.error(t)})),this},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},l.prototype.error=function(t){var e=this._sources;if(!a.prototype.error.call(this,t))return!1;for(var r=0;r<e.length;r++)try{e[r].error(t)}catch(t){}return!0},l.prototype.lock=function(){a.prototype.lock.call(this);for(var t=this._sources,e=0;e<t.length;e++)t[e].lock()},e.exports=l},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,e,r){"use strict";var n=t("../compressions"),o=t("./ZipFileWorker");r.generateWorker=function(t,e,r){var i=new o(e.streamFiles,r,e.platform,e.encodeFileName),a=0;try{t.forEach((function(t,r){a++;var o=function(t,e){var r=t||e,o=n[r];if(!o)throw new Error(r+" is not a valid compression method !");return o}(r.options.compression,e.compression),s=r.options.compressionOptions||e.compressionOptions||{},c=r.dir,u=r.date;r._compressWorker(o,s).withStreamInfo("file",{name:t,dir:c,date:u,comment:r.comment||"",unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions}).pipe(i)})),i.entriesCount=a}catch(t){i.error(t)}return i}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,e,r){"use strict";function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var t=new n;for(var e in this)"function"!=typeof this[e]&&(t[e]=this[e]);return t}}(n.prototype=t("./object")).loadAsync=t("./load"),n.support=t("./support"),n.defaults=t("./defaults"),n.version="3.7.1",n.loadAsync=function(t,e){return(new n).loadAsync(t,e)},n.external=t("./external"),e.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,e,r){"use strict";var n=t("./utils"),o=t("./external"),i=t("./utf8"),a=t("./zipEntries"),s=t("./stream/Crc32Probe"),c=t("./nodejsUtils");function u(t){return new o.Promise((function(e,r){var n=t.decompressed.getContentWorker().pipe(new s);n.on("error",(function(t){r(t)})).on("end",(function(){n.streamInfo.crc32!==t.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):e()})).resume()}))}e.exports=function(t,e){var r=this;return e=n.extend(e||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:i.utf8decode}),c.isNode&&c.isStream(t)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",t,!0,e.optimizedBinaryString,e.base64).then((function(t){var r=new a(e);return r.load(t),r})).then((function(t){var r=[o.Promise.resolve(t)],n=t.files;if(e.checkCRC32)for(var i=0;i<n.length;i++)r.push(u(n[i]));return o.Promise.all(r)})).then((function(t){for(var n=t.shift(),o=n.files,i=0;i<o.length;i++){var a=o[i];r.file(a.fileNameStr,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:e.createFolders})}return n.zipComment.length&&(r.comment=n.zipComment),r}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,e,r){"use strict";var n=t("../utils"),o=t("../stream/GenericWorker");function i(t,e){o.call(this,"Nodejs stream input adapter for "+t),this._upstreamEnded=!1,this._bindStream(e)}n.inherits(i,o),i.prototype._bindStream=function(t){var e=this;(this._stream=t).pause(),t.on("data",(function(t){e.push({data:t,meta:{percent:0}})})).on("error",(function(t){e.isPaused?this.generatedError=t:e.error(t)})).on("end",(function(){e.isPaused?e._upstreamEnded=!0:e.end()}))},i.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},i.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},e.exports=i},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,e,r){"use strict";var n=t("readable-stream").Readable;function o(t,e,r){n.call(this,e),this._helper=t;var o=this;t.on("data",(function(t,e){o.push(t)||o._helper.pause(),r&&r(e)})).on("error",(function(t){o.emit("error",t)})).on("end",(function(){o.push(null)}))}t("../utils").inherits(o,n),o.prototype._read=function(){this._helper.resume()},e.exports=o},{"../utils":32,"readable-stream":16}],14:[function(t,e,r){"use strict";e.exports={isNode:void 0!==n,newBufferFrom:function(t,e){if(n.from&&n.from!==Uint8Array.from)return n.from(t,e);if("number"==typeof t)throw new Error('The "data" argument must not be a number');return new n(t,e)},allocBuffer:function(t){if(n.alloc)return n.alloc(t);var e=new n(t);return e.fill(0),e},isBuffer:function(t){return n.isBuffer(t)},isStream:function(t){return t&&"function"==typeof t.on&&"function"==typeof t.pause&&"function"==typeof t.resume}}},{}],15:[function(t,e,r){"use strict";function n(t,e,r){var n,o=i.getTypeOf(e),s=i.extend(r||{},c);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(t=y(t)),s.createFolders&&(n=p(t))&&g.call(this,n,!0);var f="string"===o&&!1===s.binary&&!1===s.base64;r&&void 0!==r.binary||(s.binary=!f),(e instanceof u&&0===e.uncompressedSize||s.dir||!e||0===e.length)&&(s.base64=!1,s.binary=!0,e="",s.compression="STORE",o="string");var m;m=e instanceof u||e instanceof a?e:h.isNode&&h.isStream(e)?new d(t,e):i.prepareContent(t,e,s.binary,s.optimizedBinaryString,s.base64);var v=new l(t,m,s);this.files[t]=v}var o=t("./utf8"),i=t("./utils"),a=t("./stream/GenericWorker"),s=t("./stream/StreamHelper"),c=t("./defaults"),u=t("./compressedObject"),l=t("./zipObject"),f=t("./generate"),h=t("./nodejsUtils"),d=t("./nodejs/NodejsStreamInputAdapter"),p=function(t){"/"===t.slice(-1)&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return 0<e?t.substring(0,e):""},y=function(t){return"/"!==t.slice(-1)&&(t+="/"),t},g=function(t,e){return e=void 0!==e?e:c.createFolders,t=y(t),this.files[t]||n.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function m(t){return"[object RegExp]"===Object.prototype.toString.call(t)}var v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(t){var e,r,n;for(e in this.files)n=this.files[e],(r=e.slice(this.root.length,e.length))&&e.slice(0,this.root.length)===this.root&&t(r,n)},filter:function(t){var e=[];return this.forEach((function(r,n){t(r,n)&&e.push(n)})),e},file:function(t,e,r){if(1!==arguments.length)return t=this.root+t,n.call(this,t,e,r),this;if(m(t)){var o=t;return this.filter((function(t,e){return!e.dir&&o.test(t)}))}var i=this.files[this.root+t];return i&&!i.dir?i:null},folder:function(t){if(!t)return this;if(m(t))return this.filter((function(e,r){return r.dir&&t.test(e)}));var e=this.root+t,r=g.call(this,e),n=this.clone();return n.root=r.name,n},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!==t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.dir)delete this.files[t];else for(var r=this.filter((function(e,r){return r.name.slice(0,t.length)===t})),n=0;n<r.length;n++)delete this.files[r[n].name];return this},generate:function(t){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(t){var e,r={};try{if((r=i.extend(t||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");i.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var n=r.comment||this.comment||"";e=f.generateWorker(this,r,n)}catch(t){(e=new a("error")).error(t)}return new s(e,r.type||"string",r.mimeType)},generateAsync:function(t,e){return this.generateInternalStream(t).accumulate(e)},generateNodeStream:function(t,e){return(t=t||{}).type||(t.type="nodebuffer"),this.generateInternalStream(t).toNodejsStream(e)}};e.exports=v},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,e,r){e.exports=t("stream")},{stream:void 0}],17:[function(t,e,r){"use strict";var n=t("./DataReader");function o(t){n.call(this,t);for(var e=0;e<this.data.length;e++)t[e]=255&t[e]}t("../utils").inherits(o,n),o.prototype.byteAt=function(t){return this.data[this.zero+t]},o.prototype.lastIndexOfSignature=function(t){for(var e=t.charCodeAt(0),r=t.charCodeAt(1),n=t.charCodeAt(2),o=t.charCodeAt(3),i=this.length-4;0<=i;--i)if(this.data[i]===e&&this.data[i+1]===r&&this.data[i+2]===n&&this.data[i+3]===o)return i-this.zero;return-1},o.prototype.readAndCheckSignature=function(t){var e=t.charCodeAt(0),r=t.charCodeAt(1),n=t.charCodeAt(2),o=t.charCodeAt(3),i=this.readData(4);return e===i[0]&&r===i[1]&&n===i[2]&&o===i[3]},o.prototype.readData=function(t){if(this.checkOffset(t),0===t)return[];var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=o},{"../utils":32,"./DataReader":18}],18:[function(t,e,r){"use strict";var n=t("../utils");function o(t){this.data=t,this.length=t.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(t){this.checkIndex(this.index+t)},checkIndex:function(t){if(this.length<this.zero+t||t<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+t+"). Corrupted zip ?")},setIndex:function(t){this.checkIndex(t),this.index=t},skip:function(t){this.setIndex(this.index+t)},byteAt:function(t){},readInt:function(t){var e,r=0;for(this.checkOffset(t),e=this.index+t-1;e>=this.index;e--)r=(r<<8)+this.byteAt(e);return this.index+=t,r},readString:function(t){return n.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readAndCheckSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=o},{"../utils":32}],19:[function(t,e,r){"use strict";var n=t("./Uint8ArrayReader");function o(t){n.call(this,t)}t("../utils").inherits(o,n),o.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,r){"use strict";var n=t("./DataReader");function o(t){n.call(this,t)}t("../utils").inherits(o,n),o.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},o.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},o.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},o.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,e,r){"use strict";var n=t("./ArrayReader");function o(t){n.call(this,t)}t("../utils").inherits(o,n),o.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,r){"use strict";var n=t("../utils"),o=t("../support"),i=t("./ArrayReader"),a=t("./StringReader"),s=t("./NodeBufferReader"),c=t("./Uint8ArrayReader");e.exports=function(t){var e=n.getTypeOf(t);return n.checkSupport(e),"string"!==e||o.uint8array?"nodebuffer"===e?new s(t):o.uint8array?new c(n.transformTo("uint8array",t)):new i(n.transformTo("array",t)):new a(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,r){"use strict";var n=t("./GenericWorker"),o=t("../utils");function i(t){n.call(this,"ConvertWorker to "+t),this.destType=t}o.inherits(i,n),i.prototype.processChunk=function(t){this.push({data:o.transformTo(this.destType,t.data),meta:t.meta})},e.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,r){"use strict";var n=t("./GenericWorker"),o=t("../crc32");function i(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(i,n),i.prototype.processChunk=function(t){this.streamInfo.crc32=o(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,r){"use strict";var n=t("../utils"),o=t("./GenericWorker");function i(t){o.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}n.inherits(i,o),i.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}o.prototype.processChunk.call(this,t)},e.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,r){"use strict";var n=t("../utils"),o=t("./GenericWorker");function i(t){o.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then((function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=n.getTypeOf(t),e.isPaused||e._tickAndRepeat()}),(function(t){e.error(t)}))}n.inherits(i,o),i.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,r){"use strict";function n(t){this.name=t||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var r=0;r<this._listeners[t].length;r++)this._listeners[t][r].call(this,e)},pipe:function(t){return t.registerPrevious(this)},registerPrevious:function(t){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=t.streamInfo,this.mergeStreamInfo(),this.previous=t;var e=this;return t.on("data",(function(t){e.processChunk(t)})),t.on("end",(function(){e.end()})),t.on("error",(function(t){e.error(t)})),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var t=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),t=!0),this.previous&&this.previous.resume(),!t},flush:function(){},processChunk:function(t){this.push(t)},withStreamInfo:function(t,e){return this.extraStreamInfo[t]=e,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var t in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(t)&&(this.streamInfo[t]=this.extraStreamInfo[t])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var t="Worker "+this.name;return this.previous?this.previous+" -> "+t:t}},e.exports=n},{}],29:[function(t,e,r){"use strict";var o=t("../utils"),i=t("./ConvertWorker"),a=t("./GenericWorker"),s=t("../base64"),c=t("../support"),u=t("../external"),l=null;if(c.nodestream)try{l=t("../nodejs/NodejsStreamOutputAdapter")}catch(t){}function f(t,e,r){var n=e;switch(e){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=e,this._mimeType=r,o.checkSupport(n),this._worker=t.pipe(new i(n)),t.lock()}catch(t){this._worker=new a("error"),this._worker.error(t)}}f.prototype={accumulate:function(t){return function(t,e){return new u.Promise((function(r,i){var a=[],c=t._internalType,u=t._outputType,l=t._mimeType;t.on("data",(function(t,r){a.push(t),e&&e(r)})).on("error",(function(t){a=[],i(t)})).on("end",(function(){try{var t=function(t,e,r){switch(t){case"blob":return o.newBlob(o.transformTo("arraybuffer",e),r);case"base64":return s.encode(e);default:return o.transformTo(t,e)}}(u,function(t,e){var r,o=0,i=null,a=0;for(r=0;r<e.length;r++)a+=e[r].length;switch(t){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(i=new Uint8Array(a),r=0;r<e.length;r++)i.set(e[r],o),o+=e[r].length;return i;case"nodebuffer":return n.concat(e);default:throw new Error("concat : unsupported type '"+t+"'")}}(c,a),l);r(t)}catch(t){i(t)}a=[]})).resume()}))}(this,t)},on:function(t,e){var r=this;return"data"===t?this._worker.on(t,(function(t){e.call(r,t.data,t.meta)})):this._worker.on(t,(function(){o.delay(e,arguments,r)})),this},resume:function(){return o.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(t){if(o.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},t)}},e.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,e,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer=void 0!==n,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var o=new ArrayBuffer(0);try{r.blob=0===new Blob([o],{type:"application/zip"}).size}catch(t){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(o),r.blob=0===i.getBlob("application/zip").size}catch(t){r.blob=!1}}}try{r.nodestream=!!t("readable-stream").Readable}catch(t){r.nodestream=!1}},{"readable-stream":16}],31:[function(t,e,r){"use strict";for(var n=t("./utils"),o=t("./support"),i=t("./nodejsUtils"),a=t("./stream/GenericWorker"),s=new Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function u(){a.call(this,"utf-8 decode"),this.leftOver=null}function l(){a.call(this,"utf-8 encode")}s[254]=s[254]=1,r.utf8encode=function(t){return o.nodebuffer?i.newBufferFrom(t,"utf-8"):function(t){var e,r,n,i,a,s=t.length,c=0;for(i=0;i<s;i++)55296==(64512&(r=t.charCodeAt(i)))&&i+1<s&&56320==(64512&(n=t.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),c+=r<128?1:r<2048?2:r<65536?3:4;for(e=o.uint8array?new Uint8Array(c):new Array(c),i=a=0;a<c;i++)55296==(64512&(r=t.charCodeAt(i)))&&i+1<s&&56320==(64512&(n=t.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?e[a++]=r:(r<2048?e[a++]=192|r>>>6:(r<65536?e[a++]=224|r>>>12:(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63),e[a++]=128|r>>>6&63),e[a++]=128|63&r);return e}(t)},r.utf8decode=function(t){return o.nodebuffer?n.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,r,o,i,a=t.length,c=new Array(2*a);for(e=r=0;e<a;)if((o=t[e++])<128)c[r++]=o;else if(4<(i=s[o]))c[r++]=65533,e+=i-1;else{for(o&=2===i?31:3===i?15:7;1<i&&e<a;)o=o<<6|63&t[e++],i--;1<i?c[r++]=65533:o<65536?c[r++]=o:(o-=65536,c[r++]=55296|o>>10&1023,c[r++]=56320|1023&o)}return c.length!==r&&(c.subarray?c=c.subarray(0,r):c.length=r),n.applyFromCharCode(c)}(t=n.transformTo(o.uint8array?"uint8array":"array",t))},n.inherits(u,a),u.prototype.processChunk=function(t){var e=n.transformTo(o.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var i=e;(e=new Uint8Array(i.length+this.leftOver.length)).set(this.leftOver,0),e.set(i,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var a=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;0<=r&&128==(192&t[r]);)r--;return r<0||0===r?e:r+s[t[r]]>e?r:e}(e),c=e;a!==e.length&&(o.uint8array?(c=e.subarray(0,a),this.leftOver=e.subarray(a,e.length)):(c=e.slice(0,a),this.leftOver=e.slice(a,e.length))),this.push({data:r.utf8decode(c),meta:t.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=u,n.inherits(l,a),l.prototype.processChunk=function(t){this.push({data:r.utf8encode(t.data),meta:t.meta})},r.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,r){"use strict";var n=t("./support"),o=t("./base64"),i=t("./nodejsUtils"),a=t("set-immediate-shim"),s=t("./external");function c(t){return t}function u(t,e){for(var r=0;r<t.length;++r)e[r]=255&t.charCodeAt(r);return e}r.newBlob=function(t,e){r.checkSupport("blob");try{return new Blob([t],{type:e})}catch(r){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(t),n.getBlob(e)}catch(t){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(t,e,r){var n=[],o=0,i=t.length;if(i<=r)return String.fromCharCode.apply(null,t);for(;o<i;)"array"===e||"nodebuffer"===e?n.push(String.fromCharCode.apply(null,t.slice(o,Math.min(o+r,i)))):n.push(String.fromCharCode.apply(null,t.subarray(o,Math.min(o+r,i)))),o+=r;return n.join("")},stringifyByChar:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},applyCanBeUsed:{uint8array:function(){try{return n.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(t){return!1}}(),nodebuffer:function(){try{return n.nodebuffer&&1===String.fromCharCode.apply(null,i.allocBuffer(1)).length}catch(t){return!1}}()}};function f(t){var e=65536,n=r.getTypeOf(t),o=!0;if("uint8array"===n?o=l.applyCanBeUsed.uint8array:"nodebuffer"===n&&(o=l.applyCanBeUsed.nodebuffer),o)for(;1<e;)try{return l.stringifyByChunk(t,n,e)}catch(t){e=Math.floor(e/2)}return l.stringifyByChar(t)}function h(t,e){for(var r=0;r<t.length;r++)e[r]=t[r];return e}r.applyFromCharCode=f;var d={};d.string={string:c,array:function(t){return u(t,new Array(t.length))},arraybuffer:function(t){return d.string.uint8array(t).buffer},uint8array:function(t){return u(t,new Uint8Array(t.length))},nodebuffer:function(t){return u(t,i.allocBuffer(t.length))}},d.array={string:f,array:c,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return i.newBufferFrom(t)}},d.arraybuffer={string:function(t){return f(new Uint8Array(t))},array:function(t){return h(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:c,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return i.newBufferFrom(new Uint8Array(t))}},d.uint8array={string:f,array:function(t){return h(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:c,nodebuffer:function(t){return i.newBufferFrom(t)}},d.nodebuffer={string:f,array:function(t){return h(t,new Array(t.length))},arraybuffer:function(t){return d.nodebuffer.uint8array(t).buffer},uint8array:function(t){return h(t,new Uint8Array(t.length))},nodebuffer:c},r.transformTo=function(t,e){if(e=e||"",!t)return e;r.checkSupport(t);var n=r.getTypeOf(e);return d[n][t](e)},r.getTypeOf=function(t){return"string"==typeof t?"string":"[object Array]"===Object.prototype.toString.call(t)?"array":n.nodebuffer&&i.isBuffer(t)?"nodebuffer":n.uint8array&&t instanceof Uint8Array?"uint8array":n.arraybuffer&&t instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(t){if(!n[t.toLowerCase()])throw new Error(t+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(t){var e,r,n="";for(r=0;r<(t||"").length;r++)n+="\\x"+((e=t.charCodeAt(r))<16?"0":"")+e.toString(16).toUpperCase();return n},r.delay=function(t,e,r){a((function(){t.apply(r||null,e||[])}))},r.inherits=function(t,e){function r(){}r.prototype=e.prototype,t.prototype=new r},r.extend=function(){var t,e,r={};for(t=0;t<arguments.length;t++)for(e in arguments[t])arguments[t].hasOwnProperty(e)&&void 0===r[e]&&(r[e]=arguments[t][e]);return r},r.prepareContent=function(t,e,i,a,c){return s.Promise.resolve(e).then((function(t){return n.blob&&(t instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(t)))&&"undefined"!=typeof FileReader?new s.Promise((function(e,r){var n=new FileReader;n.onload=function(t){e(t.target.result)},n.onerror=function(t){r(t.target.error)},n.readAsArrayBuffer(t)})):t})).then((function(e){var l=r.getTypeOf(e);return l?("arraybuffer"===l?e=r.transformTo("uint8array",e):"string"===l&&(c?e=o.decode(e):i&&!0!==a&&(e=function(t){return u(t,n.uint8array?new Uint8Array(t.length):new Array(t.length))}(e))),e):s.Promise.reject(new Error("Can't read the data of '"+t+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"set-immediate-shim":54}],33:[function(t,e,r){"use strict";var n=t("./reader/readerFor"),o=t("./utils"),i=t("./signature"),a=t("./zipEntry"),s=(t("./utf8"),t("./support"));function c(t){this.files=[],this.loadOptions=t}c.prototype={checkSignature:function(t){if(!this.reader.readAndCheckSignature(t)){this.reader.index-=4;var e=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(e)+", expected "+o.pretty(t)+")")}},isSignature:function(t,e){var r=this.reader.index;this.reader.setIndex(t);var n=this.reader.readString(4)===e;return this.reader.setIndex(r),n},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var t=this.reader.readData(this.zipCommentLength),e=s.uint8array?"uint8array":"array",r=o.transformTo(e,t);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var t,e,r,n=this.zip64EndOfCentralSize-44;0<n;)t=this.reader.readInt(2),e=this.reader.readInt(4),r=this.reader.readData(e),this.zip64ExtensibleData[t]={id:t,length:e,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var t,e;for(t=0;t<this.files.length;t++)e=this.files[t],this.reader.setIndex(e.localHeaderOffset),this.checkSignature(i.LOCAL_FILE_HEADER),e.readLocalPart(this.reader),e.handleUTF8(),e.processAttributes()},readCentralDir:function(){var t;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER);)(t=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(t);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var t=this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);if(t<0)throw this.isSignature(0,i.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(t);var e=t;if(this.checkSignature(i.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(t=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(t),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,i.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var n=e-r;if(0<n)this.isSignature(e,i.CENTRAL_FILE_HEADER)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")},prepareReader:function(t){this.reader=n(t)},load:function(t){this.prepareReader(t),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},e.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(t,e,r){"use strict";var n=t("./reader/readerFor"),o=t("./utils"),i=t("./compressedObject"),a=t("./crc32"),s=t("./utf8"),c=t("./compressions"),u=t("./support");function l(t,e){this.options=t,this.loadOptions=e}l.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(t){var e,r;if(t.skip(22),this.fileNameLength=t.readInt(2),r=t.readInt(2),this.fileName=t.readData(this.fileNameLength),t.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(e=function(t){for(var e in c)if(c.hasOwnProperty(e)&&c[e].magic===t)return c[e];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,e,t.readData(this.compressedSize))},readCentralPart:function(t){this.versionMadeBy=t.readInt(2),t.skip(2),this.bitFlag=t.readInt(2),this.compressionMethod=t.readString(2),this.date=t.readDate(),this.crc32=t.readInt(4),this.compressedSize=t.readInt(4),this.uncompressedSize=t.readInt(4);var e=t.readInt(2);if(this.extraFieldsLength=t.readInt(2),this.fileCommentLength=t.readInt(2),this.diskNumberStart=t.readInt(2),this.internalFileAttributes=t.readInt(2),this.externalFileAttributes=t.readInt(4),this.localHeaderOffset=t.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");t.skip(e),this.readExtraFields(t),this.parseZIP64ExtraField(t),this.fileComment=t.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var t=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(t){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(t){var e,r,n,o=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index+4<o;)e=t.readInt(2),r=t.readInt(2),n=t.readData(r),this.extraFields[e]={id:e,length:r,value:n};t.setIndex(o)},handleUTF8:function(){var t=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=s.utf8decode(this.fileName),this.fileCommentStr=s.utf8decode(this.fileComment);else{var e=this.findExtraFieldUnicodePath();if(null!==e)this.fileNameStr=e;else{var r=o.transformTo(t,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var n=this.findExtraFieldUnicodeComment();if(null!==n)this.fileCommentStr=n;else{var i=o.transformTo(t,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(i)}}},findExtraFieldUnicodePath:function(){var t=this.extraFields[28789];if(t){var e=n(t.value);return 1!==e.readInt(1)||a(this.fileName)!==e.readInt(4)?null:s.utf8decode(e.readData(t.length-5))}return null},findExtraFieldUnicodeComment:function(){var t=this.extraFields[25461];if(t){var e=n(t.value);return 1!==e.readInt(1)||a(this.fileComment)!==e.readInt(4)?null:s.utf8decode(e.readData(t.length-5))}return null}},e.exports=l},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,e,r){"use strict";function n(t,e,r){this.name=t,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=e,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}}var o=t("./stream/StreamHelper"),i=t("./stream/DataWorker"),a=t("./utf8"),s=t("./compressedObject"),c=t("./stream/GenericWorker");n.prototype={internalStream:function(t){var e=null,r="string";try{if(!t)throw new Error("No output type specified.");var n="string"===(r=t.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),e=this._decompressWorker();var i=!this._dataBinary;i&&!n&&(e=e.pipe(new a.Utf8EncodeWorker)),!i&&n&&(e=e.pipe(new a.Utf8DecodeWorker))}catch(t){(e=new c("error")).error(t)}return new o(e,r,"")},async:function(t,e){return this.internalStream(t).accumulate(e)},nodeStream:function(t,e){return this.internalStream(t||"nodebuffer").toNodejsStream(e)},_compressWorker:function(t,e){if(this._data instanceof s&&this._data.compression.magic===t.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new a.Utf8EncodeWorker)),s.createWorkerFrom(r,t,e)},_decompressWorker:function(){return this._data instanceof s?this._data.getContentWorker():this._data instanceof c?this._data:new i(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<u.length;f++)n.prototype[u[f]]=l;e.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,e,n){(function(t){"use strict";var r,n,o=t.MutationObserver||t.WebKitMutationObserver;if(o){var i=0,a=new o(l),s=t.document.createTextNode("");a.observe(s,{characterData:!0}),r=function(){s.data=i=++i%2}}else if(t.setImmediate||void 0===t.MessageChannel)r="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){l(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(l,0)};else{var c=new t.MessageChannel;c.port1.onmessage=l,r=function(){c.port2.postMessage(0)}}var u=[];function l(){var t,e;n=!0;for(var r=u.length;r;){for(e=u,u=[],t=-1;++t<r;)e[t]();r=u.length}n=!1}e.exports=function(t){1!==u.push(t)||n||r()}}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(t,e,r){"use strict";var n=t("immediate");function o(){}var i={},a=["REJECTED"],s=["FULFILLED"],c=["PENDING"];function u(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,t!==o&&d(this,t)}function l(t,e,r){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function f(t,e,r){n((function(){var n;try{n=e(r)}catch(n){return i.reject(t,n)}n===t?i.reject(t,new TypeError("Cannot resolve promise with itself")):i.resolve(t,n)}))}function h(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function d(t,e){var r=!1;function n(e){r||(r=!0,i.reject(t,e))}function o(e){r||(r=!0,i.resolve(t,e))}var a=p((function(){e(o,n)}));"error"===a.status&&n(a.value)}function p(t,e){var r={};try{r.value=t(e),r.status="success"}catch(t){r.status="error",r.value=t}return r}(e.exports=u).prototype.finally=function(t){if("function"!=typeof t)return this;var e=this.constructor;return this.then((function(r){return e.resolve(t()).then((function(){return r}))}),(function(r){return e.resolve(t()).then((function(){throw r}))}))},u.prototype.catch=function(t){return this.then(null,t)},u.prototype.then=function(t,e){if("function"!=typeof t&&this.state===s||"function"!=typeof e&&this.state===a)return this;var r=new this.constructor(o);return this.state!==c?f(r,this.state===s?t:e,this.outcome):this.queue.push(new l(r,t,e)),r},l.prototype.callFulfilled=function(t){i.resolve(this.promise,t)},l.prototype.otherCallFulfilled=function(t){f(this.promise,this.onFulfilled,t)},l.prototype.callRejected=function(t){i.reject(this.promise,t)},l.prototype.otherCallRejected=function(t){f(this.promise,this.onRejected,t)},i.resolve=function(t,e){var r=p(h,e);if("error"===r.status)return i.reject(t,r.value);var n=r.value;if(n)d(t,n);else{t.state=s,t.outcome=e;for(var o=-1,a=t.queue.length;++o<a;)t.queue[o].callFulfilled(e)}return t},i.reject=function(t,e){t.state=a,t.outcome=e;for(var r=-1,n=t.queue.length;++r<n;)t.queue[r].callRejected(e);return t},u.resolve=function(t){return t instanceof this?t:i.resolve(new this(o),t)},u.reject=function(t){var e=new this(o);return i.reject(e,t)},u.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var r=t.length,n=!1;if(!r)return this.resolve([]);for(var a=new Array(r),s=0,c=-1,u=new this(o);++c<r;)l(t[c],c);return u;function l(t,o){e.resolve(t).then((function(t){a[o]=t,++s!==r||n||(n=!0,i.resolve(u,a))}),(function(t){n||(n=!0,i.reject(u,t))}))}},u.race=function(t){if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var e=t.length,r=!1;if(!e)return this.resolve([]);for(var n,a=-1,s=new this(o);++a<e;)n=t[a],this.resolve(n).then((function(t){r||(r=!0,i.resolve(s,t))}),(function(t){r||(r=!0,i.reject(s,t))}));return s}},{immediate:36}],38:[function(t,e,r){"use strict";var n={};(0,t("./lib/utils/common").assign)(n,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),e.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,e,r){"use strict";var n=t("./zlib/deflate"),o=t("./utils/common"),i=t("./utils/strings"),a=t("./zlib/messages"),s=t("./zlib/zstream"),c=Object.prototype.toString;function u(t){if(!(this instanceof u))return new u(t);this.options=o.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},t||{});var e=this.options;e.raw&&0<e.windowBits?e.windowBits=-e.windowBits:e.gzip&&0<e.windowBits&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var r=n.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(0!==r)throw new Error(a[r]);if(e.header&&n.deflateSetHeader(this.strm,e.header),e.dictionary){var l;if(l="string"==typeof e.dictionary?i.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(r=n.deflateSetDictionary(this.strm,l)))throw new Error(a[r]);this._dict_set=!0}}function l(t,e){var r=new u(e);if(r.push(t,!0),r.err)throw r.msg||a[r.err];return r.result}u.prototype.push=function(t,e){var r,a,s=this.strm,u=this.options.chunkSize;if(this.ended)return!1;a=e===~~e?e:!0===e?4:0,"string"==typeof t?s.input=i.string2buf(t):"[object ArrayBuffer]"===c.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new o.Buf8(u),s.next_out=0,s.avail_out=u),1!==(r=n.deflate(s,a))&&0!==r)return this.onEnd(r),!(this.ended=!0);0!==s.avail_out&&(0!==s.avail_in||4!==a&&2!==a)||("string"===this.options.to?this.onData(i.buf2binstring(o.shrinkBuf(s.output,s.next_out))):this.onData(o.shrinkBuf(s.output,s.next_out)))}while((0<s.avail_in||0===s.avail_out)&&1!==r);return 4===a?(r=n.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==a||(this.onEnd(0),!(s.avail_out=0))},u.prototype.onData=function(t){this.chunks.push(t)},u.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},r.Deflate=u,r.deflate=l,r.deflateRaw=function(t,e){return(e=e||{}).raw=!0,l(t,e)},r.gzip=function(t,e){return(e=e||{}).gzip=!0,l(t,e)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,e,r){"use strict";var n=t("./zlib/inflate"),o=t("./utils/common"),i=t("./utils/strings"),a=t("./zlib/constants"),s=t("./zlib/messages"),c=t("./zlib/zstream"),u=t("./zlib/gzheader"),l=Object.prototype.toString;function f(t){if(!(this instanceof f))return new f(t);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&0<=e.windowBits&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(0<=e.windowBits&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),15<e.windowBits&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var r=n.inflateInit2(this.strm,e.windowBits);if(r!==a.Z_OK)throw new Error(s[r]);this.header=new u,n.inflateGetHeader(this.strm,this.header)}function h(t,e){var r=new f(e);if(r.push(t,!0),r.err)throw r.msg||s[r.err];return r.result}f.prototype.push=function(t,e){var r,s,c,u,f,h,d=this.strm,p=this.options.chunkSize,y=this.options.dictionary,g=!1;if(this.ended)return!1;s=e===~~e?e:!0===e?a.Z_FINISH:a.Z_NO_FLUSH,"string"==typeof t?d.input=i.binstring2buf(t):"[object ArrayBuffer]"===l.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new o.Buf8(p),d.next_out=0,d.avail_out=p),(r=n.inflate(d,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&y&&(h="string"==typeof y?i.string2buf(y):"[object ArrayBuffer]"===l.call(y)?new Uint8Array(y):y,r=n.inflateSetDictionary(this.strm,h)),r===a.Z_BUF_ERROR&&!0===g&&(r=a.Z_OK,g=!1),r!==a.Z_STREAM_END&&r!==a.Z_OK)return this.onEnd(r),!(this.ended=!0);d.next_out&&(0!==d.avail_out&&r!==a.Z_STREAM_END&&(0!==d.avail_in||s!==a.Z_FINISH&&s!==a.Z_SYNC_FLUSH)||("string"===this.options.to?(c=i.utf8border(d.output,d.next_out),u=d.next_out-c,f=i.buf2string(d.output,c),d.next_out=u,d.avail_out=p-u,u&&o.arraySet(d.output,d.output,c,u,0),this.onData(f)):this.onData(o.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(g=!0)}while((0<d.avail_in||0===d.avail_out)&&r!==a.Z_STREAM_END);return r===a.Z_STREAM_END&&(s=a.Z_FINISH),s===a.Z_FINISH?(r=n.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===a.Z_OK):s!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),!(d.avail_out=0))},f.prototype.onData=function(t){this.chunks.push(t)},f.prototype.onEnd=function(t){t===a.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},r.Inflate=f,r.inflate=h,r.inflateRaw=function(t,e){return(e=e||{}).raw=!0,h(t,e)},r.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,e,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])}}return t},r.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var o={arraySet:function(t,e,r,n,o){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+n),o);else for(var i=0;i<n;i++)t[o+i]=e[r+i]},flattenChunks:function(t){var e,r,n,o,i,a;for(e=n=0,r=t.length;e<r;e++)n+=t[e].length;for(a=new Uint8Array(n),e=o=0,r=t.length;e<r;e++)i=t[e],a.set(i,o),o+=i.length;return a}},i={arraySet:function(t,e,r,n,o){for(var i=0;i<n;i++)t[o+i]=e[r+i]},flattenChunks:function(t){return[].concat.apply([],t)}};r.setTyped=function(t){t?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,o)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,i))},r.setTyped(n)},{}],42:[function(t,e,r){"use strict";var n=t("./common"),o=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch(t){o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){i=!1}for(var a=new n.Buf8(256),s=0;s<256;s++)a[s]=252<=s?6:248<=s?5:240<=s?4:224<=s?3:192<=s?2:1;function c(t,e){if(e<65537&&(t.subarray&&i||!t.subarray&&o))return String.fromCharCode.apply(null,n.shrinkBuf(t,e));for(var r="",a=0;a<e;a++)r+=String.fromCharCode(t[a]);return r}a[254]=a[254]=1,r.string2buf=function(t){var e,r,o,i,a,s=t.length,c=0;for(i=0;i<s;i++)55296==(64512&(r=t.charCodeAt(i)))&&i+1<s&&56320==(64512&(o=t.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(o-56320),i++),c+=r<128?1:r<2048?2:r<65536?3:4;for(e=new n.Buf8(c),i=a=0;a<c;i++)55296==(64512&(r=t.charCodeAt(i)))&&i+1<s&&56320==(64512&(o=t.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(o-56320),i++),r<128?e[a++]=r:(r<2048?e[a++]=192|r>>>6:(r<65536?e[a++]=224|r>>>12:(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63),e[a++]=128|r>>>6&63),e[a++]=128|63&r);return e},r.buf2binstring=function(t){return c(t,t.length)},r.binstring2buf=function(t){for(var e=new n.Buf8(t.length),r=0,o=e.length;r<o;r++)e[r]=t.charCodeAt(r);return e},r.buf2string=function(t,e){var r,n,o,i,s=e||t.length,u=new Array(2*s);for(r=n=0;r<s;)if((o=t[r++])<128)u[n++]=o;else if(4<(i=a[o]))u[n++]=65533,r+=i-1;else{for(o&=2===i?31:3===i?15:7;1<i&&r<s;)o=o<<6|63&t[r++],i--;1<i?u[n++]=65533:o<65536?u[n++]=o:(o-=65536,u[n++]=55296|o>>10&1023,u[n++]=56320|1023&o)}return c(u,n)},r.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;0<=r&&128==(192&t[r]);)r--;return r<0||0===r?e:r+a[t[r]]>e?r:e}},{"./common":41}],43:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){for(var o=65535&t|0,i=t>>>16&65535|0,a=0;0!==r;){for(r-=a=2e3<r?2e3:r;i=i+(o=o+e[n++]|0)|0,--a;);o%=65521,i%=65521}return o|i<<16|0}},{}],44:[function(t,e,r){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,e,r){"use strict";var n=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();e.exports=function(t,e,r,o){var i=n,a=o+r;t^=-1;for(var s=o;s<a;s++)t=t>>>8^i[255&(t^e[s])];return-1^t}},{}],46:[function(t,e,r){"use strict";var n,o=t("../utils/common"),i=t("./trees"),a=t("./adler32"),s=t("./crc32"),c=t("./messages"),u=-2,l=258,f=262,h=113;function d(t,e){return t.msg=c[e],e}function p(t){return(t<<1)-(4<t?9:0)}function y(t){for(var e=t.length;0<=--e;)t[e]=0}function g(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(o.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function m(t,e){i._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,g(t.strm)}function v(t,e){t.pending_buf[t.pending++]=e}function b(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function w(t,e){var r,n,o=t.max_chain_length,i=t.strstart,a=t.prev_length,s=t.nice_match,c=t.strstart>t.w_size-f?t.strstart-(t.w_size-f):0,u=t.window,h=t.w_mask,d=t.prev,p=t.strstart+l,y=u[i+a-1],g=u[i+a];t.prev_length>=t.good_match&&(o>>=2),s>t.lookahead&&(s=t.lookahead);do{if(u[(r=e)+a]===g&&u[r+a-1]===y&&u[r]===u[i]&&u[++r]===u[i+1]){i+=2,r++;do{}while(u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&i<p);if(n=l-(p-i),i=p-l,a<n){if(t.match_start=e,s<=(a=n))break;y=u[i+a-1],g=u[i+a]}}}while((e=d[e&h])>c&&0!=--o);return a<=t.lookahead?a:t.lookahead}function x(t){var e,r,n,i,c,u,l,h,d,p,y=t.w_size;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=y+(y-f)){for(o.arraySet(t.window,t.window,y,y,0),t.match_start-=y,t.strstart-=y,t.block_start-=y,e=r=t.hash_size;n=t.head[--e],t.head[e]=y<=n?n-y:0,--r;);for(e=r=y;n=t.prev[--e],t.prev[e]=y<=n?n-y:0,--r;);i+=y}if(0===t.strm.avail_in)break;if(u=t.strm,l=t.window,h=t.strstart+t.lookahead,p=void 0,(d=i)<(p=u.avail_in)&&(p=d),r=0===p?0:(u.avail_in-=p,o.arraySet(l,u.input,u.next_in,p,h),1===u.state.wrap?u.adler=a(u.adler,l,p,h):2===u.state.wrap&&(u.adler=s(u.adler,l,p,h)),u.next_in+=p,u.total_in+=p,p),t.lookahead+=r,t.lookahead+t.insert>=3)for(c=t.strstart-t.insert,t.ins_h=t.window[c],t.ins_h=(t.ins_h<<t.hash_shift^t.window[c+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[c+3-1])&t.hash_mask,t.prev[c&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=c,c++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<f&&0!==t.strm.avail_in)}function _(t,e){for(var r,n;;){if(t.lookahead<f){if(x(t),t.lookahead<f&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==r&&t.strstart-r<=t.w_size-f&&(t.match_length=w(t,r)),t.match_length>=3)if(n=i._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart,0!=--t.match_length;);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else n=i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(m(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(m(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(m(t,!1),0===t.strm.avail_out)?1:2}function k(t,e){for(var r,n,o;;){if(t.lookahead<f){if(x(t),t.lookahead<f&&0===e)return 1;if(0===t.lookahead)break}if(r=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==r&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-f&&(t.match_length=w(t,r),t.match_length<=5&&(1===t.strategy||3===t.match_length&&4096<t.strstart-t.match_start)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){for(o=t.strstart+t.lookahead-3,n=i._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=o&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!=--t.prev_length;);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(m(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((n=i._tr_tally(t,0,t.window[t.strstart-1]))&&m(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=i._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(m(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(m(t,!1),0===t.strm.avail_out)?1:2}function E(t,e,r,n,o){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=o}function A(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(1146),this.dyn_dtree=new o.Buf16(122),this.bl_tree=new o.Buf16(78),y(this.dyn_ltree),y(this.dyn_dtree),y(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(16),this.heap=new o.Buf16(573),y(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(573),y(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function S(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:h,t.adler=2===e.wrap?0:1,e.last_flush=0,i._tr_init(e),0):d(t,u)}function L(t){var e=S(t);return 0===e&&function(t){t.window_size=2*t.w_size,y(t.head),t.max_lazy_match=n[t.level].max_lazy,t.good_match=n[t.level].good_length,t.nice_match=n[t.level].nice_length,t.max_chain_length=n[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0}(t.state),e}function O(t,e,r,n,i,a){if(!t)return u;var s=1;if(-1===e&&(e=6),n<0?(s=0,n=-n):15<n&&(s=2,n-=16),i<1||9<i||8!==r||n<8||15<n||e<0||9<e||a<0||4<a)return d(t,u);8===n&&(n=9);var c=new A;return(t.state=c).strm=t,c.wrap=s,c.gzhead=null,c.w_bits=n,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=i+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+3-1)/3),c.window=new o.Buf8(2*c.w_size),c.head=new o.Buf16(c.hash_size),c.prev=new o.Buf16(c.w_size),c.lit_bufsize=1<<i+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new o.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=e,c.strategy=a,c.method=r,L(t)}n=[new E(0,0,0,0,(function(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(x(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+r;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,m(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-f&&(m(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(m(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(m(t,!1),t.strm.avail_out),1)})),new E(4,4,8,4,_),new E(4,5,16,8,_),new E(4,6,32,32,_),new E(4,4,16,16,k),new E(8,16,32,32,k),new E(8,16,128,128,k),new E(8,32,128,256,k),new E(32,128,258,1024,k),new E(32,258,258,4096,k)],r.deflateInit=function(t,e){return O(t,e,8,15,8,0)},r.deflateInit2=O,r.deflateReset=L,r.deflateResetKeep=S,r.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?u:(t.state.gzhead=e,0):u},r.deflate=function(t,e){var r,o,a,c;if(!t||!t.state||5<e||e<0)return t?d(t,u):u;if(o=t.state,!t.output||!t.input&&0!==t.avail_in||666===o.status&&4!==e)return d(t,0===t.avail_out?-5:u);if(o.strm=t,r=o.last_flush,o.last_flush=e,42===o.status)if(2===o.wrap)t.adler=0,v(o,31),v(o,139),v(o,8),o.gzhead?(v(o,(o.gzhead.text?1:0)+(o.gzhead.hcrc?2:0)+(o.gzhead.extra?4:0)+(o.gzhead.name?8:0)+(o.gzhead.comment?16:0)),v(o,255&o.gzhead.time),v(o,o.gzhead.time>>8&255),v(o,o.gzhead.time>>16&255),v(o,o.gzhead.time>>24&255),v(o,9===o.level?2:2<=o.strategy||o.level<2?4:0),v(o,255&o.gzhead.os),o.gzhead.extra&&o.gzhead.extra.length&&(v(o,255&o.gzhead.extra.length),v(o,o.gzhead.extra.length>>8&255)),o.gzhead.hcrc&&(t.adler=s(t.adler,o.pending_buf,o.pending,0)),o.gzindex=0,o.status=69):(v(o,0),v(o,0),v(o,0),v(o,0),v(o,0),v(o,9===o.level?2:2<=o.strategy||o.level<2?4:0),v(o,3),o.status=h);else{var f=8+(o.w_bits-8<<4)<<8;f|=(2<=o.strategy||o.level<2?0:o.level<6?1:6===o.level?2:3)<<6,0!==o.strstart&&(f|=32),f+=31-f%31,o.status=h,b(o,f),0!==o.strstart&&(b(o,t.adler>>>16),b(o,65535&t.adler)),t.adler=1}if(69===o.status)if(o.gzhead.extra){for(a=o.pending;o.gzindex<(65535&o.gzhead.extra.length)&&(o.pending!==o.pending_buf_size||(o.gzhead.hcrc&&o.pending>a&&(t.adler=s(t.adler,o.pending_buf,o.pending-a,a)),g(t),a=o.pending,o.pending!==o.pending_buf_size));)v(o,255&o.gzhead.extra[o.gzindex]),o.gzindex++;o.gzhead.hcrc&&o.pending>a&&(t.adler=s(t.adler,o.pending_buf,o.pending-a,a)),o.gzindex===o.gzhead.extra.length&&(o.gzindex=0,o.status=73)}else o.status=73;if(73===o.status)if(o.gzhead.name){a=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>a&&(t.adler=s(t.adler,o.pending_buf,o.pending-a,a)),g(t),a=o.pending,o.pending===o.pending_buf_size)){c=1;break}c=o.gzindex<o.gzhead.name.length?255&o.gzhead.name.charCodeAt(o.gzindex++):0,v(o,c)}while(0!==c);o.gzhead.hcrc&&o.pending>a&&(t.adler=s(t.adler,o.pending_buf,o.pending-a,a)),0===c&&(o.gzindex=0,o.status=91)}else o.status=91;if(91===o.status)if(o.gzhead.comment){a=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>a&&(t.adler=s(t.adler,o.pending_buf,o.pending-a,a)),g(t),a=o.pending,o.pending===o.pending_buf_size)){c=1;break}c=o.gzindex<o.gzhead.comment.length?255&o.gzhead.comment.charCodeAt(o.gzindex++):0,v(o,c)}while(0!==c);o.gzhead.hcrc&&o.pending>a&&(t.adler=s(t.adler,o.pending_buf,o.pending-a,a)),0===c&&(o.status=103)}else o.status=103;if(103===o.status&&(o.gzhead.hcrc?(o.pending+2>o.pending_buf_size&&g(t),o.pending+2<=o.pending_buf_size&&(v(o,255&t.adler),v(o,t.adler>>8&255),t.adler=0,o.status=h)):o.status=h),0!==o.pending){if(g(t),0===t.avail_out)return o.last_flush=-1,0}else if(0===t.avail_in&&p(e)<=p(r)&&4!==e)return d(t,-5);if(666===o.status&&0!==t.avail_in)return d(t,-5);if(0!==t.avail_in||0!==o.lookahead||0!==e&&666!==o.status){var w=2===o.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(x(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,r=i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(m(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(m(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(m(t,!1),0===t.strm.avail_out)?1:2}(o,e):3===o.strategy?function(t,e){for(var r,n,o,a,s=t.window;;){if(t.lookahead<=l){if(x(t),t.lookahead<=l&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&0<t.strstart&&(n=s[o=t.strstart-1])===s[++o]&&n===s[++o]&&n===s[++o]){a=t.strstart+l;do{}while(n===s[++o]&&n===s[++o]&&n===s[++o]&&n===s[++o]&&n===s[++o]&&n===s[++o]&&n===s[++o]&&n===s[++o]&&o<a);t.match_length=l-(a-o),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=i._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(m(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(m(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(m(t,!1),0===t.strm.avail_out)?1:2}(o,e):n[o.level].func(o,e);if(3!==w&&4!==w||(o.status=666),1===w||3===w)return 0===t.avail_out&&(o.last_flush=-1),0;if(2===w&&(1===e?i._tr_align(o):5!==e&&(i._tr_stored_block(o,0,0,!1),3===e&&(y(o.head),0===o.lookahead&&(o.strstart=0,o.block_start=0,o.insert=0))),g(t),0===t.avail_out))return o.last_flush=-1,0}return 4!==e?0:o.wrap<=0?1:(2===o.wrap?(v(o,255&t.adler),v(o,t.adler>>8&255),v(o,t.adler>>16&255),v(o,t.adler>>24&255),v(o,255&t.total_in),v(o,t.total_in>>8&255),v(o,t.total_in>>16&255),v(o,t.total_in>>24&255)):(b(o,t.adler>>>16),b(o,65535&t.adler)),g(t),0<o.wrap&&(o.wrap=-o.wrap),0!==o.pending?0:1)},r.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&103!==e&&e!==h&&666!==e?d(t,u):(t.state=null,e===h?d(t,-3):0):u},r.deflateSetDictionary=function(t,e){var r,n,i,s,c,l,f,h,d=e.length;if(!t||!t.state)return u;if(2===(s=(r=t.state).wrap)||1===s&&42!==r.status||r.lookahead)return u;for(1===s&&(t.adler=a(t.adler,e,d,0)),r.wrap=0,d>=r.w_size&&(0===s&&(y(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new o.Buf8(r.w_size),o.arraySet(h,e,d-r.w_size,r.w_size,0),e=h,d=r.w_size),c=t.avail_in,l=t.next_in,f=t.input,t.avail_in=d,t.next_in=0,t.input=e,x(r);r.lookahead>=3;){for(n=r.strstart,i=r.lookahead-2;r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,--i;);r.strstart=n,r.lookahead=2,x(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,t.next_in=l,t.input=f,t.avail_in=c,r.wrap=s,0},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,e,r){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,o,i,a,s,c,u,l,f,h,d,p,y,g,m,v,b,w,x,_,k,E,A,S;r=t.state,n=t.next_in,A=t.input,o=n+(t.avail_in-5),i=t.next_out,S=t.output,a=i-(e-t.avail_out),s=i+(t.avail_out-257),c=r.dmax,u=r.wsize,l=r.whave,f=r.wnext,h=r.window,d=r.hold,p=r.bits,y=r.lencode,g=r.distcode,m=(1<<r.lenbits)-1,v=(1<<r.distbits)-1;t:do{p<15&&(d+=A[n++]<<p,p+=8,d+=A[n++]<<p,p+=8),b=y[d&m];e:for(;;){if(d>>>=w=b>>>24,p-=w,0==(w=b>>>16&255))S[i++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=y[(65535&b)+(d&(1<<w)-1)];continue e}if(32&w){r.mode=12;break t}t.msg="invalid literal/length code",r.mode=30;break t}x=65535&b,(w&=15)&&(p<w&&(d+=A[n++]<<p,p+=8),x+=d&(1<<w)-1,d>>>=w,p-=w),p<15&&(d+=A[n++]<<p,p+=8,d+=A[n++]<<p,p+=8),b=g[d&v];r:for(;;){if(d>>>=w=b>>>24,p-=w,!(16&(w=b>>>16&255))){if(0==(64&w)){b=g[(65535&b)+(d&(1<<w)-1)];continue r}t.msg="invalid distance code",r.mode=30;break t}if(_=65535&b,p<(w&=15)&&(d+=A[n++]<<p,(p+=8)<w&&(d+=A[n++]<<p,p+=8)),c<(_+=d&(1<<w)-1)){t.msg="invalid distance too far back",r.mode=30;break t}if(d>>>=w,p-=w,(w=i-a)<_){if(l<(w=_-w)&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(E=h,(k=0)===f){if(k+=u-w,w<x){for(x-=w;S[i++]=h[k++],--w;);k=i-_,E=S}}else if(f<w){if(k+=u+f-w,(w-=f)<x){for(x-=w;S[i++]=h[k++],--w;);if(k=0,f<x){for(x-=w=f;S[i++]=h[k++],--w;);k=i-_,E=S}}}else if(k+=f-w,w<x){for(x-=w;S[i++]=h[k++],--w;);k=i-_,E=S}for(;2<x;)S[i++]=E[k++],S[i++]=E[k++],S[i++]=E[k++],x-=3;x&&(S[i++]=E[k++],1<x&&(S[i++]=E[k++]))}else{for(k=i-_;S[i++]=S[k++],S[i++]=S[k++],S[i++]=S[k++],2<(x-=3););x&&(S[i++]=S[k++],1<x&&(S[i++]=S[k++]))}break}}break}}while(n<o&&i<s);n-=x=p>>3,d&=(1<<(p-=x<<3))-1,t.next_in=n,t.next_out=i,t.avail_in=n<o?o-n+5:5-(n-o),t.avail_out=i<s?s-i+257:257-(i-s),r.hold=d,r.bits=p}},{}],49:[function(t,e,r){"use strict";var n=t("../utils/common"),o=t("./adler32"),i=t("./crc32"),a=t("./inffast"),s=t("./inftrees"),c=-2;function u(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function l(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new n.Buf32(852),e.distcode=e.distdyn=new n.Buf32(592),e.sane=1,e.back=-1,0):c}function h(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,f(t)):c}function d(t,e){var r,n;return t&&t.state?(n=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15<e)?c:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,h(t))):c}function p(t,e){var r,n;return t?(n=new l,(t.state=n).window=null,0!==(r=d(t,e))&&(t.state=null),r):c}var y,g,m=!0;function v(t){if(m){var e;for(y=new n.Buf32(512),g=new n.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(1,t.lens,0,288,y,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(2,t.lens,0,32,g,0,t.work,{bits:5}),m=!1}t.lencode=y,t.lenbits=9,t.distcode=g,t.distbits=5}function b(t,e,r,o){var i,a=t.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new n.Buf8(a.wsize)),o>=a.wsize?(n.arraySet(a.window,e,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(o<(i=a.wsize-a.wnext)&&(i=o),n.arraySet(a.window,e,r-o,i,a.wnext),(o-=i)?(n.arraySet(a.window,e,r-o,o,0),a.wnext=o,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}r.inflateReset=h,r.inflateReset2=d,r.inflateResetKeep=f,r.inflateInit=function(t){return p(t,15)},r.inflateInit2=p,r.inflate=function(t,e){var r,l,f,h,d,p,y,g,m,w,x,_,k,E,A,S,L,O,P,T,C,M,j,I,B=0,z=new n.Buf8(4),D=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return c;12===(r=t.state).mode&&(r.mode=13),d=t.next_out,f=t.output,y=t.avail_out,h=t.next_in,l=t.input,p=t.avail_in,g=r.hold,m=r.bits,w=p,x=y,M=0;t:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;m<16;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}if(2&r.wrap&&35615===g){z[r.check=0]=255&g,z[1]=g>>>8&255,r.check=i(r.check,z,2,0),m=g=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&g)<<8)+(g>>8))%31){t.msg="incorrect header check",r.mode=30;break}if(8!=(15&g)){t.msg="unknown compression method",r.mode=30;break}if(m-=4,C=8+(15&(g>>>=4)),0===r.wbits)r.wbits=C;else if(C>r.wbits){t.msg="invalid window size",r.mode=30;break}r.dmax=1<<C,t.adler=r.check=1,r.mode=512&g?10:12,m=g=0;break;case 2:for(;m<16;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}if(r.flags=g,8!=(255&r.flags)){t.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=g>>8&1),512&r.flags&&(z[0]=255&g,z[1]=g>>>8&255,r.check=i(r.check,z,2,0)),m=g=0,r.mode=3;case 3:for(;m<32;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}r.head&&(r.head.time=g),512&r.flags&&(z[0]=255&g,z[1]=g>>>8&255,z[2]=g>>>16&255,z[3]=g>>>24&255,r.check=i(r.check,z,4,0)),m=g=0,r.mode=4;case 4:for(;m<16;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}r.head&&(r.head.xflags=255&g,r.head.os=g>>8),512&r.flags&&(z[0]=255&g,z[1]=g>>>8&255,r.check=i(r.check,z,2,0)),m=g=0,r.mode=5;case 5:if(1024&r.flags){for(;m<16;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}r.length=g,r.head&&(r.head.extra_len=g),512&r.flags&&(z[0]=255&g,z[1]=g>>>8&255,r.check=i(r.check,z,2,0)),m=g=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(p<(_=r.length)&&(_=p),_&&(r.head&&(C=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,l,h,_,C)),512&r.flags&&(r.check=i(r.check,l,_,h)),p-=_,h+=_,r.length-=_),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===p)break t;for(_=0;C=l[h+_++],r.head&&C&&r.length<65536&&(r.head.name+=String.fromCharCode(C)),C&&_<p;);if(512&r.flags&&(r.check=i(r.check,l,_,h)),p-=_,h+=_,C)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===p)break t;for(_=0;C=l[h+_++],r.head&&C&&r.length<65536&&(r.head.comment+=String.fromCharCode(C)),C&&_<p;);if(512&r.flags&&(r.check=i(r.check,l,_,h)),p-=_,h+=_,C)break t}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;m<16;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}if(g!==(65535&r.check)){t.msg="header crc mismatch",r.mode=30;break}m=g=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=12;break;case 10:for(;m<32;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}t.adler=r.check=u(g),m=g=0,r.mode=11;case 11:if(0===r.havedict)return t.next_out=d,t.avail_out=y,t.next_in=h,t.avail_in=p,r.hold=g,r.bits=m,2;t.adler=r.check=1,r.mode=12;case 12:if(5===e||6===e)break t;case 13:if(r.last){g>>>=7&m,m-=7&m,r.mode=27;break}for(;m<3;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}switch(r.last=1&g,m-=1,3&(g>>>=1)){case 0:r.mode=14;break;case 1:if(v(r),r.mode=20,6!==e)break;g>>>=2,m-=2;break t;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=30}g>>>=2,m-=2;break;case 14:for(g>>>=7&m,m-=7&m;m<32;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}if((65535&g)!=(g>>>16^65535)){t.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&g,m=g=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(_=r.length){if(p<_&&(_=p),y<_&&(_=y),0===_)break t;n.arraySet(f,l,h,_,d),p-=_,h+=_,y-=_,d+=_,r.length-=_;break}r.mode=12;break;case 17:for(;m<14;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}if(r.nlen=257+(31&g),g>>>=5,m-=5,r.ndist=1+(31&g),g>>>=5,m-=5,r.ncode=4+(15&g),g>>>=4,m-=4,286<r.nlen||30<r.ndist){t.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;m<3;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}r.lens[D[r.have++]]=7&g,g>>>=3,m-=3}for(;r.have<19;)r.lens[D[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,j={bits:r.lenbits},M=s(0,r.lens,0,19,r.lencode,0,r.work,j),r.lenbits=j.bits,M){t.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;S=(B=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,L=65535&B,!((A=B>>>24)<=m);){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}if(L<16)g>>>=A,m-=A,r.lens[r.have++]=L;else{if(16===L){for(I=A+2;m<I;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}if(g>>>=A,m-=A,0===r.have){t.msg="invalid bit length repeat",r.mode=30;break}C=r.lens[r.have-1],_=3+(3&g),g>>>=2,m-=2}else if(17===L){for(I=A+3;m<I;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}m-=A,C=0,_=3+(7&(g>>>=A)),g>>>=3,m-=3}else{for(I=A+7;m<I;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}m-=A,C=0,_=11+(127&(g>>>=A)),g>>>=7,m-=7}if(r.have+_>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=30;break}for(;_--;)r.lens[r.have++]=C}}if(30===r.mode)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,j={bits:r.lenbits},M=s(1,r.lens,0,r.nlen,r.lencode,0,r.work,j),r.lenbits=j.bits,M){t.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,j={bits:r.distbits},M=s(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,j),r.distbits=j.bits,M){t.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(6<=p&&258<=y){t.next_out=d,t.avail_out=y,t.next_in=h,t.avail_in=p,r.hold=g,r.bits=m,a(t,x),d=t.next_out,f=t.output,y=t.avail_out,h=t.next_in,l=t.input,p=t.avail_in,g=r.hold,m=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;S=(B=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,L=65535&B,!((A=B>>>24)<=m);){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}if(S&&0==(240&S)){for(O=A,P=S,T=L;S=(B=r.lencode[T+((g&(1<<O+P)-1)>>O)])>>>16&255,L=65535&B,!(O+(A=B>>>24)<=m);){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}g>>>=O,m-=O,r.back+=O}if(g>>>=A,m-=A,r.back+=A,r.length=L,0===S){r.mode=26;break}if(32&S){r.back=-1,r.mode=12;break}if(64&S){t.msg="invalid literal/length code",r.mode=30;break}r.extra=15&S,r.mode=22;case 22:if(r.extra){for(I=r.extra;m<I;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}r.length+=g&(1<<r.extra)-1,g>>>=r.extra,m-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;S=(B=r.distcode[g&(1<<r.distbits)-1])>>>16&255,L=65535&B,!((A=B>>>24)<=m);){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}if(0==(240&S)){for(O=A,P=S,T=L;S=(B=r.distcode[T+((g&(1<<O+P)-1)>>O)])>>>16&255,L=65535&B,!(O+(A=B>>>24)<=m);){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}g>>>=O,m-=O,r.back+=O}if(g>>>=A,m-=A,r.back+=A,64&S){t.msg="invalid distance code",r.mode=30;break}r.offset=L,r.extra=15&S,r.mode=24;case 24:if(r.extra){for(I=r.extra;m<I;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}r.offset+=g&(1<<r.extra)-1,g>>>=r.extra,m-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===y)break t;if(_=x-y,r.offset>_){if((_=r.offset-_)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=30;break}k=_>r.wnext?(_-=r.wnext,r.wsize-_):r.wnext-_,_>r.length&&(_=r.length),E=r.window}else E=f,k=d-r.offset,_=r.length;for(y<_&&(_=y),y-=_,r.length-=_;f[d++]=E[k++],--_;);0===r.length&&(r.mode=21);break;case 26:if(0===y)break t;f[d++]=r.length,y--,r.mode=21;break;case 27:if(r.wrap){for(;m<32;){if(0===p)break t;p--,g|=l[h++]<<m,m+=8}if(x-=y,t.total_out+=x,r.total+=x,x&&(t.adler=r.check=r.flags?i(r.check,f,x,d-x):o(r.check,f,x,d-x)),x=y,(r.flags?g:u(g))!==r.check){t.msg="incorrect data check",r.mode=30;break}m=g=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;m<32;){if(0===p)break t;p--,g+=l[h++]<<m,m+=8}if(g!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=30;break}m=g=0}r.mode=29;case 29:M=1;break t;case 30:M=-3;break t;case 31:return-4;default:return c}return t.next_out=d,t.avail_out=y,t.next_in=h,t.avail_in=p,r.hold=g,r.bits=m,(r.wsize||x!==t.avail_out&&r.mode<30&&(r.mode<27||4!==e))&&b(t,t.output,t.next_out,x-t.avail_out)?(r.mode=31,-4):(w-=t.avail_in,x-=t.avail_out,t.total_in+=w,t.total_out+=x,r.total+=x,r.wrap&&x&&(t.adler=r.check=r.flags?i(r.check,f,x,t.next_out-x):o(r.check,f,x,t.next_out-x)),t.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==w&&0===x||4===e)&&0===M&&(M=-5),M)},r.inflateEnd=function(t){if(!t||!t.state)return c;var e=t.state;return e.window&&(e.window=null),t.state=null,0},r.inflateGetHeader=function(t,e){var r;return t&&t.state?0==(2&(r=t.state).wrap)?c:((r.head=e).done=!1,0):c},r.inflateSetDictionary=function(t,e){var r,n=e.length;return t&&t.state?0!==(r=t.state).wrap&&11!==r.mode?c:11===r.mode&&o(1,e,n,0)!==r.check?-3:b(t,e,n,n)?(r.mode=31,-4):(r.havedict=1,0):c},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,e,r){"use strict";var n=t("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],i=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,r,c,u,l,f,h){var d,p,y,g,m,v,b,w,x,_=h.bits,k=0,E=0,A=0,S=0,L=0,O=0,P=0,T=0,C=0,M=0,j=null,I=0,B=new n.Buf16(16),z=new n.Buf16(16),D=null,N=0;for(k=0;k<=15;k++)B[k]=0;for(E=0;E<c;E++)B[e[r+E]]++;for(L=_,S=15;1<=S&&0===B[S];S--);if(S<L&&(L=S),0===S)return u[l++]=20971520,u[l++]=20971520,h.bits=1,0;for(A=1;A<S&&0===B[A];A++);for(L<A&&(L=A),k=T=1;k<=15;k++)if(T<<=1,(T-=B[k])<0)return-1;if(0<T&&(0===t||1!==S))return-1;for(z[1]=0,k=1;k<15;k++)z[k+1]=z[k]+B[k];for(E=0;E<c;E++)0!==e[r+E]&&(f[z[e[r+E]]++]=E);if(v=0===t?(j=D=f,19):1===t?(j=o,I-=257,D=i,N-=257,256):(j=a,D=s,-1),k=A,m=l,P=E=M=0,y=-1,g=(C=1<<(O=L))-1,1===t&&852<C||2===t&&592<C)return 1;for(;;){for(b=k-P,x=f[E]<v?(w=0,f[E]):f[E]>v?(w=D[N+f[E]],j[I+f[E]]):(w=96,0),d=1<<k-P,A=p=1<<O;u[m+(M>>P)+(p-=d)]=b<<24|w<<16|x|0,0!==p;);for(d=1<<k-1;M&d;)d>>=1;if(0!==d?(M&=d-1,M+=d):M=0,E++,0==--B[k]){if(k===S)break;k=e[r+f[E]]}if(L<k&&(M&g)!==y){for(0===P&&(P=L),m+=A,T=1<<(O=k-P);O+P<S&&!((T-=B[O+P])<=0);)O++,T<<=1;if(C+=1<<O,1===t&&852<C||2===t&&592<C)return 1;u[y=M&g]=L<<24|O<<16|m-l|0}}return 0!==M&&(u[m+M]=k-P<<24|64<<16|0),h.bits=L,0}},{"../utils/common":41}],51:[function(t,e,r){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,e,r){"use strict";var n=t("../utils/common");function o(t){for(var e=t.length;0<=--e;)t[e]=0}var i=256,a=286,s=30,c=15,u=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],l=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],h=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],d=new Array(576);o(d);var p=new Array(60);o(p);var y=new Array(512);o(y);var g=new Array(256);o(g);var m=new Array(29);o(m);var v,b,w,x=new Array(s);function _(t,e,r,n,o){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=o,this.has_stree=t&&t.length}function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function E(t){return t<256?y[t]:y[256+(t>>>7)]}function A(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function S(t,e,r){t.bi_valid>16-r?(t.bi_buf|=e<<t.bi_valid&65535,A(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}function L(t,e,r){S(t,r[2*e],r[2*e+1])}function O(t,e){for(var r=0;r|=1&t,t>>>=1,r<<=1,0<--e;);return r>>>1}function P(t,e,r){var n,o,i=new Array(16),a=0;for(n=1;n<=c;n++)i[n]=a=a+r[n-1]<<1;for(o=0;o<=e;o++){var s=t[2*o+1];0!==s&&(t[2*o]=O(i[s]++,s))}}function T(t){var e;for(e=0;e<a;e++)t.dyn_ltree[2*e]=0;for(e=0;e<s;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function C(t){8<t.bi_valid?A(t,t.bi_buf):0<t.bi_valid&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function M(t,e,r,n){var o=2*e,i=2*r;return t[o]<t[i]||t[o]===t[i]&&n[e]<=n[r]}function j(t,e,r){for(var n=t.heap[r],o=r<<1;o<=t.heap_len&&(o<t.heap_len&&M(e,t.heap[o+1],t.heap[o],t.depth)&&o++,!M(e,n,t.heap[o],t.depth));)t.heap[r]=t.heap[o],r=o,o<<=1;t.heap[r]=n}function I(t,e,r){var n,o,a,s,c=0;if(0!==t.last_lit)for(;n=t.pending_buf[t.d_buf+2*c]<<8|t.pending_buf[t.d_buf+2*c+1],o=t.pending_buf[t.l_buf+c],c++,0===n?L(t,o,e):(L(t,(a=g[o])+i+1,e),0!==(s=u[a])&&S(t,o-=m[a],s),L(t,a=E(--n),r),0!==(s=l[a])&&S(t,n-=x[a],s)),c<t.last_lit;);L(t,256,e)}function B(t,e){var r,n,o,i=e.dyn_tree,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,u=e.stat_desc.elems,l=-1;for(t.heap_len=0,t.heap_max=573,r=0;r<u;r++)0!==i[2*r]?(t.heap[++t.heap_len]=l=r,t.depth[r]=0):i[2*r+1]=0;for(;t.heap_len<2;)i[2*(o=t.heap[++t.heap_len]=l<2?++l:0)]=1,t.depth[o]=0,t.opt_len--,s&&(t.static_len-=a[2*o+1]);for(e.max_code=l,r=t.heap_len>>1;1<=r;r--)j(t,i,r);for(o=u;r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],j(t,i,1),n=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=n,i[2*o]=i[2*r]+i[2*n],t.depth[o]=(t.depth[r]>=t.depth[n]?t.depth[r]:t.depth[n])+1,i[2*r+1]=i[2*n+1]=o,t.heap[1]=o++,j(t,i,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,n,o,i,a,s,u=e.dyn_tree,l=e.max_code,f=e.stat_desc.static_tree,h=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,y=e.stat_desc.max_length,g=0;for(i=0;i<=c;i++)t.bl_count[i]=0;for(u[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<573;r++)y<(i=u[2*u[2*(n=t.heap[r])+1]+1]+1)&&(i=y,g++),u[2*n+1]=i,l<n||(t.bl_count[i]++,a=0,p<=n&&(a=d[n-p]),s=u[2*n],t.opt_len+=s*(i+a),h&&(t.static_len+=s*(f[2*n+1]+a)));if(0!==g){do{for(i=y-1;0===t.bl_count[i];)i--;t.bl_count[i]--,t.bl_count[i+1]+=2,t.bl_count[y]--,g-=2}while(0<g);for(i=y;0!==i;i--)for(n=t.bl_count[i];0!==n;)l<(o=t.heap[--r])||(u[2*o+1]!==i&&(t.opt_len+=(i-u[2*o+1])*u[2*o],u[2*o+1]=i),n--)}}(t,e),P(i,l,t.bl_count)}function z(t,e,r){var n,o,i=-1,a=e[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),e[2*(r+1)+1]=65535,n=0;n<=r;n++)o=a,a=e[2*(n+1)+1],++s<c&&o===a||(s<u?t.bl_tree[2*o]+=s:0!==o?(o!==i&&t.bl_tree[2*o]++,t.bl_tree[32]++):s<=10?t.bl_tree[34]++:t.bl_tree[36]++,i=o,u=(s=0)===a?(c=138,3):o===a?(c=6,3):(c=7,4))}function D(t,e,r){var n,o,i=-1,a=e[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(o=a,a=e[2*(n+1)+1],!(++s<c&&o===a)){if(s<u)for(;L(t,o,t.bl_tree),0!=--s;);else 0!==o?(o!==i&&(L(t,o,t.bl_tree),s--),L(t,16,t.bl_tree),S(t,s-3,2)):s<=10?(L(t,17,t.bl_tree),S(t,s-3,3)):(L(t,18,t.bl_tree),S(t,s-11,7));i=o,u=(s=0)===a?(c=138,3):o===a?(c=6,3):(c=7,4)}}o(x);var N=!1;function R(t,e,r,o){S(t,0+(o?1:0),3),function(t,e,r,o){C(t),A(t,r),A(t,~r),n.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}(t,e,r)}r._tr_init=function(t){N||(function(){var t,e,r,n,o,i=new Array(16);for(n=r=0;n<28;n++)for(m[n]=r,t=0;t<1<<u[n];t++)g[r++]=n;for(g[r-1]=n,n=o=0;n<16;n++)for(x[n]=o,t=0;t<1<<l[n];t++)y[o++]=n;for(o>>=7;n<s;n++)for(x[n]=o<<7,t=0;t<1<<l[n]-7;t++)y[256+o++]=n;for(e=0;e<=c;e++)i[e]=0;for(t=0;t<=143;)d[2*t+1]=8,t++,i[8]++;for(;t<=255;)d[2*t+1]=9,t++,i[9]++;for(;t<=279;)d[2*t+1]=7,t++,i[7]++;for(;t<=287;)d[2*t+1]=8,t++,i[8]++;for(P(d,287,i),t=0;t<s;t++)p[2*t+1]=5,p[2*t]=O(t,5);v=new _(d,u,257,a,c),b=new _(p,l,0,s,c),w=new _(new Array(0),f,0,19,7)}(),N=!0),t.l_desc=new k(t.dyn_ltree,v),t.d_desc=new k(t.dyn_dtree,b),t.bl_desc=new k(t.bl_tree,w),t.bi_buf=0,t.bi_valid=0,T(t)},r._tr_stored_block=R,r._tr_flush_block=function(t,e,r,n){var o,a,s=0;0<t.level?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<i;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),B(t,t.l_desc),B(t,t.d_desc),s=function(t){var e;for(z(t,t.dyn_ltree,t.l_desc.max_code),z(t,t.dyn_dtree,t.d_desc.max_code),B(t,t.bl_desc),e=18;3<=e&&0===t.bl_tree[2*h[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),o=t.opt_len+3+7>>>3,(a=t.static_len+3+7>>>3)<=o&&(o=a)):o=a=r+5,r+4<=o&&-1!==e?R(t,e,r,n):4===t.strategy||a===o?(S(t,2+(n?1:0),3),I(t,d,p)):(S(t,4+(n?1:0),3),function(t,e,r,n){var o;for(S(t,e-257,5),S(t,r-1,5),S(t,n-4,4),o=0;o<n;o++)S(t,t.bl_tree[2*h[o]+1],3);D(t,t.dyn_ltree,e-1),D(t,t.dyn_dtree,r-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),I(t,t.dyn_ltree,t.dyn_dtree)),T(t),n&&C(t)},r._tr_tally=function(t,e,r){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(g[r]+i+1)]++,t.dyn_dtree[2*E(e)]++),t.last_lit===t.lit_bufsize-1},r._tr_align=function(t){S(t,2,3),L(t,256,d),function(t){16===t.bi_valid?(A(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},{"../utils/common":41}],53:[function(t,e,r){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,r){"use strict";e.exports="function"==typeof setImmediate?setImmediate:function(){var t=[].slice.apply(arguments);t.splice(1,0,0),setTimeout.apply(null,t)}},{}]},{},[10])(10)},5233:function(t,e,r){var n,o,i;t=r.nmd(t),function(a,s,c){"use strict";var u={function:!0,object:!0},l=u[typeof e]&&e&&!e.nodeType&&e,f=u.object&&t&&!t.nodeType&&t,h=l&&f&&"object"==typeof r.g&&r.g,d=f&&f.exports===l&&l;!h||h.global!==h&&h.window!==h&&h.self,o=[e],void 0===(i="function"==typeof(n=c)?n.apply(e,o):n)||(t.exports=i),l&&d&&c(f.exports)}(0,0,(function(t){"use strict";var e,r,n,o,i;t.version="0.3.1";var a=t.defaultOptions={wait:!1,comments:!0,scope:!1,locations:!1,ranges:!1,onCreateNode:null,onCreateScope:null,onDestroyScope:null,onLocalDeclaration:null,luaVersion:"5.1",encodingMode:"none"};function s(t,e){return e=e||0,t<128?String.fromCharCode(t):t<2048?String.fromCharCode(192|e|t>>6,128|e|63&t):t<65536?String.fromCharCode(224|e|t>>12,128|e|t>>6&63,128|e|63&t):t<1114112?String.fromCharCode(240|e|t>>18,128|e|t>>12&63,128|e|t>>6&63,128|e|63&t):null}function c(t){return function(e){var r=t.exec(e);if(!r)return e;M(null,d.invalidCodeUnit,function(t,e){for(var r=t.toString(16);r.length<4;)r="0"+r;return r}(r[0].charCodeAt(0)).toUpperCase())}}var u={"pseudo-latin1":{fixup:c(/[^\x00-\xff]/),encodeByte:function(t){return null===t?"":String.fromCharCode(t)},encodeUTF8:function(t){return s(t)}},"x-user-defined":{fixup:c(/[^\x00-\x7f\uf780-\uf7ff]/),encodeByte:function(t){return null===t?"":t>=128?String.fromCharCode(63232|t):String.fromCharCode(t)},encodeUTF8:function(t){return s(t,63232)}},none:{discardStrings:!0,fixup:function(t){return t},encodeByte:function(t){return""},encodeUTF8:function(t){return""}}},l=32,f=128,h=256;t.tokenTypes={EOF:1,StringLiteral:2,Keyword:4,Identifier:8,NumericLiteral:16,Punctuator:l,BooleanLiteral:64,NilLiteral:f,VarargLiteral:h};var d=t.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"},p=t.ast={labelStatement:function(t){return{type:"LabelStatement",label:t}},breakStatement:function(){return{type:"BreakStatement"}},gotoStatement:function(t){return{type:"GotoStatement",label:t}},returnStatement:function(t){return{type:"ReturnStatement",arguments:t}},ifStatement:function(t){return{type:"IfStatement",clauses:t}},ifClause:function(t,e){return{type:"IfClause",condition:t,body:e}},elseifClause:function(t,e){return{type:"ElseifClause",condition:t,body:e}},elseClause:function(t){return{type:"ElseClause",body:t}},whileStatement:function(t,e){return{type:"WhileStatement",condition:t,body:e}},doStatement:function(t){return{type:"DoStatement",body:t}},repeatStatement:function(t,e){return{type:"RepeatStatement",condition:t,body:e}},localStatement:function(t,e){return{type:"LocalStatement",variables:t,init:e}},assignmentStatement:function(t,e){return{type:"AssignmentStatement",variables:t,init:e}},callStatement:function(t){return{type:"CallStatement",expression:t}},functionStatement:function(t,e,r,n){return{type:"FunctionDeclaration",identifier:t,isLocal:r,parameters:e,body:n}},forNumericStatement:function(t,e,r,n,o){return{type:"ForNumericStatement",variable:t,start:e,end:r,step:n,body:o}},forGenericStatement:function(t,e,r){return{type:"ForGenericStatement",variables:t,iterators:e,body:r}},chunk:function(t){return{type:"Chunk",body:t}},identifier:function(t){return{type:"Identifier",name:t}},literal:function(t,e,r){return{type:t=2===t?"StringLiteral":16===t?"NumericLiteral":64===t?"BooleanLiteral":t===f?"NilLiteral":"VarargLiteral",value:e,raw:r}},tableKey:function(t,e){return{type:"TableKey",key:t,value:e}},tableKeyString:function(t,e){return{type:"TableKeyString",key:t,value:e}},tableValue:function(t){return{type:"TableValue",value:t}},tableConstructorExpression:function(t){return{type:"TableConstructorExpression",fields:t}},binaryExpression:function(t,e,r){return{type:"and"===t||"or"===t?"LogicalExpression":"BinaryExpression",operator:t,left:e,right:r}},unaryExpression:function(t,e){return{type:"UnaryExpression",operator:t,argument:e}},memberExpression:function(t,e,r){return{type:"MemberExpression",indexer:e,identifier:r,base:t}},indexExpression:function(t,e){return{type:"IndexExpression",base:t,index:e}},callExpression:function(t,e){return{type:"CallExpression",base:t,arguments:e}},tableCallExpression:function(t,e){return{type:"TableCallExpression",base:t,arguments:e}},stringCallExpression:function(t,e){return{type:"StringCallExpression",base:t,argument:e}},comment:function(t,e){return{type:"Comment",value:t,raw:e}}};function y(t){if(ot){var e=it.pop();e.complete(),e.bless(t)}return r.onCreateNode&&r.onCreateNode(t),t}var g=Array.prototype.slice,m=(Object.prototype.toString,function(t,e){for(var r=0,n=t.length;r<n;++r)if(t[r]===e)return r;return-1});function v(t){var e=g.call(arguments,1);return t=t.replace(/%(\d)/g,(function(t,r){return""+e[r-1]||""})),t}Array.prototype.indexOf&&(m=function(t,e){return t.indexOf(e)});var b,w,x,_,k,E,A,S,L,O,P,T=function(t){for(var e,r,n=g.call(arguments,1),o=0,i=n.length;o<i;++o)for(r in e=n[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t};function C(t){return Object.create?Object.create(t,{line:{writable:!0,value:t.line},index:{writable:!0,value:t.index},column:{writable:!0,value:t.column}}):t}function M(t){var e,r,n=v.apply(null,g.call(arguments,1));throw null===t||void 0===t.line?(r=b-S+1,(e=C(new SyntaxError(v("[%1:%2] %3",A,r,n)))).index=b,e.line=A,e.column=r):(r=t.range[0]-t.lineStart,(e=C(new SyntaxError(v("[%1:%2] %3",t.line,r,n)))).line=t.line,e.index=t.range[0],e.column=r),e}function j(t){return e.slice(t.range[0],t.range[1])||t.value}function I(t,e){M(e,d.expectedToken,t,j(e))}function B(t){var e=j(_);if(void 0!==t.type){var r;switch(t.type){case 2:r="string";break;case 4:r="keyword";break;case 8:r="identifier";break;case 16:r="number";break;case l:r="symbol";break;case 64:r="boolean";break;case f:return M(t,d.unexpected,"symbol","nil",e);case 1:return M(t,d.unexpectedEOF)}return M(t,d.unexpected,r,j(t),e)}return M(t,d.unexpected,"symbol",t,e)}function z(){for(N();45===e.charCodeAt(b)&&45===e.charCodeAt(b+1);)G(),N();if(b>=n)return{type:1,value:"<eof>",line:A,lineStart:S,range:[b,b]};var t,r,a,s=e.charCodeAt(b),c=e.charCodeAt(b+1);if(E=b,function(t){return t>=65&&t<=90||t>=97&&t<=122||95===t||!!(o.extendedIdentifiers&&t>=128)}(s))return function(){for(var t,r;q(e.charCodeAt(++b)););return!function(t){switch(t.length){case 2:return"do"===t||"if"===t||"in"===t||"or"===t;case 3:return"and"===t||"end"===t||"for"===t||"not"===t;case 4:return"else"===t||"then"===t||!(!o.labels||o.contextualGoto)&&"goto"===t;case 5:return"break"===t||"local"===t||"until"===t||"while"===t;case 6:return"elseif"===t||"repeat"===t||"return"===t;case 8:return"function"===t}return!1}(t=i.fixup(e.slice(E,b)))?"true"===t||"false"===t?(r=64,t="true"===t):"nil"===t?(r=f,t=null):r=8:r=4,{type:r,value:t,line:A,lineStart:S,range:[E,b]}}();switch(s){case 39:case 34:return function(){for(var t,r=e.charCodeAt(b++),o=A,a=S,s=b,c=i.discardStrings?null:"";r!==(t=e.charCodeAt(b++));)if((b>n||Y(t))&&(c+=e.slice(s,b-1),M(null,d.unfinishedString,e.slice(E,b-1))),92===t){if(!i.discardStrings){var u=e.slice(s,b-1);c+=i.fixup(u)}var l=U();i.discardStrings||(c+=l),s=b}return i.discardStrings||(c+=i.encodeByte(null),c+=i.fixup(e.slice(s,b-1))),{type:2,value:c,line:o,lineStart:a,lastLine:A,lastLineStart:S,range:[E,b]}}();case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return F();case 46:return K(c)?F():46===c?46===e.charCodeAt(b+2)?{type:h,value:"...",line:A,lineStart:S,range:[E,b+=3]}:R(".."):R(".");case 61:return R(61===c?"==":"=");case 62:return o.bitwiseOperators&&62===c?R(">>"):R(61===c?">=":">");case 60:return o.bitwiseOperators&&60===c?R("<<"):R(61===c?"<=":"<");case 126:if(61===c)return R("~=");if(!o.bitwiseOperators)break;return R("~");case 58:return o.labels&&58===c?R("::"):R(":");case 91:return 91===c||61===c?(t=A,r=S,!1===(a=W(!1))&&M(w,d.expected,"[",j(w)),{type:2,value:i.discardStrings?null:i.fixup(a),line:t,lineStart:r,lastLine:A,lastLineStart:S,range:[E,b]}):R("[");case 47:return o.integerDivision&&47===c?R("//"):R("/");case 38:case 124:if(!o.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 R(e.charAt(b))}return B(e.charAt(b))}function D(){var t=e.charCodeAt(b),r=e.charCodeAt(b+1);return!!Y(t)&&(10===t&&13===r&&++b,13===t&&10===r&&++b,++A,S=++b,!0)}function N(){for(;b<n;)if(9===(t=e.charCodeAt(b))||32===t||11===t||12===t)++b;else if(!D())break;var t}function R(t){return b+=t.length,{type:l,value:t,line:A,lineStart:S,range:[E,b]}}function F(){var t=e.charAt(b),r=e.charAt(b+1),n="0"===t&&"xX".indexOf(r||null)>=0?function(){var t,r,n,o,i=0,a=1,s=1;for(o=b+=2,H(e.charCodeAt(b))||M(null,d.malformedNumber,e.slice(E,b));H(e.charCodeAt(b));)++b;t=parseInt(e.slice(o,b),16);var c=!1;if("."===e.charAt(b)){for(c=!0,r=++b;H(e.charCodeAt(b));)++b;i=e.slice(r,b),i=r===b?0:parseInt(i,16)/Math.pow(16,b-r)}var u=!1;if("pP".indexOf(e.charAt(b)||null)>=0){for(u=!0,++b,"+-".indexOf(e.charAt(b)||null)>=0&&(s="+"===e.charAt(b++)?1:-1),n=b,K(e.charCodeAt(b))||M(null,d.malformedNumber,e.slice(E,b));K(e.charCodeAt(b));)++b;a=e.slice(n,b),a=Math.pow(2,a*s)}return{value:(t+i)*a,hasFractionPart:c||u}}():function(){for(;K(e.charCodeAt(b));)++b;var t=!1;if("."===e.charAt(b))for(t=!0,++b;K(e.charCodeAt(b));)++b;var r=!1;if("eE".indexOf(e.charAt(b)||null)>=0)for(r=!0,++b,"+-".indexOf(e.charAt(b)||null)>=0&&++b,K(e.charCodeAt(b))||M(null,d.malformedNumber,e.slice(E,b));K(e.charCodeAt(b));)++b;return{value:parseFloat(e.slice(E,b)),hasFractionPart:t||r}}(),i=function(){if(o.imaginaryNumbers)return"iI".indexOf(e.charAt(b)||null)>=0&&(++b,!0)}();return function(){if(o.integerSuffixes)if("uU".indexOf(e.charAt(b)||null)>=0)if(++b,"lL".indexOf(e.charAt(b)||null)>=0){if(++b,"lL".indexOf(e.charAt(b)||null)>=0)return++b,"ULL";M(null,d.malformedNumber,e.slice(E,b))}else M(null,d.malformedNumber,e.slice(E,b));else if("lL".indexOf(e.charAt(b)||null)>=0){if(++b,"lL".indexOf(e.charAt(b)||null)>=0)return++b,"LL";M(null,d.malformedNumber,e.slice(E,b))}}()&&(i||n.hasFractionPart)&&M(null,d.malformedNumber,e.slice(E,b)),{type:16,value:n.value,line:A,lineStart:S,range:[E,b]}}function U(){var t=b;switch(e.charAt(b)){case"a":return++b,"";case"n":return++b,"\n";case"r":return++b,"\r";case"t":return++b,"\t";case"v":return++b,"\v";case"b":return++b,"\b";case"f":return++b,"\f";case"\r":case"\n":return D(),"\n";case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;K(e.charCodeAt(b))&&b-t<3;)++b;var r=e.slice(t,b),n=parseInt(r,10);return n>255&&M(null,d.decimalEscapeTooLarge,"\\"+n),i.encodeByte(n,"\\"+r);case"z":if(o.skipWhitespaceEscape)return++b,N(),"";break;case"x":if(o.hexEscapes){if(H(e.charCodeAt(b+1))&&H(e.charCodeAt(b+2)))return b+=3,i.encodeByte(parseInt(e.slice(t+1,b),16),"\\"+e.slice(t,b));M(null,d.hexadecimalDigitExpected,"\\"+e.slice(t,b+2))}break;case"u":if(o.unicodeEscapes)return function(){var t=b++;for("{"!==e.charAt(b++)&&M(null,d.braceExpected,"{","\\"+e.slice(t,b)),H(e.charCodeAt(b))||M(null,d.hexadecimalDigitExpected,"\\"+e.slice(t,b));48===e.charCodeAt(b);)++b;for(var r=b;H(e.charCodeAt(b));)++b-r>6&&M(null,d.tooLargeCodepoint,"\\"+e.slice(t,b));var n=e.charAt(b++);"}"!==n&&('"'===n||"'"===n?M(null,d.braceExpected,"}","\\"+e.slice(t,b--)):M(null,d.hexadecimalDigitExpected,"\\"+e.slice(t,b)));var o=parseInt(e.slice(r,b-1)||"0",16),a="\\"+e.slice(t,b);return o>1114111&&M(null,d.tooLargeCodepoint,a),i.encodeUTF8(o,a)}();break;case"\\":case'"':case"'":return e.charAt(b++)}return o.strictEscapes&&M(null,d.invalidEscape,"\\"+e.slice(t,b+1)),e.charAt(b++)}function G(){E=b,b+=2;var t=e.charAt(b),o="",i=!1,a=b,s=S,c=A;if("["===t&&(!1===(o=W(!0))?o=t:i=!0),!i){for(;b<n&&!Y(e.charCodeAt(b));)++b;r.comments&&(o=e.slice(a,b))}if(r.comments){var u=p.comment(o,e.slice(E,b));r.locations&&(u.loc={start:{line:c,column:E-s},end:{line:A,column:b-S}}),r.ranges&&(u.range=[E,b]),r.onCreateNode&&r.onCreateNode(u),k.push(u)}}function W(t){var r,o=0,i="",a=!1,s=A;for(++b;"="===e.charAt(b+o);)++o;if("["!==e.charAt(b+o))return!1;for(b+=o+1,Y(e.charCodeAt(b))&&D(),r=b;b<n;){for(;Y(e.charCodeAt(b));)D();if("]"===e.charAt(b++)){a=!0;for(var c=0;c<o;++c)"="!==e.charAt(b+c)&&(a=!1);"]"!==e.charAt(b+o)&&(a=!1)}if(a)return i+=e.slice(r,b-1),b+=o+1,i}M(null,t?d.unfinishedLongComment:d.unfinishedLongString,s,"<eof>")}function V(){x=w,w=_,_=z()}function Z(t){return t===w.value&&(V(),!0)}function $(t){t===w.value?V():M(w,d.expected,t,j(w))}function Y(t){return 10===t||13===t}function K(t){return t>=48&&t<=57}function H(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function q(t){return t>=65&&t<=90||t>=97&&t<=122||95===t||t>=48&&t<=57||!!(o.extendedIdentifiers&&t>=128)}function X(t){if(1===t.type)return!0;if(4!==t.type)return!1;switch(t.value){case"else":case"elseif":case"end":case"until":return!0;default:return!1}}function J(){var t=L[O++].slice();L.push(t),r.onCreateScope&&r.onCreateScope()}function Q(){L.pop(),--O,r.onDestroyScope&&r.onDestroyScope()}function tt(t){r.onLocalDeclaration&&r.onLocalDeclaration(t),-1===m(L[O],t)&&L[O].push(t)}function et(t){tt(t.name),rt(t,!0)}function rt(t,e){e||-1!==function(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===r)return n;return-1}(P,0,t.name)||P.push(t),t.isLocal=e}function nt(t){return-1!==m(L[O],t)}Object.assign&&(T=Object.assign),t.SyntaxError=SyntaxError,t.lex=z;var ot,it=[];function at(){return new st(w)}function st(t){r.locations&&(this.loc={start:{line:t.line,column:t.range[0]-t.lineStart},end:{line:0,column:0}}),r.ranges&&(this.range=[t.range[0],0])}function ct(){ot&&it.push(at())}function ut(t){ot&&it.push(t)}function lt(){this.scopes=[],this.pendingGotos=[]}function ft(){this.level=0,this.loopLevels=[]}function ht(){return o.labels?new lt:new ft}function dt(t){for(var e,r=[];!X(w);){if("return"===w.value||!o.relaxedBreak&&"break"===w.value){r.push(pt(t));break}e=pt(t),Z(";"),e&&r.push(e)}return r}function pt(t){if(ct(),l===w.type&&Z("::"))return function(t){var e=w,n=gt();return r.scope&&(tt("::"+e.value+"::"),rt(n,!0)),$("::"),t.addLabel(e.value,e),y(p.labelStatement(n))}(t);if(!o.emptyStatement||!Z(";")){if(t.raiseDeferredErrors(),4===w.type)switch(w.value){case"local":return V(),function(t){var e,n=x;if(8===w.type){var o=[],i=[];do{e=gt(),o.push(e),t.addLocal(e.name,n)}while(Z(","));if(Z("="))do{var a=wt(t);i.push(a)}while(Z(","));if(r.scope)for(var s=0,c=o.length;s<c;++s)et(o[s]);return y(p.localStatement(o,i))}if(Z("function"))return e=gt(),t.addLocal(e.name,n),r.scope&&(et(e),J()),mt(e,!0);I("<name>",w)}(t);case"if":return V(),function(t){var e,n,o,i=[];for(ot&&(o=it[it.length-1],it.push(o)),e=wt(t),$("then"),r.scope&&J(),t.pushScope(),n=dt(t),t.popScope(),r.scope&&Q(),i.push(y(p.ifClause(e,n))),ot&&(o=at());Z("elseif");)ut(o),e=wt(t),$("then"),r.scope&&J(),t.pushScope(),n=dt(t),t.popScope(),r.scope&&Q(),i.push(y(p.elseifClause(e,n))),ot&&(o=at());return Z("else")&&(ot&&(o=new st(x),it.push(o)),r.scope&&J(),t.pushScope(),n=dt(t),t.popScope(),r.scope&&Q(),i.push(y(p.elseClause(n)))),$("end"),y(p.ifStatement(i))}(t);case"return":return V(),function(t){var e=[];if("end"!==w.value){var r=bt(t);for(null!=r&&e.push(r);Z(",");)r=wt(t),e.push(r);Z(";")}return y(p.returnStatement(e))}(t);case"function":return V(),mt(function(){var t,e,n;for(ot&&(n=at()),t=gt(),r.scope&&(rt(t,nt(t.name)),J());Z(".");)ut(n),e=gt(),t=y(p.memberExpression(t,".",e));return Z(":")&&(ut(n),e=gt(),t=y(p.memberExpression(t,":",e)),r.scope&&tt("self")),t}());case"while":return V(),function(t){var e=wt(t);$("do"),r.scope&&J(),t.pushScope(!0);var n=dt(t);return t.popScope(),r.scope&&Q(),$("end"),y(p.whileStatement(e,n))}(t);case"for":return V(),function(t){var e,n=gt();if(r.scope&&(J(),et(n)),Z("=")){var o=wt(t);$(",");var i=wt(t),a=Z(",")?wt(t):null;return $("do"),t.pushScope(!0),e=dt(t),t.popScope(),$("end"),r.scope&&Q(),y(p.forNumericStatement(n,o,i,a,e))}for(var s=[n];Z(",");)n=gt(),r.scope&&et(n),s.push(n);$("in");var c=[];do{var u=wt(t);c.push(u)}while(Z(","));return $("do"),t.pushScope(!0),e=dt(t),t.popScope(),$("end"),r.scope&&Q(),y(p.forGenericStatement(s,c,e))}(t);case"repeat":return V(),function(t){r.scope&&J(),t.pushScope(!0);var e=dt(t);$("until"),t.raiseDeferredErrors();var n=wt(t);return t.popScope(),r.scope&&Q(),y(p.repeatStatement(n,e))}(t);case"break":return V(),t.isInLoop()||M(w,d.noLoopToBreak,w.value),y(p.breakStatement());case"do":return V(),function(t){r.scope&&J(),t.pushScope();var e=dt(t);return t.popScope(),r.scope&&Q(),$("end"),y(p.doStatement(e))}(t);case"goto":return V(),yt(t)}return o.contextualGoto&&8===w.type&&"goto"===w.value&&8===_.type&&"goto"!==_.value?(V(),yt(t)):(ot&&it.pop(),function(t){var e,n,o,i,a,s=[];for(ot&&(n=at());;){if(ot&&(e=at()),8===w.type)a=w.value,i=gt(),r.scope&&rt(i,nt(a)),o=!0;else{if("("!==w.value)return B(w);V(),i=wt(t),$(")"),o=!1}t:for(;;){switch(2===w.type?'"':w.value){case".":case"[":o=!0;break;case":":case"(":case"{":case'"':o=null;break;default:break t}i=kt(i,e,t)}if(s.push(i),","!==w.value)break;if(!o)return B(w);V()}if(1===s.length&&null===o)return ut(e),y(p.callStatement(s[0]));if(!o)return B(w);$("=");var c=[];do{c.push(wt(t))}while(Z(","));return ut(n),y(p.assignmentStatement(s,c))}(t))}ot&&it.pop()}function yt(t){var e=w.value,r=x,n=gt();return t.addGoto(e,r),y(p.gotoStatement(n))}function gt(){ct();var t=w.value;return 8!==w.type&&I("<name>",w),V(),y(p.identifier(t))}function mt(t,e){var n=ht();n.pushScope();var o=[];if($("("),!Z(")"))for(;;){if(8===w.type){var i=gt();if(r.scope&&et(i),o.push(i),Z(","))continue}else h===w.type?(n.allowVararg=!0,o.push(At(n))):I("<name> or '...'",w);$(")");break}var a=dt(n);return n.popScope(),$("end"),r.scope&&Q(),e=e||!1,y(p.functionStatement(t,o,e,a))}function vt(t){for(var e,r,n=[];;){if(ct(),l===w.type&&Z("["))e=wt(t),$("]"),$("="),r=wt(t),n.push(y(p.tableKey(e,r)));else if(8===w.type)"="===_.value?(e=gt(),V(),r=wt(t),n.push(y(p.tableKeyString(e,r)))):(r=wt(t),n.push(y(p.tableValue(r))));else{if(null==(r=bt(t))){it.pop();break}n.push(y(p.tableValue(r)))}if(!(",;".indexOf(w.value)>=0))break;V()}return $("}"),y(p.tableConstructorExpression(n))}function bt(t){return _t(0,t)}function wt(t){var e=bt(t);if(null!=e)return e;I("<expression>",w)}function xt(t){var e=t.charCodeAt(0),r=t.length;if(1===r)switch(e){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(2===r)switch(e){case 47:return 10;case 46:return 8;case 60:case 62:return"<<"===t||">>"===t?7:3;case 61:case 126:return 3;case 111:return 1}else if(97===e&&"and"===t)return 2;return 0}function _t(t,e){var n,o,i,a=w.value;if(ot&&(o=at()),function(t){return l===t.type?"#-~".indexOf(t.value)>=0:4===t.type&&"not"===t.value}(w)){ct(),V();var s=_t(10,e);null==s&&I("<expression>",w),n=y(p.unaryExpression(a,s))}if(null==n&&null==(n=At(e))&&(n=function(t){var e,n,o;if(ot&&(o=at()),8===w.type)n=w.value,e=gt(),r.scope&&rt(e,nt(n));else{if(!Z("("))return null;e=wt(t),$(")")}for(;;){var i=kt(e,o,t);if(null===i)break;e=i}return e}(e)),null==n)return null;for(;a=w.value,!(0===(i=l===w.type||4===w.type?xt(a):0)||i<=t);){"^"!==a&&".."!==a||--i,V();var c=_t(i,e);null==c&&I("<expression>",w),ot&&it.push(o),n=y(p.binaryExpression(a,n,c))}return n}function kt(t,e,r){var n,o;if(l===w.type)switch(w.value){case"[":return ut(e),V(),n=wt(r),$("]"),y(p.indexExpression(t,n));case".":return ut(e),V(),o=gt(),y(p.memberExpression(t,".",o));case":":return ut(e),V(),o=gt(),t=y(p.memberExpression(t,":",o)),ut(e),Et(t,r);case"(":case"{":return ut(e),Et(t,r)}else if(2===w.type)return ut(e),Et(t,r);return null}function Et(t,e){if(l===w.type)switch(w.value){case"(":o.emptyStatement||w.line!==x.line&&M(null,d.ambiguousSyntax,w.value),V();var r=[],n=bt(e);for(null!=n&&r.push(n);Z(",");)n=wt(e),r.push(n);return $(")"),y(p.callExpression(t,r));case"{":ct(),V();var i=vt(e);return y(p.tableCallExpression(t,i))}else if(2===w.type)return y(p.stringCallExpression(t,At(e)));I("function arguments",w)}function At(t){var n,o=w.value,i=w.type;if(ot&&(n=at()),i!==h||t.allowVararg||M(w,d.cannotUseVararg,w.value),466&i){ut(n);var a=e.slice(w.range[0],w.range[1]);return V(),y(p.literal(i,o,a))}return 4===i&&"function"===o?(ut(n),V(),r.scope&&J(),mt(null)):Z("{")?(ut(n),vt(t)):void 0}st.prototype.complete=function(){r.locations&&(this.loc.end.line=x.lastLine||x.line,this.loc.end.column=x.range[1]-(x.lastLineStart||x.lineStart)),r.ranges&&(this.range[1]=x.range[1])},st.prototype.bless=function(t){if(this.loc){var e=this.loc;t.loc={start:{line:e.start.line,column:e.start.column},end:{line:e.end.line,column:e.end.column}}}this.range&&(t.range=[this.range[0],this.range[1]])},lt.prototype.isInLoop=function(){for(var t=this.scopes.length;t-- >0;)if(this.scopes[t].isLoop)return!0;return!1},lt.prototype.pushScope=function(t){var e={labels:{},locals:[],deferredGotos:[],isLoop:!!t};this.scopes.push(e)},lt.prototype.popScope=function(){for(var t=0;t<this.pendingGotos.length;++t){var e=this.pendingGotos[t];e.maxDepth>=this.scopes.length&&--e.maxDepth<=0&&M(e.token,d.labelNotVisible,e.target)}this.scopes.pop()},lt.prototype.addGoto=function(t,e){for(var r=[],n=0;n<this.scopes.length;++n){var o=this.scopes[n];if(r.push(o.locals.length),Object.prototype.hasOwnProperty.call(o.labels,t))return}this.pendingGotos.push({maxDepth:this.scopes.length,target:t,token:e,localCounts:r})},lt.prototype.addLabel=function(t,e){var r=this.currentScope();if(Object.prototype.hasOwnProperty.call(r.labels,t))M(e,d.labelAlreadyDefined,t,r.labels[t].line);else{for(var n=[],o=0;o<this.pendingGotos.length;++o){var i=this.pendingGotos[o];i.maxDepth>=this.scopes.length&&i.target===t?i.localCounts[this.scopes.length-1]<r.locals.length&&r.deferredGotos.push(i):n.push(i)}this.pendingGotos=n}r.labels[t]={localCount:r.locals.length,line:e.line}},lt.prototype.addLocal=function(t,e){this.currentScope().locals.push({name:t,token:e})},lt.prototype.currentScope=function(){return this.scopes[this.scopes.length-1]},lt.prototype.raiseDeferredErrors=function(){for(var t=this.currentScope(),e=t.deferredGotos,r=0;r<e.length;++r){var n=e[r];M(n.token,d.gotoJumpInLocalScope,n.target,t.locals[n.localCounts[this.scopes.length-1]].name)}},ft.prototype.isInLoop=function(){return!!this.loopLevels.length},ft.prototype.pushScope=function(t){++this.level,t&&this.loopLevels.push(this.level)},ft.prototype.popScope=function(){var t=this.loopLevels,e=t.length;e&&t[e-1]===this.level&&t.pop(),--this.level},ft.prototype.addGoto=ft.prototype.addLabel=function(){throw new Error("This should never happen")},ft.prototype.addLocal=ft.prototype.raiseDeferredErrors=function(){},t.parse=function(s,c){if(void 0===c&&"object"==typeof s&&(c=s,s=void 0),c||(c={}),e=s||"",r=T({},a,c),b=0,A=1,S=0,n=e.length,L=[[]],O=0,P=[],it=[],!Object.prototype.hasOwnProperty.call(St,r.luaVersion))throw new Error(v("Lua version '%1' not supported",r.luaVersion));if(o=T({},St[r.luaVersion]),void 0!==r.extendedIdentifiers&&(o.extendedIdentifiers=!!r.extendedIdentifiers),!Object.prototype.hasOwnProperty.call(u,r.encodingMode))throw new Error(v("Encoding mode '%1' not supported",r.encodingMode));return i=u[r.encodingMode],r.comments&&(k=[]),r.wait?t:Ot()};var St={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 Lt(r){return e+=String(r),n=e.length,t}function Ot(t){void 0!==t&&Lt(t),e&&"#!"===e.substr(0,2)&&(e=e.replace(/^.*/,(function(t){return t.replace(/./g," ")}))),n=e.length,ot=r.locations||r.ranges,_=z();var o=function(){V(),ct(),r.scope&&J();var t=ht();t.allowVararg=!0,t.pushScope();var e=dt(t);return t.popScope(),r.scope&&Q(),1!==w.type&&B(w),ot&&!e.length&&(x=w),y(p.chunk(e))}();if(r.comments&&(o.comments=k),r.scope&&(o.globals=P),it.length>0)throw new Error("Location tracking failed. This is most likely a bug in luaparse");return o}t.write=Lt,t.end=Ot}))},2703:(t,e,r)=>{"use strict";var n=r(414);function o(){}function i(){}i.resetWarningCache=o,t.exports=function(){function t(t,e,r,o,i,a){if(a!==n){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var r={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:i,resetWarningCache:o};return r.PropTypes=r,r}},5697:(t,e,r)=>{t.exports=r(2703)()},414:t=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9921:(t,e)=>{"use strict";var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,i=r?Symbol.for("react.fragment"):60107,a=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,c=r?Symbol.for("react.provider"):60109,u=r?Symbol.for("react.context"):60110,l=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,h=r?Symbol.for("react.forward_ref"):60112,d=r?Symbol.for("react.suspense"):60113,p=r?Symbol.for("react.suspense_list"):60120,y=r?Symbol.for("react.memo"):60115,g=r?Symbol.for("react.lazy"):60116,m=r?Symbol.for("react.block"):60121,v=r?Symbol.for("react.fundamental"):60117,b=r?Symbol.for("react.responder"):60118,w=r?Symbol.for("react.scope"):60119;function x(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case n:switch(t=t.type){case l:case f:case i:case s:case a:case d:return t;default:switch(t=t&&t.$$typeof){case u:case h:case g:case y:case c:return t;default:return e}}case o:return e}}}function _(t){return x(t)===f}e.AsyncMode=l,e.ConcurrentMode=f,e.ContextConsumer=u,e.ContextProvider=c,e.Element=n,e.ForwardRef=h,e.Fragment=i,e.Lazy=g,e.Memo=y,e.Portal=o,e.Profiler=s,e.StrictMode=a,e.Suspense=d,e.isAsyncMode=function(t){return _(t)||x(t)===l},e.isConcurrentMode=_,e.isContextConsumer=function(t){return x(t)===u},e.isContextProvider=function(t){return x(t)===c},e.isElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===n},e.isForwardRef=function(t){return x(t)===h},e.isFragment=function(t){return x(t)===i},e.isLazy=function(t){return x(t)===g},e.isMemo=function(t){return x(t)===y},e.isPortal=function(t){return x(t)===o},e.isProfiler=function(t){return x(t)===s},e.isStrictMode=function(t){return x(t)===a},e.isSuspense=function(t){return x(t)===d},e.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===i||t===f||t===s||t===a||t===d||t===p||"object"==typeof t&&null!==t&&(t.$$typeof===g||t.$$typeof===y||t.$$typeof===c||t.$$typeof===u||t.$$typeof===h||t.$$typeof===v||t.$$typeof===b||t.$$typeof===w||t.$$typeof===m)},e.typeOf=x},9864:(t,e,r)=>{"use strict";t.exports=r(9921)},3872:(t,e,r)=>{"use strict";r.d(e,{collect:()=>q});const n={currentComponent:null,isBatchUpdating:!1,isInBrowser:"undefined"!=typeof window,listeners:new Map,manualListeners:[],nextVersionMap:new WeakMap,proxyIsMuted:!1,redirectToNext:!0,store:{}},o=Symbol("PATH"),i=Symbol("ORIGINAL"),a="RR_DEBUG",s=t=>!!t&&"object"==typeof t&&t.constructor===Object,c=t=>Array.isArray(t),u=t=>t instanceof Map,l=t=>t instanceof Set,f=t=>s(t)||c(t)||u(t)||l(t),h=t=>t===o||"constructor"===t||"toJSON"===t||"@@toStringTag"===t||t===Symbol.toStringTag,d=t=>"function"==typeof t,p=t=>s(t)?Object.assign({},t):c(t)?t.slice():u(t)?new Map(t):l(t)?new Set(t):t,y=(t,e)=>u(t)?t.get(e):l(t)?e:(c(t),t[e]),g=(t,e,r)=>{if(s(t))t[e]=r;else if(c(t))t[e]=r;else if(u(t))t.set(e,r);else{if(!l(t))throw Error("Unexpected type");t.add(r)}},m=t=>{if(s(t))return Object.keys(t).length;if(c(t))return t.length;if(u(t)||l(t))return t.size;throw Error("Unexpected type")},v=(t,e)=>{const r=[],n=t=>{const o=e(t,r.slice()),i=void 0!==o?o:t,a=(t,e)=>{r.push(t);const o=n(e);r.pop(),g(i,t,o)};if(s(i))Object.entries(i).forEach((([t,e])=>{a(t,e)}));else if(c(i)||u(i))i.forEach(((t,e)=>{a(e,t)}));else if(l(i)){const t=Array.from(i);i.clear(),t.forEach((t=>{a(t,t)}))}return i};return n(t)},b=t=>{n.proxyIsMuted=!0;const e=t();return n.proxyIsMuted=!1,e},w=(t,e)=>t.map((t=>t.toString())).join(e),x=t=>w(t,"."),_=t=>w(t,"~~~"),k=(t,e)=>{const r=t[o]||[];return void 0===e?r:r.concat(e)},E=(t,e)=>x(k(t,e)),A=(t,e)=>{t&&Object.defineProperty(t,o,{value:e,writable:!0})},S=t=>t[o]||[],L="undefined"!=typeof window&&!!window.localStorage,O=(t,e)=>{if(L)try{const r="string"==typeof e?e:JSON.stringify(e);return localStorage.setItem(t,r)}catch(t){return}},P="on",T="off";let C=(t=>{if(!L)return;const e=localStorage.getItem("RR_DEBUG");if(!e)return e;try{return JSON.parse(e)}catch(t){return e}})()||T;C===P&&console.info("Recollect debugging is enabled. Type __RR__.debugOff() to turn it off.");const M=t=>{C===P&&t()},j=(t,e,r)=>{M((()=>{console.groupCollapsed(`GET: ${E(t,e)}`),console.info(`Component: <${n.currentComponent._name}>`),void 0!==r&&console.info("Value:",r),console.groupEnd()}))},I=(t,e,r)=>{M((()=>{console.groupCollapsed(`SET: ${E(t,e)}`),console.info("From:",y(t,e)),console.info("To: ",r),console.groupEnd()}))},B={},z=t=>B.UpdateNextStore(t),D=t=>{if(!n.currentComponent)return;const e=_(t),r=n.listeners.get(e)||new Set;r.add(n.currentComponent),n.listeners.set(e,r)},N=t=>{return new Proxy(t,u(e=t)||l(e)?{get(t,e){if(e===i)return t;let r=Reflect.get(t,e);if(d(r)&&(r=r.bind(t)),n.proxyIsMuted||h(e))return r;if(!n.currentComponent&&n.redirectToNext){const r=n.nextVersionMap.get(t);if(r)return Reflect.get(r,e)}return"set"===e?new Proxy(r,{apply:(r,n,[o,i])=>n.get(o)===i||z({target:n,prop:o,value:i,updater:(r,n)=>(I(t,e,n),Reflect.apply(r[e],r,[o,n]))})}):"add"===e?new Proxy(r,{apply:(r,n,[o])=>!!n.has(o)||z({target:n,notifyTarget:!0,value:o,updater:(r,n)=>(I(t,e,n),Reflect.apply(r[e],r,[n]))})}):"clear"===e||"delete"===e?new Proxy(r,{apply:(r,n,[o])=>!(!n.size||"delete"===e&&!n.has(o))&&z({target:n,notifyTarget:!0,updater:r=>(I(t,e),Reflect.apply(r[e],r,[o]))})}):n.currentComponent&&u(t)&&"get"===e?new Proxy(r,{apply:(e,r,n)=>(D(k(t,n[0])),Reflect.apply(e,r,n))}):r}}:{get(t,e){if(e===i)return t;const r=Reflect.get(t,e);if(n.proxyIsMuted||h(e))return r;if(((t,e)=>c(t)&&["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"].includes(e))(t,e))return new Proxy(r,{apply:(r,n,o)=>z({target:n,notifyTarget:!0,value:o,updater:(r,n)=>{I(t,e,n);const o=Reflect.apply(r[e],r,n),i=S(t);return v(r,((t,e)=>{f(t)&&A(t,[...i,...e])})),o}})});if(d(t[e]))return r;if(n.currentComponent)c(t)&&"length"===e||(j(t,e,r),D(k(t,e)));else if(n.redirectToNext){const r=n.nextVersionMap.get(t);if(r)return Reflect.get(r,e)}return r},has(t,e){const r=Reflect.has(t,e);if(n.proxyIsMuted||h(e))return r;if(n.currentComponent)c(t)||(j(t,e),D(k(t,e)));else{const r=n.nextVersionMap.get(t);if(r)return Reflect.has(r,e)}return r},ownKeys(t){const e=Reflect.ownKeys(t);if(n.proxyIsMuted)return e;if(n.currentComponent)j(t),D(S(t));else{const e=n.nextVersionMap.get(t);if(e)return Reflect.ownKeys(e)}return e},set:(t,e,r)=>n.proxyIsMuted?Reflect.set(t,e,r):t[e]===r||z({target:t,prop:e,value:r,updater:(r,n)=>(I(t,e,n),Reflect.set(r,e,n))}),deleteProperty:(t,e)=>n.proxyIsMuted?Reflect.deleteProperty(t,e):z({target:t,prop:e,notifyTarget:!0,updater:r=>(((t,e)=>{M((()=>{console.groupCollapsed(`DELETE: ${E(t,e)}`),console.info("Property: ",E(t,e)),console.groupEnd()}))})(t,e),Reflect.deleteProperty(r,e))})});var e};var R=r(5156);const F=r.n(R)().unstable_batchedUpdates||(t=>{t()}),U={components:new Map,changedPaths:new Set};var G;n.store=N({}),G=({target:t,prop:e,value:r,notifyTarget:o=!1,updater:a})=>b((()=>{let s;const c=S(t),u=k(t,e);let l=!1;const h=m(t);let d=r;return f(d)&&(d=v(r,((t,e)=>{if(!f(t))return t;const r=p(t);return A(r,[...u,...e]),N(r)}))),c.length?c.reduce(((e,r,o)=>{const u=y(e,r);let f=p(u);return A(f,S(u)),f=N(f),g(e,r,f),o===c.length-1&&(s=a(f,d),l=m(f)!==h,n.nextVersionMap.set(t[i]||t,f)),f}),n.store):(s=a(n.store,d),l=m(n.store)!==h),(t=>{const e=_(t),r=x(t);U.changedPaths.add(r),n.listeners.forEach(((t,n)=>{""!==e&&e!==n||t.forEach((t=>{const e=U.components.get(t)||new Set;e.add(r),U.components.set(t,e)}))})),n.isBatchUpdating||(F((()=>{U.components.forEach(((t,e)=>{((t,e)=>{M((()=>{console.groupCollapsed(`UPDATE: <${t._name}>`),console.info("Changed properties:",e),console.groupEnd()}))})(e,Array.from(t)),e.update()}))})),n.manualListeners.forEach((t=>t({changedProps:Array.from(U.changedPaths),renderedComponents:Array.from(U.components.keys()),store:n.store}))),U.components.clear(),U.changedPaths.clear())})(o||l?c:u),s})),B.UpdateNextStore=G;var W=r(9787),V=r.n(W),Z=r(8679),$=r.n(Z);const Y=[],K=()=>{n.isInBrowser&&(M((()=>{console.groupEnd()})),Y.pop(),n.currentComponent=Y[Y.length-1]||null)},H=()=>b((()=>{const t=Object.assign({},n.store);return n.nextVersionMap.set(t,n.store),N(t)})),q=t=>{const e=t.displayName||t.name||"NamelessComponent";class r extends V().PureComponent{constructor(){super(...arguments),this.state={store:H()},this._isMounted=!1,this._isMounting=!0,this._isRendering=!1,this._name=e}componentDidMount(){this._isMounted=!0,this._isMounting=!1,K(),this._isRendering=!1}componentDidUpdate(){K(),this._isRendering=!1}componentWillUnmount(){var t;t=this,n.listeners.forEach(((e,r)=>{const o=Array.from(e).filter((e=>e!==t));o.length?n.listeners.set(r,new Set(o)):n.listeners.delete(r)})),this._isMounted=!1}update(){(this._isMounted||this._isMounting)&&this.setState({store:H()})}render(){var e;this._isRendering||(e=this,n.isInBrowser&&(M((()=>{console.groupCollapsed(`RENDER: <${e._name}>`)})),n.currentComponent=e,Y.push(n.currentComponent)),this._isRendering=!0);const r=Object.assign(Object.assign({},this.props),{store:this.state.store});return V().createElement(t,Object.assign({},r))}}return r.displayName=`Collected(${e})`,$()(r,t)};let X;X=r(5697);const{store:J}=n;"undefined"!=typeof window&&("Proxy"in window?window.__RR__={debugOn:()=>{C=P,O(a,P)},debugOff:()=>{C=T,O(a,T)},internals:n}:console.warn("This browser doesn't support the Proxy object, which react-recollect needs. See https://caniuse.com/#search=proxy to find out which browsers do support it"))},5565:(t,e,r)=>{t.exports=r(3872)},3379:t=>{"use strict";var e=[];function r(t){for(var r=-1,n=0;n<e.length;n++)if(e[n].identifier===t){r=n;break}return r}function n(t,n){for(var i={},a=[],s=0;s<t.length;s++){var c=t[s],u=n.base?c[0]+n.base:c[0],l=i[u]||0,f="".concat(u," ").concat(l);i[u]=l+1;var h=r(f),d={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==h)e[h].references++,e[h].updater(d);else{var p=o(d,n);n.byIndex=s,e.splice(s,0,{identifier:f,updater:p,references:1})}a.push(f)}return a}function o(t,e){var r=e.domAPI(e);return r.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;r.update(t=e)}else r.remove()}}t.exports=function(t,o){var i=n(t=t||[],o=o||{});return function(t){t=t||[];for(var a=0;a<i.length;a++){var s=r(i[a]);e[s].references--}for(var c=n(t,o),u=0;u<i.length;u++){var l=r(i[u]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}i=c}}},569:t=>{"use strict";var e={};t.exports=function(t,r){var n=function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(r)}},9216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},6636:(t,e,r)=>{"use strict";t.exports=function(t){var e=r.nc;e&&t.setAttribute("nonce",e)}},7795:t=>{"use strict";t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(r){!function(t,e,r){var n="";r.supports&&(n+="@supports (".concat(r.supports,") {")),r.media&&(n+="@media ".concat(r.media," {"));var o=void 0!==r.layer;o&&(n+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),n+=r.css,o&&(n+="}"),r.media&&(n+="}"),r.supports&&(n+="}");var i=r.sourceMap;i&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,r)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},4589:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},4668:(t,e,r)=>{var n={"./animate.js":5019,"./changezone.js":4146,"./chat.js":6023,"./dance.js":3582,"./dialogue.js":3419,"./face.js":8463,"./greeting.js":3972,"./interact.js":1726,"./move.js":6481,"./patrol.js":955,"./prompt.js":5214,"./script.js":6027};function o(t){var e=i(t);return r(e)}function i(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=i,t.exports=o,o.id=4668},7996:(t,e,r)=>{var n={"./camera.js":8826,"./chat.js":3565,"./menu.js":48};function o(t){var e=i(t);return r(e)}function i(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=i,t.exports=o,o.id=7996},746:(t,e,r)=>{var n={"./cosmic/fs.js":7745,"./matrix/fs.js":5401,"./morning/fs.js":2628,"./neon/fs.js":471,"./sky/fs.js":8143,"./sunset/fs.js":8135};function o(t){return Promise.resolve().then((()=>{if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return r(n[t])}))}o.keys=()=>Object.keys(n),o.id=746,t.exports=o},4970:(t,e,r)=>{var n={"./cosmic/vs.js":5564,"./matrix/vs.js":488,"./morning/vs.js":939,"./neon/vs.js":202,"./sky/vs.js":6568,"./sunset/vs.js":8299};function o(t){return Promise.resolve().then((()=>{if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return r(n[t])}))}o.keys=()=>Object.keys(n),o.id=4970,t.exports=o},4016:t=>{function e(t){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}e.keys=()=>[],e.resolve=e,e.id=4016,t.exports=e},9787:e=>{"use strict";e.exports=t},5156:t=>{"use strict";t.exports=e}},n={};function o(t){var e=n[t];if(void 0!==e)return e.exports;var i=n[t]={id:t,loaded:!1,exports:{}};return r[t].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.e=()=>Promise.resolve(),o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),o.nc=void 0;var i={};return(()=>{"use strict";o.d(i,{default:()=>se});var t=o(9787),e=o.n(t),r=o(5565),n=o(5697),a=o.n(n),s=o(9124),c=o(5490);function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}function l(){l=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h={};function d(){}function p(){}function y(){}var g={};s(g,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(S([])));v&&v!==e&&r.call(v,o)&&(g=v);var b=y.prototype=d.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,a,s){var c=f(t[o],t,i);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==u(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,s(b,"constructor",y),s(y,"constructor",p),p.displayName=s(y,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,a,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),s(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),s(b,a,"Generator"),s(b,o,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function f(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function h(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){f(i,n,o,a,s,"next",t)}function s(t){f(i,n,o,a,s,"throw",t)}a(void 0)}))}}function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],a=!0,s=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){s=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}}(t,e)||function(t,e){if(t){if("string"==typeof t)return p(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function g(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?y(Object(r),!0).forEach((function(e){m(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function m(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var v=function(r){var n=r.width,o=r.height,i=r.SpritzProvider,a=r.class,u=r.zipData,f=(0,t.useRef)(),p=(0,t.useRef)(),y=(0,t.useRef)(),m=(0,t.useRef)(),v=(0,t.useRef)(),b=((0,t.useRef)(),(0,t.useRef)(),(0,t.useRef)(),(0,t.useRef)()),w=((0,t.useRef)(),(0,t.useRef)(),function(t){try{i&&i.onKeyEvent&&i.onKeyEvent(t)}catch(t){}}),x=function(t){try{var e=p.current;if(e&&void 0!==t.clientX){var r=e.getBoundingClientRect(),n=e.width/r.width,o=e.height/r.height,a=g(g({},t),{},{clientX:t.clientX,clientY:t.clientY,_canvasRect:r,_scaleX:n,_scaleY:o});i&&i.onTouchEvent&&i.onTouchEvent(a)}else i&&i.onTouchEvent&&i.onTouchEvent(t)}catch(t){}},_=null,k=d((0,t.useState)(!1),2),E=(k[0],k[1],d((0,t.useState)(!1),2)),A=E[0],S=(E[1],d((0,t.useState)(),2)),L=(S[0],S[1],d((0,t.useState)(),2)),O=(L[0],L[1],d((0,t.useState)({dynamicWidth:window.innerWidth,dynamicHeight:window.innerHeight}),2)),P=O[0],T=O[1],C=function(){T({dynamicWidth:window.innerWidth,dynamicHeight:window.innerHeight})};function M(){return j.apply(this,arguments)}function j(){return(j=h(l().mark((function t(){return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c.Ky.load();case 2:document.fonts.add(c.Ky);case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function I(t){document.body.addEventListener("touchstart",(function(e){e.target==t&&e.preventDefault()}),{passive:!1}),document.body.addEventListener("touchend",(function(e){e.target==t&&e.preventDefault()}),{passive:!1}),document.body.addEventListener("touchmove",(function(e){e.target==t&&e.preventDefault()}),{passive:!1})}(0,t.useEffect)(h(l().mark((function t(){var e,r,a,c,u;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return window.addEventListener("resize",C),e=f.current,r=p.current,a=v.current,c=y.current,u=m.current,_=new s.Z(e,r,a,c,u,n,o),t.next=9,M();case 9:return t.next=11,_.init(i);case 11:return _.render(),t.abrupt("return",(function(){I(e),I(c),I(r),window.removeEventListener("resize",C),_.close()}));case 13:case"end":return t.stop()}}),t)}))),[i]);var B=3*P.dynamicWidth/4>1080?1080:P.dynamicHeight,z=3*P.dynamicWidth/4>1080?B:B-200,D=P.dynamicWidth>1920?1920:P.dynamicWidth,N=P.dynamicWidth<=900;return e().createElement("div",{style:{marginLeft:"auto",marginRight:"auto"}},e().createElement("div",{style:{position:"relative",padding:"none",background:"var(--color-bg, #0a0a0f)",height:z+"px",width:D+"px"},onKeyDownCapture:function(t){return w(t.nativeEvent)},onKeyUpCapture:function(t){return w(t.nativeEvent)},tabIndex:0},e().createElement("div",{style:{display:A?"none":"block"}},e().createElement("canvas",{style:{position:"absolute",zIndex:1,top:0,left:0,width:"100%",height:"100%"},ref:f,width:D,height:z,className:a}),e().createElement("canvas",{style:{position:"absolute",zIndex:2,top:0,left:0,background:"none",width:"100%",height:"100%"},ref:p,width:D,height:z,className:a,onMouseUp:function(t){return x(t.nativeEvent)},onMouseDown:function(t){return x(t.nativeEvent)},onMouseMove:function(t){return x(t.nativeEvent)}}),e().createElement("canvas",{style:{display:"none"},ref:v,width:256,height:256}),e().createElement("canvas",{width:D,height:z,ref:b,style:{display:"none"}}))),e().createElement("div",{style:{width:D+"px",height:N?"200px":"1px",marginTop:N?"10px":"0px",position:"relative",overflow:"hidden"}},e().createElement("canvas",{style:{position:"absolute",zIndex:5,top:0,left:0,background:"none",width:"100%",height:"100%",display:N?"block":"none"},ref:y,width:D,height:200,className:a,onMouseUp:function(t){return x(t.nativeEvent)},onMouseDown:function(t){return x(t.nativeEvent)},onMouseMove:function(t){return x(t.nativeEvent)},onTouchMoveCapture:function(t){return x(t.nativeEvent)},onTouchCancelCapture:function(t){return x(t.nativeEvent)},onTouchStartCapture:function(t){return x(t.nativeEvent)},onTouchEndCapture:function(t){return x(t.nativeEvent)}})),e().createElement("div",null,e().createElement("input",{type:"file",ref:m,src:null!=u?u:null,hidden:!0})))};v.propTypes={width:a().number.isRequired,height:a().number.isRequired,SpritzProvider:a().object.isRequired,class:a().string.isRequired};const b=v;var w=o(3162),x=o(5733),_=o.n(x),k=o(4395),E=o(5867),A=o(7974),S=o(9010),L=o(679),O=o(6083);function P(t){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},P(t)}function T(){T=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==P(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function C(t,e,r){return C=M()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&j(o,r.prototype),o},C.apply(null,arguments)}function M(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function j(t,e){return j=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},j(t,e)}function I(t){return function(t){if(Array.isArray(t))return B(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return B(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?B(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function z(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function D(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){z(i,n,o,a,s,"next",t)}function s(t){z(i,n,o,a,s,"throw",t)}a(void 0)}))}}function N(t,e,r){return R.apply(this,arguments)}function R(){return R=D(T().mark((function t(e,r,n){var o,i,a,s,c,u=this,l=arguments;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=l.length>3&&void 0!==l[3]?l[3]:null,console.log("loading map...."),o&&console.log("[loadMap] Using heights data:",o.length,"rows"),i="string"==typeof e.sprites?e.sprites:e.sprites.map((function(t){var e;return{id:t.id,type:t.type,pos:C(S.OW,I(t.pos)),facing:k.Nm[t.facing],zones:null!==(e=t.zones)&&void 0!==e?e:null}})),a=e.scenes.map((function(t){return{id:t.id,actions:t.actions.map((function(t){return t.trigger?{trigger:t.trigger,scope:u}:{sprite:t.sprite,action:t.action,args:t.args,scope:u}})),scope:u}})),t.next=7,Promise.all(e.scripts.map(function(){var t=D(T().mark((function t(e){var r,o,i;return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,(r=n.file("triggers/".concat(e.trigger,".lua")))||(r=n.file("triggers/".concat(e.trigger,".pxs"))),t.next=5,r.async("string");case 5:return o=t.sent,console.log({msg:"lua script",luaScript:o}),i=function(t){var r,n=new O.Z(t.engine);return n.setScope({_this:t,zone:u,subject:t}),n.initLibrary(),n.run('print("hello world lua - zone")'),{id:e.id,trigger:(r=D(T().mark((function t(){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log("running actual trigger"),t.abrupt("return",n.run(o));case 2:case"end":return t.stop()}}),t)}))),function(){return r.apply(this,arguments)})}}.bind(u)(u),console.log({msg:"zone trigger Lua eval response",result:i}),t.abrupt("return",i);case 12:t.prev=12,t.t0=t.catch(0),console.error(t.t0);case 15:case"end":return t.stop()}}),t,null,[[0,12]])})));return function(e){return t.apply(this,arguments)}}()));case 7:return s=t.sent,c=e.objects.map((function(t){return{id:t.id,type:t.type,mtl:t.mtl,useScale:t.useScale?C(S.OW,I(t.useScale)):null,pos:t.pos?C(S.OW,I(t.pos)):null,rotation:t.rotation?C(S.OW,I(t.rotation)):null}})),t.abrupt("return",{bounds:e.bounds,tileset:e.tileset,cells:r,heights:o,sprites:i,scenes:a,scripts:s,objects:c,lights:e.lights,selectTrigger:e.selectTrigger});case 10:case"end":return t.stop()}}),t)}))),R.apply(this,arguments)}function F(t,e){if("string"==typeof t)return t;var r=[];return t.forEach((function(t,n){var o=t.length;t.forEach((function(t,i){r[n*o+i]=e[t]}))})),r}function U(t){return U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},U(t)}function G(t){return function(t){if(Array.isArray(t))return K(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Y(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function W(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function V(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?W(Object(r),!0).forEach((function(e){et(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):W(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Z(){Z=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==U(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function $(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Y(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function Y(t,e){if(t){if("string"==typeof t)return K(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?K(t,e):void 0}}function K(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function H(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function q(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){H(i,n,o,a,s,"next",t)}function s(t){H(i,n,o,a,s,"throw",t)}a(void 0)}))}}function X(t,e){return X=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},X(t,e)}function J(t,e){if(e&&("object"===U(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Q(t)}function Q(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function tt(t){return tt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},tt(t)}function et(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var rt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&X(t,e)}(a,t);var e,r,n,i=(r=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=tt(r);if(n){var o=tt(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return J(this,t)});function a(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),et(Q(r=i.call(this)),"getZoneData",(function(){return{id:r.id,objId:r.objId,scripts:r.scripts,data:r.data,objects:Object.keys(r.objectDict),sprites:Object.keys(r.spriteDict),selectedTiles:r.selectedTiles}})),et(Q(r),"afterTilesetAndActorsLoaded",(function(){var t;!r.loaded&&null!==(t=r.tileset)&&void 0!==t&&t.loaded&&r.spriteList.every((function(t){return t.loaded}))&&r.objectList.every((function(t){return t.loaded}))&&(r.loaded=!0,r.loadScripts(!0),r.onLoadActions.run())})),et(Q(r),"attachTilesetListeners",(function(){r.tileset.runWhenDefinitionLoaded(r.onTilesetDefinitionLoaded),r.tileset.runWhenLoaded(r.afterTilesetAndActorsLoaded)})),et(Q(r),"finalize",q(Z().mark((function t(){var e,n,o,i;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=$(r.spriteList);try{for(e.s();!(n=e.n()).done;)n.value.runWhenLoaded(r.afterTilesetAndActorsLoaded)}catch(t){e.e(t)}finally{e.f()}o=$(r.objectList);try{for(o.s();!(i=o.n()).done;)i.value.runWhenLoaded(r.afterTilesetAndActorsLoaded)}catch(t){o.e(t)}finally{o.f()}r.engine.networkManager.loadZone(r.id,Q(r));case 5:case"end":return t.stop()}}),t)})))),et(Q(r),"loadRemote",q(Z().mark((function t(){var e,n,o,i;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(E.Z.zoneRequestUrl(r.id));case 2:if((e=t.sent).ok){t.next=5;break}return t.abrupt("return");case 5:return t.prev=5,t.next=8,e.json();case 8:return i=t.sent,r.bounds=i.bounds,r.size=[i.bounds[2]-i.bounds[0],i.bounds[3]-i.bounds[1]],r.cells="function"==typeof i.cells?i.cells(r.bounds,Q(r)):i.cells,r.sprites="function"==typeof i.sprites?i.sprites(r.bounds,Q(r)):i.sprites||[],r.objects="function"==typeof i.objects?i.objects(r.bounds,Q(r)):i.objects||[],t.next=16,r.tsLoader.load(i.tileset,r.spritzName);case 16:return r.tileset=t.sent,r.attachTilesetListeners(),r.audioSrc&&(r.audio=r.engine.resourceManager.audioLoader.load(r.audioSrc,!0)),t.next=21,Promise.all([Promise.all(r.sprites.map(r.loadSprite)),Promise.all(r.objects.map(r.loadObject))]);case 21:if(!i.skyboxShader||null===(n=r.engine.renderManager)||void 0===n||null===(o=n.skyboxManager)||void 0===o||!o.setSkyboxShader){t.next=24;break}return t.next=24,r.engine.renderManager.skyboxManager.setSkyboxShader(i.skyboxShader);case 24:return t.next=26,r.finalize();case 26:if(t.prev=26,!i.mode){t.next=30;break}return t.next=30,r.loadMode(i.mode);case 30:t.next=35;break;case 32:t.prev=32,t.t0=t.catch(26),console.warn("zone mode load failed",t.t0);case 35:t.next=40;break;case 37:t.prev=37,t.t1=t.catch(5),console.error("Error parsing zone "+r.id,t.t1);case 40:case"end":return t.stop()}}),t,null,[[5,37],[26,32]])})))),et(Q(r),"load",q(Z().mark((function t(){var e,n,i;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,i=o(4016)("./"+r.spritzName+"/maps/"+r.id+"/map.js").default,Object.assign(Q(r),i),"function"==typeof r.cells&&(r.cells=r.cells(r.bounds,Q(r))),r.audioSrc&&(r.audio=r.engine.resourceManager.audioLoader.load(r.audioSrc,!0)),r.size=[r.bounds[2]-r.bounds[0],r.bounds[3]-r.bounds[1]],t.next=8,r.tsLoader.load(r.tileset,r.spritzName);case 8:return r.tileset=t.sent,r.attachTilesetListeners(),"function"==typeof r.sprites&&(r.sprites=r.sprites(r.bounds,Q(r))),r.sprites=r.sprites||[],r.objects=r.objects||[],t.next=15,Promise.all([Promise.all(r.sprites.map(r.loadSprite)),Promise.all(r.objects.map(r.loadObject))]);case 15:if(!i.skyboxShader||null===(e=r.engine.renderManager)||void 0===e||null===(n=e.skyboxManager)||void 0===n||!n.setSkyboxShader){t.next=18;break}return t.next=18,r.engine.renderManager.skyboxManager.setSkyboxShader(i.skyboxShader);case 18:return t.next=20,r.finalize();case 20:if(t.prev=20,!i.mode){t.next=24;break}return t.next=24,r.loadMode(i.mode);case 24:t.next=29;break;case 26:t.prev=26,t.t0=t.catch(20),console.warn("zone mode load failed",t.t0);case 29:try{r.engine.networkManager.joinZone(r.id)}catch(t){console.warn("Network Error :: could not send zone commend to server")}t.next=35;break;case 32:t.prev=32,t.t1=t.catch(0),console.error("Error parsing zone "+r.id,t.t1);case 35:case"end":return t.stop()}}),t,null,[[0,32],[20,26]])})))),et(Q(r),"loadTriggerFromZip",function(){var t=q(Z().mark((function t(e,n){var o,i,a,s,c,u,l,f,h,d;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,n.file("triggers/".concat(e,".lua"));case 3:if(!(o=t.sent)){t.next=9;break}return t.next=7,o.async("string");case 7:return i=t.sent,t.abrupt("return",(function(t,e){var n=new O.Z(t.engine);return n.setScope({_this:t,zone:Q(r),subject:e}),n.initLibrary(),n.run(i)}));case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(0),null!==(a=r.engine)&&void 0!==a&&a.debug&&console.warn("Lua trigger load failed",t.t0);case 14:return t.prev=14,t.next=17,n.file("triggers/".concat(e,".pxs"));case 17:if(!(s=t.sent)){t.next=23;break}return t.next=21,s.async("string");case 21:return c=t.sent,t.abrupt("return",(function(t,e){var n=new O.Z(t.engine);return n.setScope({_this:t,zone:Q(r),subject:e}),n.initLibrary(),n.run(c)}));case 23:t.next=28;break;case 25:t.prev=25,t.t1=t.catch(14),null!==(u=r.engine)&&void 0!==u&&u.debug&&console.warn("PixoScript trigger load failed",t.t1);case 28:return t.next=30,n.file("triggers/".concat(e,".js"));case 30:if(!(l=t.sent)){t.next=39;break}return t.next=34,l.async("string");case 34:if(f=t.sent,h=new Function("zone","engine","".concat(f,"; return (typeof module !== 'undefined' && module.exports) ? module.exports : (typeof exports !== 'undefined' ? exports : (typeof trigger === 'function' ? trigger : null));")),"function"!=typeof(d=h(Q(r),r.engine))){t.next=39;break}return t.abrupt("return",d.bind(Q(r),Q(r)));case 39:return t.abrupt("return",(function(){}));case 40:case"end":return t.stop()}}),t,null,[[0,11],[14,25]])})));return function(e,r){return t.apply(this,arguments)}}()),et(Q(r),"loadModeFromZip",function(){var t=q(Z().mark((function t(e,n){var o,i,a,s,c,u,l,f,h;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,console.log("Loading Game Mode From Zip"),o=n.file("modes/".concat(e,"/setup.lua")),i=n.file("modes/".concat(e,"/update.lua")),a=n.file("modes/".concat(e,"/teardown.lua")),s=r.world,(c=new O.Z(r.engine)).setScope({zone:Q(r),map:Q(r),_this:Q(r)}),c.initLibrary(),u={},!o){t.next=17;break}return t.next=13,o.async("string");case 13:return l=t.sent,console.log("Zone.loadModeFromZip: running setup.lua for mode",e),t.next=17,c.run(l);case 17:if(!i){t.next=22;break}return t.next=20,i.async("string");case 20:f=t.sent,u.update=function(){var t=q(Z().mark((function t(e,n){var o,i;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,(o=new O.Z(r.engine)).setScope({zone:Q(r),map:Q(r),_this:Q(r),time:e,params:n}),o.initLibrary(),t.next=6,o.run(f);case 6:"function"==typeof(i=t.sent)&&i(e,n),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),console.warn("mode update exec failed",t.t0);case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,r){return t.apply(this,arguments)}}();case 22:if(!a){t.next=27;break}return t.next=25,a.async("string");case 25:h=t.sent,u.teardown=function(){var t=q(Z().mark((function t(e){var n,o;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,(n=new O.Z(r.engine)).setScope({zone:Q(r)}),n.initLibrary(),t.next=6,n.run(h);case 6:"function"==typeof(o=t.sent)&&o(e),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),console.warn("mode teardown failed",t.t0);case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e){return t.apply(this,arguments)}}();case 27:s&&s.modeManager&&(s.modeManager.registered[e]||s.modeManager.register(e,u)),t.next=33;break;case 30:t.prev=30,t.t0=t.catch(0),console.warn("loadModeFromZip failed",e,t.t0);case 33:case"end":return t.stop()}}),t,null,[[0,30]])})));return function(e,r){return t.apply(this,arguments)}}()),et(Q(r),"loadMode",function(){var t=q(Z().mark((function t(e){var n;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,n=r.world,t.next=4,r.loadModeFromZip(e,n.spritz.zip);case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.warn("loadMode failed",e,t.t0);case 9:case"end":return t.stop()}}),t,null,[[0,6]])})));return function(e){return t.apply(this,arguments)}}()),et(Q(r),"loadZoneFromZip",function(){var t=q(Z().mark((function t(e,n,o){var i,a,s,c,u,l,f,h,d,p,y,g,m,v,b,w,x,_,E,A,S,L,O=arguments;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=O.length>3&&void 0!==O[3]&&O[3],t.prev=1,null===(a=e.extends)||void 0===a||!a.length){t.next=7;break}return c={},t.next=6,Promise.all(e.extends.map(function(){var t=q(Z().mark((function t(e){var r;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.file("maps/"+e+"/map.json").async("string");case 2:r=t.sent,c=(0,k.Ee)(c,JSON.parse(r));case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 6:e=Object.assign(c,V(V({},e),{},{extends:null}));case 7:if(null===(s=n.extends)||void 0===s||!s.length){t.next=12;break}return u=[],t.next=11,Promise.all(n.extends.map(function(){var t=q(Z().mark((function t(e){var r,n;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.file("maps/"+e+"/cells.json").async("string");case 2:r=t.sent,n=JSON.parse(r),u=u.concat(n.cells?n.cells:n);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 11:n=u.concat(n.cells||[]);case 12:if(l=null,t.prev=13,!(f=o.file("maps/"+r.id+"/heights.json"))){t.next=25;break}return t.next=18,f.async("string");case 18:y=t.sent,l=JSON.parse(y),console.log("[Zone] Loaded heights.json for ".concat(r.id,":"),null===(h=l)||void 0===h?void 0:h.length,"rows"),console.log("[Zone] First row heights:",null===(d=l)||void 0===d?void 0:d[0]),console.log("[Zone] Heights data sample:",JSON.stringify(null===(p=l)||void 0===p?void 0:p.slice(0,3))),t.next=26;break;case 25:console.log("[Zone] No heights.json found for ".concat(r.id,", using default geometry heights"));case 26:t.next=31;break;case 28:t.prev=28,t.t0=t.catch(13),console.warn("[Zone] Failed to load heights.json for ".concat(r.id,":"),t.t0.message);case 31:if(!e.menu){t.next=37;break}return g={},t.next=35,Promise.all(Object.keys(e.menu).map(function(){var t=q(Z().mark((function t(n){var i;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(i=V(V({},e.menu[n]),{},{id:n})).onOpen){t.next=5;break}return t.next=4,r.loadTriggerFromZip(i.onOpen,o);case 4:i.onOpen=t.sent.bind(Q(r),Q(r));case 5:if(!i.trigger){t.next=9;break}return t.next=8,r.loadTriggerFromZip(i.trigger,o);case 8:i.trigger=t.sent.bind(Q(r),Q(r));case 9:g[n]=i;case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 35:r.menus=g,r.world.startMenu(r.menus);case 37:return t.next=39,r.tsLoader.loadFromZip(o,e.tileset,r.spritzName);case 39:return m=t.sent,v=F(n,m.tiles),t.next=43,N.call(Q(r),e,v,o,l);case 43:if(b=t.sent,Object.assign(Q(r),b),"string"==typeof r.cells)try{w=new Function("bounds","zone","return (".concat(r.cells,")(bounds, zone);")),r.cells=w.call(Q(r),r.bounds,Q(r))}catch(t){console.error("error loading cell function",t)}if(e.mode)try{r.mode=e.mode}catch(t){console.error("audio load",t)}if(!e.audioSrc){t.next=57;break}return t.prev=48,t.next=51,r.engine.resourceManager.audioLoader.loadFromZip(o,e.audioSrc,!0);case 51:r.audio=t.sent,t.next=57;break;case 54:t.prev=54,t.t1=t.catch(48),console.error("audio load",t.t1);case 57:try{r.lights=null!==(x=e.lights)&&void 0!==x?x:[],_=r.engine.renderManager.lightManager,E=$(r.lights);try{for(E.s();!(A=E.n()).done;)S=A.value,_.addLight(S.id,S.pos,S.color,S.attenuation,S.direction,S.density,S.scatteringCoefficients,S.enabled)}catch(t){E.e(t)}finally{E.f()}}catch(t){console.error("lights",t)}if(r.tileset=m,r.size=[r.bounds[2]-r.bounds[0],r.bounds[3]-r.bounds[1]],"string"==typeof r.sprites)try{L=new Function("bounds","zone","return (".concat(r.sprites,")(bounds, zone);")),r.sprites=L.call(Q(r),r.bounds,Q(r))}catch(t){console.error("sprite fn",t)}return r.sprites=r.sprites||[],r.objects=r.objects||[],t.next=65,Promise.all([Promise.all(r.sprites.map((function(t){return r.loadSpriteFromZip(t,o,i)}))),Promise.all(r.objects.map((function(t){return r.loadObjectFromZip(t,o)})))]);case 65:if(r.attachTilesetListeners(),t.prev=66,!r.mode){t.next=70;break}return t.next=70,r.loadMode(r.mode);case 70:t.next=75;break;case 72:t.prev=72,t.t2=t.catch(66),console.warn("zone mode load failed",t.t2);case 75:return t.next=77,r.finalize();case 77:t.next=82;break;case 79:t.prev=79,t.t3=t.catch(1),console.error("Error parsing json zone "+r.id,t.t3);case 82:case"end":return t.stop()}}),t,null,[[1,79],[13,28],[48,54],[66,72]])})));return function(e,r,n){return t.apply(this,arguments)}}()),et(Q(r),"runWhenDeleted",(function(){var t,e=$(r.lights);try{for(e.s();!(t=e.n()).done;){var n=t.value;r.engine.renderManager.lightManager.removeLight(n.id)}}catch(t){e.e(t)}finally{e.f()}})),et(Q(r),"onTilesetDefinitionLoaded",(function(){var t=r.size[0],e=r.size[1],n=r.engine.renderManager,o=r.engine.gl;r.cellVertexPosBuf=Array.from({length:e},(function(){return new Array(t)})),r.cellVertexTexBuf=Array.from({length:e},(function(){return new Array(t)})),r.cellPickingId=Array.from({length:e},(function(){return new Array(t)})),r.walkability=new Uint16Array(t*e);for(var i=0,a=0;a<e;a++)for(var s=0;s<t;s++,i++){var c=r.cells[i],u=Math.floor(c.length/3),l=[],f=[],h=k.Nm.All,d=r.heights&&r.heights[a]&&"number"==typeof r.heights[a][s]?r.heights[a][s]:null;i<5&&console.log("[Zone.finalize] Cell [".concat(a,",").concat(s,"] heightOverride:"),d);for(var p=0;p<u;p++){var y=c[3*p],g=c[3*p+1],m=c[3*p+2];"number"!=typeof m&&(m=0);var v=[r.bounds[0]+s,r.bounds[1]+a,m];h&=r.tileset.getWalkability(y),l=l.concat(r.tileset.getTileVertices(y,v,d)),f=f.concat(r.tileset.getTileTexCoords(y,g))}c.length===3*u+1&&(h=c[3*u]),r.walkability[i]=h;var b=n.createBuffer(new Float32Array(l),o.STATIC_DRAW,3),w=n.createBuffer(new Float32Array(f),o.STATIC_DRAW,2);r.cellVertexPosBuf[a][s]=b,r.cellVertexTexBuf[a][s]=w,r.cellPickingId[a][s]=[(255&r.objId)/255,(255&a)/255,(255&s)/255,255]}})),et(Q(r),"loadScripts",(function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(console.log("[Zone.loadScripts] ENTRY - zone:",r.id,"refresh:",t,"isPaused:",r.world.isPaused,"scripts:",r.scripts.length),!r.world.isPaused){var e,n=Q(r),o=$(r.scripts);try{for(o.s();!(e=o.n()).done;){var i=e.value;if(console.log("[Zone.loadScripts] Checking script:",i.id,"isLoadSpritz:","load-spritz"===i.id,"refresh:",t),"load-spritz"===i.id&&t){console.log("[Zone.loadScripts] Calling load-spritz trigger for zone:",r.id);try{i.trigger.call(n)}catch(t){console.error("[Zone.loadScripts] Error calling load-spritz trigger:",t)}}}}catch(t){o.e(t)}finally{o.f()}}})),et(Q(r),"loadObject",function(){var t=q(Z().mark((function t(e){var n;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.zone=Q(r),r.objectDict[e.id]){t.next=8;break}return t.next=4,r.objectLoader.load(e,(function(t){return t.onLoad(t)}));case 4:n=t.sent,r.world.objectDict[e.id]=r.objectDict[e.id]=n,r.objectList.push(n),r.world.objectList.push(n);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),et(Q(r),"loadObjectFromZip",function(){var t=q(Z().mark((function t(e,n){var o;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.zone=Q(r),r.objectDict[e.id]){t.next=8;break}return t.next=4,r.objectLoader.loadFromZip(n,e,function(){var t=q(Z().mark((function t(e){return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.onLoadFromZip(e,n));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());case 4:o=t.sent,r.world.objectDict[e.id]=r.objectDict[e.id]=o,r.objectList.push(o),r.world.objectList.push(o);case 8:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),et(Q(r),"loadSprite",function(){var t=q(Z().mark((function t(e){var n;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.zone=Q(r),r.spriteDict[e.id]){t.next=8;break}return t.next=4,r.spriteLoader.load(e.type,r.spritzName,(function(t){return t.onLoad(e)}));case 4:n=t.sent,r.world.spriteDict[e.id]=r.spriteDict[e.id]=n,r.spriteList.push(n),r.world.spriteList.push(n);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),et(Q(r),"loadSpriteFromZip",function(){var t=q(Z().mark((function t(e,n){var o;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.zone=Q(r),r.spriteDict[e.id]){t.next=8;break}return t.next=4,r.spriteLoader.loadFromZip(n,e.type,r.spritzName,function(){var t=q(Z().mark((function t(r){return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",r.onLoadFromZip(e,n));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());case 4:o=t.sent,r.world.spriteDict[e.id]=r.spriteDict[e.id]=o,r.spriteList.push(o),r.world.spriteList.push(o);case 8:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),et(Q(r),"addSprite",(function(t){t.zone=Q(r),r.world.spriteDict[t.id]=r.spriteDict[t.id]=t,r.spriteList.push(t),r.world.spriteList.push(t)})),et(Q(r),"removeSprite",(function(t){var e=function(e){return e.id!==t||(e.removeAllActions(),!1)};r.spriteList=r.spriteList.filter(e),r.world.spriteList=r.world.spriteList.filter(e),delete r.spriteDict[t],delete r.world.spriteDict[t]})),et(Q(r),"removeAllSprites",(function(){var t,e=$(r.spriteList);try{for(e.s();!(t=e.n()).done;){var n=t.value;r.removeSprite(n.id)}}catch(t){e.e(t)}finally{e.f()}})),et(Q(r),"getSpriteById",(function(t){return r.spriteDict[t]})),et(Q(r),"addPortal",(function(t,e,n){var o;if(null===(o=r.portals)||void 0===o||!o.length)return t;var i=r.getHeight(e,n);if(0!==i)return t;var a;return r.portals.length>0&&((a=e*n%3==0?r.portals.shift():r.portals.pop()).pos=new S.OW(e,n,i),t.push(a)),t})),et(Q(r),"getHeight",(function(t,e){var n;if(!r.isInZone(t,e))return null!==(n=r.engine)&&void 0!==n&&n.debug&&console.error("Height out of bounds [".concat(t,", ").concat(e,"]")),0;for(var o=Math.floor(t),i=Math.floor(e),a=t-o,s=e-i,c=(i-r.bounds[1])*r.size[0]+(o-r.bounds[0]),u=r.cells[c],l=Math.floor(u.length/3),f=r.heights&&r.heights[i-r.bounds[1]]&&"number"==typeof r.heights[i-r.bounds[1]][o-r.bounds[0]]?r.heights[i-r.bounds[1]][o-r.bounds[0]]:null,h=function(t){var e=t[1][0]-t[0][0],r=t[1][1]-t[0][1],n=t[2][0]-t[0][0],o=t[2][1]-t[0][1],i=1/(e*o-r*n),c=i*o,u=-i*n,l=-i*r,f=i*e,h=a-t[0][0],d=s-t[0][1];return[h*c+d*u,h*l+d*f]},d=0;d<l;d++){var p=r.tileset.getTileWalkPoly(u[3*d]);if(p)for(var y="number"==typeof u[3*d+2]?u[3*d+2]:0,g=null!==f?f:0,m=0;m<p.length;m++){var v=h(p[m]),b=v[0]+v[1];if(v[0]>=0&&v[1]>=0&&b<=1){var w,x=p[m],_=y+g+(1-b)*x[0][2]+v[0]*x[1][2]+v[1]*x[2][2];return null!==(w=r.engine)&&void 0!==w&&w.debug&&(r.__getHeightLogCount=(r.__getHeightLogCount||0)+1,r.__getHeightLogCount<4&&console.log("[Zone.getHeight] sample (x=".concat(t,",y=").concat(e,") -> i=").concat(o,", j=").concat(i,", baseZ=").concat(y,", heightOffset=").concat(g,", uv=[").concat(v[0].toFixed(2),",").concat(v[1].toFixed(2),"], w=").concat(b.toFixed(2),", computed=").concat(_.toFixed(2)))),_}}}if(l>0){var k=r.tileset.getTileWalkPoly(u[0]);if(k&&k.length>0){var E,A="number"==typeof u[2]?u[2]:0,S=null!==f?f:0,L=k[0],O=A+S+(L[0][2]+L[1][2]+L[2][2])/3;return null!==(E=r.engine)&&void 0!==E&&E.debug&&console.log("[Zone.getHeight] walkPoly fallback for (".concat(t,",").concat(e,"), using avg of first tri = ").concat(O.toFixed(2))),O}}return("number"==typeof u[2]?u[2]:0)+(null!==f?f:0)})),et(Q(r),"drawRow",(function(t,e,n,o,i,a,s){r.tileset.texture.attach();for(var c=r.cellVertexPosBuf[t],u=r.cellVertexTexBuf[t],l=r.size[0],f=r.cellPickingId[t],h=0;h<l;h++){var d=c[h],p=u[h];o.bindBuffer(d,i.aVertexPosition),o.bindBuffer(p,i.aTextureCoord);var y=f[h];a.setMatrixUniforms({id:y}),i.setMatrixUniforms({id:y,isSelected:!!e&&e.has("".concat(t,",").concat(h)),sampler:1,colorMultiplier:n}),s.drawArrays(s.TRIANGLES,0,d.numItems),o.debug&&o.debug.tilesDrawn++}})),et(Q(r),"drawCell",(function(t,e){var n,o=r.engine.renderManager,i=r.engine.gl,a=o.shaderProgram,s=o.effectPrograms.picker,c=r.cellVertexPosBuf[t][e],u=r.cellVertexTexBuf[t][e];o.bindBuffer(c,a.aVertexPosition),o.bindBuffer(u,a.aTextureCoord);var l=r.cellPickingId[t][e];s.setMatrixUniforms({id:l}),a.setMatrixUniforms({id:l,isSelected:!(null===(n=r._selectedSet)||void 0===n||!n.has("".concat(t,",").concat(e))),sampler:1,colorMultiplier:r._highlight||[1,1,0,1]}),i.drawArrays(i.TRIANGLES,0,c.numItems)})),et(Q(r),"draw",(function(){if(r.loaded){var t=r.engine.renderManager,e=r.engine.gl,n=t.shaderProgram,o=t.effectPrograms.picker,i=r.selectedTiles;r.selectedSet=i&&i.length?new Set(i.map((function(t){return"".concat(t[0],",").concat(t[1])}))):null,r.highlight=8&r.engine.frameCount?[1,0,0,1]:[1,1,0,1];var a=function(t){for(var e=1;e<t.length;e++)if(t[e-1].pos.y>t[e].pos.y){t.sort((function(t,e){return t.pos.y-e.pos.y}));break}};a(r.spriteList),a(r.objectList),t.mvPushMatrix(),r.engine._freecamActive||t.camera.setCamera();var s=0,c=0;if("N"===r.engine.renderManager.camera.cameraDir||"NE"===r.engine.renderManager.camera.cameraDir||"NW"===r.engine.renderManager.camera.cameraDir||"E"===r.engine.renderManager.camera.cameraDir)for(var u=0;u<r.size[1];u++){for(r.drawRow(u,r.selectedSet,r.highlight,t,n,o,e);c<r.objectList.length&&r.objectList[c].pos.y-r.bounds[1]<=u;)r.objectList[c++].draw();for(;s<r.spriteList.length&&r.spriteList[s].pos.y-r.bounds[1]<=u;)r.spriteList[s++].draw(r.engine)}else for(var l=r.size[1]-1;l>=0;l--){for(r.drawRow(l,r.selectedSet,r.highlight,t,n,o,e);c<r.objectList.length&&r.bounds[1]-r.objectList[c].pos.y<=l;)r.objectList[c++].draw();for(;s<r.spriteList.length&&r.bounds[1]-r.spriteList[s].pos.y<=l;)r.spriteList[s++].draw(r.engine)}for(;c<r.objectList.length;)r.objectList[c++].draw();for(;s<r.spriteList.length;)r.spriteList[s++].draw(r.engine);t.mvPopMatrix()}})),et(Q(r),"tick",(function(t,e){if(r.loaded&&!e){r.checkInput(t);var n,o=$(r.spriteList);try{for(o.s();!(n=o.n()).done;)n.value.tickOuter(t)}catch(t){o.e(t)}finally{o.f()}}})),et(Q(r),"checkInput",function(){var t=q(Z().mark((function t(e){return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e<=r.lastKey+200)){t.next=2;break}return t.abrupt("return");case 2:r.engine.gamepad.checkInput(),r.lastKey=e;case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),et(Q(r),"isInZone",(function(t,e){return t>=r.bounds[0]&&e>=r.bounds[1]&&t<r.bounds[2]&&e<r.bounds[3]})),et(Q(r),"onSelect",function(){var t=q(Z().mark((function t(e,n){var o,i,a,s,c,u;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,null===(o=r.world)||void 0===o||!o.modeManager||!r.world.modeManager.handleSelect){t.next=8;break}return console.log("Running Custom Select Handler"),t.next=5,r.world.modeManager.handleSelect(Q(r),e,n,"tile");case 5:if(!t.sent){t.next=8;break}return t.abrupt("return");case 8:t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),console.warn("mode selection handler error",t.t0);case 13:if(i=!1,r.selectedTiles=r.selectedTiles.filter((function(t){var r=!(t[0]===e&&t[1]===n);return r||(i=!0),r})),!i){t.next=17;break}return t.abrupt("return");case 17:if(r.selectedTiles.push([e,n]),r.selectTrigger){t.next=20;break}return t.abrupt("return");case 20:if(t.prev=20,(a=r.engine.spritz.zip.file("triggers/".concat(r.selectTrigger,".lua")))||(a=r.engine.spritz.zip.file("triggers/".concat(r.selectTrigger,".pxs"))),a){t.next=25;break}throw new Error("No Lua Script Found");case 25:return t.next=27,a.async("string");case 27:return s=t.sent,(c=new O.Z(r.engine)).setScope({_this:Q(r),zone:Q(r),subject:new c.lua.Table([e,n])}),c.initLibrary(),t.next=33,c.run(s);case 33:return t.abrupt("return",t.sent);case 36:t.prev=36,t.t1=t.catch(20),null!==(u=r.engine)&&void 0!==u&&u.debug&&console.warn("select trigger missing",t.t1);case 39:case"end":return t.stop()}}),t,null,[[0,10],[20,36]])})));return function(e,r){return t.apply(this,arguments)}}()),et(Q(r),"isWalkable",(function(t,e,n){if(!r.isInZone(t,e))return null;for(var o in r.spriteDict){var i=r.spriteDict[o];if(i.pos.x===t&&i.pos.y===e){if(!i.walkable&&!i.blocking&&i.override)return!0;if(!i.walkable&&i.blocking)return!1}}for(var a in r.objectDict){var s=r.objectDict[a],c=s.pos.x-s.scale.x*(s.size.x/2),u=s.pos.y-s.scale.y*(s.size.y/2),l=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return n?t>=e&&t<=r:t>e&&t<r},f=l(t,c,s.pos.x,!0),h=l(e,u,s.pos.y,!0);if(!s.walkable&&f&&h&&!s.blocking&&s.override)return!0;if(!s.walkable&&(s.pos.x===t&&s.pos.y===e||f&&h)&&s.blocking)return!1}return 0!=(r.walkability[(e-r.bounds[1])*r.size[0]+(t-r.bounds[0])]&n)})),et(Q(r),"within",(function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return n?t>=e&&t<=r:t>e&&t<r})),et(Q(r),"triggerScript",(function(t){var e,n=$(r.scripts);try{for(n.s();!(e=n.n()).done;){var o=e.value;o.id===t&&r.runWhenLoaded(o.trigger.bind(Q(r)))}}catch(t){n.e(t)}finally{n.f()}})),et(Q(r),"moveSprite",function(){var t=q(Z().mark((function t(e,n){var o,i=arguments;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=i.length>2&&void 0!==i[2]&&i[2],t.abrupt("return",new Promise(function(){var t=q(Z().mark((function t(i){var a;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=r.getSpriteById(e),t.next=3,a.addAction(new L.aW(r.engine,"patrol",[a.pos.toArray(),n,o?200:600,Q(r)],a,i));case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 2:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),et(Q(r),"spriteDialogue",function(){var t=q(Z().mark((function t(e,n){var o,i=arguments;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=i.length>2&&void 0!==i[2]?i[2]:{autoclose:!0},t.abrupt("return",new Promise(function(){var t=q(Z().mark((function t(i){var a;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=r.getSpriteById(e),t.next=3,a.addAction(new L.aW(r.engine,"dialogue",[n,!1,o],a,i));case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 2:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),et(Q(r),"runActions",function(){var t=q(Z().mark((function t(e){var n,o,i,a,s;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Q(r),o=Promise.resolve(),i=$(e);try{for(s=function(){var t=a.value;o=o.then(q(Z().mark((function e(){var r,o,i,a;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:if(e.prev=2,t.scope=t.scope||n,!t.sprite){e.next=11;break}if(!(r=t.scope.getSpriteById(t.sprite))||!t.action){e.next=11;break}return o=G(t.args),i=o.pop(),e.next=11,r.addAction(new L.aW(n.engine,t.action,[].concat(G(o),[V({},i)]),r,(function(){})));case 11:if(!t.trigger){e.next=16;break}if(!(a=t.scope.getSpriteById("avatar"))){e.next=16;break}return e.next=16,a.addAction(new L.aW(n.engine,"script",[t.trigger,t.scope,function(){}],a));case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(2),console.warn("runActions error",(null===e.t0||void 0===e.t0?void 0:e.t0.message)||e.t0);case 21:case"end":return e.stop()}}),e,null,[[2,18]])}))))},i.s();!(a=i.n()).done;)s()}catch(t){i.e(t)}finally{i.f()}return t.abrupt("return",o.catch((function(t){var e;null!==(e=r.engine)&&void 0!==e&&e.debug&&console.warn("runActions chain",t)})));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),et(Q(r),"playCutScene",function(){var t=q(Z().mark((function t(e){var n,o,i,a,s,c=arguments;return Z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=c.length>1&&void 0!==c[1]?c[1]:null,o=n||r.spritz,i=$(o),t.prev=3,i.s();case 5:if((a=i.n()).done){t.next=21;break}if(s=a.value,t.prev=7,s.currentStep=s.currentStep||0,!(s.currentStep>o.length)){t.next=11;break}return t.abrupt("continue",19);case 11:if(s.id!==e){t.next=14;break}return t.next=14,r.runActions(s.actions);case 14:t.next=19;break;case 16:t.prev=16,t.t0=t.catch(7),console.error(t.t0);case 19:t.next=5;break;case 21:t.next=26;break;case 23:t.prev=23,t.t1=t.catch(3),i.e(t.t1);case 26:return t.prev=26,i.f(),t.finish(26);case 29:case"end":return t.stop()}}),t,null,[[3,23,26,29],[7,16]])})));return function(e){return t.apply(this,arguments)}}()),r.spritzName=e.id,r.id=t,r.objId=Math.round(100*Math.random()),r.world=e,r.data={},r.spriteDict=Object.create(null),r.spriteList=[],r.objectDict=Object.create(null),r.objectList=[],r.selectedTiles=[],r.lights=[],r.spritz=[],r.scripts=r.scripts||[],r.lastKey=0,r.engine=e.engine,r.onLoadActions=new A.Z,r.spriteLoader=new L.jf(e.engine),r.objectLoader=new L.Gq(e.engine),r.EventLoader=L.q1,r.tsLoader=new L.e5(e.engine),r.audio=null,r._selectedSet=null,r._highlight=null,r}return e=a,Object.defineProperty(e,"prototype",{writable:!1}),e}(o(5849).Z),nt=o(1248),ot=o(2737);function it(t){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(t)}function at(t){return function(t){if(Array.isArray(t))return st(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return st(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?st(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function st(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ct(){ct=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==it(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function ut(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function lt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){ut(i,n,o,a,s,"next",t)}function s(t){ut(i,n,o,a,s,"throw",t)}a(void 0)}))}}function ft(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ht(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function dt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var pt=function(){function t(e,r){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),dt(this,"createAvatar",(function(t){var e=n.zoneContaining(t.x,t.y);if(e){var r=new ot.Z(n.engine);return r.onLoad(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ft(Object(r),!0).forEach((function(e){dt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ft(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({zone:e,id:t.id,pos:new S.OW(t.x,t.y)},t)),e.addSprite(r),r}return null})),dt(this,"removeAvatar",(function(t){var e=t.zone;e&&e.removeSprite(t)})),dt(this,"getAvatar",(function(){return n.spriteDict.avatar})),dt(this,"runAfterTick",(function(t){n.afterTickActions.add(t)})),dt(this,"sortZones",(function(){n.zoneList.sort((function(t,e){return t.bounds[1]-e.bounds[1]}))})),dt(this,"loadZoneFromZip",function(){var t=lt(ct().mark((function t(e,r){var o,i,a,s,c,u,l,f,h,d,p,y,g,m,v,b,w,x,_=arguments;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=_.length>2&&void 0!==_[2]&&_[2],i=_.length>3&&void 0!==_[3]?_[3]:{effect:"cross",duration:500},o||!n.zoneDict[e]){t.next=4;break}return t.abrupt("return",n.zoneDict[e]);case 4:if(a=n.engine,s=!1,i&&null!=a&&a.renderManager&&(c=a.renderManager,u="undefined"!=typeof performance?performance.now():Date.now(),l=u-(c.transitionStartTime+c.transitionDuration),!c.isTransitioning&&l>100&&(s=!0)),!s){t.next=11;break}return f=i.effect,h=void 0===f?"cross":f,d=i.duration,p=void 0===d?500:d,t.next=11,a.renderManager.startTransition({effect:h,direction:"out",duration:p});case 11:return console.log("Loading Zone from Zip:",e),t.t0=JSON,t.next=15,r.file("maps/"+e+"/map.json").async("string");case 15:return t.t1=t.sent,y=t.t0.parse.call(t.t0,t.t1),t.t2=JSON,t.next=20,r.file("maps/"+e+"/cells.json").async("string");case 20:return t.t3=t.sent,g=t.t2.parse.call(t.t2,t.t3),m=new rt(e,n),t.next=25,m.loadZoneFromZip(y,g,r);case 25:if(n.zoneList.map((function(t){t.audio&&t.audio.pauseAudio()})),m.audio&&m.audio.playAudio(),n.zoneDict[e]=m,n.zoneList.push(m),m.runWhenLoaded(n.sortZones),!s){t.next=34;break}return v=i.effect,b=void 0===v?"cross":v,w=i.duration,x=void 0===w?500:w,t.next=34,a.renderManager.startTransition({effect:b,direction:"in",duration:x});case 34:return t.abrupt("return",m);case 35:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),dt(this,"loadZone",function(){var t=lt(ct().mark((function t(e){var r,o,i,a,s,c,u,l,f,h,d,p,y,g,m,v,b,w=arguments;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=w.length>1&&void 0!==w[1]&&w[1],o=w.length>2&&void 0!==w[2]&&w[2],i=w.length>3&&void 0!==w[3]?w[3]:{effect:"cross",duration:500},o||!n.zoneDict[e]){t.next=5;break}return t.abrupt("return",n.zoneDict[e]);case 5:if(a=n.engine,s=!1,i&&null!=a&&a.renderManager&&(c=a.renderManager,u="undefined"!=typeof performance?performance.now():Date.now(),l=u-(c.transitionStartTime+c.transitionDuration),!c.isTransitioning&&l>100&&(s=!0)),!s){t.next=12;break}return f=i.effect,h=void 0===f?"cross":f,d=i.duration,p=void 0===d?500:d,t.next=12,a.renderManager.startTransition({effect:h,direction:"out",duration:p});case 12:if(y=new rt(e,n),!r){t.next=18;break}return t.next=16,y.loadRemote();case 16:t.next=20;break;case 18:return t.next=20,y.load();case 20:if(n.zoneList.map((function(t){t.audio&&t.audio.pauseAudio()})),y.audio&&(console.log(y.audio),y.audio.playAudio()),n.zoneDict[e]=y,n.zoneList.push(y),y.runWhenLoaded(n.sortZones),!s){t.next=29;break}return g=i.effect,m=void 0===g?"cross":g,v=i.duration,b=void 0===v?500:v,t.next=29,a.renderManager.startTransition({effect:m,direction:"in",duration:b});case 29:return t.abrupt("return",y);case 30:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),dt(this,"removeZone",(function(t){n.zoneList=n.zoneList.filter((function(e){if(e.id!==t)return!0;e.audio&&e.audio.pauseAudio(),e.removeAllSprites(),e.runWhenDeleted()})),delete n.zoneDict[t]})),dt(this,"removeAllZones",(function(){n.zoneList.map((function(t){t.audio&&t.audio.pauseAudio(),t.removeAllSprites(),t.runWhenDeleted()})),n.zoneList=[],n.zoneDict={}})),dt(this,"tick",(function(t){for(var e in n.zoneDict){var r;null===(r=n.zoneDict[e])||void 0===r||r.tick(t,n.isPaused)}n.afterTickActions.run(t)})),dt(this,"checkInput",(function(t){if(t>n.lastKey+200){if(n.lastKey=t,n.modeManager&&n.modeManager.handleInput)try{if(n.modeManager.handleInput(t))return}catch(t){console.warn("mode input handler error",t)}var e=n.engine.gamepad.checkInput();n.engine.gamepad.keyPressed("start")&&(e.start=0),n.engine.gamepad.keyPressed("select")&&(e.select=0,n.engine.toggleFullscreen())}})),dt(this,"startMenu",(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["start"];n.addEvent(new L.q1(n.engine,"menu",[null!=t?t:n.menuConfig,e,!1,{autoclose:!1,closeOnEnter:!0}],n))})),dt(this,"addEvent",(function(t){n.eventDict[t.id]&&n.removeAction(t.id),n.eventDict[t.id]=t,n.eventList.push(t)})),dt(this,"removeAction",(function(t){n.eventList=n.eventList.filter((function(e){return e.id!==t})),delete n.eventDict[t]})),dt(this,"removeAllActions",(function(){n.eventList=[],n.eventDict={}})),dt(this,"tickOuter",(function(t){n.checkInput(t),n.eventList.sort((function(t,e){var r=t.startTime-e.startTime;return r?t.id>e.id?1:-1:r}));var e=[];if(n.eventList.forEach((function(r){!r.loaded||r.startTime>t||r.pausable&&n.isPaused||r.tick(t)&&(e.push(r),r.onComplete())})),e.forEach((function(t){return n.removeAction(t.id)})),n.tick&&!n.isPaused&&n.tick(t),!n.isPaused&&n.modeManager&&n.modeManager.update)try{n.modeManager.update(t)}catch(t){console.warn("mode update error",t)}})),dt(this,"draw",(function(){for(var t in n.zoneDict)n.zoneDict[t].draw(n.engine)})),dt(this,"zoneContaining",(function(t,e){for(var r in n.zoneDict){var o=n.zoneDict[r];if(o.loaded&&o.isInZone(t,e))return o}return null})),dt(this,"pathFind",(function(t,e){var r=[],o=!1,i=n,a=t[0],s=t[1];function c(t,n){var a=JSON.stringify([t[0],t[1]]);return!o&&(t[0]==e[0]&&t[1]==e[1]?(o=!0,i.canWalk(t,a,r)?[o,[].concat(at(n),[e])]:[o,at(n)]):!!i.canWalk(t,a,r)&&(r.push(a),i.getNeighbours.apply(i,at(t)).sort((function(t,r){return Math.min(Math.abs(e[0]-t[0])-Math.abs(e[0]-r[0]),Math.abs(e[1]-t[1])-Math.abs(e[1]-r[1]))})).map((function(e){return c(e,[].concat(at(n),[[t[0],t[1],600]]))})).filter((function(t){return t})).flat()))}return i.getNeighbours(a,s).sort((function(t,r){return Math.min(Math.abs(e[0]-t[0])-Math.abs(e[0]-r[0]),Math.abs(e[1]-t[1])-Math.abs(e[1]-r[1]))})).map((function(e){return c(e,[[t[0],t[1],600]])})).filter((function(t){return t[0]})).flat()})),dt(this,"getZoneById",(function(t){return n.zoneDict[t]})),dt(this,"getNeighbours",(function(t,e){var r=[t,e+1,k.Nm.Up],n=[t,e-1,k.Nm.Down];return[r,[t-1,e,k.Nm.Left],[t+1,e,k.Nm.Right],n]})),dt(this,"canWalk",(function(t,e,r){var o=n.zoneContaining.apply(n,at(t));return!(r.indexOf(e)>=0||!o||!o.isWalkable.apply(o,at(t))||!o.isWalkable(t[0],t[1],k.Nm.reverse(t[2])))})),this.id=r,this.spritz=e,this.objId=Math.round(1e3*Math.random())+1,this.engine=e.engine,this.zoneDict={},this.zoneList=[],this.remoteAvatars=new Map,this.spriteDict={},this.spriteList=[],this.objectDict={},this.objectList=[],this.tilesetDict={},this.tilesetList=[],this.eventList=[],this.eventDict={},this.lastKey=(new Date).getTime(),this.lastZoneTransitionTime=0,this.isPaused=!0,this.modeManager=new nt.Z(this),this.afterTickActions=new A.Z,this.menuConfig={start:{onOpen:function(t){t.completed=!0}}}}var e,r;return e=t,(r=[{key:"addRemoteAvatar",value:function(t,e){try{var r,n,o,i,a,s,c,u;if(this.remoteAvatars.has(t)){var l=this.remoteAvatars.get(t);try{console.log("Remote avatar for ".concat(t," already exists, updating instead"))}catch(t){}return null!=e.x&&(l.pos.x=e.x),null!=e.y&&(l.pos.y=e.y),null!=e.z&&(l.pos.z=e.z),null!=e.facing&&(l.facing=e.facing),l}var f=new ot.Z(this.engine),h=this.getAvatar();h?(f.src=h.src,f.portraitSrc=h.portraitSrc,f.sheetSize=h.sheetSize,f.tileSize=h.tileSize,f.frames=h.frames,f.hotspotOffset=h.hotspotOffset,f.drawOffset=h.drawOffset,f.enableSpeech=h.enableSpeech,f.bindCamera=!1,h.texture&&(f.texture=h.texture),h.vertexTexBuf&&(f.vertexTexBuf=h.vertexTexBuf),h.vertexPosBuf&&(f.vertexPosBuf=h.vertexPosBuf),h.speech&&h.speechTexBuf&&(f.speech=h.speech,f.speechTexBuf=h.speechTexBuf),f.loaded=!0,f.templateLoaded=!0):console.warn("No local avatar template found; remote avatar may not render correctly");var d=e.id||"player",p="".concat(d,"-").concat(t),y=this.getZoneById(e.zone||e.zoneId)||this.zoneContaining(e.x||0,e.y||0);f.zone=y,f.id=p;var g=null!==(r=null!==(n=e.x)&&void 0!==n?n:e.pos&&e.pos.x)&&void 0!==r?r:0,m=null!==(o=null!==(i=e.y)&&void 0!==i?i:e.pos&&e.pos.y)&&void 0!==o?o:0,v=g+(null!==(a=null===(s=f.hotspotOffset)||void 0===s?void 0:s.x)&&void 0!==a?a:0),b=m+(null!==(c=null===(u=f.hotspotOffset)||void 0===u?void 0:u.y)&&void 0!==c?c:0),w="number"==typeof e.z?e.z:e.pos&&"number"==typeof e.pos.z?e.pos.z:y?y.getHeight(v,b):0;f.pos=new S.OW(g,m,w),f.facing=e.facing||0,f.isSelected=!1;var x=y&&y.tileset&&y.tileset.tileSize?y.tileset.tileSize:32,_=[f.tileSize[0]/x,f.tileSize[1]/x],k=[[0,0,0],[_[0],0,0],[_[0],0,_[1]],[0,0,_[1]]],E=[[k[2],k[3],k[0]],[k[2],k[0],k[1]]].flat(3);f.vertexPosBuf=this.engine.renderManager.createBuffer(E,this.engine.gl.STATIC_DRAW,3);var A=f.getTexCoords();f.vertexTexBuf=this.engine.renderManager.createBuffer(A,this.engine.gl.DYNAMIC_DRAW,2),f.enableSpeech&&(f.speechVerBuf=this.engine.renderManager.createBuffer(f.getSpeechBubbleVertices(),this.engine.gl.STATIC_DRAW,3),f.speechTexBuf=this.engine.renderManager.createBuffer(f.getSpeechBubbleTexture(),this.engine.gl.DYNAMIC_DRAW,2)),y&&(y.spriteDict||(y.spriteDict={}),y.spriteList||(y.spriteList=[]),this.spriteDict[f.id]=f,y.spriteDict[f.id]=f,y.spriteList.includes(f)||y.spriteList.push(f),this.spriteList.includes(f)||this.spriteList.push(f),console.log("Added remote avatar for client ".concat(t," as sprite '").concat(f.id,"' to zone ").concat(y.id," at (").concat(f.pos.x,",").concat(f.pos.y,",").concat(f.pos.z,")"))),this.remoteAvatars.set(t,f);try{console.log("Remote avatar map now has ".concat(this.remoteAvatars.size," entries"))}catch(t){}return f}catch(t){return console.warn("Failed to add remote avatar",t),null}}},{key:"removeRemoteAvatar",value:function(t){var e=this.remoteAvatars.get(t);if(e){try{if(e.zone){var r=e.id||(e.objId?e.objId:null);r?e.zone.removeSprite(r):e.zone.removeSprite(e)}}catch(t){try{e.zone&&e.zone.removeSprite(e)}catch(t){}}this.remoteAvatars.delete(t)}}},{key:"updateRemoteAvatar",value:function(t,e){var r=this.remoteAvatars.get(t);if(r){try{var n,o,i,a;console.log("updateRemoteAvatar: client=".concat(t," pre pos=").concat(null===(n=r.pos)||void 0===n?void 0:n.x,",").concat(null===(o=r.pos)||void 0===o?void 0:o.y,",").concat(null===(i=r.pos)||void 0===i?void 0:i.z," loaded=").concat(r.loaded," id=").concat(r.id," zone=").concat(null===(a=r.zone)||void 0===a?void 0:a.id))}catch(t){}"function"==typeof r.setPosition?r.setPosition(e.x,e.y,e.z):r.pos&&(r.pos.x=e.x,r.pos.y=e.y,r.pos.z=e.z||r.pos.z),"function"==typeof r.updateState?r.updateState(e):(null!=e.facing&&(r.facing=e.facing),null!=e.animFrame&&(r.animFrame=e.animFrame)),r.loaded||(console.warn("Remote avatar ".concat(t," was not loaded; forcing loaded=true so renderer will attempt to draw.")),r.loaded=!0,r.templateLoaded=!0,r.texture&&"function"==typeof r.texture.attach||(r.texture={loaded:!0,attach:function(){}}));try{var s,c,u,l;console.log("updateRemoteAvatar: client=".concat(t," post pos=").concat(null===(s=r.pos)||void 0===s?void 0:s.x,",").concat(null===(c=r.pos)||void 0===c?void 0:c.y,",").concat(null===(u=r.pos)||void 0===u?void 0:u.z," loaded=").concat(r.loaded," id=").concat(r.id," zone=").concat(null===(l=r.zone)||void 0===l?void 0:l.id))}catch(t){}return r}return null}},{key:"applyRemoteAction",value:function(t,e,r,n){var o=this.remoteAvatars.get(t);o&&o.performAction(e,r)}}])&&ht(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function yt(t){return yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(t)}function gt(){gt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==yt(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function mt(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function vt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){mt(i,n,o,a,s,"next",t)}function s(t){mt(i,n,o,a,s,"throw",t)}a(void 0)}))}}function bt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function wt(t,e,r){return e&&bt(t.prototype,e),r&&bt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function xt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var _t=wt((function t(){var e=this;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),xt(this,"init",function(){var r=vt(gt().mark((function r(n){var o;return gt().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:t._instance.engine=n,(o=t._instance.world=new pt(t._instance,"spritz")).zoneList.forEach((function(t){return t.runWhenLoaded((function(){return console.log("loading...done")}))})),o.startMenu({start:{text:"Start Game",prompt:"Please press the button to start...",x:n.screenSize().width/2-75,y:n.screenSize().height/2-50,w:150,h:75,quittable:!1,colours:{top:"#333",bottom:"#777",background:"#999"},onOpen:function(t){e.isPaused=!0},trigger:function(t){t.world.isPaused=!1,t.completed=!0}}});case 4:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}()),xt(this,"loadSpritzManifest",function(){var t=vt(gt().mark((function t(e){return gt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),xt(this,"loadAvatar",function(){var t=vt(gt().mark((function t(e,r){return gt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),xt(this,"exportAvatar",vt(gt().mark((function t(){var e,r,n;return gt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=new x,r={},e.folder("pixos").file("avatar.json",JSON.stringify(r)),t.next=5,e.generateAsync({type:"blob"});case 5:n=t.sent,(0,w.saveAs)(n,"avatar.zip");case 7:case"end":return t.stop()}}),t)})))),xt(this,"update",(function(e){t._instance.world.tickOuter(e)})),xt(this,"render",(function(e,r){t._instance.world.draw(e)})),xt(this,"onKeyEvent",(function(e){"keydown"===e.type?t._instance.engine.keyboard.onKeyDown(e):t._instance.engine.keyboard.onKeyUp(e)})),xt(this,"onTouchEvent",(function(e){if(e.type,t._instance&&t._instance.engine&&"function"==typeof t._instance.engine.touchHandler)try{t._instance.engine.touchHandler(e)}catch(t){console.warn("touchHandler error",t)}})),this.shaders={fs:"\n precision mediump int;\n precision mediump float;\n\n const float Near = 0.1;\n const float Far = 50.0;\n\n struct PointLight {\n float enabled;\n vec3 color;\n vec3 position;\n vec3 attenuation;\n vec3 direction;\n vec3 scatteringCoefficients;\n float density;\n };\n\n float unpack(vec4 color) {\n const vec4 bitShifts = vec4(1.0, 1.0 / 255.0, 1.0 / (255.0 * 255.0), 1.0 / (255.0 * 255.0 * 255.0));\n return dot(color, bitShifts);\n }\n\n varying vec4 vWorldVertex;\n varying vec3 vWorldNormal;\n varying vec3 vTransformedNormal;\n varying vec4 vPosition;\n varying vec2 vTextureCoord;\n\n varying vec3 vLighting;\n\n uniform PointLight uLights[32];\n uniform sampler2D uDepthMap;\n uniform vec4 u_id;\n\n uniform float runTransition;\n uniform float useSampler;\n uniform float useDiffuse;\n uniform float isSelected;\n uniform vec4 uColorMultiplier; \n uniform sampler2D uSampler;\n uniform sampler2D uDiffuseMap;\n\n uniform vec3 uDiffuse;\n uniform vec3 uSpecular;\n uniform float uSpecularExponent;\n\n uniform vec3 uLightColor;\n varying vec3 vFragPos;\n varying vec3 vLightDir;\n varying vec3 vViewDir;\n\n float getAttenuation(PointLight light) {\n float distance_from_light;\n vec3 to_light;\n\n to_light = light.position - vPosition.xyz;\n distance_from_light = length(to_light);\n \n float attenuation = 1.0 / (\n 1.0 + light.attenuation.x\n + light.attenuation.y * distance_from_light \n + light.attenuation.z * pow(distance_from_light, 2.0)\n );\n return attenuation;\n }\n\n vec3 getReflectedLightColor(vec3 color) {\n vec3 reflectedLightColor = vec3(0.0);\n \n for(int i = 0; i < 32; i++) {\n if(uLights[i].enabled <= 0.5) continue;\n \n vec3 specular_color;\n vec3 diffuse_color;\n vec3 to_light;\n vec3 reflection;\n vec3 to_camera;\n float cos_angle;\n float attenuation;\n vec3 normal;\n \n // Calculate a vector from the fragment location to the light source\n to_light = normalize(uLights[i].position - vFragPos);\n normal = normalize(vWorldNormal);\n \n // DIFFUSE calculations\n if (useSampler == 1.0) {\n cos_angle = 0.67; // billboard sprites\n cos_angle += dot(to_camera, to_light);\n } else {\n cos_angle = dot(normal, to_light);\n cos_angle = clamp(cos_angle, 0.0, 1.0);\n }\n \n // Scale the color of this fragment based on its angle to the light.\n diffuse_color = uLights[i].color * cos_angle;\n \n // SPECULAR calculations\n reflection = 2.0 * dot(normal, to_light) * normal - to_light;\n reflection = normalize(reflection);\n \n to_camera = normalize(vViewDir);\n \n cos_angle = dot(reflection, to_camera);\n cos_angle = clamp(cos_angle, 0.0, 1.0);\n specular_color = uLights[i].color * cos_angle;\n \n // ATTENUATION calculations\n attenuation = getAttenuation(uLights[i]);\n \n // Combine and attenuate the colors from this light source\n reflectedLightColor += attenuation * (diffuse_color + specular_color);\n }\n \n return clamp(0.5 * color + reflectedLightColor, 0.0, 1.0);\n }\n\n // Diffuse Colour Calculation\n vec3 calculateDiffuse() {\n vec4 texelColors = texture2D(uDiffuseMap, vTextureCoord);\n vec3 color = uDiffuse;\n if(useDiffuse == 1.0) {\n // If texture has valid data, use it multiplied by material diffuse color\n if(texelColors.a > 0.01) {\n color = texelColors.rgb * uDiffuse;\n }\n }\n return color;\n }\n\n // Sampler Texture Colour Calculation\n vec3 calculateSampler(vec4 texelColors) {\n vec3 color = texelColors.rgb;\n if(texelColors.a < 0.1) discard;\n return color;\n }\n\n // linearize depth\n float LinearizeDepth(float depth) {\n float z = depth * 2.0 - 1.0; // back to NDC \n return (2.0 * Near * Far) / (Far + Near - z * (Far - Near));\n }\n\n // fog effect based on depth\n vec4 fogEffect(vec4 color4) {\n float depth = LinearizeDepth(gl_FragCoord.z) / Far;\n vec4 depthVec4 = vec4(vec3(pow(depth, 1.4)), 1.0);\n return (color4 * (1.0 - depth)) + depthVec4;\n }\n\n // Volumetric Calculation\n vec4 volumetricCalculation(vec4 color4) {\n vec3 finalColor;\n\n for(int i = 0; i < 32; i++) {\n if(uLights[i].enabled <= 0.5) continue;\n \n // Calculate the distance from the fragment to the light\n float distance = length(uLights[i].position - vec3(vWorldVertex));\n\n // directional lighting - not working atm\n // if(length(uLights[i].direction) > 0.0){\n // // Calculate the angle between the light direction and the fragment\n // float cos_angle = dot(normalize(uLights[i].direction), normalize(vFragPos - uLights[i].position));\n // // If the fragment is not within the light cone, skip this light\n // if(cos_angle <= 0.0) continue;\n // }\n\n // Calculate the scattering effect\n float scattering = exp(-uLights[i].density * distance);\n vec3 scatteredLight = uLights[i].color * scattering * uLights[i].scatteringCoefficients;\n // Combine the scattered light with the existing lighting\n finalColor += scatteredLight;\n }\n\n return color4 * vec4(finalColor, 1.0);\n }\n\n void main(void) {\n vec4 finalColor = vec4(0.0, 0.0, 0.0, 1.0);\n\n if(runTransition == 1.0) {\n finalColor = vec4(0.0, 0.0, 0.0, 0.0);\n gl_FragColor = finalColor;\n return;\n }\n\n if(useSampler == 1.0) { // sampler\n vec4 texelColors = texture2D(uSampler, vTextureCoord);\n vec3 color = calculateSampler(texelColors);\n vec4 color4 = vec4(getReflectedLightColor(color), texelColors.a);\n finalColor = volumetricCalculation(vec4(color, texelColors.a)) * fogEffect(color4);\n } else { // diffuse\n vec3 color = calculateDiffuse();\n vec4 color4 = vec4((getReflectedLightColor(color)), 1.0);\n finalColor = volumetricCalculation(vec4(color,1.0)) * fogEffect(color4);\n }\n\n // flash on selection\n if(isSelected == 1.0) {\n finalColor = finalColor * uColorMultiplier;\n }\n\n // gl_FragColor = vec4(vec3(u_id),1.0);\n\n gl_FragColor = finalColor;\n }\n",vs:"\n precision mediump float;\n\n attribute vec3 aVertexPosition;\n attribute vec3 aVertexNormal;\n attribute vec2 aTextureCoord;\n \n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n uniform mat3 uNormalMatrix;\n uniform mat3 uCamPos;\n\n uniform vec3 uLightDirection;\n uniform vec3 uCameraPosition;\n varying vec3 vFragPos;\n varying vec3 vLightDir;\n varying vec3 vViewDir;\n\n varying vec4 vWorldVertex;\n varying vec3 vWorldNormal;\n varying vec3 vTransformedNormal;\n varying vec4 vPosition;\n varying vec2 vTextureCoord;\n\n uniform vec3 u_scale;\n\n void main(void) {\n vec3 scaledPosition = aVertexPosition * u_scale;\n\n vWorldVertex = uModelMatrix * vec4(aVertexPosition, 1.0);\n vPosition = uModelMatrix * vec4(scaledPosition, 1.0);\n vTextureCoord = aTextureCoord;\n vTransformedNormal = uNormalMatrix * aVertexNormal;\n vWorldNormal = normalize(mat3(uModelMatrix) * aVertexNormal);\n\n // Pass fragment position to fragment shader\n vFragPos = vec3(uModelMatrix * vec4(scaledPosition, 1.0));\n \n // Calculate view direction and pass to fragment shader\n vViewDir = normalize(uCameraPosition - vFragPos);\n\n gl_Position = uProjectionMatrix * uViewMatrix * vPosition;\n }\n"},this.effects={},this.effectPrograms={},t._instance||(t._instance=this),t._instance}));function kt(t){return kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kt(t)}function Et(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return At(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?At(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function At(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function St(){St=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=w(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function f(){}function h(){}function d(){}var p={};s(p,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(E([])));g&&g!==e&&r.call(g,o)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,s){var c=u(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==kt(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,s)}))}s(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return h.prototype=d,s(m,"constructor",d),s(d,"constructor",h),h.displayName=s(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(b.prototype),s(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},v(m),s(m,a,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Lt(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function Ot(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Lt(i,n,o,a,s,"next",t)}function s(t){Lt(i,n,o,a,s,"throw",t)}a(void 0)}))}}function Pt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tt(t,e){return Tt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Tt(t,e)}function Ct(t,e){if(e&&("object"===kt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Mt(t)}function Mt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jt(t){return jt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},jt(t)}function It(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Bt(t){return Bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bt(t)}function zt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Dt(t,e){return Dt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Dt(t,e)}function Nt(t,e){if(e&&("object"===Bt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Rt(t){return Rt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Rt(t)}var Ft=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dt(t,e)}(i,t);var e,r,n,o=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Rt(r);if(n){var o=Rt(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return Nt(this,t)});function i(){return zt(this,i),o.apply(this,arguments)}return e=i,Object.defineProperty(e,"prototype",{writable:!1}),e}(function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tt(t,e)}(i,t);var e,r,n,o=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=jt(r);if(n){var o=jt(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return Ct(this,t)});function i(){var t;Pt(this,i);for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return It(Mt(t=o.call.apply(o,[this].concat(r))),"init",function(){var e=Ot(St().mark((function e(r){var n,o,i,a;return St().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||0===r.fileUpload.files.length)return r.fileUpload.click(),void(r.fileUpload.onchange=function(e){return o(t)});o(null)},i=function(){return(i=Ot(St().mark((function t(e){var o,i,a,s,c,u;return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,o=r.fileUpload.files[0],t.next=4,_().loadAsync(o);case 4:return i=t.sent,_t._instance.zip=i,t.t0=JSON,t.next=9,i.file("manifest.json").async("string");case 9:t.t1=t.sent,a=t.t0.parse.call(t.t0,t.t1),console.log(a),a.network&&a.network.url&&(console.log("Network connection found -- attempting connectiong to server"),r.networkManager.connect(a.network.url)),s=Et(a.initialZones),t.prev=14,s.s();case 16:if((c=s.n()).done){t.next=22;break}return u=c.value,t.next=20,n.loadZoneFromZip(u,i,!0,{effect:"cross",duration:500});case 20:t.next=16;break;case 22:t.next=27;break;case 24:t.prev=24,t.t2=t.catch(14),s.e(t.t2);case 27:return t.prev=27,s.f(),t.finish(27);case 30:n.isPaused=!1,e.completed=!0,_t._instance.loaded=!0,t.next=39;break;case 35:return t.prev=35,t.t3=t.catch(0),console.error(t.t3),t.abrupt("return");case 39:case"end":return t.stop()}}),t,null,[[0,35],[14,24,27,30]])})))).apply(this,arguments)},o=function(t){return i.apply(this,arguments)},_t._instance.loaded=!1,_t._instance.engine=r,(n=_t._instance.world=new pt(_t._instance,"dynamic")).startMenu({start:{pausable:!1,text:"Load Game File",prompt:"Please select a file to load...",x:r.screenSize().width/2-75,y:r.screenSize().height/2-50,w:150,h:75,quittable:!1,colours:{top:"#333",bottom:"#777",background:"#999"},onEnter:!0,onOpen:function(e){t.isPaused=!0},trigger:function(){var t=Ot(St().mark((function t(e){return St().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a(e);case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),t}return e=i,Object.defineProperty(e,"prototype",{writable:!1}),e}(_t)),Ut=o(3379),Gt=o.n(Ut),Wt=o(7795),Vt=o.n(Wt),Zt=o(569),$t=o.n(Zt),Yt=o(6636),Kt=o.n(Yt),Ht=o(9216),qt=o.n(Ht),Xt=o(4589),Jt=o.n(Xt),Qt=o(1895),te={};function ee(t){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ee(t)}function re(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ne(t,e){return ne=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ne(t,e)}function oe(t,e){if(e&&("object"===ee(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function ie(t){return ie=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ie(t)}te.styleTagTransform=Jt(),te.setAttributes=Kt(),te.insert=$t().bind(null,"head"),te.domAPI=Vt(),te.insertStyleElement=qt(),Gt()(Qt.Z,te),Qt.Z&&Qt.Z.locals&&Qt.Z.locals;var ae=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ne(t,e)}(c,t);var r,n,o,i,a,s=(i=c,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=ie(i);if(a){var r=ie(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return oe(this,t)});function c(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(e=s.call(this,t)).state={spritz:new Ft,updated:Date.now(),zipData:t.zipData},e}return r=c,o=[{key:"getDerivedStateFromProps",value:function(t,e){return JSON.stringify(e.networkString)!==JSON.stringify(t.networkString)?{networkString:t.networkString,updated:Date.now()}:null}}],(n=[{key:"render",value:function(){var t=this.state,r=t.updated,n=t.spritz,o=t.zipData;return e().createElement("div",{style:{margin:0,minHeight:"480px",maxHeight:"1080px"}},e().createElement(b,{class:"pixos",key:"pixos-".concat(r),width:480,height:640,SpritzProvider:n,zipData:null!=o?o:""}))}}])&&re(r.prototype,n),o&&re(r,o),Object.defineProperty(r,"prototype",{writable:!1}),c}(t.Component);const se=(0,r.collect)(ae)})(),i.default})()));
3
+ //# sourceMappingURL=bundle.js.map