narraleaf-react 0.0.1-beta.11 → 0.0.1-beta.12

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/main.js CHANGED
@@ -28,4 +28,4 @@ function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.p
28
28
  *
29
29
  * This source code is licensed under the MIT license found in the
30
30
  * LICENSE file in the root directory of this source tree.
31
- */function c(t,e,n){var r,i={},c=null,l=null;for(r in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,r)&&!u.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:c,ref:l,props:i,_owner:s.current}}e.jsx=c,e.jsxs=c},848:(t,e,n)=>{"use strict";t.exports=n(20)},72:t=>{"use strict";var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var i={},a=[],s=0;s<t.length;s++){var u=t[s],c=r.base?u[0]+r.base:u[0],l=i[c]||0,f="".concat(c," ").concat(l);i[c]=l+1;var d=n(f),p={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var h=o(p,r);r.byIndex=s,e.splice(s,0,{identifier:f,updater:h,references:1})}a.push(f)}return a}function o(t,e){var n=e.domAPI(e);n.update(t);return 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;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var i=r(t=t||[],o=o||{});return function(t){t=t||[];for(var a=0;a<i.length;a++){var s=n(i[a]);e[s].references--}for(var u=r(t,o),c=0;c<i.length;c++){var l=n(i[c]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}i=u}}},659:t=>{"use strict";var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},56:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},113: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))}}},12:e=>{"use strict";e.exports=t}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={id:t,exports:{}};return e[t](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nc=void 0;var o={};return(()=>{"use strict";function t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return n};var e,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(e){l=function(t,e,n){return t[e]=n}}function d(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new I(r||[]);return i(a,"_invoke",{value:P(t,n,s)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=d;var h="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,s,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(M([])));x&&x!==r&&o.call(x,s)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function T(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(r,i,a,s){var u=p(t[r],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==f(l)&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function P(t,n,r){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=O(s,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var c=p(t,n,r);if("normal"===c.type){if(o=r.done?m:y,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function O(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=p(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(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 C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(f(t)+" is not iterable")}return w.prototype=_,i(A,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},n.awrap=function(t){return{__await:t}},T(E.prototype),l(E.prototype,u,(function(){return this})),n.AsyncIterator=E,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new E(d(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(A),l(A,c,"Generator"),l(A,s,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=M,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},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 n=this;function r(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;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,g):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),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}function e(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=c(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s(r.key),r)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}function u(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)||c(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 c(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function f(t){return f="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},f(t)}r.r(o),r.d(o,{Align:()=>we,Base:()=>Sf,Character:()=>Ot,ColoredSentence:()=>Mt,CommonPosition:()=>ge,CommonPositionType:()=>ae,Condition:()=>Ms,Control:()=>$s,Coord2D:()=>be,Dissolve:()=>Wf,Fade:()=>jf,FadeIn:()=>Vf,Game:()=>qt,GameProviders:()=>gf,GameState:()=>G,Image:()=>Sa,Isolated:()=>ot,Lambda:()=>Is,LiveGame:()=>Yt,Menu:()=>Xs,Player:()=>vf,Say:()=>It,Scene:()=>xu,Script:()=>Iu,Sentence:()=>Tt,Sound:()=>lu,SoundType:()=>eu,Story:()=>Bu,Transform:()=>ha,Utils:()=>ms,Word:()=>Pt,useGame:()=>dt});var d=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function p(t,e){var n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r={},o=function(t,e,n){return"object"!==f(e)||null===e||Array.isArray(e)||"object"!==f(n)||null===n||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n)?e.map((function(t,e){return"object"===f(t)&&null!==t&&!Array.isArray(t)&&n[e]?p(t,n[e]):t})):void 0!==n?n:e:e.constructor!==Object||n.constructor!==Object?n||e:p(e,n)};for(var i in t)n(t,i)&&(r[i]=o(0,t[i],e[i]));for(var a in e)n(e,a)&&!n(r,a)&&("object"===f(e[a])&&null!==e[a]?e[a].constructor!==Object?r[a]=e[a]:r[a]=p({},e[a]):r[a]=e[a]);for(var s=arguments.length,c=new Array(s>2?s-2:0),l=2;l<s;l++)c[l-2]=arguments[l];if(c.length){var d=c[0],h=c.slice(1);return p.apply(void 0,[r,d].concat(u(h)))}return r}var h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},r=arguments.length>1?arguments[1]:void 0;n(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=r}return a(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var n,r=e(this.listeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)(this.result)}}catch(t){r.e(t)}finally{r.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function y(t){var n=new WeakSet;return function t(r){if(null===r||"object"!==f(r))return r;if(!n.has(r)){if(n.add(r),Array.isArray(r)){var o,i=[],a=e(r);try{for(a.s();!(o=a.n()).done;){var s=o.value;i.push(t(s))}}catch(t){a.e(t)}finally{a.f()}return i}var u={};for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(u[c]=t(r[c]));return u}}(t)}function v(t){return"string"==typeof t?t:"#".concat((t.r||0).toString(16).padStart(2,"0")).concat((t.g||0).toString(16).padStart(2,"0")).concat((t.b||0).toString(16).padStart(2,"0")).concat(void 0!==t.a?t.a.toString(16).padStart(2,"0"):"")}var m=function(){return a((function t(){n(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return d(this,void 0,void 0,t().mark((function r(){var i,a,s,u,c,l=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.events[n]||(this.events[n]=[]),i=[],a=e(this.events[n]);try{for(a.s();!(s=a.n()).done;)u=s.value,(c=u.apply(void 0,o))&&"object"===f(c)&&"function"==typeof c.then&&i.push(c)}catch(t){a.e(t)}finally{a.f()}if(this.events[n]=this.events[n].filter((function(t){return!i.includes(t)})),0!==i.length){t.next=7;break}return t.abrupt("return",new Promise((function(t){var e=l.on("event:EventDispatcher.register",(function(r,i){if(r===n){l.off(r,e);var a=null==i?void 0:i.apply(void 0,o);a&&a.then?a.then(t):t(a)}}))})));case 7:return t.next=9,Promise.all(i);case 9:return t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),r,this)})))}}])}();function g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function b(t){return new Promise((function(e){return setTimeout(e,t)}))}function w(t,e){if(t===e)return!0;if("object"!==f(t)||"object"!==f(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!w(t[a],e[a]))return!1}return!0}var _=function(){return a((function t(e,r){n(this,t),this.game=e,this.prefix=r}),[{key:"log",value:function(t){if(this.game.config.app.logger.log){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"info",value:function(t){if(this.game.config.app.logger.info){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).info.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"warn",value:function(t){if(this.game.config.app.logger.warn){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).warn.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"error",value:function(t){if(this.game.config.app.logger.error){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).error.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"debug",value:function(t){if(this.game.config.app.logger.debug){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).debug.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"trace",value:function(t){if(this.game.config.app.logger.trace){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console.trace(this._log.apply(this,[t].concat(n)))}}},{key:"_log",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===n.length?[this.prefix||"",t]:["".concat(this.prefix||""," [").concat(t,"]")].concat(n)}}])}(),S=function(){return a((function t(e){n(this,t),this.abortHandler=e,this.events=new m,this.aborted=!1}),[{key:"abort",value:function(){return this.aborted||(this.aborted=!0,this.result=this.abortHandler.apply(this,arguments)),this.result}},{key:"isAborted",value:function(){return this.aborted}},{key:"cancel",value:function(){this.aborted=!0}}])}();function k(t){return k="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},k(t)}function x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return A(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(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 A(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,O(r.key),r)}}function P(t,e,n){return e&&E(t.prototype,e),n&&E(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function O(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==k(e)?e:e+""}S.EventTypes={"event:skipController.abort":"event:skipController.abort"};var j=function(){function t(e,n,r){T(this,t),this.name=e,this.key=r||e,this.content=p({},n)}return P(t,[{key:"set",value:function(e,n){return t.isSerializable(n)?(this.content[e]=n,this):(console.warn('Value "'.concat(n,'" in key "').concat(String(e),'" is not serializable, and will not be set\nat namespace "').concat(this.name,'"')),this.content[e]=n,this)}},{key:"get",value:function(t){return this.content[t]}},{key:"toData",value:function(){return this.serialize()}},{key:"load",value:function(t){t?this.content=t:console.warn("No data to load")}},{key:"serialize",value:function(){var t=this,e={};return Object.entries(this.content).forEach((function(n){var r=x(n,2),o=r[0],i=r[1];e[o]=t.wrap(i)})),e}},{key:"deserialize",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=x(t,2),r=n[0],o=n[1];e.content[r]=e.unwrap(o)})):console.warn("No data to load")}},{key:"toTypeName",value:function(t){return t instanceof Date?"date":"any"}},{key:"wrap",value:function(t){return{any:function(t){return{type:"any",data:t}},date:function(t){return{type:"date",data:t.toString()}}}[this.toTypeName(t)](t)}},{key:"unwrap",value:function(t){var e={any:function(t){return t.data},date:function(t){return new Date(t.data)}};return e[t.type](t)}}],[{key:"isSerializable",value:function(e){return!!["number","string","boolean"].includes(k(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===k(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),C=function(){return P((function t(){T(this,t),this.namespaces={}}),[{key:"addNamespace",value:function(t){return this.namespaces[t.key]=t,this}},{key:"getNamespace",value:function(t){return this.namespaces[t]}},{key:"setNamespace",value:function(t,e){return this.namespaces[t]=e,this}},{key:"getNamespaces",value:function(){return this.namespaces}},{key:"keys",value:function(){return Object.keys(this.namespaces)}},{key:"values",value:function(){return Object.values(this.namespaces)}},{key:"entries",value:function(){return Object.entries(this.namespaces)}},{key:"toData",value:function(){return this.entries().reduce((function(t,e){var n=x(e,2),r=n[0],o=n[1];return t[r]=o.toData(),t}),{})}},{key:"load",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=x(t,2),r=n[0],o=n[1];e.namespaces[r]?e.namespaces[r].load(o):console.warn("Namespace ".concat(r," not found in ").concat(e.constructor.name))})):console.warn("No data to load")}}])}();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 M(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,L(r.key),r)}}function L(t){var e=function(t,e){if("object"!=I(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==I(e)?e:e+""}var N=r(196);function F(t){return F="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},F(t)}function R(t){return function(t){if(Array.isArray(t))return t}(t)||B(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 V(t){return function(t){if(Array.isArray(t))return $(t)}(t)||B(t)||D(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){if(t){if("string"==typeof t)return $(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(t,e):void 0}}function B(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function $(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function U(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,H(r.key),r)}}function H(t){var e=function(t,e){if("object"!=F(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=F(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==F(e)?e:e+""}var G=function(){return function(t,e,n){return e&&U(t.prototype,e),n&&U(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={sounds:[],srcManagers:[],elements:[]},this.currentHandling=null,this.stage=n,this.game=e,this.events=new m,this.logger=new _(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByImage",value:function(t){return this.state.elements.find((function(e){return e.ele.images.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this._getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=this.createWaitableAction({character:e.character,sentence:e,id:t},(function(){i.splice(i.indexOf(a),1),n&&n()}));i.push(a)}},{key:"createMenu",value:function(t,e,n){var r;if(!t.choices.length)throw new Error("Menu must have at least one choice");var o=null===(r=this.findElementByScene(this._getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!o)throw new Error("Scene not found");var i=this.createWaitableAction(t,(function(t){o.splice(o.indexOf(i),1),e&&e(t)}));o.push(i)}},{key:"createImage",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.images.push(t),this):this}},{key:"disposeImage",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.images;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Image not found");return o.splice(i,1),this}},{key:"playSound",value:function(t,e){var n=t.play(),r=[t.once("end",o.bind(this)),t.once("stop",o.bind(this))];function o(){e&&e(),r.forEach((function(t){return t.off()})),this.stage.next()}return n}},{key:"getHowl",value:function(){return N.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(V(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"toData",value:function(){return{elements:this.state.elements.map((function(t){return{scene:t.scene.id,ele:{images:t.ele.images.map((function(t){return t.id}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;this.state.elements=[];var r=this.game.getLiveGame().story;if(!r)throw new Error("No story loaded");var o=r.getAllElements(e);t.elements.forEach((function(t){var e=R(r.findElementsByIds([t.scene].concat(V(t.ele.images)),o)),i={scene:e[0],ele:{images:e.slice(1),menus:[],texts:[]}};n.state.elements.push(i),n.state.srcManagers.push(i.scene.srcManager)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],images:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"_getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new Error('Scene not found, please call "scene.activate()" first.');return e}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}])}();function z(t){var e,n,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=z(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}G.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip"};const W=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=z(t))&&(r&&(r+=" "),r+=e);return r};var q=r(12),Y=r.n(q);function X(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return K(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?K(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 K(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Z(t){return Z="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},Z(t)}function Q(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,J(r.key),r)}}function J(t){var e=function(t,e){if("object"!=Z(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Z(e)?e:e+""}var tt=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={width:0,height:0,minWidth:800,minHeight:450,paused:!1},this.events=new m,this.lockers=[],this.updater=null}return function(t,e,n){return e&&Q(t.prototype,e),n&&Q(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n){this.state.width=e,this.state.height=n,this.events.emit(t.EventTypes["event:aspectRatio.update"],e,n)}},{key:"updateMin",value:function(t,e){this.state.minWidth=t,this.state.minHeight=e}},{key:"lock",value:function(){var t=Symbol();return this.lockers.push(t),t}},{key:"unlock",value:function(t){if(t&&!this.lockers.includes(t))throw new Error("Locker not found");return this.lockers=this.lockers.filter((function(e){return e!==t})),this.triggerUpdate(),null}},{key:"isLocked",value:function(){return!!this.lockers.length}},{key:"getStyle",value:function(){return{width:"".concat(this.state.width,"px"),height:"".concat(this.state.height,"px")}}},{key:"setUpdate",value:function(t){this.updater=t}},{key:"pause",value:function(){this.state.paused=!0,this.events.emit(t.EventTypes["event:aspectRatio.pause"])}},{key:"resume",value:function(){this.state.paused=!1,this.events.emit(t.EventTypes["event:aspectRatio.resume"])}},{key:"onUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.update"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.update"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();tt.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume"};var et=(0,q.createContext)(null);function nt(t){var e=t.children,n=X((0,q.useState)(new tt),1)[0];return Y().createElement(et.Provider,{value:{ratio:n}},e)}function rt(){var t=(0,q.useContext)(et);if(!et||!t)throw new Error("useRatio must be used within a RatioProvider");var e=X((0,q.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,q.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function ot(t){var e=t.children,n=t.className,r=rt().ratio,o=r.getStyle();return Y().createElement("div",{className:W("inset-0 flex items-center justify-center",n),style:{width:"100%",height:"100%",minWidth:"".concat(r.state.minWidth,"px"),minHeight:"".concat(r.state.minHeight,"px")}},Y().createElement("div",{style:Object.assign(Object.assign({},o),{position:"relative"})},e))}function it(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return at(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(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 at(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}const st=function(t){var e=t.text,n=t.speed,r=t.onComplete,o=t.className,i=it((0,q.useState)(""),2),a=i[0],s=i[1],u=it((0,q.useState)(0),2),c=u[0],l=u[1];return(0,q.useEffect)((function(){if(c<e.length){if(" "!==e[c]){var t=setTimeout((function(){s((function(t){return t+e[c]})),l((function(t){return t+1}))}),n);return function(){return clearTimeout(t)}}s((function(t){return t+" "})),l((function(t){return t+1}))}else r&&r()}),[c,e,n,r]),Y().createElement("span",{className:o},a)};function ut(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ct(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ct(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 ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var lt=Y().createContext(null);function ft(t){var e=t.children,n=t.game,r=new qt({}),o=ut((0,q.useState)(n||r),2),i=o[0],a=o[1];return Y().createElement(lt.Provider,{value:{game:i,setGame:a}},e)}function dt(){var t=(0,q.useContext)(lt);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function pt(t){return pt="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},pt(t)}function ht(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yt(r.key),r)}}function yt(t){var e=function(t,e){if("object"!=pt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pt(e)?e:e+""}var vt=function(){return function(t,e,n){return e&&ht(t.prototype,e),n&&ht(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.IdPrefixes.Actionable;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actions=[],this.id=qt.getIdManager().prefix(e,qt.getIdManager().getStringId(),"-")}),[{key:"toActions",value:function(){var t=this.actions;return this.actions=[],t}},{key:"toData",value:function(){return null}},{key:"fromData",value:function(t){return this}}])}();function mt(t){return mt="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},mt(t)}function gt(t,e,n){return e=wt(e),function(t,e){if(e&&("object"==mt(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)}(t,bt()?Reflect.construct(e,n||[],wt(t).constructor):e.apply(t,n))}function bt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(bt=function(){return!!t})()}function wt(t){return wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wt(t)}function _t(t,e){return _t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_t(t,e)}function St(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,At(r.key),r)}}function xt(t,e,n){return e&&kt(t.prototype,e),n&&kt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function At(t){var e=function(t,e){if("object"!=mt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=mt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==mt(e)?e:e+""}vt.IdPrefixes={Actionable:"actionable",Condition:"$0",Control:"$1",Image:"$2",Script:"$3",Sound:"$4",Text:"$5",Menu:"$6"};var Tt=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};St(this,t),this.character=e,this.text=this.format(n),this.config=p(t.defaultConfig,r),this.id=qt.getIdManager().getStringId(),this.state=y(t.defaultState)}return xt(t,[{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)Pt.isWord(t[n])?e.push(t[n]):e.push(new Pt(t[n]));else e.push(Pt.isWord(t)?t:new Pt(t));return e}},{key:"toData",value:function(){return w(this.state,t.defaultState)?null:{state:y(this.state)}}},{key:"fromData",value:function(t){return this.state=p(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(null,e)}}])}();Tt.defaultConfig={color:"#000",pause:!0,voice:null},Tt.defaultState={display:!0};var Et,Pt=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};St(this,t),this.text=e,this.config=p(t.defaultConfig,n)}return xt(t,null,[{key:"isWord",value:function(e){return e instanceof t}}])}();Pt.defaultConfig={},Pt.defaultColor="#000",function(t){t.adv="adv",t.nvl="nvl"}(Et||(Et={}));var Ot=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return St(this,e),(n=gt(this,e,[vt.IdPrefixes.Text])).name=t,n.config=p({},e.defaultConfig,r),n}return 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&&_t(t,e)}(e,t),xt(e,[{key:"say",value:function(t){var e=Array.isArray(t)?new Tt(this,t,{}):Tt.isSentence(t)?t:new Tt(this,t,{}),n=new Za(this,Za.ActionTypes.say,new ue(qt.getIdManager().getStringId()).setContent(e));return this.actions.push(n),this}}])}(vt);function jt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ct(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(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 Ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function It(t){var e,n=t.action,r=t.onClick,o=t.useTypeEffect,i=void 0===o||o,a=t.className,s=t.state,u=n.sentence,c=n.character,l=jt((0,q.useState)(0),2),f=l[0],d=l[1],p=jt((0,q.useState)(!1),2),h=p[0],y=p[1],m=dt().game,g=function(){d((function(t){return t+1})),f===u.text.length-1&&y(!0)};return(0,q.useEffect)((function(){if(window){var t=function(t){m.config.elements.say.nextKey.includes(t.key)&&(h?r&&r():y(!0))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[h]),(0,q.useEffect)((function(){var t=s.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:s.events.on(G.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),y(!0),r&&r()}))}]);return function(){t.cancel()}})),Y().createElement(ot,{className:"absolute"},u.state.display&&(c&&c.config.mode!==Ot.Modes.adv?Y().createElement(Y().Fragment,null," "):Y().createElement("div",{className:W("absolute flex items-center justify-center bottom-0 w-[calc(100%-40px)] h-[calc(33%-40px)] m-4 bg-white",m.config.elementStyles.say.container,a),onClick:function(){h?r&&r():y(!0)}},Y().createElement("div",{className:W("absolute top-0 left-0 p-1.25 rounded-br-md m-4",m.config.elementStyles.say.nameText)},(null===(e=u.character)||void 0===e?void 0:e.name)||""),Y().createElement("div",{className:W("text-center max-w-[80%] mx-auto",m.config.elementStyles.say.textContainer)},u.text.map((function(t,e){var n=t.config.color||u.config.color||Pt.defaultColor;return h?Y().createElement("span",{key:e,style:{color:"string"==typeof n?n:v(n)},className:W(m.config.elementStyles.say.textSpan)},t.text):e>f?null:Y().createElement("span",{key:e,style:{color:v(n)},className:W(m.config.elementStyles.say.textSpan)},i?Y().createElement(st,{text:t.text,onComplete:e===f?g:void 0,speed:m.config.elements.say.textInterval,className:W(m.config.elementStyles.say.textSpan)}):t.text)}))))))}function Mt(t){var e=t.sentence,n=t.className;return Y().createElement(Y().Fragment,null,e.text.map((function(t,r){var o=t.config.color||e.config.color||Pt.defaultColor;return Y().createElement("span",{key:r,style:{color:v(o)},className:n},t.text)})))}Ot.Modes=Et,Ot.defaultConfig={mode:Et.adv};var Lt={say:It,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=dt().game,a=i.config.elements.say.use;return Y().createElement(Y().Fragment,null,Y().createElement(ot,{className:"absolute"},Y().createElement("div",{className:"absolute flex flex-col items-center justify-center min-w-full w-full h-full"},e&&Y().createElement(a,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"}))),Y().createElement(ot,{className:"absolute"},Y().createElement("div",{className:W("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.container)},Y().createElement("div",{className:"p-4 rounded-lg w-full z-20"},Y().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return Y().createElement("button",{key:e,className:W("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButton),onClick:function(){return function(t){r(t)}(t)}},Y().createElement(Mt,{key:e,sentence:t.prompt,className:W(i.config.elementStyles.menu.choiceButtonText)}))})))))))}};function Nt(t){return Nt="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},Nt(t)}function Ft(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Rt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Dt(r.key),r)}}function Vt(t,e,n){return e&&Rt(t.prototype,e),n&&Rt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Dt(t){var e=function(t,e){if("object"!=Nt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nt(e)?e:e+""}function Bt(t,e,n){return e=Ut(e),function(t,e){if(e&&("object"==Nt(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)}(t,$t()?Reflect.construct(e,n||[],Ut(t).constructor):e.apply(t,n))}function $t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($t=function(){return!!t})()}function Ut(t){return Ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ut(t)}function Ht(t,e){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ht(t,e)}var Gt,zt=function(t){function e(){var t;return Ft(this,e),(t=Bt(this,e,arguments)).id=0,t}return 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&&Ht(t,e)}(e,t),Vt(e,[{key:"getId",value:function(){return this.id++}},{key:"getStringId",value:function(){return(this.id++).toString()}},{key:"prefix",value:function(t,e){return t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:":")+e}}])}(function(){var t=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return function(t,e,n){return e&&M(t.prototype,e),n&&M(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"getInstance",value:function(){return t._instance||(t._instance=new this),t._instance}}])}();return t._instance=null,t}()),Wt=function(){return Vt((function t(){Ft(this,t),this.id=0}),[{key:"getId",value:function(){return this.id++}},{key:"getStringId",value:function(){return(this.id++).toString()}},{key:"prefix",value:function(t,e){return t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:":")+e}}])}();!function(t){t.game="game"}(Gt||(Gt={}));var qt=function(){return Vt((function t(e){Ft(this,t),this.liveGame=null,this.config=p(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Lt).includes(t))throw new Error("Invalid key ".concat(t));if("function"!=typeof e)throw new Error("Invalid component for key ".concat(t));return this.config.elements[t].use=e,this}},{key:"getLiveGame",value:function(){if(!this.liveGame){var t=this.createLiveGame();return this.liveGame=t,t}return this.liveGame}},{key:"createLiveGame",value:function(){return new Yt(this)}}],[{key:"getIdManager",value:function(){return zt.getInstance()}}])}();qt.defaultSettings={volume:1},qt.ComponentTypes={say:"say",menu:"menu"},qt.DefaultConfig={version:"v0.0.0",player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:"100%",height:"100%",skipKey:["Control"],skipInterval:100},elements:{say:{nextKey:[" "],textInterval:50,use:Lt.say},img:{slowLoadWarning:!0,slowLoadThreshold:2e3},menu:{use:Lt.menu}},elementStyles:{say:{container:"",nameText:"",textContainer:"",textSpan:""},menu:{container:"",choiceButton:"",choiceButtonText:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1}}},qt.GameSettingsNamespace=Gt;var Yt=function(){function t(e){Ft(this,t),this.currentSceneNumber=null,this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this._lockedCount=0,this.currentAction=null,this.game=e,this.storable=new C,this.initNamespaces(),this.idManager=new Wt}return Vt(t,[{key:"getDefaultSavedGame",value:function(){return{name:"_",version:this.game.config.version,meta:{created:Date.now(),updated:Date.now()},game:{store:{},elementState:[],nodeChildIdMap:{},stage:{elements:[]},currentScene:0,currentAction:null}}}},{key:"initNamespaces",value:function(){return this.storable.addNamespace(new j(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t,this}},{key:"newGame",value:function(){var t;this.initNamespaces(),this.currentSceneNumber=0,this.currentAction=(null===(t=this.story)||void 0===t?void 0:t.getActions()[this.currentSceneNumber])||null;var e=this.getDefaultSavedGame();return e.name="NewGame-"+Date.now(),this.currentSavedGame=e,this}},{key:"deserialize",value:function(t,e){var n=e.gameState,r=this.story;if(!r)throw new Error("No story loaded");if(t.version!==this.game.config.version)throw new Error("Saved game version mismatch");var o=r.getAllActions(),i=t.game,a=i.store,s=i.elementState,u=i.nodeChildIdMap,c=i.currentScene,l=i.currentAction,f=i.stage;this.storable.load(a),r._setAllElementState(s,o),r._setNodeChildByMap(u,o),l?this.setCurrentAction(r.findActionById(l,o)||null):this.setCurrentAction(null),this.currentSceneNumber=c,this.currentSavedGame=t,n.loadData(f,o)}},{key:"serialize",value:function(t){var e,n,r,o=t.gameState,i=this.story;if(!i)throw new Error("No story loaded");var a=i.getAllActions(),s=i._getAllElementState(a),u=Object.fromEntries(i._getNodeChildIdMap(a)),c=o.toData();return{name:(null===(e=this.currentSavedGame)||void 0===e?void 0:e.name)||"_",version:this.game.config.version,meta:{created:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.meta.created)||Date.now(),updated:Date.now()},game:{store:this.storable.toData(),elementState:s,stage:c,nodeChildIdMap:u,currentScene:this.currentSceneNumber||0,currentAction:(null===(r=this.getCurrentAction())||void 0===r?void 0:r.getId())||null}}}},{key:"getCurrentAction",value:function(){return this.currentAction}},{key:"setCurrentAction",value:function(t){return this.currentAction=t,this}},{key:"next",value:function(t){var e,n,r;if(!this.story)throw new Error("No story loaded");if(this.currentSceneNumber||(this.currentSceneNumber=0),this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("Locked awaiting");return this.lockedAwaiting}var o=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==o?void 0:o.node)||void 0===e?void 0:e.action)||null,this.lockedAwaiting=null,o||null}if(this.currentAction=this.currentAction||this.story.getActions()[++this.currentSceneNumber],!this.currentAction)return t.events.emit(G.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),null;var i=this.currentAction.executeAction(t);return h.isAwaitable(i)?(this.lockedAwaiting=i,i):(this._lockedCount=0,this.currentAction=(null===(r=null===(n=i.node)||void 0===n?void 0:n.child)||void 0===r?void 0:r.action)||null,i)}},{key:"abortAwaiting",value:function(){var t;if(this.lockedAwaiting){var e=this.lockedAwaiting.abort();this.currentAction=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.action)||null,this.lockedAwaiting=null}}},{key:"executeAction",value:function(t,e){var n,r,o=e.executeAction(t);return h.isAwaitable(o)?o:(null===(r=null===(n=null==o?void 0:o.node)||void 0===n?void 0:n.child)||void 0===r?void 0:r.action)||null}}])}();Yt.DefaultNamespaces={game:{}},Yt.GameSpacesKey={game:"game"};function Xt(t){return Xt="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},Xt(t)}function Kt(t,e,n){return e=Qt(e),function(t,e){if(e&&("object"==Xt(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)}(t,Zt()?Reflect.construct(e,n||[],Qt(t).constructor):e.apply(t,n))}function Zt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Zt=function(){return!!t})()}function Qt(t){return Qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qt(t)}function Jt(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&&te(t,e)}function te(t,e){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},te(t,e)}function ee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ne(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,oe(r.key),r)}}function re(t,e,n){return e&&ne(t.prototype,e),n&&ne(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function oe(t){var e=function(t,e){if("object"!=Xt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Xt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xt(e)?e:e+""}var ie;!function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(ie||(ie={}));var ae,se=function(){return re((function t(e,n){ee(this,t),this.id=e,this.type=n,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}(),ue=function(t){function e(t,n,r,o){var i;return ee(this,e),(i=Kt(this,e,[qt.getIdManager().prefix("node",t,"-"),ie.ContentNode])).child=o||null,i.parent=r||null,i.action=n||null,i}return Jt(e,t),re(e,[{key:"setParent",value:function(t){if(t===this)throw new Error("Cannot set parent to itself");return this.parent=t,this}},{key:"setChild",value:function(t){if(t===this)throw new Error("Cannot set child to itself");return this.child=t,t&&t.parent!==this&&t.remove().setParent(this),this}},{key:"getChild",value:function(){return this.child||null}},{key:"getParent",value:function(){return this.parent||null}},{key:"setInitChild",value:function(t){return this.initChild=t,this.setChild(t)}},{key:"addChild",value:function(t){return this.setChild(t),this}},{key:"removeChild",value:function(t){return t&&this.child===t?(this.child=null,t.setParent(null)):t||(this.child=null),this}},{key:"remove",value:function(){var t;return null===(t=this.parent)||void 0===t||t.removeChild(this),this}},{key:"hasChild",value:function(){return!!this.child}}],[{key:"forEachParent",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getParent()}},{key:"forEachChild",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getChild()}}])}(se),ce={center:"center",left:"left",right:"right"};function le(t){return le="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},le(t)}function fe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function de(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ye(r.key),r)}}function pe(t,e,n){return e&&de(t.prototype,e),n&&de(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function he(t,e,n){return(e=ye(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ye(t){var e=function(t,e){if("object"!=le(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=le(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==le(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(ae||(ae={}));var ve=he(he(he({},ae.Left,"33.33%"),ae.Center,"50%"),ae.Right,"66.66%"),me=function(){function t(){fe(this,t)}return pe(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"".concat(e);var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + ").concat(n,"px)")}},{key:"toCoord2D",value:function(t){if(ge.isCommonPositionType(t))return be.fromCommonPosition(t);if(be.isCoord2DPosition(t))return t;if(we.isAlignPosition(t))return be.fromAlignPosition(t);if("object"===le(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new be(t);throw new Error("Invalid position type")}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return be.merge(n,r)}},{key:"serializePosition",value:function(e){var n=this.toCoord2D(e);return{x:t.isUnknown(n.x)?0:n.x,y:t.isUnknown(n.y)?0:n.y,xoffset:t.isUnknown(n.xoffset)?0:n.xoffset,yoffset:t.isUnknown(n.yoffset)?0:n.yoffset}}},{key:"isRawCommonPositionType",value:function(t){return Object.values(ae).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===le(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===le(t)&&("xalign"in t||"yalign"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawPosition",value:function(t){return this.isRawCommonPositionType(t)||this.isRawCoord2DPosition(t)||this.isRawAlignPosition(t)}},{key:"isPosition",value:function(t){return t instanceof ge||t instanceof be||t instanceof we}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return be.fromCommonPosition(new ge(t));if(this.isRawCoord2DPosition(t))return new be(t);if(this.isRawAlignPosition(t))return be.fromAlignPosition(t);throw new Error("Invalid position type")}},{key:"tryParsePosition",value:function(t){if(this.isPosition(t))return t;if(this.isRawPosition(t))return this.rawPositionToCoord2D(t);throw new Error("Invalid position type")}}])}();me.Unknown=Symbol("Unknown");var ge=function(){function t(e){fe(this,t),this.position=e}return pe(t,[{key:"toCSS",value:function(){return{x:ve[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();ge.Positions=ae;var be=function(){function t(e,n){fe(this,t),"object"===le(e)?(this.x=e.x||me.Unknown,this.y=e.y||me.Unknown,this.xoffset=e.xoffset||me.Unknown,this.yoffset=e.yoffset||me.Unknown):(this.x=e||me.Unknown,this.y=n||me.Unknown,this.xoffset=me.Unknown,this.yoffset=me.Unknown)}return pe(t,[{key:"toCSS",value:function(){return{x:this.x,y:this.y,xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isCoord2DPosition",value:function(e){return e instanceof t}},{key:"fromCommonPosition",value:function(e){return new t({x:ve[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:me.isUnknown(e.xalign)?me.Unknown:"".concat(100*e.xalign,"%"),y:me.isUnknown(e.yalign)?me.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:me.isUnknown(n.x)?e.x:n.x,y:me.isUnknown(n.y)?e.y:n.y,xoffset:me.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:me.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),we=function(){function t(e,n){fe(this,t),"object"===le(e)?(this.xalign=e.xalign||me.Unknown,this.yalign=e.yalign||me.Unknown,this.xoffset=e.xoffset||me.Unknown,this.yoffset=e.yoffset||me.Unknown):(this.xalign=e||me.Unknown,this.yalign=n||me.Unknown,this.xoffset=me.Unknown,this.yoffset=me.Unknown)}return pe(t,[{key:"toCSS",value:function(){return{x:me.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:me.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();const _e=t=>t;let Se=_e,ke=_e;function xe(t,e,n){var r;if("string"==typeof t){let o=document;e&&(ke(Boolean(e.current),"Scope provided, but no element detected."),o=e.current),n?(null!==(r=n[t])&&void 0!==r||(n[t]=o.querySelectorAll(t)),t=n[t]):t=o.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}const Ae=new WeakMap,Te=!1,Ee=!1;const Pe=["read","resolveKeyframes","update","preRender","render","postRender"];function Oe(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Pe.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,o=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function s(e){i.has(e)&&(u.schedule(e),t()),e(a)}const u={schedule:(t,o=!1,a=!1)=>{const s=a&&r?e:n;return o&&i.add(t),s.has(t)||s.add(t),t},cancel:t=>{n.delete(t),i.delete(t)},process:t=>{a=t,r?o=!0:(r=!0,[e,n]=[n,e],n.clear(),e.forEach(s),r=!1,o&&(o=!1,u.process(t)))}};return u}(i),t)),{}),{read:s,resolveKeyframes:u,update:c,preRender:l,render:f,postRender:d}=a,p=()=>{const i=Ee?o.timestamp:performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(i-o.timestamp,40),1),o.timestamp=i,o.isProcessing=!0,s.process(o),u.process(o),c.process(o),l.process(o),f.process(o),d.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(p))};return{schedule:Pe.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(p)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<Pe.length;e++)a[Pe[e]].cancel(t)},state:o,steps:a}}const{schedule:je,cancel:Ce,state:Ie,steps:Me}=Oe("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:_e,!0);function Le(t){let e;return()=>(void 0===e&&(e=t()),e)}const Ne=Le((()=>void 0!==window.ScrollTimeline));class Fe{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>{if(!Ne()||!e.attachTimeline)return e.pause(),function(t,e){let n;const r=()=>{const{currentTime:r}=e,o=(null===r?0:r.value)/100;n!==o&&t(o),n=o};return je.update(r,!0),()=>Ce(r)}((t=>{e.time=e.duration*t}),t);e.attachTimeline(t)}));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Re=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ve=new Set(Re),De=t=>1e3*t,Be=t=>t/1e3,$e={type:"spring",stiffness:500,damping:25,restSpeed:10},Ue={type:"keyframes",duration:.8},He={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ge=(t,{keyframes:e})=>e.length>2?Ue:Ve.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:$e:He;function ze(t,e){return t[e]||t.default||t}const We=!1,qe=t=>null!==t;function Ye(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(qe),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const Xe=t=>/^0[^.\s]+$/u.test(t);const Ke=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Ze=t=>e=>"string"==typeof e&&e.startsWith(t),Qe=Ze("--"),Je=Ze("var(--"),tn=t=>!!Je(t)&&en.test(t.split("/*")[0].trim()),en=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,nn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function rn(t,e,n=1){ke(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,o]=function(t){const e=nn.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${null!=n?n:r}`,o]}(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const t=i.trim();return Ke(t)?parseFloat(t):t}return tn(o)?rn(o,e,n+1):o}const on=(t,e,n)=>n>e?e:n<t?t:n,an={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},sn={...an,transform:t=>on(0,1,t)},un={...an,default:1},cn=t=>Math.round(1e5*t)/1e5,ln=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,fn=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,dn=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function pn(t){return"string"==typeof t}const hn=t=>({test:e=>pn(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),yn=hn("deg"),vn=hn("%"),mn=hn("px"),gn=hn("vh"),bn=hn("vw"),wn={...vn,parse:t=>vn.parse(t)/100,transform:t=>vn.transform(100*t)},_n=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Sn=t=>t===an||t===mn,kn=(t,e)=>parseFloat(t.split(", ")[e]),xn=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return kn(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?kn(e[1],t):0}},An=new Set(["x","y","z"]),Tn=Re.filter((t=>!An.has(t)));const En={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:xn(4,13),y:xn(5,14)};En.translateX=En.x,En.translateY=En.y;const Pn=t=>e=>e.test(t),On=[an,mn,vn,yn,bn,gn,{test:t=>"auto"===t,parse:t=>t}],jn=t=>On.find(Pn(t)),Cn=new Set;let In=!1,Mn=!1;function Ln(){if(Mn){const t=Array.from(Cn).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return Tn.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var r;null===(r=t.getValue(e))||void 0===r||r.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}Mn=!1,In=!1,Cn.forEach((t=>t.complete())),Cn.clear()}function Nn(){Cn.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Mn=!0)}))}class Fn{constructor(t,e,n,r,o,i=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=r,this.element=o,this.isAsync=i}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Cn.add(this),In||(In=!0,je.read(Nn),je.resolveKeyframes(Ln))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let o=0;o<t.length;o++)if(null===t[o])if(0===o){const o=null==r?void 0:r.get(),i=t[t.length-1];if(void 0!==o)t[0]=o;else if(n&&e){const r=n.readValue(e,i);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=i),r&&void 0===o&&r.set(t[0])}else t[o]=t[o-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Cn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Cn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Rn=(t,e)=>n=>Boolean(pn(n)&&dn.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Vn=(t,e,n)=>r=>{if(!pn(r))return r;const[o,i,a,s]=r.match(ln);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},Dn={...an,transform:t=>Math.round((t=>on(0,255,t))(t))},Bn={test:Rn("rgb","red"),parse:Vn("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Dn.transform(t)+", "+Dn.transform(e)+", "+Dn.transform(n)+", "+cn(sn.transform(r))+")"};const $n={test:Rn("#"),parse:function(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:Bn.transform},Un={test:Rn("hsl","hue"),parse:Vn("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+vn.transform(cn(e))+", "+vn.transform(cn(n))+", "+cn(sn.transform(r))+")"},Hn={test:t=>Bn.test(t)||$n.test(t)||Un.test(t),parse:t=>Bn.test(t)?Bn.parse(t):Un.test(t)?Un.parse(t):$n.parse(t),transform:t=>pn(t)?t:t.hasOwnProperty("red")?Bn.transform(t):Un.transform(t)};const Gn="number",zn="color",Wn="var",qn="var(",Yn="${}",Xn=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Kn(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(Xn,(t=>(Hn.test(t)?(r.color.push(i),o.push(zn),n.push(Hn.parse(t))):t.startsWith(qn)?(r.var.push(i),o.push(Wn),n.push(t)):(r.number.push(i),o.push(Gn),n.push(parseFloat(t))),++i,Yn))).split(Yn);return{values:n,split:a,indexes:r,types:o}}function Zn(t){return Kn(t).values}function Qn(t){const{split:e,types:n}=Kn(t),r=e.length;return t=>{let o="";for(let i=0;i<r;i++)if(o+=e[i],void 0!==t[i]){const e=n[i];o+=e===Gn?cn(t[i]):e===zn?Hn.transform(t[i]):t[i]}return o}}const Jn=t=>"number"==typeof t?0:t;const tr={test:function(t){var e,n;return isNaN(t)&&pn(t)&&((null===(e=t.match(ln))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(fn))||void 0===n?void 0:n.length)||0)>0},parse:Zn,createTransformer:Qn,getAnimatableNone:function(t){const e=Zn(t);return Qn(t)(e.map(Jn))}},er=new Set(["brightness","contrast","saturate","opacity"]);function nr(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(ln)||[];if(!r)return t;const o=n.replace(r,"");let i=er.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const rr=/\b([a-z-]*)\(.*?\)/gu,or={...tr,getAnimatableNone:t=>{const e=t.match(rr);return e?e.map(nr).join(" "):t}},ir={...an,transform:Math.round},ar={borderWidth:mn,borderTopWidth:mn,borderRightWidth:mn,borderBottomWidth:mn,borderLeftWidth:mn,borderRadius:mn,radius:mn,borderTopLeftRadius:mn,borderTopRightRadius:mn,borderBottomRightRadius:mn,borderBottomLeftRadius:mn,width:mn,maxWidth:mn,height:mn,maxHeight:mn,size:mn,top:mn,right:mn,bottom:mn,left:mn,padding:mn,paddingTop:mn,paddingRight:mn,paddingBottom:mn,paddingLeft:mn,margin:mn,marginTop:mn,marginRight:mn,marginBottom:mn,marginLeft:mn,rotate:yn,rotateX:yn,rotateY:yn,rotateZ:yn,scale:un,scaleX:un,scaleY:un,scaleZ:un,skew:yn,skewX:yn,skewY:yn,distance:mn,translateX:mn,translateY:mn,translateZ:mn,x:mn,y:mn,z:mn,perspective:mn,transformPerspective:mn,opacity:sn,originX:wn,originY:wn,originZ:mn,zIndex:ir,backgroundPositionX:mn,backgroundPositionY:mn,fillOpacity:sn,strokeOpacity:sn,numOctaves:ir},sr={...ar,color:Hn,backgroundColor:Hn,outlineColor:Hn,fill:Hn,stroke:Hn,borderColor:Hn,borderTopColor:Hn,borderRightColor:Hn,borderBottomColor:Hn,borderLeftColor:Hn,filter:or,WebkitFilter:or},ur=t=>sr[t];function cr(t,e){let n=ur(t);return n!==or&&(n=tr),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const lr=new Set(["auto","none","0"]);class fr extends Fn{constructor(t,e,n,r,o){super(t,e,n,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let r=t[n];if("string"==typeof r&&(r=r.trim(),tn(r))){const o=rn(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!_n.has(n)||2!==t.length)return;const[r,o]=t,i=jn(r),a=jn(o);if(i!==a)if(Sn(i)&&Sn(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(r=t[e])?0===r:null===r||"none"===r||"0"===r||Xe(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,o=0;for(;o<t.length&&!r;){const e=t[o];"string"==typeof e&&!lr.has(e)&&Kn(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=cr(n,r)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=En[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const r=e[e.length-1];void 0!==r&&t.getValue(n,r).jump(r,!1)}measureEndState(){var t;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=En[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==a&&void 0===this.finalKeyframe&&(this.finalKeyframe=a),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach((([t,n])=>{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}let dr;function pr(){dr=void 0}const hr={now:()=>(void 0===dr&&hr.set(Ie.isProcessing||Ee?Ie.timestamp:performance.now()),dr),set:t=>{dr=t,queueMicrotask(pr)}},yr=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!tr.test(t)&&"0"!==t||t.startsWith("url(")));class vr{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:i="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=hr.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:o,repeatType:i,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Nn(),Ln()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=hr.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!function(t,e,n,r){const o=t[0];if(null===o)return!1;if("display"===e||"visibility"===e)return!0;const i=t[t.length-1],a=yr(o,e),s=yr(i,e);return Se(a===s,`You are trying to animate ${e} from "${o}" to "${i}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${i} via the \`style\` property.`),!(!a||!s)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||"spring"===n&&r)}(t,n,r,o)){if(We||!i)return null==s||s(Ye(t,this.options,e)),null==a||a(),void this.resolveFinishedPromise();this.options.duration=0}const c=this.initPlayback(t,e);!1!==c&&(this._resolved={keyframes:t,finalKeyframe:e,...c},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function mr(t,e){return e?t*(1e3/e):0}const gr=5;function br(t,e,n){const r=Math.max(e-gr,0);return mr(n-t(r),e-r)}const wr=.001,_r=.01,Sr=10,kr=.05,xr=1;function Ar({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;Se(t<=De(Sr),"Spring duration must be 10 seconds or less");let a=1-e;a=on(kr,xr,a),t=on(_r,Sr,Be(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=Er(e,a),u=Math.exp(-o);return wr-i/s*u},i=e=>{const r=e*a*t,i=r*n+n,s=Math.pow(a,2)*Math.pow(e,2)*t,u=Math.exp(-r),c=Er(Math.pow(e,2),a);return(-o(e)+wr>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-wr,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<Tr;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=De(t),isNaN(s))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(s,2)*r;return{stiffness:e,damping:2*a*Math.sqrt(r*e),duration:t}}}const Tr=12;function Er(t,e){return t*Math.sqrt(1-e*e)}const Pr=["duration","bounce"],Or=["stiffness","damping","mass"];function jr(t,e){return e.some((e=>void 0!==t[e]))}function Cr({keyframes:t,restDelta:e,restSpeed:n,...r}){const o=t[0],i=t[t.length-1],a={done:!1,value:o},{stiffness:s,damping:u,mass:c,duration:l,velocity:f,isResolvedFromDuration:d}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!jr(t,Or)&&jr(t,Pr)){const n=Ar(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-Be(r.velocity||0)}),p=f||0,h=u/(2*Math.sqrt(s*c)),y=i-o,v=Be(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),h<1){const t=Er(v,h);g=e=>{const n=Math.exp(-h*v*e);return i-n*((p+h*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===h)g=t=>i-Math.exp(-v*t)*(y+(p+v*y)*t);else{const t=v*Math.sqrt(h*h-1);g=e=>{const n=Math.exp(-h*v*e),r=Math.min(t*e,300);return i-n*((p+h*v*y)*Math.sinh(r)+t*y*Math.cosh(r))/t}}return{calculatedDuration:d&&l||null,next:t=>{const r=g(t);if(d)a.done=t>=l;else{let o=0;h<1&&(o=0===t?De(p):br(g,t,r));const s=Math.abs(o)<=n,u=Math.abs(i-r)<=e;a.done=s&&u}return a.value=a.done?i:r,a}}}function Ir({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:u,restDelta:c=.5,restSpeed:l}){const f=t[0],d={done:!1,value:f},p=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let h=n*e;const y=f+h,v=void 0===a?y:a(y);v!==y&&(h=v-f);const m=t=>-h*Math.exp(-t/r),g=t=>v+m(t),b=t=>{const e=m(t),n=g(t);d.done=Math.abs(e)<=c,d.value=d.done?v:n};let w,_;const S=t=>{var e;(e=d.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,_=Cr({keyframes:[d.value,p(d.value)],velocity:br(g,t,d.value),damping:o,stiffness:i,restDelta:c,restSpeed:l}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return _||void 0!==w||(e=!0,b(t),S(t)),void 0!==w&&t>=w?_.next(t-w):(!e&&b(t),d)}}}const Mr=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Lr=1e-7,Nr=12;function Fr(t,e,n,r){if(t===e&&n===r)return _e;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Mr(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>Lr&&++s<Nr);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Mr(o(t),e,r)}const Rr=Fr(.42,0,1,1),Vr=Fr(0,0,.58,1),Dr=Fr(.42,0,.58,1),Br=t=>Array.isArray(t)&&"number"!=typeof t[0],$r=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Ur=t=>e=>1-t(1-e),Hr=t=>1-Math.sin(Math.acos(t)),Gr=Ur(Hr),zr=$r(Hr),Wr=Fr(.33,1.53,.69,.99),qr=Ur(Wr),Yr={linear:_e,easeIn:Rr,easeInOut:Dr,easeOut:Vr,circIn:Hr,circInOut:zr,circOut:Gr,backIn:qr,backInOut:$r(qr),backOut:Wr,anticipate:t=>(t*=2)<1?.5*qr(t):.5*(2-Math.pow(2,-10*(t-1)))},Xr=t=>{if(Array.isArray(t)){ke(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return Fr(e,n,r,o)}return"string"==typeof t?(ke(void 0!==Yr[t],`Invalid easing type '${t}'`),Yr[t]):t},Kr=(t,e)=>n=>e(t(n)),Zr=(...t)=>t.reduce(Kr),Qr=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},Jr=(t,e,n)=>t+(e-t)*n;function to(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function eo(t,e){return n=>n>0?e:t}const no=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},ro=[$n,Bn,Un];function oo(t){const e=(n=t,ro.find((t=>t.test(n))));var n;if(Se(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let r=e.parse(t);return e===Un&&(r=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,i=0,a=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,s=2*n-r;o=to(s,r,t+1/3),i=to(s,r,t),a=to(s,r,t-1/3)}else o=i=a=n;return{red:Math.round(255*o),green:Math.round(255*i),blue:Math.round(255*a),alpha:r}}(r)),r}const io=(t,e)=>{const n=oo(t),r=oo(e);if(!n||!r)return eo(t,e);const o={...n};return t=>(o.red=no(n.red,r.red,t),o.green=no(n.green,r.green,t),o.blue=no(n.blue,r.blue,t),o.alpha=Jr(n.alpha,r.alpha,t),Bn.transform(o))},ao=new Set(["none","hidden"]);function so(t,e){return n=>Jr(t,e,n)}function uo(t){return"number"==typeof t?so:"string"==typeof t?tn(t)?eo:Hn.test(t)?io:fo:Array.isArray(t)?co:"object"==typeof t?Hn.test(t)?io:lo:eo}function co(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>uo(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function lo(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=uo(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const fo=(t,e)=>{const n=tr.createTransformer(e),r=Kn(t),o=Kn(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?ao.has(t)&&!o.values.length||ao.has(e)&&!r.values.length?function(t,e){return ao.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Zr(co(function(t,e){var n;const r=[],o={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],s=t.indexes[a][o[a]],u=null!==(n=t.values[s])&&void 0!==n?n:0;r[i]=u,o[a]++}return r}(r,o),o.values),n):(Se(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),eo(t,e))};function po(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Jr(t,e,n);return uo(t)(t,e)}function ho(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(ke(i===e.length,"Both input and output ranges must be the same length"),1===i)return()=>e[0];if(2===i&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const r=[],o=n||po,i=t.length-1;for(let n=0;n<i;n++){let i=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||_e:e;i=Zr(t,i)}r.push(i)}return r}(e,r,o),s=a.length,u=e=>{let n=0;if(s>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=Qr(t[n],t[n+1],e);return a[n](r)};return n?e=>u(on(t[0],t[i-1],e)):u}function yo(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=Qr(0,e,r);t.push(Jr(n,1,o))}}function vo(t){const e=[0];return yo(e,t.length-1),e}function mo({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=Br(r)?r.map(Xr):Xr(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:vo(e),t),s=ho(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||Dr)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const go=2e4;function bo(t){let e=0;let n=t.next(e);for(;!n.done&&e<go;)e+=50,n=t.next(e);return e>=go?1/0:e}const wo=t=>{const e=({timestamp:e})=>t(e);return{start:()=>je.update(e,!0),stop:()=>Ce(e),now:()=>Ie.isProcessing?Ie.timestamp:hr.now()}},_o={decay:Ir,inertia:Ir,tween:mo,keyframes:mo,spring:Cr},So=t=>t/100;class ko extends vr{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:r,keyframes:o}=this.options,i=(null==r?void 0:r.KeyframeResolver)||Fn;this.resolver=new i(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:o,velocity:i=0}=this.options,a=_o[e]||mo;let s,u;a!==mo&&"number"!=typeof t[0]&&(s=Zr(So,po(t[0],t[1])),t=[0,100]);const c=a({...this.options,keyframes:t});"mirror"===o&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-i})),null===c.calculatedDuration&&(c.calculatedDuration=bo(c));const{calculatedDuration:l}=c,f=l+r;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:s,calculatedDuration:l,resolvedDuration:f,totalDuration:f*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:o,mirroredGenerator:i,mapPercentToKeyframes:a,keyframes:s,calculatedDuration:u,totalDuration:c,resolvedDuration:l}=n;if(null===this.startTime)return o.next(0);const{delay:f,repeat:d,repeatType:p,repeatDelay:h,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-f*(this.speed>=0?1:-1),m=this.speed>=0?v<0:v>c;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let g=this.currentTime,b=o;if(d){const t=Math.min(this.currentTime,c)/l;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===p?(n=1-n,h&&(n-=h/l)):"mirror"===p&&(b=i)),g=on(0,1,n)*l}const w=m?{done:!1,value:s[0]}:b.next(g);a&&(w.value=a(w.value));let{done:_}=w;m||null===u||(_=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&_);return S&&void 0!==r&&(w.value=Ye(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?Be(t.calculatedDuration):0}get time(){return Be(this.currentTime)}set time(t){t=De(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=Be(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=wo,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const xo=new Set(["opacity","clipPath","filter","transform"]),Ao=t=>Array.isArray(t)&&"number"==typeof t[0];function To(t){return Boolean(!t||"string"==typeof t&&t in Po||Ao(t)||Array.isArray(t)&&t.every(To))}const Eo=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Po={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Eo([0,.65,.55,1]),circOut:Eo([.55,0,1,.45]),backIn:Eo([.31,.01,.66,-.59]),backOut:Eo([.33,1.53,.69,.99])};function Oo(t){return jo(t)||Po.easeOut}function jo(t){return t?Ao(t)?Eo(t):Array.isArray(t)?t.map(Oo):Po[t]:void 0}const Co=Le((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class Io extends vr{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new fr(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:a,motionValue:s,name:u,startTime:c}=this.options;if(!(null===(n=s.owner)||void 0===n?void 0:n.current))return!1;if(function(t){return"spring"===t.type||!To(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new ko({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const o=[];let i=0;for(;!r.done&&i<2e4;)r=n.sample(i),o.push(r.value),i+=10;return{times:void 0,keyframes:o,duration:i-10,ease:"linear"}}(t,c);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,o=l.times,i=l.ease,a="keyframes"}const l=function(t,e,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:a="loop",ease:s,times:u}={}){const c={[e]:n};u&&(c.offset=u);const l=jo(s);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(l.timeline=this.pendingTimeline,this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(Ye(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:l,duration:r,times:o,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return Be(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return Be(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=De(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return _e;const{animation:n}=e;n.timeline=t,n.onfinish=null}else this.pendingTimeline=t;return _e}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:r,type:o,ease:i,times:a}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:s,element:u,...c}=this.options,l=new ko({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=De(this.time);t.setWithVelocity(l.sample(f-10).value,l.sample(f).value,10)}const{onStop:s}=this.options;s&&s(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:i,type:a}=t;return Co()&&n&&xo.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const Mo=(t,e,n,r={},o,i,a)=>s=>{const u=ze(r,t)||{},c=u.delay||r.delay||0;let{elapsed:l=0}=r;l-=De(c);let f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-l,onUpdate:t=>{e.set(t),u.onUpdate&&u.onUpdate(t)},onComplete:()=>{s(),u.onComplete&&u.onComplete(),a&&a()},onStop:a,name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(u)||(f={...f,...Ge(t,f)}),f.duration&&(f.duration=De(f.duration)),f.repeatDelay&&(f.repeatDelay=De(f.repeatDelay)),void 0!==f.from&&(f.keyframes[0]=f.from);let d=!1;if((!1===f.type||0===f.duration&&!f.repeatDelay)&&(f.duration=0,0===f.delay&&(d=!0)),(We||Te)&&(d=!0,f.duration=0,f.delay=0),d&&!i&&void 0!==e.get()){const t=Ye(f.keyframes,u);if(void 0!==t)return je.update((()=>{f.onUpdate(t),f.onComplete()})),new Fe([])}return!i&&Io.supports(f)?new Io(f):new ko(f)},Lo=t=>Array.isArray(t),No=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Fo=t=>Lo(t)?t[t.length-1]||0:t;function Ro(t,e){-1===t.indexOf(e)&&t.push(e)}function Vo(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Do{constructor(){this.subscriptions=[]}add(t){return Ro(this.subscriptions,t),()=>Vo(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Bo={current:void 0};class $o{constructor(t,e={}){this.version="11.5.4",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=hr.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=hr.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new Do);const n=this.events[t].add(e);return"change"===t?()=>{n(),je.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return Bo.current&&Bo.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=hr.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return mr(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Uo(t,e){return new $o(t,e)}function Ho(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Go(t,e,n,r){if("function"==typeof e){const[o,i]=Ho(r);e=e(void 0!==n?n:t.custom,o,i)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[o,i]=Ho(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function zo(t,e,n){const r=t.getProps();return Go(r,e,void 0!==n?n:r.custom,t)}function Wo(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Uo(n))}const qo=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Yo="data-"+qo("framerAppearId");function Xo(t){return t.props[Yo]}function Ko(t){return Ve.has(t)?"transform":xo.has(t)?qo(t):void 0}class Zo extends $o{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(t){const e=Ko(t);if(!e)return;const n=this.counts.get(e)||0;this.counts.set(e,n+1),0===n&&(this.output.push(e),this.update());let r=!1;return()=>{if(r)return;r=!0;const t=this.counts.get(e)-1;this.counts.set(e,t),0===t&&(Vo(this.output,e),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}const Qo=t=>Boolean(t&&t.getVelocity);function Jo(t,e){var n;if(!t.applyWillChange)return;let r=t.getValue("willChange");return r||(null===(n=t.props.style)||void 0===n?void 0:n.willChange)||(r=new Zo("auto"),t.addValue("willChange",r)),o=r,Boolean(Qo(o)&&o.add)?r.add(e):void 0;var o}function ti({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function ei(t,e,{delay:n=0,transitionOverride:r,type:o}={}){var i;let{transition:a=t.getDefaultTransition(),transitionEnd:s,...u}=e;r&&(a=r);const c=[],l=o&&t.animationState&&t.animationState.getState()[o];for(const e in u){const r=t.getValue(e,null!==(i=t.latestValues[e])&&void 0!==i?i:null),o=u[e];if(void 0===o||l&&ti(l,e))continue;const s={delay:n,...ze(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=Xo(t);if(n){const t=window.MotionHandoffAnimation(n,e,je);null!==t&&(s.startTime=t,f=!0)}}r.start(Mo(e,r,o,t.shouldReduceMotion&&Ve.has(e)?{type:!1}:s,t,f,Jo(t,e)));const d=r.animation;d&&c.push(d)}return s&&Promise.all(c).then((()=>{je.update((()=>{s&&function(t,e){const n=zo(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)Wo(t,e,Fo(i[e]))}(t,s)}))})),c}const ni={};function ri(t,{layout:e,layoutId:n}){return Ve.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!ni[t]||"opacity"===t)}function oi(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(Qo(o[a])||e.style&&Qo(e.style[a])||ri(a,t)||void 0!==(null===(r=null==n?void 0:n.getValue(a))||void 0===r?void 0:r.liveStyle))&&(i[a]=o[a]);return n&&o&&"string"==typeof o.willChange&&(n.applyWillChange=!1),i}function ii(t,e,n){const r=oi(t,e,n);for(const n in t)if(Qo(t[n])||Qo(e[n])){r[-1!==Re.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const ai="undefined"!=typeof window,si={current:null},ui={current:!1};function ci(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function li(t){return"string"==typeof t||Array.isArray(t)}const fi=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],di=["initial",...fi];function pi(t){return ci(t.animate)||di.some((e=>li(t[e])))}function hi(t){return Boolean(pi(t)||t.variants)}const yi={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},vi={};for(const t in yi)vi[t]={isEnabled:e=>yi[t].some((t=>!!e[t]))};const mi=[...On,Hn,tr],gi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),bi=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],wi=di.length;class _i{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:o,visualState:i},a={}){this.applyWillChange=!1,this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Fn,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,je.render(this.render,!1,!0))};const{latestValues:s,renderState:u}=i;this.latestValues=s,this.baseTarget={...s},this.initialValues=e.initial?{...s}:{},this.renderState=u,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=pi(e),this.isVariantNode=hi(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:c,...l}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in l){const e=l[t];void 0!==s[t]&&Qo(e)&&e.set(s[t],!1)}}mount(t){this.current=t,Ae.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),ui.current||function(){if(ui.current=!0,ai)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>si.current=t.matches;t.addListener(e),e()}else si.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||si.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Ae.delete(this.current),this.projection&&this.projection.unmount(),Ce(this.notifyUpdate),Ce(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=Ve.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&je.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),o=e.on("renderRequest",this.scheduleRender);let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),o(),i&&i(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in vi){const e=vi[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<bi.length;e++){const n=bi[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){for(const r in e){const o=e[r],i=n[r];if(Qo(o))t.addValue(r,o);else if(Qo(i))t.addValue(r,Uo(o,{owner:t}));else if(i!==o)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(o):e.hasAnimated||e.set(o)}else{const e=t.getStaticValue(r);t.addValue(r,Uo(void 0!==e?e:o,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const e={};for(let t=0;t<wi;t++){const n=di[t],r=this.props[n];(li(r)||!1===r)&&(e[n]=r)}return e}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Uo(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let r=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var o;return null!=r&&("string"==typeof r&&(Ke(r)||Xe(r))?r=parseFloat(r):(o=r,!mi.find(Pn(o))&&tr.test(e)&&(r=cr(t,e))),this.setBaseTarget(t,Qo(r)?r.get():r)),Qo(r)?r.get():r}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const o=Go(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);o&&(r=o[t])}if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,t);return void 0===o||Qo(o)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:o}on(t,e){return this.events[t]||(this.events[t]=new Do),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Si extends _i{constructor(){super(...arguments),this.KeyframeResolver=fr}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}}const ki=(t,e)=>e&&"number"==typeof t?e.transform(t):t,xi={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Ai=Re.length;function Ti(t,e,n){const{style:r,vars:o,transformOrigin:i}=t;let a=!1,s=!1;for(const t in e){const n=e[t];if(Ve.has(t))a=!0;else if(Qe(t))o[t]=n;else{const e=ki(n,ar[t]);t.startsWith("origin")?(s=!0,i[t]=e):r[t]=e}}if(e.transform||(a||n?r.transform=function(t,e,n){let r="",o=!0;for(let i=0;i<Ai;i++){const a=Re[i],s=t[a];if(void 0===s)continue;let u=!0;if(u="number"==typeof s?s===(a.startsWith("scale")?1:0):0===parseFloat(s),!u||n){const t=ki(s,ar[a]);u||(o=!1,r+=`${xi[a]||a}(${t}) `),n&&(e[a]=t)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),s){const{originX:t="50%",originY:e="50%",originZ:n=0}=i;r.transformOrigin=`${t} ${e} ${n}`}}function Ei(t,e,n){return"string"==typeof t?t:mn.transform(e+n*t)}const Pi={offset:"stroke-dashoffset",array:"stroke-dasharray"},Oi={offset:"strokeDashoffset",array:"strokeDasharray"};function ji(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(Ti(t,c,f),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:d,style:p,dimensions:h}=t;d.transform&&(h&&(p.transform=d.transform),delete d.transform),h&&(void 0!==o||void 0!==i||p.transform)&&(p.transformOrigin=function(t,e,n){return`${Ei(e,t.x,t.width)} ${Ei(n,t.y,t.height)}`}(h,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(d.x=e),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==a&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?Pi:Oi;t[i.offset]=mn.transform(-r);const a=mn.transform(e),s=mn.transform(n);t[i.array]=`${a} ${s}`}(d,a,s,u,!1)}const Ci=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Ii(t,{style:e,vars:n},r,o){Object.assign(t.style,e,o&&o.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}function Mi(t,e,n,r){Ii(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Ci.has(n)?n:qo(n),e.attrs[n])}const Li=t=>"string"==typeof t&&"svg"===t.toLowerCase();class Ni extends Si{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=gi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Ve.has(e)){const t=ur(e);return t&&t.default||0}return e=Ci.has(e)?e:qo(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return ii(t,e,n)}build(t,e,n){ji(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Mi(t,e,0,r)}mount(t){this.isSVGTag=Li(t.tagName),super.mount(t)}}function Fi(t,e){return function({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}class Ri extends Si{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=Ii}readValueFromInstance(t,e){if(Ve.has(e)){const t=ur(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(Qe(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Fi(t,e)}build(t,e,n){Ti(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return oi(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Qo(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}function Vi(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=function(t){return t instanceof SVGElement&&"svg"!==t.tagName}(t)?new Ni(e):new Ri(e);n.mount(t),Ae.set(t,n)}function Di(t,e,n){const r=Qo(t)?t:Uo(t);return r.start(Mo("",r,e,n)),r.animation}function Bi(t,e=100){const n=Cr({keyframes:[0,e],...t}),r=Math.min(bo(n),go);return{type:"keyframes",ease:t=>n.next(r*t).value/e,duration:Be(r)}}function $i(t,e,n,r){var o;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(o=r.get(e))&&void 0!==o?o:t}const Ui=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t};function Hi(t,e){return Br(t)?t[Ui(0,t.length,e)]:t}function Gi(t,e,n,r,o,i){!function(t,e,n){for(let r=0;r<t.length;r++){const o=t[r];o.at>e&&o.at<n&&(Vo(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:Jr(o,i,r[a]),easing:Hi(n,a)})}function zi(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const Wi="easeInOut";function qi(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function Yi(t,e){return e[t]||(e[t]=[]),e[t]}function Xi(t){return Array.isArray(t)?t:[t]}function Ki(t,e){return t[e]?{...t,...t[e]}:{...t}}const Zi=t=>"number"==typeof t,Qi=t=>t.every(Zi);function Ji(t,e,n,r){const o=xe(t,r),i=o.length;ke(Boolean(i),"No valid element provided.");const a=[];for(let t=0;t<i;t++){const r=o[t];Ae.has(r)||Vi(r);const s=Ae.get(r),u={...n};"function"==typeof u.delay&&(u.delay=u.delay(t,i)),a.push(...ei(s,{...e,transition:u},{}))}return new Fe(a)}function ta(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r){const o=e.duration||.3,i=new Map,a=new Map,s={},u=new Map;let c=0,l=0,f=0;for(let n=0;n<t.length;n++){const i=t[n];if("string"==typeof i){u.set(i,l);continue}if(!Array.isArray(i)){u.set(i.name,$i(l,i.at,c,u));continue}let[d,p,h={}]=i;void 0!==h.at&&(l=$i(l,h.at,c,u));let y=0;const v=(t,n,r,i=0,a=0)=>{const s=Xi(t),{delay:u=0,times:c=vo(s),type:d="keyframes",...p}=n;let{ease:h=e.ease||"easeOut",duration:v}=n;const m="function"==typeof u?u(i,a):u,g=s.length;if(g<=2&&"spring"===d){let t=100;if(2===g&&Qi(s)){const e=s[1]-s[0];t=Math.abs(e)}const e={...p};void 0!==v&&(e.duration=De(v));const n=Bi(e,t);h=n.ease,v=n.duration}null!=v||(v=o);const b=l+m,w=b+v;1===c.length&&0===c[0]&&(c[1]=1);const _=c.length-s.length;_>0&&yo(c,_),1===s.length&&s.unshift(null),Gi(r,s,h,c,b,w),y=Math.max(m+v,y),f=Math.max(w,f)};if(Qo(d))v(p,h,Yi("default",qi(d,a)));else{const t=xe(d,r,s),e=t.length;for(let n=0;n<e;n++){const r=qi(t[n],a);for(const t in p)v(p[t],Ki(h,t),Yi(t,r),n,e)}}c=l,l+=y}return a.forEach(((t,r)=>{for(const o in t){const a=t[o];a.sort(zi);const s=[],u=[],c=[];for(let t=0;t<a.length;t++){const{at:e,value:n,easing:r}=a[t];s.push(n),u.push(Qr(0,f,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(Wi)),1!==u[u.length-1]&&(u.push(1),s.push(null)),i.has(r)||i.set(r,{keyframes:{},transition:{}});const l=i.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:f,ease:c,times:u,...n}}})),i}(t,e,n);return o.forEach((({keyframes:t,transition:e},n)=>{let o;o=Qo(n)?Di(n,t.default,e.default):Ji(n,t,e),r.push(o)})),new Fe(r)}const ea=function(t,e,n){let r;var o;return o=t,r=Array.isArray(o)&&Array.isArray(o[0])?ta(t,e,na):function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?Ji(t,e,n,na):Di(t,e,n),na&&na.animations.push(r),r};var na;function ra(t){return ra="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},ra(t)}function oa(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */oa=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==ra(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value: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,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function P(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 O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(ra(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.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,v):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),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ia(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=sa(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function aa(t){return function(t){if(Array.isArray(t))return ua(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||sa(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 sa(t,e){if(t){if("string"==typeof t)return ua(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ua(t,e):void 0}}function ua(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ca(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,fa(r.key),r)}}function la(t,e,n){return(e=fa(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fa(t){var e=function(t,e){if("object"!=ra(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ra(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ra(e)?e:e+""}var da=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},pa=la(la(la({},ce.left,"25.33%"),ce.center,"50%"),ce.right,"75.66%"),ha=function(){function t(e,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequences=[],this.control=null,this.transformers={},Array.isArray(e)){var r;(r=this.sequences).push.apply(r,aa(e)),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions,n||{})}else{var o=e,i=n||t.defaultOptions;this.sequences.push({props:o,options:i||{}}),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions)}}return function(t,e,n){return e&&ca(t.prototype,e),n&&ca(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r,o){var i=e.scope,a=e.overwrites;return da(this,void 0,void 0,oa().mark((function e(){var s=this;return oa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=p(r,{}),e.abrupt("return",new Promise((function(e){da(s,void 0,void 0,oa().mark((function s(){var u,c,l,f,d=this;return oa().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||(e(),o&&o(r)),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=ia(this.sequences),s.prev=4,f=oa().mark((function e(){var o,s,u,c,f,h;return oa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=l.value,s=o.props,u=o.options,c=p({},d.propToCSS(n,r)),i.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=i.current,Object.assign(f.style,c),r=t.mergeState(r,s),h=ea(f,d.propToCSS(n,r,a),d.optionsToFramerMotionOptions(u)||{}),d.setControl(h),!1===(null==u?void 0:u.sync)){e.next=16;break}return e.next=12,new Promise((function(t){return h.then((function(){return t()}))}));case 12:Object.assign(f.style,d.propToCSS(n,r,a)),d.setControl(null),e.next=17;break;case 16:h.then((function(){Object.assign(f.style,d.propToCSS(n,r,a)),d.setControl(null)}));case 17:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){s.next=11;break}return s.delegateYield(f(),"t0",9);case 9:s.next=7;break;case 11:s.next=16;break;case 13:s.prev=13,s.t1=s.catch(4),c.e(s.t1);case 16:return s.prev=16,c.f(),s.finish(16);case 19:u++,s.next=2;break;case 22:return s.next=24,b(2);case 24:this.setControl(null),this.sequenceOptions.sync&&(e(),o&&o(r));case 26:case"end":return s.stop()}}),s,this,[[4,13,16,19]])})))})));case 2:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return"scale"in n?{width:"".concat(100*n.scale,"%")}:{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}}},c={};for(var l in c.transform=this.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"propToCSSTransform",value:function(t,e){var n;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var r=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},o=r.invertY,i=r.invertX;return["translate(".concat(i?"":"-","50%, ").concat(o?"":"-","50%)"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)")].filter(Boolean).join(" ")}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],[{key:"isPosition",value:function(t){return ge.isCommonPositionType(t)||be.isCoord2DPosition(t)||we.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return me.D2PositionToCSS(t.toCSS(),n,e)}},{key:"backgroundToCSS",value:function(t){return null==t?{}:ms.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:v(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?me.mergePosition(me.tryParsePosition(t),me.tryParsePosition(e)):me.toCoord2D(me.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},p(t,e)),{position:n})}}])}();function ya(t){return ya="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},ya(t)}function va(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ma(r.key),r)}}function ma(t){var e=function(t,e){if("object"!=ya(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ya(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ya(e)?e:e+""}function ga(t,e,n){return e=wa(e),function(t,e){if(e&&("object"==ya(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)}(t,ba()?Reflect.construct(e,n||[],wa(t).constructor):e.apply(t,n))}function ba(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ba=function(){return!!t})()}function wa(t){return wa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wa(t)}function _a(t,e){return _a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_a(t,e)}ha.defaultSequenceOptions={sync:!0,repeat:1},ha.defaultOptions={duration:0,ease:"linear"},ha.CommonImagePositionMap=pa;var Sa=function(t){function e(t,n){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=ga(this,e,[vt.IdPrefixes.Image])).events=new m,r.ref=void 0,"string"==typeof t?(r.name=t,r.config=p(e.defaultConfig,n||{}),r.config.position&&(r.config.position=me.tryParsePosition(r.config.position))):(r.name="",r.config=p(e.defaultConfig,t),r.config.position&&(r.config.position=me.tryParsePosition(r.config.position))),r.state=p({},r.config),r.actions=[],r.checkConfig(),r}return 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&&_a(t,e)}(e,t),function(t,e,n){return e&&va(t.prototype,e),n&&va(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this._init()}},{key:"checkConfig",value:function(){if(!this.config.src)throw new Error("Image src is required");if(!ha.isPosition(this.config.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");return this}},{key:"setSrc",value:function(t,e){if(e){var n=e.copy();n.setSrc(ms.srcToString(t)),this._transitionSrc(n)}var r=new ts(this,ts.ActionTypes.setSrc,new ue(qt.getIdManager().getStringId()).setContent(["string"==typeof t?t:ms.staticImageDataToSrc(t)]));return this.actions.push(r),this}},{key:"applyTransform",value:function(t){var e=new ts(this,ts.ActionTypes.applyTransform,new ue(qt.getIdManager().getStringId()).setContent([void 0,t,g()]));return this.actions.push(e),this}},{key:"show",value:function(t){var e=t instanceof ha?t:new ha([{props:{opacity:1},options:t||{}}]),n=new ts(this,ts.ActionTypes.show,new ue(qt.getIdManager().getStringId()).setContent([void 0,e]));return this.actions.push(n),this}},{key:"hide",value:function(t){var e=new ts(this,ts.ActionTypes.hide,new ue(qt.getIdManager().getStringId()).setContent([void 0,t instanceof ha?t:new ha([{props:{opacity:0},options:t||{}}])]));return this.actions.push(e),this}},{key:"toTransform",value:function(){return new ha(this.state,{duration:0})}},{key:"setScope",value:function(t){return this.ref=t,this}},{key:"getScope",value:function(){return this.ref}},{key:"copy",value:function(){return new e(this.name,this.config)}},{key:"toData",value:function(){return this.state.disposed||w(this.state,this.config)?null:{state:p({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=p(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_setTransition",value:function(t){return this.actions.push(new ts(this,ts.ActionTypes.setTransition,new ue(qt.getIdManager().getStringId()).setContent([t]))),this}},{key:"_applyTransition",value:function(t){return this.actions.push(new ts(this,"image:applyTransition",new ue(qt.getIdManager().getStringId()).setContent([t]))),this}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._setTransition(e)._applyTransition(e),this}},{key:"_dispose",value:function(){return this.actions.push(new ts(this,ts.ActionTypes.dispose,new ue(qt.getIdManager().getStringId()))),this}},{key:"_init",value:function(t){return this.actions.push(new ts(this,ts.ActionTypes.init,new ue(qt.getIdManager().getStringId()).setContent([t]))),this}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return me.serializePosition(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}},{key:"deserializeImageState",value:function(t){var e={position:function(t){return me.toCoord2D(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}}])}(vt);function ka(t){return ka="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},ka(t)}function xa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Aa(r.key),r)}}function Aa(t){var e=function(t,e){if("object"!=ka(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ka(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ka(e)?e:e+""}Sa.EventTypes={"event:image.show":"event:image.show","event:image.hide":"event:image.hide","event:image.init":"event:image.init","event:image.applyTransform":"event:image.applyTransform","event:image.mount":"event:image.mount","event:image.unmount":"event:image.unmount","event:image.ready":"event:image.ready","event:image.elementLoaded":"event:image.elementLoaded","event:image.setTransition":"event:image.setTransition"},Sa.defaultConfig={src:"",display:!1,position:new ge(ae.Center),scale:1,rotation:0,opacity:0},Sa.ImagePosition=ce;var Ta=function(){return function(t,e,n){return e&&xa(t.prototype,e),n&&xa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.callee=e,this.type=n,this.contentNode=r,this.__stack=g(4,4),this._id=qt.getIdManager().prefix("action",qt.getIdManager().getStringId(),"-")}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode}}},{key:"getId",value:function(){return this._id}},{key:"getFutureActions",value:function(){var t=this.contentNode.child;return t&&t.action?[t.action]:[]}}])}();Ta.ActionTypes={action:"action"};var Ea={say:"character:say",action:"character:action"},Pa={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",setTransition:"scene:setTransition",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform"},Oa={action:"image:action",setSrc:"image:setSrc",setPosition:"image:setPosition",show:"image:show",hide:"image:hide",applyTransform:"image:applyTransform",init:"image:init",dispose:"image:dispose",setTransition:"image:setTransition",applyTransition:"image:applyTransition"},ja={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},Ca={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat"};function Ia(t){return Ia="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},Ia(t)}function Ma(t){return function(t){if(Array.isArray(t))return Ra(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Fa(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 La(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */La=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Ia(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value: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,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function P(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 O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Ia(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.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,v):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),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Na(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||Fa(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 Fa(t,e){if(t){if("string"==typeof t)return Ra(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ra(t,e):void 0}}function Ra(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Va(t,e,n,r){var o=Da(Wa(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Da(){return Da="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Wa(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Da.apply(null,arguments)}function Ba(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ha(r.key),r)}}function Ua(t,e,n){return e&&$a(t.prototype,e),n&&$a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ha(t){var e=function(t,e){if("object"!=Ia(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ia(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ia(e)?e:e+""}function Ga(t,e,n){return e=Wa(e),function(t,e){if(e&&("object"==Ia(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)}(t,za()?Reflect.construct(e,n||[],Wa(t).constructor):e.apply(t,n))}function za(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(za=function(){return!!t})()}function Wa(t){return Wa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wa(t)}function qa(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&&Ya(t,e)}function Ya(t,e){return Ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ya(t,e)}var Xa=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Ka=function(t){function e(t,n,r){var o;return Ba(this,e),(o=Ga(this,e,[t,n,r])).callee=t,o.contentNode.action=o,o}return qa(e,t),Ua(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}}])}(Ta),Za=function(t){function e(){return Ba(this,e),Ga(this,e,arguments)}return qa(e,t),Ua(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Ea.say){var r=new h((function(t){return t})).registerSkipController(new S((function(){return{type:n.type,node:n.contentNode.getChild()}}))),o=this.contentNode.getContent();return t.createText(this.contentNode.id,o,(function(){r.resolve({type:n.type,node:n.contentNode.getChild()})})),r}return Va(e,"executeAction",this,3)([t])}}])}(Ka);Za.ActionTypes=Ea;var Qa=function(t){function e(){return Ba(this,e),Ga(this,e,arguments)}return qa(e,t),Ua(e,[{key:"executeAction",value:function(t){var n,r,o=this;if(this.type===Pa.action)return Va(e,"executeAction",this,3)([t]);if(this.type===Pa.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],Va(e,"executeAction",this,3)([t]);if(this.type===Pa.sleep){var i=new h((function(t){return t})),a=this.contentNode.getContent();return new Promise((function(t){"number"==typeof a?setTimeout((function(){t()}),a):h.isAwaitable(a)?a.then(t):null==a||a.then(t)})).then((function(){i.resolve({type:o.type,node:o.contentNode.child}),t.stage.next()})),i}if(this.type===Pa.setTransition)return this.callee.events.emit("event:scene.setTransition",this.contentNode.getContent()[0]),Va(e,"executeAction",this,3)([t]);if(this.type===Pa.applyTransition){var s=(new h).registerSkipController(new S((function(){return{type:o.type,node:o.contentNode.getChild()}})));return this.contentNode.getContent()[0].start((function(){s.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),s}if(this.type===Pa.init){if(this.callee._liveState.active)return Va(e,"executeAction",this,3)([t]);this.callee._liveState.active=!0;var u=new h((function(t){return t}));return t.registerSrcManager(this.callee.srcManager).addScene(this.callee),this.callee.events.once("event:scene.unmount",(function(){t.offSrcManager(o.callee.srcManager)})),this.callee.events.once("event:scene.mount",(function(){o.callee.state.backgroundMusic&&(os.initSound(t,o.callee.state.backgroundMusic),o.callee.events.emit("event:scene.setBackgroundMusic",o.callee.state.backgroundMusic,o.callee.config.backgroundMusicFade))})),this.callee.events.once("event:scene.imageLoaded",(function(){var e=o.callee._toTransform();o.callee.events.any("event:scene.initTransform",e).then((function(){u.resolve({type:o.type,node:o.contentNode.child}),t.stage.next()}))})),u}if(this.type===Pa.exit){this.callee._liveState.active=!1,t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var c=new h((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){c.resolve({type:o.type,node:o.contentNode.child}),t.stage.next()})),c}if(this.type===Pa.jumpTo){var l=this.contentNode.getContent()[0],f=this.contentNode,d=null===(r=null===(n=l.getActions())||void 0===n?void 0:n[0])||void 0===r?void 0:r.contentNode;return d&&f.addChild(d),Va(e,"executeAction",this,3)([t])}if(this.type===Pa.setBackgroundMusic){var p=Na(this.contentNode.getContent(),2),y=p[0],v=p[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),Va(e,"executeAction",this,3)([t])}if(this.type===Pa.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),Va(e,"executeAction",this,3)([t]);if(this.type===Pa.applyTransform){var m=Na(this.contentNode.getContent(),1)[0],g=new h((function(t){return t})).registerSkipController(new S((function(){return{type:o.type,node:o.contentNode.getChild()}})));return this.callee.events.any("event:scene.applyTransform",m).then((function(){g.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,e;if(this.type===Pa.jumpTo)return null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.getActions();var n=null===(e=this.contentNode.child)||void 0===e?void 0:e.action;return n?[n]:[]}}])}(Ka);Qa.ActionTypes=Pa;var Ja=function(t){function e(){return Ba(this,e),Ga(this,e,arguments)}return qa(e,t),Ua(e)}(Ka);Ja.ActionTypes={action:"story:action"};var ts=function(t){function e(){return Ba(this,e),Ga(this,e,arguments)}return qa(e,t),Ua(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Oa.init){var r=t.findElementByImage(this.callee);r&&t.disposeImage(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createImage(this.callee,o);var i=new h((function(t){return t}));return this.callee.events.once("event:image.mount",(function(){return Xa(n,void 0,void 0,La().mark((function e(){var n;return La().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=this.callee.getScope())||void 0===n?void 0:n.current){e.next=3;break}return e.next=3,this.callee.events.any(Sa.EventTypes["event:image.elementLoaded"]);case 3:return e.next=5,this.callee.events.any("event:image.init");case 5:i.resolve({type:this.type,node:this.contentNode.child}),t.stage.next();case 7:case"end":return e.stop()}}),e,this)})))})),i}if(this.type===Oa.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.stage.forceUpdate(),Va(e,"executeAction",this,3)([t]);if([Oa.show,Oa.hide,Oa.applyTransform].includes(this.type)){var a=new h((function(t){return t})).registerSkipController(new S((function(){return n.type===Oa.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}}))),s=this.contentNode.getContent()[1];return this.type===Oa.show&&(this.callee.state.display=!0,t.stage.forceUpdate()),t.animateImage(Sa.EventTypes["event:image.applyTransform"],this.callee,[s],(function(){var t;n.type===Oa.hide&&(n.callee.state.display=!1),a.resolve({type:n.type,node:(null===(t=n.contentNode)||void 0===t?void 0:t.child)||null})})),a}if(this.type===Oa.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),Va(e,"executeAction",this,3)([t]);if(this.type===Oa.setTransition)return this.callee.events.emit("event:image.setTransition",this.contentNode.getContent()[0]),Va(e,"executeAction",this,3)([t]);if(this.type===Oa.applyTransition){var u=new h((function(t){return t})).registerSkipController(new S((function(){return n.type===Oa.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}})));return this.contentNode.getContent()[0].start((function(){u.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),u}throw Va(e,"unknownType",this,3)([])}}])}(Ka);ts.ActionTypes=Oa;var es=function(t){function e(){return Ba(this,e),Ga(this,e,arguments)}return qa(e,t),Ua(e,[{key:"executeAction",value:function(t){var e,n,r=this.callee.evaluate(this.contentNode.getContent(),{gameState:t});return null===(e=null==r?void 0:r[r.length-1])||void 0===e||e.contentNode.addChild(this.contentNode.getChild()),this.contentNode.addChild((null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.contentNode)||null),{type:this.type,node:this.contentNode}}},{key:"getFutureActions",value:function(){return[].concat(Ma(this.callee._getFutureActions()),Ma(Va(e,"getFutureActions",this,3)([])))}}])}(Ka);es.ActionTypes={action:"condition:action"};var ns=function(t){function e(){return Ba(this,e),Ga(this,e,arguments)}return qa(e,t),Ua(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),{type:this.type,node:this.contentNode}}}])}(Ka);ns.ActionTypes={action:"script:action"};var rs=function(t){function e(){return Ba(this,e),Ga(this,e,arguments)}return qa(e,t),Ua(e,[{key:"executeAction",value:function(t){var e=this,n=new h((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent();return[].concat(Ma(this.callee._getFutureActions(t.choices)),Ma(Va(e,"getFutureActions",this,3)([])))}}])}(Ka);rs.ActionTypes={action:"menu:action"};var os=function(t){function e(){return Ba(this,e),Ga(this,e,arguments)}return qa(e,t),Ua(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===ja.play){if(e.initSound(t,this.callee),!this.callee.$getHowl())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var r=new h((function(t){return t})),o=t.playSound(this.callee.$getHowl(),(function(){var t;n.callee.$stop(),r.resolve({type:n.type,node:(null===(t=n.contentNode)||void 0===t?void 0:t.child)||null})}));return this.callee.$setToken(o),r}var i=t.playSound(this.callee.$getHowl(),(function(){n.callee.$stop()}));return this.callee.$setToken(i),Va(e,"executeAction",this,3)([t])}if(this.type===ja.stop)return this.callee.$getHowl()&&(this.callee.$getHowl().stop(),this.callee.$stop()),Va(e,"executeAction",this,3)([t]);if(this.type===ja.fade){var a=Na(this.contentNode.getContent(),1)[0],s=a.start,u=a.end,c=a.duration;if(this.callee.$getHowl()){var l=void 0===s?this.callee.$getHowl().volume():s;this.callee.$getHowl().fade(l,u,c,this.callee.$getToken())}return Va(e,"executeAction",this,3)([t])}if(this.type===ja.setVolume){var f=Na(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().volume(f,this.callee.$getToken()),Va(e,"executeAction",this,3)([t])}if(this.type===ja.setRate){var d=Na(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().rate(d,this.callee.$getToken()),Va(e,"executeAction",this,3)([t])}if(this.type===ja.pause)return this.callee.$getHowl()&&this.callee.$getHowl().pause(this.callee.$getToken()),Va(e,"executeAction",this,3)([t]);if(this.type===ja.resume)return this.callee.$getHowl()&&this.callee.$getHowl().play(this.callee.$getToken()),Va(e,"executeAction",this,3)([t]);throw Va(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.$getHowl()||e.$setHowl(new(t.getHowl())(e.getHowlOptions()))}}])}(Ka);os.ActionTypes=ja;var is=function(t){function e(){return Ba(this,e),Ga(this,e,arguments)}return qa(e,t),Ua(e,[{key:"executeAllActions",value:function(t,e){return Xa(this,void 0,void 0,La().mark((function n(){var r,o,i;return La().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=La().mark((function e(){var n,r,i;return La().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o)){e.next=3;break}return e.abrupt("return",0);case 3:if(!h.isAwaitable(n)){e.next=15;break}return e.next=6,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 6:if(r=e.sent,i=r.node){e.next=12;break}return e.abrupt("return",0);case 12:o=i.action;case 13:e.next=16;break;case 15:o=n;case 16:case"end":return e.stop()}}),e)}));case 3:if(r||!o){n.next=10;break}return n.delegateYield(i(),"t0",5);case 5:if(0!==n.t0){n.next=8;break}return n.abrupt("break",10);case 8:n.next=3;break;case 10:case"end":return n.stop()}}),n)})))}},{key:"executeSingleAction",value:function(t,e){return Xa(this,void 0,void 0,La().mark((function n(){var r,o,i;return La().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!h.isAwaitable(r)){n.next=9;break}return n.next=4,new Promise((function(t){r.then((function(e){return t(r.result)}))}));case 4:return o=n.sent,i=o.node,n.abrupt("return",i);case 9:return n.abrupt("return",r);case 10:case"end":return n.stop()}}),n)})))}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.child})})),n):Va(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n,r,o=this,i=Na(this.contentNode.getContent(),1)[0];if(this.type===Ca.do){var a=null===(n=i[0])||void 0===n?void 0:n.contentNode,s=null===(r=i[i.length-1])||void 0===r?void 0:r.contentNode,u=this.contentNode.getChild();return null==s||s.addChild(u),this.contentNode.addChild(a||null),Va(e,"executeAction",this,3)([t])}if(this.type===Ca.doAsync)return Xa(o,void 0,void 0,La().mark((function e(){return La().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),Va(e,"executeAction",this,3)([t]);if(this.type===Ca.any){var c=new h((function(t){return t})),l=i.map((function(e){return o.executeSingleAction(t,e)}));return Promise.any(l).then((function(){c.resolve({type:o.type,node:o.contentNode.getChild()})})),c}if(this.type===Ca.all){var f=new h((function(t){return t}));return this.execute(t,f,i)}if(this.type===Ca.allAsync)return Xa(o,void 0,void 0,La().mark((function e(){return La().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),Va(e,"executeAction",this,3)([t]);if(this.type===Ca.repeat){var d=Na(this.contentNode.getContent(),2),p=d[0],y=d[1];return Xa(o,void 0,void 0,La().mark((function e(){var n;return La().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<y)){e.next=8;break}if(!(p.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,p[0]);case 5:n++,e.next=1;break;case 8:case"end":return e.stop()}}),e,this)}))),Va(e,"executeAction",this,3)([t])}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=Va(e,"getFutureActions",this,3)([]);return[].concat(Ma(t),Ma(n))}}])}(Ka);function as(t){return as="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},as(t)}function ss(t,e,n){return e=ds(e),function(t,e){if(e&&("object"==as(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)}(t,ls()?Reflect.construct(e,n||[],ds(t).constructor):e.apply(t,n))}function us(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&&fs(t,e)}function cs(t){var e="function"==typeof Map?new Map:void 0;return cs=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(ls())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&fs(o,n.prototype),o}(t,arguments,ds(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),fs(n,t)},cs(t)}function ls(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ls=function(){return!!t})()}function fs(t,e){return fs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fs(t,e)}function ds(t){return ds=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ds(t)}function ps(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,vs(r.key),r)}}function ys(t,e,n){return e&&hs(t.prototype,e),n&&hs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function vs(t){var e=function(t,e){if("object"!=as(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=as(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==as(e)?e:e+""}is.ActionTypes=Ca;var ms=function(){function t(){ps(this,t)}return ys(t,null,[{key:"srcToString",value:function(t){return"string"==typeof t?t:t.src}},{key:"staticImageDataToSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"isStaticImageData",value:function(t){return void 0!==(null==t?void 0:t.src)}},{key:"backgroundToSrc",value:function(e){return t.isStaticImageData(e)?e.src:(null==e?void 0:e.url)||null}},{key:"isExternalSrc",value:function(t){return t.startsWith("http://")||t.startsWith("https://")}}])}(),gs=function(t){function e(t){return ps(this,e),ss(this,e,[t,{},"StaticScriptWarning"])}return us(e,t),ys(e,null,[{key:"isWarning",value:function(t){return t instanceof e}}])}(function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UseError";return ps(this,e),(r=ss(this,e,[t])).props=n,r.name=o,r}return us(e,t),ys(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(cs(Error))),bs=function(){return ys((function t(e){ps(this,t),this.scene=e}),[{key:"start",value:function(){var t=new Map,e=[],n=new Set;if(!this.scene.getAllActions().length)return null;for(e.push(this.scene.getAllActions()[0]);e.length;){var r=e.shift();this.checkAction(r,t,n);var o=r.contentNode.child;o&&o.action&&e.push(o.action)}return t}},{key:"checkAction",value:function(t,e,n){if(t instanceof ts)e.has(t.callee)||e.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(e.get(t.callee),t);else if(t instanceof Qa&&t.type===Pa.jumpTo){var r=t.contentNode.getContent()[0];if(n.has(r))return;n.add(r)}}},{key:"checkImage",value:function(t,e){if(e.type===Oa.dispose){if(t.isDisposed){var n="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new gs(n)}t.isDisposed=!0}else if([Oa.init,Oa.show,Oa.hide,Oa.applyTransform,Oa.applyTransition].includes(e.type)){if(t.isDisposed){var r="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new gs(r)}}else if(e.type===Oa.setSrc){var o=e.contentNode.getContent()[0];ms.isExternalSrc(o)&&(t.usedExternalSrc=!0)}}}])}();function ws(t){return ws="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},ws(t)}function _s(t){return function(t){if(Array.isArray(t))return ks(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ss(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 Ss(t,e){if(t){if("string"==typeof t)return ks(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ks(t,e):void 0}}function ks(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function xs(t,e,n){return e=Ts(e),function(t,e){if(e&&("object"==ws(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)}(t,As()?Reflect.construct(e,n||[],Ts(t).constructor):e.apply(t,n))}function As(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(As=function(){return!!t})()}function Ts(t){return Ts=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ts(t)}function Es(t,e){return Es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Es(t,e)}function Ps(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Os(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Cs(r.key),r)}}function js(t,e,n){return e&&Os(t.prototype,e),n&&Os(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Cs(t){var e=function(t,e){if("object"!=ws(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ws(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ws(e)?e:e+""}var Is=function(){return js((function t(e){Ps(this,t),this.handler=e}),[{key:"evaluate",value:function(t){var e=t.gameState;return{value:this.handler(this.getCtx({gameState:e}))}}},{key:"getCtx",value:function(t){return{gameState:t.gameState}}}])}(),Ms=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ps(this,e),(t=xs(this,e,[vt.IdPrefixes.Condition])).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=p(e.defaultConfig,n),t}return 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&&Es(t,e)}(e,t),js(e,[{key:"If",value:function(t,e){return this.conditions.If.condition=t instanceof Is?t:new Is(t),this.conditions.If.action=this.construct(Array.isArray(e)?e:[e]),this}},{key:"ElseIf",value:function(t,e){return this.conditions.ElseIf.push({condition:t instanceof Is?t:new Is(t),action:this.construct(Array.isArray(e)?e:[e])}),this}},{key:"Else",value:function(t){return this.conditions.Else.action=this.construct(Array.isArray(t)?t:[t]),this}},{key:"evaluate",value:function(t,e){var n,r,o={gameState:e.gameState},i=null===(n=t.If.condition)||void 0===n?void 0:n.evaluate(o);if(null==i?void 0:i.value)return t.If.action||null;var a,s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Ss(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(t.ElseIf);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=null===(r=u.condition)||void 0===r?void 0:r.evaluate(o);if(null==c?void 0:c.value)return u.action||null}}catch(t){s.e(t)}finally{s.f()}return t.Else.action||null}},{key:"toActions",value:function(){var t=[Reflect.construct(es,[this,es.ActionTypes.action,new ue(qt.getIdManager().getStringId()).setContent(this.conditions)])];return this.conditions=e.getInitialState(),t}},{key:"construct",value:function(t,e,n){for(var r,o=0;o<t.length;o++){var i=t[o].contentNode,a=null===(r=t[o+1])||void 0===r?void 0:r.contentNode;a&&i.setInitChild(a),o===t.length-1&&e&&i.setInitChild(e),0===o&&n&&n.setInitChild(i)}return t}},{key:"_getFutureActions",value:function(){return[].concat(_s(this.conditions.If.action||[]),_s(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),_s(this.conditions.Else.action||[]))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(vt);function Ls(t){return Ls="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},Ls(t)}function Ns(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Fs(r.key),r)}}function Fs(t){var e=function(t,e){if("object"!=Ls(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ls(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ls(e)?e:e+""}function Rs(t,e,n){return e=Ds(e),function(t,e){if(e&&("object"==Ls(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)}(t,Vs()?Reflect.construct(e,n||[],Ds(t).constructor):e.apply(t,n))}function Vs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Vs=function(){return!!t})()}function Ds(t){return Ds=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ds(t)}function Bs(t,e){return Bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bs(t,e)}Ms.defaultConfig={};var $s=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Rs(this,e,[vt.IdPrefixes.Control])}return 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&&Bs(t,e)}(e,t),function(t,e,n){return e&&Ns(t.prototype,e),n&&Ns(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(is.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(is.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(is.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(is.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(is.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(is.ActionTypes.repeat,e,t)}},{key:"construct",value:function(t){for(var e,n=0;n<t.length;n++){var r=t[n];0!==n&&(null===(e=t[n-1])||void 0===e||e.contentNode.setInitChild(r.contentNode))}return t}},{key:"push",value:function(t,e){for(var n=e.flat(2),r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=new is(this,t,new ue(qt.getIdManager().getStringId()).setContent([this.construct(n)].concat(o)));return this.actions.push(a),this}}],[{key:"do",value:function(t){return(new e).do(t)}},{key:"doAsync",value:function(t){return(new e).doAsync(t)}},{key:"any",value:function(t){return(new e).any(t)}},{key:"all",value:function(t){return(new e).all(t)}},{key:"allAsync",value:function(t){return(new e).allAsync(t)}},{key:"repeat",value:function(t,n){return(new e).repeat(t,n)}}])}(vt);function Us(t){return Us="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},Us(t)}function Hs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Gs(r.key),r)}}function Gs(t){var e=function(t,e){if("object"!=Us(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Us(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Us(e)?e:e+""}function zs(t,e,n){return e=qs(e),function(t,e){if(e&&("object"==Us(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)}(t,Ws()?Reflect.construct(e,n||[],qs(t).constructor):e.apply(t,n))}function Ws(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ws=function(){return!!t})()}function qs(t){return qs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qs(t)}function Ys(t,e){return Ys=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ys(t,e)}var Xs=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=zs(this,e,[vt.IdPrefixes.Menu])).choices=[],n.prompt=Tt.isSentence(t)?t:new Tt(null,t),n.config=p(e.defaultConfig,r),n}return 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&&Ys(t,e)}(e,t),function(t,e,n){return e&&Hs(t.prototype,e),n&&Hs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){return Tt.isSentence(t)&&e||(Pt.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?this.choices.push({prompt:Tt.toSentence(t),action:e.flat(2)}):"object"===Us(t)&&"prompt"in t&&"action"in t?this.choices.push({prompt:Tt.toSentence(t.prompt),action:t.action.flat(2)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),this}},{key:"construct",value:function(t,e,n){for(var r,o=0;o<t.length;o++){var i=t[o].contentNode,a=null===(r=t[o+1])||void 0===r?void 0:r.contentNode;a&&i.setInitChild(a),o===this.choices.length-1&&e&&i.setInitChild(e),0===o&&n&&n.setInitChild(i)}return t}},{key:"toActions",value:function(){var t=[new rs(this,rs.ActionTypes.action,new ue(qt.getIdManager().getStringId()).setContent({prompt:this.prompt,choices:this.constructChoices()}))];return this.choices=[],t}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action})).flat(2)}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.construct(e.action),prompt:e.prompt}}))}}])}(vt);function Ks(t){return Ks="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},Ks(t)}function Zs(t){return function(t){if(Array.isArray(t))return Qs(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 Qs(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qs(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 Qs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Js(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,tu(r.key),r)}}function tu(t){var e=function(t,e){if("object"!=Ks(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ks(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ks(e)?e:e+""}Xs.defaultConfig={},Xs.targetAction=rs;var eu,nu=function(){return function(t,e,n){return e&&Js(t.prototype,e),n&&Js(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actions=[]}),[{key:"setRoot",value:function(t){var e,n;return null===(e=this.actions[0])||void 0===e||e.contentNode.setParent(t),t.setChild(null===(n=this.actions[0])||void 0===n?void 0:n.contentNode),this.actions[0]}},{key:"getActions",value:function(){return this.actions}},{key:"setActions",value:function(t){var e;this.actions.length=0,(e=this.actions).push.apply(e,Zs(t))}},{key:"getAllActions",value:function(t,e){var n=new Set;return this.forEachAction((function(t){return n.add(t)}),t,e),Array.from(n)}},{key:"forEachAction",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=[];((arguments.length>2?arguments[2]:void 0)||this.getActions()).forEach((function(r){var o=[];for(o.push(r);o.length>0;){var i=o.shift();if(i.type===Pa.jumpTo){if(!e||n.includes(i.getId()))continue;n.push(i.getId())}t(i);var a=i.getFutureActions();o.push.apply(o,Zs(a))}}))}},{key:"findActionById",value:function(t,e){if(e)return e.find((function(e){return e.getId()===t}))||null;var n=this.getActions(),r=[],o=[];for(r.push.apply(r,Zs(n));r.length>0;){var i=r.shift();if(i.getId()===t)return i;if(i.type===Pa.jumpTo){if(o.includes(i.getId()))continue;o.push(i.getId())}r.push.apply(r,Zs(i.getFutureActions()))}return null}},{key:"getAllElements",value:function(t){var e=t||this.getAllActions(),n=new Set(e.map((function(t){return t.callee})));return Array.from(n)}},{key:"getActionsByType",value:function(t,e){return(e||this.getAllActions()).filter((function(e){return e.type===t}))}},{key:"getAllNodes",value:function(t){var e=t||this.getAllActions(),n=new Set(e.map((function(t){return t.contentNode})));return Array.from(n)}},{key:"findNodeById",value:function(t,e){var n;return(null===(n=(e||this.getAllActions()).find((function(e){return e.contentNode.id===t})))||void 0===n?void 0:n.contentNode)||null}},{key:"findElementById",value:function(t,e){return e.find((function(e){return e.id===t}))||null}},{key:"findElementsByIds",value:function(t,e){var n=new Map;return e.forEach((function(t){return n.set(t.id,t)})),t.map((function(t){return n.get(t)})).filter(Boolean)}},{key:"_action",value:function(t){var e;"function"==typeof t&&(t=t(this));var n=t.flat(2);(e=this.actions).push.apply(e,Zs(n));var r=this.construct(),o=new ue(qt.getIdManager().getStringId(),void 0,void 0,r||void 0).setContent(this);null==r||r.setParent(o);var i=this.constructor;return Reflect.construct(i.targetAction,[this,i.targetAction.ActionTypes.action,o])}},{key:"construct",value:function(t){for(var e,n=0;n<this.actions.length;n++){var r=this.actions[n];0===n&&t?t.setInitChild(r.contentNode):n>0&&(null===(e=this.actions[n-1].contentNode)||void 0===e||e.setInitChild(r.contentNode))}return this.actions.length?this.actions[0].contentNode:null}}])}();function ru(t){return ru="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},ru(t)}function ou(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,iu(r.key),r)}}function iu(t){var e=function(t,e){if("object"!=ru(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ru(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ru(e)?e:e+""}function au(t,e,n){return e=uu(e),function(t,e){if(e&&("object"==ru(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)}(t,su()?Reflect.construct(e,n||[],uu(t).constructor):e.apply(t,n))}function su(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(su=function(){return!!t})()}function uu(t){return uu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uu(t)}function cu(t,e){return cu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cu(t,e)}nu.targetAction=Ta,function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(eu||(eu={}));var lu=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=au(this,e,[vt.IdPrefixes.Sound])).state={playing:null,token:null},t.config=p(e.defaultConfig,n),t}return 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&&cu(t,e)}(e,t),function(t,e,n){return e&&ou(t.prototype,e),n&&ou(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===eu.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(os.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===eu.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(os.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===eu.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(os.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(os.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(os.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(os.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(os.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(){return{src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1}}},{key:"getSrc",value:function(){return this.config.src}},{key:"$setToken",value:function(t){this.state.token=t}},{key:"$getToken",value:function(){return this.state.token}},{key:"$setHowl",value:function(t){this.state.playing=t}},{key:"$getHowl",value:function(){return this.state.playing}},{key:"$stop",value:function(){this.$setToken(null),this.$setHowl(null)}},{key:"toData",value:function(){return w(this.config,e.defaultConfig)?null:{config:y(this.config)}}},{key:"fromData",value:function(t){return this.config=p(this.config,t.config),this}},{key:"pushAction",value:function(t,e){var n=new os(this,t,new ue(qt.getIdManager().getStringId()).setContent(e));return this.actions.push(n),this}}])}(vt);function fu(t){return fu="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},fu(t)}function du(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pu(r.key),r)}}function pu(t){var e=function(t,e){if("object"!=fu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fu(e)?e:e+""}lu.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var hu=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.src=[],this.future=[]}return function(t,e,n){return e&&du(t.prototype,e),n&&du(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"register",value:function(t,e){var n=this;if(Array.isArray(t))t.forEach((function(t){return n.register(t)}));else if(t instanceof lu){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof Sa||ms.isStaticImageData(t)){if(t instanceof Sa){if(this.isSrcRegistered(ms.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(ms.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof Sa?t:new Sa("",{src:ms.staticImageDataToSrc(t)})})}else if("object"===fu(t)){if(this.isSrcRegistered(t.src||""))return this;this.src.push(t)}else if("audio"===t){if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e instanceof lu?e:new lu({src:e})})}else{if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e})}return this}},{key:"isSrcRegistered",value:function(e){var n=e instanceof lu?e.getSrc():e;return this.src.some((function(e){return e.type===t.SrcTypes.audio?n===e.src.getSrc():e.type===t.SrcTypes.image?n===ms.srcToString(e.src.state.src):n===e.src}))}},{key:"getSrc",value:function(){return this.src}},{key:"getSrcByType",value:function(t){return this.src.filter((function(e){return e.type===t}))}},{key:"registerFuture",value:function(t){return this.future.includes(t)||this.hasFuture(t)||this.future.push(t),this}},{key:"hasFuture",value:function(t){return this.future.includes(t)}}])}();function yu(t){return yu="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},yu(t)}function vu(t){return function(t){if(Array.isArray(t))return mu(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 mu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mu(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 mu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function gu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,bu(r.key),r)}}function bu(t){var e=function(t,e){if("object"!=yu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=yu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yu(e)?e:e+""}function wu(t,e,n){return e=Su(e),function(t,e){if(e&&("object"==yu(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)}(t,_u()?Reflect.construct(e,n||[],Su(t).constructor):e.apply(t,n))}function _u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(_u=function(){return!!t})()}function Su(t){return Su=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Su(t)}function ku(t,e){return ku=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ku(t,e)}hu.SrcTypes={image:"image",video:"video",audio:"audio"};var xu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.defaultConfig;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=wu(this,e)).srcManager=new hu,n.events=new m,n._liveState={active:!1},n._actions=[],n.id=qt.getIdManager().getStringId(),n.name=t,n.config=p(e.defaultConfig,r),n.state=p(e.defaultState,n.config),n.backgroundImageState={position:new ge(ae.Center)},n}return 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&&ku(t,e)}(e,t),function(t,e,n){return e&&gu(t.prototype,e),n&&gu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"activate",value:function(){return this._init()}},{key:"deactivate",value:function(){return this._exit()}},{key:"setBackground",value:function(t,e){if(e){var n=e.copy();n.setSrc(ms.backgroundToSrc(t)),this.transitionSceneBackground(void 0,n)}return this._actions.push(new Qa(this,"scene:setBackground",new ue(qt.getIdManager().getStringId()).setContent([t]))),this}},{key:"applyTransform",value:function(t){return this._actions.push(new Qa(this,"scene:applyTransform",new ue(qt.getIdManager().getStringId()).setContent([t]))),this}},{key:"jumpTo",value:function(t,e){this._actions.push(new Qa(this,"scene:preUnmount",new ue(qt.getIdManager().getStringId()).setContent([])));var n=e||{};return this._transitionToScene(t,n.transition)._exit(),this._jumpTo(t)}},{key:"transitionSceneBackground",value:function(t,e){return this._transitionToScene(t,e),this}},{key:"sleep",value:function(t){return this._actions.push(new Qa(this,"scene:sleep",new ue(qt.getIdManager().getStringId()).setContent(t))),this}},{key:"setBackgroundMusic",value:function(t,e){return this._actions.push(new Qa(this,Pa.setBackgroundMusic,new ue(qt.getIdManager().getStringId()).setContent([t,e]))),this}},{key:"toActions",value:function(){var t=this._actions;return this._actions=[],t}},{key:"_$getBackgroundMusic",value:function(){return this.state.backgroundMusic}},{key:"toData",value:function(){var t;return w(this.state,this.config)?null:{state:Object.assign(Object.assign({},y(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background,backgroundImageState:Sa.serializeImageState(this.backgroundImageState)})}}},{key:"fromData",value:function(t){return this.state=p(this.state,t.state),t.state.backgroundMusic&&(this.state.backgroundMusic=(new lu).fromData(t.state.backgroundMusic),this.state.background=t.state.background),t.state.backgroundImageState&&(this.backgroundImageState=Sa.deserializeImageState(t.state.backgroundImageState)),this}},{key:"_setTransition",value:function(t){return this._actions.push(new Qa(this,"scene:setTransition",new ue(qt.getIdManager().getStringId()).setContent([t]))),this}},{key:"_applyTransition",value:function(t){return this._actions.push(new Qa(this,"scene:applyTransition",new ue(qt.getIdManager().getStringId()).setContent([t]))),this}},{key:"_toTransform",value:function(){return new ha([{props:this.backgroundImageState,options:{duration:0}}])}},{key:"registerSrc",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.getActions().length){var n=new Set,r=[this.getActions()[0]],o=new Set;for(ms.backgroundToSrc(this.config.background)&&this.srcManager.register(new Sa({src:ms.backgroundToSrc(this.config.background)}));r.length;){var i=r.shift();if(i instanceof Qa){if(i.type===Pa.jumpTo){var a=i,s=a.contentNode.getContent()[0];if(n.has(a)||e.has(s))continue;n.add(a),o.add(s),e.add(s)}else if(i.type===Pa.setBackground){var u=i.contentNode.getContent()[0];this.srcManager.register(new Sa({src:ms.backgroundToSrc(u)}))}}else if(i instanceof ts){var c=i;if(this.srcManager.register(c.callee),i.type===Oa.setSrc){var l=i.contentNode.getContent()[0];this.srcManager.register(new Sa({src:l}))}}else if(i instanceof os)this.srcManager.register(i.callee);else if(i instanceof is){var f=i.getFutureActions();r.push.apply(r,vu(f))}r.push.apply(r,vu(i.getFutureActions()))}o.forEach((function(n){n.registerSrc(e),t.srcManager.registerFuture(n.srcManager)}))}}},{key:"action",value:function(t){var e=Array.isArray(t)?t.flat(2):t(this).flat(2),n=this.getAllElements(this.getAllActions(!1,e)).filter((function(t){return t instanceof Sa})),r=[].concat(vu(this.activate().toActions()),vu(n.map((function(t){return t.init().toActions()})).flat(2)),vu(e));return this._sceneRoot=this._action(r),this}},{key:"getSceneActions",value:function(){return this.toActions()}},{key:"_jumpTo",value:function(t){return this._actions.push(new Qa(this,"scene:jumpTo",new ue(qt.getIdManager().getStringId()).setContent([t]))),this}},{key:"_exit",value:function(){return this._actions.push(new Qa(this,"scene:exit",new ue(qt.getIdManager().getStringId()).setContent([]))),this}},{key:"_transitionToScene",value:function(t,e){if(e){var n=e.copy();t&&n.setSrc(ms.backgroundToSrc(t.config.background)),this._setTransition(n)._applyTransition(n)}var r;t&&(r=this._actions).push.apply(r,vu(t.activate().toActions()));return this}},{key:"_init",value:function(){return this._actions.push(new Qa(this,"scene:init",new ue(qt.getIdManager().getStringId()).setContent([]))),this}}])}(nu);function Au(t){return Au="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},Au(t)}function Tu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Eu(r.key),r)}}function Eu(t){var e=function(t,e){if("object"!=Au(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Au(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Au(e)?e:e+""}function Pu(t,e,n){return e=ju(e),function(t,e){if(e&&("object"==Au(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)}(t,Ou()?Reflect.construct(e,n||[],ju(t).constructor):e.apply(t,n))}function Ou(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ou=function(){return!!t})()}function ju(t){return ju=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ju(t)}function Cu(t,e){return Cu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cu(t,e)}xu.EventTypes={"event:scene.setTransition":"event:scene.setTransition","event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.initTransform":"event:scene.initTransform","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:scene.applyTransform":"event:scene.applyTransform"},xu.defaultConfig={background:null,invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},xu.defaultState={},xu.targetAction=Qa;var Iu=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Pu(this,e,[vt.IdPrefixes.Script])).cleaner=null,n.handler=t,n}return 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&&Cu(t,e)}(e,t),function(t,e,n){return e&&Tu(t.prototype,e),n&&Tu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var e=t.gameState;this.cleaner=this.handler(this.getCtx({gameState:e}))||null}},{key:"getCtx",value:function(t){return{script:this,gameState:t.gameState}}},{key:"toActions",value:function(){return[new ns(this,ns.ActionTypes.action,new ue(qt.getIdManager().getStringId()).setContent(this))]}}])}(vt);function Mu(t){return Mu="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},Mu(t)}function Lu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Nu(r.key),r)}}function Nu(t){var e=function(t,e){if("object"!=Mu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Mu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Mu(e)?e:e+""}function Fu(t,e,n){return e=Vu(e),function(t,e){if(e&&("object"==Mu(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)}(t,Ru()?Reflect.construct(e,n||[],Vu(t).constructor):e.apply(t,n))}function Ru(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ru=function(){return!!t})()}function Vu(t){return Vu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vu(t)}function Du(t,e){return Du=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Du(t,e)}var Bu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Fu(this,e)).id=qt.getIdManager().getStringId(),n.name=t,n.config=p(e.defaultConfig,r),n}return 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&&Du(t,e)}(e,t),function(t,e,n){return e&&Lu(t.prototype,e),n&&Lu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"_setAllElementState",value:function(t,e){var n=e||this.getAllActions(),r=new Map;t.forEach((function(t){return r.set(t.id,t.data)})),this.getAllElements(n).forEach((function(t){var e=r.get(t.id);e&&t.fromData(e)}))}},{key:"_getAllElementState",value:function(t){var e=t||this.getAllActions();return this.getAllElements(e).map((function(t){return{id:t.id,data:t.toData()}})).filter((function(t){return null!==t.data}))}},{key:"_getNodeChildIdMap",value:function(t){var e=t||this.getAllActions(),n=new Map;return e.forEach((function(t){var e,r=t.contentNode;(null===(e=r.child)||void 0===e?void 0:e.id)&&r.initChild!==r.child&&n.set(r.id,r.child.id)})),n}},{key:"_setNodeChildByMap",value:function(t,e){if(t){var n=t instanceof Map?t:new Map(Object.entries(t)),r=e||this.getAllActions(),o=this._getMappedNodes(this.getAllNodes(r));r.forEach((function(t){var e=t.contentNode,r=n.get(e.id),i=r&&o.get(r);i&&e.setChild(i)}))}}},{key:"_getMappedNodes",value:function(t){var e=new Map;return t.forEach((function(t){return e.set(t.id,t)})),e}},{key:"toData",value:function(){return null}},{key:"fromData",value:function(t){return this}},{key:"entry",value:function(t){var e=t._sceneRoot;if(!e)throw new Error("No actions in scene, please add actions to scene first");return this.setActions([e]),t.registerSrc(),new bs(t).start(),this}}])}(nu);Bu.defaultConfig={},Bu.targetAction=Ja;var $u=r(72),Uu=r.n($u),Hu=r(825),Gu=r.n(Hu),zu=r(659),Wu=r.n(zu),qu=r(56),Yu=r.n(qu),Xu=r(540),Ku=r.n(Xu),Zu=r(113),Qu=r.n(Zu),Ju=r(587),tc={};tc.styleTagTransform=Qu(),tc.setAttributes=Yu(),tc.insert=Wu().bind(null,"head"),tc.domAPI=Gu(),tc.insertStyleElement=Ku();Uu()(Ju.A,tc);Ju.A&&Ju.A.locals&&Ju.A.locals;var ec=r(848);const nc=(0,q.createContext)({strict:!1});function rc(t){for(const e in t)vi[e]={...vi[e],...t[e]}}function oc({children:t,features:e,strict:n=!1}){const[,r]=(0,q.useState)(!ic(e)),o=(0,q.useRef)(void 0);if(!ic(e)){const{renderer:t,...n}=e;o.current=t,rc(n)}return(0,q.useEffect)((()=>{ic(e)&&e().then((({renderer:t,...e})=>{rc(e),o.current=t,r(!0)}))}),[]),(0,ec.jsx)(nc.Provider,{value:{renderer:o.current,strict:n},children:t})}function ic(t){return"function"==typeof t}function ac(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function sc(t,e,n={}){var r;const o=zo(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(i=n.transitionOverride);const a=o?()=>Promise.all(ei(t,o,n)):()=>Promise.resolve(),s=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:o=0,staggerChildren:a,staggerDirection:s}=i;return function(t,e,n=0,r=0,o=1,i){const a=[],s=(t.variantChildren.size-1)*r,u=1===o?(t=0)=>t*r:(t=0)=>s-t*r;return Array.from(t.variantChildren).sort(uc).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(sc(t,e,{...i,delay:n+u(r)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(a)}(t,e,o+r,a,s,n)}:()=>Promise.resolve(),{when:u}=i;if(u){const[t,e]="beforeChildren"===u?[a,s]:[s,a];return t().then((()=>e()))}return Promise.all([a(),s(n.delay)])}function uc(t,e){return t.sortNodePosition(e)}const cc=[...fi].reverse(),lc=fi.length;function fc(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const o=e.map((e=>sc(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=sc(t,e,n);else{const o="function"==typeof e?zo(t,e,n.custom):e;r=Promise.all(ei(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function dc(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!ac(e,t)}function pc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function hc(){return{animate:pc(!0),whileInView:pc(),whileHover:pc(),whileTap:pc(),whileDrag:pc(),whileFocus:pc(),exit:pc()}}class yc{constructor(t){this.isMounted=!1,this.node=t}update(){}}let vc=0;const mc={animation:{Feature:class extends yc{constructor(t){super(t),t.animationState||(t.animationState=function(t){let e=fc(t),n=hc(),r=!0;const o=e=>(n,r)=>{var o;const i=zo(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const a=t.getProps(),s=t.getVariantContext(!0)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<lc;e++){const d=cc[e],p=n[d],h=void 0!==a[d]?a[d]:s[d],y=li(h),v=d===i?p.isActive:null;!1===v&&(f=e);let m=h===s[d]&&h!==a[d]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),p.protectedKeys={...l},!p.isActive&&null===v||!h&&!p.prevProp||ci(h)||"boolean"==typeof h)continue;let g=dc(p.prevProp,h)||d===i&&p.isActive&&!m&&y||e>f&&y,b=!1;const w=Array.isArray(h)?h:[h];let _=w.reduce(o(d),{});!1===v&&(_={});const{prevResolvedValues:S={}}=p,k={...S,..._},x=e=>{g=!0,c.has(e)&&(b=!0,c.delete(e)),p.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in k){const e=_[t],n=S[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Lo(e)&&Lo(n)?!ac(e,n):e!==n,r?null!=e?x(t):c.add(t):void 0!==e&&c.has(t)?x(t):p.protectedKeys[t]=!0}p.prevProp=h,p.prevResolvedValues=_,p.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(g=!1),!g||m&&!b||u.push(...w.map((t=>({animation:t,options:{type:d}}))))}if(c.size){const e={};c.forEach((n=>{const r=t.getBaseTarget(n),o=t.getValue(n);o&&(o.liveStyle=!0),e[n]=null!=r?r:null})),u.push({animation:e})}let d=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(d=!1),r=!1,d?e(u):Promise.resolve()}return{animateChanges:i,setActive:function(e,r){var o;if(n[e].isActive===r)return Promise.resolve();null===(o=t.variantChildren)||void 0===o||o.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const a=i(e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=hc(),r=!0}}}(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();ci(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends yc{constructor(){super(...arguments),this.id=vc++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const r=this.node.animationState.setActive("exit",!t);e&&!t&&r.then((()=>e(this.id)))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}};function gc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function bc(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const wc=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,bc(e));function _c(t,e,n,r){return gc(t,e,wc(n),r)}function Sc(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const kc=Sc("dragHorizontal"),xc=Sc("dragVertical");function Ac(){const t=function(t){let e=!1;if("y"===t)e=xc();else if("x"===t)e=kc();else{const t=kc(),n=xc();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function Tc(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return _c(t.current,n,((n,o)=>{if("touch"===n.pointerType||Ac())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&je.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Ec=(t,e)=>!!e&&(t===e||Ec(t,e.parentElement));function Pc(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,bc(n))}const Oc=new WeakMap,jc=new WeakMap,Cc=t=>{const e=Oc.get(t.target);e&&e(t)},Ic=t=>{t.forEach(Cc)};function Mc(t,e,n){const r=function({root:t,...e}){const n=t||document;jc.has(n)||jc.set(n,{});const r=jc.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Ic,{root:t,...e})),r[o]}(e);return Oc.set(t,n),r.observe(t),()=>{Oc.delete(t),r.unobserve(t)}}const Lc={some:0,all:1};const Nc={inView:{Feature:class extends yc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:r="some",once:o}=t,i={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:Lc[r]};return Mc(this.node.current,i,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,o&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),i=e?n:r;i&&i(t)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends yc{constructor(){super(...arguments),this.removeStartListeners=_e,this.removeEndListeners=_e,this.removeAccessibleListeners=_e,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=_c(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Ec(this.node.current,t.target)?n:r;i&&je.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=_c(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Zr(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=gc(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=gc(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&Pc("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&je.postRender((()=>n(t,e)))}))})),Pc("down",((t,e)=>{this.startPress(t,e)}))})),e=gc(this.node.current,"blur",(()=>{this.isPressing&&Pc("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=Zr(t,e)}}startPress(t,e){this.isPressing=!0;const{onTapStart:n,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&je.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Ac()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&je.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=_c(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=gc(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Zr(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends yc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Zr(gc(this.node.current,"focus",(()=>this.onFocus())),gc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends yc{mount(){this.unmount=Zr(Tc(this.node,!0),Tc(this.node,!1))}unmount(){}}}},Fc=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Rc(t){return"string"==typeof t&&!t.includes("-")&&!!(Fc.indexOf(t)>-1||/[A-Z]/u.test(t))}const Vc={renderer:(t,e)=>Rc(t)?new Ni(e):new Ri(e,{allowProjection:t!==q.Fragment}),...mc,...Nc};function Dc(t){var e=t.children;return Y().createElement(oc,{features:Vc,strict:!0},e)}function Bc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return $c(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$c(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 $c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Uc(t){var e=t.children,n=t.className,r=Bc((0,q.useState)({}),2),o=r[0],i=r[1],a=rt().ratio,s=dt().game,u=Bc((0,q.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,q.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("Ratio is locked, skipping update");else{var t=document.getElementById(s.config.player.contentContainerId);if(t){var e,n,r=t.clientWidth,o=t.clientHeight,f=s.config.player.aspectRatio;r/o>f?(e=o*f,n=o):(e=r,n=r/f),e<c&&(e=c),n<l&&(n=l),i({width:"".concat(e,"px"),height:"".concat(n,"px"),margin:"auto",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center"}),a.update(e,n),a.updateMin(c,l),u()}}};a.setUpdate(e);var n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)};return e(),window.addEventListener("resize",n),function(){window.removeEventListener("resize",n),clearTimeout(t)}}),[a]),Y().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},Y().createElement("div",{className:W(n),style:o},e))}var Hc={start:"start",update:"update",end:"end"};function Gc(t){var e=t.children,n=rt().ratio,r=dt().game,o=(0,q.useRef)(null);return(0,q.useEffect)((function(){if(!o.current)throw new Error("Content container not found")}),[r.config.player.contentContainerId]),Y().createElement(Y().Fragment,null,Y().createElement("div",{ref:o,className:W("absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"),style:Object.assign({},n.getStyle())},e))}function zc(t){return zc="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},zc(t)}function Wc(){return Wc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Wc.apply(null,arguments)}function qc(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */qc=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==zc(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value: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,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function P(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 O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(zc(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.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,v):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),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Yc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Xc(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xc(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 Xc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var Kc=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function Zc(t){var e=this,n=t.scene,r=t.props,o=t.state,i=(0,q.useRef)(null),a=dt().game,s=Yc((0,q.useState)(null),2),u=s[0],c=s[1],l=Yc((0,q.useState)([]),2)[1],f=Yc((0,q.useState)(null),2),d=f[0],h=f[1],y=Yc((0,q.useState)({}),2),v=y[0],m=y[1];function g(){n.events.emit(xu.EventTypes["event:scene.imageLoaded"])}function b(t){if(d&&d.getControl()&&(console.warn("processing transform not completed"),d.getControl().complete(),d.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof ha?Object.assign(i.current.style,t.propToCSS(o,n.backgroundImageState)):Object.assign(i.current.style,t)}(0,q.useEffect)((function(){var t=n.events.onEvents([{type:xu.EventTypes["event:scene.setTransition"],listener:n.events.on(xu.EventTypes["event:scene.setTransition"],(function(t){c(t),o.logger.log("transition",t)}))},{type:xu.EventTypes["event:scene.applyTransform"],listener:n.events.on(xu.EventTypes["event:scene.applyTransform"],(function(t){return Kc(e,void 0,void 0,qc().mark((function e(){return qc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(o,n.backgroundImageState)),h(t),e.next=4,t.animate({scope:i},o,n.backgroundImageState,(function(e){n.backgroundImageState=p(n.backgroundImageState,e),m({style:t.propToCSS(o,n.backgroundImageState)}),h(null)}));case 4:case"end":return e.stop()}}),e)})))}))},{type:xu.EventTypes["event:scene.initTransform"],listener:n.events.on(xu.EventTypes["event:scene.initTransform"],(function(t){return Kc(e,void 0,void 0,qc().mark((function e(){return qc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.animate({scope:i},o,n.backgroundImageState,(function(t){n.backgroundImageState=p(n.backgroundImageState,t)}));case 2:case"end":return e.stop()}}),e)})))}))}]),r=u?u.events.onEvents([{type:Hc.update,listener:u.events.on(Hc.update,(function(t){l(t)}))},{type:Hc.end,listener:u.events.on(Hc.end,(function(){c(null)}))}]):null;return b(n.backgroundImageState),function(){var e;t.cancel(),null===(e=null==r?void 0:r.cancel)||void 0===e||e.call(r)}}),[u,n]),(0,q.useEffect)((function(){var t=o.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:o.events.on(G.EventTypes["event:state.player.skip"],(function(){d&&d.getControl()&&(d.getControl().complete(),d.setControl(null))}))}]);return function(){t.cancel()}}),[d]);var w,_="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",S={src:_,style:Object.assign({opacity:0},a.config.app.debug?{border:"1px solid red"}:{})};return Y().createElement("div",null,u?u.toElementProps().map((function(t,e,n){var o=p(S,r,t,v);return Y().createElement(Gc,{key:e},Y().createElement("img",Wc({alt:o.alt},o,{onLoad:g,src:o.src||_,ref:e===n.length-1?i:void 0,className:"absolute"})))})):(w=p(S,r,v),Y().createElement(Gc,null,Y().createElement("img",Wc({alt:w.alt},w,{onLoad:g,ref:i,src:w.src||_,className:"absolute"})))))}function Qc(t){return Qc="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},Qc(t)}function Jc(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Jc=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Qc(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value: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,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function P(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 O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Qc(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.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,v):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),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function tl(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return el(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?el(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 el(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var nl=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function rl(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=rt().ratio,a=tl((0,q.useState)((function(){return e._$getBackgroundMusic()})),2),s=a[0],u=a[1],c=tl((0,q.useState)(null),2),l=c[0],f=c[1],d=tl((0,q.useState)(null),2),p=d[0],h=d[1];function y(t,e){return nl(this,void 0,void 0,Jc().mark((function n(){var r;return Jc().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.$getHowl()&&t.$getHowl().playing(t.$getToken())){n.next=2;break}return n.abrupt("return",Promise.resolve());case 2:return r=t.$getHowl().volume(t.$getToken()),n.next=5,new Promise((function(n){t.$getHowl().fade(r,0,e,t.$getToken()),h((function(){return n})),f(setTimeout((function(){t.$getHowl().stop(),t.$getHowl().volume(r),t.$setToken(null),n(),h(null)}),e))}));case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))}return(0,q.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(xu.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){var n,r,o,i,a,c;return nl(this,void 0,void 0,Jc().mark((function d(){var v,m;return Jc().wrap((function(d){for(;;)switch(d.prev=d.next){case 0:if(l&&(clearTimeout(l),f(null),p&&(p(),h(null))),m=t,!(v=s)){d.next=12;break}if(!e){d.next=9;break}return d.next=7,y(v,e);case 7:d.next=12;break;case 9:null===(n=v.$getHowl())||void 0===n||n.stop(),null===(r=v.$getHowl())||void 0===r||r.volume(0),v.$setToken(null);case 12:if(m){d.next=14;break}return d.abrupt("return");case 14:null===(o=m.$getHowl())||void 0===o||o.volume(0),m.$setToken(null===(i=m.$getHowl())||void 0===i?void 0:i.play(m.$getToken()||void 0)),e?null===(a=m.$getHowl())||void 0===a||a.fade(0,m.config.volume,e,m.$getToken()):null===(c=m.$getHowl())||void 0===c||c.volume(m.config.volume,m.$getToken()),u(m);case 18:case"end":return d.stop()}}),d)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(xu.EventTypes["event:scene.preUnmount"],(function(){l&&(clearTimeout(l),p&&p()),s&&y(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,q.useEffect)((function(){return e.events.emit(xu.EventTypes["event:scene.mount"]),function(){e.events.emit(xu.EventTypes["event:scene.unmount"])}}),[]),Y().createElement("div",{className:o},Y().createElement(Zc,{scene:e,props:{width:i.state.width,height:i.state.height,src:ms.backgroundToSrc(e.state.background)},state:n}),r)}function ol(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}const il=(0,q.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),al=(0,q.createContext)({}),sl=(0,q.createContext)(null),ul=ai?q.useLayoutEffect:q.useEffect,{schedule:cl,cancel:ll}=Oe(queueMicrotask,!1);function fl(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const dl=(0,q.createContext)({});let pl=!1;function hl(t,e,n,r,o){var i;const{visualElement:a}=(0,q.useContext)(al),s=(0,q.useContext)(nc),u=(0,q.useContext)(sl),c=(0,q.useContext)(il).reducedMotion,l=(0,q.useRef)();r=r||s.renderer,!l.current&&r&&(l.current=r(t,{visualState:e,parent:a,props:n,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:c}));const f=l.current,d=(0,q.useContext)(dl);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:vl(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&fl(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(l.current,n,o,d),(0,q.useInsertionEffect)((()=>{f&&f.update(n,u)}));const p=n[Yo],h=(0,q.useRef)(Boolean(p)&&!window.MotionHandoffIsComplete&&(null===(i=window.MotionHasOptimisedAnimation)||void 0===i?void 0:i.call(window,p)));return ul((()=>{f&&(f.updateFeatures(),cl.render(f.render),h.current&&f.animationState&&f.animationState.animateChanges())})),(0,q.useEffect)((()=>{f&&(!h.current&&f.animationState&&f.animationState.animateChanges(),h.current=!1,pl||(pl=!0,queueMicrotask(yl)))})),f}function yl(){window.MotionHandoffIsComplete=!0}function vl(t){if(t)return!1!==t.options.allowProjection?t.projection:vl(t.parent)}function ml(t,e,n){return(0,q.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):fl(n)&&(n.current=r))}),[e])}function gl(t){const{initial:e,animate:n}=function(t,e){if(pi(t)){const{initial:e,animate:n}=t;return{initial:!1===e||li(e)?e:void 0,animate:li(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,q.useContext)(al));return(0,q.useMemo)((()=>({initial:e,animate:n})),[bl(e),bl(n)])}function bl(t){return Array.isArray(t)?t.join(" "):t}const wl=(0,q.createContext)({}),_l=Symbol.for("motionComponentSymbol");function Sl({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&rc(t);const i=(0,q.forwardRef)((function(t,i){let a;const s={...(0,q.useContext)(il),...t,layoutId:kl(t)},{isStatic:u}=s,c=gl(t),l=r(t,u);if(!u&&ai){!function(){(0,q.useContext)(nc).strict;0}();const t=function(t){const{drag:e,layout:n}=vi;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(s);a=t.MeasureLayout,c.visualElement=hl(o,l,s,e,t.ProjectionNode)}return(0,ec.jsxs)(al.Provider,{value:c,children:[a&&c.visualElement?(0,ec.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,ml(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[_l]=o,i}function kl({layoutId:t}){const e=(0,q.useContext)(wl).id;return e&&void 0!==t?e+"-"+t:t}function xl(t){const e=Qo(t)?t.get():t;return No(e)?e.toValue():e}const Al=t=>(e,n)=>{const r=(0,q.useContext)(al),o=(0,q.useContext)(sl),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:Pl(o,i,a,!s&&t,e),renderState:n()};return r&&(u.mount=t=>r(o,t,u)),u}(t,e,r,o,n);return n?i():function(t){const e=(0,q.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function Tl(t,e){const n=Ko(e);n&&Ro(t,n)}function El(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=Go(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function Pl(t,e,n,r,o){var i;const a={},s=[],u=r&&void 0===(null===(i=t.style)||void 0===i?void 0:i.willChange),c=o(t,{});for(const t in c)a[t]=xl(c[t]);let{initial:l,animate:f}=t;const d=pi(t),p=hi(t);e&&p&&!d&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let h=!!n&&!1===n.initial;h=h||!1===l;const y=h?f:l;return y&&"boolean"!=typeof y&&!ci(y)&&El(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[h?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!ci(f)&&El(t,f,(t=>{for(const e in t)Tl(s,e)})),s.length&&(a.willChange=s.join(","))),a}const Ol=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),jl=()=>({...Ol(),attrs:{}}),Cl={useVisualState:Al({scrapeMotionValuesFromProps:ii,createRenderState:jl,onMount:(t,e,{renderState:n,latestValues:r})=>{je.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),je.render((()=>{ji(n,r,Li(e.tagName),t.transformTemplate),Mi(e,n)}))}})},Il={useVisualState:Al({applyWillChange:!0,scrapeMotionValuesFromProps:oi,createRenderState:Ol})};function Ml(t,e,n){for(const r in e)Qo(e[r])||ri(r,n)||(t[r]=e[r])}function Ll(t,e){const n={};return Ml(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,q.useMemo)((()=>{const n=Ol();return Ti(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function Nl(t,e){const n={},r=Ll(t,e);return t.drag&&!1!==t.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const Fl=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Rl(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Fl.has(t)}let Vl=t=>!Rl(t);try{(Dl=require("@emotion/is-prop-valid").default)&&(Vl=t=>t.startsWith("on")?!Rl(t):Dl(t))}catch(t){}var Dl;function Bl(t,e,n,r){const o=(0,q.useMemo)((()=>{const n=jl();return ji(n,e,Li(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};Ml(e,t.style,t),o.style={...e,...o.style}}return o}function $l(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(Rc(e)?Bl:Nl)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(Vl(o)||!0===n&&Rl(o)||!e&&!Rl(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==q.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,q.useMemo)((()=>Qo(c)?c.get():c),[c]);return(0,q.createElement)(e,{...u,children:l})}}function Ul(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Sl({...Rc(n)?Cl:Il,preloadedFeatures:t,useRender:$l(r),createVisualElement:e,Component:n})}}const Hl=ol(Ul());function Gl(t){return Gl="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},Gl(t)}function zl(){return zl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},zl.apply(null,arguments)}function Wl(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Wl=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Gl(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value: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,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function P(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 O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Gl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.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,v):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),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ql(t){return function(t){if(Array.isArray(t))return Kl(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Xl(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 Yl(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||Xl(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 Xl(t,e){if(t){if("string"==typeof t)return Kl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kl(t,e):void 0}}function Kl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var Zl=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function Ql(t){var e=this,n=t.image,r=t.state,o=t.onAnimationEnd,i=(0,q.useRef)(null),a=Yl((0,q.useState)(null),2),s=a[0],u=a[1],c=Yl((0,q.useState)({style:{}}),2),l=c[0],f=c[1],d=Yl((0,q.useState)(null),2),h=d[0],y=d[1],v=Yl((0,q.useState)([]),2)[1],m=Yl((0,q.useState)(0),2),g=m[0],b=m[1],w=dt().game;(0,q.useEffect)((function(){n.setScope(i),n.events.emit(Sa.EventTypes["event:image.mount"]);var t=n.events.onEvents([].concat(ql([Sa.EventTypes["event:image.show"],Sa.EventTypes["event:image.hide"],Sa.EventTypes["event:image.applyTransform"]].map((function(t){return{type:t,listener:n.events.on(t,(function(t){return Zl(e,void 0,void 0,Wl().mark((function e(){return Wl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(t.propToCSS(r,n.state)),u(t),r.logger.debug("transform",t,t.propToCSS(r,n.state)),e.next=5,t.animate({scope:i},r,n.state,(function(e){n.state=p(n.state,e),f({style:t.propToCSS(r,n.state)}),o&&o(),u(null)}));case 5:return e.abrupt("return",!0);case 6:case"end":return e.stop()}}),e)})))}))}}))),[{type:Sa.EventTypes["event:image.init"],listener:n.events.on(Sa.EventTypes["event:image.init"],(function(){return Zl(e,void 0,void 0,Wl().mark((function t(){return Wl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.toTransform().animate({scope:i},r,n.state,(function(t){n.state=p(n.state,t),f({style:n.toTransform().propToCSS(r,n.state)})}));case 2:case"end":return t.stop()}}),t)})))}))}]));return S(n.toTransform().propToCSS(r,n.state)),n.events.emit(Sa.EventTypes["event:image.ready"],i),function(){t.cancel(),n.events.emit(Sa.EventTypes["event:image.unmount"])}}),[]),(0,q.useEffect)((function(){var t=n.events.onEvents([{type:Sa.EventTypes["event:image.setTransition"],listener:n.events.on(Sa.EventTypes["event:image.setTransition"],(function(t){y(t)}))}]);return function(){t.cancel()}}),[h,n]),(0,q.useEffect)((function(){var t=h?h.events.onEvents([{type:Hc.update,listener:h.events.on(Hc.update,(function(t){v(t)}))},{type:Hc.end,listener:h.events.on(Hc.end,(function(){y(null)}))}]):null;return function(){var e;null===(e=null==t?void 0:t.cancel)||void 0===e||e.call(t)}}),[h]),(0,q.useEffect)((function(){b(performance.now())}),[]),(0,q.useEffect)((function(){var t=r.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:r.events.on(G.EventTypes["event:state.player.skip"],(function(){s&&s.getControl()&&(s.getControl().complete(),s.setControl(null),r.logger.debug("transform skip")),h&&h.controller&&(h.controller.complete(),y(null),r.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[h,s]);var _=function(){var t=performance.now()-g,e=w.config.elements.img.slowLoadThreshold;t>e&&w.config.elements.img.slowLoadWarning&&r.logger.warn("NarraLeaf-React","Image took ".concat(t,"ms to load, which exceeds the threshold of ").concat(e,"ms. ")+"Consider enable cache for the image, so Preloader can preload it before it's used. To disable this warning, set `elements.img.slowLoadWarning` to false in the game config.")};function S(t){if(s&&s.getControl()&&(console.warn("processing transform not completed"),s.getControl().complete(),s.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof ha?Object.assign(i.current.style,t.propToCSS(r,n.state)):Object.assign(i.current.style,t)}var k={className:"absolute",src:ms.staticImageDataToSrc(n.state.src),style:Object.assign({opacity:0},w.config.app.debug?{border:"1px solid red"}:{})};return Y().createElement(ot,{className:"absolute overflow-hidden"},h?h.toElementProps().map((function(t,e,n){var r=p(k,l,t);return Y().createElement(Hl.img,zl({key:e,alt:r.alt},r,{ref:e===n.length-1?i:void 0,onLoad:_,layout:!0}))})):Y().createElement(Hl.img,zl({ref:i,alt:"image"},p(k,l),{onLoad:_})))}function Jl(t){return Jl="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},Jl(t)}function tf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ef(r.key),r)}}function ef(t){var e=function(t,e){if("object"!=Jl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Jl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jl(e)?e:e+""}var nf=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.preloaded=[],this.events=new m}return function(t,e,n){return e&&tf(t.prototype,e),n&&tf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"add",value:function(e){return this.has(this.getSrc(e))||(this.preloaded.push(e),this.events.emit(t.EventTypes["event:preloaded.add"],e),this.events.emit(t.EventTypes["event:preloaded.change"])),this}},{key:"get",value:function(t){var e=this;return this.preloaded.find((function(n){return e.getSrc(n)===t}))}},{key:"has",value:function(t){var e=this;return Array.isArray(t)?t.every((function(t){return e.has(t)})):this.preloaded.some((function(n){return e.getSrc(n)===t}))}},{key:"remove",value:function(e){var n=this;if(Array.isArray(e)){var r=e.map((function(t){return n.getSrc(t)}));return this.preloaded=this.preloaded.filter((function(t){return!r.includes(n.getSrc(t))})),this}var o=this.getSrc(e);return this.preloaded=this.preloaded.filter((function(t){return n.getSrc(t)!==o})),this.events.emit(t.EventTypes["event:preloaded.remove"],e),this.events.emit(t.EventTypes["event:preloaded.change"]),this}},{key:"clear",value:function(){return this.preloaded=[],this}},{key:"getSrc",value:function(t){return"string"==typeof t?t:"image"===t.type?ms.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function rf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return of(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?of(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 of(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}nf.EventTypes={"event:preloaded.add":"event:preloaded.add","event:preloaded.remove":"event:preloaded.remove","event:preloaded.change":"event:preloaded.change","event:preloaded.mount":"event:preloaded.mount","event:preloaded.ready":"event:preloaded.ready"};var af=(0,q.createContext)(null);function sf(t){var e=t.children,n=rf((0,q.useState)(new nf),1)[0];return Y().createElement(Y().Fragment,null,Y().createElement(af.Provider,{value:{preloaded:n}},e))}function uf(){if(!af)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,q.useContext)(af)}function cf(t){return function(t){if(Array.isArray(t))return lf(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 lf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lf(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 lf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ff(t){var e=t.state,n=t.srcManager,r=uf().preloaded;return(0,q.useEffect)((function(){var t,o;if("undefined"!=typeof window){var i=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,a=(null===(o=e.getLastScene())||void 0===o?void 0:o.srcManager.future)||[],s=[].concat(cf(n.src),cf(i?i.src:[]),cf(a.map((function(t){return t.src})).flat(2))),u={image:new Set,audio:new Set,video:new Set};s.forEach((function(t){t.type===hu.SrcTypes.image?u.image.add(t.src):t.type===hu.SrcTypes.audio?u.audio.add(t.src):t.type===hu.SrcTypes.video&&u.video.add(t.src)})),e.logger.debug("Preloading",u,a),r.preloaded=r.preloaded.filter((function(t){if(t.type===hu.SrcTypes.audio){var e=u[t.type].has(t.src);return e||(e=Array.from(u[t.type]).some((function(e){return r.getSrc(t)===r.getSrc(e.config.src)}))),e}if(t.type===hu.SrcTypes.image)return u[t.type].has(t.src);var n=r.getSrc(t);return u[t.type].has(n)}));var c=[];return u.image.forEach((function(t){var n=new Image;n.src=ms.srcToString(t.state.src),n.onload=function(){e.logger.debug("Image loaded",t.state.src)},c.push(n),r.add({type:"image",src:t})})),Promise.all([]).then((function(){e.logger.log("Preloaded","Preloaded ".concat(u.image.size," images")),r.events.emit(nf.EventTypes["event:preloaded.ready"])})),u.audio.forEach((function(t){t.$getHowl()||t.$setHowl(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),r.events.emit(nf.EventTypes["event:preloaded.mount"]),function(){c.forEach((function(t){t.onload=null}))}}console.warn("Window is not supported in this environment")}),[e]),null}function df(t){var e=t.state,n=dt().game;return(0,q.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&e.events.emit(G.EventTypes["event:state.player.skip"])},r=n.config.player.skipInterval,o=0,function(){var e=Date.now();if(!(e-o<r))return o=e,t.apply(void 0,arguments)});return window.addEventListener("keydown",i),function(){window.removeEventListener("keydown",i)}}e.logger.warn("NarraLeaf-React: Announcer","Cannot listen to window events")}),[]),Y().createElement(Y().Fragment,null)}function pf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return hf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hf(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 hf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function yf(t,e){return t.handle(e)}function vf(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=pf((0,q.useReducer)((function(t){return t+1}),0),2)[1],u=dt().game,c=pf((0,q.useReducer)(yf,new G(u,{forceUpdate:function(){s()},next:y,dispatch:function(t){return f(t)}})),2),l=c[0],f=c[1],d=u.config.elements.say.use,p=u.config.elements.menu.use;function y(){for(var t=!1;!t;){var e=u.getLiveGame().next(l);if(!e)break;if(h.isAwaitable(e)){t=!0;break}f(e)}l.stage.forceUpdate()}(0,q.useEffect)((function(){e&&u.getLiveGame().loadStory(e)}),[e,u]),(0,q.useEffect)((function(){i&&i({game:u,state:l});var t=l.getLastScene(),e=[];t?e.push({type:"event:scene.mount",listener:t.events.once("event:scene.mount",(function(){l.stage.next()}))}):l.stage.next();var n=l.events.onEvents([{type:G.EventTypes["event:state.end"],listener:function(){a&&a({game:u,state:l})}}]),r=l.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:function(){u.getLiveGame().abortAwaiting(),y()}}]);return l.stage.forceUpdate(),function(){t&&e.forEach((function(e){t.events.off(e.type,e.listener)})),n.cancel(),r.cancel()}}),[]);var v=n||u.config.player.width,m=r||u.config.player.height;return Y().createElement(Dc,null,Y().createElement("div",{style:{width:"number"==typeof v?"".concat(v,"px"):v,height:"number"==typeof m?"".concat(m,"px"):m},className:W(o,"__narraleaf_content-player")},Y().createElement(Uc,{className:W("flex-grow overflow-auto")},Y().createElement(ot,{className:"relative"},l.state.srcManagers.map((function(t,e){return Y().createElement(ff,{key:e,state:l,srcManager:t})})),Y().createElement(mf,{onLoaded:function(){l.stage.forceUpdate(),e&&y()}},Y().createElement(df,{state:l}),l.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return Y().createElement(rl,{key:"scene-"+e.id,state:l,scene:e},n.images.map((function(t){return Y().createElement(Ql,{key:"image-"+t.id,image:t,state:l})})),n.texts.map((function(t){var e=t.action,n=t.onClick;return Y().createElement(d,{state:l,key:"say-"+e.id,action:e,onClick:function(){n(),y()}})})),n.menus.map((function(t,e){return Y().createElement("div",{key:"menu-"+e},Y().createElement(p,{state:l,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),y()}}))})))})))))))}function mf(t){var e=t.children,n=t.onLoaded,r=uf().preloaded,o=pf((0,q.useState)(!1),2),i=o[0],a=o[1];return(0,q.useEffect)((function(){var t=r.events.on(nf.EventTypes["event:preloaded.ready"],(function(){a(!0),n()}));return function(){r.events.off(nf.EventTypes["event:preloaded.ready"],t)}}),[i]),Y().createElement(Y().Fragment,null,i?e:null)}function gf(t){var e=t.children,n=t.game;return Y().createElement(Y().Fragment,null,Y().createElement(nt,null,Y().createElement(ft,{game:n},Y().createElement(sf,null,e))))}function bf(t){return bf="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},bf(t)}function wf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_f(r.key),r)}}function _f(t){var e=function(t,e){if("object"!=bf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=bf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==bf(e)?e:e+""}var Sf=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=new m}return function(t,e,n){return e&&wf(t.prototype,e),n&&wf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"start",value:function(t){}},{key:"toElementProps",value:function(){return[]}},{key:"setSrc",value:function(t){}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(Hc.start,null),this.controller=ea(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(Hc.update,r.toElementProps())},onComplete:function(){r.events.emit(Hc.end,null),s&&s(),r.controller=void 0}},n)),this.controller}},{key:"copy",value:function(){return new t}}])}();function kf(t){return kf="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},kf(t)}function xf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Af(r.key),r)}}function Af(t){var e=function(t,e){if("object"!=kf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=kf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==kf(e)?e:e+""}function Tf(t,e,n){return e=Pf(e),function(t,e){if(e&&("object"==kf(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)}(t,Ef()?Reflect.construct(e,n||[],Pf(t).constructor):e.apply(t,n))}function Ef(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ef=function(){return!!t})()}function Pf(t){return Pf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pf(t)}function Of(t,e){return Of=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Of(t,e)}var jf=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Tf(this,e)).state={opacity:1},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof xu?ms.backgroundToSrc(r.config.background):ms.staticImageDataToSrc(r)),t}return 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&&Of(t,e)}(e,t),function(t,e,n){return e&&xf(t.prototype,e),n&&xf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{},{style:{opacity:this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Sf);function Cf(t){return Cf="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},Cf(t)}function If(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mf(r.key),r)}}function Mf(t){var e=function(t,e){if("object"!=Cf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Cf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Cf(e)?e:e+""}function Lf(t,e,n){return e=Ff(e),function(t,e){if(e&&("object"==Cf(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)}(t,Nf()?Reflect.construct(e,n||[],Ff(t).constructor):e.apply(t,n))}function Nf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Nf=function(){return!!t})()}function Ff(t){return Ff=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ff(t)}function Rf(t,e){return Rf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rf(t,e)}jf.Frames=[0,1];var Vf=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3?arguments[3]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=Lf(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,i&&(r.src="string"==typeof i?i:i instanceof xu?ms.backgroundToSrc(i.config.background):ms.staticImageDataToSrc(i)),r.__stack=g(),r}return 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&&Rf(t,e)}(e,t),function(t,e,n){return e&&If(t.prototype,e),n&&If(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}})}},{key:"toElementProps",value:function(){return[{},{style:{opacity:this.state.opacity,transform:this.state.transform},src:this.src}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])}(Sf);function Df(t){return Df="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},Df(t)}function Bf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,$f(r.key),r)}}function $f(t){var e=function(t,e){if("object"!=Df(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Df(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Df(e)?e:e+""}function Uf(t,e,n){return e=Gf(e),function(t,e){if(e&&("object"==Df(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)}(t,Hf()?Reflect.construct(e,n||[],Gf(t).constructor):e.apply(t,n))}function Hf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Hf=function(){return!!t})()}function Gf(t){return Gf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gf(t)}function zf(t,e){return zf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zf(t,e)}var Wf=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Uf(this,e)).state={opacity:0},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof xu?ms.backgroundToSrc(r.config.background):ms.staticImageDataToSrc(r)),t}return 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&&zf(t,e)}(e,t),function(t,e,n){return e&&Bf(t.prototype,e),n&&Bf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Sf);Wf.Frames=[1,0]})(),o})()));
31
+ */function c(t,e,n){var r,i={},c=null,l=null;for(r in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,r)&&!u.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:c,ref:l,props:i,_owner:s.current}}e.jsx=c,e.jsxs=c},848:(t,e,n)=>{"use strict";t.exports=n(20)},72:t=>{"use strict";var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var i={},a=[],s=0;s<t.length;s++){var u=t[s],c=r.base?u[0]+r.base:u[0],l=i[c]||0,f="".concat(c," ").concat(l);i[c]=l+1;var d=n(f),p={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var h=o(p,r);r.byIndex=s,e.splice(s,0,{identifier:f,updater:h,references:1})}a.push(f)}return a}function o(t,e){var n=e.domAPI(e);n.update(t);return 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;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var i=r(t=t||[],o=o||{});return function(t){t=t||[];for(var a=0;a<i.length;a++){var s=n(i[a]);e[s].references--}for(var u=r(t,o),c=0;c<i.length;c++){var l=n(i[c]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}i=u}}},659:t=>{"use strict";var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},56:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},113: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))}}},12:e=>{"use strict";e.exports=t}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={id:t,exports:{}};return e[t](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nc=void 0;var o={};return(()=>{"use strict";function t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return n};var e,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(e){l=function(t,e,n){return t[e]=n}}function d(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new I(r||[]);return i(a,"_invoke",{value:O(t,n,s)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=d;var h="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,s,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(M([])));x&&x!==r&&o.call(x,s)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function T(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(r,i,a,s){var u=p(t[r],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==f(l)&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function O(t,n,r){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=P(s,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var c=p(t,n,r);if("normal"===c.type){if(o=r.done?m:y,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function P(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=p(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(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 C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(f(t)+" is not iterable")}return w.prototype=_,i(A,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},n.awrap=function(t){return{__await:t}},T(E.prototype),l(E.prototype,u,(function(){return this})),n.AsyncIterator=E,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new E(d(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(A),l(A,c,"Generator"),l(A,s,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=M,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},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 n=this;function r(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;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,g):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),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}function e(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=c(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s(r.key),r)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}function u(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)||c(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 c(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function f(t){return f="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},f(t)}r.r(o),r.d(o,{Align:()=>Ne,Base:()=>Hf,Character:()=>Gt,ColoredSentence:()=>Yt,CommonPosition:()=>Me,CommonPositionType:()=>_e,Condition:()=>Ys,Control:()=>nu,Coord2D:()=>Le,Dissolve:()=>pd,Fade:()=>Zf,FadeIn:()=>id,Game:()=>ue,GameProviders:()=>Df,GameState:()=>G,Image:()=>Fa,Isolated:()=>ot,Lambda:()=>qs,LiveGame:()=>ce,Menu:()=>lu,Player:()=>Ff,Say:()=>qt,Scene:()=>Gu,Script:()=>Ju,Sentence:()=>$t,Sound:()=>Pu,SoundType:()=>wu,Story:()=>sc,Transform:()=>Pa,Utils:()=>Is,Word:()=>Ht,useGame:()=>pt});var d=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function p(t,e){var n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r={},o=function(t,e,n){return"object"!==f(e)||null===e||Array.isArray(e)||"object"!==f(n)||null===n||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n)?e.map((function(t,e){return"object"===f(t)&&null!==t&&!Array.isArray(t)&&n[e]?p(t,n[e]):t})):void 0!==n?n:e:e.constructor!==Object||n.constructor!==Object?n||e:p(e,n)};for(var i in t)n(t,i)&&(r[i]=o(0,t[i],e[i]));for(var a in e)n(e,a)&&!n(r,a)&&("object"===f(e[a])&&null!==e[a]?e[a].constructor!==Object?r[a]=e[a]:r[a]=p({},e[a]):r[a]=e[a]);for(var s=arguments.length,c=new Array(s>2?s-2:0),l=2;l<s;l++)c[l-2]=arguments[l];if(c.length){var d=c[0],h=c.slice(1);return p.apply(void 0,[r,d].concat(u(h)))}return r}var h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},r=arguments.length>1?arguments[1]:void 0;n(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=r}return a(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var n,r=e(this.listeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)(this.result)}}catch(t){r.e(t)}finally{r.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function y(t){var n=new WeakSet;return function t(r){if(null===r||"object"!==f(r))return r;if(!n.has(r)){if(n.add(r),Array.isArray(r)){var o,i=[],a=e(r);try{for(a.s();!(o=a.n()).done;){var s=o.value;i.push(t(s))}}catch(t){a.e(t)}finally{a.f()}return i}var u={};for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(u[c]=t(r[c]));return u}}(t)}function v(t){return"string"==typeof t?t:"#".concat((t.r||0).toString(16).padStart(2,"0")).concat((t.g||0).toString(16).padStart(2,"0")).concat((t.b||0).toString(16).padStart(2,"0")).concat(void 0!==t.a?t.a.toString(16).padStart(2,"0"):"")}var m=function(){return a((function t(){n(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return d(this,void 0,void 0,t().mark((function r(){var i,a,s,u,c,l=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.events[n]||(this.events[n]=[]),i=[],a=e(this.events[n]);try{for(a.s();!(s=a.n()).done;)u=s.value,(c=u.apply(void 0,o))&&"object"===f(c)&&"function"==typeof c.then&&i.push(c)}catch(t){a.e(t)}finally{a.f()}if(this.events[n]=this.events[n].filter((function(t){return!i.includes(t)})),0!==i.length){t.next=7;break}return t.abrupt("return",new Promise((function(t){var e=l.on("event:EventDispatcher.register",(function(r,i){if(r===n){l.off(r,e);var a=null==i?void 0:i.apply(void 0,o);a&&a.then?a.then(t):t(a)}}))})));case 7:return t.next=9,Promise.all(i);case 9:return t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),r,this)})))}}])}();function g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function b(t){return new Promise((function(e){return setTimeout(e,t)}))}function w(t,e){if(t===e)return!0;if("object"!==f(t)||"object"!==f(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!w(t[a],e[a]))return!1}return!0}var _=function(){return a((function t(e,r){n(this,t),this.game=e,this.prefix=r}),[{key:"log",value:function(t){if(this.game.config.app.logger.log){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"info",value:function(t){if(this.game.config.app.logger.info){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).info.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"warn",value:function(t){if(this.game.config.app.logger.warn){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).warn.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"error",value:function(t){if(this.game.config.app.logger.error){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).error.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"debug",value:function(t){if(this.game.config.app.logger.debug){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).debug.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"trace",value:function(t){if(this.game.config.app.logger.trace){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console.trace(this._log.apply(this,[t].concat(n)))}}},{key:"_log",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===n.length?[this.prefix||"",t]:["".concat(this.prefix||""," [").concat(t,"]")].concat(n)}}])}(),S=function(){return a((function t(e){n(this,t),this.abortHandler=e,this.events=new m,this.aborted=!1}),[{key:"abort",value:function(){return this.aborted||(this.aborted=!0,this.result=this.abortHandler.apply(this,arguments)),this.result}},{key:"isAborted",value:function(){return this.aborted}},{key:"cancel",value:function(){this.aborted=!0}}])}();function k(t){return k="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},k(t)}function x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return A(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(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 A(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,P(r.key),r)}}function O(t,e,n){return e&&E(t.prototype,e),n&&E(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function P(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==k(e)?e:e+""}S.EventTypes={"event:skipController.abort":"event:skipController.abort"};var j=function(){function t(e,n,r){T(this,t),this.name=e,this.key=r||e,this.content=p({},n)}return O(t,[{key:"set",value:function(e,n){return t.isSerializable(n)?(this.content[e]=n,this):(console.warn('Value "'.concat(n,'" in key "').concat(String(e),'" is not serializable, and will not be set\nat namespace "').concat(this.name,'"')),this.content[e]=n,this)}},{key:"get",value:function(t){return this.content[t]}},{key:"toData",value:function(){return this.serialize()}},{key:"load",value:function(t){t?this.content=t:console.warn("No data to load")}},{key:"serialize",value:function(){var t=this,e={};return Object.entries(this.content).forEach((function(n){var r=x(n,2),o=r[0],i=r[1];e[o]=t.wrap(i)})),e}},{key:"deserialize",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=x(t,2),r=n[0],o=n[1];e.content[r]=e.unwrap(o)})):console.warn("No data to load")}},{key:"toTypeName",value:function(t){return t instanceof Date?"date":"any"}},{key:"wrap",value:function(t){return{any:function(t){return{type:"any",data:t}},date:function(t){return{type:"date",data:t.toString()}}}[this.toTypeName(t)](t)}},{key:"unwrap",value:function(t){var e={any:function(t){return t.data},date:function(t){return new Date(t.data)}};return e[t.type](t)}}],[{key:"isSerializable",value:function(e){return!!["number","string","boolean"].includes(k(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===k(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),C=function(){return O((function t(){T(this,t),this.namespaces={}}),[{key:"addNamespace",value:function(t){return this.namespaces[t.key]=t,this}},{key:"getNamespace",value:function(t){return this.namespaces[t]}},{key:"setNamespace",value:function(t,e){return this.namespaces[t]=e,this}},{key:"getNamespaces",value:function(){return this.namespaces}},{key:"keys",value:function(){return Object.keys(this.namespaces)}},{key:"values",value:function(){return Object.values(this.namespaces)}},{key:"entries",value:function(){return Object.entries(this.namespaces)}},{key:"toData",value:function(){return this.entries().reduce((function(t,e){var n=x(e,2),r=n[0],o=n[1];return t[r]=o.toData(),t}),{})}},{key:"load",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=x(t,2),r=n[0],o=n[1];e.namespaces[r]?e.namespaces[r].load(o):console.warn("Namespace ".concat(r," not found in ").concat(e.constructor.name))})):console.warn("No data to load")}}])}();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 M(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,L(r.key),r)}}function L(t){var e=function(t,e){if("object"!=I(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==I(e)?e:e+""}var N=r(196);function R(t){return R="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},R(t)}function F(t){return function(t){if(Array.isArray(t))return t}(t)||B(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 V(t){return function(t){if(Array.isArray(t))return $(t)}(t)||B(t)||D(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){if(t){if("string"==typeof t)return $(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(t,e):void 0}}function B(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function $(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function U(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,H(r.key),r)}}function H(t){var e=function(t,e){if("object"!=R(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==R(e)?e:e+""}var G=function(){return function(t,e,n){return e&&U(t.prototype,e),n&&U(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={sounds:[],srcManagers:[],elements:[]},this.currentHandling=null,this.stage=n,this.game=e,this.events=new m,this.logger=new _(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByImage",value:function(t){return this.state.elements.find((function(e){return e.ele.images.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this._getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=this.createWaitableAction({character:e.character,sentence:e,id:t},(function(){i.splice(i.indexOf(a),1),n&&n()}));i.push(a)}},{key:"createMenu",value:function(t,e,n){var r;if(!t.choices.length)throw new Error("Menu must have at least one choice");var o=null===(r=this.findElementByScene(this._getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!o)throw new Error("Scene not found");var i=this.createWaitableAction(t,(function(t){o.splice(o.indexOf(i),1),e&&e(t)}));o.push(i)}},{key:"createImage",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.images.push(t),this):this}},{key:"disposeImage",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.images;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Image not found");return o.splice(i,1),this}},{key:"playSound",value:function(t,e){var n=t.play(),r=[t.once("end",o.bind(this)),t.once("stop",o.bind(this))];function o(){e&&e(),r.forEach((function(t){return t.off()})),this.stage.next()}return n}},{key:"getHowl",value:function(){return N.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(V(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"toData",value:function(){return{elements:this.state.elements.map((function(t){return{scene:t.scene.id,ele:{images:t.ele.images.map((function(t){return t.id}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;this.state.elements=[];var r=this.game.getLiveGame().story;if(!r)throw new Error("No story loaded");var o=r.getAllElements(e);t.elements.forEach((function(t){var e=F(r.findElementsByIds([t.scene].concat(V(t.ele.images)),o)),i={scene:e[0],ele:{images:e.slice(1),menus:[],texts:[]}};n.state.elements.push(i),n.state.srcManagers.push(i.scene.srcManager)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],images:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"_getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new Error('Scene not found, please call "scene.activate()" first.');return e}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}])}();function z(t){var e,n,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=z(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}G.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip"};const W=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=z(t))&&(r&&(r+=" "),r+=e);return r};var q=r(12),Y=r.n(q);function X(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return K(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?K(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 K(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Z(t){return Z="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},Z(t)}function Q(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,J(r.key),r)}}function J(t){var e=function(t,e){if("object"!=Z(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Z(e)?e:e+""}var tt=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={width:0,height:0,minWidth:800,minHeight:450,paused:!1},this.events=new m,this.lockers=[],this.updater=null}return function(t,e,n){return e&&Q(t.prototype,e),n&&Q(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n){this.state.width=e,this.state.height=n,this.events.emit(t.EventTypes["event:aspectRatio.update"],e,n)}},{key:"updateMin",value:function(t,e){this.state.minWidth=t,this.state.minHeight=e}},{key:"lock",value:function(){var t=Symbol();return this.lockers.push(t),t}},{key:"unlock",value:function(t){if(t&&!this.lockers.includes(t))throw new Error("Locker not found");return this.lockers=this.lockers.filter((function(e){return e!==t})),this.triggerUpdate(),null}},{key:"isLocked",value:function(){return!!this.lockers.length}},{key:"getStyle",value:function(){return{width:"".concat(this.state.width,"px"),height:"".concat(this.state.height,"px")}}},{key:"setUpdate",value:function(t){this.updater=t}},{key:"pause",value:function(){this.state.paused=!0,this.events.emit(t.EventTypes["event:aspectRatio.pause"])}},{key:"resume",value:function(){this.state.paused=!1,this.events.emit(t.EventTypes["event:aspectRatio.resume"])}},{key:"onUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.update"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.update"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();tt.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume"};var et=(0,q.createContext)(null);function nt(t){var e=t.children,n=X((0,q.useState)(new tt),1)[0];return Y().createElement(et.Provider,{value:{ratio:n}},e)}function rt(){var t=(0,q.useContext)(et);if(!et||!t)throw new Error("useRatio must be used within a RatioProvider");var e=X((0,q.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,q.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function ot(t){var e=t.children,n=t.className,r=rt().ratio,o=r.getStyle();return Y().createElement("div",{className:W("inset-0 flex items-center justify-center",n),style:{width:"100%",height:"100%",minWidth:"".concat(r.state.minWidth,"px"),minHeight:"".concat(r.state.minHeight,"px")}},Y().createElement("div",{style:Object.assign(Object.assign({},o),{position:"relative"})},e))}function it(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return at(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(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 at(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}const st=function(t){var e=t.text,n=t.speed,r=t.onComplete,o=t.className,i=it((0,q.useState)(""),2),a=i[0],s=i[1],u=it((0,q.useState)(0),2),c=u[0],l=u[1];return(0,q.useEffect)((function(){if(c<e.length){if(" "!==e[c]){var t=setTimeout((function(){s((function(t){return t+e[c]})),l((function(t){return t+1}))}),n);return function(){return clearTimeout(t)}}s((function(t){return t+" "})),l((function(t){return t+1}))}else r&&r()}),[c,e,n,r]),Y().createElement("span",{className:o},a)};function ut(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ct(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ct(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 ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var lt,ft=Y().createContext(null);function dt(t){var e=t.children,n=t.game,r=new ue({}),o=ut((0,q.useState)(n||r),2),i=o[0],a=o[1];return Y().createElement(ft.Provider,{value:{game:i,setGame:a}},e)}function pt(){var t=(0,q.useContext)(ft);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function ht(t){return ht="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},ht(t)}function yt(t){return function(t){if(Array.isArray(t))return vt(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 vt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vt(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 vt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function mt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,wt(r.key),r)}}function bt(t,e,n){return e&&gt(t.prototype,e),n&&gt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function wt(t){var e=function(t,e){if("object"!=ht(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ht(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ht(e)?e:e+""}var _t=Symbol("_Chained"),St=function(){function t(){mt(this,t),this[lt]=!0,this.__actions=[]}return bt(t,[{key:"push",value:function(){var t;(t=this.__actions).push.apply(t,arguments)}},{key:"getActions",value:function(){return this.__actions}}],[{key:"isChained",value:function(t){return t&&t[_t]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(2)}}])}();lt=_t;var kt=function(){return bt((function t(){mt(this,t)}),[{key:"chain",value:function(t){var e=St.isChained(this)?this:this.proxy(this,new St);if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,yt(n)),e}},{key:"proxy",value:function(t,e){var n=new Proxy(t,{get:function(t,r){if(r in e)return e[r];var o=t[r];return"function"==typeof o?o.bind(n):o},set:function(t,e,n){return t[e]=n,!0}});return n}}])}();function xt(t){return xt="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},xt(t)}function At(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Tt(r.key),r)}}function Tt(t){var e=function(t,e){if("object"!=xt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=xt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xt(e)?e:e+""}function Et(t,e,n){return e=Pt(e),function(t,e){if(e&&("object"==xt(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)}(t,Ot()?Reflect.construct(e,n||[],Pt(t).constructor):e.apply(t,n))}function Ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ot=function(){return!!t})()}function Pt(t){return Pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pt(t)}function jt(t,e){return jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jt(t,e)}var Ct=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.IdPrefixes.Actionable;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Et(this,e)).id=ue.getIdManager().prefix(n,ue.getIdManager().getStringId(),"-"),t}return 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&&jt(t,e)}(e,t),function(t,e,n){return e&&At(t.prototype,e),n&&At(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toActions",value:function(){return[]}},{key:"toData",value:function(){return null}},{key:"fromData",value:function(t){return this}},{key:"fromChained",value:function(t){return t.getActions()}}])}(kt);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 Mt(t,e,n){return e=Nt(e),function(t,e){if(e&&("object"==It(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)}(t,Lt()?Reflect.construct(e,n||[],Nt(t).constructor):e.apply(t,n))}function Lt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Lt=function(){return!!t})()}function Nt(t){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nt(t)}function Rt(t,e){return Rt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rt(t,e)}function Ft(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Vt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Bt(r.key),r)}}function Dt(t,e,n){return e&&Vt(t.prototype,e),n&&Vt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Bt(t){var e=function(t,e){if("object"!=It(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=It(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==It(e)?e:e+""}Ct.IdPrefixes={Actionable:"actionable",Condition:"$0",Control:"$1",Image:"$2",Script:"$3",Sound:"$4",Text:"$5",Menu:"$6"};var $t=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ft(this,t),this.character=e,this.text=this.format(n),this.config=p(t.defaultConfig,r),this.id=ue.getIdManager().getStringId(),this.state=y(t.defaultState)}return Dt(t,[{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)Ht.isWord(t[n])?e.push(t[n]):e.push(new Ht(t[n]));else e.push(Ht.isWord(t)?t:new Ht(t));return e}},{key:"toData",value:function(){return w(this.state,t.defaultState)?null:{state:y(this.state)}}},{key:"fromData",value:function(t){return this.state=p(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(null,e)}}])}();$t.defaultConfig={color:"#000",pause:!0,voice:null},$t.defaultState={display:!0};var Ut,Ht=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ft(this,t),this.text=e,this.config=p(t.defaultConfig,n)}return Dt(t,null,[{key:"isWord",value:function(e){return e instanceof t}}])}();Ht.defaultConfig={},Ht.defaultColor="#000",function(t){t.adv="adv",t.nvl="nvl"}(Ut||(Ut={}));var Gt=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ft(this,e),(n=Mt(this,e,[Ct.IdPrefixes.Text])).name=t,n.config=p({},e.defaultConfig,r),n}return 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&&Rt(t,e)}(e,t),Dt(e,[{key:"say",value:function(t){var e=Array.isArray(t)?new $t(this,t,{}):$t.isSentence(t)?t:new $t(this,t,{}),n=new ds(this,ds.ActionTypes.say,new ke(ue.getIdManager().getStringId()).setContent(e));return this.chain(n)}}])}(Ct);function zt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Wt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wt(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 Wt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qt(t){var e,n=t.action,r=t.onClick,o=t.useTypeEffect,i=void 0===o||o,a=t.className,s=t.state,u=n.sentence,c=n.character,l=zt((0,q.useState)(0),2),f=l[0],d=l[1],p=zt((0,q.useState)(!1),2),h=p[0],y=p[1],m=pt().game,g=function(){d((function(t){return t+1})),f===u.text.length-1&&y(!0)};return(0,q.useEffect)((function(){if(window){var t=function(t){m.config.elements.say.nextKey.includes(t.key)&&(h?r&&r():y(!0))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[h]),(0,q.useEffect)((function(){var t=s.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:s.events.on(G.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),y(!0),r&&r()}))}]);return function(){t.cancel()}})),Y().createElement(ot,{className:"absolute"},u.state.display&&(c&&c.config.mode!==Gt.Modes.adv?Y().createElement(Y().Fragment,null," "):Y().createElement("div",{className:W("absolute flex items-center justify-center bottom-0 w-[calc(100%-40px)] h-[calc(33%-40px)] m-4 bg-white",m.config.elementStyles.say.container,a),onClick:function(){h?r&&r():y(!0)}},Y().createElement("div",{className:W("absolute top-0 left-0 p-1.25 rounded-br-md m-4",m.config.elementStyles.say.nameText)},(null===(e=u.character)||void 0===e?void 0:e.name)||""),Y().createElement("div",{className:W("text-center max-w-[80%] mx-auto",m.config.elementStyles.say.textContainer)},u.text.map((function(t,e){var n=t.config.color||u.config.color||Ht.defaultColor;return h?Y().createElement("span",{key:e,style:{color:"string"==typeof n?n:v(n)},className:W(m.config.elementStyles.say.textSpan)},t.text):e>f?null:Y().createElement("span",{key:e,style:{color:v(n)},className:W(m.config.elementStyles.say.textSpan)},i?Y().createElement(st,{text:t.text,onComplete:e===f?g:void 0,speed:m.config.elements.say.textInterval,className:W(m.config.elementStyles.say.textSpan)}):t.text)}))))))}function Yt(t){var e=t.sentence,n=t.className;return Y().createElement(Y().Fragment,null,e.text.map((function(t,r){var o=t.config.color||e.config.color||Ht.defaultColor;return Y().createElement("span",{key:r,style:{color:v(o)},className:n},t.text)})))}Gt.Modes=Ut,Gt.defaultConfig={mode:Ut.adv};var Xt={say:qt,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=pt().game,a=i.config.elements.say.use;return Y().createElement(Y().Fragment,null,Y().createElement(ot,{className:"absolute"},Y().createElement("div",{className:"absolute flex flex-col items-center justify-center min-w-full w-full h-full"},e&&Y().createElement(a,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"}))),Y().createElement(ot,{className:"absolute"},Y().createElement("div",{className:W("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.container)},Y().createElement("div",{className:"p-4 rounded-lg w-full z-20"},Y().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return Y().createElement("button",{key:e,className:W("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButton),onClick:function(){return function(t){r(t)}(t)}},Y().createElement(Yt,{key:e,sentence:t.prompt,className:W(i.config.elementStyles.menu.choiceButtonText)}))})))))))}};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 Zt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,te(r.key),r)}}function Jt(t,e,n){return e&&Qt(t.prototype,e),n&&Qt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function te(t){var e=function(t,e){if("object"!=Kt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Kt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Kt(e)?e:e+""}function ee(t,e,n){return e=re(e),function(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 function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ne()?Reflect.construct(e,n||[],re(t).constructor):e.apply(t,n))}function ne(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ne=function(){return!!t})()}function re(t){return re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},re(t)}function oe(t,e){return oe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},oe(t,e)}var ie,ae=function(t){function e(){var t;return Zt(this,e),(t=ee(this,e,arguments)).id=0,t}return 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&&oe(t,e)}(e,t),Jt(e,[{key:"getId",value:function(){return this.id++}},{key:"getStringId",value:function(){return(this.id++).toString()}},{key:"prefix",value:function(t,e){return t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:":")+e}}])}(function(){var t=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return function(t,e,n){return e&&M(t.prototype,e),n&&M(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"getInstance",value:function(){return t._instance||(t._instance=new this),t._instance}}])}();return t._instance=null,t}()),se=function(){return Jt((function t(){Zt(this,t),this.id=0}),[{key:"getId",value:function(){return this.id++}},{key:"getStringId",value:function(){return(this.id++).toString()}},{key:"prefix",value:function(t,e){return t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:":")+e}}])}();!function(t){t.game="game"}(ie||(ie={}));var ue=function(){return Jt((function t(e){Zt(this,t),this.liveGame=null,this.config=p(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Xt).includes(t))throw new Error("Invalid key ".concat(t));if("function"!=typeof e)throw new Error("Invalid component for key ".concat(t));return this.config.elements[t].use=e,this}},{key:"getLiveGame",value:function(){if(!this.liveGame){var t=this.createLiveGame();return this.liveGame=t,t}return this.liveGame}},{key:"createLiveGame",value:function(){return new ce(this)}}],[{key:"getIdManager",value:function(){return ae.getInstance()}}])}();ue.defaultSettings={volume:1},ue.ComponentTypes={say:"say",menu:"menu"},ue.DefaultConfig={version:"v0.0.0",player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:"100%",height:"100%",skipKey:["Control"],skipInterval:100},elements:{say:{nextKey:[" "],textInterval:50,use:Xt.say},img:{slowLoadWarning:!0,slowLoadThreshold:2e3},menu:{use:Xt.menu}},elementStyles:{say:{container:"",nameText:"",textContainer:"",textSpan:""},menu:{container:"",choiceButton:"",choiceButtonText:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1}}},ue.GameSettingsNamespace=ie;var ce=function(){function t(e){Zt(this,t),this.currentSceneNumber=null,this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this._lockedCount=0,this.currentAction=null,this.game=e,this.storable=new C,this.initNamespaces(),this.idManager=new se}return Jt(t,[{key:"getDefaultSavedGame",value:function(){return{name:"_",version:this.game.config.version,meta:{created:Date.now(),updated:Date.now()},game:{store:{},elementState:[],nodeChildIdMap:{},stage:{elements:[]},currentScene:0,currentAction:null}}}},{key:"initNamespaces",value:function(){return this.storable.addNamespace(new j(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t,this}},{key:"newGame",value:function(){var t,e;this.initNamespaces(),this.currentAction=(null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.sceneRoot)||null;var n=this.getDefaultSavedGame();return n.name="NewGame-"+Date.now(),this.currentSavedGame=n,this}},{key:"deserialize",value:function(t,e){var n=e.gameState,r=this.story;if(!r)throw new Error("No story loaded");if(t.version!==this.game.config.version)throw new Error("Saved game version mismatch");var o=r.getAllActions(),i=t.game,a=i.store,s=i.elementState,u=i.nodeChildIdMap,c=i.currentAction,l=i.stage;this.storable.load(a),r._setAllElementState(s,o),r._setNodeChildByMap(u,o),c?this.setCurrentAction(r.findActionById(c,o)||null):this.setCurrentAction(null),this.currentSavedGame=t,n.loadData(l,o)}},{key:"serialize",value:function(t){var e,n,r,o=t.gameState,i=this.story;if(!i)throw new Error("No story loaded");var a=i.getAllActions(),s=i._getAllElementState(a),u=Object.fromEntries(i._getNodeChildIdMap(a)),c=o.toData();return{name:(null===(e=this.currentSavedGame)||void 0===e?void 0:e.name)||"_",version:this.game.config.version,meta:{created:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.meta.created)||Date.now(),updated:Date.now()},game:{store:this.storable.toData(),elementState:s,stage:c,nodeChildIdMap:u,currentScene:0,currentAction:(null===(r=this.getCurrentAction())||void 0===r?void 0:r.getId())||null}}}},{key:"getCurrentAction",value:function(){return this.currentAction}},{key:"setCurrentAction",value:function(t){return this.currentAction=t,this}},{key:"next",value:function(t){var e,n,r;if(!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("Locked awaiting");return this.lockedAwaiting}var o=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==o?void 0:o.node)||void 0===e?void 0:e.action)||null,t.logger.debug("next action",o),this.lockedAwaiting=null,o||null}if(!this.currentAction)return t.events.emit(G.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),null;var i=this.currentAction.executeAction(t);return h.isAwaitable(i)?(this.lockedAwaiting=i,i):(t.logger.debug("next action",i),this._lockedCount=0,this.currentAction=(null===(r=null===(n=i.node)||void 0===n?void 0:n.child)||void 0===r?void 0:r.action)||null,i)}},{key:"abortAwaiting",value:function(){var t;if(this.lockedAwaiting){var e=this.lockedAwaiting.abort();this.currentAction=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.action)||null,this.lockedAwaiting=null}}},{key:"executeAction",value:function(t,e){var n,r,o=e.executeAction(t);return h.isAwaitable(o)?o:(null===(r=null===(n=null==o?void 0:o.node)||void 0===n?void 0:n.child)||void 0===r?void 0:r.action)||null}}])}();ce.DefaultNamespaces={game:{}},ce.GameSpacesKey={game:"game"};function le(t){return le="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},le(t)}function fe(t,e,n){return e=pe(e),function(t,e){if(e&&("object"==le(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)}(t,de()?Reflect.construct(e,n||[],pe(t).constructor):e.apply(t,n))}function de(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(de=function(){return!!t})()}function pe(t){return pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pe(t)}function he(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&&ye(t,e)}function ye(t,e){return ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ye(t,e)}function ve(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function me(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,be(r.key),r)}}function ge(t,e,n){return e&&me(t.prototype,e),n&&me(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function be(t){var e=function(t,e){if("object"!=le(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=le(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==le(e)?e:e+""}var we;!function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(we||(we={}));var _e,Se=function(){return ge((function t(e,n){ve(this,t),this.id=e,this.type=n,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}(),ke=function(t){function e(t,n,r,o){var i;return ve(this,e),(i=fe(this,e,[ue.getIdManager().prefix("node",t,"-"),we.ContentNode])).child=o||null,i.parent=r||null,i.action=n||null,i}return he(e,t),ge(e,[{key:"setParent",value:function(t){if(t===this)throw new Error("Cannot set parent to itself");return this.parent=t,this}},{key:"setChild",value:function(t){if(t===this)throw new Error("Cannot set child to itself");return this.child=t,t&&t.parent!==this&&t.remove().setParent(this),this}},{key:"getChild",value:function(){return this.child||null}},{key:"getParent",value:function(){return this.parent||null}},{key:"setInitChild",value:function(t){return this.initChild=t,this.setChild(t)}},{key:"addChild",value:function(t){return this.setChild(t),this}},{key:"removeChild",value:function(t){return t&&this.child===t?(this.child=null,t.setParent(null)):t||(this.child=null),this}},{key:"remove",value:function(){var t;return null===(t=this.parent)||void 0===t||t.removeChild(this),this}},{key:"hasChild",value:function(){return!!this.child}}],[{key:"forEachParent",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getParent()}},{key:"forEachChild",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getChild()}}])}(Se),xe={center:"center",left:"left",right:"right"};function Ae(t){return Ae="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},Ae(t)}function Te(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ee(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,je(r.key),r)}}function Oe(t,e,n){return e&&Ee(t.prototype,e),n&&Ee(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Pe(t,e,n){return(e=je(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function je(t){var e=function(t,e){if("object"!=Ae(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ae(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ae(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(_e||(_e={}));var Ce=Pe(Pe(Pe({},_e.Left,"33.33%"),_e.Center,"50%"),_e.Right,"66.66%"),Ie=function(){function t(){Te(this,t)}return Oe(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"".concat(e);var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + ").concat(n,"px)")}},{key:"toCoord2D",value:function(t){if(Me.isCommonPositionType(t))return Le.fromCommonPosition(t);if(Le.isCoord2DPosition(t))return t;if(Ne.isAlignPosition(t))return Le.fromAlignPosition(t);if("object"===Ae(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new Le(t);throw new Error("Invalid position type")}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return Le.merge(n,r)}},{key:"serializePosition",value:function(e){var n=this.toCoord2D(e);return{x:t.isUnknown(n.x)?0:n.x,y:t.isUnknown(n.y)?0:n.y,xoffset:t.isUnknown(n.xoffset)?0:n.xoffset,yoffset:t.isUnknown(n.yoffset)?0:n.yoffset}}},{key:"isRawCommonPositionType",value:function(t){return Object.values(_e).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===Ae(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===Ae(t)&&("xalign"in t||"yalign"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawPosition",value:function(t){return this.isRawCommonPositionType(t)||this.isRawCoord2DPosition(t)||this.isRawAlignPosition(t)}},{key:"isPosition",value:function(t){return t instanceof Me||t instanceof Le||t instanceof Ne}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return Le.fromCommonPosition(new Me(t));if(this.isRawCoord2DPosition(t))return new Le(t);if(this.isRawAlignPosition(t))return Le.fromAlignPosition(t);throw new Error("Invalid position type")}},{key:"tryParsePosition",value:function(t){if(this.isPosition(t))return t;if(this.isRawPosition(t))return this.rawPositionToCoord2D(t);throw new Error("Invalid position type")}}])}();Ie.Unknown=Symbol("Unknown");var Me=function(){function t(e){Te(this,t),this.position=e}return Oe(t,[{key:"toCSS",value:function(){return{x:Ce[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();Me.Positions=_e;var Le=function(){function t(e,n){Te(this,t),"object"===Ae(e)?(this.x=e.x||Ie.Unknown,this.y=e.y||Ie.Unknown,this.xoffset=e.xoffset||Ie.Unknown,this.yoffset=e.yoffset||Ie.Unknown):(this.x=e||Ie.Unknown,this.y=n||Ie.Unknown,this.xoffset=Ie.Unknown,this.yoffset=Ie.Unknown)}return Oe(t,[{key:"toCSS",value:function(){return{x:this.x,y:this.y,xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isCoord2DPosition",value:function(e){return e instanceof t}},{key:"fromCommonPosition",value:function(e){return new t({x:Ce[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:Ie.isUnknown(e.xalign)?Ie.Unknown:"".concat(100*e.xalign,"%"),y:Ie.isUnknown(e.yalign)?Ie.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:Ie.isUnknown(n.x)?e.x:n.x,y:Ie.isUnknown(n.y)?e.y:n.y,xoffset:Ie.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:Ie.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),Ne=function(){function t(e,n){Te(this,t),"object"===Ae(e)?(this.xalign=e.xalign||Ie.Unknown,this.yalign=e.yalign||Ie.Unknown,this.xoffset=e.xoffset||Ie.Unknown,this.yoffset=e.yoffset||Ie.Unknown):(this.xalign=e||Ie.Unknown,this.yalign=n||Ie.Unknown,this.xoffset=Ie.Unknown,this.yoffset=Ie.Unknown)}return Oe(t,[{key:"toCSS",value:function(){return{x:Ie.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:Ie.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();const Re=t=>t;let Fe=Re,Ve=Re;function De(t,e,n){var r;if("string"==typeof t){let o=document;e&&(Ve(Boolean(e.current),"Scope provided, but no element detected."),o=e.current),n?(null!==(r=n[t])&&void 0!==r||(n[t]=o.querySelectorAll(t)),t=n[t]):t=o.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}const Be=new WeakMap,$e=!1,Ue=!1;const He=["read","resolveKeyframes","update","preRender","render","postRender"];function Ge(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=He.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,o=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function s(e){i.has(e)&&(u.schedule(e),t()),e(a)}const u={schedule:(t,o=!1,a=!1)=>{const s=a&&r?e:n;return o&&i.add(t),s.has(t)||s.add(t),t},cancel:t=>{n.delete(t),i.delete(t)},process:t=>{a=t,r?o=!0:(r=!0,[e,n]=[n,e],n.clear(),e.forEach(s),r=!1,o&&(o=!1,u.process(t)))}};return u}(i),t)),{}),{read:s,resolveKeyframes:u,update:c,preRender:l,render:f,postRender:d}=a,p=()=>{const i=Ue?o.timestamp:performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(i-o.timestamp,40),1),o.timestamp=i,o.isProcessing=!0,s.process(o),u.process(o),c.process(o),l.process(o),f.process(o),d.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(p))};return{schedule:He.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(p)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<He.length;e++)a[He[e]].cancel(t)},state:o,steps:a}}const{schedule:ze,cancel:We,state:qe,steps:Ye}=Ge("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Re,!0);function Xe(t){let e;return()=>(void 0===e&&(e=t()),e)}const Ke=Xe((()=>void 0!==window.ScrollTimeline));class Ze{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>{if(!Ke()||!e.attachTimeline)return e.pause(),function(t,e){let n;const r=()=>{const{currentTime:r}=e,o=(null===r?0:r.value)/100;n!==o&&t(o),n=o};return ze.update(r,!0),()=>We(r)}((t=>{e.time=e.duration*t}),t);e.attachTimeline(t)}));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Qe=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Je=new Set(Qe),tn=t=>1e3*t,en=t=>t/1e3,nn={type:"spring",stiffness:500,damping:25,restSpeed:10},rn={type:"keyframes",duration:.8},on={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},an=(t,{keyframes:e})=>e.length>2?rn:Je.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:nn:on;function sn(t,e){return t[e]||t.default||t}const un=!1,cn=t=>null!==t;function ln(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(cn),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const fn=t=>/^0[^.\s]+$/u.test(t);const dn=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),pn=t=>e=>"string"==typeof e&&e.startsWith(t),hn=pn("--"),yn=pn("var(--"),vn=t=>!!yn(t)&&mn.test(t.split("/*")[0].trim()),mn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,gn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function bn(t,e,n=1){Ve(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,o]=function(t){const e=gn.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${null!=n?n:r}`,o]}(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const t=i.trim();return dn(t)?parseFloat(t):t}return vn(o)?bn(o,e,n+1):o}const wn=(t,e,n)=>n>e?e:n<t?t:n,_n={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Sn={..._n,transform:t=>wn(0,1,t)},kn={..._n,default:1},xn=t=>Math.round(1e5*t)/1e5,An=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,Tn=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,En=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function On(t){return"string"==typeof t}const Pn=t=>({test:e=>On(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),jn=Pn("deg"),Cn=Pn("%"),In=Pn("px"),Mn=Pn("vh"),Ln=Pn("vw"),Nn={...Cn,parse:t=>Cn.parse(t)/100,transform:t=>Cn.transform(100*t)},Rn=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Fn=t=>t===_n||t===In,Vn=(t,e)=>parseFloat(t.split(", ")[e]),Dn=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Vn(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?Vn(e[1],t):0}},Bn=new Set(["x","y","z"]),$n=Qe.filter((t=>!Bn.has(t)));const Un={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:Dn(4,13),y:Dn(5,14)};Un.translateX=Un.x,Un.translateY=Un.y;const Hn=t=>e=>e.test(t),Gn=[_n,In,Cn,jn,Ln,Mn,{test:t=>"auto"===t,parse:t=>t}],zn=t=>Gn.find(Hn(t)),Wn=new Set;let qn=!1,Yn=!1;function Xn(){if(Yn){const t=Array.from(Wn).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return $n.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var r;null===(r=t.getValue(e))||void 0===r||r.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}Yn=!1,qn=!1,Wn.forEach((t=>t.complete())),Wn.clear()}function Kn(){Wn.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Yn=!0)}))}class Zn{constructor(t,e,n,r,o,i=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=r,this.element=o,this.isAsync=i}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Wn.add(this),qn||(qn=!0,ze.read(Kn),ze.resolveKeyframes(Xn))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let o=0;o<t.length;o++)if(null===t[o])if(0===o){const o=null==r?void 0:r.get(),i=t[t.length-1];if(void 0!==o)t[0]=o;else if(n&&e){const r=n.readValue(e,i);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=i),r&&void 0===o&&r.set(t[0])}else t[o]=t[o-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Wn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Wn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Qn=(t,e)=>n=>Boolean(On(n)&&En.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Jn=(t,e,n)=>r=>{if(!On(r))return r;const[o,i,a,s]=r.match(An);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},tr={..._n,transform:t=>Math.round((t=>wn(0,255,t))(t))},er={test:Qn("rgb","red"),parse:Jn("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+tr.transform(t)+", "+tr.transform(e)+", "+tr.transform(n)+", "+xn(Sn.transform(r))+")"};const nr={test:Qn("#"),parse:function(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:er.transform},rr={test:Qn("hsl","hue"),parse:Jn("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Cn.transform(xn(e))+", "+Cn.transform(xn(n))+", "+xn(Sn.transform(r))+")"},or={test:t=>er.test(t)||nr.test(t)||rr.test(t),parse:t=>er.test(t)?er.parse(t):rr.test(t)?rr.parse(t):nr.parse(t),transform:t=>On(t)?t:t.hasOwnProperty("red")?er.transform(t):rr.transform(t)};const ir="number",ar="color",sr="var",ur="var(",cr="${}",lr=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function fr(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(lr,(t=>(or.test(t)?(r.color.push(i),o.push(ar),n.push(or.parse(t))):t.startsWith(ur)?(r.var.push(i),o.push(sr),n.push(t)):(r.number.push(i),o.push(ir),n.push(parseFloat(t))),++i,cr))).split(cr);return{values:n,split:a,indexes:r,types:o}}function dr(t){return fr(t).values}function pr(t){const{split:e,types:n}=fr(t),r=e.length;return t=>{let o="";for(let i=0;i<r;i++)if(o+=e[i],void 0!==t[i]){const e=n[i];o+=e===ir?xn(t[i]):e===ar?or.transform(t[i]):t[i]}return o}}const hr=t=>"number"==typeof t?0:t;const yr={test:function(t){var e,n;return isNaN(t)&&On(t)&&((null===(e=t.match(An))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(Tn))||void 0===n?void 0:n.length)||0)>0},parse:dr,createTransformer:pr,getAnimatableNone:function(t){const e=dr(t);return pr(t)(e.map(hr))}},vr=new Set(["brightness","contrast","saturate","opacity"]);function mr(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(An)||[];if(!r)return t;const o=n.replace(r,"");let i=vr.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const gr=/\b([a-z-]*)\(.*?\)/gu,br={...yr,getAnimatableNone:t=>{const e=t.match(gr);return e?e.map(mr).join(" "):t}},wr={..._n,transform:Math.round},_r={borderWidth:In,borderTopWidth:In,borderRightWidth:In,borderBottomWidth:In,borderLeftWidth:In,borderRadius:In,radius:In,borderTopLeftRadius:In,borderTopRightRadius:In,borderBottomRightRadius:In,borderBottomLeftRadius:In,width:In,maxWidth:In,height:In,maxHeight:In,size:In,top:In,right:In,bottom:In,left:In,padding:In,paddingTop:In,paddingRight:In,paddingBottom:In,paddingLeft:In,margin:In,marginTop:In,marginRight:In,marginBottom:In,marginLeft:In,rotate:jn,rotateX:jn,rotateY:jn,rotateZ:jn,scale:kn,scaleX:kn,scaleY:kn,scaleZ:kn,skew:jn,skewX:jn,skewY:jn,distance:In,translateX:In,translateY:In,translateZ:In,x:In,y:In,z:In,perspective:In,transformPerspective:In,opacity:Sn,originX:Nn,originY:Nn,originZ:In,zIndex:wr,backgroundPositionX:In,backgroundPositionY:In,fillOpacity:Sn,strokeOpacity:Sn,numOctaves:wr},Sr={..._r,color:or,backgroundColor:or,outlineColor:or,fill:or,stroke:or,borderColor:or,borderTopColor:or,borderRightColor:or,borderBottomColor:or,borderLeftColor:or,filter:br,WebkitFilter:br},kr=t=>Sr[t];function xr(t,e){let n=kr(t);return n!==br&&(n=yr),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Ar=new Set(["auto","none","0"]);class Tr extends Zn{constructor(t,e,n,r,o){super(t,e,n,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let r=t[n];if("string"==typeof r&&(r=r.trim(),vn(r))){const o=bn(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Rn.has(n)||2!==t.length)return;const[r,o]=t,i=zn(r),a=zn(o);if(i!==a)if(Fn(i)&&Fn(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(r=t[e])?0===r:null===r||"none"===r||"0"===r||fn(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,o=0;for(;o<t.length&&!r;){const e=t[o];"string"==typeof e&&!Ar.has(e)&&fr(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=xr(n,r)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Un[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const r=e[e.length-1];void 0!==r&&t.getValue(n,r).jump(r,!1)}measureEndState(){var t;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=Un[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==a&&void 0===this.finalKeyframe&&(this.finalKeyframe=a),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach((([t,n])=>{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}let Er;function Or(){Er=void 0}const Pr={now:()=>(void 0===Er&&Pr.set(qe.isProcessing||Ue?qe.timestamp:performance.now()),Er),set:t=>{Er=t,queueMicrotask(Or)}},jr=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!yr.test(t)&&"0"!==t||t.startsWith("url(")));class Cr{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:i="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Pr.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:o,repeatType:i,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Kn(),Xn()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Pr.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!function(t,e,n,r){const o=t[0];if(null===o)return!1;if("display"===e||"visibility"===e)return!0;const i=t[t.length-1],a=jr(o,e),s=jr(i,e);return Fe(a===s,`You are trying to animate ${e} from "${o}" to "${i}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${i} via the \`style\` property.`),!(!a||!s)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||"spring"===n&&r)}(t,n,r,o)){if(un||!i)return null==s||s(ln(t,this.options,e)),null==a||a(),void this.resolveFinishedPromise();this.options.duration=0}const c=this.initPlayback(t,e);!1!==c&&(this._resolved={keyframes:t,finalKeyframe:e,...c},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function Ir(t,e){return e?t*(1e3/e):0}const Mr=5;function Lr(t,e,n){const r=Math.max(e-Mr,0);return Ir(n-t(r),e-r)}const Nr=.001,Rr=.01,Fr=10,Vr=.05,Dr=1;function Br({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;Fe(t<=tn(Fr),"Spring duration must be 10 seconds or less");let a=1-e;a=wn(Vr,Dr,a),t=wn(Rr,Fr,en(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=Ur(e,a),u=Math.exp(-o);return Nr-i/s*u},i=e=>{const r=e*a*t,i=r*n+n,s=Math.pow(a,2)*Math.pow(e,2)*t,u=Math.exp(-r),c=Ur(Math.pow(e,2),a);return(-o(e)+Nr>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-Nr,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<$r;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=tn(t),isNaN(s))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(s,2)*r;return{stiffness:e,damping:2*a*Math.sqrt(r*e),duration:t}}}const $r=12;function Ur(t,e){return t*Math.sqrt(1-e*e)}const Hr=["duration","bounce"],Gr=["stiffness","damping","mass"];function zr(t,e){return e.some((e=>void 0!==t[e]))}function Wr({keyframes:t,restDelta:e,restSpeed:n,...r}){const o=t[0],i=t[t.length-1],a={done:!1,value:o},{stiffness:s,damping:u,mass:c,duration:l,velocity:f,isResolvedFromDuration:d}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!zr(t,Gr)&&zr(t,Hr)){const n=Br(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-en(r.velocity||0)}),p=f||0,h=u/(2*Math.sqrt(s*c)),y=i-o,v=en(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),h<1){const t=Ur(v,h);g=e=>{const n=Math.exp(-h*v*e);return i-n*((p+h*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===h)g=t=>i-Math.exp(-v*t)*(y+(p+v*y)*t);else{const t=v*Math.sqrt(h*h-1);g=e=>{const n=Math.exp(-h*v*e),r=Math.min(t*e,300);return i-n*((p+h*v*y)*Math.sinh(r)+t*y*Math.cosh(r))/t}}return{calculatedDuration:d&&l||null,next:t=>{const r=g(t);if(d)a.done=t>=l;else{let o=0;h<1&&(o=0===t?tn(p):Lr(g,t,r));const s=Math.abs(o)<=n,u=Math.abs(i-r)<=e;a.done=s&&u}return a.value=a.done?i:r,a}}}function qr({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:u,restDelta:c=.5,restSpeed:l}){const f=t[0],d={done:!1,value:f},p=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let h=n*e;const y=f+h,v=void 0===a?y:a(y);v!==y&&(h=v-f);const m=t=>-h*Math.exp(-t/r),g=t=>v+m(t),b=t=>{const e=m(t),n=g(t);d.done=Math.abs(e)<=c,d.value=d.done?v:n};let w,_;const S=t=>{var e;(e=d.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,_=Wr({keyframes:[d.value,p(d.value)],velocity:Lr(g,t,d.value),damping:o,stiffness:i,restDelta:c,restSpeed:l}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return _||void 0!==w||(e=!0,b(t),S(t)),void 0!==w&&t>=w?_.next(t-w):(!e&&b(t),d)}}}const Yr=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Xr=1e-7,Kr=12;function Zr(t,e,n,r){if(t===e&&n===r)return Re;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Yr(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>Xr&&++s<Kr);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Yr(o(t),e,r)}const Qr=Zr(.42,0,1,1),Jr=Zr(0,0,.58,1),to=Zr(.42,0,.58,1),eo=t=>Array.isArray(t)&&"number"!=typeof t[0],no=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,ro=t=>e=>1-t(1-e),oo=t=>1-Math.sin(Math.acos(t)),io=ro(oo),ao=no(oo),so=Zr(.33,1.53,.69,.99),uo=ro(so),co={linear:Re,easeIn:Qr,easeInOut:to,easeOut:Jr,circIn:oo,circInOut:ao,circOut:io,backIn:uo,backInOut:no(uo),backOut:so,anticipate:t=>(t*=2)<1?.5*uo(t):.5*(2-Math.pow(2,-10*(t-1)))},lo=t=>{if(Array.isArray(t)){Ve(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return Zr(e,n,r,o)}return"string"==typeof t?(Ve(void 0!==co[t],`Invalid easing type '${t}'`),co[t]):t},fo=(t,e)=>n=>e(t(n)),po=(...t)=>t.reduce(fo),ho=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},yo=(t,e,n)=>t+(e-t)*n;function vo(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function mo(t,e){return n=>n>0?e:t}const go=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},bo=[nr,er,rr];function wo(t){const e=(n=t,bo.find((t=>t.test(n))));var n;if(Fe(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let r=e.parse(t);return e===rr&&(r=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,i=0,a=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,s=2*n-r;o=vo(s,r,t+1/3),i=vo(s,r,t),a=vo(s,r,t-1/3)}else o=i=a=n;return{red:Math.round(255*o),green:Math.round(255*i),blue:Math.round(255*a),alpha:r}}(r)),r}const _o=(t,e)=>{const n=wo(t),r=wo(e);if(!n||!r)return mo(t,e);const o={...n};return t=>(o.red=go(n.red,r.red,t),o.green=go(n.green,r.green,t),o.blue=go(n.blue,r.blue,t),o.alpha=yo(n.alpha,r.alpha,t),er.transform(o))},So=new Set(["none","hidden"]);function ko(t,e){return n=>yo(t,e,n)}function xo(t){return"number"==typeof t?ko:"string"==typeof t?vn(t)?mo:or.test(t)?_o:Eo:Array.isArray(t)?Ao:"object"==typeof t?or.test(t)?_o:To:mo}function Ao(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>xo(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function To(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=xo(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const Eo=(t,e)=>{const n=yr.createTransformer(e),r=fr(t),o=fr(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?So.has(t)&&!o.values.length||So.has(e)&&!r.values.length?function(t,e){return So.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):po(Ao(function(t,e){var n;const r=[],o={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],s=t.indexes[a][o[a]],u=null!==(n=t.values[s])&&void 0!==n?n:0;r[i]=u,o[a]++}return r}(r,o),o.values),n):(Fe(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),mo(t,e))};function Oo(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return yo(t,e,n);return xo(t)(t,e)}function Po(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(Ve(i===e.length,"Both input and output ranges must be the same length"),1===i)return()=>e[0];if(2===i&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const r=[],o=n||Oo,i=t.length-1;for(let n=0;n<i;n++){let i=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||Re:e;i=po(t,i)}r.push(i)}return r}(e,r,o),s=a.length,u=e=>{let n=0;if(s>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=ho(t[n],t[n+1],e);return a[n](r)};return n?e=>u(wn(t[0],t[i-1],e)):u}function jo(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=ho(0,e,r);t.push(yo(n,1,o))}}function Co(t){const e=[0];return jo(e,t.length-1),e}function Io({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=eo(r)?r.map(lo):lo(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Co(e),t),s=Po(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||to)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const Mo=2e4;function Lo(t){let e=0;let n=t.next(e);for(;!n.done&&e<Mo;)e+=50,n=t.next(e);return e>=Mo?1/0:e}const No=t=>{const e=({timestamp:e})=>t(e);return{start:()=>ze.update(e,!0),stop:()=>We(e),now:()=>qe.isProcessing?qe.timestamp:Pr.now()}},Ro={decay:qr,inertia:qr,tween:Io,keyframes:Io,spring:Wr},Fo=t=>t/100;class Vo extends Cr{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:r,keyframes:o}=this.options,i=(null==r?void 0:r.KeyframeResolver)||Zn;this.resolver=new i(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:o,velocity:i=0}=this.options,a=Ro[e]||Io;let s,u;a!==Io&&"number"!=typeof t[0]&&(s=po(Fo,Oo(t[0],t[1])),t=[0,100]);const c=a({...this.options,keyframes:t});"mirror"===o&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-i})),null===c.calculatedDuration&&(c.calculatedDuration=Lo(c));const{calculatedDuration:l}=c,f=l+r;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:s,calculatedDuration:l,resolvedDuration:f,totalDuration:f*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:o,mirroredGenerator:i,mapPercentToKeyframes:a,keyframes:s,calculatedDuration:u,totalDuration:c,resolvedDuration:l}=n;if(null===this.startTime)return o.next(0);const{delay:f,repeat:d,repeatType:p,repeatDelay:h,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-f*(this.speed>=0?1:-1),m=this.speed>=0?v<0:v>c;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let g=this.currentTime,b=o;if(d){const t=Math.min(this.currentTime,c)/l;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===p?(n=1-n,h&&(n-=h/l)):"mirror"===p&&(b=i)),g=wn(0,1,n)*l}const w=m?{done:!1,value:s[0]}:b.next(g);a&&(w.value=a(w.value));let{done:_}=w;m||null===u||(_=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&_);return S&&void 0!==r&&(w.value=ln(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?en(t.calculatedDuration):0}get time(){return en(this.currentTime)}set time(t){t=tn(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=en(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=No,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const Do=new Set(["opacity","clipPath","filter","transform"]),Bo=t=>Array.isArray(t)&&"number"==typeof t[0];function $o(t){return Boolean(!t||"string"==typeof t&&t in Ho||Bo(t)||Array.isArray(t)&&t.every($o))}const Uo=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Ho={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Uo([0,.65,.55,1]),circOut:Uo([.55,0,1,.45]),backIn:Uo([.31,.01,.66,-.59]),backOut:Uo([.33,1.53,.69,.99])};function Go(t){return zo(t)||Ho.easeOut}function zo(t){return t?Bo(t)?Uo(t):Array.isArray(t)?t.map(Go):Ho[t]:void 0}const Wo=Xe((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class qo extends Cr{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new Tr(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:a,motionValue:s,name:u,startTime:c}=this.options;if(!(null===(n=s.owner)||void 0===n?void 0:n.current))return!1;if(function(t){return"spring"===t.type||!$o(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new Vo({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const o=[];let i=0;for(;!r.done&&i<2e4;)r=n.sample(i),o.push(r.value),i+=10;return{times:void 0,keyframes:o,duration:i-10,ease:"linear"}}(t,c);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,o=l.times,i=l.ease,a="keyframes"}const l=function(t,e,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:a="loop",ease:s,times:u}={}){const c={[e]:n};u&&(c.offset=u);const l=zo(s);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(l.timeline=this.pendingTimeline,this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(ln(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:l,duration:r,times:o,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return en(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return en(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=tn(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return Re;const{animation:n}=e;n.timeline=t,n.onfinish=null}else this.pendingTimeline=t;return Re}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:r,type:o,ease:i,times:a}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:s,element:u,...c}=this.options,l=new Vo({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=tn(this.time);t.setWithVelocity(l.sample(f-10).value,l.sample(f).value,10)}const{onStop:s}=this.options;s&&s(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:i,type:a}=t;return Wo()&&n&&Do.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const Yo=(t,e,n,r={},o,i,a)=>s=>{const u=sn(r,t)||{},c=u.delay||r.delay||0;let{elapsed:l=0}=r;l-=tn(c);let f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-l,onUpdate:t=>{e.set(t),u.onUpdate&&u.onUpdate(t)},onComplete:()=>{s(),u.onComplete&&u.onComplete(),a&&a()},onStop:a,name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(u)||(f={...f,...an(t,f)}),f.duration&&(f.duration=tn(f.duration)),f.repeatDelay&&(f.repeatDelay=tn(f.repeatDelay)),void 0!==f.from&&(f.keyframes[0]=f.from);let d=!1;if((!1===f.type||0===f.duration&&!f.repeatDelay)&&(f.duration=0,0===f.delay&&(d=!0)),(un||$e)&&(d=!0,f.duration=0,f.delay=0),d&&!i&&void 0!==e.get()){const t=ln(f.keyframes,u);if(void 0!==t)return ze.update((()=>{f.onUpdate(t),f.onComplete()})),new Ze([])}return!i&&qo.supports(f)?new qo(f):new Vo(f)},Xo=t=>Array.isArray(t),Ko=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Zo=t=>Xo(t)?t[t.length-1]||0:t;function Qo(t,e){-1===t.indexOf(e)&&t.push(e)}function Jo(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class ti{constructor(){this.subscriptions=[]}add(t){return Qo(this.subscriptions,t),()=>Jo(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ei={current:void 0};class ni{constructor(t,e={}){this.version="11.5.4",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=Pr.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=Pr.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new ti);const n=this.events[t].add(e);return"change"===t?()=>{n(),ze.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return ei.current&&ei.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Pr.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Ir(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ri(t,e){return new ni(t,e)}function oi(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function ii(t,e,n,r){if("function"==typeof e){const[o,i]=oi(r);e=e(void 0!==n?n:t.custom,o,i)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[o,i]=oi(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function ai(t,e,n){const r=t.getProps();return ii(r,e,void 0!==n?n:r.custom,t)}function si(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ri(n))}const ui=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ci="data-"+ui("framerAppearId");function li(t){return t.props[ci]}function fi(t){return Je.has(t)?"transform":Do.has(t)?ui(t):void 0}class di extends ni{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(t){const e=fi(t);if(!e)return;const n=this.counts.get(e)||0;this.counts.set(e,n+1),0===n&&(this.output.push(e),this.update());let r=!1;return()=>{if(r)return;r=!0;const t=this.counts.get(e)-1;this.counts.set(e,t),0===t&&(Jo(this.output,e),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}const pi=t=>Boolean(t&&t.getVelocity);function hi(t,e){var n;if(!t.applyWillChange)return;let r=t.getValue("willChange");return r||(null===(n=t.props.style)||void 0===n?void 0:n.willChange)||(r=new di("auto"),t.addValue("willChange",r)),o=r,Boolean(pi(o)&&o.add)?r.add(e):void 0;var o}function yi({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function vi(t,e,{delay:n=0,transitionOverride:r,type:o}={}){var i;let{transition:a=t.getDefaultTransition(),transitionEnd:s,...u}=e;r&&(a=r);const c=[],l=o&&t.animationState&&t.animationState.getState()[o];for(const e in u){const r=t.getValue(e,null!==(i=t.latestValues[e])&&void 0!==i?i:null),o=u[e];if(void 0===o||l&&yi(l,e))continue;const s={delay:n,...sn(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=li(t);if(n){const t=window.MotionHandoffAnimation(n,e,ze);null!==t&&(s.startTime=t,f=!0)}}r.start(Yo(e,r,o,t.shouldReduceMotion&&Je.has(e)?{type:!1}:s,t,f,hi(t,e)));const d=r.animation;d&&c.push(d)}return s&&Promise.all(c).then((()=>{ze.update((()=>{s&&function(t,e){const n=ai(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)si(t,e,Zo(i[e]))}(t,s)}))})),c}const mi={};function gi(t,{layout:e,layoutId:n}){return Je.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!mi[t]||"opacity"===t)}function bi(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(pi(o[a])||e.style&&pi(e.style[a])||gi(a,t)||void 0!==(null===(r=null==n?void 0:n.getValue(a))||void 0===r?void 0:r.liveStyle))&&(i[a]=o[a]);return n&&o&&"string"==typeof o.willChange&&(n.applyWillChange=!1),i}function wi(t,e,n){const r=bi(t,e,n);for(const n in t)if(pi(t[n])||pi(e[n])){r[-1!==Qe.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const _i="undefined"!=typeof window,Si={current:null},ki={current:!1};function xi(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function Ai(t){return"string"==typeof t||Array.isArray(t)}const Ti=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ei=["initial",...Ti];function Oi(t){return xi(t.animate)||Ei.some((e=>Ai(t[e])))}function Pi(t){return Boolean(Oi(t)||t.variants)}const ji={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ci={};for(const t in ji)Ci[t]={isEnabled:e=>ji[t].some((t=>!!e[t]))};const Ii=[...Gn,or,yr],Mi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Li=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Ni=Ei.length;class Ri{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:o,visualState:i},a={}){this.applyWillChange=!1,this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Zn,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,ze.render(this.render,!1,!0))};const{latestValues:s,renderState:u}=i;this.latestValues=s,this.baseTarget={...s},this.initialValues=e.initial?{...s}:{},this.renderState=u,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=Oi(e),this.isVariantNode=Pi(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:c,...l}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in l){const e=l[t];void 0!==s[t]&&pi(e)&&e.set(s[t],!1)}}mount(t){this.current=t,Be.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),ki.current||function(){if(ki.current=!0,_i)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Si.current=t.matches;t.addListener(e),e()}else Si.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Si.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Be.delete(this.current),this.projection&&this.projection.unmount(),We(this.notifyUpdate),We(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=Je.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&ze.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),o=e.on("renderRequest",this.scheduleRender);let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),o(),i&&i(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in Ci){const e=Ci[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<Li.length;e++){const n=Li[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){for(const r in e){const o=e[r],i=n[r];if(pi(o))t.addValue(r,o);else if(pi(i))t.addValue(r,ri(o,{owner:t}));else if(i!==o)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(o):e.hasAnimated||e.set(o)}else{const e=t.getStaticValue(r);t.addValue(r,ri(void 0!==e?e:o,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const e={};for(let t=0;t<Ni;t++){const n=Ei[t],r=this.props[n];(Ai(r)||!1===r)&&(e[n]=r)}return e}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=ri(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let r=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var o;return null!=r&&("string"==typeof r&&(dn(r)||fn(r))?r=parseFloat(r):(o=r,!Ii.find(Hn(o))&&yr.test(e)&&(r=xr(t,e))),this.setBaseTarget(t,pi(r)?r.get():r)),pi(r)?r.get():r}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const o=ii(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);o&&(r=o[t])}if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,t);return void 0===o||pi(o)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:o}on(t,e){return this.events[t]||(this.events[t]=new ti),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Fi extends Ri{constructor(){super(...arguments),this.KeyframeResolver=Tr}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}}const Vi=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Di={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Bi=Qe.length;function $i(t,e,n){const{style:r,vars:o,transformOrigin:i}=t;let a=!1,s=!1;for(const t in e){const n=e[t];if(Je.has(t))a=!0;else if(hn(t))o[t]=n;else{const e=Vi(n,_r[t]);t.startsWith("origin")?(s=!0,i[t]=e):r[t]=e}}if(e.transform||(a||n?r.transform=function(t,e,n){let r="",o=!0;for(let i=0;i<Bi;i++){const a=Qe[i],s=t[a];if(void 0===s)continue;let u=!0;if(u="number"==typeof s?s===(a.startsWith("scale")?1:0):0===parseFloat(s),!u||n){const t=Vi(s,_r[a]);u||(o=!1,r+=`${Di[a]||a}(${t}) `),n&&(e[a]=t)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),s){const{originX:t="50%",originY:e="50%",originZ:n=0}=i;r.transformOrigin=`${t} ${e} ${n}`}}function Ui(t,e,n){return"string"==typeof t?t:In.transform(e+n*t)}const Hi={offset:"stroke-dashoffset",array:"stroke-dasharray"},Gi={offset:"strokeDashoffset",array:"strokeDasharray"};function zi(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if($i(t,c,f),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:d,style:p,dimensions:h}=t;d.transform&&(h&&(p.transform=d.transform),delete d.transform),h&&(void 0!==o||void 0!==i||p.transform)&&(p.transformOrigin=function(t,e,n){return`${Ui(e,t.x,t.width)} ${Ui(n,t.y,t.height)}`}(h,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(d.x=e),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==a&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?Hi:Gi;t[i.offset]=In.transform(-r);const a=In.transform(e),s=In.transform(n);t[i.array]=`${a} ${s}`}(d,a,s,u,!1)}const Wi=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function qi(t,{style:e,vars:n},r,o){Object.assign(t.style,e,o&&o.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}function Yi(t,e,n,r){qi(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Wi.has(n)?n:ui(n),e.attrs[n])}const Xi=t=>"string"==typeof t&&"svg"===t.toLowerCase();class Ki extends Fi{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Mi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Je.has(e)){const t=kr(e);return t&&t.default||0}return e=Wi.has(e)?e:ui(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return wi(t,e,n)}build(t,e,n){zi(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Yi(t,e,0,r)}mount(t){this.isSVGTag=Xi(t.tagName),super.mount(t)}}function Zi(t,e){return function({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}class Qi extends Fi{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=qi}readValueFromInstance(t,e){if(Je.has(e)){const t=kr(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(hn(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Zi(t,e)}build(t,e,n){$i(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return bi(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;pi(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}function Ji(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=function(t){return t instanceof SVGElement&&"svg"!==t.tagName}(t)?new Ki(e):new Qi(e);n.mount(t),Be.set(t,n)}function ta(t,e,n){const r=pi(t)?t:ri(t);return r.start(Yo("",r,e,n)),r.animation}function ea(t,e=100){const n=Wr({keyframes:[0,e],...t}),r=Math.min(Lo(n),Mo);return{type:"keyframes",ease:t=>n.next(r*t).value/e,duration:en(r)}}function na(t,e,n,r){var o;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(o=r.get(e))&&void 0!==o?o:t}const ra=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t};function oa(t,e){return eo(t)?t[ra(0,t.length,e)]:t}function ia(t,e,n,r,o,i){!function(t,e,n){for(let r=0;r<t.length;r++){const o=t[r];o.at>e&&o.at<n&&(Jo(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:yo(o,i,r[a]),easing:oa(n,a)})}function aa(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const sa="easeInOut";function ua(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function ca(t,e){return e[t]||(e[t]=[]),e[t]}function la(t){return Array.isArray(t)?t:[t]}function fa(t,e){return t[e]?{...t,...t[e]}:{...t}}const da=t=>"number"==typeof t,pa=t=>t.every(da);function ha(t,e,n,r){const o=De(t,r),i=o.length;Ve(Boolean(i),"No valid element provided.");const a=[];for(let t=0;t<i;t++){const r=o[t];Be.has(r)||Ji(r);const s=Be.get(r),u={...n};"function"==typeof u.delay&&(u.delay=u.delay(t,i)),a.push(...vi(s,{...e,transition:u},{}))}return new Ze(a)}function ya(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r){const o=e.duration||.3,i=new Map,a=new Map,s={},u=new Map;let c=0,l=0,f=0;for(let n=0;n<t.length;n++){const i=t[n];if("string"==typeof i){u.set(i,l);continue}if(!Array.isArray(i)){u.set(i.name,na(l,i.at,c,u));continue}let[d,p,h={}]=i;void 0!==h.at&&(l=na(l,h.at,c,u));let y=0;const v=(t,n,r,i=0,a=0)=>{const s=la(t),{delay:u=0,times:c=Co(s),type:d="keyframes",...p}=n;let{ease:h=e.ease||"easeOut",duration:v}=n;const m="function"==typeof u?u(i,a):u,g=s.length;if(g<=2&&"spring"===d){let t=100;if(2===g&&pa(s)){const e=s[1]-s[0];t=Math.abs(e)}const e={...p};void 0!==v&&(e.duration=tn(v));const n=ea(e,t);h=n.ease,v=n.duration}null!=v||(v=o);const b=l+m,w=b+v;1===c.length&&0===c[0]&&(c[1]=1);const _=c.length-s.length;_>0&&jo(c,_),1===s.length&&s.unshift(null),ia(r,s,h,c,b,w),y=Math.max(m+v,y),f=Math.max(w,f)};if(pi(d))v(p,h,ca("default",ua(d,a)));else{const t=De(d,r,s),e=t.length;for(let n=0;n<e;n++){const r=ua(t[n],a);for(const t in p)v(p[t],fa(h,t),ca(t,r),n,e)}}c=l,l+=y}return a.forEach(((t,r)=>{for(const o in t){const a=t[o];a.sort(aa);const s=[],u=[],c=[];for(let t=0;t<a.length;t++){const{at:e,value:n,easing:r}=a[t];s.push(n),u.push(ho(0,f,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(sa)),1!==u[u.length-1]&&(u.push(1),s.push(null)),i.has(r)||i.set(r,{keyframes:{},transition:{}});const l=i.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:f,ease:c,times:u,...n}}})),i}(t,e,n);return o.forEach((({keyframes:t,transition:e},n)=>{let o;o=pi(n)?ta(n,t.default,e.default):ha(n,t,e),r.push(o)})),new Ze(r)}const va=function(t,e,n){let r;var o;return o=t,r=Array.isArray(o)&&Array.isArray(o[0])?ya(t,e,ma):function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?ha(t,e,n,ma):ta(t,e,n),ma&&ma.animations.push(r),r};var ma;function ga(t){return ga="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},ga(t)}function ba(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ba=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==ga(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value: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,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(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 P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(ga(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.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,v):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),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function wa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Sa(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function _a(t){return function(t){if(Array.isArray(t))return ka(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Sa(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 Sa(t,e){if(t){if("string"==typeof t)return ka(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ka(t,e):void 0}}function ka(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function xa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ta(r.key),r)}}function Aa(t,e,n){return(e=Ta(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ta(t){var e=function(t,e){if("object"!=ga(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ga(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ga(e)?e:e+""}var Ea=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Oa=Aa(Aa(Aa({},xe.left,"25.33%"),xe.center,"50%"),xe.right,"75.66%"),Pa=function(){function t(e,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequences=[],this.control=null,this.transformers={},Array.isArray(e)){var r;(r=this.sequences).push.apply(r,_a(e)),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions,n||{})}else{var o=e,i=n||t.defaultOptions;this.sequences.push({props:o,options:i||{}}),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions)}}return function(t,e,n){return e&&xa(t.prototype,e),n&&xa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r,o){var i=e.scope,a=e.overwrites;return Ea(this,void 0,void 0,ba().mark((function e(){var s=this;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=p(r,{}),e.abrupt("return",new Promise((function(e){Ea(s,void 0,void 0,ba().mark((function s(){var u,c,l,f,d=this;return ba().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||(e(),o&&o(r)),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=wa(this.sequences),s.prev=4,f=ba().mark((function e(){var o,s,u,c,f,h;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=l.value,s=o.props,u=o.options,c=p({},d.propToCSS(n,r)),i.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=i.current,Object.assign(f.style,c),r=t.mergeState(r,s),h=va(f,d.propToCSS(n,r,a),d.optionsToFramerMotionOptions(u)||{}),d.setControl(h),!1===(null==u?void 0:u.sync)){e.next=16;break}return e.next=12,new Promise((function(t){return h.then((function(){return t()}))}));case 12:Object.assign(f.style,d.propToCSS(n,r,a)),d.setControl(null),e.next=17;break;case 16:h.then((function(){Object.assign(f.style,d.propToCSS(n,r,a)),d.setControl(null)}));case 17:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){s.next=11;break}return s.delegateYield(f(),"t0",9);case 9:s.next=7;break;case 11:s.next=16;break;case 13:s.prev=13,s.t1=s.catch(4),c.e(s.t1);case 16:return s.prev=16,c.f(),s.finish(16);case 19:u++,s.next=2;break;case 22:return s.next=24,b(2);case 24:this.setControl(null),this.sequenceOptions.sync&&(e(),o&&o(r));case 26:case"end":return s.stop()}}),s,this,[[4,13,16,19]])})))})));case 2:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return"scale"in n?{width:"".concat(100*n.scale,"%")}:{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}}},c={};for(var l in c.transform=this.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"propToCSSTransform",value:function(t,e){var n;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var r=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},o=r.invertY,i=r.invertX;return["translate(".concat(i?"":"-","50%, ").concat(o?"":"-","50%)"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)")].filter(Boolean).join(" ")}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],[{key:"isPosition",value:function(t){return Me.isCommonPositionType(t)||Le.isCoord2DPosition(t)||Ne.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return Ie.D2PositionToCSS(t.toCSS(),n,e)}},{key:"backgroundToCSS",value:function(t){return null==t?{}:Is.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:v(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?Ie.mergePosition(Ie.tryParsePosition(t),Ie.tryParsePosition(e)):Ie.toCoord2D(Ie.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},p(t,e)),{position:n})}}])}();function ja(t){return ja="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},ja(t)}function Ca(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ia(r.key),r)}}function Ia(t){var e=function(t,e){if("object"!=ja(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ja(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ja(e)?e:e+""}function Ma(t,e,n){return e=Na(e),function(t,e){if(e&&("object"==ja(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)}(t,La()?Reflect.construct(e,n||[],Na(t).constructor):e.apply(t,n))}function La(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(La=function(){return!!t})()}function Na(t){return Na=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Na(t)}function Ra(t,e){return Ra=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ra(t,e)}Pa.defaultSequenceOptions={sync:!0,repeat:1},Pa.defaultOptions={duration:0,ease:"linear"},Pa.CommonImagePositionMap=Oa;var Fa=function(t){function e(t,n){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=Ma(this,e,[Ct.IdPrefixes.Image])).events=new m,r.ref=void 0,"string"==typeof t?(r.name=t,r.config=p(e.defaultConfig,n||{}),r.config.position&&(r.config.position=Ie.tryParsePosition(r.config.position))):(r.name="",r.config=p(e.defaultConfig,t),r.config.position&&(r.config.position=Ie.tryParsePosition(r.config.position))),r.state=p({},r.config),r.checkConfig(),r}return 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&&Ra(t,e)}(e,t),function(t,e,n){return e&&Ca(t.prototype,e),n&&Ca(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this.chain(this._init())}},{key:"checkConfig",value:function(){if(!this.config.src)throw new Error("Image src is required");if(!Pa.isPosition(this.config.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");return this}},{key:"setSrc",value:function(t,e){var n=this.chain();if(e){var r=e.copy();r.setSrc(Is.srcToString(t)),n._transitionSrc(r)}var o=new ys(this,ys.ActionTypes.setSrc,new ke(ue.getIdManager().getStringId()).setContent(["string"==typeof t?t:Is.staticImageDataToSrc(t)]));return n.chain(o)}},{key:"applyTransform",value:function(t){var e=new ys(this,ys.ActionTypes.applyTransform,new ke(ue.getIdManager().getStringId()).setContent([void 0,t,g()]));return this.chain(e)}},{key:"show",value:function(t){var e=t instanceof Pa?t:new Pa([{props:{opacity:1},options:t||{}}]),n=new ys(this,ys.ActionTypes.show,new ke(ue.getIdManager().getStringId()).setContent([void 0,e]));return this.chain(n)}},{key:"hide",value:function(t){var e=new ys(this,ys.ActionTypes.hide,new ke(ue.getIdManager().getStringId()).setContent([void 0,t instanceof Pa?t:new Pa([{props:{opacity:0},options:t||{}}])]));return this.chain(e)}},{key:"toTransform",value:function(){return new Pa(this.state,{duration:0})}},{key:"setScope",value:function(t){return this.ref=t,this}},{key:"getScope",value:function(){return this.ref}},{key:"copy",value:function(){return new e(this.name,this.config)}},{key:"toData",value:function(){return this.state.disposed||w(this.state,this.config)?null:{state:p({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=p(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_setTransition",value:function(t){return this.chain(new ys(this,ys.ActionTypes.setTransition,new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"_applyTransition",value:function(t){return this.chain(new ys(this,"image:applyTransition",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._setTransition(e)._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new ys(this,ys.ActionTypes.dispose,new ke(ue.getIdManager().getStringId())))}},{key:"_init",value:function(t){return new ys(this,ys.ActionTypes.init,new ke(ue.getIdManager().getStringId()).setContent([t]))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return Ie.serializePosition(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}},{key:"deserializeImageState",value:function(t){var e={position:function(t){return Ie.toCoord2D(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}}])}(Ct);function Va(t){return Va="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},Va(t)}function Da(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ba(r.key),r)}}function Ba(t){var e=function(t,e){if("object"!=Va(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Va(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Va(e)?e:e+""}Fa.EventTypes={"event:image.show":"event:image.show","event:image.hide":"event:image.hide","event:image.init":"event:image.init","event:image.applyTransform":"event:image.applyTransform","event:image.mount":"event:image.mount","event:image.unmount":"event:image.unmount","event:image.ready":"event:image.ready","event:image.elementLoaded":"event:image.elementLoaded","event:image.setTransition":"event:image.setTransition"},Fa.defaultConfig={src:"",display:!1,position:new Me(_e.Center),scale:1,rotation:0,opacity:0},Fa.ImagePosition=xe;var $a=function(){return function(t,e,n){return e&&Da(t.prototype,e),n&&Da(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.callee=e,this.type=n,this.contentNode=r,this.__stack=g(),this._id=ue.getIdManager().prefix("action",ue.getIdManager().getStringId(),"-")}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode}}},{key:"getId",value:function(){return this._id}},{key:"getFutureActions",value:function(){var t=this.contentNode.child;return t&&t.action?[t.action]:[]}}])}();$a.ActionTypes={action:"action"};var Ua={say:"character:say",action:"character:action"},Ha={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",setTransition:"scene:setTransition",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform"},Ga={action:"image:action",setSrc:"image:setSrc",setPosition:"image:setPosition",show:"image:show",hide:"image:hide",applyTransform:"image:applyTransform",init:"image:init",dispose:"image:dispose",setTransition:"image:setTransition",applyTransition:"image:applyTransition"},za={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},Wa={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat"};function qa(t){return qa="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},qa(t)}function Ya(t){return function(t){if(Array.isArray(t))return Qa(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Za(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 Xa(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Xa=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==qa(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value: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,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(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 P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(qa(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.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,v):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),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Ka(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||Za(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 Za(t,e){if(t){if("string"==typeof t)return Qa(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qa(t,e):void 0}}function Qa(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ja(t,e,n,r){var o=ts(ss(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ts(){return ts="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ss(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},ts.apply(null,arguments)}function es(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ns(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,os(r.key),r)}}function rs(t,e,n){return e&&ns(t.prototype,e),n&&ns(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function os(t){var e=function(t,e){if("object"!=qa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=qa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qa(e)?e:e+""}function is(t,e,n){return e=ss(e),function(t,e){if(e&&("object"==qa(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)}(t,as()?Reflect.construct(e,n||[],ss(t).constructor):e.apply(t,n))}function as(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(as=function(){return!!t})()}function ss(t){return ss=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ss(t)}function us(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&&cs(t,e)}function cs(t,e){return cs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cs(t,e)}var ls=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},fs=function(t){function e(t,n,r){var o;return es(this,e),(o=is(this,e,[t,n,r])).callee=t,o.contentNode.action=o,o}return us(e,t),rs(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}}])}($a),ds=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Ua.say){var r=new h((function(t){return t})).registerSkipController(new S((function(){return{type:n.type,node:n.contentNode.getChild()}}))),o=this.contentNode.getContent();return t.createText(this.contentNode.id,o,(function(){r.resolve({type:n.type,node:n.contentNode.getChild()})})),r}return Ja(e,"executeAction",this,3)([t])}}])}(fs);ds.ActionTypes=Ua;var ps=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var n,r=this;if(this.type===Ha.action)return Ja(e,"executeAction",this,3)([t]);if(this.type===Ha.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],Ja(e,"executeAction",this,3)([t]);if(this.type===Ha.sleep){var o=new h((function(t){return t})),i=this.contentNode.getContent();return new Promise((function(t){"number"==typeof i?setTimeout((function(){t()}),i):h.isAwaitable(i)?i.then(t):null==i||i.then(t)})).then((function(){o.resolve({type:r.type,node:r.contentNode.child}),t.stage.next()})),o}if(this.type===Ha.applyTransition){var a=(new h).registerSkipController(new S((function(){return t.logger.info("NarraLeaf-React: Background Transition","Skipped"),{type:r.type,node:r.contentNode.getChild()}}))),s=this.contentNode.getContent()[0];return this.callee.events.any("event:scene.applyTransition",s).then((function(){a.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),a}if(this.type===Ha.init){if(this.callee._liveState.active)return Ja(e,"executeAction",this,3)([t]);this.callee._liveState.active=!0;var u=new h((function(t){return t}));return t.registerSrcManager(this.callee.srcManager).addScene(this.callee),this.callee.events.once("event:scene.unmount",(function(){t.offSrcManager(r.callee.srcManager)})),this.callee.events.once("event:scene.mount",(function(){r.callee.state.backgroundMusic&&(bs.initSound(t,r.callee.state.backgroundMusic),r.callee.events.emit("event:scene.setBackgroundMusic",r.callee.state.backgroundMusic,r.callee.config.backgroundMusicFade))})),this.callee.events.once("event:scene.imageLoaded",(function(){var e=r.callee._initTransform();r.callee.events.any("event:scene.initTransform",e).then((function(){u.resolve({type:r.type,node:r.contentNode.child}),t.stage.next()}))})),u}if(this.type===Ha.exit){this.callee._liveState.active=!1,t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var c=new h((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){c.resolve({type:r.type,node:r.contentNode.child}),t.stage.next()})),c}if(this.type===Ha.jumpTo){var l=this.contentNode.getContent()[0],f=this.contentNode,d=(null===(n=l.sceneRoot)||void 0===n?void 0:n.contentNode)||null;return d&&f.addChild(d),Ja(e,"executeAction",this,3)([t])}if(this.type===Ha.setBackgroundMusic){var p=Ka(this.contentNode.getContent(),2),y=p[0],v=p[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),Ja(e,"executeAction",this,3)([t])}if(this.type===Ha.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),Ja(e,"executeAction",this,3)([t]);if(this.type===Ha.applyTransform){var m=Ka(this.contentNode.getContent(),1)[0],g=new h((function(t){return t})).registerSkipController(new S((function(){return{type:r.type,node:r.contentNode.getChild()}})));return this.callee.events.any("event:scene.applyTransform",m).then((function(){g.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,e,n;if(this.type===Ha.jumpTo){var r=null===(e=null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.sceneRoot)||void 0===e?void 0:e.contentNode;return(null==r?void 0:r.action)?[r.action]:[]}var o=null===(n=this.contentNode.child)||void 0===n?void 0:n.action;return o?[o]:[]}}])}(fs);ps.ActionTypes=Ha;var hs=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e)}(fs);hs.ActionTypes={action:"story:action"};var ys=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Ga.init){var r=t.findElementByImage(this.callee);r&&t.disposeImage(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createImage(this.callee,o);var i=new h((function(t){return t}));return this.callee.events.once("event:image.mount",(function(){return ls(n,void 0,void 0,Xa().mark((function e(){var n;return Xa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=this.callee.getScope())||void 0===n?void 0:n.current){e.next=3;break}return e.next=3,this.callee.events.any(Fa.EventTypes["event:image.elementLoaded"]);case 3:return e.next=5,this.callee.events.any("event:image.init");case 5:i.resolve({type:this.type,node:this.contentNode.child}),t.stage.next();case 7:case"end":return e.stop()}}),e,this)})))})),i}if(this.type===Ga.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.stage.forceUpdate(),Ja(e,"executeAction",this,3)([t]);if([Ga.show,Ga.hide,Ga.applyTransform].includes(this.type)){var a=new h((function(t){return t})).registerSkipController(new S((function(){return n.type===Ga.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}}))),s=this.contentNode.getContent()[1];return this.type===Ga.show&&(this.callee.state.display=!0,t.stage.forceUpdate()),t.animateImage(Fa.EventTypes["event:image.applyTransform"],this.callee,[s],(function(){var t;n.type===Ga.hide&&(n.callee.state.display=!1),a.resolve({type:n.type,node:(null===(t=n.contentNode)||void 0===t?void 0:t.child)||null})})),a}if(this.type===Ga.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),Ja(e,"executeAction",this,3)([t]);if(this.type===Ga.setTransition)return this.callee.events.emit("event:image.setTransition",this.contentNode.getContent()[0]),Ja(e,"executeAction",this,3)([t]);if(this.type===Ga.applyTransition){var u=new h((function(t){return t})).registerSkipController(new S((function(){return n.type===Ga.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}})));return this.contentNode.getContent()[0].start((function(){u.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),u}throw Ja(e,"unknownType",this,3)([])}}])}(fs);ys.ActionTypes=Ga;var vs=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var e,n,r=this.callee.evaluate(this.contentNode.getContent(),{gameState:t});return null===(e=null==r?void 0:r[r.length-1])||void 0===e||e.contentNode.addChild(this.contentNode.getChild()),this.contentNode.addChild((null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.contentNode)||null),{type:this.type,node:this.contentNode}}},{key:"getFutureActions",value:function(){return[].concat(Ya(this.callee._getFutureActions()),Ya(Ja(e,"getFutureActions",this,3)([])))}}])}(fs);vs.ActionTypes={action:"condition:action"};var ms=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),{type:this.type,node:this.contentNode}}}])}(fs);ms.ActionTypes={action:"script:action"};var gs=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var e=this,n=new h((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent();return[].concat(Ya(this.callee._getFutureActions(t.choices)),Ya(Ja(e,"getFutureActions",this,3)([])))}}])}(fs);gs.ActionTypes={action:"menu:action"};var bs=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===za.play){if(e.initSound(t,this.callee),!this.callee.$getHowl())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var r=new h((function(t){return t})),o=t.playSound(this.callee.$getHowl(),(function(){var t;n.callee.$stop(),r.resolve({type:n.type,node:(null===(t=n.contentNode)||void 0===t?void 0:t.child)||null})}));return this.callee.$setToken(o),r}var i=t.playSound(this.callee.$getHowl(),(function(){n.callee.$stop()}));return this.callee.$setToken(i),Ja(e,"executeAction",this,3)([t])}if(this.type===za.stop)return this.callee.$getHowl()&&(this.callee.$getHowl().stop(),this.callee.$stop()),Ja(e,"executeAction",this,3)([t]);if(this.type===za.fade){var a=Ka(this.contentNode.getContent(),1)[0],s=a.start,u=a.end,c=a.duration;if(this.callee.$getHowl()){var l=void 0===s?this.callee.$getHowl().volume():s;this.callee.$getHowl().fade(l,u,c,this.callee.$getToken())}return Ja(e,"executeAction",this,3)([t])}if(this.type===za.setVolume){var f=Ka(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().volume(f,this.callee.$getToken()),Ja(e,"executeAction",this,3)([t])}if(this.type===za.setRate){var d=Ka(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().rate(d,this.callee.$getToken()),Ja(e,"executeAction",this,3)([t])}if(this.type===za.pause)return this.callee.$getHowl()&&this.callee.$getHowl().pause(this.callee.$getToken()),Ja(e,"executeAction",this,3)([t]);if(this.type===za.resume)return this.callee.$getHowl()&&this.callee.$getHowl().play(this.callee.$getToken()),Ja(e,"executeAction",this,3)([t]);throw Ja(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.$getHowl()||e.$setHowl(new(t.getHowl())(e.getHowlOptions()))}}])}(fs);bs.ActionTypes=za;var ws=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAllActions",value:function(t,e){return ls(this,void 0,void 0,Xa().mark((function n(){var r,o,i;return Xa().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=Xa().mark((function e(){var n,r,i;return Xa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o)){e.next=3;break}return e.abrupt("return",0);case 3:if(!h.isAwaitable(n)){e.next=15;break}return e.next=6,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 6:if(r=e.sent,i=r.node){e.next=12;break}return e.abrupt("return",0);case 12:o=i.action;case 13:e.next=16;break;case 15:o=n;case 16:case"end":return e.stop()}}),e)}));case 3:if(r||!o){n.next=10;break}return n.delegateYield(i(),"t0",5);case 5:if(0!==n.t0){n.next=8;break}return n.abrupt("break",10);case 8:n.next=3;break;case 10:case"end":return n.stop()}}),n)})))}},{key:"executeSingleAction",value:function(t,e){return ls(this,void 0,void 0,Xa().mark((function n(){var r,o,i;return Xa().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!h.isAwaitable(r)){n.next=9;break}return n.next=4,new Promise((function(t){r.then((function(e){return t(r.result)}))}));case 4:return o=n.sent,i=o.node,n.abrupt("return",i);case 9:return n.abrupt("return",r);case 10:case"end":return n.stop()}}),n)})))}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.child})})),n):Ja(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n,r,o=this,i=Ka(this.contentNode.getContent(),1)[0];if(this.type===Wa.do){var a=null===(n=i[0])||void 0===n?void 0:n.contentNode,s=null===(r=i[i.length-1])||void 0===r?void 0:r.contentNode,u=this.contentNode.getChild();return null==s||s.addChild(u),this.contentNode.addChild(a||null),Ja(e,"executeAction",this,3)([t])}if(this.type===Wa.doAsync)return ls(o,void 0,void 0,Xa().mark((function e(){return Xa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),Ja(e,"executeAction",this,3)([t]);if(this.type===Wa.any){var c=new h((function(t){return t})),l=i.map((function(e){return o.executeSingleAction(t,e)}));return Promise.any(l).then((function(){c.resolve({type:o.type,node:o.contentNode.getChild()})})),c}if(this.type===Wa.all){var f=new h((function(t){return t}));return this.execute(t,f,i)}if(this.type===Wa.allAsync)return ls(o,void 0,void 0,Xa().mark((function e(){return Xa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),Ja(e,"executeAction",this,3)([t]);if(this.type===Wa.repeat){var d=Ka(this.contentNode.getContent(),2),p=d[0],y=d[1];return ls(o,void 0,void 0,Xa().mark((function e(){var n;return Xa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<y)){e.next=8;break}if(!(p.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,p[0]);case 5:n++,e.next=1;break;case 8:case"end":return e.stop()}}),e,this)}))),Ja(e,"executeAction",this,3)([t])}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=Ja(e,"getFutureActions",this,3)([]);return[].concat(Ya(t),Ya(n))}}])}(fs);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 Ss(t,e,n){return e=Es(e),function(t,e){if(e&&("object"==_s(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)}(t,As()?Reflect.construct(e,n||[],Es(t).constructor):e.apply(t,n))}function ks(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&&Ts(t,e)}function xs(t){var e="function"==typeof Map?new Map:void 0;return xs=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(As())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&Ts(o,n.prototype),o}(t,arguments,Es(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Ts(n,t)},xs(t)}function As(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(As=function(){return!!t})()}function Ts(t,e){return Ts=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ts(t,e)}function Es(t){return Es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Es(t)}function Os(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ps(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Cs(r.key),r)}}function js(t,e,n){return e&&Ps(t.prototype,e),n&&Ps(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Cs(t){var e=function(t,e){if("object"!=_s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_s(e)?e:e+""}ws.ActionTypes=Wa;var Is=function(){function t(){Os(this,t)}return js(t,null,[{key:"srcToString",value:function(t){return"string"==typeof t?t:t.src}},{key:"staticImageDataToSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"isStaticImageData",value:function(t){return void 0!==(null==t?void 0:t.src)}},{key:"backgroundToSrc",value:function(e){return t.isStaticImageData(e)?e.src:(null==e?void 0:e.url)||null}},{key:"isExternalSrc",value:function(t){return t.startsWith("http://")||t.startsWith("https://")}}])}(),Ms=function(t){function e(t){return Os(this,e),Ss(this,e,[t,{},"StaticScriptWarning"])}return ks(e,t),js(e,null,[{key:"isWarning",value:function(t){return t instanceof e}}])}(function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UseError";return Os(this,e),(r=Ss(this,e,[t])).props=n,r.name=o,r}return ks(e,t),js(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(xs(Error))),Ls=function(){return js((function t(e){Os(this,t),this.scene=e}),[{key:"run",value:function(){var t=new Map,e=[],n=new Set;if(!this.scene.getAllActions().length)return null;for(e.push(this.scene.getAllActions()[0]);e.length;){var r=e.shift();this.checkAction(r,t,n);var o=r.contentNode.child;o&&o.action&&e.push(o.action)}return t}},{key:"checkAction",value:function(t,e,n){if(t instanceof ys)e.has(t.callee)||e.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(e.get(t.callee),t);else if(t instanceof ps&&t.type===Ha.jumpTo){var r=t.contentNode.getContent()[0];if(n.has(r))return;n.add(r)}}},{key:"checkImage",value:function(t,e){if(e.type===Ga.dispose){if(t.isDisposed){var n="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Ms(n)}t.isDisposed=!0}else if([Ga.init,Ga.show,Ga.hide,Ga.applyTransform,Ga.applyTransition].includes(e.type)){if(t.isDisposed){var r="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Ms(r)}}else if(e.type===Ga.setSrc){var o=e.contentNode.getContent()[0];Is.isExternalSrc(o)&&(t.usedExternalSrc=!0)}}}])}();function Ns(t){return Ns="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},Ns(t)}function Rs(t){return function(t){if(Array.isArray(t))return Vs(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Fs(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 Fs(t,e){if(t){if("string"==typeof t)return Vs(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vs(t,e):void 0}}function Vs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ds(t,e,n){return e=$s(e),function(t,e){if(e&&("object"==Ns(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)}(t,Bs()?Reflect.construct(e,n||[],$s(t).constructor):e.apply(t,n))}function Bs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Bs=function(){return!!t})()}function $s(t){return $s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$s(t)}function Us(t,e){return Us=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Us(t,e)}function Hs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ws(r.key),r)}}function zs(t,e,n){return e&&Gs(t.prototype,e),n&&Gs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ws(t){var e=function(t,e){if("object"!=Ns(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ns(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ns(e)?e:e+""}var qs=function(){return zs((function t(e){Hs(this,t),this.handler=e}),[{key:"evaluate",value:function(t){var e=t.gameState;return{value:this.handler(this.getCtx({gameState:e}))}}},{key:"getCtx",value:function(t){return{gameState:t.gameState}}}])}(),Ys=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Hs(this,e),(t=Ds(this,e,[Ct.IdPrefixes.Condition])).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=p(e.defaultConfig,n),t}return 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&&Us(t,e)}(e,t),zs(e,[{key:"If",value:function(t,e){return this.conditions.If.condition=t instanceof qs?t:new qs(t),this.conditions.If.action=this.construct(Array.isArray(e)?e:[e]),this.chain()}},{key:"ElseIf",value:function(t,e){return this.conditions.ElseIf.push({condition:t instanceof qs?t:new qs(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){return this.conditions.Else.action=this.construct(Array.isArray(t)?t:[t]),this.chain()}},{key:"evaluate",value:function(t,e){var n,r,o={gameState:e.gameState},i=null===(n=t.If.condition)||void 0===n?void 0:n.evaluate(o);if(null==i?void 0:i.value)return t.If.action||null;var a,s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Fs(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(t.ElseIf);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=null===(r=u.condition)||void 0===r?void 0:r.evaluate(o);if(null==c?void 0:c.value)return u.action||null}}catch(t){s.e(t)}finally{s.f()}return t.Else.action||null}},{key:"fromChained",value:function(t){return[Reflect.construct(vs,[this,vs.ActionTypes.action,new ke(ue.getIdManager().getStringId()).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=St.toActions(t),i=0;i<o.length;i++){var a=o[i].contentNode,s=null===(r=o[i+1])||void 0===r?void 0:r.contentNode;s&&a.setInitChild(s),i===o.length-1&&e&&a.setInitChild(e),0===i&&n&&n.setInitChild(a)}return o}},{key:"_getFutureActions",value:function(){return[].concat(Rs(this.conditions.If.action||[]),Rs(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),Rs(this.conditions.Else.action||[]))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(Ct);function Xs(t){return Xs="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},Xs(t)}function Ks(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zs(r.key),r)}}function Zs(t){var e=function(t,e){if("object"!=Xs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Xs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xs(e)?e:e+""}function Qs(t,e,n){return e=tu(e),function(t,e){if(e&&("object"==Xs(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)}(t,Js()?Reflect.construct(e,n||[],tu(t).constructor):e.apply(t,n))}function Js(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Js=function(){return!!t})()}function tu(t){return tu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tu(t)}function eu(t,e){return eu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},eu(t,e)}Ys.defaultConfig={};var nu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Qs(this,e,[Ct.IdPrefixes.Control])}return 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&&eu(t,e)}(e,t),function(t,e,n){return e&&Ks(t.prototype,e),n&&Ks(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(ws.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(ws.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(ws.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(ws.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(ws.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(ws.ActionTypes.repeat,e,t)}},{key:"construct",value:function(t){for(var e,n=0;n<t.length;n++){var r=t[n];0!==n&&(null===(e=t[n-1])||void 0===e||e.contentNode.setInitChild(r.contentNode))}return t}},{key:"push",value:function(t,e){for(var n=St.toActions(e),r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=new ws(this,t,new ke(ue.getIdManager().getStringId()).setContent([this.construct(n)].concat(o)));return this.chain(a)}}],[{key:"do",value:function(t){return(new e).do(t)}},{key:"doAsync",value:function(t){return(new e).doAsync(t)}},{key:"any",value:function(t){return(new e).any(t)}},{key:"all",value:function(t){return(new e).all(t)}},{key:"allAsync",value:function(t){return(new e).allAsync(t)}},{key:"repeat",value:function(t,n){return(new e).repeat(t,n)}}])}(Ct);function ru(t){return ru="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},ru(t)}function ou(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,iu(r.key),r)}}function iu(t){var e=function(t,e){if("object"!=ru(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ru(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ru(e)?e:e+""}function au(t,e,n){return e=uu(e),function(t,e){if(e&&("object"==ru(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)}(t,su()?Reflect.construct(e,n||[],uu(t).constructor):e.apply(t,n))}function su(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(su=function(){return!!t})()}function uu(t){return uu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uu(t)}function cu(t,e){return cu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cu(t,e)}var lu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=au(this,e,[Ct.IdPrefixes.Menu])).choices=[],n.prompt=$t.isSentence(t)?t:new $t(null,t),n.config=p(e.defaultConfig,r),n}return 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&&cu(t,e)}(e,t),function(t,e,n){return e&&ou(t.prototype,e),n&&ou(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return $t.isSentence(t)&&e||(Ht.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:$t.toSentence(t),action:St.toActions(e)}):"object"===ru(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:$t.toSentence(t.prompt),action:St.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new gs(this,gs.ActionTypes.action,new ke(ue.getIdManager().getStringId()).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"construct",value:function(t,e,n){for(var r,o=0;o<t.length;o++){var i=t[o].contentNode,a=null===(r=t[o+1])||void 0===r?void 0:r.contentNode;a&&i.setInitChild(a),o===this.choices.length-1&&e&&i.setInitChild(e),0===o&&n&&n.setInitChild(i)}return t}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action})).flat(2)}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.construct(e.action),prompt:e.prompt}}))}}])}(Ct);function fu(t){return fu="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},fu(t)}function du(t){return function(t){if(Array.isArray(t))return pu(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 pu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pu(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 pu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function hu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yu(r.key),r)}}function yu(t){var e=function(t,e){if("object"!=fu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fu(e)?e:e+""}function vu(t,e,n){return e=gu(e),function(t,e){if(e&&("object"==fu(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)}(t,mu()?Reflect.construct(e,n||[],gu(t).constructor):e.apply(t,n))}function mu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(mu=function(){return!!t})()}function gu(t){return gu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gu(t)}function bu(t,e){return bu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bu(t,e)}lu.defaultConfig={},lu.targetAction=gs;var wu,_u=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=vu(this,e)).actions=[],t}return 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&&bu(t,e)}(e,t),function(t,e,n){return e&&hu(t.prototype,e),n&&hu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setRoot",value:function(t){var e,n;return null===(e=this.actions[0])||void 0===e||e.contentNode.setParent(t),t.setChild(null===(n=this.actions[0])||void 0===n?void 0:n.contentNode),this.actions[0]}},{key:"_getActions",value:function(){return this.actions}},{key:"getAllActions",value:function(t,e){var n=new Set;return this.forEachAction((function(t){return n.add(t)}),t,e),Array.from(n)}},{key:"forEachAction",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=[];((arguments.length>2?arguments[2]:void 0)||this._getActions()).forEach((function(r){var o=[];for(o.push(r);o.length>0;){var i=o.shift();if(i.type===Ha.jumpTo){if(!e||n.includes(i.getId()))continue;n.push(i.getId())}t(i);var a=i.getFutureActions();o.push.apply(o,du(a))}}))}},{key:"findActionById",value:function(t,e){if(e)return e.find((function(e){return e.getId()===t}))||null;var n=this._getActions(),r=[],o=[];for(r.push.apply(r,du(n));r.length>0;){var i=r.shift();if(i.getId()===t)return i;if(i.type===Ha.jumpTo){if(o.includes(i.getId()))continue;o.push(i.getId())}r.push.apply(r,du(i.getFutureActions()))}return null}},{key:"getAllElements",value:function(t){var e=t||this.getAllActions(),n=new Set(e.map((function(t){return t.callee})));return Array.from(n)}},{key:"getActionsByType",value:function(t,e){return(e||this.getAllActions()).filter((function(e){return e.type===t}))}},{key:"getAllNodes",value:function(t){var e=t||this.getAllActions(),n=new Set(e.map((function(t){return t.contentNode})));return Array.from(n)}},{key:"findNodeById",value:function(t,e){var n;return(null===(n=(e||this.getAllActions()).find((function(e){return e.contentNode.id===t})))||void 0===n?void 0:n.contentNode)||null}},{key:"findElementById",value:function(t,e){return e.find((function(e){return e.id===t}))||null}},{key:"findElementsByIds",value:function(t,e){var n=new Map;return e.forEach((function(t){return n.set(t.id,t)})),t.map((function(t){return n.get(t)})).filter(Boolean)}},{key:"fromChained",value:function(t){return t.getActions()}},{key:"construct",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setInitChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setInitChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(kt);function Su(t){return Su="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},Su(t)}function ku(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xu(r.key),r)}}function xu(t){var e=function(t,e){if("object"!=Su(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Su(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Su(e)?e:e+""}function Au(t,e,n){return e=Eu(e),function(t,e){if(e&&("object"==Su(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)}(t,Tu()?Reflect.construct(e,n||[],Eu(t).constructor):e.apply(t,n))}function Tu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Tu=function(){return!!t})()}function Eu(t){return Eu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Eu(t)}function Ou(t,e){return Ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ou(t,e)}_u.targetAction=$a,function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(wu||(wu={}));var Pu=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Au(this,e,[Ct.IdPrefixes.Sound])).state={playing:null,token:null},t.config=p(e.defaultConfig,n),t}return 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&&Ou(t,e)}(e,t),function(t,e,n){return e&&ku(t.prototype,e),n&&ku(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===wu.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(bs.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===wu.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(bs.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===wu.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(bs.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(bs.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(bs.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(bs.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(bs.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(){return{src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1}}},{key:"getSrc",value:function(){return this.config.src}},{key:"$setToken",value:function(t){this.state.token=t}},{key:"$getToken",value:function(){return this.state.token}},{key:"$setHowl",value:function(t){this.state.playing=t}},{key:"$getHowl",value:function(){return this.state.playing}},{key:"$stop",value:function(){this.$setToken(null),this.$setHowl(null)}},{key:"toData",value:function(){return w(this.config,e.defaultConfig)?null:{config:y(this.config)}}},{key:"fromData",value:function(t){return this.config=p(this.config,t.config),this}},{key:"pushAction",value:function(t,e){return this.chain(new bs(this,t,new ke(ue.getIdManager().getStringId()).setContent(e)))}}])}(Ct);function ju(t){return ju="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},ju(t)}function Cu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Iu(r.key),r)}}function Iu(t){var e=function(t,e){if("object"!=ju(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ju(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ju(e)?e:e+""}Pu.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var Mu=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.src=[],this.future=[]}return function(t,e,n){return e&&Cu(t.prototype,e),n&&Cu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"register",value:function(t,e){var n=this;if(Array.isArray(t))t.forEach((function(t){return n.register(t)}));else if(t instanceof Pu){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof Fa||Is.isStaticImageData(t)){if(t instanceof Fa){if(this.isSrcRegistered(Is.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(Is.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof Fa?t:new Fa("",{src:Is.staticImageDataToSrc(t)})})}else if("object"===ju(t)){if(this.isSrcRegistered(t.src||""))return this;this.src.push(t)}else if("audio"===t){if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e instanceof Pu?e:new Pu({src:e})})}else{if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e})}return this}},{key:"isSrcRegistered",value:function(e){var n=e instanceof Pu?e.getSrc():e;return this.src.some((function(e){return e.type===t.SrcTypes.audio?n===e.src.getSrc():e.type===t.SrcTypes.image?n===Is.srcToString(e.src.state.src):n===e.src}))}},{key:"getSrc",value:function(){return this.src}},{key:"getSrcByType",value:function(t){return this.src.filter((function(e){return e.type===t}))}},{key:"registerFuture",value:function(t){return this.future.includes(t)||this.hasFuture(t)||this.future.push(t),this}},{key:"hasFuture",value:function(t){return this.future.includes(t)}}])}();function Lu(t){return Lu="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},Lu(t)}function Nu(t){return function(t){if(Array.isArray(t))return Ru(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 Ru(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ru(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 Ru(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Fu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Vu(r.key),r)}}function Vu(t){var e=function(t,e){if("object"!=Lu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Lu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Lu(e)?e:e+""}function Du(t,e,n){return e=Uu(e),function(t,e){if(e&&("object"==Lu(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)}(t,Bu()?Reflect.construct(e,n||[],Uu(t).constructor):e.apply(t,n))}function Bu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Bu=function(){return!!t})()}function $u(){return $u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Uu(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},$u.apply(null,arguments)}function Uu(t){return Uu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uu(t)}function Hu(t,e){return Hu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Hu(t,e)}Mu.SrcTypes={image:"image",video:"video",audio:"audio"};var Gu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.defaultConfig;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Du(this,e)).srcManager=new Mu,n.events=new m,n._liveState={active:!1},n.id=ue.getIdManager().getStringId(),n.name=t,n.config=p(e.defaultConfig,r),n.state=p(e.defaultState,n.config),n.backgroundImageState={position:new Me(_e.Center)},n}return 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&&Hu(t,e)}(e,t),function(t,e,n){return e&&Fu(t.prototype,e),n&&Fu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"activate",value:function(){return this.chain(this._init(this))}},{key:"deactivate",value:function(){return this.chain(this._exit())}},{key:"setBackground",value:function(t,e){if(e){var n=e.copy();n.setSrc(Is.backgroundToSrc(t)),this.transitionSceneBackground(void 0,n)}return this.chain(new ps(this,"scene:setBackground",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"applyTransform",value:function(t){return this.chain(new ps(this,"scene:applyTransform",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"jumpTo",value:function(t,e){var n=e||{};return this.chain(new ps(this,"scene:preUnmount",new ke(ue.getIdManager().getStringId()).setContent([])))._transitionToScene(t,n.transition).chain(t._init()).chain(this._exit())._jumpTo(t)}},{key:"transitionSceneBackground",value:function(t,e){return this._transitionToScene(t,e)}},{key:"sleep",value:function(t){return this.chain(new ps(this,"scene:sleep",new ke(ue.getIdManager().getStringId()).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,e){return this.chain(new ps(this,Ha.setBackgroundMusic,new ke(ue.getIdManager().getStringId()).setContent([t,e])))}},{key:"_$getBackgroundMusic",value:function(){return this.state.backgroundMusic}},{key:"toData",value:function(){var t;return w(this.state,this.config)?null:{state:Object.assign(Object.assign({},y(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background,backgroundImageState:Fa.serializeImageState(this.backgroundImageState)})}}},{key:"fromData",value:function(t){return this.state=p(this.state,t.state),t.state.backgroundMusic&&(this.state.backgroundMusic=(new Pu).fromData(t.state.backgroundMusic),this.state.background=t.state.background),t.state.backgroundImageState&&(this.backgroundImageState=Fa.deserializeImageState(t.state.backgroundImageState)),this}},{key:"_setTransition",value:function(t){return this.chain(new ps(this,"scene:setTransition",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"_applyTransition",value:function(t){return this.chain(new ps(this,"scene:applyTransition",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"_toTransform",value:function(){return new Pa([{props:this.backgroundImageState,options:{duration:0}}])}},{key:"_initTransform",value:function(){return new Pa([{props:Object.assign(Object.assign({},this.backgroundImageState),{opacity:1}),options:{duration:0}}])}},{key:"registerSrc",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.sceneRoot){var n=new Set,r=[this.sceneRoot],o=new Set;for(Is.backgroundToSrc(this.config.background)&&this.srcManager.register(new Fa({src:Is.backgroundToSrc(this.config.background)}));r.length;){var i=r.shift();if(i instanceof ps){if(i.type===Ha.jumpTo){var a=i,s=a.contentNode.getContent()[0];if(n.has(a)||e.has(s))continue;n.add(a),o.add(s),e.add(s)}else if(i.type===Ha.setBackground){var u=i.contentNode.getContent()[0];this.srcManager.register(new Fa({src:Is.backgroundToSrc(u)}))}}else if(i instanceof ys){var c=i;if(this.srcManager.register(c.callee),i.type===Ga.setSrc){var l=i.contentNode.getContent()[0];this.srcManager.register(new Fa({src:l}))}}else if(i instanceof bs)this.srcManager.register(i.callee);else if(i instanceof ws){var f=i.getFutureActions();r.push.apply(r,Nu(f))}r.push.apply(r,Nu(i.getFutureActions()))}o.forEach((function(n){n.registerSrc(e),t.srcManager.registerFuture(n.srcManager)}))}}},{key:"action",value:function(t){var n=(Array.isArray(t)?t.flat(2):t(this).flat(2)).map((function(t){return St.isChained(t)?t.fromChained(t):t})).flat(2),r=this.getAllElements(this.getAllActions(!1,n)).filter((function(t){return t instanceof Fa&&!St.isChained(t)})),o=[this._init(this)].concat(Nu(r.map((function(t){return t._init()}))),Nu(n)),i=function(t,e,n,r){var o=$u(Uu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"construct",this,3)([o]),a=new ke(ue.getIdManager().getStringId(),void 0,void 0,i||void 0).setContent(this);return null==i||i.setParent(a),this.sceneRoot=new ps(this,"scene:action",a),this}},{key:"_jumpTo",value:function(t){return this.chain(new ps(this,"scene:jumpTo",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"_exit",value:function(){return new ps(this,"scene:exit",new ke(ue.getIdManager().getStringId()).setContent([]))}},{key:"_transitionToScene",value:function(t,e){var n=this.chain();if(e){var r=e.copy();t&&r.setSrc(Is.backgroundToSrc(t.state.background)),n._applyTransition(r)}return n}},{key:"_init",value:function(){return new ps(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,"scene:init",new ke(ue.getIdManager().getStringId()).setContent([]))}}])}(_u);function zu(t){return zu="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},zu(t)}function Wu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,qu(r.key),r)}}function qu(t){var e=function(t,e){if("object"!=zu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=zu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==zu(e)?e:e+""}function Yu(t,e,n){return e=Zu(e),Xu(t,Ku()?Reflect.construct(e,n||[],Zu(t).constructor):e.apply(t,n))}function Xu(t,e){if(e&&("object"==zu(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 Ku(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ku=function(){return!!t})()}function Zu(t){return Zu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zu(t)}function Qu(t,e){return Qu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qu(t,e)}Gu.EventTypes={"event:scene.applyTransition":"event:scene.applyTransition","event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.initTransform":"event:scene.initTransform","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:scene.applyTransform":"event:scene.applyTransform"},Gu.defaultConfig={background:null,invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},Gu.defaultState={},Gu.targetAction=ps;var Ju=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Yu(this,e,[Ct.IdPrefixes.Script])).cleaner=null,n.handler=t,Xu(n,n.chain())}return 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&&Qu(t,e)}(e,t),function(t,e,n){return e&&Wu(t.prototype,e),n&&Wu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var e=t.gameState;this.cleaner=this.handler(this.getCtx({gameState:e}))||null}},{key:"getCtx",value:function(t){return{script:this,gameState:t.gameState}}},{key:"fromChained",value:function(t){return[new ms(this,ms.ActionTypes.action,new ke(ue.getIdManager().getStringId()).setContent(t))]}}])}(Ct);function tc(t){return tc="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},tc(t)}function ec(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nc(r.key),r)}}function nc(t){var e=function(t,e){if("object"!=tc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tc(e)?e:e+""}function rc(t,e,n){return e=ic(e),function(t,e){if(e&&("object"==tc(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)}(t,oc()?Reflect.construct(e,n||[],ic(t).constructor):e.apply(t,n))}function oc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(oc=function(){return!!t})()}function ic(t){return ic=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ic(t)}function ac(t,e){return ac=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ac(t,e)}var sc=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=rc(this,e)).entryScene=null,n.id=ue.getIdManager().getStringId(),n.name=t,n.config=p(e.defaultConfig,r),n}return 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&&ac(t,e)}(e,t),function(t,e,n){return e&&ec(t.prototype,e),n&&ec(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"_setAllElementState",value:function(t,e){var n=e||this.getAllActions(),r=new Map;t.forEach((function(t){return r.set(t.id,t.data)})),this.getAllElements(n).forEach((function(t){var e=r.get(t.id);e&&t.fromData(e)}))}},{key:"_getAllElementState",value:function(t){var e=t||this.getAllActions();return this.getAllElements(e).map((function(t){return{id:t.id,data:t.toData()}})).filter((function(t){return null!==t.data}))}},{key:"_getNodeChildIdMap",value:function(t){var e=t||this.getAllActions(),n=new Map;return e.forEach((function(t){var e,r=t.contentNode;(null===(e=r.child)||void 0===e?void 0:e.id)&&r.initChild!==r.child&&n.set(r.id,r.child.id)})),n}},{key:"_setNodeChildByMap",value:function(t,e){if(t){var n=t instanceof Map?t:new Map(Object.entries(t)),r=e||this.getAllActions(),o=this._getMappedNodes(this.getAllNodes(r));r.forEach((function(t){var e=t.contentNode,r=n.get(e.id),i=r&&o.get(r);i&&e.setChild(i)}))}}},{key:"_getMappedNodes",value:function(t){var e=new Map;return t.forEach((function(t){return e.set(t.id,t)})),e}},{key:"toData",value:function(){return null}},{key:"fromData",value:function(t){return this}},{key:"entry",value:function(t){if(!t.sceneRoot)throw new Error("No actions in scene, please add actions to scene first");return this.entryScene=t,t.registerSrc(),new Ls(t).run(),this}}])}(_u);sc.defaultConfig={},sc.targetAction=hs;var uc=r(72),cc=r.n(uc),lc=r(825),fc=r.n(lc),dc=r(659),pc=r.n(dc),hc=r(56),yc=r.n(hc),vc=r(540),mc=r.n(vc),gc=r(113),bc=r.n(gc),wc=r(587),_c={};_c.styleTagTransform=bc(),_c.setAttributes=yc(),_c.insert=pc().bind(null,"head"),_c.domAPI=fc(),_c.insertStyleElement=mc();cc()(wc.A,_c);wc.A&&wc.A.locals&&wc.A.locals;var Sc=r(848);const kc=(0,q.createContext)({strict:!1});function xc(t){for(const e in t)Ci[e]={...Ci[e],...t[e]}}function Ac({children:t,features:e,strict:n=!1}){const[,r]=(0,q.useState)(!Tc(e)),o=(0,q.useRef)(void 0);if(!Tc(e)){const{renderer:t,...n}=e;o.current=t,xc(n)}return(0,q.useEffect)((()=>{Tc(e)&&e().then((({renderer:t,...e})=>{xc(e),o.current=t,r(!0)}))}),[]),(0,Sc.jsx)(kc.Provider,{value:{renderer:o.current,strict:n},children:t})}function Tc(t){return"function"==typeof t}function Ec(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Oc(t,e,n={}){var r;const o=ai(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(i=n.transitionOverride);const a=o?()=>Promise.all(vi(t,o,n)):()=>Promise.resolve(),s=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:o=0,staggerChildren:a,staggerDirection:s}=i;return function(t,e,n=0,r=0,o=1,i){const a=[],s=(t.variantChildren.size-1)*r,u=1===o?(t=0)=>t*r:(t=0)=>s-t*r;return Array.from(t.variantChildren).sort(Pc).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(Oc(t,e,{...i,delay:n+u(r)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(a)}(t,e,o+r,a,s,n)}:()=>Promise.resolve(),{when:u}=i;if(u){const[t,e]="beforeChildren"===u?[a,s]:[s,a];return t().then((()=>e()))}return Promise.all([a(),s(n.delay)])}function Pc(t,e){return t.sortNodePosition(e)}const jc=[...Ti].reverse(),Cc=Ti.length;function Ic(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const o=e.map((e=>Oc(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=Oc(t,e,n);else{const o="function"==typeof e?ai(t,e,n.custom):e;r=Promise.all(vi(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Mc(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Ec(e,t)}function Lc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Nc(){return{animate:Lc(!0),whileInView:Lc(),whileHover:Lc(),whileTap:Lc(),whileDrag:Lc(),whileFocus:Lc(),exit:Lc()}}class Rc{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Fc=0;const Vc={animation:{Feature:class extends Rc{constructor(t){super(t),t.animationState||(t.animationState=function(t){let e=Ic(t),n=Nc(),r=!0;const o=e=>(n,r)=>{var o;const i=ai(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const a=t.getProps(),s=t.getVariantContext(!0)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<Cc;e++){const d=jc[e],p=n[d],h=void 0!==a[d]?a[d]:s[d],y=Ai(h),v=d===i?p.isActive:null;!1===v&&(f=e);let m=h===s[d]&&h!==a[d]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),p.protectedKeys={...l},!p.isActive&&null===v||!h&&!p.prevProp||xi(h)||"boolean"==typeof h)continue;let g=Mc(p.prevProp,h)||d===i&&p.isActive&&!m&&y||e>f&&y,b=!1;const w=Array.isArray(h)?h:[h];let _=w.reduce(o(d),{});!1===v&&(_={});const{prevResolvedValues:S={}}=p,k={...S,..._},x=e=>{g=!0,c.has(e)&&(b=!0,c.delete(e)),p.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in k){const e=_[t],n=S[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Xo(e)&&Xo(n)?!Ec(e,n):e!==n,r?null!=e?x(t):c.add(t):void 0!==e&&c.has(t)?x(t):p.protectedKeys[t]=!0}p.prevProp=h,p.prevResolvedValues=_,p.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(g=!1),!g||m&&!b||u.push(...w.map((t=>({animation:t,options:{type:d}}))))}if(c.size){const e={};c.forEach((n=>{const r=t.getBaseTarget(n),o=t.getValue(n);o&&(o.liveStyle=!0),e[n]=null!=r?r:null})),u.push({animation:e})}let d=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(d=!1),r=!1,d?e(u):Promise.resolve()}return{animateChanges:i,setActive:function(e,r){var o;if(n[e].isActive===r)return Promise.resolve();null===(o=t.variantChildren)||void 0===o||o.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const a=i(e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Nc(),r=!0}}}(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();xi(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends Rc{constructor(){super(...arguments),this.id=Fc++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const r=this.node.animationState.setActive("exit",!t);e&&!t&&r.then((()=>e(this.id)))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}};function Dc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Bc(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const $c=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Bc(e));function Uc(t,e,n,r){return Dc(t,e,$c(n),r)}function Hc(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Gc=Hc("dragHorizontal"),zc=Hc("dragVertical");function Wc(){const t=function(t){let e=!1;if("y"===t)e=zc();else if("x"===t)e=Gc();else{const t=Gc(),n=zc();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function qc(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return Uc(t.current,n,((n,o)=>{if("touch"===n.pointerType||Wc())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&ze.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Yc=(t,e)=>!!e&&(t===e||Yc(t,e.parentElement));function Xc(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Bc(n))}const Kc=new WeakMap,Zc=new WeakMap,Qc=t=>{const e=Kc.get(t.target);e&&e(t)},Jc=t=>{t.forEach(Qc)};function tl(t,e,n){const r=function({root:t,...e}){const n=t||document;Zc.has(n)||Zc.set(n,{});const r=Zc.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Jc,{root:t,...e})),r[o]}(e);return Kc.set(t,n),r.observe(t),()=>{Kc.delete(t),r.unobserve(t)}}const el={some:0,all:1};const nl={inView:{Feature:class extends Rc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:r="some",once:o}=t,i={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:el[r]};return tl(this.node.current,i,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,o&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),i=e?n:r;i&&i(t)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Rc{constructor(){super(...arguments),this.removeStartListeners=Re,this.removeEndListeners=Re,this.removeAccessibleListeners=Re,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=Uc(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Yc(this.node.current,t.target)?n:r;i&&ze.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=Uc(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=po(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=Dc(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=Dc(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&Xc("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&ze.postRender((()=>n(t,e)))}))})),Xc("down",((t,e)=>{this.startPress(t,e)}))})),e=Dc(this.node.current,"blur",(()=>{this.isPressing&&Xc("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=po(t,e)}}startPress(t,e){this.isPressing=!0;const{onTapStart:n,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&ze.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Wc()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&ze.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=Uc(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=Dc(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=po(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Rc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=po(Dc(this.node.current,"focus",(()=>this.onFocus())),Dc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Rc{mount(){this.unmount=po(qc(this.node,!0),qc(this.node,!1))}unmount(){}}}},rl=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ol(t){return"string"==typeof t&&!t.includes("-")&&!!(rl.indexOf(t)>-1||/[A-Z]/u.test(t))}const il={renderer:(t,e)=>ol(t)?new Ki(e):new Qi(e,{allowProjection:t!==q.Fragment}),...Vc,...nl};function al(t){var e=t.children;return Y().createElement(Ac,{features:il,strict:!0},e)}function sl(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ul(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ul(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 ul(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function cl(t){var e=t.children,n=t.className,r=sl((0,q.useState)({}),2),o=r[0],i=r[1],a=rt().ratio,s=pt().game,u=sl((0,q.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,q.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("Ratio is locked, skipping update");else{var t=document.getElementById(s.config.player.contentContainerId);if(t){var e,n,r=t.clientWidth,o=t.clientHeight,f=s.config.player.aspectRatio;r/o>f?(e=o*f,n=o):(e=r,n=r/f),e<c&&(e=c),n<l&&(n=l),i({width:"".concat(e,"px"),height:"".concat(n,"px"),margin:"auto",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center"}),a.update(e,n),a.updateMin(c,l),u()}}};a.setUpdate(e);var n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)};return e(),window.addEventListener("resize",n),function(){window.removeEventListener("resize",n),clearTimeout(t)}}),[a]),Y().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},Y().createElement("div",{className:W(n),style:o},e))}var ll={start:"start",update:"update",end:"end"};function fl(t){var e=t.children,n=rt().ratio,r=pt().game,o=(0,q.useRef)(null);return(0,q.useEffect)((function(){if(!o.current)throw new Error("Content container not found")}),[r.config.player.contentContainerId]),Y().createElement(Y().Fragment,null,Y().createElement("div",{ref:o,className:W("absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"),style:Object.assign({},n.getStyle())},e))}function dl(t){return dl="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},dl(t)}function pl(){return pl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},pl.apply(null,arguments)}function hl(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */hl=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==dl(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value: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,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(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 P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(dl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.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,v):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),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function yl(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return vl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vl(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 vl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var ml=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function gl(t){var e=this,n=t.scene,r=t.props,o=t.state,i=(0,q.useRef)(null),a=pt().game,s=yl((0,q.useState)(null),2),u=s[0],c=s[1],l=yl((0,q.useState)([]),2)[1],f=yl((0,q.useState)(null),2),d=f[0],h=f[1],y=yl((0,q.useState)({}),2),v=y[0],m=y[1];function g(){n.events.emit(Gu.EventTypes["event:scene.imageLoaded"])}function b(t){if(d&&d.getControl()&&(console.warn("processing transform not completed"),d.getControl().complete(),d.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof Pa?Object.assign(i.current.style,t.propToCSS(o,n.backgroundImageState)):Object.assign(i.current.style,t)}(0,q.useEffect)((function(){var t=n.events.onEvents([{type:Gu.EventTypes["event:scene.applyTransition"],listener:n.events.on(Gu.EventTypes["event:scene.applyTransition"],(function(t){return c(t),t?new Promise((function(e){var n=t.events.onEvents([{type:ll.update,listener:t.events.on(ll.update,(function(t){l(t),o.logger.debug("transition update",{progress:t})}))},{type:ll.end,listener:t.events.on(ll.end,(function(){c(null),e(),o.logger.debug("transition end",u)}))},{type:ll.start,listener:t.events.on(ll.start,(function(){o.logger.debug("transition start",u)}))}]);t.start((function(){n.cancel(),e()}))})):(o.logger.warn("transition not set"),Promise.resolve())}))},{type:Gu.EventTypes["event:scene.applyTransform"],listener:n.events.on(Gu.EventTypes["event:scene.applyTransform"],(function(t){return ml(e,void 0,void 0,hl().mark((function e(){return hl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(o,n.backgroundImageState)),h(t),e.next=4,t.animate({scope:i},o,n.backgroundImageState,(function(e){n.backgroundImageState=p(n.backgroundImageState,e),m({style:t.propToCSS(o,n.backgroundImageState)}),h(null)}));case 4:case"end":return e.stop()}}),e)})))}))},{type:Gu.EventTypes["event:scene.initTransform"],listener:n.events.on(Gu.EventTypes["event:scene.initTransform"],(function(t){return ml(e,void 0,void 0,hl().mark((function e(){return hl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o.logger.debug("init transform",t),e.next=3,t.animate({scope:i},o,n.backgroundImageState,(function(t){n.backgroundImageState=p(n.backgroundImageState,t)}));case 3:case"end":return e.stop()}}),e)})))}))}]);return function(){t.cancel()}}),[n]),(0,q.useEffect)((function(){b(n.backgroundImageState)}),[]),(0,q.useEffect)((function(){var t=o.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:o.events.on(G.EventTypes["event:state.player.skip"],(function(){d&&d.getControl()&&(d.getControl().complete(),d.setControl(null))}))}]);return function(){t.cancel()}}),[d]);var w,_="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",S={src:_,style:Object.assign({opacity:0},a.config.app.debug?{border:"1px solid red"}:{})};return Y().createElement("div",null,u?u.toElementProps().map((function(t,e,n){var o=p(S,r,v,t);return Y().createElement(fl,{key:e},Y().createElement("img",pl({alt:o.alt},o,{onLoad:g,src:o.src||_,ref:e===n.length-1?i:void 0,className:"absolute"})))})):(w=p(S,r,v),Y().createElement(fl,null,Y().createElement("img",pl({alt:w.alt},w,{onLoad:g,ref:i,src:w.src||_,className:"absolute"})))))}function bl(t){return bl="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},bl(t)}function wl(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */wl=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==bl(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value: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,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(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 P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(bl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.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,v):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),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function _l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Sl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sl(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 Sl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var kl=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function xl(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=rt().ratio,a=_l((0,q.useState)((function(){return e._$getBackgroundMusic()})),2),s=a[0],u=a[1],c=_l((0,q.useState)(null),2),l=c[0],f=c[1],d=_l((0,q.useState)(null),2),p=d[0],h=d[1];function y(t,e){return kl(this,void 0,void 0,wl().mark((function n(){var r;return wl().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.$getHowl()&&t.$getHowl().playing(t.$getToken())){n.next=2;break}return n.abrupt("return",Promise.resolve());case 2:return r=t.$getHowl().volume(t.$getToken()),n.next=5,new Promise((function(n){t.$getHowl().fade(r,0,e,t.$getToken()),h((function(){return n})),f(setTimeout((function(){t.$getHowl().stop(),t.$getHowl().volume(r),t.$setToken(null),n(),h(null)}),e))}));case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))}return(0,q.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(Gu.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){var n,r,o,i,a,c;return kl(this,void 0,void 0,wl().mark((function d(){var v,m;return wl().wrap((function(d){for(;;)switch(d.prev=d.next){case 0:if(l&&(clearTimeout(l),f(null),p&&(p(),h(null))),m=t,!(v=s)){d.next=12;break}if(!e){d.next=9;break}return d.next=7,y(v,e);case 7:d.next=12;break;case 9:null===(n=v.$getHowl())||void 0===n||n.stop(),null===(r=v.$getHowl())||void 0===r||r.volume(0),v.$setToken(null);case 12:if(m){d.next=14;break}return d.abrupt("return");case 14:null===(o=m.$getHowl())||void 0===o||o.volume(0),m.$setToken(null===(i=m.$getHowl())||void 0===i?void 0:i.play(m.$getToken()||void 0)),e?null===(a=m.$getHowl())||void 0===a||a.fade(0,m.config.volume,e,m.$getToken()):null===(c=m.$getHowl())||void 0===c||c.volume(m.config.volume,m.$getToken()),u(m);case 18:case"end":return d.stop()}}),d)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(Gu.EventTypes["event:scene.preUnmount"],(function(){l&&(clearTimeout(l),p&&p()),s&&y(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,q.useEffect)((function(){return e.events.emit(Gu.EventTypes["event:scene.mount"]),function(){e.events.emit(Gu.EventTypes["event:scene.unmount"])}}),[]),Y().createElement("div",{className:o},Y().createElement(gl,{scene:e,props:{width:i.state.width,height:i.state.height,src:Is.backgroundToSrc(e.state.background)},state:n}),r)}function Al(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}const Tl=(0,q.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),El=(0,q.createContext)({}),Ol=(0,q.createContext)(null),Pl=_i?q.useLayoutEffect:q.useEffect,{schedule:jl,cancel:Cl}=Ge(queueMicrotask,!1);function Il(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const Ml=(0,q.createContext)({});let Ll=!1;function Nl(t,e,n,r,o){var i;const{visualElement:a}=(0,q.useContext)(El),s=(0,q.useContext)(kc),u=(0,q.useContext)(Ol),c=(0,q.useContext)(Tl).reducedMotion,l=(0,q.useRef)();r=r||s.renderer,!l.current&&r&&(l.current=r(t,{visualState:e,parent:a,props:n,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:c}));const f=l.current,d=(0,q.useContext)(Ml);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Fl(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&Il(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(l.current,n,o,d),(0,q.useInsertionEffect)((()=>{f&&f.update(n,u)}));const p=n[ci],h=(0,q.useRef)(Boolean(p)&&!window.MotionHandoffIsComplete&&(null===(i=window.MotionHasOptimisedAnimation)||void 0===i?void 0:i.call(window,p)));return Pl((()=>{f&&(f.updateFeatures(),jl.render(f.render),h.current&&f.animationState&&f.animationState.animateChanges())})),(0,q.useEffect)((()=>{f&&(!h.current&&f.animationState&&f.animationState.animateChanges(),h.current=!1,Ll||(Ll=!0,queueMicrotask(Rl)))})),f}function Rl(){window.MotionHandoffIsComplete=!0}function Fl(t){if(t)return!1!==t.options.allowProjection?t.projection:Fl(t.parent)}function Vl(t,e,n){return(0,q.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Il(n)&&(n.current=r))}),[e])}function Dl(t){const{initial:e,animate:n}=function(t,e){if(Oi(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Ai(e)?e:void 0,animate:Ai(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,q.useContext)(El));return(0,q.useMemo)((()=>({initial:e,animate:n})),[Bl(e),Bl(n)])}function Bl(t){return Array.isArray(t)?t.join(" "):t}const $l=(0,q.createContext)({}),Ul=Symbol.for("motionComponentSymbol");function Hl({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&xc(t);const i=(0,q.forwardRef)((function(t,i){let a;const s={...(0,q.useContext)(Tl),...t,layoutId:Gl(t)},{isStatic:u}=s,c=Dl(t),l=r(t,u);if(!u&&_i){!function(){(0,q.useContext)(kc).strict;0}();const t=function(t){const{drag:e,layout:n}=Ci;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(s);a=t.MeasureLayout,c.visualElement=Nl(o,l,s,e,t.ProjectionNode)}return(0,Sc.jsxs)(El.Provider,{value:c,children:[a&&c.visualElement?(0,Sc.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Vl(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[Ul]=o,i}function Gl({layoutId:t}){const e=(0,q.useContext)($l).id;return e&&void 0!==t?e+"-"+t:t}function zl(t){const e=pi(t)?t.get():t;return Ko(e)?e.toValue():e}const Wl=t=>(e,n)=>{const r=(0,q.useContext)(El),o=(0,q.useContext)(Ol),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:Xl(o,i,a,!s&&t,e),renderState:n()};return r&&(u.mount=t=>r(o,t,u)),u}(t,e,r,o,n);return n?i():function(t){const e=(0,q.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function ql(t,e){const n=fi(e);n&&Qo(t,n)}function Yl(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=ii(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function Xl(t,e,n,r,o){var i;const a={},s=[],u=r&&void 0===(null===(i=t.style)||void 0===i?void 0:i.willChange),c=o(t,{});for(const t in c)a[t]=zl(c[t]);let{initial:l,animate:f}=t;const d=Oi(t),p=Pi(t);e&&p&&!d&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let h=!!n&&!1===n.initial;h=h||!1===l;const y=h?f:l;return y&&"boolean"!=typeof y&&!xi(y)&&Yl(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[h?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!xi(f)&&Yl(t,f,(t=>{for(const e in t)ql(s,e)})),s.length&&(a.willChange=s.join(","))),a}const Kl=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Zl=()=>({...Kl(),attrs:{}}),Ql={useVisualState:Wl({scrapeMotionValuesFromProps:wi,createRenderState:Zl,onMount:(t,e,{renderState:n,latestValues:r})=>{ze.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),ze.render((()=>{zi(n,r,Xi(e.tagName),t.transformTemplate),Yi(e,n)}))}})},Jl={useVisualState:Wl({applyWillChange:!0,scrapeMotionValuesFromProps:bi,createRenderState:Kl})};function tf(t,e,n){for(const r in e)pi(e[r])||gi(r,n)||(t[r]=e[r])}function ef(t,e){const n={};return tf(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,q.useMemo)((()=>{const n=Kl();return $i(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function nf(t,e){const n={},r=ef(t,e);return t.drag&&!1!==t.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const rf=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function of(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||rf.has(t)}let af=t=>!of(t);try{(sf=require("@emotion/is-prop-valid").default)&&(af=t=>t.startsWith("on")?!of(t):sf(t))}catch(lt){}var sf;function uf(t,e,n,r){const o=(0,q.useMemo)((()=>{const n=Zl();return zi(n,e,Xi(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};tf(e,t.style,t),o.style={...e,...o.style}}return o}function cf(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(ol(e)?uf:nf)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(af(o)||!0===n&&of(o)||!e&&!of(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==q.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,q.useMemo)((()=>pi(c)?c.get():c),[c]);return(0,q.createElement)(e,{...u,children:l})}}function lf(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Hl({...ol(n)?Ql:Jl,preloadedFeatures:t,useRender:cf(r),createVisualElement:e,Component:n})}}const ff=Al(lf());function df(t){return df="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},df(t)}function pf(){return pf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},pf.apply(null,arguments)}function hf(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */hf=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==df(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value: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,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(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 P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(df(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.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,v):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),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function yf(t){return function(t){if(Array.isArray(t))return gf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||mf(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 vf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||mf(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 mf(t,e){if(t){if("string"==typeof t)return gf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gf(t,e):void 0}}function gf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var bf=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function wf(t){var e=this,n=t.image,r=t.state,o=t.onAnimationEnd,i=(0,q.useRef)(null),a=vf((0,q.useState)(null),2),s=a[0],u=a[1],c=vf((0,q.useState)({style:{}}),2),l=c[0],f=c[1],d=vf((0,q.useState)(null),2),h=d[0],y=d[1],v=vf((0,q.useState)([]),2)[1],m=vf((0,q.useState)(0),2),g=m[0],b=m[1],w=pt().game;(0,q.useEffect)((function(){n.setScope(i),n.events.emit(Fa.EventTypes["event:image.mount"]);var t=n.events.onEvents([].concat(yf([Fa.EventTypes["event:image.show"],Fa.EventTypes["event:image.hide"],Fa.EventTypes["event:image.applyTransform"]].map((function(t){return{type:t,listener:n.events.on(t,(function(t){return bf(e,void 0,void 0,hf().mark((function e(){return hf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(t.propToCSS(r,n.state)),u(t),r.logger.debug("transform",t,t.propToCSS(r,n.state)),e.next=5,t.animate({scope:i},r,n.state,(function(e){n.state=p(n.state,e),f({style:t.propToCSS(r,n.state)}),o&&o(),u(null)}));case 5:return e.abrupt("return",!0);case 6:case"end":return e.stop()}}),e)})))}))}}))),[{type:Fa.EventTypes["event:image.init"],listener:n.events.on(Fa.EventTypes["event:image.init"],(function(){return bf(e,void 0,void 0,hf().mark((function t(){return hf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.toTransform().animate({scope:i},r,n.state,(function(t){n.state=p(n.state,t),f({style:n.toTransform().propToCSS(r,n.state)})}));case 2:case"end":return t.stop()}}),t)})))}))}]));return S(n.toTransform().propToCSS(r,n.state)),n.events.emit(Fa.EventTypes["event:image.ready"],i),function(){t.cancel(),n.events.emit(Fa.EventTypes["event:image.unmount"])}}),[]),(0,q.useEffect)((function(){var t=n.events.onEvents([{type:Fa.EventTypes["event:image.setTransition"],listener:n.events.on(Fa.EventTypes["event:image.setTransition"],(function(t){y(t)}))}]);return function(){t.cancel()}}),[h,n]),(0,q.useEffect)((function(){var t=h?h.events.onEvents([{type:ll.update,listener:h.events.on(ll.update,(function(t){v(t)}))},{type:ll.end,listener:h.events.on(ll.end,(function(){y(null)}))}]):null;return function(){var e;null===(e=null==t?void 0:t.cancel)||void 0===e||e.call(t)}}),[h]),(0,q.useEffect)((function(){b(performance.now())}),[]),(0,q.useEffect)((function(){var t=r.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:r.events.on(G.EventTypes["event:state.player.skip"],(function(){s&&s.getControl()&&(s.getControl().complete(),s.setControl(null),r.logger.debug("transform skip")),h&&h.controller&&(h.controller.complete(),y(null),r.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[h,s]);var _=function(){var t=performance.now()-g,e=w.config.elements.img.slowLoadThreshold;t>e&&w.config.elements.img.slowLoadWarning&&r.logger.warn("NarraLeaf-React","Image took ".concat(t,"ms to load, which exceeds the threshold of ").concat(e,"ms. ")+"Consider enable cache for the image, so Preloader can preload it before it's used. To disable this warning, set `elements.img.slowLoadWarning` to false in the game config.")};function S(t){if(s&&s.getControl()&&(console.warn("processing transform not completed"),s.getControl().complete(),s.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof Pa?Object.assign(i.current.style,t.propToCSS(r,n.state)):Object.assign(i.current.style,t)}var k={className:"absolute",src:Is.staticImageDataToSrc(n.state.src),style:Object.assign({opacity:0},w.config.app.debug?{border:"1px solid red"}:{})};return Y().createElement(ot,{className:"absolute overflow-hidden"},h?h.toElementProps().map((function(t,e,n){var r=p(k,l,t);return Y().createElement(ff.img,pf({key:e,alt:r.alt},r,{ref:e===n.length-1?i:void 0,onLoad:_,layout:!0}))})):Y().createElement(ff.img,pf({ref:i,alt:"image"},p(k,l),{onLoad:_})))}function _f(t){return _f="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},_f(t)}function Sf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,kf(r.key),r)}}function kf(t){var e=function(t,e){if("object"!=_f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_f(e)?e:e+""}var xf=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.preloaded=[],this.events=new m}return function(t,e,n){return e&&Sf(t.prototype,e),n&&Sf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"add",value:function(e){return this.has(this.getSrc(e))||(this.preloaded.push(e),this.events.emit(t.EventTypes["event:preloaded.add"],e),this.events.emit(t.EventTypes["event:preloaded.change"])),this}},{key:"get",value:function(t){var e=this;return this.preloaded.find((function(n){return e.getSrc(n)===t}))}},{key:"has",value:function(t){var e=this;return Array.isArray(t)?t.every((function(t){return e.has(t)})):this.preloaded.some((function(n){return e.getSrc(n)===t}))}},{key:"remove",value:function(e){var n=this;if(Array.isArray(e)){var r=e.map((function(t){return n.getSrc(t)}));return this.preloaded=this.preloaded.filter((function(t){return!r.includes(n.getSrc(t))})),this}var o=this.getSrc(e);return this.preloaded=this.preloaded.filter((function(t){return n.getSrc(t)!==o})),this.events.emit(t.EventTypes["event:preloaded.remove"],e),this.events.emit(t.EventTypes["event:preloaded.change"]),this}},{key:"clear",value:function(){return this.preloaded=[],this}},{key:"getSrc",value:function(t){return"string"==typeof t?t:"image"===t.type?Is.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function Af(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Tf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tf(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 Tf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}xf.EventTypes={"event:preloaded.add":"event:preloaded.add","event:preloaded.remove":"event:preloaded.remove","event:preloaded.change":"event:preloaded.change","event:preloaded.mount":"event:preloaded.mount","event:preloaded.ready":"event:preloaded.ready"};var Ef=(0,q.createContext)(null);function Of(t){var e=t.children,n=Af((0,q.useState)(new xf),1)[0];return Y().createElement(Y().Fragment,null,Y().createElement(Ef.Provider,{value:{preloaded:n}},e))}function Pf(){if(!Ef)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,q.useContext)(Ef)}function jf(t){return function(t){if(Array.isArray(t))return Cf(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 Cf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cf(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 Cf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function If(t){var e=t.state,n=t.srcManager,r=Pf().preloaded;return(0,q.useEffect)((function(){var t,o;if("undefined"!=typeof window){var i=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,a=(null===(o=e.getLastScene())||void 0===o?void 0:o.srcManager.future)||[],s=[].concat(jf(n.src),jf(i?i.src:[]),jf(a.map((function(t){return t.src})).flat(2))),u={image:new Set,audio:new Set,video:new Set};s.forEach((function(t){t.type===Mu.SrcTypes.image?u.image.add(t.src):t.type===Mu.SrcTypes.audio?u.audio.add(t.src):t.type===Mu.SrcTypes.video&&u.video.add(t.src)})),e.logger.debug("Preloading",u,a),r.preloaded=r.preloaded.filter((function(t){if(t.type===Mu.SrcTypes.audio){var e=u[t.type].has(t.src);return e||(e=Array.from(u[t.type]).some((function(e){return r.getSrc(t)===r.getSrc(e.config.src)}))),e}if(t.type===Mu.SrcTypes.image)return u[t.type].has(t.src);var n=r.getSrc(t);return u[t.type].has(n)}));var c=[];return u.image.forEach((function(t){var n=new Image;n.src=Is.srcToString(t.state.src),n.onload=function(){e.logger.debug("Image loaded",t.state.src)},c.push(n),r.add({type:"image",src:t})})),Promise.all([]).then((function(){e.logger.log("Preloaded","Preloaded ".concat(u.image.size," images")),r.events.emit(xf.EventTypes["event:preloaded.ready"])})),u.audio.forEach((function(t){t.$getHowl()||t.$setHowl(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),r.events.emit(xf.EventTypes["event:preloaded.mount"]),function(){c.forEach((function(t){t.onload=null}))}}console.warn("Window is not supported in this environment")}),[e]),null}function Mf(t){var e=t.state,n=pt().game;return(0,q.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&e.events.emit(G.EventTypes["event:state.player.skip"])},r=n.config.player.skipInterval,o=0,function(){var e=Date.now();if(!(e-o<r))return o=e,t.apply(void 0,arguments)});return window.addEventListener("keydown",i),function(){window.removeEventListener("keydown",i)}}e.logger.warn("NarraLeaf-React: Announcer","Cannot listen to window events")}),[]),Y().createElement(Y().Fragment,null)}function Lf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Nf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nf(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 Nf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Rf(t,e){return t.handle(e)}function Ff(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=Lf((0,q.useReducer)((function(t){return t+1}),0),2)[1],u=pt().game,c=Lf((0,q.useReducer)(Rf,new G(u,{forceUpdate:function(){s()},next:y,dispatch:function(t){return f(t)}})),2),l=c[0],f=c[1],d=u.config.elements.say.use,p=u.config.elements.menu.use;function y(){for(var t=!1;!t;){var e=u.getLiveGame().next(l);if(!e)break;if(h.isAwaitable(e)){t=!0;break}f(e)}l.stage.forceUpdate()}(0,q.useEffect)((function(){e&&u.getLiveGame().loadStory(e)}),[e,u]),(0,q.useEffect)((function(){i&&i({game:u,state:l});var t=l.getLastScene(),e=[];t?e.push({type:"event:scene.mount",listener:t.events.once("event:scene.mount",(function(){l.stage.next()}))}):l.stage.next();var n=l.events.onEvents([{type:G.EventTypes["event:state.end"],listener:function(){a&&a({game:u,state:l})}}]),r=l.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:function(){u.getLiveGame().abortAwaiting(),y()}}]);return l.stage.forceUpdate(),function(){t&&e.forEach((function(e){t.events.off(e.type,e.listener)})),n.cancel(),r.cancel()}}),[]);var v=n||u.config.player.width,m=r||u.config.player.height;return Y().createElement(al,null,Y().createElement("div",{style:{width:"number"==typeof v?"".concat(v,"px"):v,height:"number"==typeof m?"".concat(m,"px"):m},className:W(o,"__narraleaf_content-player")},Y().createElement(cl,{className:W("flex-grow overflow-auto")},Y().createElement(ot,{className:"relative"},l.state.srcManagers.map((function(t,e){return Y().createElement(If,{key:e,state:l,srcManager:t})})),Y().createElement(Vf,{onLoaded:function(){l.stage.forceUpdate(),e&&y()}},Y().createElement(Mf,{state:l}),l.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return Y().createElement(xl,{key:"scene-"+e.id,state:l,scene:e},n.images.map((function(t){return Y().createElement(wf,{key:"image-"+t.id,image:t,state:l})})),n.texts.map((function(t){var e=t.action,n=t.onClick;return Y().createElement(d,{state:l,key:"say-"+e.id,action:e,onClick:function(){n(),y()}})})),n.menus.map((function(t,e){return Y().createElement("div",{key:"menu-"+e},Y().createElement(p,{state:l,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),y()}}))})))})))))))}function Vf(t){var e=t.children,n=t.onLoaded,r=Pf().preloaded,o=Lf((0,q.useState)(!1),2),i=o[0],a=o[1];return(0,q.useEffect)((function(){var t=r.events.on(xf.EventTypes["event:preloaded.ready"],(function(){a(!0),n()}));return function(){r.events.off(xf.EventTypes["event:preloaded.ready"],t)}}),[i]),Y().createElement(Y().Fragment,null,i?e:null)}function Df(t){var e=t.children,n=t.game;return Y().createElement(Y().Fragment,null,Y().createElement(nt,null,Y().createElement(dt,{game:n},Y().createElement(Of,null,e))))}function Bf(t){return Bf="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},Bf(t)}function $f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Uf(r.key),r)}}function Uf(t){var e=function(t,e){if("object"!=Bf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Bf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bf(e)?e:e+""}var Hf=function(){return function(t,e,n){return e&&$f(t.prototype,e),n&&$f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=new m}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(ll.start,null),this.controller=va(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(ll.update,r.toElementProps())},onComplete:function(){r.events.emit(ll.end,null),s&&s(),r.controller=void 0}},n)),this.controller}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}();function Gf(t){return Gf="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},Gf(t)}function zf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Wf(r.key),r)}}function Wf(t){var e=function(t,e){if("object"!=Gf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Gf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gf(e)?e:e+""}function qf(t,e,n){return e=Xf(e),function(t,e){if(e&&("object"==Gf(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)}(t,Yf()?Reflect.construct(e,n||[],Xf(t).constructor):e.apply(t,n))}function Yf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yf=function(){return!!t})()}function Xf(t){return Xf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xf(t)}function Kf(t,e){return Kf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kf(t,e)}var Zf=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=qf(this,e)).state={opacity:1},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Gu?Is.backgroundToSrc(r.config.background):Is.staticImageDataToSrc(r)),t}return 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&&Kf(t,e)}(e,t),function(t,e,n){return e&&zf(t.prototype,e),n&&zf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{},{style:{opacity:this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Hf);function Qf(t){return Qf="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},Qf(t)}function Jf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,td(r.key),r)}}function td(t){var e=function(t,e){if("object"!=Qf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qf(e)?e:e+""}function ed(t,e,n){return e=rd(e),function(t,e){if(e&&("object"==Qf(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)}(t,nd()?Reflect.construct(e,n||[],rd(t).constructor):e.apply(t,n))}function nd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(nd=function(){return!!t})()}function rd(t){return rd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rd(t)}function od(t,e){return od=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},od(t,e)}Zf.Frames=[0,1];var id=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3?arguments[3]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=ed(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,i&&(r.src="string"==typeof i?i:i instanceof Gu?Is.backgroundToSrc(i.config.background):Is.staticImageDataToSrc(i)),r.__stack=g(),r}return 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&&od(t,e)}(e,t),function(t,e,n){return e&&Jf(t.prototype,e),n&&Jf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}})}},{key:"toElementProps",value:function(){return[{},{style:{opacity:this.state.opacity,transform:this.state.transform},src:this.src}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])}(Hf);function ad(t){return ad="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},ad(t)}function sd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ud(r.key),r)}}function ud(t){var e=function(t,e){if("object"!=ad(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ad(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ad(e)?e:e+""}function cd(t,e,n){return e=fd(e),function(t,e){if(e&&("object"==ad(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)}(t,ld()?Reflect.construct(e,n||[],fd(t).constructor):e.apply(t,n))}function ld(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ld=function(){return!!t})()}function fd(t){return fd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fd(t)}function dd(t,e){return dd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dd(t,e)}var pd=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=cd(this,e)).state={opacity:0},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Gu?Is.backgroundToSrc(r.config.background):Is.staticImageDataToSrc(r)),t}return 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&&dd(t,e)}(e,t),function(t,e,n){return e&&sd(t.prototype,e),n&&sd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Hf);pd.Frames=[1,0]})(),o})()));