narraleaf-react 0.2.0 → 0.2.2

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
@@ -1,4 +1,4 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.NarraleafReact=e(require("react"),require("react-dom")):t.NarraleafReact=e(t.React,t.ReactDOM)}(this,((t,e)=>(()=>{var n={587:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(601),o=n.n(r),i=n(314),a=n.n(i)()(o());a.push([t.id,"/*\n! tailwindcss v3.4.11 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n.\\!container {\n width: 100% !important;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n\n .\\!container {\n max-width: 640px !important;\n }\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .\\!container {\n max-width: 768px !important;\n }\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .\\!container {\n max-width: 1024px !important;\n }\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .\\!container {\n max-width: 1280px !important;\n }\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .\\!container {\n max-width: 1536px !important;\n }\n\n .container {\n max-width: 1536px;\n }\n}\n.pointer-events-none {\n pointer-events: none;\n}\n.static {\n position: static;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.inset-0 {\n inset: 0px;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-10 {\n z-index: 10;\n}\n.z-20 {\n z-index: 20;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.block {\n display: block;\n}\n.inline-block {\n display: inline-block;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-\\[calc\\(100\\%-40px\\)\\] {\n width: calc(100% - 40px);\n}\n.w-full {\n width: 100%;\n}\n.min-w-full {\n min-width: 100%;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.resize {\n resize: both;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-start {\n align-items: flex-start;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.whitespace-pre {\n white-space: pre;\n}\n.whitespace-pre-wrap {\n white-space: pre-wrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-br-md {\n border-bottom-right-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-black {\n --tw-border-opacity: 1;\n border-color: rgb(0 0 0 / var(--tw-border-opacity));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.bg-cover {\n background-size: cover;\n}\n.bg-center {\n background-position: center;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.align-bottom {\n vertical-align: bottom;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.italic {\n font-style: italic;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n.text-red-700 {\n --tw-text-opacity: 1;\n color: rgb(185 28 28 / var(--tw-text-opacity));\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.outline {\n outline-style: solid;\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.\\!transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.__narraleaf_content-player * {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.__narraleaf_content-player img {\n pointer-events: none;\n -webkit-user-drag: none;\n -webkit-user-select: none;\n}\n",""]);const s=a},314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,i){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var u=this[s][0];null!=u&&(a[u]=!0)}for(var c=0;c<t.length;c++){var l=[].concat(t[c]);r&&a[l[0]]||(void 0!==i&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},601:t=>{"use strict";t.exports=function(t){return t[1]}},196:(t,e,n)=>{var r;
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.NarraleafReact=e(require("react"),require("react-dom")):t.NarraleafReact=e(t.React,t.ReactDOM)}(this,((t,e)=>(()=>{var n={587:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(601),o=n.n(r),i=n(314),a=n.n(i)()(o());a.push([t.id,"/*\n! tailwindcss v3.4.11 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n.\\!container {\n width: 100% !important;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n\n .\\!container {\n max-width: 640px !important;\n }\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .\\!container {\n max-width: 768px !important;\n }\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .\\!container {\n max-width: 1024px !important;\n }\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .\\!container {\n max-width: 1280px !important;\n }\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .\\!container {\n max-width: 1536px !important;\n }\n\n .container {\n max-width: 1536px;\n }\n}\n.pointer-events-none {\n pointer-events: none;\n}\n.\\!visible {\n visibility: visible !important;\n}\n.visible {\n visibility: visible;\n}\n.static {\n position: static;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.inset-0 {\n inset: 0px;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-10 {\n z-index: 10;\n}\n.z-20 {\n z-index: 20;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.block {\n display: block;\n}\n.inline-block {\n display: inline-block;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-\\[calc\\(100\\%-40px\\)\\] {\n width: calc(100% - 40px);\n}\n.w-full {\n width: 100%;\n}\n.min-w-full {\n min-width: 100%;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.resize {\n resize: both;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-start {\n align-items: flex-start;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.whitespace-pre {\n white-space: pre;\n}\n.whitespace-pre-wrap {\n white-space: pre-wrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-br-md {\n border-bottom-right-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-black {\n --tw-border-opacity: 1;\n border-color: rgb(0 0 0 / var(--tw-border-opacity));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.bg-cover {\n background-size: cover;\n}\n.bg-center {\n background-position: center;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.align-bottom {\n vertical-align: bottom;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.italic {\n font-style: italic;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n.text-red-700 {\n --tw-text-opacity: 1;\n color: rgb(185 28 28 / var(--tw-text-opacity));\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.outline {\n outline-style: solid;\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.\\!transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.__narraleaf_content-player * {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.__narraleaf_content-player img {\n pointer-events: none;\n -webkit-user-drag: none;\n -webkit-user-select: none;\n}\n",""]);const s=a},314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,i){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var u=this[s][0];null!=u&&(a[u]=!0)}for(var c=0;c<t.length;c++){var l=[].concat(t[c]);r&&a[l[0]]||(void 0!==i&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},601:t=>{"use strict";t.exports=function(t){return t[1]}},196:(t,e,n)=>{var r;
2
2
  /*!
3
3
  * howler.js v2.2.4
4
4
  * howlerjs.com
@@ -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},387:(t,e,n)=>{"use strict";t.exports=n(73)},12:e=>{"use strict";e.exports=t},33:t=>{"use strict";t.exports=e}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={id:t,exports:{}};return n[t](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nc=void 0;var i={};return(()=>{"use strict";o.r(i),o.d(i,{Align:()=>Xt,BaseImageTransition:()=>kl,BaseTextTransition:()=>xl,BaseTransition:()=>_l,Bottom:()=>Pv,Center:()=>jv,Character:()=>Ku,CommonPosition:()=>qt,CommonPositionType:()=>Nt,Condition:()=>Sc,Control:()=>Ka,Coord2D:()=>Yt,Dissolve:()=>sm,Fade:()=>Hv,FadeIn:()=>Jv,Game:()=>sd,GameProviders:()=>Av,GameState:()=>$h,HBox:()=>Fv,Image:()=>rp,Isolated:()=>jh,Lambda:()=>wc,LiveGame:()=>Qh,Menu:()=>Vc,Namespace:()=>qf,Pause:()=>_u,Persistent:()=>np,Player:()=>kv,Say:()=>Eh,Scene:()=>Jl,Script:()=>gf,Sentence:()=>Iu,Sound:()=>gu,SoundType:()=>au,Storable:()=>Yf,Story:()=>Tf,Text:()=>Vl,Top:()=>Tv,Transform:()=>Qi,Utils:()=>iu,VBox:()=>Mv,Word:()=>Ou,useGame:()=>pp});var t={say:"character:say",action:"character:action",setName:"character:setName"},e={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform",transitionToScene:"scene:transitionToScene"},n={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",flush:"image:flush",initWearable:"image:initWearable",setAppearance:"image:setAppearance"},r={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},a={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat",sleep:"control:sleep"},s={action:"text:action",setText:"text:setText",show:"text:show",hide:"text:hide",applyTransform:"text:applyTransform",init:"text:init",applyTransition:"text:applyTransition",setFontSize:"text:setFontSize"},u={action:"displayable:action",layerMoveUp:"displayable:layerMoveUp",layerMoveDown:"displayable:layerMoveDown",layerMoveTop:"displayable:layerMoveTop",layerMoveBottom:"displayable:layerMoveBottom"},c={action:"persistent:action",set:"persistent:set"};function l(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */l=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 f(t,e,n,r){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new I(r||[]);return o(a,"_invoke",{value:T(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}}}e.wrap=f;var h="suspendedStart",d="suspendedYield",y="executing",v="completed",m={};function g(){}function w(){}function S(){}var _={};c(_,a,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(L([])));x&&x!==n&&r.call(x,a)&&(_=x);var A=S.prototype=g.prototype=Object.create(_);function O(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(o,i,a,s){var u=p(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==b(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=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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=j(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var c=p(e,n,r);if("normal"===c.type){if(o=r.done?v:d,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function j(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,j(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=p(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;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,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}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 C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function L(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(b(e)+" is not iterable")}return w.prototype=S,o(A,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:w,configurable:!0}),w.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,c(t,u,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},O(E.prototype),c(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new E(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(A),c(A,u,"Generator"),c(A,a,(function(){return this})),c(A,"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=L,I.prototype={constructor:I,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(C),!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,m):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),m},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),m}},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(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=m(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 p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(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,y(r.key),r)}}function d(t,e,n){return e&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function y(t){var e=function(t,e){if("object"!=b(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==b(e)?e:e+""}function v(t){return function(t){if(Array.isArray(t))return g(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(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 m(t,e){if(t){if("string"==typeof t)return g(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)?g(t,e):void 0}}function g(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 b(t){return b="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},b(t)}var w,S=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(t){t[t.string=0]="string",t[t.number=1]="number",t[t.boolean=2]="boolean",t[t.object=3]="object",t[t.array=4]="array",t[t.function=5]="function",t[t.symbol=6]="symbol",t[t[void 0]=7]="undefined",t[t.null=8]="null",t[t.date=9]="date",t[t.regexp=10]="regexp",t[t.other=11]="other"}(w||(w={}));var _=function(t){return"string"==typeof t?w.string:"number"==typeof t?w.number:"boolean"==typeof t?w.boolean:"object"===b(t)?Array.isArray(t)?w.array:null===t?w.null:t instanceof Date?w.date:t instanceof RegExp?w.regexp:w.object:"function"==typeof t?w.function:"symbol"===b(t)?w.symbol:void 0===t?w.undefined:w.other};function k(t,e){var n,r,o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i={};for(var a in t)o(t,a)&&(i[a]=(n=t[a],r=e[a],_(n)===w.object&&_(r)===w.object?n.constructor!==Object||r.constructor!==Object?r||n:k(n,r):Array.isArray(n)&&Array.isArray(r)?r&&r.length>0?v(r):v(n):void 0===n&&Array.isArray(r)?v(r):void 0===r?Array.isArray(n)?v(n):n:Array.isArray(r)?v(r):r));for(var s in e)o(e,s)&&!o(i,s)&&("object"===b(e[s])&&null!==e[s]?e[s].constructor===Object?i[s]=k({},e[s]):Array.isArray(e[s])?i[s]=v(e[s]):i[s]=e[s]:i[s]=e[s]);for(var u=arguments.length,c=new Array(u>2?u-2:0),l=2;l<u;l++)c[l-2]=arguments[l];if(c.length){var f=c[0],p=c.slice(1);return k.apply(void 0,[i,f].concat(v(p)))}return i}_.DataTypes=w;var x=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},n=arguments.length>1?arguments[1]:void 0;p(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=n}return d(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 e,n=f(this.listeners);try{for(n.s();!(e=n.n()).done;){(0,e.value)(this.result)}}catch(t){n.e(t)}finally{n.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 A(t){var e=new WeakSet;return function t(n){if(null===n||"object"!==b(n))return n;if(!e.has(n)){if(e.add(n),Array.isArray(n)){var r,o=[],i=f(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;o.push(t(a))}}catch(t){i.e(t)}finally{i.f()}return o}var s={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(s[u]=t(n[u]));return s}}(t)}function O(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"))}x.nothing=function(t){return t};var E=function(){return d((function t(){p(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(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 S(this,void 0,void 0,l().mark((function e(){var r,o,i,a,s,u,c=this;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.events[t]||(this.events[t]=[]),r=[],o=!1,i=f(this.events[t]);try{for(i.s();!(a=i.n()).done;)s=a.value,(u=s.apply(void 0,n))&&"object"===b(u)&&"function"==typeof u.then?r.push(u):o=!0}catch(t){i.e(t)}finally{i.f()}if(!o){e.next=7;break}return e.abrupt("return",void 0);case 7:if(this.events[t]=this.events[t].filter((function(t){return!r.includes(t)})),0!==r.length){e.next=10;break}return e.abrupt("return",new Promise((function(e){var r=c.on("event:EventDispatcher.register",(function(o,i){if(o===t){c.off(o,r);var a=null==i?void 0:i.apply(void 0,n);a&&a.then?a.then(e):e(a)}}))})));case 10:return e.next=12,Promise.all(r);case 12:return e.abrupt("return",void 0);case 13:case"end":return e.stop()}}),e,this)})))}},{key:"clear",value:function(){this.events={}}}])}();function T(){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 j(t){return new Promise((function(e){return setTimeout(e,t)}))}function P(t,e){if(t===e)return!0;if("object"!==b(t)||"object"!==b(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)||!P(t[a],e[a]))return!1}return!0}var C=function(){return d((function t(e){p(this,t),this.abortHandler=e,this.events=new E,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}}])}();C.EventTypes={"event:skipController.abort":"event:skipController.abort"};var I=function(){return d((function t(){p(this,t),this.locked=!1,this.listeners=[],this.unlockListeners=[]}),[{key:"lock",value:function(){return this.locked=!0,this}},{key:"unlock",value:function(){this.locked=!1;var t,e=f(this.listeners);try{for(e.s();!(t=e.n()).done;){(0,t.value)()}}catch(t){e.e(t)}finally{e.f()}var n,r=f(this.unlockListeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)()}}catch(t){r.e(t)}finally{r.f()}return this.listeners=[],this}},{key:"onUnlock",value:function(t){return this.unlockListeners.push(t),t}},{key:"offUnlock",value:function(t){this.unlockListeners=this.unlockListeners.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return S(this,void 0,void 0,l().mark((function t(){var e=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.locked){t.next=2;break}return t.abrupt("return");case 2:return t.abrupt("return",new Promise((function(t){e.listeners.push(t)})));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locked}}])}(),L=function(){return d((function t(){p(this,t),this.locks=[]}),[{key:"unlock",value:function(t){return t.unlock(),this.off(t),t}},{key:"register",value:function(t){var e=t||new I;return this.locks.push(e),e}},{key:"off",value:function(t){this.locks=this.locks.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return S(this,void 0,void 0,l().mark((function t(){var e;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.locks.map((function(t){return t.nextUnlock()})),t.abrupt("return",Promise.all(e));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locks.some((function(t){return t.isLocked()}))}}])}();function N(t,e){return t?e:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}function R(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return void 0!==t};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&r in e&&n(t[r],r)&&e[r](t[r],r)}var M=function(){return d((function t(){p(this,t),this.taskToken=null}),[{key:"scheduleTask",value:function(t,e){this.taskToken&&this.taskToken.cancel();var n=!1,r=setTimeout((function(){n||t()}),e);return this.taskToken={cancel:function(){clearTimeout(r),n=!0},isCancelled:function(){return n}},this.taskToken}},{key:"cancelTask",value:function(){return this.taskToken&&(this.taskToken.cancel(),this.taskToken=null),this}}])}();function F(t,e,n){var r=t.indexOf(e);if(-1===r)return t;var o=v(t);return o.splice(r,1),o.splice(n,0,e),o}var D=function(){return d((function t(e,n){p(this,t),this.concurrency=e,this.delay=n,this.tasks=[]}),[{key:"addTask",value:function(t){this.tasks.push(t)}},{key:"start",value:function(){return S(this,void 0,void 0,l().mark((function t(){var e,n=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=function(){return S(n,void 0,void 0,l().mark((function t(){var n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==this.tasks.length){t.next=2;break}return t.abrupt("return");case 2:return n=this.tasks.splice(0,this.concurrency),t.next=5,Promise.all(n.map((function(t){return t()})));case 5:return t.next=7,j(this.delay);case 7:return t.next=9,e();case 9:case"end":return t.stop()}}),t,this)})))},t.next=3,e();case 3:case"end":return t.stop()}}),t)})))}}])}();function B(t){return B="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},B(t)}function V(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,G(r.key),r)}}function G(t){var e=function(t,e){if("object"!=B(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=B(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==B(e)?e:e+""}var U=function(){return function(t,e,n){return e&&V(t.prototype,e),n&&V(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=T(),this._id=""}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode.getChild()}}},{key:"getId",value:function(){return this._id}},{key:"setId",value:function(t){this._id=t}},{key:"setContent",value:function(t){return this.contentNode.setContent(t),this}},{key:"setContentNode",value:function(t){return this.contentNode=t,this}},{key:"getFutureActions",value:function(t){var e=this.contentNode.getChild();return e&&e.action?[e.action]:[]}}])}();function W(t){return W="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},W(t)}function z(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */z=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==W(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(W(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 H(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,$(r.key),r)}}function $(t){var e=function(t,e){if("object"!=W(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=W(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==W(e)?e:e+""}function q(t,e,n){return e=X(e),function(t,e){if(e&&("object"==W(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,Y()?Reflect.construct(e,n||[],X(t).constructor):e.apply(t,n))}function Y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Y=function(){return!!t})()}function X(t){return X=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},X(t)}function K(t,e){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},K(t,e)}U.ActionTypes={action:"action"};var Z=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())}))},Q=function(t){function e(t,n,r){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=q(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}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&&K(t,e)}(e,t),function(t,e,n){return e&&H(t.prototype,e),n&&H(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"unknownTypeError",value:function(){throw new Error("Unknown action type: "+this.type)}},{key:"resolveAwaitable",value:function(t,e){var n=this,r=e||new x((function(t){return t}));return Z(n,void 0,void 0,z().mark((function e(){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t(r.resolve.bind(r),r);case 2:case"end":return e.stop()}}),e)}))),r}},{key:"is",value:function(t,e){return this instanceof t&&this.type===e}}])}(U);function J(t){return J="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},J(t)}function tt(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 et(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)?et(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 et(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 nt(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,rt(r.key),r)}}function rt(t){var e=function(t,e){if("object"!=J(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=J(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==J(e)?e:e+""}function ot(t,e,n){return e=ut(e),function(t,e){if(e&&("object"==J(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,it()?Reflect.construct(e,n||[],ut(t).constructor):e.apply(t,n))}function it(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(it=function(){return!!t})()}function at(t,e,n,r){var o=st(ut(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function st(){return st="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ut(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}},st.apply(null,arguments)}function ut(t){return ut=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ut(t)}function ct(t,e){return ct=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ct(t,e)}var lt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ot(this,e,arguments)}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&&ct(t,e)}(e,t),function(t,e,n){return e&&nt(t.prototype,e),n&&nt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===r.play){if(e.initSound(t,this.callee),!this.callee.getPlaying())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var o=new x((function(t){return t}));return t.playSound(this.callee,(function(){var e;t.stopSound(n.callee),o.resolve({type:n.type,node:null===(e=n.contentNode)||void 0===e?void 0:e.getChild()})})),o}return t.playSound(this.callee,(function(){t.stopSound(n.callee)})),at(e,"executeAction",this,3)([t])}if(this.type===r.stop)return t.stopSound(this.callee),at(e,"executeAction",this,3)([t]);if(this.type===r.fade){var i=tt(this.contentNode.getContent(),1)[0],a=i.start,s=i.end,u=i.duration;if(this.callee.getPlaying()){var c=void 0===a?this.callee.getPlaying().volume():a;this.callee.getPlaying().fade(c,s,u,this.callee.getToken())}return at(e,"executeAction",this,3)([t])}if(this.type===r.setVolume){var l=tt(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().volume(l,this.callee.getToken()),at(e,"executeAction",this,3)([t])}if(this.type===r.setRate){var f=tt(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().rate(f,this.callee.getToken()),at(e,"executeAction",this,3)([t])}if(this.type===r.pause)return this.callee.getPlaying()&&this.callee.getPlaying().pause(this.callee.getToken()),at(e,"executeAction",this,3)([t]);if(this.type===r.resume)return this.callee.getPlaying()&&this.callee.getPlaying().play(this.callee.getToken()),at(e,"executeAction",this,3)([t]);throw at(e,"unknownTypeError",this,3)([])}}],[{key:"initSound",value:function(t,e){e.getPlaying()||e.setPlaying(new(t.getHowl())(e.getHowlOptions()))}}])}(Q);function ft(t){return ft="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},ft(t)}function pt(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 ht(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)?ht(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 ht(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 dt(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"!=ft(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ft(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ft(e)?e:e+""}function vt(t,e,n){return e=wt(e),function(t,e){if(e&&("object"==ft(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,mt()?Reflect.construct(e,n||[],wt(t).constructor):e.apply(t,n))}function mt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(mt=function(){return!!t})()}function gt(t,e,n,r){var o=bt(wt(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function bt(){return bt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=wt(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}},bt.apply(null,arguments)}function wt(t){return wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wt(t)}function St(t,e){return St=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},St(t,e)}lt.ActionTypes=r;var _t,kt=function(t){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),vt(this,n,arguments)}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&&St(t,e)}(n,t),function(t,e,n){return e&&dt(t.prototype,e),n&&dt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"applyTransition",value:function(t,e){var n=this,r=(new x).registerSkipController(new C((function(){return t.logger.info("Background Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransition",e).then((function(){r.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),r}},{key:"executeAction",value:function(t){var r=this;if(this.type===e.action)return gt(n,"executeAction",this,3)([t]);if(this.type===e.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],gt(n,"executeAction",this,3)([t]);if(this.type===e.sleep){var o=new x((function(t){return t})),i=this.contentNode.getContent();return new Promise((function(t){"number"==typeof i?setTimeout((function(){t()}),i):x.isAwaitable(i)?i.then(t):null==i||i.then(t)})).then((function(){o.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),o}if(this.type===e.applyTransition){var a=pt(this.contentNode.getContent(),1)[0];return this.applyTransition(t,a)}if(this.is(n,"scene:init")){var s=new x((function(t){return t}));return n.handleSceneInit(this,t,s)}if(this.type===e.exit){t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var u=new x((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){u.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),u}if(this.type===e.jumpTo){var c=this.contentNode.getContent()[0],l=this.contentNode,f=t.getStory().getScene(c);if(!f)throw this._sceneNotFoundError(this.getSceneName(c));var p=f.getSceneRoot().contentNode;return p&&l.addChild(p),{type:this.type,node:p}}if(this.type===e.setBackgroundMusic){var h=pt(this.contentNode.getContent(),2),d=h[0],y=h[1];return this.callee.events.emit("event:scene.setBackgroundMusic",d,y||0),gt(n,"executeAction",this,3)([t])}if(this.type===e.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),gt(n,"executeAction",this,3)([t]);if(this.type===e.applyTransform){var v=pt(this.contentNode.getContent(),1)[0],m=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransform",v).then((function(){m.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),m}if(this.type===e.transitionToScene){var g=pt(this.contentNode.getContent(),3),b=g[0],w=g[1],S=g[2];if(w){var _=t.getStory().getScene(w);if(!_)throw this._sceneNotFoundError(this.getSceneName(w));if(!_.config.background)return gt(n,"executeAction",this,3)([t]);b.setSrc(_.config.background)}else S&&b.setSrc(S);return this.applyTransition(t,b)}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(t){var n,r;if(this.type===e.jumpTo){var o=this.contentNode.getContent()[0],i=t.getScene(o,!0);i.isSceneRootConstructed()||i.constructSceneRoot(t);var a=null===(n=t.getScene(o,!0).getSceneRoot())||void 0===n?void 0:n.contentNode;return(null==a?void 0:a.action)?[a.action]:[]}var s=null===(r=this.contentNode.getChild())||void 0===r?void 0:r.action;return s?[s]:[]}},{key:"_sceneNotFoundError",value:function(t){return new cu("Scene with name ".concat(t," not found")+"\nMake sure you have registered the scene using story.register"+"\nAction: (id: ".concat(this.getId(),") ").concat(this.type)+"\nAt: ".concat(this.__stack))}},{key:"getSceneName",value:function(t){return"string"==typeof t?t:t.name}}],[{key:"handleSceneInit",value:function(t,e,r){var o=pt(t.contentNode.getContent(),1)[0],i="string"==typeof o?e.getSceneByName(o):o;if(!i)throw t._sceneNotFoundError(t.getSceneName(o));return e.isSceneActive(i)?{type:t.type,node:t.contentNode.getChild()}:(e.registerSrcManager(i.srcManager).addScene(i),n.registerEventListeners(i,e,(function(){r.resolve({type:t.type,node:t.contentNode.getChild()}),e.stage.next()})),r)}},{key:"registerEventListeners",value:function(t,e,n){t.events.once("event:scene.unmount",(function(){e.offSrcManager(t.srcManager)})),t.events.once("event:scene.mount",(function(){t.state.backgroundMusic&&(lt.initSound(e,t.state.backgroundMusic),t.events.emit("event:scene.setBackgroundMusic",t.state.backgroundMusic,t.config.backgroundMusicFade))})),t.events.any("event:displayable.init").then((function(){n&&n()}))}}])}(Q);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,n){return e=Et(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||[],Et(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 Et(t){return Et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Et(t)}function Tt(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)}function jt(t,e){return jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jt(t,e)}function Pt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ct(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,Lt(r.key),r)}}function It(t,e,n){return e&&Ct(t.prototype,e),n&&Ct(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Lt(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+""}kt.ActionTypes=e,function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(_t||(_t={}));var Nt,Rt=function(t){function e(t,n,r){var o;return Pt(this,e),(o=At(this,e,[_t.ContentNode])).child=r||null,o.parent=n||null,o.action=t||null,o}return Tt(e,t),It(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:"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:"create",value:function(t){return(new e).setContent(t)}},{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()}}])}(function(){return It((function t(e){Pt(this,t),this.type=e,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}()),Mt="center",Ft="left",Dt="right";function Bt(t){return Bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bt(t)}function Vt(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,zt(r.key),r)}}function Ut(t,e,n){return e&&Gt(t.prototype,e),n&&Gt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wt(t,e,n){return(e=zt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zt(t){var e=function(t,e){if("object"!=Bt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Bt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bt(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(Nt||(Nt={}));var Ht=Wt(Wt(Wt({},Nt.Left,"33.33%"),Nt.Center,"50%"),Nt.Right,"66.66%"),$t=function(){function t(){Vt(this,t)}return Ut(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"calc(".concat(e," + 0px)");var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + (").concat(n,"px))")}},{key:"toCoord2D",value:function(t){if(qt.isCommonPositionType(t))return Yt.fromCommonPosition(t);if(Yt.isCoord2DPosition(t))return t;if(Xt.isAlignPosition(t))return Yt.fromAlignPosition(t);if("object"===Bt(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new Yt(t);throw new Error("Invalid position type")}},{key:"orUnknown",value:function(e){return t.isUnknown(e)||void 0===e?t.Unknown:e}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return Yt.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(Nt).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===Bt(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===Bt(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 qt||t instanceof Yt||t instanceof Xt}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return Yt.fromCommonPosition(new qt(t));if(this.isRawCoord2DPosition(t))return new Yt(t);if(this.isRawAlignPosition(t))return Yt.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")}}])}();$t.Unknown=Symbol("Unknown");var qt=function(){function t(e){Vt(this,t),this.position=e}return Ut(t,[{key:"toCSS",value:function(){return{x:Ht[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();qt.Positions=Nt;var Yt=function(){function t(e,n){Vt(this,t),"object"===Bt(e)?(this.x=$t.orUnknown(e.x),this.y=$t.orUnknown(e.y),this.xoffset=$t.orUnknown(e.xoffset),this.yoffset=$t.orUnknown(e.yoffset)):(this.x=$t.orUnknown(e),this.y=$t.orUnknown(n),this.xoffset=$t.Unknown,this.yoffset=$t.Unknown)}return Ut(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:Ht[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:$t.isUnknown(e.xalign)?$t.Unknown:"".concat(100*e.xalign,"%"),y:$t.isUnknown(e.yalign)?$t.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:$t.isUnknown(n.x)?e.x:n.x,y:$t.isUnknown(n.y)?e.y:n.y,xoffset:$t.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:$t.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),Xt=function(){function t(e,n){Vt(this,t),"object"===Bt(e)?(this.xalign=$t.orUnknown(e.xalign),this.yalign=$t.orUnknown(e.yalign),this.xoffset=$t.orUnknown(e.xoffset),this.yoffset=$t.orUnknown(e.yoffset)):(this.xalign=$t.orUnknown(e),this.yalign=$t.orUnknown(n),this.xoffset=$t.Unknown,this.yoffset=$t.Unknown)}return Ut(t,[{key:"toCSS",value:function(){return{x:$t.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:$t.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();function Kt(t){let e;return()=>(void 0===e&&(e=t()),e)}const Zt=Kt((()=>void 0!==window.ScrollTimeline));class Qt{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,e){const n=this.animations.map((n=>Zt()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.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 Jt=t=>1e3*t,te=t=>t/1e3;function ee(t,e){return e?t*(1e3/e):0}const ne=5;function re(t,e,n){const r=Math.max(e-ne,0);return ee(n-t(r),e-r)}const oe=t=>t;let ie=oe,ae=oe;const se=(t,e,n)=>n>e?e:n<t?t:n,ue=.001,ce=.01,le=10,fe=.05,pe=1;function he({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;ie(t<=Jt(le),"Spring duration must be 10 seconds or less");let a=1-e;a=se(fe,pe,a),t=se(ce,le,te(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=ye(e,a),u=Math.exp(-o);return ue-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=ye(Math.pow(e,2),a);return(-o(e)+ue>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-ue,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<de;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=Jt(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 de=12;function ye(t,e){return t*Math.sqrt(1-e*e)}const ve=["duration","bounce"],me=["stiffness","damping","mass"];function ge(t,e){return e.some((e=>void 0!==t[e]))}function be({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:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!ge(t,me)&&ge(t,ve)){const n=he(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-te(r.velocity||0)}),h=f||0,d=u/(2*Math.sqrt(s*c)),y=i-o,v=te(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),d<1){const t=ye(v,d);g=e=>{const n=Math.exp(-d*v*e);return i-n*((h+d*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===d)g=t=>i-Math.exp(-v*t)*(y+(h+v*y)*t);else{const t=v*Math.sqrt(d*d-1);g=e=>{const n=Math.exp(-d*v*e),r=Math.min(t*e,300);return i-n*((h+d*v*y)*Math.sinh(r)+t*y*Math.cosh(r))/t}}return{calculatedDuration:p&&l||null,next:t=>{const r=g(t);if(p)a.done=t>=l;else{let o=0;d<1&&(o=0===t?Jt(h):re(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}}}const we=2e4;function Se(t){let e=0;let n=t.next(e);for(;!n.done&&e<we;)e+=50,n=t.next(e);return e>=we?1/0:e}function _e(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(Se(r),we);return{type:"keyframes",ease:t=>r.next(o*t).value/e,duration:te(o)}}const ke=(t,e,n)=>t+(e-t)*n,xe=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r};function Ae(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=xe(0,e,r);t.push(ke(n,1,o))}}function Oe(t){const e=[0];return Ae(e,t.length-1),e}const Ee=t=>Boolean(t&&t.getVelocity);function Te(t){return"object"==typeof t&&!Array.isArray(t)}function je(t,e,n,r){return"string"==typeof t&&Te(e)?function(t,e,n){var r;if("string"==typeof t){let o=document;e&&(ae(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||[])}(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function Pe(t){return"function"==typeof t}function Ce(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 Ie=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t},Le=t=>Array.isArray(t)&&"number"!=typeof t[0];function Ne(t,e){return Le(t)?t[Ie(0,t.length,e)]:t}function Re(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function Me(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&&(Re(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:ke(o,i,r[a]),easing:Ne(n,a)})}function Fe(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const De="easeInOut";function Be(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function Ve(t,e){return e[t]||(e[t]=[]),e[t]}function Ge(t){return Array.isArray(t)?t:[t]}function Ue(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const We=t=>"number"==typeof t,ze=t=>t.every(We),He=new WeakMap,$e=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],qe=new Set($e),Ye={type:"spring",stiffness:500,damping:25,restSpeed:10},Xe={type:"keyframes",duration:.8},Ke={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ze=(t,{keyframes:e})=>e.length>2?Xe:qe.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Ye:Ke;function Qe(t,e){return t?t[e]||t.default||t:void 0}const Je=!1,tn=!1,en=!1,nn=t=>null!==t;function rn(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(nn),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const on=["read","resolveKeyframes","update","preRender","render","postRender"];function an(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=on.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:p}=a,h=()=>{const i=tn?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),p.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(h))};return{schedule:on.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(h)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<on.length;e++)a[on[e]].cancel(t)},state:o,steps:a}}const{schedule:sn,cancel:un,state:cn,steps:ln}=an("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:oe,!0),fn=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,pn=1e-7,hn=12;function dn(t,e,n,r){if(t===e&&n===r)return oe;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=fn(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>pn&&++s<hn);return a}(e,0,1,t,n);return t=>0===t||1===t?t:fn(o(t),e,r)}const yn=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,vn=t=>e=>1-t(1-e),mn=dn(.33,1.53,.69,.99),gn=vn(mn),bn=yn(gn),wn=t=>(t*=2)<1?.5*gn(t):.5*(2-Math.pow(2,-10*(t-1))),Sn=t=>1-Math.sin(Math.acos(t)),_n=vn(Sn),kn=yn(Sn),xn=t=>/^0[^.\s]+$/u.test(t);const An=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),On=t=>e=>"string"==typeof e&&e.startsWith(t),En=On("--"),Tn=On("var(--"),jn=t=>!!Tn(t)&&Pn.test(t.split("/*")[0].trim()),Pn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Cn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function In(t,e,n=1){ae(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=Cn.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 An(t)?parseFloat(t):t}return jn(o)?In(o,e,n+1):o}const Ln={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Nn={...Ln,transform:t=>se(0,1,t)},Rn={...Ln,default:1},Mn=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Fn=Mn("deg"),Dn=Mn("%"),Bn=Mn("px"),Vn=Mn("vh"),Gn=Mn("vw"),Un={...Dn,parse:t=>Dn.parse(t)/100,transform:t=>Dn.transform(100*t)},Wn=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),zn=t=>t===Ln||t===Bn,Hn=(t,e)=>parseFloat(t.split(", ")[e]),$n=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Hn(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?Hn(e[1],t):0}},qn=new Set(["x","y","z"]),Yn=$e.filter((t=>!qn.has(t)));const Xn={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:$n(4,13),y:$n(5,14)};Xn.translateX=Xn.x,Xn.translateY=Xn.y;const Kn=t=>e=>e.test(t),Zn=[Ln,Bn,Dn,Fn,Gn,Vn,{test:t=>"auto"===t,parse:t=>t}],Qn=t=>Zn.find(Kn(t)),Jn=new Set;let tr=!1,er=!1;function nr(){if(er){const t=Array.from(Jn).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 Yn.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)}))}er=!1,tr=!1,Jn.forEach((t=>t.complete())),Jn.clear()}function rr(){Jn.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(er=!0)}))}class or{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?(Jn.add(this),tr||(tr=!0,sn.read(rr),sn.resolveKeyframes(nr))):(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),Jn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Jn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const ir=t=>Math.round(1e5*t)/1e5,ar=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const sr=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ur=(t,e)=>n=>Boolean("string"==typeof n&&sr.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),cr=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[o,i,a,s]=r.match(ar);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},lr={...Ln,transform:t=>Math.round((t=>se(0,255,t))(t))},fr={test:ur("rgb","red"),parse:cr("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+lr.transform(t)+", "+lr.transform(e)+", "+lr.transform(n)+", "+ir(Nn.transform(r))+")"};const pr={test:ur("#"),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:fr.transform},hr={test:ur("hsl","hue"),parse:cr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Dn.transform(ir(e))+", "+Dn.transform(ir(n))+", "+ir(Nn.transform(r))+")"},dr={test:t=>fr.test(t)||pr.test(t)||hr.test(t),parse:t=>fr.test(t)?fr.parse(t):hr.test(t)?hr.parse(t):pr.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?fr.transform(t):hr.transform(t)},yr=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const vr="number",mr="color",gr="var",br="var(",wr="${}",Sr=/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 _r(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(Sr,(t=>(dr.test(t)?(r.color.push(i),o.push(mr),n.push(dr.parse(t))):t.startsWith(br)?(r.var.push(i),o.push(gr),n.push(t)):(r.number.push(i),o.push(vr),n.push(parseFloat(t))),++i,wr))).split(wr);return{values:n,split:a,indexes:r,types:o}}function kr(t){return _r(t).values}function xr(t){const{split:e,types:n}=_r(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===vr?ir(t[i]):e===mr?dr.transform(t[i]):t[i]}return o}}const Ar=t=>"number"==typeof t?0:t;const Or={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(ar))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(yr))||void 0===n?void 0:n.length)||0)>0},parse:kr,createTransformer:xr,getAnimatableNone:function(t){const e=kr(t);return xr(t)(e.map(Ar))}},Er=new Set(["brightness","contrast","saturate","opacity"]);function Tr(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(ar)||[];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 jr=/\b([a-z-]*)\(.*?\)/gu,Pr={...Or,getAnimatableNone:t=>{const e=t.match(jr);return e?e.map(Tr).join(" "):t}},Cr={borderWidth:Bn,borderTopWidth:Bn,borderRightWidth:Bn,borderBottomWidth:Bn,borderLeftWidth:Bn,borderRadius:Bn,radius:Bn,borderTopLeftRadius:Bn,borderTopRightRadius:Bn,borderBottomRightRadius:Bn,borderBottomLeftRadius:Bn,width:Bn,maxWidth:Bn,height:Bn,maxHeight:Bn,top:Bn,right:Bn,bottom:Bn,left:Bn,padding:Bn,paddingTop:Bn,paddingRight:Bn,paddingBottom:Bn,paddingLeft:Bn,margin:Bn,marginTop:Bn,marginRight:Bn,marginBottom:Bn,marginLeft:Bn,backgroundPositionX:Bn,backgroundPositionY:Bn},Ir={rotate:Fn,rotateX:Fn,rotateY:Fn,rotateZ:Fn,scale:Rn,scaleX:Rn,scaleY:Rn,scaleZ:Rn,skew:Fn,skewX:Fn,skewY:Fn,distance:Bn,translateX:Bn,translateY:Bn,translateZ:Bn,x:Bn,y:Bn,z:Bn,perspective:Bn,transformPerspective:Bn,opacity:Nn,originX:Un,originY:Un,originZ:Bn},Lr={...Ln,transform:Math.round},Nr={...Cr,...Ir,zIndex:Lr,size:Bn,fillOpacity:Nn,strokeOpacity:Nn,numOctaves:Lr},Rr={...Nr,color:dr,backgroundColor:dr,outlineColor:dr,fill:dr,stroke:dr,borderColor:dr,borderTopColor:dr,borderRightColor:dr,borderBottomColor:dr,borderLeftColor:dr,filter:Pr,WebkitFilter:Pr},Mr=t=>Rr[t];function Fr(t,e){let n=Mr(t);return n!==Pr&&(n=Or),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Dr=new Set(["auto","none","0"]);class Br extends or{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(),jn(r))){const o=In(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Wn.has(n)||2!==t.length)return;const[r,o]=t,i=Qn(r),a=Qn(o);if(i!==a)if(zn(i)&&zn(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||xn(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&&!Dr.has(e)&&_r(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=Fr(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=Xn[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]=Xn[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 Vr;function Gr(){Vr=void 0}const Ur={now:()=>(void 0===Vr&&Ur.set(cn.isProcessing||tn?cn.timestamp:performance.now()),Vr),set:t=>{Vr=t,queueMicrotask(Gr)}},Wr=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Or.test(t)&&"0"!==t||t.startsWith("url(")));function zr(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=Wr(o,e),s=Wr(i,e);return ie(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||Pe(n))&&r)}class Hr{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=Ur.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||(rr(),nr()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Ur.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!zr(t,n,r,o)){if(en||!i)return null==s||s(rn(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 $r({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],p={done:!1,value:f},h=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let d=n*e;const y=f+d,v=void 0===a?y:a(y);v!==y&&(d=v-f);const m=t=>-d*Math.exp(-t/r),g=t=>v+m(t),b=t=>{const e=m(t),n=g(t);p.done=Math.abs(e)<=c,p.value=p.done?v:n};let w,S;const _=t=>{var e;(e=p.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,S=be({keyframes:[p.value,h(p.value)],velocity:re(g,t,p.value),damping:o,stiffness:i,restDelta:c,restSpeed:l}))};return _(0),{calculatedDuration:null,next:t=>{let e=!1;return S||void 0!==w||(e=!0,b(t),_(t)),void 0!==w&&t>=w?S.next(t-w):(!e&&b(t),p)}}}const qr=dn(.42,0,1,1),Yr=dn(0,0,.58,1),Xr=dn(.42,0,.58,1),Kr=t=>Array.isArray(t)&&"number"==typeof t[0],Zr={linear:oe,easeIn:qr,easeInOut:Xr,easeOut:Yr,circIn:Sn,circInOut:kn,circOut:_n,backIn:gn,backInOut:bn,backOut:mn,anticipate:wn},Qr=t=>{if(Kr(t)){ae(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return dn(e,n,r,o)}return"string"==typeof t?(ae(void 0!==Zr[t],`Invalid easing type '${t}'`),Zr[t]):t},Jr=(t,e)=>n=>e(t(n)),to=(...t)=>t.reduce(Jr);function eo(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 no(t,e){return n=>n>0?e:t}const ro=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},oo=[pr,fr,hr];function io(t){const e=(n=t,oo.find((t=>t.test(n))));var n;if(ie(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===hr&&(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=eo(s,r,t+1/3),i=eo(s,r,t),a=eo(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 ao=(t,e)=>{const n=io(t),r=io(e);if(!n||!r)return no(t,e);const o={...n};return t=>(o.red=ro(n.red,r.red,t),o.green=ro(n.green,r.green,t),o.blue=ro(n.blue,r.blue,t),o.alpha=ke(n.alpha,r.alpha,t),fr.transform(o))},so=new Set(["none","hidden"]);function uo(t,e){return n=>ke(t,e,n)}function co(t){return"number"==typeof t?uo:"string"==typeof t?jn(t)?no:dr.test(t)?ao:po:Array.isArray(t)?lo:"object"==typeof t?dr.test(t)?ao:fo:no}function lo(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>co(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function fo(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=co(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const po=(t,e)=>{const n=Or.createTransformer(e),r=_r(t),o=_r(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):to(lo(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):(ie(!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.`),no(t,e))};function ho(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return ke(t,e,n);return co(t)(t,e)}function yo(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(ae(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||ho,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]||oe:e;i=to(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=xe(t[n],t[n+1],e);return a[n](r)};return n?e=>u(se(t[0],t[i-1],e)):u}function vo({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=Le(r)?r.map(Qr):Qr(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Oe(e),t),s=yo(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||Xr)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const mo=t=>{const e=({timestamp:e})=>t(e);return{start:()=>sn.update(e,!0),stop:()=>un(e),now:()=>cn.isProcessing?cn.timestamp:Ur.now()}},go={decay:$r,inertia:$r,tween:vo,keyframes:vo,spring:be},bo=t=>t/100;class wo extends Hr{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)||or;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=Pe(e)?e:go[e]||vo;let s,u;a!==vo&&"number"!=typeof t[0]&&(s=to(bo,ho(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=Se(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:p,repeatType:h,repeatDelay:d,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(p){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,p+1);Boolean(e%2)&&("reverse"===h?(n=1-n,d&&(n-=d/l)):"mirror"===h&&(b=i)),g=se(0,1,n)*l}const w=m?{done:!1,value:s[0]}:b.next(g);a&&(w.value=a(w.value));let{done:S}=w;m||null===u||(S=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const _=null===this.holdTime&&("finished"===this.state||"running"===this.state&&S);return _&&void 0!==r&&(w.value=rn(s,this.options,r)),y&&y(w.value),_&&this.finish(),w}get duration(){const{resolved:t}=this;return t?te(t.calculatedDuration):0}get time(){return te(this.currentTime)}set time(t){t=Jt(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=te(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=mo,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 So=new Set(["opacity","clipPath","filter","transform"]),_o=(t,e)=>{let n="";const r=Math.max(Math.round(e/10),2);for(let e=0;e<r;e++)n+=t(xe(0,r-1,e))+", ";return`linear(${n.substring(0,n.length-2)})`},ko={linearEasing:void 0};function xo(t,e){const n=Kt(t);return()=>{var t;return null!==(t=ko[e])&&void 0!==t?t:n()}}const Ao=xo((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function Oo(t){return Boolean("function"==typeof t&&Ao()||!t||"string"==typeof t&&(t in To||Ao())||Kr(t)||Array.isArray(t)&&t.every(Oo))}const Eo=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,To={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 jo(t,e){return t?"function"==typeof t&&Ao()?_o(t,e):Kr(t)?Eo(t):Array.isArray(t)?t.map((t=>jo(t,e)||To.easeOut)):To[t]:void 0}function Po(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,o);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"})}function Co(t,e){t.timeline=e,t.onfinish=null}const Io=Kt((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const Lo={anticipate:wn,backInOut:bn,circInOut:kn};class No extends Hr{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new Br(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("string"==typeof i&&Ao()&&i in Lo&&(i=Lo[i]),function(t){return Pe(t.type)||"spring"===t.type||!Oo(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new wo({...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=Po(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(Co(l,this.pendingTimeline),this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(rn(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 te(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return te(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=Jt(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 oe;const{animation:n}=e;Co(n,t)}else this.pendingTimeline=t;return oe}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 wo({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=Jt(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 Io()&&n&&So.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const Ro=(t,e,n,r={},o,i)=>a=>{const s=Qe(r,t)||{},u=s.delay||r.delay||0;let{elapsed:c=0}=r;c-=Jt(u);let l={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...s,delay:-c,onUpdate:t=>{e.set(t),s.onUpdate&&s.onUpdate(t)},onComplete:()=>{a(),s.onComplete&&s.onComplete()},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})(s)||(l={...l,...Ze(t,l)}),l.duration&&(l.duration=Jt(l.duration)),l.repeatDelay&&(l.repeatDelay=Jt(l.repeatDelay)),void 0!==l.from&&(l.keyframes[0]=l.from);let f=!1;if((!1===l.type||0===l.duration&&!l.repeatDelay)&&(l.duration=0,0===l.delay&&(f=!0)),(en||Je)&&(f=!0,l.duration=0,l.delay=0),f&&!i&&void 0!==e.get()){const t=rn(l.keyframes,s);if(void 0!==t)return sn.update((()=>{l.onUpdate(t),l.onComplete()})),new Qt([])}return!i&&No.supports(l)?new No(l):new wo(l)},Mo=t=>Array.isArray(t),Fo=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Do=t=>Mo(t)?t[t.length-1]||0:t;class Bo{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>Re(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 Vo={current:void 0};class Go{constructor(t,e={}){this.version="11.11.9",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=Ur.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=Ur.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 Bo);const n=this.events[t].add(e);return"change"===t?()=>{n(),sn.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 Vo.current&&Vo.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Ur.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return ee(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 Go(t,e)}function Wo(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function zo(t,e,n,r){if("function"==typeof e){const[o,i]=Wo(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]=Wo(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function Ho(t,e,n){const r=t.getProps();return zo(r,e,void 0!==n?n:r.custom,t)}function $o(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,e){if(!t.applyWillChange)return;const n=t.getValue("willChange");return r=n,Boolean(Ee(r)&&r.add)?n.add(e):void 0;var r}function Zo({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Qo(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&&Zo(l,e))continue;const s={delay:n,...Qe(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=Xo(t);if(n){const t=window.MotionHandoffAnimation(n,e,sn);null!==t&&(s.startTime=t,f=!0)}}Ko(t,e),r.start(Ro(e,r,o,t.shouldReduceMotion&&qe.has(e)?{type:!1}:s,t,f));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{sn.update((()=>{s&&function(t,e){const n=Ho(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)$o(t,e,Do(i[e]))}(t,s)}))})),c}const Jo={};function ti(t,{layout:e,layoutId:n}){return qe.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!Jo[t]||"opacity"===t)}function ei(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(Ee(o[a])||e.style&&Ee(e.style[a])||ti(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 ni(t,e,n){const r=ei(t,e,n);for(const n in t)if(Ee(t[n])||Ee(e[n])){r[-1!==$e.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const ri="undefined"!=typeof window,oi={current:null},ii={current:!1};function ai(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function si(t){return"string"==typeof t||Array.isArray(t)}const ui=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ci=["initial",...ui];function li(t){return ai(t.animate)||ci.some((e=>si(t[e])))}function fi(t){return Boolean(li(t)||t.variants)}const pi={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"]},hi={};for(const t in pi)hi[t]={isEnabled:e=>pi[t].some((t=>!!e[t]))};const di=[...Zn,dr,Or],yi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),vi=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class mi{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=or,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=Ur.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,sn.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=li(e),this.isVariantNode=fi(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]&&Ee(e)&&e.set(s[t],!1)}}mount(t){this.current=t,He.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))),ii.current||function(){if(ii.current=!0,ri)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>oi.current=t.matches;t.addListener(e),e()}else oi.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||oi.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){He.delete(this.current),this.projection&&this.projection.unmount(),un(this.notifyUpdate),un(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=qe.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&sn.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 hi){const e=hi[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<vi.length;e++){const n=vi[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(Ee(o))t.addValue(r,o);else if(Ee(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}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&&(An(r)||xn(r))?r=parseFloat(r):(o=r,!di.find(Kn(o))&&Or.test(e)&&(r=Fr(t,e))),this.setBaseTarget(t,Ee(r)?r.get():r)),Ee(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=zo(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||Ee(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 Bo),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class gi extends mi{constructor(){super(...arguments),this.KeyframeResolver=Br}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 bi=(t,e)=>e&&"number"==typeof t?e.transform(t):t,wi={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Si=$e.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(qe.has(t))a=!0;else if(En(t))o[t]=n;else{const e=bi(n,Nr[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<Si;i++){const a=$e[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=bi(s,Nr[a]);u||(o=!1,r+=`${wi[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 ki(t,e,n){return"string"==typeof t?t:Bn.transform(e+n*t)}const xi={offset:"stroke-dashoffset",array:"stroke-dasharray"},Ai={offset:"strokeDashoffset",array:"strokeDasharray"};function Oi(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:p,style:h,dimensions:d}=t;p.transform&&(d&&(h.transform=p.transform),delete p.transform),d&&(void 0!==o||void 0!==i||h.transform)&&(h.transformOrigin=function(t,e,n){return`${ki(e,t.x,t.width)} ${ki(n,t.y,t.height)}`}(d,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(p.x=e),void 0!==n&&(p.y=n),void 0!==r&&(p.scale=r),void 0!==a&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?xi:Ai;t[i.offset]=Bn.transform(-r);const a=Bn.transform(e),s=Bn.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const Ei=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 Ti(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 ji(t,e,n,r){Ti(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Ei.has(n)?n:qo(n),e.attrs[n])}const Pi=t=>"string"==typeof t&&"svg"===t.toLowerCase();class Ci extends gi{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=yi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(qe.has(e)){const t=Mr(e);return t&&t.default||0}return e=Ei.has(e)?e:qo(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return ni(t,e,n)}build(t,e,n){Oi(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){ji(t,e,0,r)}mount(t){this.isSVGTag=Pi(t.tagName),super.mount(t)}}function Ii(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 Li extends gi{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=Ti}readValueFromInstance(t,e){if(qe.has(e)){const t=Mr(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(En(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Ii(t,e)}build(t,e,n){_i(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return ei(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ee(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class Ni extends mi{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function Ri(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 Ci(e):new Li(e);n.mount(t),He.set(t,n)}function Mi(t){const e=new Ni({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),He.set(t,e)}function Fi(t,e,n,r){const o=[];if(function(t,e){return Ee(t)||"number"==typeof t||"string"==typeof t&&!Te(e)}(t,e))o.push(function(t,e,n){const r=Ee(t)?t:Uo(t);return r.start(Ro("",r,e,n)),r.animation}(t,Te(e)&&e.default||e,n&&n.default||n));else{const i=je(t,e,r),a=i.length;ae(Boolean(a),"No valid elements provided.");for(let t=0;t<a;t++){const r=i[t],s=r instanceof Element?Ri:Mi;He.has(r)||s(r);const u=He.get(r),c={...n};"delay"in c&&"function"==typeof c.delay&&(c.delay=c.delay(t,a)),o.push(...Qo(u,{...e,transition:c},{}))}}return o}function Di(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r,o){const i=e.duration||.3,a=new Map,s=new Map,u={},c=new Map;let l=0,f=0,p=0;for(let n=0;n<t.length;n++){const a=t[n];if("string"==typeof a){c.set(a,f);continue}if(!Array.isArray(a)){c.set(a.name,Ce(f,a.at,l,c));continue}let[h,d,y={}]=a;void 0!==y.at&&(f=Ce(f,y.at,l,c));let v=0;const m=(t,n,r,a=0,s=0)=>{const u=Ge(t),{delay:c=0,times:l=Oe(u),type:h="keyframes",...d}=n;let{ease:y=e.ease||"easeOut",duration:m}=n;const g="function"==typeof c?c(a,s):c,b=u.length,w=Pe(h)?h:null==o?void 0:o[h];if(b<=2&&w){let t=100;if(2===b&&ze(u)){const e=u[1]-u[0];t=Math.abs(e)}const e={...d};void 0!==m&&(e.duration=Jt(m));const n=_e(e,t,w);y=n.ease,m=n.duration}null!=m||(m=i);const S=f+g,_=S+m;1===l.length&&0===l[0]&&(l[1]=1);const k=l.length-u.length;k>0&&Ae(l,k),1===u.length&&u.unshift(null),Me(r,u,y,l,S,_),v=Math.max(g+m,v),p=Math.max(_,p)};if(Ee(h))m(d,y,Ve("default",Be(h,s)));else{const t=je(h,d,r,u),e=t.length;for(let n=0;n<e;n++){const r=Be(t[n],s);for(const t in d)m(d[t],Ue(y,t),Ve(t,r),n,e)}}l=f,f+=v}return s.forEach(((t,r)=>{for(const o in t){const i=t[o];i.sort(Fe);const s=[],u=[],c=[];for(let t=0;t<i.length;t++){const{at:e,value:n,easing:r}=i[t];s.push(n),u.push(xe(0,p,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(De)),1!==u[u.length-1]&&(u.push(1),s.push(null)),a.has(r)||a.set(r,{keyframes:{},transition:{}});const l=a.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:p,ease:c,times:u,...n}}})),a}(t,e,n,{spring:be});return o.forEach((({keyframes:t,transition:e},n)=>{r.push(...Fi(n,t,e))})),r}const Bi=function(t,e,n){let r=[];var o;o=t,r=Array.isArray(o)&&Array.isArray(o[0])?Di(t,e,Vi):Fi(t,e,n,Vi);const i=new Qt(r);return Vi&&Vi.animations.push(i),i};var Vi;function Gi(t){return Gi="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},Gi(t)}function Ui(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Ui=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==Gi(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Gi(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 Wi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Hi(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 zi(t){return function(t){if(Array.isArray(t))return $i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Hi(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 Hi(t,e){if(t){if("string"==typeof t)return $i(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)?$i(t,e):void 0}}function $i(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 qi(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,Xi(r.key),r)}}function Yi(t,e,n){return(e=Xi(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xi(t){var e=function(t,e){if("object"!=Gi(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Gi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gi(e)?e:e+""}var Ki=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())}))},Zi=Yi(Yi(Yi({},Ft,"25.33%"),Mt,"50%"),Dt,"75.66%"),Qi=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,zi(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&&qi(t.prototype,e),n&&qi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r){var o=e.scope,i=e.overwrites,a=e.target;return Ki(this,void 0,void 0,Ui().mark((function e(){var s=this;return Ui().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){Ki(s,void 0,void 0,Ui().mark((function s(){var u,c,l,f,p=this;return Ui().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||e(),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=Wi(this.sequences),s.prev=4,f=Ui().mark((function e(){var r,s,u,c,f,h;return Ui().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,s=r.props,u=r.options,c=k({},p.propToCSS(n,a.state)),o.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=o.current,Object.assign(f.style,c),a.state=t.mergeState(a.state,s),h=Bi(f,p.propToCSS(n,a.state,i),p.optionsToFramerMotionOptions(u)||{}),p.setControl(h),n.logger.debug("Animating",p.propToCSS(n,a.state,i)),!1!==(null==u?void 0:u.sync)){e.next=14;break}h.then((function(){Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null)})),e.next=18;break;case 14:return e.next=16,new Promise((function(t){return h.then((function(){return t()}))}));case 16:Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null);case 18: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,j(2);case 24:this.setControl(null),e(),r&&r(a.state);case 27:case"end":return s.stop()}}),s,this,[[4,13,16,19]])})))})));case 1: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{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}},fontColor:function(t){return"string"==typeof t?{color:t}:{color:O(t)}}},c={};for(var l in c.transform=t.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:"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 qt.isCommonPositionType(t)||Yt.isCoord2DPosition(t)||Xt.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return t?$t.isRawPosition(t)?$t.D2PositionToCSS($t.rawPositionToCoord2D(t),n,e):$t.D2PositionToCSS(t.toCSS(),n,e):{}}},{key:"backgroundToCSS",value:function(t){return null==t?{}:iu.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:O(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?$t.mergePosition($t.tryParsePosition(t),$t.tryParsePosition(e)):$t.toCoord2D($t.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},k(t,e)),{position:n})}},{key:"propToCSSTransform",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.translate,i=void 0===o?[]:o,a=r.scale,s=void 0===a?1:a;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var u=void 0!==e.scale?e.scale:1,c=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},l=c.invertY,f=c.invertX;return["translate(".concat(i[0]||(f?"":"-")+"50%",", ").concat(i[1]||(l?"":"-")+"50%",")"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)"),"scale(".concat(u*s,")")].filter(Boolean).join(" ")}}])}();function Ji(t){return Ji="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},Ji(t)}function ta(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,ea(r.key),r)}}function ea(t){var e=function(t,e){if("object"!=Ji(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ji(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ji(e)?e:e+""}Qi.defaultSequenceOptions={sync:!0,repeat:1},Qi.defaultOptions={duration:0,ease:"linear"},Qi.CommonImagePositionMap=Zi;var na=function(){return function(t,e,n){return e&&ta(t.prototype,e),n&&ta(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.id=""}),[{key:"setId",value:function(t){this.id=t}},{key:"getId",value:function(){return this.id}},{key:"reset",value:function(){}},{key:"fromData",value:function(t){return this}},{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.setChild(r.contentNode))}return t}}])}();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(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 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,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)||sa(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 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(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ca=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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,P.prototype={constructor:P,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(j),!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),j(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;j(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 la(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 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+""}function pa(t,e,n){return e=va(e),function(t,e){if(e&&("object"==ra(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,ha()?Reflect.construct(e,n||[],va(t).constructor):e.apply(t,n))}function ha(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ha=function(){return!!t})()}function da(t,e,n,r){var o=ya(va(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ya(){return ya="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=va(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}},ya.apply(null,arguments)}function va(t){return va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},va(t)}function ma(t,e){return ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ma(t,e)}var ga,ba=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())}))},wa=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),pa(this,e,arguments)}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&&ma(t,e)}(e,t),function(t,e,n){return e&&la(t.prototype,e),n&&la(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAllActions",value:function(t,e){return ba(this,void 0,void 0,ca().mark((function n(){var r,o,i;return ca().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=ca().mark((function e(){var n,r,i;return ca().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o),t.logger.debug("Control - Next Action",n),n){e.next=4;break}return e.abrupt("return",0);case 4:if(!x.isAwaitable(n)){e.next=16;break}return e.next=7,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 7:if(r=e.sent,!(i=r.node)){e.next=13;break}o=i.action,e.next=14;break;case 13:return e.abrupt("return",0);case 14:e.next=17;break;case 16:o=n;case 17: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 ba(this,void 0,void 0,ca().mark((function n(){var r,o,i;return ca().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!x.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.getChild()}),t.stage.next()})),n):da(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n=this,r=aa(this.contentNode.getContent(),1)[0];if(this.type===a.do){var o=new x((function(t){return t}));return this.execute(t,o,r)}if(this.type===a.doAsync)return ba(n,void 0,void 0,ca().mark((function e(){return ca().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,r[0]);case 3:case"end":return e.stop()}}),e,this)}))),da(e,"executeAction",this,3)([t]);if(this.type===a.any){var i=new x((function(t){return t})),s=r.map((function(e){return n.executeSingleAction(t,e)}));return Promise.any(s).then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if(this.type===a.all){var u=new x((function(t){return t}));return ba(n,void 0,void 0,ca().mark((function e(){var n=this;return ca().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(r.map((function(e){return n.executeSingleAction(t,e)})));case 2:u.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 4:case"end":return e.stop()}}),e,this)}))),u}if(this.type===a.allAsync)return ba(n,void 0,void 0,ca().mark((function e(){var n,o,i;return ca().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=ia(r);try{for(n.s();!(o=n.n()).done;)i=o.value,this.executeSingleAction(t,i).then((function(t){}))}catch(t){n.e(t)}finally{n.f()}case 2:case"end":return e.stop()}}),e,this)}))),da(e,"executeAction",this,3)([t]);if(this.type===a.repeat){var c=aa(this.contentNode.getContent(),2),l=c[0],f=c[1],p=new x((function(t){return t}));return ba(n,void 0,void 0,ca().mark((function e(){var n;return ca().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<f)){e.next=8;break}if(!(l.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,l[0]);case 5:n++,e.next=1;break;case 8:p.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 10:case"end":return e.stop()}}),e,this)}))),p}if(this.type===a.sleep){var h=new x((function(t){return t})),d=aa(this.contentNode.getContent(),2)[1];return new Promise((function(t){"number"==typeof d?setTimeout((function(){t()}),d):x.isAwaitable(d)?d.then(t):null==d||d.then(t)})).then((function(){h.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),h}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(t){var n=this.contentNode.getContent()[0],r=da(e,"getFutureActions",this,3)([t]);return[].concat(oa(n),oa(r))}}])}(Q);function Sa(t){return Sa="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},Sa(t)}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)||function(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}}(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 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,n){return e=Oa(e),function(t,e){if(e&&("object"==Sa(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,Aa()?Reflect.construct(e,n||[],Oa(t).constructor):e.apply(t,n))}function Aa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Aa=function(){return!!t})()}function Oa(t){return Oa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oa(t)}function Ea(t,e){return Ea=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ea(t,e)}function Ta(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ja(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,Ca(r.key),r)}}function Pa(t,e,n){return e&&ja(t.prototype,e),n&&ja(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ca(t){var e=function(t,e){if("object"!=Sa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Sa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sa(e)?e:e+""}wa.ActionTypes=a;var Ia=Symbol("_Chained"),La=function(){function t(e){Ta(this,t),this[ga]=!0,this.__actions=[],this.__self=e}return Pa(t,[{key:"push",value:function(){var t;(t=this.__actions).push.apply(t,arguments)}},{key:"getActions",value:function(){return this.__actions}},{key:"getSelf",value:function(){return this.__self}},{key:"newChain",value:function(){return this.getSelf().chain()}}],[{key:"isChained",value:function(t){return t&&t[Ia]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();ga=Ia;var Na=function(t){function e(){return Ta(this,e),xa(this,e,arguments)}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&&Ea(t,e)}(e,t),Pa(e,[{key:"chain",value:function(t){var e=La.isChained(this)?this:this.proxy(this,new La(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,_a(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}},{key:"combineActions",value:function(t,e){var n=e(this.chain().newChain()),r=new wa(t.chain(),wa.ActionTypes.do,(new Rt).setContent([this.construct(La.toActions([n]))]));return this.chain(r)}}])}(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 Ma(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 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+""}function Da(t,e,n){return e=Va(e),function(t,e){if(e&&("object"==Ra(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||[],Va(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 Va(t){return Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Va(t)}function Ga(t,e){return Ga=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ga(t,e)}var Ua=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Da(this,e)}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&&Ga(t,e)}(e,t),function(t,e,n){return e&&Ma(t.prototype,e),n&&Ma(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromChained",value:function(t){return t.getActions()}}])}(Na);function Wa(t){return Wa="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},Wa(t)}function za(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 Ha(t){var e=function(t,e){if("object"!=Wa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wa(e)?e:e+""}function $a(t,e,n){return e=Ya(e),function(t,e){if(e&&("object"==Wa(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,qa()?Reflect.construct(e,n||[],Ya(t).constructor):e.apply(t,n))}function qa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(qa=function(){return!!t})()}function Ya(t){return Ya=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ya(t)}function Xa(t,e){return Xa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xa(t,e)}var Ka=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),$a(this,e)}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&&Xa(t,e)}(e,t),function(t,e,n){return e&&za(t.prototype,e),n&&za(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(wa.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(wa.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(wa.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(wa.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(wa.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(wa.ActionTypes.repeat,e,t)}},{key:"sleep",value:function(t){return this.push(wa.ActionTypes.sleep,[],t)}},{key:"push",value:function(t,e){for(var n=La.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 wa(this.chain(),t,(new Rt).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)}},{key:"sleep",value:function(t){return(new e).sleep(t)}}])}(Ua);function Za(t){return Za="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},Za(t)}function Qa(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,Ja(r.key),r)}}function Ja(t){var e=function(t,e){if("object"!=Za(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Za(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Za(e)?e:e+""}function ts(t,e,n){return e=os(e),function(t,e){if(e&&("object"==Za(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,es()?Reflect.construct(e,n||[],os(t).constructor):e.apply(t,n))}function es(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(es=function(){return!!t})()}function ns(t,e,n,r){var o=rs(os(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function rs(){return rs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=os(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}},rs.apply(null,arguments)}function os(t){return os=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},os(t)}function is(t,e){return is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},is(t,e)}var as=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ts(this,e,arguments)}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&&is(t,e)}(e,t),function(t,e,n){return e&&Qa(t.prototype,e),n&&Qa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=t.getLastSceneIfNot();if(this.type===u.layerMoveUp)return t.moveUpElement(n,this.callee),t.stage.update(),ns(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveDown)return t.moveDownElement(n,this.callee),t.stage.update(),ns(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveTop)return t.moveTopElement(n,this.callee),t.stage.update(),ns(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveBottom)return t.moveBottomElement(n,this.callee),t.stage.update(),ns(e,"executeAction",this,3)([t]);throw this.unknownTypeError()}}])}(Q);function ss(t){return ss="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},ss(t)}function us(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 cs(t){var e=function(t,e){if("object"!=ss(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ss(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ss(e)?e:e+""}function ls(t,e,n){return e=ps(e),function(t,e){if(e&&("object"==ss(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,fs()?Reflect.construct(e,n||[],ps(t).constructor):e.apply(t,n))}function fs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(fs=function(){return!!t})()}function ps(t){return ps=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ps(t)}function hs(t,e){return hs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},hs(t,e)}as.ActionTypes=u;var ds=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ls(this,e,arguments)}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&&hs(t,e)}(e,t),function(t,e,n){return e&&us(t.prototype,e),n&&us(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"layerMoveUp",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveUp))}},{key:"layerMoveDown",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveDown))}},{key:"layerMoveTop",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveTop))}},{key:"layerMoveBottom",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveBottom))}},{key:"constructLayerAction",value:function(t,e){return new as(t,e,new Rt)}}])}(Ua);function ys(t){return ys="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},ys(t)}function vs(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=gs(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 ms(t){return function(t){if(Array.isArray(t))return bs(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||gs(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 gs(t,e){if(t){if("string"==typeof t)return bs(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)?bs(t,e):void 0}}function bs(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 ws(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ss(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,ks(r.key),r)}}function _s(t,e,n){return e&&Ss(t.prototype,e),n&&Ss(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ks(t){var e=function(t,e){if("object"!=ys(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ys(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ys(e)?e:e+""}function xs(t,e,n){return e=Os(e),function(t,e){if(e&&("object"==ys(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||[],Os(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 Os(t){return Os=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Os(t)}function Es(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 Ts(t,e){return Ts=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ts(t,e)}ds.EventTypes={"event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"};var js=function(t){function e(){var t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;return ws(this,e),(t=xs(this,e)).events=new E,t.ref=void 0,t.name=r.name||"(anonymous)",t.config=k(e.defaultConfig,r,{tag:o||r.tag,position:r.position?$t.tryParsePosition(r.position):new qt(Nt.Center),currentTags:(null===(n=r.tag)||void 0===n?void 0:n.defaults)?ms(r.tag.defaults):null}),t.state=k({},t.config),t.checkConfig(t.config),t}return Es(e,t),_s(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this.chain(this._init())}},{key:"checkConfig",value:function(t){var e;if(!Qi.isPosition(t.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");if(_(t.src)===_.DataTypes.string&&t.tag)throw this._mixedSrcError();if(!t.src&&!t.tag)throw this._srcNotSpecifiedError();var n,r=vs(t.wearables);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(!o.config.isWearable)throw this._invalidWearableError(JSON.stringify(o.config))}}catch(t){r.e(t)}finally{r.f()}if(t.tag){var i,a=new Set,s=vs(t.tag.groups);try{for(s.s();!(i=s.n()).done;){var u,c=vs(i.value);try{for(c.s();!(u=c.n()).done;){var l=u.value;if(a.has(l))throw this._invalidTagGroupDefinitionError();a.add(l)}}catch(t){c.e(t)}finally{c.f()}}}catch(t){s.e(t)}finally{s.f()}}if(t.tag){var f,p=this.constructTagMap(t.tag.groups),h=new Set,d=vs(t.tag.defaults);try{for(d.s();!(f=d.n()).done;){var y=f.value;if(h.has(y))throw new Error('Tag conflict\nTag "'.concat(y,'" is conflicting with another tag\nError found in config.tag.defaults'));if(!p.has(y))throw new Error('Tag not found\nTag "'.concat(y,'" is not defined in tagDefinitions\nError found in config.tag.defaults'));null===(e=p.get(y))||void 0===e||e.forEach((function(t){return h.add(t)}))}}catch(t){d.e(t)}finally{d.f()}}return this}},{key:"setSrc",value:function(t,e){var n=this;return this.combineActions(new Ka,(function(r){return n._setSrc(r,t,e)}))}},{key:"setAppearance",value:function(t,e){var n=this;return this.combineActions(new Ka,(function(r){var o=new zs(r,zs.ActionTypes.setAppearance,(new Rt).setContent([t,null==e?void 0:e.copy()]));return r.chain(o).chain(n._flush())}))}},{key:"applyTransform",value:function(t){var e=this;return this.combineActions(new Ka,(function(n){var r=new zs(n,zs.ActionTypes.applyTransform,(new Rt).setContent([void 0,t.copy(),T()]));return n.chain(r).chain(e._flush())}))}},{key:"show",value:function(t){var e=this,n=t instanceof Qi?t.copy():new Qi([{props:{opacity:1},options:t||{}}]);return this.combineActions(new Ka,(function(t){var r=new zs(t,zs.ActionTypes.show,(new Rt).setContent([void 0,n]));return t.chain(r).chain(e._flush())}))}},{key:"hide",value:function(t){var e=this;return this.combineActions(new Ka,(function(n){var r=new zs(n,zs.ActionTypes.hide,(new Rt).setContent([void 0,t instanceof Qi?t.copy():new Qi([{props:{opacity:0},options:t||{}}])]));return n.chain(r).chain(e._flush())}))}},{key:"addWearable",value:function(t){var e,n=vs(Array.isArray(t)?t:[t]);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.config.wearables.push(r),r.config.isWearable=!0}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"bindWearable",value:function(t){return t.addWearable([this]),this}},{key:"toTransform",value:function(){return new Qi(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.config)}},{key:"toData",value:function(){return this.state.disposed||P(this.state,this.config)?null:{state:k({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=k(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_applyTransition",value:function(t){return this.chain(new zs(this.chain(),"image:applyTransition",(new Rt).setContent([t])))}},{key:"_init",value:function(t){return new zs(this.chain(),zs.ActionTypes.init,(new Rt).setContent([t]))}},{key:"_initWearable",value:function(t){return new zs(this.chain(),zs.ActionTypes.initWearable,(new Rt).setContent([t]))}},{key:"_flush",value:function(){return new zs(this.chain(),zs.ActionTypes.flush,new Rt)}},{key:"reset",value:function(){this.state=k({},this.config)}},{key:"toDisplayableTransform",value:function(){return new Qi(this.state,{duration:0})}},{key:"getTransformState",value:function(){return{position:this.state.position,scale:this.state.scale,rotation:this.state.rotation,opacity:this.state.opacity,display:this.state.display}}},{key:"resolveTags",value:function(t,e){if(!this.state.tag)throw new Error("Tag not defined\nTag must be defined in the image config");var n=this.constructTagMap(this.state.tag.groups),r=new Set,o=function(t){var e,o=vs(t);try{for(o.s();!(e=o.n()).done;){var i=e.value,a=n.get(i);if(a){var s,u=vs(a);try{for(u.s();!(s=u.n()).done;){var c=s.value;r.delete(c)}}catch(t){u.e(t)}finally{u.f()}r.add(i)}}}catch(t){o.e(t)}finally{o.f()}};return o(t),o(e),Array.from(r)}},{key:"_mixedSrcError",value:function(){throw new TypeError("To better understand the behavior of the image, you cannot mix src and tags in the same image. If you are using tags, remove the src from the image config and do not use setSrc method. If you are using src, remove the tags from the image config and do not use setAppearance method.")}},{key:"_invalidSrcHandlerError",value:function(){throw new Error("Invalid src handler, If you are using tags, config.src must be a function that resolves the src from the tags. If you are using src, config.src must be a string or StaticImageData")}},{key:"_srcNotSpecifiedError",value:function(){throw new TypeError("Src not specified\nPlease provide a src or tags in the image config")}},{key:"_invalidWearableError",value:function(t){throw new Error("Invalid wearable\nWearable must be an Image with isWearable set to true\nIt seems like you are trying to add a non-wearable image to wearables\nImage below violates the rule:\n"+t)}},{key:"_invalidTagGroupDefinitionError",value:function(){throw new Error("Invalid tag group definition. Tags in groups must be unique and not conflicting with each other.")}},{key:"constructTagMap",value:function(t){var e,n=new Map,r=vs(t);try{for(r.s();!(e=r.n()).done;){var o,i=e.value,a=vs(i);try{for(a.s();!(o=a.n()).done;){var s=o.value;n.set(s,i)}}catch(t){a.e(t)}finally{a.f()}}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"_setSrc",value:function(t,e,n){if(n){var r=n.copy();r.setSrc(iu.srcToString(e)),t._transitionSrc(r)}var o=new zs(t,zs.ActionTypes.setSrc,(new Rt).setContent(["string"==typeof e?e:iu.staticImageDataToSrc(e)]));return t.chain(o).chain(this._flush())}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new zs(this.chain(),zs.ActionTypes.dispose,new Rt))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return $t.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 $t.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}},{key:"getSrc",value:function(t){if("string"==typeof t.src||iu.isStaticImageData(t.src)){var n=t.src;return iu.isStaticImageData(n)?iu.staticImageDataToSrc(n):n}var r=t.src,o=t.currentTags;if(!o)throw new Error("Tags not resolved\nTags must be resolved before getting the src");return e.getSrcFromTags(o,r)}},{key:"getSrcFromTags",value:function(t,e){return e.apply(void 0,ms(t))}},{key:"fromSrc",value:function(t){return new e({src:t})}}])}(ds);js.EventTypes=Object.assign(Object.assign({},ds.EventTypes),{"event:wearable.create":"event:wearable.create"}),js.DefaultImagePlaceholder="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",js.defaultConfig={display:!1,position:new qt(Nt.Center),scale:1,rotation:0,opacity:0,isWearable:!1,wearables:[],src:js.DefaultImagePlaceholder,currentTags:null,autoInit:!0};var Ps=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ws(this,e),(t=xs(this,e)).name=n.name||"(anonymous [virtual image proxy])",t.config.opacity=1,t.state.opacity=1,t}return Es(e,t),_s(e,[{key:"checkConfig",value:function(t){return this}}])}(js);function Cs(t){return Cs="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},Cs(t)}function Is(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 Ls(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)?Ls(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 Ls(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 Ns(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Ns=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==Cs(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Cs(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 Rs(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,Ms(r.key),r)}}function Ms(t){var e=function(t,e){if("object"!=Cs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Cs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Cs(e)?e:e+""}function Fs(t,e,n){return e=Gs(e),function(t,e){if(e&&("object"==Cs(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,Ds()?Reflect.construct(e,n||[],Gs(t).constructor):e.apply(t,n))}function Ds(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ds=function(){return!!t})()}function Bs(t,e,n,r){var o=Vs(Gs(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Vs(){return Vs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Gs(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}},Vs.apply(null,arguments)}function Gs(t){return Gs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gs(t)}function Us(t,e){return Us=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Us(t,e)}var Ws=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())}))},zs=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Fs(this,e,arguments)}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),function(t,e,n){return e&&Rs(t.prototype,e),n&&Rs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var r=this,o=Object.create(null,{executeAction:{get:function(){return Bs(e,"executeAction",r,1)}},unknownTypeError:{get:function(){return Bs(e,"unknownTypeError",r,1)}}});if(this.type===n.init){if(this.callee.config.isWearable)throw new Error("Cannot init wearable image with init action\nIt seems like you are trying to init a wearable image with an init action, or use this wearable image without parent.");var i=t.findElementByDisplayable(this.callee);i&&t.disposeImage(this.callee,i.scene);var a=this.contentNode.getContent()[0];return t.createImage(this.callee,a),this.resolveAwaitable((function(e){return Ws(r,void 0,void 0,Ns().mark((function n(){return Ns().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:displayable.init");case 2:e(o.executeAction.call(this,t)),t.stage.next();case 4:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.initWearable){var s=Is(this.contentNode.getContent(),1)[0];return this.resolveAwaitable((function(e){return Ws(r,void 0,void 0,Ns().mark((function n(){return Ns().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:wearable.create",s);case 2:return n.next=4,s.events.any("event:displayable.init");case 4:e(o.executeAction.call(this,t)),t.stage.next();case 6:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.setSrc){if(this.callee.state.tag)throw this.callee._mixedSrcError();return this.callee.state.src=this.contentNode.getContent()[0],t.logger.debug("Image - Set Src",this.callee.state.src),t.stage.update(),o.executeAction.call(this,t)}if([n.show,n.hide,n.applyTransform].includes(this.type)){var u=new x((function(t){return t})).registerSkipController(new C((function(){return r.type===n.hide&&(r.callee.state.display=!1),o.executeAction.call(r,t)}))),c=this.contentNode.getContent()[1];return this.type===n.show&&(this.callee.state.display=!0,t.stage.update()),t.animateImage(js.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){var t;r.type===n.hide&&(r.callee.state.display=!1),u.resolve({type:r.type,node:null===(t=r.contentNode)||void 0===t?void 0:t.getChild()})})),u}if(this.type===n.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),o.executeAction.call(this,t);if(this.type===n.applyTransition){var l=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}}))),f=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",f).then((function(){l.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),l}if(this.type===n.flush)return o.executeAction.call(this,t);if(this.type===n.setAppearance){var p=Is(this.contentNode.getContent(),2),h=p[0],d=p[1];if(!this.callee.state.tag||!this.callee.state.currentTags)throw this.callee._srcNotSpecifiedError();var y=this.callee.resolveTags(this.callee.state.currentTags,h),v=js.getSrcFromTags(y,this.callee.state.src);if(t.logger.debug("Image - Set Appearance",y,v),d){var m=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}})));d.setSrc(v),this.callee.events.any("event:displayable.applyTransition",d).then((function(){r.callee.state.currentTags=y,m.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()}))}return this.callee.state.currentTags=y,o.executeAction.call(this,t)}throw o.unknownTypeError.call(this)}}])}(Q);function Hs(t){return function(t){if(Array.isArray(t))return $s(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 $s(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)?$s(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 $s(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 qs(t,e,n){return e=Qs(e),function(t,e){if(e&&("object"==Js(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,Ks()?Reflect.construct(e,n||[],Qs(t).constructor):e.apply(t,n))}function Ys(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&&Zs(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(Ks())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&Zs(o,n.prototype),o}(t,arguments,Qs(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Zs(n,t)},Xs(t)}function Ks(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ks=function(){return!!t})()}function Zs(t,e){return Zs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zs(t,e)}function Qs(t){return Qs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qs(t)}function Js(t){return Js="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},Js(t)}function tu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function eu(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,ru(r.key),r)}}function nu(t,e,n){return e&&eu(t.prototype,e),n&&eu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ru(t){var e=function(t,e){if("object"!=Js(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Js(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Js(e)?e:e+""}zs.ActionTypes=n;var ou=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;tu(this,t),this.r=e,this.g=n,this.b=r,this.a=o}return nu(t,[{key:"toString",value:function(){return"rgba(".concat(this.r,", ").concat(this.g,", ").concat(this.b,", ").concat(this.a,")")}},{key:"toHex",value:function(){return"#"+this.r.toString(16)+this.g.toString(16)+this.b.toString(16)}},{key:"toImageColor",value:function(){return{r:this.r,g:this.g,b:this.b,a:this.a}}}],[{key:"isHexString",value:function(t){return"string"==typeof t&&/^#[0-9A-F]{6}$/i.test(t)}},{key:"fromHex",value:function(e){var n=e.slice(1);return new t(parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1)}}])}(),iu=function(){function t(){tu(this,t)}return nu(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)&&"string"==typeof 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://")}},{key:"isImageSrc",value:function(e){return"string"==typeof e&&!this.isHexString(e)||t.isStaticImageData(e)}},{key:"isImageColor",value:function(e){return t.isHexString(e)||t.isPlainColor(e)}},{key:"isPlainColor",value:function(t){return t&&("string"==typeof t||"object"===Js(t)&&"r"in t&&"g"in t&&"b"in t)}},{key:"isHexString",value:function(t){return"string"==typeof t&&/^#([0-9A-F]{6}|[0-9A-F]{3})$/i.test(t)}},{key:"toBackgroundSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"toHex",value:function(t){return O(t)}}])}();iu.RGBColor=ou;var au,su=function(t){function e(t,n){return tu(this,e),qs(this,e,[t,{info:n},"StaticScriptWarning"])}return Ys(e,t),nu(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 tu(this,e),(r=qs(this,e,[t])).props=n,r.name=o,r}return Ys(e,t),nu(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(Xs(Error))),uu=function(){return nu((function t(e){tu(this,t),this.scene=e}),[{key:"run",value:function(t){var e=new Map,n=new Map,r=[],o=new Set,i=this.scene.getAllChildren(t,this.scene.getSceneRoot());if(!i.length)return null;for(r.push(i[0]);r.length;){var a=r.shift();this.checkAction(t,a,{imageStates:e,scenes:n},o);var s=a.contentNode.getChild();s&&s.action&&r.push(s.action)}return e}},{key:"checkAction",value:function(t,n,r,o){var i=r.imageStates,a=r.scenes;if(n instanceof zs)i.has(n.callee)||i.set(n.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(i.get(n.callee),n);else if(n instanceof kt){var s=n.callee;if(a.has(s.name)){if(a.get(s.name)!==s){var u="Scene with name: ".concat(s.name," is duplicated\nScene: ").concat(s.name,"\n\nAt: ").concat(n.__stack);throw new su(u)}}else a.set(s.name,s);if(n.type===e.jumpTo){var c=n.contentNode.getContent()[0],l=t.getScene(c,!0);if(o.has(l))return;o.add(l)}}}},{key:"checkImage",value:function(t,e){if(e.type===n.dispose){if(t.isDisposed){var r="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 su(r)}t.isDisposed=!0}else if([n.init,n.show,n.hide,n.applyTransform,n.applyTransition].includes(e.type)){if(t.isDisposed){var o="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new su(o)}}else if(e.type===n.setSrc){var i=e.contentNode.getContent()[0];iu.isExternalSrc(i)&&(t.usedExternalSrc=!0)}}}])}(),cu=function(t){function e(t,n){var r;return tu(this,e),(r=qs(this,e,[e.toMessage(t,n)])).name="RuntimeScriptError",r}return Ys(e,t),nu(e,null,[{key:"toMessage",value:function(t,n){var r=[];return r.push.apply(r,Hs(Array.isArray(t)?t:[t])),n&&r.push.apply(r,Hs(Array.isArray(n)?n.map(e.getActionTrace):[e.getActionTrace(n)])),r.join("")}},{key:"getActionTrace",value:function(t){return"\nUsing action (id: ".concat(t.getId(),")")+"\n at: ".concat(t.__stack)}}])}(Xs(Error)),lu=function(t){function e(t){var n;return tu(this,e),(n=qs(this,e,[t])).name="RuntimeGameError",n}return Ys(e,t),nu(e)}(Xs(Error));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 pu(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,hu(r.key),r)}}function hu(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 du(t,e,n){return e=vu(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,yu()?Reflect.construct(e,n||[],vu(t).constructor):e.apply(t,n))}function yu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yu=function(){return!!t})()}function vu(t){return vu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vu(t)}function mu(t,e){return mu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mu(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(au||(au={}));var gu=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=du(this,e)).state={playing:null,token:null},t.config=k(e.defaultConfig,"string"==typeof n?{src:n}: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&&mu(t,e)}(e,t),function(t,e,n){return e&&pu(t.prototype,e),n&&pu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===au.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(lt.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===au.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(lt.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===au.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(lt.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(lt.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(lt.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(lt.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(lt.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(t){return Object.assign({src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1},t||{})}},{key:"getSrc",value:function(){return this.config.src}},{key:"getToken",value:function(){return this.state.token||void 0}},{key:"getPlaying",value:function(){return this.state.playing}},{key:"setToken",value:function(t){this.state.token=void 0===t?null:t}},{key:"setPlaying",value:function(t){return this.state.playing=t,this}},{key:"toData",value:function(){return P(this.config,e.defaultConfig)?null:{config:A(this.config)}}},{key:"fromData",value:function(t){return this.config=k(this.config,t.config),this}},{key:"reset",value:function(){var t;null===(t=this.state.playing)||void 0===t||t.stop(),this.state.playing=null,this.state.token=null}},{key:"pushAction",value:function(t,e){return this.chain(new lt(this.chain(),t,(new Rt).setContent(e)))}}],[{key:"toSoundSrc",value:function(t){return null==t?null:"string"==typeof t?t:t.getSrc()}},{key:"toSound",value:function(t){return null==t?null:"string"==typeof t?new e({src:t}):t}}])}(Ua);function bu(t){return bu="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},bu(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,Su(r.key),r)}}function Su(t){var e=function(t,e){if("object"!=bu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=bu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==bu(e)?e:e+""}gu.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var _u=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e}return function(t,e,n){return e&&wu(t.prototype,e),n&&wu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"from",value:function(e){return t.isPauseConstructor(e)?new t:e}},{key:"wait",value:function(e){return new t({duration:e})}},{key:"isPause",value:function(e){return this.isPauseConstructor(e)||e instanceof t}},{key:"isPauseConstructor",value:function(e){return e===t}}])}();function ku(t){return ku="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},ku(t)}function xu(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,Au(r.key),r)}}function Au(t){var e=function(t,e){if("object"!=ku(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ku(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ku(e)?e:e+""}var Ou=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=e,this.config=k(t.defaultConfig,n)}return function(t,e,n){return e&&xu(t.prototype,e),n&&xu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"evaluate",value:function(e){var n=this;if(_u.isPause(this.text))return[this];if("function"==typeof this.text){var r=this.text(e);return Array.isArray(r)?r.map((function(r){return t.isWord(r)?r.inherit(n.config).evaluate(e):new t(r,n.config)})).flat():t.isWord(r)?r.inherit(this.config).evaluate(e):[new t(r,this.config)]}return[this]}},{key:"inherit",value:function(t){return this.config.color=this.config.color||t.color,this.config.italic=this.config.italic||t.italic,this.config.bold=this.config.bold||t.bold,this}},{key:"copy",value:function(){return new t(this.text,this.config)}}],[{key:"isWord",value:function(e){return e instanceof t}},{key:"color",value:function(e,n){return t.isWord(e)?e.copy().inherit({color:n}):new t(e,{color:n})}},{key:"bold",value:function(e){return t.isWord(e)?e.copy().inherit({bold:!0}):new t(e,{bold:!0})}},{key:"italic",value:function(e){return t.isWord(e)?e.copy().inherit({italic:!0}):new t(e,{italic:!0})}}])}();function Eu(t){return Eu="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},Eu(t)}function Tu(t){return function(t){if(Array.isArray(t))return ju(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 ju(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)?ju(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 ju(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 Pu(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,Cu(r.key),r)}}function Cu(t){var e=function(t,e){if("object"!=Eu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Eu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Eu(e)?e:e+""}Ou.defaultConfig={},Ou.defaultColor="#000";var Iu=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=t.format(e),this.config=k(t.defaultConfig,Object.assign(Object.assign({},n),{voice:gu.toSound(n.voice)})),this.state=A(t.defaultState)}return function(t,e,n){return e&&Pu(t.prototype,e),n&&Pu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"toData",value:function(){return P(this.state,t.defaultState)?null:{state:A(this.state)}}},{key:"fromData",value:function(t){return this.state=k(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}},{key:"setCharacter",value:function(t){return this.config.character=t,this}},{key:"evaluate",value:function(e){for(var n=[],r=0;r<this.text.length;r++){var o=this.text[r].evaluate(e);n.push.apply(n,Tu(t.formatStaticWord(o)))}return n}},{key:"copy",value:function(){return new t(Tu(this.text),this.config)}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(e)}},{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)e.push(this.formatWord(t[n]));else e.push(this.formatWord(t));return e}},{key:"formatWord",value:function(t){return Ou.isWord(t)?t:new Ou(t)}},{key:"formatStaticWord",value:function(t,e){var n=this;return Array.isArray(t)?t.map((function(t){return n.formatStaticWord(t,e)})).flat(2):[Ou.isWord(t)?t:new Ou(t,e)]}},{key:"isSentencePrompt",value:function(e){return Array.isArray(e)?e.every(t.isSingleWord):t.isSingleWord(e)}},{key:"isSingleWord",value:function(t){return"string"==typeof t||Ou.isWord(t)||_u.isPause(t)||"function"==typeof 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,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,Ru(r.key),r)}}function Ru(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 Mu(t,e,n){return e=Vu(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,Fu()?Reflect.construct(e,n||[],Vu(t).constructor):e.apply(t,n))}function Fu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Fu=function(){return!!t})()}function Du(t,e,n,r){var o=Bu(Vu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Bu(){return Bu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Vu(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}},Bu.apply(null,arguments)}function Vu(t){return Vu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vu(t)}function Gu(t,e){return Gu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gu(t,e)}Iu.defaultConfig={color:"#000",pause:!0,voice:null,character:null,voiceId:null},Iu.defaultState={display:!0};var Uu=function(e){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),Mu(this,n,arguments)}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&&Gu(t,e)}(n,e),function(t,e,n){return e&&Nu(t.prototype,e),n&&Nu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"executeAction",value:function(e){var r=this;if(this.type===t.say){var o=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}}))),i=this.contentNode.getContent(),a=n.getVoice(e,i);return a&&(lt.initSound(e,a),e.playSound(a,(function(){e.stopSound(a)}))),e.createText(this.getId(),i,(function(){a&&e.stopSound(a),o.resolve({type:r.type,node:r.contentNode.getChild()})})),o}if(this.type===t.setName)return this.callee.state.name=this.contentNode.getContent()[0],Du(n,"executeAction",this,3)([e]);throw Du(n,"unknownTypeError",this,3)([])}}],[{key:"getVoice",value:function(t,e){var n=t.getLastScene();if(!n)throw new Error("No scene found when trying to play voice");var r=e.config,o=r.voiceId,i=r.voice;return o||i?gu.toSound(n.getVoice(o)||i):null}}])}(Q);function Wu(t){return Wu="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},Wu(t)}function zu(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,Hu(r.key),r)}}function Hu(t){var e=function(t,e){if("object"!=Wu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wu(e)?e:e+""}function $u(t,e,n){return e=Yu(e),function(t,e){if(e&&("object"==Wu(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,qu()?Reflect.construct(e,n||[],Yu(t).constructor):e.apply(t,n))}function qu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(qu=function(){return!!t})()}function Yu(t){return Yu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yu(t)}function Xu(t,e){return Xu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xu(t,e)}Uu.ActionTypes=t;var Ku=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=$u(this,e)).config=k(e.defaultConfig,r),n.state={name: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&&Xu(t,e)}(e,t),function(t,e,n){return e&&zu(t.prototype,e),n&&zu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"say",value:function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(Array.isArray(t)&&t.every((function(t){return"string"==typeof t}))&&[e].concat(r).length>0&&[e].concat(r).every((function(t){return Iu.isSingleWord(t)}))){var i=t,a=Iu.format([e].concat(r)),s=new Iu(function(t,e){for(var n=[],r=0;r<Math.max(t.length,e.length);r++)r<t.length&&n.push(t[r]),r<e.length&&n.push(e[r]);return n}(i,a),{character:this}),u=new Uu(this.chain(),Uu.ActionTypes.say,(new Rt).setContent(s));return this.chain(u)}var c=e||{},l=t,f=Array.isArray(l)?new Iu(l,Object.assign(Object.assign({},c),{character:this})):(Iu.isSentence(l)?l:new Iu(l,Object.assign(Object.assign({},c),{character:this}))).copy();f.setCharacter(this);var p=new Uu(this.chain(),Uu.ActionTypes.say,(new Rt).setContent(f));return this.chain(p)}},{key:"setName",value:function(t){var e=new Uu(this.chain(),Uu.ActionTypes.setName,(new Rt).setContent([t]));return this.chain(e)}}])}(Ua);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 Qu(t){return function(t){if(Array.isArray(t))return Ju(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 Ju(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)?Ju(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 Ju(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 tc(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,ec(r.key),r)}}function ec(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 nc(t,e,n){return e=ic(e),function(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)}(t,rc()?Reflect.construct(e,n||[],ic(t).constructor):e.apply(t,n))}function rc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(rc=function(){return!!t})()}function oc(){return oc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ic(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}},oc.apply(null,arguments)}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)}Ku.defaultConfig={color:"#000"};var sc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),nc(this,e,arguments)}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&&tc(t.prototype,e),n&&tc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(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.getChild()}}},{key:"getFutureActions",value:function(t){return[].concat(Qu(this.callee._getFutureActions()),Qu(function(t,e,n,r){var o=oc(ic(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([t])))}}])}(Q);function uc(t){return uc="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},uc(t)}function cc(t){return function(t){if(Array.isArray(t))return fc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||lc(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 lc(t,e){if(t){if("string"==typeof t)return fc(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)?fc(t,e):void 0}}function fc(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 pc(t,e,n){return e=dc(e),function(t,e){if(e&&("object"==uc(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,hc()?Reflect.construct(e,n||[],dc(t).constructor):e.apply(t,n))}function hc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(hc=function(){return!!t})()}function dc(t){return dc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dc(t)}function yc(t,e){return yc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yc(t,e)}function vc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mc(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,bc(r.key),r)}}function gc(t,e,n){return e&&mc(t.prototype,e),n&&mc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function bc(t){var e=function(t,e){if("object"!=uc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=uc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==uc(e)?e:e+""}sc.ActionTypes={action:"condition:action"};var wc=function(){function t(e){vc(this,t),this.handler=e}return gc(t,[{key:"evaluate",value:function(t){var e=t.gameState;return{value:this.handler(this.getCtx({gameState:e}))}}},{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}],[{key:"isLambda",value:function(e){return e instanceof t&&"handler"in e}},{key:"from",value:function(e){return t.isLambda(e)?e:new t(e)}}])}(),Sc=function(t){function e(){var t;return vc(this,e),(t=pc(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},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&&yc(t,e)}(e,t),gc(e,[{key:"ElseIf",value:function(t,e){if(this.conditions.Else.action)throw new su("ELSE condition already set\nYou are trying to set an ELSE-IF condition after an ELSE condition");return this.conditions.ElseIf.push({condition:wc.isLambda(t)?t:new wc(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(this.conditions.Else.action)throw new su("ELSE condition already set\nYou are trying to set multiple ELSE conditions for the same condition");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=lc(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(sc,[this,sc.ActionTypes.action,(new Rt).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=La.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.setChild(s),i===o.length-1&&e&&a.setChild(e),0===i&&n&&n.setChild(a)}return o}},{key:"_getFutureActions",value:function(){var t,e;return La.toActions([(null===(t=this.conditions.If.action)||void 0===t?void 0:t[0])||[]].concat(cc(this.conditions.ElseIf.flatMap((function(t){var e;return(null===(e=t.action)||void 0===e?void 0:e[0])||[]}))),[(null===(e=this.conditions.Else.action)||void 0===e?void 0:e[0])||[]]))}},{key:"createIfCondition",value:function(t,e){return this.conditions.If.condition=t instanceof wc?t:new wc(t),this.conditions.If.action=this.construct(Array.isArray(e)?e:[e]),this.chain()}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}},{key:"If",value:function(t,n){return(new e).createIfCondition(t,n)}}])}(Ua);function _c(t){return _c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_c(t)}function kc(t){return function(t){if(Array.isArray(t))return xc(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 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)||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 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}function Ac(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,Oc(r.key),r)}}function Oc(t){var e=function(t,e){if("object"!=_c(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_c(e)?e:e+""}function Ec(t,e,n){return e=Pc(e),function(t,e){if(e&&("object"==_c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Tc()?Reflect.construct(e,n||[],Pc(t).constructor):e.apply(t,n))}function Tc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Tc=function(){return!!t})()}function jc(){return jc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Pc(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}},jc.apply(null,arguments)}function Pc(t){return Pc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pc(t)}function Cc(t,e){return Cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cc(t,e)}var Ic=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ec(this,e,arguments)}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&&Cc(t,e)}(e,t),function(t,e,n){return e&&Ac(t.prototype,e),n&&Ac(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var e=this,n=new x((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(t){var n=this.contentNode.getContent();return[].concat(kc(this.callee._getFutureActions(n.choices)),kc(function(t,e,n,r){var o=jc(Pc(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([t])))}}])}(Q);function Lc(t){return Lc="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},Lc(t)}function Nc(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,Rc(r.key),r)}}function Rc(t){var e=function(t,e){if("object"!=Lc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Lc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Lc(e)?e:e+""}function Mc(t,e,n){return e=Dc(e),function(t,e){if(e&&("object"==Lc(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,Fc()?Reflect.construct(e,n||[],Dc(t).constructor):e.apply(t,n))}function Fc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Fc=function(){return!!t})()}function Dc(t){return Dc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Dc(t)}function Bc(t,e){return Bc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bc(t,e)}Ic.ActionTypes={action:"menu:action"};var Vc=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=Mc(this,e)).choices=[],n.prompt=Iu.isSentence(t)?t:new Iu(t),n.config=k(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&&Bc(t,e)}(e,t),function(t,e,n){return e&&Nc(t.prototype,e),n&&Nc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Iu.isSentence(t)&&e||(Ou.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Iu.toSentence(t),action:La.toActions(e)}):"object"===Lc(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Iu.toSentence(t.prompt),action:La.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new Ic(this.chain(),Ic.ActionTypes.action,(new Rt).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action[0]||null})).filter((function(t){return null!==t}))}},{key:"constructNodes",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.setChild(a),o===this.choices.length-1&&e&&i.setChild(e),0===o&&n&&n.setChild(i)}return t}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.constructNodes(e.action),prompt:e.prompt}}))}}])}(Ua);function Gc(t){return Gc="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},Gc(t)}function Uc(t){return function(t){if(Array.isArray(t))return Wc(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 Wc(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)?Wc(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 Wc(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 zc(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,Hc(r.key),r)}}function Hc(t){var e=function(t,e){if("object"!=Gc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Gc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gc(e)?e:e+""}function $c(t,e,n){return e=Yc(e),function(t,e){if(e&&("object"==Gc(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,qc()?Reflect.construct(e,n||[],Yc(t).constructor):e.apply(t,n))}function qc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(qc=function(){return!!t})()}function Yc(t){return Yc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yc(t)}function Xc(t,e){return Xc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xc(t,e)}Vc.defaultConfig={},Vc.targetAction=Ic;var Kc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),$c(this,e)}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&&Xc(t,e)}(e,t),function(t,e,n){return e&&zc(t.prototype,e),n&&zc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"fromChained",value:function(t){return t.getActions()}},{key:"forEachChild",value:function(t,e,n){var r=new Set,o=[];for(Array.isArray(e)?o.push.apply(o,Uc(e)):o.push(e);o.length;){var i=o.shift();if(!r.has(i)){r.add(i),n(i);var a=i.getFutureActions(t).filter((function(t){return!r.has(t)}));o.push.apply(o,Uc(a))}}}},{key:"getAllChildren",value:function(t,e){var n=[];return this.forEachChild(t,e,(function(t){return n.push(t)})),n}},{key:"getAllChildrenMap",value:function(t,e){var n=new Map;return this.forEachChild(t,e,(function(t){return n.set(t.getId(),t)})),n}},{key:"getAllElementMap",value:function(t,e){var n=new Map;return this.forEachChild(t,e,(function(t){return n.set(t.callee.getId(),t.callee)})),n}},{key:"getAllChildrenElements",value:function(t,e){return Array.from(new Set(this.getAllChildren(t,e).map((function(t){return t.callee}))))}},{key:"toData",value:function(){return null}},{key:"constructNodes",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(Na);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 Qc(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,Jc(r.key),r)}}function Jc(t){var e=function(t,e){if("object"!=Zc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Zc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Zc(e)?e:e+""}var tl=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&&Qc(t.prototype,e),n&&Qc(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 gu){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof js||iu.isStaticImageData(t)){if(t instanceof js){if(this.isSrcRegistered(js.getSrc(t.state)))return this}else if(this.isSrcRegistered(iu.srcToString(t.src)))return this;this.src.push({type:"image",src:new js(t instanceof js?{src:js.getSrc(t.state)}:{src:iu.staticImageDataToSrc(t)})})}else if("object"===Zc(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 gu?e:new gu({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 gu?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===js.getSrc(e.src.state):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)}},{key:"getFutureSrc",value:function(){return this.future.map((function(t){return t.getSrc()})).flat(2)}}],[{key:"catSrc",value:function(e){var n=new Set,r=new Set,o=new Set;return e.forEach((function(e){var i=e.type,a=e.src;i===t.SrcTypes.image?n.add(a):i===t.SrcTypes.video?r.add(a):o.add(a)})),{image:Array.from(n),video:Array.from(r),audio:Array.from(o)}}},{key:"getSrc",value:function(t){return"string"==typeof t?t:t instanceof js?js.getSrc(t.state):"image"===t.type?js.getSrc(t.src.state):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}},{key:"getPreloadableSrc",value:function(t,r){var o;if(r.is(kt,e.setBackground)){var i=r.contentNode.getContent()[0],a=iu.backgroundToSrc(i);if(a)return{type:"image",src:new js({src:a}),activeType:"scene"}}else if(r.is(kt,e.jumpTo)){var s=r.contentNode.getContent()[0],u=t.getScene(s,!0).config.background;if(iu.isStaticImageData(u)||"string"==typeof u)return{type:"image",src:new js({src:u}),activeType:"once"}}else if(r instanceof zs){var c=r;if(c.callee.config.tag)return{type:"image",src:new js({src:js.getSrcFromTags(c.callee.config.tag.defaults,c.callee.config.src)}),activeType:"scene"};if(r.is(zs,n.setSrc)){var l=r.contentNode.getContent()[0];return{type:"image",src:new js({src:l}),activeType:"scene"}}if(r.type===n.initWearable)return{type:"image",src:r.contentNode.getContent()[0],activeType:"scene"};if(r.type===n.setAppearance){var f=r.contentNode.getContent()[0];if("function"!=typeof c.callee.config.src)throw c.callee._invalidSrcHandlerError();if(f.length===(null===(o=c.callee.state.tag)||void 0===o?void 0:o.groups.length))return{type:"image",src:js.fromSrc(js.getSrcFromTags(f,c.callee.config.src)),activeType:"scene"}}else if(r.type===n.init){var p=r.callee.config.src;if("string"==typeof p||iu.isStaticImageData(p))return{type:"image",src:new js({src:p}),activeType:"scene"}}}return null}}])}();function el(t){return el="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},el(t)}function nl(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,rl(r.key),r)}}function rl(t){var e=function(t,e){if("object"!=el(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=el(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==el(e)?e:e+""}function ol(t,e,n){return e=ul(e),function(t,e){if(e&&("object"==el(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,il()?Reflect.construct(e,n||[],ul(t).constructor):e.apply(t,n))}function il(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(il=function(){return!!t})()}function al(t,e,n,r){var o=sl(ul(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function sl(){return sl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ul(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}},sl.apply(null,arguments)}function ul(t){return ul=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ul(t)}function cl(t,e){return cl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cl(t,e)}tl.SrcTypes={image:"image",video:"video",audio:"audio"};var ll=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ol(this,e,arguments)}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&&cl(t,e)}(e,t),function(t,e,n){return e&&nl(t.prototype,e),n&&nl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===s.init){var r=t.findElementByDisplayable(this.callee);r&&t.disposeDisplayable(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createDisplayable(this.callee,o);var i=new x((function(t){return t}));return this.callee.events.any("event:displayable.init").then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if([s.show,s.hide,s.applyTransform].includes(this.type)){var a=new x((function(t){return t})).registerSkipController(new C((function(){return n.type===s.hide&&(n.callee.state.display=!1),al(e,"executeAction",n,3)([t])}))),u=this.contentNode.getContent()[0];return this.type===s.show&&(this.callee.state.display=!0,t.stage.update()),t.animateText(Vl.EventTypes["event:displayable.applyTransform"],this.callee,[u],(function(){n.type===s.hide&&(n.callee.state.display=!1),a.resolve(al(e,"executeAction",n,3)([t]))})),a}if(this.type===s.setText)return this.callee.state.text=this.contentNode.getContent()[0],al(e,"executeAction",this,3)([t]);if(this.type===s.setFontSize){this.callee.state.fontSize=this.contentNode.getContent()[0];var c=new Qi([],{duration:0}),l=new x;return t.animateText(Vl.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){l.resolve(al(e,"executeAction",n,3)([t]))})),l}if(this.type===s.applyTransition){var f=(new x).registerSkipController(new C((function(){return t.logger.info("NarraLeaf-React: Text Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}}))),p=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",p).then((function(){f.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),f}throw al(e,"unknownTypeError",this,3)([])}}])}(Q);ll.ActionTypes=s;var fl={start:"start",update:"update",end:"end"};function pl(t){return pl="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},pl(t)}function hl(t,e,n){return e=yl(e),function(t,e){if(e&&("object"==pl(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,dl()?Reflect.construct(e,n||[],yl(t).constructor):e.apply(t,n))}function dl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(dl=function(){return!!t})()}function yl(t){return yl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yl(t)}function vl(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&&ml(t,e)}function ml(t,e){return ml=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ml(t,e)}function gl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bl(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,Sl(r.key),r)}}function wl(t,e,n){return e&&bl(t.prototype,e),n&&bl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Sl(t){var e=function(t,e){if("object"!=pl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pl(e)?e:e+""}var _l=function(){return wl((function t(){gl(this,t),this.events=new E}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"copy",value:function(){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(fl.start,null),this.controller=Bi(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(fl.update,r.toElementProps())},onComplete:function(){r.controller=void 0,r.events.emit(fl.end,null),s&&s()}},n)),this.controller}}])}(),kl=function(t){function e(){return gl(this,e),hl(this,e,arguments)}return vl(e,t),wl(e,[{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(_l);kl.DefaultEasing="linear";var xl=function(t){function e(){return gl(this,e),hl(this,e,arguments)}return vl(e,t),wl(e,[{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(_l);function Al(t){return Al="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},Al(t)}function Ol(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,El(r.key),r)}}function El(t){var e=function(t,e){if("object"!=Al(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Al(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Al(e)?e:e+""}function Tl(t,e,n){return e=Pl(e),function(t,e){if(e&&("object"==Al(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,jl()?Reflect.construct(e,n||[],Pl(t).constructor):e.apply(t,n))}function jl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(jl=function(){return!!t})()}function Pl(t){return Pl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pl(t)}function Cl(t,e){return Cl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cl(t,e)}var Il=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=Tl(this,e)).state={fontSize:0},r.startValue=t,r.endValue=n,r.duration=o,r.easing=i,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&&Cl(t,e)}(e,t),function(t,e,n){return e&&Ol(t.prototype,e),n&&Ol(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"start",value:function(t){var e=this;this.state.fontSize=this.startValue,this.requestAnimation({start:this.startValue,end:this.endValue,duration:this.duration},{onComplete:function(){e.state.fontSize=e.endValue,t&&t()},onUpdate:function(t){e.state.fontSize=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{fontSize:this.state.fontSize}}]}},{key:"copy",value:function(){return new e(this.startValue,this.endValue,this.duration,this.easing)}}])}(xl);function Ll(t){return Ll="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},Ll(t)}function Nl(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,Rl(r.key),r)}}function Rl(t){var e=function(t,e){if("object"!=Ll(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ll(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ll(e)?e:e+""}function Ml(t,e,n){return e=Dl(e),function(t,e){if(e&&("object"==Ll(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,Fl()?Reflect.construct(e,n||[],Dl(t).constructor):e.apply(t,n))}function Fl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Fl=function(){return!!t})()}function Dl(t){return Dl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Dl(t)}function Bl(t,e){return Bl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bl(t,e)}Il.Frames=[1,0];var Vl=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=Ml(this,e)).events=new E,n.config="string"==typeof t?k({},e.defaultConfig,r,{text:t}):k({},e.defaultConfig,t),n.state=k({},n.config),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&&Bl(t,e)}(e,t),function(t,e,n){return e&&Nl(t.prototype,e),n&&Nl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"applyTransform",value:function(t){var e=this.chain(),n=new ll(e,ll.ActionTypes.applyTransform,(new Rt).setContent([t.copy()]));return e.chain(n)}},{key:"applyTransition",value:function(t){var e=this.chain(),n=this._applyTransition(e,t);return e.chain(n)}},{key:"show",value:function(t){var e=this.chain(),n=t instanceof Qi?t.copy():new Qi([{props:{opacity:1},options:t||{}}]),r=new ll(e,ll.ActionTypes.show,(new Rt).setContent([n]));return e.chain(r)}},{key:"hide",value:function(t){var e=this.chain(),n=t instanceof Qi?t.copy():new Qi([{props:{opacity:1},options:t||{}}]),r=new ll(e,ll.ActionTypes.hide,(new Rt).setContent([n]));return e.chain(r)}},{key:"setText",value:function(t){var e=this.chain(),n=new ll(e,ll.ActionTypes.setText,(new Rt).setContent([t]));return e.chain(n)}},{key:"setFontSize",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return this.combineActions(new Ka,(function(o){if(n){var i=new Il(e.state.fontSize,t,n,r);o.chain(e._applyTransition(o,i))}var a=new ll(o,ll.ActionTypes.setFontSize,(new Rt).setContent([t]));return o.chain(a)}))}},{key:"toData",value:function(){return{state:k({},js.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=k({},js.deserializeImageState(t.state)),this}},{key:"toTransform",value:function(){return new Qi(this.state,{duration:0})}},{key:"toDisplayableTransform",value:function(){return new Qi(this.state,{duration:0})}},{key:"_init",value:function(t){return new ll(this.chain(),ll.ActionTypes.init,(new Rt).setContent([t]))}},{key:"_applyTransition",value:function(t,e){return new ll(t,ll.ActionTypes.applyTransition,(new Rt).setContent([e]))}}])}(Ua);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 Ul(t){return function(t){if(Array.isArray(t))return zl(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Wl(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 Wl(t,e){if(t){if("string"==typeof t)return zl(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)?zl(t,e):void 0}}function zl(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 Hl(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"!=Gl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Gl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gl(e)?e:e+""}function ql(t,e,n){return e=Kl(e),function(t,e){if(e&&("object"==Gl(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,Yl()?Reflect.construct(e,n||[],Kl(t).constructor):e.apply(t,n))}function Yl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yl=function(){return!!t})()}function Xl(){return Xl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Kl(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}},Xl.apply(null,arguments)}function Kl(t){return Kl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kl(t)}function Zl(t,e){return Zl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zl(t,e)}Vl.EventTypes=Object.assign(Object.assign({},ds.EventTypes),{"event:text.show":"event:text.show","event:text.hide":"event:text.hide"}),Vl.defaultConfig={position:new qt(qt.Positions.Center),scale:1,rotation:0,opacity:0,alignX:"center",alignY:"center",fontSize:16,fontColor:"#000000",display:!1,text:""};var Ql=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},Jl=function(t){function n(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=ql(this,n)).srcManager=new tl,r.events=new E,r.actions=[],r._userConfig={},r.name=t,r._userConfig=e||{};var o=k(n.defaultConfig,e||{}),i=o.background,a=o.voices,s=Ql(o,["background","voices"]);return r.config=Object.assign(Object.assign({},s),{voices:a||null,background:i||null}),r.state=k(r.config,{backgroundImageProxy:r._createImageProxy()}),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&&Zl(t,e)}(n,t),function(t,e,n){return e&&Hl(t.prototype,e),n&&Hl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"toBackground",value:function(t){if(iu.isImageSrc(t)||iu.isImageColor(t))return t;if(t instanceof ou)return t.toImageColor();throw new Error("Invalid background type")}},{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){var n=this;return this.combineActions(new Ka,(function(r){if(e){var o=e.copy();o.setSrc(n.toBackground(t)),r._transitionToScene(o,void 0,n.toBackground(t))}return r.chain(new kt(r,"scene:setBackground",(new Rt).setContent([t])))}))}},{key:"applyTransform",value:function(t){return this.chain(new kt(this.chain(),"scene:applyTransform",(new Rt).setContent([t.copy()])))}},{key:"jumpTo",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.combineActions(new Ka,(function(r){var o=k({unloadScene:!0},n);return r.chain(new kt(r,"scene:preUnmount",(new Rt).setContent([])))._transitionToScene(o.transition,t).chain(e._init(t)),o.unloadScene&&r.chain(e._exit()),r}))._jumpTo(t)}},{key:"sleep",value:function(t){return this.chain(new kt(this.chain(),"scene:sleep",(new Rt).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,n){return this.chain(new kt(this.chain(),e.setBackgroundMusic,(new Rt).setContent([t,n])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},A(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:this.state.backgroundImageProxy.toData()}}},{key:"fromData",value:function(t){var e=this;return R(t,{state:function(t){R(t,{backgroundMusic:function(t){t&&(e.state.backgroundMusic=(new gu).fromData(t))},background:function(t){t&&(e.state.background=t)}})},backgroundImageState:function(t){t&&(e.state.backgroundImageProxy=(new js).fromData(t))}}),this}},{key:"getInitTransform",value:function(){return new Qi([{props:Object.assign(Object.assign({},this.state.backgroundImageProxy.state),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){return this.actions=t,this}},{key:"constructSceneRoot",value:function(t){var e;this.sceneRoot=new kt(this.chain(),"scene:action",new Rt);var r=this.actions,o=(Array.isArray(r)?r.flat(2):r(this).flat(2)).map((function(t){return La.isChained(t)?t.fromChained(t):t})).flat(2),i=[],a=[];this.getAllChildrenElements(t,o).forEach((function(t){La.isChained(t)||(t instanceof js?i.push(t):t instanceof Vl&&a.push(t))}));var s=[],u=[],c=new Map;i.forEach((function(t){var e;t.config.isWearable?u.push(t):s.push(t);var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Wl(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.config.wearables);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(c.get(o)&&c.get(o)!==t)throw new Error("Wearable image cannot be used multiple times\nYou may bind the same wearable image to multiple parent images\nParent Conflict: "+(null===(e=c.get(o))||void 0===e?void 0:e.getId())+"\nCurrent Parent: "+t.getId());c.set(o,t)}}catch(t){r.e(t)}finally{r.f()}}));var l=[this._init(this)].concat(Ul(s.filter((function(t){return t.config.autoInit})).map((function(t){return t._init()}))),Ul(u.map((function(t){if(!c.has(t))throw new Error("Wearable image must have a parent image");return c.get(t)._initWearable(t)}))),Ul(a.map((function(t){return t._init()}))),Ul(o)),f=function(t,e,n,r){var o=Xl(Kl(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(n,"constructNodes",this,3)([l]),p=new Rt(this.sceneRoot,void 0,f||void 0).setContent(this);return null==f||f.setParent(p),null===(e=this.sceneRoot)||void 0===e||e.setContentNode(p),this}},{key:"isSceneRootConstructed",value:function(){return!!this.sceneRoot}},{key:"inherit",value:function(t){var e=k(n.defaultConfig,t.config,this._userConfig),r=e.background,o=Ql(e,["background"]);return this.config=Object.assign(Object.assign({},o),{background:r||null}),this.state=k(this.config,{backgroundImageProxy:this._createImageProxy()}),this}},{key:"registerSrc",value:function(t){var r=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set;if(this.sceneRoot){var i=new Set,a=new Set,s=[this.sceneRoot],u=new Set;for(iu.isImageSrc(this.config.background)&&this.srcManager.register(new js({src:iu.toBackgroundSrc(this.config.background)}));s.length;){var c=s.shift();if(!i.has(c)){if(i.add(c),c instanceof kt){if(c.type===e.jumpTo){var l=c,f=n.getScene(t,l.contentNode.getContent()[0]);if(!f)throw c._sceneNotFoundError(c.getSceneName(l.contentNode.getContent()[0]));var p=tl.getPreloadableSrc(t,c);if(p&&this.srcManager.register(p),a.has(l)||o.has(f))continue;a.add(l),u.add(f),o.add(f)}else if(c.type===e.setBackground){var h=tl.getPreloadableSrc(t,c);h&&this.srcManager.register(h)}}else if(c instanceof zs){var d=tl.getPreloadableSrc(t,c);d&&this.srcManager.register(d)}else if(c instanceof lt)this.srcManager.register(c.callee);else if(c instanceof wa){var y=c.getFutureActions(t);s.push.apply(s,Ul(y))}s.push.apply(s,Ul(c.getFutureActions(t)))}}u.forEach((function(e){e.registerSrc(t,o),r.srcManager.registerFuture(e.srcManager)}))}}},{key:"assignActionId",value:function(t){this.getAllChildren(t,this.sceneRoot||[]).forEach((function(t,e){t.setId("action-".concat(e))}))}},{key:"assignElementId",value:function(t){this.getAllChildrenElements(t,this.sceneRoot||[]).forEach((function(t,e){t.setId("element-".concat(e))}))}},{key:"getVoice",value:function(t){if(!t)return null;var e=this.config.voices;return e?"function"==typeof e?e(t):e[t]||null:null}},{key:"getSceneRoot",value:function(){if(!this.sceneRoot)throw new Error("Scene root is not constructed");return this.sceneRoot}},{key:"reset",value:function(){this.state=k(n.defaultState,this.config),this.state.backgroundImageProxy.reset()}},{key:"toDisplayableTransform",value:function(){return this.state.backgroundImageProxy.toDisplayableTransform()}},{key:"requestImagePreload",value:function(t){this.srcManager.register({type:"image",src:new js({src:t})})}},{key:"_createImageProxy",value:function(){return new Ps({opacity:1,src:js.DefaultImagePlaceholder})}},{key:"_jumpTo",value:function(t){return this.chain(new kt(this.chain(),"scene:jumpTo",(new Rt).setContent([t])))}},{key:"_exit",value:function(){return new kt(this.chain(),"scene:exit",(new Rt).setContent([]))}},{key:"_transitionToScene",value:function(t,n,r){var o=this.chain();if(t){var i=t.copy(),a=new kt(o,e.transitionToScene,(new Rt).setContent([i,n,r]));o.chain(a)}return o}},{key:"_init",value:function(t){return new kt(this.chain(),"scene:init",(new Rt).setContent([t]))}}],[{key:"isScene",value:function(t){return t instanceof n}},{key:"getScene",value:function(t,e){return"string"==typeof e?t.getScene(e):e}}])}(Kc);function tf(t){return tf="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},tf(t)}function ef(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,nf(r.key),r)}}function nf(t){var e=function(t,e){if("object"!=tf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tf(e)?e:e+""}function rf(t,e,n){return e=sf(e),function(t,e){if(e&&("object"==tf(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,of()?Reflect.construct(e,n||[],sf(t).constructor):e.apply(t,n))}function of(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(of=function(){return!!t})()}function af(){return af="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=sf(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}},af.apply(null,arguments)}function sf(t){return sf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},sf(t)}function uf(t,e){return uf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uf(t,e)}Jl.EventTypes={"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.setBackgroundMusic":"event:scene.setBackgroundMusic","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},Jl.defaultConfig={invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},Jl.defaultState={backgroundImageProxy:new Ps};var cf=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),rf(this,e,arguments)}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&&uf(t,e)}(e,t),function(t,e,n){return e&&ef(t.prototype,e),n&&ef(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),function(t,e,n,r){var o=af(sf(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"executeAction",this,3)([t])}}])}(Q);function lf(t){return lf="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},lf(t)}function ff(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,pf(r.key),r)}}function pf(t){var e=function(t,e){if("object"!=lf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=lf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==lf(e)?e:e+""}function hf(t,e,n){return e=vf(e),df(t,yf()?Reflect.construct(e,n||[],vf(t).constructor):e.apply(t,n))}function df(t,e){if(e&&("object"==lf(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 yf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yf=function(){return!!t})()}function vf(t){return vf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vf(t)}function mf(t,e){return mf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mf(t,e)}cf.ActionTypes={action:"script:action"};var gf=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=hf(this,e)).handler=t,df(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&&mf(t,e)}(e,t),function(t,e,n){return e&&ff(t.prototype,e),n&&ff(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var n=t.gameState;this.handler(e.getCtx({gameState:n}))}},{key:"fromChained",value:function(t){return[new cf(this.chain(),cf.ActionTypes.action,(new Rt).setContent(t))]}}],[{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}])}(Ua);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){return function(t){if(Array.isArray(t))return Sf(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 Sf(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)?Sf(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 Sf(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,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"!=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+""}function xf(t,e,n){return e=Of(e),function(t,e){if(e&&("object"==bf(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,Af()?Reflect.construct(e,n||[],Of(t).constructor):e.apply(t,n))}function Af(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Af=function(){return!!t})()}function Of(t){return Of=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Of(t)}function Ef(t,e){return Ef=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ef(t,e)}var Tf=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=xf(this,e)).entryScene=null,n.scenes=new Map,n.persistent=[],n.name=t,n.config=k(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&&Ef(t,e)}(e,t),function(t,e,n){return e&&_f(t.prototype,e),n&&_f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"entry",value:function(t){return this.entryScene=t,this}},{key:"registerScene",value:function(t,e){var n="string"==typeof t?t:t.name,r="string"==typeof t?e:t;if(this.scenes.has(n)&&this.scenes.get(n)!==r)throw new Error("Scene with name ".concat(n," already exists when registering scene"));return this.scenes.set(n,r),this}},{key:"registerPersistent",value:function(t){return this.persistent.push(t),this}},{key:"getScene",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;if(Jl.isScene(t))return t;var r=this.scenes.get(t)||null;if(!r&&e){var o=n||cu;throw Reflect.construct(o,["Scene with name ".concat(t," not found")])}return r}},{key:"constructStory",value:function(){var t=this.entryScene;if(!t)throw new Error("Story must have an entry scene");return this.constructSceneRoots(t),t.registerSrc(this),t.assignActionId(this),t.assignElementId(this),this.runStaticCheck(t),this}},{key:"getAllElementStates",value:function(){var t;return this.getAllChildrenElements(this,(null===(t=this.entryScene)||void 0===t?void 0:t.getSceneRoot())||[]).map((function(t){return{id:t.getId(),data:t.toData()}})).filter((function(t){return!!t.data}))}},{key:"constructSceneRoots",value:function(t){var n=new Set,r=[],o=0;for(t.constructSceneRoot(this),r.push(t.getSceneRoot());r.length;){if(++o>e.MAX_DEPTH)throw new Error("Max depth reached while constructing scene roots (max depth: ".concat(e.MAX_DEPTH,")"));var i=r.shift();if(Jl.isScene(i.callee)){if(n.has(i.callee))continue;i.callee.isSceneRootConstructed()||i.callee.constructSceneRoot(this),n.add(i.callee)}var a=i.getFutureActions(this);r.push.apply(r,wf(a))}return this}},{key:"initPersistent",value:function(t){return this.persistent.forEach((function(e){e.init(t)})),this}},{key:"runStaticCheck",value:function(t){return new uu(t).run(this)}}])}(Kc);function jf(t){return jf="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},jf(t)}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 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,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 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,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,Lf(r.key),r)}}function Lf(t){var e=function(t,e){if("object"!=jf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=jf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==jf(e)?e:e+""}function Nf(t,e,n){return e=Ff(e),function(t,e){if(e&&("object"==jf(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,Rf()?Reflect.construct(e,n||[],Ff(t).constructor):e.apply(t,n))}function Rf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Rf=function(){return!!t})()}function Mf(){return Mf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Ff(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}},Mf.apply(null,arguments)}function Ff(t){return Ff=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ff(t)}function Df(t,e){return Df=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Df(t,e)}Tf.defaultConfig={},Tf.MAX_DEPTH=1e4;var Bf=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Nf(this,e,arguments)}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&&Df(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:"executeAction",value:function(t){var n=this;if(n.is(e,"persistent:set")){var r=Pf(n.contentNode.getContent(),2),o=r[0],i=r[1];return t.getStorable().getNamespace(n.callee.getNamespaceName()).set(o,i),function(t,e,n,r){var o=Mf(Ff(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"executeAction",this,3)([t])}throw this.unknownTypeError()}}])}(Q);function Vf(t){return Vf="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},Vf(t)}function Gf(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 Uf(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)?Uf(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 Uf(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 Wf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,$f(r.key),r)}}function Hf(t,e,n){return e&&zf(t.prototype,e),n&&zf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function $f(t){var e=function(t,e){if("object"!=Vf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Vf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vf(e)?e:e+""}Bf.ActionTypes=c;var qf=function(){function t(e,n,r){Wf(this,t),this.name=e,this.key=r||e,this.content=k({},n)}return Hf(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\n at namespace "').concat(this.name,'"')),this.content[e]=n,this)}},{key:"get",value:function(t){return this.content[t]}},{key:"equals",value:function(t,e){return this.content[t]===e}},{key:"assign",value:function(t){var e=this;return Object.entries(t).forEach((function(t){var n=Gf(t,2),r=n[0],o=n[1];e.set(r,o)})),this}},{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=Gf(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=Gf(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(Vf(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===Vf(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),Yf=function(){return Hf((function t(){Wf(this,t),this.namespaces={}}),[{key:"addNamespace",value:function(t){if(!this.namespaces[t.key])return this.namespaces[t.key]=t,this}},{key:"getNamespace",value:function(t){if(!this.namespaces[t])throw new lu("Namespace ".concat(t," is not initialized"));return this.namespaces[t]}},{key:"setNamespace",value:function(t,e){return this.namespaces[t]=e,this}},{key:"hasNamespace",value:function(t){return!!this.namespaces[t]}},{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=Gf(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=Gf(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")}},{key:"clear",value:function(){return this.namespaces={},this}}])}();function Xf(t){return Xf="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},Xf(t)}function Kf(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,Zf(r.key),r)}}function Zf(t){var e=function(t,e){if("object"!=Xf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Xf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xf(e)?e:e+""}function Qf(t,e,n){return e=tp(e),function(t,e){if(e&&("object"==Xf(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,Jf()?Reflect.construct(e,n||[],tp(t).constructor):e.apply(t,n))}function Jf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Jf=function(){return!!t})()}function tp(t){return tp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tp(t)}function ep(t,e){return ep=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ep(t,e)}var np=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=Qf(this,e)).namespace=t,r.defaultContent=n,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&&ep(t,e)}(e,t),function(t,e,n){return e&&Kf(t.prototype,e),n&&Kf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"init",value:function(t){t.hasNamespace(this.namespace)||t.addNamespace(new qf(this.namespace,this.defaultContent))}},{key:"set",value:function(t,e){return this.chain(this.createAction(c.set,[t,e]))}},{key:"equals",value:function(t,e){var n=this;return new wc((function(r){return r.storable.getNamespace(n.namespace).equals(t,e)}))}},{key:"notEquals",value:function(t,e){var n=this;return new wc((function(r){return!r.storable.getNamespace(n.namespace).equals(t,e)}))}},{key:"isTrue",value:function(t){var e=this;return new wc((function(n){return n.storable.getNamespace(e.namespace).equals(t,!0)}))}},{key:"isFalse",value:function(t){var e=this;return new wc((function(n){return n.storable.getNamespace(e.namespace).equals(t,!1)}))}},{key:"isNotNull",value:function(t){var e=this;return new wc((function(n){var r=n.storable.getNamespace(e.namespace).get(t);return null!=r}))}},{key:"toWord",value:function(t){var e=this;return new Ou((function(n){var r=n.storable;return[String(r.getNamespace(e.namespace).get(t))]}))}},{key:"conditional",value:function(t,e,n){return new Ou((function(r){return wc.from(t).evaluate(r).value?e:n}))}},{key:"getNamespaceName",value:function(){return this.namespace}},{key:"createAction",value:function(t,e){return new Bf(this.chain(),t,Rt.create(e))}}])}(Ua),rp=function t(e){if(!(this instanceof t?this.constructor:void 0))throw new Error("Image is a constructor and should be called with new keyword");return new js(e,e.tag)};function op(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=op(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}const ip=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=op(t))&&(r&&(r+=" "),r+=e);return r};var ap=o(12),sp=o.n(ap);function up(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 cp(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)?cp(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 cp(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 lp=sp().createContext(null);function fp(t){var e=t.children,n=t.game,r=new sd({}),o=up((0,ap.useState)(n||r),2),i=o[0],a=o[1];return sp().createElement(lp.Provider,{value:{game:i,setGame:a}},e)}function pp(){var t=(0,ap.useContext)(lp);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function hp(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))})}var dp=o(387);const yp=(0,ap.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),vp=(0,ap.createContext)({}),mp=(0,ap.createContext)(null),gp=ri?ap.useLayoutEffect:ap.useEffect,bp=(0,ap.createContext)({strict:!1}),{schedule:wp,cancel:Sp}=an(queueMicrotask,!1);function _p(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const kp=(0,ap.createContext)({});function xp(t,e,n,r,o){var i,a;const{visualElement:s}=(0,ap.useContext)(vp),u=(0,ap.useContext)(bp),c=(0,ap.useContext)(mp),l=(0,ap.useContext)(yp).reducedMotion,f=(0,ap.useRef)();r=r||u.renderer,!f.current&&r&&(f.current=r(t,{visualState:e,parent:s,props:n,presenceContext:c,blockInitialAnimation:!!c&&!1===c.initial,reducedMotionConfig:l}));const p=f.current,h=(0,ap.useContext)(kp);!p||p.projection||!o||"html"!==p.type&&"svg"!==p.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:Ap(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&_p(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(f.current,n,o,h),(0,ap.useInsertionEffect)((()=>{p&&p.update(n,c)}));const d=n[Yo],y=(0,ap.useRef)(Boolean(d)&&!(null===(i=window.MotionHandoffIsComplete)||void 0===i?void 0:i.call(window,d))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,d)));return gp((()=>{p&&(window.MotionIsMounted=!0,p.updateFeatures(),wp.render(p.render),y.current&&p.animationState&&p.animationState.animateChanges())})),(0,ap.useEffect)((()=>{p&&(!y.current&&p.animationState&&p.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,d)})),y.current=!1))})),p}function Ap(t){if(t)return!1!==t.options.allowProjection?t.projection:Ap(t.parent)}function Op(t,e,n){return(0,ap.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):_p(n)&&(n.current=r))}),[e])}function Ep(t){const{initial:e,animate:n}=function(t,e){if(li(t)){const{initial:e,animate:n}=t;return{initial:!1===e||si(e)?e:void 0,animate:si(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,ap.useContext)(vp));return(0,ap.useMemo)((()=>({initial:e,animate:n})),[Tp(e),Tp(n)])}function Tp(t){return Array.isArray(t)?t.join(" "):t}function jp(t){for(const e in t)hi[e]={...hi[e],...t[e]}}const Pp=(0,ap.createContext)({}),Cp=Symbol.for("motionComponentSymbol");function Ip({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&jp(t);const i=(0,ap.forwardRef)((function(t,i){let a;const s={...(0,ap.useContext)(yp),...t,layoutId:Lp(t)},{isStatic:u}=s,c=Ep(t),l=r(t,u);if(!u&&ri){!function(){(0,ap.useContext)(bp).strict;0}();const t=function(t){const{drag:e,layout:n}=hi;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=xp(o,l,s,e,t.ProjectionNode)}return(0,dp.jsxs)(vp.Provider,{value:c,children:[a&&c.visualElement?(0,dp.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Op(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[Cp]=o,i}function Lp({layoutId:t}){const e=(0,ap.useContext)(Pp).id;return e&&void 0!==t?e+"-"+t:t}const Np=["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 Rp(t){return"string"==typeof t&&!t.includes("-")&&!!(Np.indexOf(t)>-1||/[A-Z]/u.test(t))}function Mp(t){const e=Ee(t)?t.get():t;return Fo(e)?e.toValue():e}function Fp(t){return qe.has(t)?"transform":So.has(t)?qo(t):void 0}const Dp=t=>(e,n)=>{const r=(0,ap.useContext)(vp),o=(0,ap.useContext)(mp),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:Vp(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,ap.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function Bp(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=zo(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function Vp(t,e,n,r,o){var i;const a={},s=new Set,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]=Mp(c[t]);let{initial:l,animate:f}=t;const p=li(t),h=fi(t);e&&h&&!p&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let d=!!n&&!1===n.initial;d=d||!1===l;const y=d?f:l;return y&&"boolean"!=typeof y&&!ai(y)&&Bp(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[d?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!ai(f)&&Bp(t,f,(t=>{for(const e in t){const t=Fp(e);t&&s.add(t)}})),s.size&&(a.willChange=Array.from(s).join(","))),a}const Gp=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Up=()=>({...Gp(),attrs:{}}),Wp={useVisualState:Dp({scrapeMotionValuesFromProps:ni,createRenderState:Up,onMount:(t,e,{renderState:n,latestValues:r})=>{sn.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),sn.render((()=>{Oi(n,r,Pi(e.tagName),t.transformTemplate),ji(e,n)}))}})},zp={useVisualState:Dp({applyWillChange:!0,scrapeMotionValuesFromProps:ei,createRenderState:Gp})};function Hp(t,e,n){for(const r in e)Ee(e[r])||ti(r,n)||(t[r]=e[r])}function $p(t,e){const n={};return Hp(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,ap.useMemo)((()=>{const n=Gp();return _i(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function qp(t,e){const n={},r=$p(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 Yp=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 Xp(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Yp.has(t)}let Kp=t=>!Xp(t);try{(Zp=require("@emotion/is-prop-valid").default)&&(Kp=t=>t.startsWith("on")?!Xp(t):Zp(t))}catch(ga){}var Zp;function Qp(t,e,n,r){const o=(0,ap.useMemo)((()=>{const n=Up();return Oi(n,e,Pi(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};Hp(e,t.style,t),o.style={...e,...o.style}}return o}function Jp(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(Rp(e)?Qp:qp)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(Kp(o)||!0===n&&Xp(o)||!e&&!Xp(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==ap.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,ap.useMemo)((()=>Ee(c)?c.get():c),[c]);return(0,ap.createElement)(e,{...u,children:l})}}function th(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Ip({...Rp(n)?Wp:zp,preloadedFeatures:t,useRender:Jp(r),createVisualElement:e,Component:n})}}const eh=hp(th());function nh(){return nh=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},nh.apply(null,arguments)}function rh(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 oh(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)?oh(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 oh(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 ih=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};function ah(t){var e=t.children,n=t.border,r=void 0===n?"solid":n,o=t.color,i=void 0===o?"red":o,a=t.tag,s=t.borderWidth,u=void 0===s?1:s,c=t.as,l=void 0===c?"div":c,f=t.Ref,p=ih(t,["children","border","color","tag","borderWidth","as","Ref"]),h=pp().game,d=rh((0,ap.useState)(!1),2),y=d[0],v=d[1];if(!h.config.app.inspector)return sp().createElement(l,nh({},p,{ref:f}),e);var m=Object.assign(Object.assign({},p),{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},style:Object.assign(Object.assign({},p.style||{}),{outline:"".concat(u,"px ").concat(r," ").concat(i),zIndex:y?1e3:"auto"})});return sp().createElement(l,nh({},m,{ref:f}),a&&y&&sp().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black text-sm"},a),e)}function sh(t){var e=t.border,n=void 0===e?"solid":e,r=t.color,o=void 0===r?"red":r,i=t.tag,a=t.borderWidth,s=void 0===a?1:a,u=t.as,c=void 0===u?"img":u,l=ih(t,["border","color","tag","borderWidth","as"]),f=pp().game,p=rh((0,ap.useState)(!1),2),h=p[0],d=p[1];if(!f.config.app.inspector)return sp().createElement(c,l);var y=Object.assign(Object.assign({},l),{onMouseEnter:function(){return d(!0)},onMouseLeave:function(){return d(!1)},style:Object.assign(Object.assign({},l.style||{}),{outline:"".concat(n," ").concat(s,"px ").concat(o),zIndex:h?1e3:"auto"})});return sp().createElement("div",null,sp().createElement(c,y),i&&h&&sp().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black"},i))}const uh={Div:function(t){return sp().createElement(ah,nh({},t,{as:"div"}))},Span:function(t){return sp().createElement(ah,nh({},t,{as:"span"}))},Button:function(t){return sp().createElement(ah,nh({},t,{as:"button"}))},Img:function(t){return sp().createElement(sh,nh({},t,{as:"img"}))},mDiv:function(t){return sp().createElement(ah,nh({},t,{as:eh.div,Ref:t.Ref}))}};function ch(t){return ch="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},ch(t)}function lh(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */lh=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==ch(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(ch(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 fh(t){return function(t){if(Array.isArray(t))return dh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||hh(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 ph(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)||hh(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 hh(t,e){if(t){if("string"==typeof t)return dh(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)?dh(t,e):void 0}}function dh(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 yh(t){var e=lh().mark(R),n=t.sentence,r=t.gameState,o=t.useTypeEffect,i=void 0===o||o,a=t.onCompleted,s=t.finished,u=t.count,c=t.className,l=ph((0,ap.useState)(!1),2),f=l[0],p=l[1],h=(0,ap.useMemo)((function(){return n.evaluate(gf.getCtx({gameState:r}))}),[]),d=r.game,y=ph((0,ap.useState)([]),2),v=y[0],m=y[1],g=(0,ap.useRef)(R(h)),b=(0,ap.useRef)(null),w=(0,ap.useRef)(null),S=ph((0,ap.useState)(0),2),_=S[0],k=S[1],x=ph((0,ap.useReducer)((function(t){return t+1}),0),2)[1],A=ph((0,ap.useState)(new Set),2),E=A[0],T=A[1],j=ph((0,ap.useState)(!1),2),P=j[0],C=j[1];function I(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];w.current&&(clearTimeout(w.current),w.current=null);for(var e=!1;!e;){var n=g.current.next(),o=n.done,i=n.value;if(o)p(!0),a&&(r.logger.info("Say","Completed",o,i),a()),e=!0;else if(_u.isPause(i)){if(t)continue;N(_u.from(i)),e=!0}else L(i)}}function L(t){m((function(e){if("\n"!==t&&E.has(t))return e;T((function(e){return new Set(e).add(t)}));var n=e[e.length-1];return n&&"\n"!==n&&"\n"!==t&&n.tag===t.tag?[].concat(fh(e.slice(0,-1)),[{text:n.text+t.text,config:t.config,tag:t.tag,tag2:t.tag2}]):[].concat(fh(e),[t])}))}function N(t){r.logger.info("Say","Paused",t),t.config.duration?b.current=setTimeout((function(){b.current=null,k((function(t){return t+1}))}),t.config.duration):C(!0)}function R(t){var n,r,o,i,a;return lh().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=fh(t),r=0;case 2:if(!(r<n.length)){e.next=24;break}if(o=n[r],!_u.isPause(o.text)){e.next=8;break}return e.next=7,_u.from(o.text);case 7:return e.abrupt("continue",21);case 8:i=0;case 9:if(!(i<o.text.length)){e.next=21;break}if("\n"!==(a=o.text[i])){e.next=16;break}return e.next=14,"\n";case 14:e.next=18;break;case 16:return e.next=18,{text:a,config:o.config,tag:r,tag2:i};case 18:i++,e.next=9;break;case 21:r++,e.next=2;break;case 24:return e.abrupt("return");case 25:case"end":return e.stop()}}),e)}return(0,ap.useEffect)((function(){if(i||I(!0),s&&!f)return b.current&&clearTimeout(b.current),b.current=null,I(!0),void(a&&(r.logger.info("Say","Completed",b.current,s,f),a()));if(f||s||P||b.current)r.logger.debug("Sentence.tsx","locked",f,s,P);else{var t=g.current.next(),e=t.done,n=t.value;if(e)return p(!0),void(a&&(r.logger.info("Say","Completed",e,n),a()));_u.isPause(n)?N(_u.from(n)):(L(n),x(),w.current=setTimeout((function(){k((function(t){return t+1}))}),d.config.elements.say.textInterval))}}),[_,s,P]),(0,ap.useEffect)((function(){if(u&&!b.current){if(P)return C(!1),void k((function(t){return t+1}));I(),k((function(t){return t+1}))}}),[u]),sp().createElement("div",{className:ip("whitespace-pre-wrap",d.config.elementStyles.say.textContainerClassName,{"font-bold":n.config.bold,italic:n.config.italic},c),style:{fontFamily:n.config.fontFamily||d.config.elementStyles.say.fontFamily,fontSize:n.config.fontSize||d.config.elementStyles.say.fontSize}},v.map((function(t,e){return"\n"===t?sp().createElement("br",{key:e}):sp().createElement(uh.Span,{tag:"say.word.".concat(e),key:e,style:Object.assign({color:O(t.config.color||n.config.color||Ou.defaultColor),fontFamily:t.config.fontFamily,fontSize:t.config.fontSize},d.config.app.debug?{outline:"1px dashed red"}:{}),className:ip(d.config.elementStyles.say.textSpanClassName,"whitespace-pre inline-block",{"font-bold":t.config.bold,italic:t.config.italic},t.config.className)},t.config.ruby?sp().createElement("ruby",{className:"align-bottom inline-block"},sp().createElement("rt",{className:"block text-center"},t.config.ruby),t.text):t.text)})))}function vh(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 mh(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)?mh(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 mh(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 gh(t){return gh="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},gh(t)}function bh(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,wh(r.key),r)}}function wh(t){var e=function(t,e){if("object"!=gh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=gh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==gh(e)?e:e+""}var Sh=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,scale:0},this.events=new E,this.lockers=[],this.updater=null}return function(t,e,n){return e&&bh(t.prototype,e),n&&bh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n,r){this.state.width=e,this.state.height=n,this.state.scale=r,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:"requestUpdate",value:function(){this.events.emit(t.EventTypes["event:aspectRatio.requestUpdate"])}},{key:"onRequestedUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.requestUpdate"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.requestUpdate"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();Sh.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume","event:aspectRatio.requestUpdate":"event:aspectRatio.requestUpdate"};var _h=(0,ap.createContext)(null);function kh(t){var e=t.children,n=vh((0,ap.useState)((function(){return new Sh})),1)[0];return sp().createElement(_h.Provider,{value:{ratio:n}},e)}function xh(){var t=(0,ap.useContext)(_h);if(!_h||!t)throw new Error("useRatio must be used within a RatioProvider");var e=vh((0,ap.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,ap.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function Ah(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 Oh(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)?Oh(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 Oh(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 Eh(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=Ah((0,ap.useState)(!1),2),l=c[0],f=c[1],p=s.game,h=Ah((0,ap.useState)(0),2),d=h[0],y=h[1],v=xh().ratio,m=Ah((0,ap.useState)(new M),1)[0];function g(){p.preference.getPreference(sd.Preferences.autoForward)&&m.cancelTask().scheduleTask((function(){r&&r()}),p.config.elements.say.autoForwardDelay)}return(0,ap.useEffect)((function(){if(window){var t=function(t){p.config.elements.say.nextKey.includes(t.key)&&(l?r&&r():y((function(t){return t+1})))};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")}),[l]),(0,ap.useEffect)((function(){var t=s.events.onEvents([{type:$h.EventTypes["event:state.player.skip"],listener:s.events.on($h.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),l?r&&r():f(!0)}))}]);return function(){t.cancel()}}),[l]),(0,ap.useEffect)((function(){var t=p.preference.onPreferenceChange(sd.Preferences.autoForward,(function(t){t&&l?g():m.cancelTask()}));return function(){t.cancel()}}),[l]),(0,ap.useEffect)((function(){return function(){m.cancelTask()}}),[]),sp().createElement("div",null,u.state.display&&sp().createElement(uh.Div,{tag:"say.aspectScaleContainer",color:"blue",border:"dashed",className:ip("absolute bottom-0 w-[calc(100%-40px)]",a),onClick:function(){l?(r&&r(),g()):y((function(t){return t+1}))},style:Object.assign({},N(p.config.elements.say.useAspectScale,{width:p.config.elements.text.width,height:p.config.elements.text.height}))},sp().createElement(uh.Div,{tag:"say.containerClassName",className:ip(p.config.elementStyles.say.containerClassName),style:Object.assign({},N(p.config.elements.say.useAspectScale,{transform:"scale(".concat(v.state.scale,")"),transformOrigin:"bottom left",width:"100%",height:"100%"}))},sp().createElement("div",{className:ip("bg-white flex flex-col items-start justify-between",p.config.elementStyles.say.contentContainerClassName,"w-full h-full")},sp().createElement(uh.Div,{tag:"say.nameTextClassName",className:ip("rounded-br-md text-black",p.config.elementStyles.say.nameTextClassName)},null===(e=u.config.character)||void 0===e?void 0:e.state.name),sp().createElement(yh,{sentence:u,gameState:s,finished:l,useTypeEffect:i,onCompleted:function(){f(!0),g()},count:d}),sp().createElement("div",null)))))}function Th(){return Th=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},Th.apply(null,arguments)}function jh(t){var e=t.children,n=t.className,r=t.props,o=t.style,i=xh().ratio,a=i.getStyle();return sp().createElement("div",{className:ip("inset-0",n),style:{width:"100%",height:"100%",minWidth:"".concat(i.state.minWidth,"px"),minHeight:"".concat(i.state.minHeight,"px")}},sp().createElement("div",Th({style:Object.assign(Object.assign(Object.assign(Object.assign({},a),{position:"relative",overflow:"hidden"}),(null==r?void 0:r.style)||{}),o||{})},r||{}),e))}var Ph={say:Eh,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=pp().game,a=xh().ratio,s=i.config.elements.say.use;return sp().createElement(sp().Fragment,null,sp().createElement(jh,{className:"absolute"},e&&sp().createElement(s,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"})),sp().createElement(uh.Div,{color:"green",border:"dashed",className:ip("absolute"),style:{width:"".concat(i.config.player.width,"px"),height:"".concat(i.config.player.height,"px")}},sp().createElement(uh.Div,{tag:"menu.aspectScaleContainer",style:{transform:"scale(".concat(a.state.scale,")"),transformOrigin:"left top"},className:ip("w-full h-full")},sp().createElement(uh.Div,{tag:"menu.containerClassName",className:ip("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.containerClassName)},sp().createElement("div",{className:"p-4 rounded-lg w-full z-20"},sp().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return sp().createElement(uh.Button,{tag:"menu.choiceButtonClassName."+e,key:e,className:ip("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButtonClassName),onClick:function(){return function(t){r(t)}(t)}},sp().createElement(yh,{sentence:t.prompt,gameState:o,useTypeEffect:!1,className:ip(i.config.elementStyles.menu.choiceButtonTextClassName)}))}))))))))}},Ch=o(196);function Ih(t){return Ih="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},Ih(t)}function Lh(t){return function(t){if(Array.isArray(t))return Nh(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 Nh(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)?Nh(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 Nh(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 Rh(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,Mh(r.key),r)}}function Mh(t){var e=function(t,e){if("object"!=Ih(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ih(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ih(e)?e:e+""}var Fh=function(){return function(t,e,n){return e&&Rh(t.prototype,e),n&&Rh(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.game=e,this.prefix=n}),[{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,Lh(this.colorLog.apply(this,["gray",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,Lh(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,Lh(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,Lh(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,Lh(this.colorLog.apply(this,["gray",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:"weakWarn",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).log.apply(e,Lh(this.colorLog.apply(this,["yellow",t].concat(r))))}}},{key:"group",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this._log(t).join(" ");return this.game.config.app.logger.info&&(n?console.groupCollapsed(r):console.group(r)),{end:function(){e.game.config.app.logger.info&&console.groupEnd()}}}},{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)}},{key:"colorLog",value:function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(0===r.length)return["%c".concat(this.prefix||""," ").concat(e),"color: ".concat(t)];var i=[],a=[],s=[];return this.prefix?(i.push("%c".concat(this.prefix," [").concat(e,"]")),a.push("color: ".concat(t))):(i.push("%c[".concat(e,"]")),a.push("color: ".concat(t))),r.forEach((function(e){"string"==typeof e?(i.push("%c".concat(e)),a.push("color: ".concat(t))):(i.push("%O"),s.push(e),a.push(""))})),[i.join(" ")].concat(a,s)}}])}();function Dh(t){return Dh="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},Dh(t)}function Bh(t){return function(t){if(Array.isArray(t))return Uh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Gh(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 Vh(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Vh=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==Dh(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Dh(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 Gh(t,e){if(t){if("string"==typeof t)return Uh(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)?Uh(t,e):void 0}}function Uh(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 Wh(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,zh(r.key),r)}}function zh(t){var e=function(t,e){if("object"!=Dh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Dh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Dh(e)?e:e+""}var Hh=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())}))},$h=function(){return function(t,e,n){return e&&Wh(t.prototype,e),n&&Wh(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 E,this.logger=new Fh(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByDisplayable",value:function(t){return this.state.elements.find((function(e){return e.ele.displayable.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:"isSceneActive",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Gh(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}}}}(this.state.elements);try{for(n.s();!(e=n.n()).done;){if(e.value.scene===t)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}},{key:"moveUpElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,Math.min(n.ele.displayable.indexOf(e)+1,n.ele.displayable.length-1)),this):this}},{key:"moveDownElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,Math.max(n.ele.displayable.indexOf(e)-1,0)),this):this}},{key:"moveTopElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,n.ele.displayable.length-1),this):this}},{key:"moveBottomElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,0),this):this}},{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.config.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.displayable.push(t),this):this}},{key:"createWearable",value:function(t,e){return t.events.any(js.EventTypes["event:wearable.create"],e)}},{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.displayable;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:"createDisplayable",value:function(t,e){var n=this.getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.displayable.push(t),this):this}},{key:"disposeDisplayable",value:function(t,e){var n,r=this.getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.displayable;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Displayables not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.sounds.forEach((function(t){var e;return null===(e=t.getPlaying())||void 0===e?void 0:e.stop()})),this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),t.removeScene(n),n.events.clear()})),this.state.elements=[],this.state.srcManagers=[]}},{key:"initSound",value:function(t,e){return t.getPlaying()||t.setPlaying(new(this.getHowl())(t.getHowlOptions(e))),t}},{key:"playSound",value:function(t,e,n){this.initSound(t,n);var r=t.getPlaying().play(),o=[t.getPlaying().once("end",i.bind(this)),t.getPlaying().once("stop",i.bind(this))];function i(){e&&e(),o.forEach((function(t){return t.off()})),this.state.sounds=this.state.sounds.filter((function(e){return e!==t})),this.stage.next()}return this.state.sounds.push(t),t.state.token=r,r}},{key:"stopSound",value:function(t){var e,n;return(null===(e=t.state.playing)||void 0===e?void 0:e.playing(t.getToken()))&&(null===(n=t.state.playing)||void 0===n||n.stop(t.getToken())),t.setPlaying(null).setToken(null),t}},{key:"transitionSound",value:function(t,e,n){return Hh(this,void 0,void 0,Vh().mark((function r(){var o;return Vh().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=5;break}if(!n){r.next=4;break}return r.next=4,this.fadeSound(t,0,n);case 4:this.stopSound(t);case 5:if(!e){r.next=12;break}if(o=e.config.volume,this.playSound(e,void 0,{volume:0}),!n){r.next=11;break}return r.next=11,this.fadeSound(e,o,n);case 11:e.getPlaying().volume(o,e.getToken());case 12:case"end":return r.stop()}}),r,this)})))}},{key:"fadeSound",value:function(t,e,n){var r,o;return Hh(this,void 0,void 0,Vh().mark((function i(){var a;return Vh().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return a=null===(r=t.getPlaying())||void 0===r?void 0:r.volume(t.getToken()),null===(o=t.getPlaying())||void 0===o||o.fade(a,e,n,t.getToken()),i.next=4,j(n);case 4:return i.abrupt("return",void 0);case 5:case"end":return i.stop()}}),i)})))}},{key:"getHowl",value:function(){return Ch.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(Bh(n)))}},{key:"animateText",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(Bh(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:"getSceneByName",value:function(t){var e;return(null===(e=this.game.getLiveGame().story)||void 0===e?void 0:e.getScene(t))||null}},{key:"getStory",value:function(){if(!this.game.getLiveGame().story)throw new lu("Story not loaded");return this.game.getLiveGame().story}},{key:"dispose",value:function(){this.forceReset()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{displayable:t.ele.displayable.map((function(t){return t.getId()}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;if(this.state.elements=[],!this.game.getLiveGame().story)throw new Error("No story loaded");t.scenes.forEach((function(t){var r=t.sceneId,o=t.elements;n.logger.debug("Loading scene: "+r);var i=e.get(r);if(!i)throw new lu("Scene not found, id: "+r+"\nNarraLeaf cannot find the element with the id from the saved game");var a={scene:i,ele:{menus:[],texts:[],displayable:o.displayable.map((function(t){if(!e.has(t))throw new lu("Displayable not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game\nThis may be caused by the damage of the saved game file or the change of the story file");return e.get(t)}))}};n.state.elements.push(a),n.registerSrcManager(i.srcManager),kt.registerEventListeners(i,n)}))}},{key:"initScenes",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;kt.registerEventListeners(n,t)}))}},{key:"getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new lu('Scene not found, please call "scene.activate()" first.');return e}},{key:"getElementMap",value:function(){return{texts:[],menus:[],displayable:[]}}},{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:"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 qh(t){return qh="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},qh(t)}function Yh(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 Xh(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)?Xh(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 Xh(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 Kh(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,Zh(r.key),r)}}function Zh(t){var e=function(t,e){if("object"!=qh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=qh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qh(e)?e:e+""}$h.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip","event:state.preload.unmount":"event:state.preload.unmount","event:state.preload.loaded":"event:state.preload.loaded","event:state.player.flush":"event:state.player.flush"};var Qh=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gameLock=new L,this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this.gameState=void 0,this._lockedCount=0,this.currentAction=null,this._nextLock=new I,this.game=e,this.storable=new Yf,this.initNamespaces()}return function(t,e,n){return e&&Kh(t.prototype,e),n&&Kh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"initNamespaces",value:function(){return this.storable.clear().addNamespace(new qf(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this.story&&this.story.initPersistent(this.storable),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t.constructStory(),this}},{key:"serialize",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState,o=this.story;if(!o)throw new Error("No story loaded");var i=this.storable.toData(),a=r.toData(),s=(null===(t=this.getCurrentAction())||void 0===t?void 0:t.getId())||null,u=o.getAllElementStates();return{name:(null===(e=this.currentSavedGame)||void 0===e?void 0:e.name)||"",meta:{created:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.meta.created)||Date.now(),updated:Date.now()},game:{store:i,stage:a,currentAction:s,elementStates:u}}}},{key:"deserialize",value:function(t){var e;if(!this.gameState)throw new Error("No game state");var n=this.gameState,r=this.story;if(!r)throw new Error("No story loaded");this.reset({gameState:n}),n.stage.forceUpdate();var o=new Map,i=new Map,a=t.game,s=a.store,u=a.stage,c=a.elementStates,l=a.currentAction;if(r.forEachChild(r,(null===(e=r.entryScene)||void 0===e?void 0:e.getSceneRoot())||[],(function(t){o.set(t.getId(),t),i.set(t.callee.getId(),t.callee)})),this.storable.load(s),c.forEach((function(t){var e=t.id,r=t.data;n.logger.debug("restore element",e);var o=i.get(e);if(!o)throw new Error("Element not found, id: "+e+"\nNarraLeaf cannot find the element with the id from the saved game");o.reset(),o.fromData(r)})),this.currentSavedGame=t,n.loadData(u,i),l){var f=o.get(l);if(!f)throw new Error("Action not found, id: "+l+"\nNarraLeaf cannot find the action with the id from the saved game");this.currentAction=f}n.stage.forceUpdate(),n.stage.next()}},{key:"newGame",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState,o=r.logger.group("LiveGame");this.reset({gameState:r}),this.initNamespaces();var i=this.getNewSavedGame();i.name="NewGame-"+Date.now(),this.currentSavedGame=i;var a=null===(t=this.story)||void 0===t?void 0:t.getAllElementMap(this.story,(null===(n=null===(e=this.story)||void 0===e?void 0:e.entryScene)||void 0===n?void 0:n.getSceneRoot())||[]);return a?a.forEach((function(t){r.logger.debug("reset element",t),t.reset()})):r.logger.warn("No elements found"),r.stage.forceUpdate(),r.stage.next(),o.end(),this}},{key:"reset",value:function(t){var e,n,r=t.gameState;this.lockedAwaiting&&this.lockedAwaiting.abort(),this.currentAction=(null===(n=null===(e=this.story)||void 0===e?void 0:e.entryScene)||void 0===n?void 0:n.getSceneRoot())||null,this.lockedAwaiting=null,this.currentSavedGame=null,r.forceReset()}},{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;if(this._nextLock.isLocked())return null;if(this._nextLock.lock(),this.gameLock.isLocked())return this.gameLock;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("LiveGame locked: dead cycle detected\nPlease refresh the page");return this._nextLock.unlock(),this.lockedAwaiting}var r=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==r?void 0:r.node)||void 0===e?void 0:e.action)||null,t.logger.debug("next action (lockedAwaiting)",r),this.lockedAwaiting=null,this._nextLock.unlock(),r||null}if(!this.currentAction)return t.events.emit($h.EventTypes["event:state.end"]),t.logger.weakWarn("LiveGame","No current action"),this._nextLock.unlock(),null;var o=this.currentAction.executeAction(t);return x.isAwaitable(o)?(this.lockedAwaiting=o,this._nextLock.unlock(),o):(t.logger.debug("next action",o),this._lockedCount=0,this.currentAction=(null===(n=o.node)||void 0===n?void 0:n.action)||null,this._nextLock.unlock(),o)}},{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=e.executeAction(t);return x.isAwaitable(r)?r:(null===(n=null==r?void 0:r.node)||void 0===n?void 0:n.action)||null}},{key:"setGameState",value:function(t){return this.gameState=t,this}},{key:"getGameState",value:function(){return this.gameState}},{key:"getAllPredictableActions",value:function(t,n,r){for(var o,i,s,u=(null==n?void 0:n.contentNode)||null,c=[],l=[],f=new Set;(u||l.length)&&!(r&&c.length>=r);)if(u||(u=l.pop().contentNode),[sc].some((function(t){return(null==u?void 0:u.action)&&u.action instanceof t})))u=null;else if(u.action&&u.action.is(kt,e.jumpTo)){var p=Yh(u.action.contentNode.getContent(),1)[0],h=t.getScene(p);if(!h)throw u.action._sceneNotFoundError(u.action.getSceneName(p));if(f.has(h)){u=null;continue}f.add(h),u=(null===(o=h.getSceneRoot())||void 0===o?void 0:o.contentNode)||null}else{if(u.action&&u.action.is(wa,a.do)){var d=Yh(u.action.contentNode.getContent(),1)[0];(null===(i=u.getChild())||void 0===i?void 0:i.action)&&l.push(u.getChild().action),u=(null===(s=d[0])||void 0===s?void 0:s.contentNode)||null}u.action&&c.push(u.action),u=u.getChild()}return c}},{key:"getNewSavedGame",value:function(){var t,e;return{name:"",meta:{created:Date.now(),updated:Date.now()},game:{store:{},stage:{scenes:[]},elementStates:[],currentAction:(null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.getSceneRoot().getId())||null}}}}])}();function Jh(t){return Jh="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},Jh(t)}function td(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,ed(r.key),r)}}function ed(t){var e=function(t,e){if("object"!=Jh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Jh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jh(e)?e:e+""}Qh.DefaultNamespaces={game:{}},Qh.GameSpacesKey={game:"game"};var nd,rd=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.settings=e,this.events=new E}return function(t,e,n){return e&&td(t.prototype,e),n&&td(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"setPreference",value:function(e,n){this.settings[e]=n,this.events.emit(t.EventTypes["event:game.preference.change"],e,n)}},{key:"getPreference",value:function(t){return this.settings[t]}},{key:"getPreferences",value:function(){return this.settings}},{key:"onPreferenceChange",value:function(e,n){var r=this,o=this.events.on(t.EventTypes["event:game.preference.change"],(function(t,r){"string"==typeof e?e===t&&n&&n(r):e(t,r)}));return{cancel:function(){return r.events.off(t.EventTypes["event:game.preference.change"],o)}}}},{key:"importPreferences",value:function(t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.setPreference(e,t[e])}},{key:"exportPreferences",value:function(){var t={};for(var e in this.settings)Object.prototype.hasOwnProperty.call(this.settings,e)&&(t[e]=this.settings[e]);return t}}])}();function od(t){return od="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},od(t)}function id(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,ad(r.key),r)}}function ad(t){var e=function(t,e){if("object"!=od(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=od(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==od(e)?e:e+""}rd.EventTypes={"event:game.preference.change":"event:game.preference.change"},function(t){t.game="game"}(nd||(nd={}));var sd=function(){return function(t,e,n){return e&&id(t.prototype,e),n&&id(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.liveGame=null,this.preference=new rd(t.DefaultPreference),this.config=k(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Ph).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 Qh(this)}}])}();sd.defaultSettings={volume:1},sd.ComponentTypes={say:"say",menu:"menu"},sd.DefaultPreference={autoForward:!1,skip:!0},sd.Preferences={autoForward:"autoForward",skip:"skip"},sd.DefaultConfig={player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:1920,height:1080,skipKey:["Control"],skipInterval:100,ratioUpdateInterval:50,preloadDelay:100,preloadConcurrency:5,waitForPreload:!1,preloadAllImages:!0,forceClearCache:!1,maxPreloadActions:10},elements:{say:{nextKey:[" "],textInterval:50,use:Ph.say,useAspectScale:!0,autoForwardDelay:3e3},img:{slowLoadWarning:!0,slowLoadThreshold:2e3,allowSkipTransform:!0,allowSkipTransition:!0},menu:{use:Ph.menu},background:{allowSkipTransform:!0,allowSkipTransition:!1},text:{allowSkipTransform:!0,allowSkipTransition:!0,width:1920,height:216}},elementStyles:{say:{contentContainerClassName:"",containerClassName:"",nameTextClassName:"",textContainerClassName:"",textSpanClassName:"",rubyClassName:""},menu:{containerClassName:"",choiceButtonClassName:"",choiceButtonTextClassName:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1},inspector:!1}},sd.GameSettingsNamespace=nd;var ud=o(72),cd=o.n(ud),ld=o(825),fd=o.n(ld),pd=o(659),hd=o.n(pd),dd=o(56),yd=o.n(dd),vd=o(540),md=o.n(vd),gd=o(113),bd=o.n(gd),wd=o(587),Sd={};Sd.styleTagTransform=bd(),Sd.setAttributes=yd(),Sd.insert=hd().bind(null,"head"),Sd.domAPI=fd(),Sd.insertStyleElement=md();cd()(wd.A,Sd);wd.A&&wd.A.locals&&wd.A.locals;function _d({children:t,features:e,strict:n=!1}){const[,r]=(0,ap.useState)(!kd(e)),o=(0,ap.useRef)(void 0);if(!kd(e)){const{renderer:t,...n}=e;o.current=t,jp(n)}return(0,ap.useEffect)((()=>{kd(e)&&e().then((({renderer:t,...e})=>{jp(e),o.current=t,r(!0)}))}),[]),(0,dp.jsx)(bp.Provider,{value:{renderer:o.current,strict:n},children:t})}function kd(t){return"function"==typeof t}function xd(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 Ad(t,e,n={}){var r;const o=Ho(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(Qo(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(Od).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(Ad(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 Od(t,e){return t.sortNodePosition(e)}const Ed=ci.length;function Td(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Td(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<Ed;n++){const r=ci[n],o=t.props[r];(si(o)||!1===o)&&(e[r]=o)}return e}const jd=[...ui].reverse(),Pd=ui.length;function Cd(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=>Ad(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=Ad(t,e,n);else{const o="function"==typeof e?Ho(t,e,n.custom):e;r=Promise.all(Qo(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Id(t){let e=Cd(t),n=Rd(),r=!0;const o=e=>(n,r)=>{var o;const i=Ho(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{props:a}=t,s=Td(t.parent)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<Pd;e++){const p=jd[e],h=n[p],d=void 0!==a[p]?a[p]:s[p],y=si(d),v=p===i?h.isActive:null;!1===v&&(f=e);let m=d===s[p]&&d!==a[p]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),h.protectedKeys={...l},!h.isActive&&null===v||!d&&!h.prevProp||ai(d)||"boolean"==typeof d)continue;const g=Ld(h.prevProp,d);let b=g||p===i&&h.isActive&&!m&&y||e>f&&y,w=!1;const S=Array.isArray(d)?d:[d];let _=S.reduce(o(p),{});!1===v&&(_={});const{prevResolvedValues:k={}}=h,x={...k,..._},A=e=>{b=!0,c.has(e)&&(w=!0,c.delete(e)),h.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=_[t],n=k[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Mo(e)&&Mo(n)?!xd(e,n):e!==n,r?null!=e?A(t):c.add(t):void 0!==e&&c.has(t)?A(t):h.protectedKeys[t]=!0}h.prevProp=d,h.prevResolvedValues=_,h.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(b=!1);b&&(!(m&&g)||w)&&u.push(...S.map((t=>({animation:t,options:{type:p}}))))}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 p=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(p=!1),r=!1,p?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=Rd(),r=!0}}}function Ld(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!xd(e,t)}function Nd(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Rd(){return{animate:Nd(!0),whileInView:Nd(),whileHover:Nd(),whileTap:Nd(),whileDrag:Nd(),whileFocus:Nd(),exit:Nd()}}class Md{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Fd=0;const Dd={animation:{Feature:class extends Md{constructor(t){super(t),t.animationState||(t.animationState=Id(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();ai(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 Md{constructor(){super(...arguments),this.id=Fd++}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 Bd(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Vd(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const Gd=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Vd(e));function Ud(t,e,n,r){return Bd(t,e,Gd(n),r)}function Wd(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const zd=Wd("dragHorizontal"),Hd=Wd("dragVertical");function $d(){const t=function(t){let e=!1;if("y"===t)e=Hd();else if("x"===t)e=zd();else{const t=zd(),n=Hd();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function qd(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return Ud(t.current,n,((n,o)=>{if("touch"===n.pointerType||$d())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&sn.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Yd=(t,e)=>!!e&&(t===e||Yd(t,e.parentElement));function Xd(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Vd(n))}const Kd=new WeakMap,Zd=new WeakMap,Qd=t=>{const e=Kd.get(t.target);e&&e(t)},Jd=t=>{t.forEach(Qd)};function ty(t,e,n){const r=function({root:t,...e}){const n=t||document;Zd.has(n)||Zd.set(n,{});const r=Zd.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Jd,{root:t,...e})),r[o]}(e);return Kd.set(t,n),r.observe(t),()=>{Kd.delete(t),r.unobserve(t)}}const ey={some:0,all:1};const ny={inView:{Feature:class extends Md{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:ey[r]};return ty(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 Md{constructor(){super(...arguments),this.removeStartListeners=oe,this.removeEndListeners=oe,this.removeAccessibleListeners=oe,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=Ud(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Yd(this.node.current,t.target)?n:r;i&&sn.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=Ud(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=to(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=Bd(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=Bd(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&Xd("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&sn.postRender((()=>n(t,e)))}))})),Xd("down",((t,e)=>{this.startPress(t,e)}))})),e=Bd(this.node.current,"blur",(()=>{this.isPressing&&Xd("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=to(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&&sn.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!$d()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&sn.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=Ud(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=Bd(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=to(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Md{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=to(Bd(this.node.current,"focus",(()=>this.onFocus())),Bd(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Md{mount(){this.unmount=to(qd(this.node,!0),qd(this.node,!1))}unmount(){}}}},ry={renderer:(t,e)=>Rp(t)?new Ci(e):new Li(e,{allowProjection:t!==ap.Fragment}),...Dd,...ny};function oy(t){var e=t.children;return sp().createElement(_d,{features:ry,strict:!0},e)}function iy(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 ay(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)?ay(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 ay(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 sy(t){var e=t.children,n=t.className,r=iy((0,ap.useState)({}),2),o=r[0],i=r[1],a=xh().ratio,s=pp().game,u=iy((0,ap.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,ap.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("NarraLeaf-React: 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"});var p=e/s.config.player.width;a.update(e,n,p),a.updateMin(c,l),u()}}};a.setUpdate(e);var n,r,o,f=(n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)},r=s.config.player.ratioUpdateInterval,o=null,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];o&&clearTimeout(o),o=setTimeout((function(){n.apply(void 0,e)}),r)});f(),window.addEventListener("resize",f);var p=a.onRequestedUpdate(f);return function(){window.removeEventListener("resize",f),clearTimeout(t),p()}}),[a]),sp().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},sp().createElement("div",{className:ip(n),style:o},e))}function uy(t){return uy="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},uy(t)}function cy(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */cy=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==uy(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(uy(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 ly(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 fy(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)?fy(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 fy(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 py=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 hy(t){var e=this,n=t.state,r=t.displayable,o=t.child,i=r.element,a=r.state,s=void 0===a?i:a,u=(0,ap.useRef)(null),c=ly((0,ap.useState)(null),2),l=c[0],f=c[1],p=ly((0,ap.useState)([]),2)[1],h=ly((0,ap.useState)(null),2),d=h[0],y=h[1],v=ly((0,ap.useState)({}),2),m=v[0],g=v[1];function b(t){if(d&&d.getControl()&&(n.logger.warn("Displayable Animation","processing transform not completed"),d.getControl().complete(),d.setControl(null)),!u.current)throw new Error("scope not ready");t instanceof Qi?Object.assign(u.current.style,t.propToCSS(n,s.state,r.transformOverwrites)):Object.assign(u.current.style,t)}function w(t){return f(t),t?new Promise((function(e){var r=t.events.onEvents([{type:fl.update,listener:t.events.on(fl.update,(function(t){p(t)}))},{type:fl.end,listener:t.events.on(fl.end,(function(){f(null),n.logger.debug("transition end",t)}))},{type:fl.start,listener:t.events.on(fl.start,(function(){n.logger.debug("transition start",t)}))}]);t.start((function(){r.cancel(),e()}))})):(n.logger.warn("transition not set"),Promise.resolve())}function S(t){return py(this,void 0,void 0,cy().mark((function e(){return cy().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(n,s.state,r.transformOverwrites)),y(t),e.next=4,t.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(e){s.state=k(s.state,e),g({style:t.propToCSS(n,s.state,r.transformOverwrites)}),y(null)}));case 4:case"end":return e.stop()}}),e)})))}return(0,ap.useEffect)((function(){var t="event:displayable.applyTransition",o="event:displayable.applyTransform",a="event:displayable.init",c=i.events.onEvents([{type:t,listener:i.events.on(t,w)},{type:o,listener:i.events.on(o,S)},{type:a,listener:i.events.on(a,(function(){return py(e,void 0,void 0,cy().mark((function t(){var e;return cy().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.toDisplayableTransform(),n.logger.debug("init transform",e),t.next=4,e.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(t){s.state=k(s.state,t)}));case 4:case"end":return t.stop()}}),t)})))}))}]);return function(){c.cancel()}}),[]),(0,ap.useEffect)((function(){if(!u.current)throw new Error("Scope not ready. Using element: ".concat(i.constructor.name))}),[]),(0,ap.useEffect)((function(){var t=n.events.onEvents([{type:$h.EventTypes["event:state.player.skip"],listener:n.events.on($h.EventTypes["event:state.player.skip"],(function(){r.skipTransform&&d&&d.getControl()&&(d.getControl().complete(),d.setControl(null),n.logger.debug("transform skip")),r.skipTransition&&l&&l.controller&&(l.controller.complete(),f(null),n.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[l,d]),sp().createElement(sp().Fragment,null,o({transformRef:u,transition:l,transform:d,transformProps:m,state:n}))}function dy(t){return dy="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},dy(t)}function yy(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,vy(r.key),r)}}function vy(t){var e=function(t,e){if("object"!=dy(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=dy(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==dy(e)?e:e+""}var my=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 E}return function(t,e,n){return e&&yy(t.prototype,e),n&&yy(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 tl.getSrc(t)}}])}();function gy(t){return gy="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},gy(t)}function by(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return wy(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)?wy(t,e):void 0}}(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 wy(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 Sy(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,_y(r.key),r)}}function _y(t){var e=function(t,e){if("object"!=gy(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=gy(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==gy(e)?e:e+""}my.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 ky=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.src=new Map,this.preloadTasks=new Map}return function(t,e,n){return e&&Sy(t.prototype,e),n&&Sy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"has",value:function(t){return this.src.has(t)}},{key:"add",value:function(t,e){return this.src.set(t,e),this}},{key:"remove",value:function(t){return this.src.delete(t),this}},{key:"get",value:function(t){return this.src.get(t)}},{key:"clear",value:function(){return this.src.clear(),this}},{key:"size",value:function(){return this.src.size}},{key:"isPreloading",value:function(t){return this.preloadTasks.has(t)}},{key:"preload",value:function(e){var n=this;if(this.src.has(e)||this.preloadTasks.has(e))return{abort:function(){},onFinished:function(){}};var r=new AbortController,o=r.signal,i={promise:t.getImage(e,o),controller:r};return this.preloadTasks.set(e,i),i.promise.then((function(t){n.preloadTasks.delete(e),t&&n.add(e,t)})),{abort:function(){r.abort(),n.preloadTasks.delete(e)},onFinished:function(t){i.promise.then(t)}}}},{key:"abortAll",value:function(){this.preloadTasks.forEach((function(t){t.controller.abort()})),this.preloadTasks.clear()}},{key:"abort",value:function(t){var e=this.preloadTasks.get(t);e&&(e.controller.abort(),this.preloadTasks.delete(t))}},{key:"preloadedSrc",value:function(){return Array.from(this.src.values())}},{key:"filter",value:function(t){var e,n=by(this.src.keys());try{for(n.s();!(e=n.n()).done;){var r=e.value;t.includes(r)||this.src.delete(r)}}catch(t){n.e(t)}finally{n.f()}return this}}],[{key:"getImage",value:function(t,e){return function(t,e){return S(this,void 0,void 0,l().mark((function n(){var r,o;return l().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,fetch(t,e);case 2:return r=n.sent,n.next=5,r.blob();case 5:return o=n.sent,n.abrupt("return",new Promise((function(t){var e=new FileReader;e.onload=function(){t(e.result)},e.readAsDataURL(o)})));case 7:case"end":return n.stop()}}),n)})))}(t,{signal:e})}}])}();function xy(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 Ay(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)?Ay(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 Ay(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 Oy=(0,ap.createContext)(null);function Ey(t){var e=t.children,n=xy((0,ap.useState)(new my),1)[0],r=xy((0,ap.useState)(new ky),1)[0];return sp().createElement(sp().Fragment,null,sp().createElement(Oy.Provider,{value:{preloaded:n,cacheManager:r}},e))}function Ty(){if(!Oy)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,ap.useContext)(Oy)}function jy(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 Py(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)?Py(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 Py(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 Cy(){return Cy=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},Cy.apply(null,arguments)}function Iy(t){var e=t.scene,n=t.props,r=t.state;return sp().createElement(hy,{displayable:{element:e,skipTransform:r.game.config.elements.background.allowSkipTransform,skipTransition:r.game.config.elements.background.allowSkipTransition},child:function(t){return sp().createElement(Ly,Cy({},t,{scene:e,props:n}))},state:r})}function Ly(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.state,i=t.scene,a=t.props,s=xh().ratio,u=Ty().cacheManager,c=jy(sp().useState(!1),2),l=c[0],f=c[1];function p(){l||(f(!0),i.events.emit(Jl.EventTypes["event:scene.imageLoaded"]),o.logger.debug("BackgroundTransition","Image loaded",i))}var h="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAgAB9sWFXTkAAAAASUVORK5CYII=",d={src:h,style:Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{})};return sp().createElement("div",null,sp().createElement(eh.div,Cy({layout:!0,ref:e,className:"absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"},k({style:Object.assign({},s.getStyle())},n)),(r?r.toElementProps():[{}]).map((function(t,e){var n,r=k(d,a,t);return sp().createElement("img",Cy({alt:r.alt},r,{onLoad:p,src:(n=r.src,n?u.has(n)?u.get(n):n:h),className:"absolute",key:e}))}))))}function Ny(t){return Ny="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},Ny(t)}function Ry(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Ry=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==Ny(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Ny(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 My(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 Fy(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)?Fy(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 Fy(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 Dy=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 By(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=xh().ratio,a=My((0,ap.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1];return(0,ap.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(Jl.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){return Dy(this,void 0,void 0,Ry().mark((function r(){var o,i;return Ry().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=s,i=t,r.next=4,n.transitionSound(o,i,e);case 4:if(i){r.next=6;break}return r.abrupt("return");case 6:u(i);case 7:case"end":return r.stop()}}),r)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(Jl.EventTypes["event:scene.preUnmount"],(function(){s&&function(t,e){return Dy(this,void 0,void 0,Ry().mark((function r(){return Ry().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.fadeSound(t,0,e);case 2:n.stopSound(t);case 3:case"end":return r.stop()}}),r)})))}(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,ap.useEffect)((function(){return e.events.emit(Jl.EventTypes["event:scene.mount"]),function(){e.events.emit(Jl.EventTypes["event:scene.unmount"])}}),[]),sp().createElement("div",{className:o},sp().createElement(Iy,{scene:e,props:{width:i.state.width,height:i.state.height,src:iu.isImageSrc(e.state.background)?iu.srcToString(e.state.background):void 0,style:{backgroundColor:iu.isImageColor(e.state.background)?iu.toHex(e.state.background):void 0}},state:n}),r)}function Vy(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Uy(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 Gy(t){return function(t){if(Array.isArray(t))return Wy(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Uy(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 Uy(t,e){if(t){if("string"==typeof t)return Wy(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)?Wy(t,e):void 0}}function Wy(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 zy(t){var e=t.state,n=Ty(),r=n.preloaded,o=n.cacheManager,i=pp().game,a=(0,ap.useRef)(new Set),s="Preload",u=e.getLastScene(),c=i.getLiveGame().getCurrentAction(),l=i.getLiveGame().story;return(0,ap.useEffect)((function(){var t,n;if("undefined"==typeof fetch)return r.events.emit(my.EventTypes["event:preloaded.ready"]),void e.logger.warn(s,"Fetch is not supported in this environment, skipping preload");if(!i.config.player.preloadAllImages)return r.events.emit(my.EventTypes["event:preloaded.ready"]),void e.logger.debug(s,"Preload all images is disabled, skipping preload");if(i.config.player.forceClearCache&&(o.clear(),e.logger.weakWarn(s,"Cache cleared")),l){var a=performance.now(),c=tl.catSrc([].concat(Gy((null===(t=null==u?void 0:u.srcManager)||void 0===t?void 0:t.src)||[]),Gy((null===(n=null==u?void 0:u.srcManager)||void 0===n?void 0:n.getFutureSrc())||[]))),f=new D(i.config.player.preloadConcurrency,i.config.player.preloadDelay),p=[],h=e.logger.group(s,!0);e.logger.debug(s,"preloading:",c);var d,y=Vy(c.image);try{var v=function(){var t=d.value,n=tl.getSrc(t);if(p.push(n),o.has(n)||o.isPreloading(n))return e.logger.debug(s,"Image already loaded (".concat(c.image.indexOf(t)+1,"/").concat(c.image.length,")"),n),1;f.addTask((function(){return new Promise((function(r){o.preload(n).onFinished((function(){e.logger.debug(s,"Image loaded (".concat(c.image.indexOf(t)+1,"/").concat(c.image.length,")"),n),r()}))}))}))};for(y.s();!(d=y.n()).done;)v()}catch(t){y.e(t)}finally{y.f()}return h.end(),f.start().then((function(){e.logger.info(s,"Image preload","loaded ".concat(o.size()," images in ").concat(performance.now()-a,"ms")),i.config.player.waitForPreload&&r.events.emit(my.EventTypes["event:preloaded.ready"]),e.events.emit($h.EventTypes["event:state.preload.loaded"]),o.filter(p)})),i.config.player.waitForPreload||r.events.emit(my.EventTypes["event:preloaded.ready"]),r.events.emit(my.EventTypes["event:preloaded.mount"]),function(){e.events.emit($h.EventTypes["event:state.preload.unmount"]),e.logger.debug(s,"Preload unmounted")}}e.logger.weakWarn(s,"Story not found, skipping preload")}),[u,l]),(0,ap.useEffect)((function(){a.current.clear()}),[u]),(0,ap.useEffect)((function(){if("undefined"!=typeof fetch&&!i.config.player.preloadAllImages)if(l){var t=performance.now(),n=i.getLiveGame().getAllPredictableActions(l,c,i.config.player.maxPreloadActions).map((function(t){return tl.getPreloadableSrc(l,t)})).filter((function(t){return null!==t}));n.filter((function(t){return"scene"===(null==t?void 0:t.activeType)})).forEach((function(t){a.current.has(t)||a.current.add(t)}));var r=tl.catSrc([].concat(Gy(a.current),Gy(n))),u=new D(i.config.player.preloadConcurrency,i.config.player.preloadDelay),f=[],p=e.logger.group(s);e.logger.debug(s,"preloading:",r);var h,d=Vy(r.image);try{var y=function(){var t=h.value,n=tl.getSrc(t);if(f.push(n),o.has(n)||o.isPreloading(n))return e.logger.debug(s,"Image already loaded (".concat(r.image.indexOf(t)+1,"/").concat(r.image.length,")"),n),1;u.addTask((function(){return new Promise((function(i){o.preload(n).onFinished((function(){e.logger.debug(s,"Image loaded (".concat(r.image.indexOf(t)+1,"/").concat(r.image.length,")"),n),i()}))}))}))};for(d.s();!(h=d.n()).done;)y()}catch(t){d.e(t)}finally{d.f()}p.end(),u.start().then((function(){e.logger.info(s,"Image preload (quick reload)","loaded ".concat(o.size()," images in ").concat(performance.now()-t,"ms")),o.filter(f)}))}else e.logger.weakWarn(s,"Story not found, skipping preload")}),[c,l]),null}function Hy(t){var e=t.state,n=pp().game;return(0,ap.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&n.preference.getPreference(sd.Preferences.skip)&&e.events.emit($h.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\nThis component must be rendered in a browser environment")}),[]),sp().createElement(sp().Fragment,null)}var $y=o(33);function qy(){return qy=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},qy.apply(null,arguments)}function Yy(t){var e=t.state,n=t.text,r={scale:function(t){return{width:"fit-content"}},transform:function(t){return{transform:Qi.propToCSSTransform(e,t,{translate:["left"===n.config.alignX?"0%":"right"===n.config.alignX?"-100%":void 0,"top"===n.config.alignY?"100%":"bottom"===n.config.alignY?"0%":void 0]})}}};return sp().createElement(hy,{displayable:{element:n,skipTransform:e.game.config.elements.text.allowSkipTransform,skipTransition:e.game.config.elements.text.allowSkipTransition,transformOverwrites:r},child:function(t){return sp().createElement(Xy,qy({},t,{text:n}))},state:e})}function Xy(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.text,i=xh().ratio,a={style:{width:"fit-content",whiteSpace:"nowrap",fontSize:o.state.fontSize}},s=[{}],u=ip(o.config.className);return sp().createElement(uh.Div,null,sp().createElement(uh.mDiv,qy({tag:"text.container",color:"green",border:"dashed",layout:!0,Ref:e,className:"absolute"},k({style:{opacity:0}},n,{style:{width:"fit-content"}})),r?r.toElementProps().map((function(t,e){var n=k(a,t,{style:{transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}},s[e]||{});return sp().createElement(uh.Span,qy({tag:"text.transition."+e,key:e},n,{className:u}),sp().createElement("span",null,o.state.text))})):sp().createElement(uh.Div,qy({tag:"text.transition.last",color:"green",border:"dashed",key:"last"},k(a,{style:{width:"fit-content",transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}})),sp().createElement(uh.Span,{className:u},o.state.text))))}function Ky(){return Ky=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},Ky.apply(null,arguments)}function Zy(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 Qy(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)?Qy(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 Qy(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 Jy(t){var e=t.props,n=t.onLoad,r=t.id,o=t.Ref,i=(0,ap.useRef)(null),a=xh().ratio,s=Zy(sp().useState(0),2),u=s[0],c=s[1],l=Ty().cacheManager,f=pp().game;function p(){var t=o||i;t.current&&c(t.current.naturalWidth*a.state.scale)}(0,ap.useEffect)((function(){var t;!e.src||l.has(e.src)&&!l.isPreloading(e.src)||null===(t=f.getLiveGame().getGameState())||void 0===t||t.logger.warn("AspectScaleImage",'Image not preloaded: "'.concat(e.src,'". ')+"\nThis may be caused by complicated image action behavior that cannot be predicted. \nTo fix this issue, you can manually register the image using scene.requestImagePreload(YourImageSrc). ")}),[e,e.src,r]),(0,ap.useEffect)((function(){return p(),a.onUpdate(p)}),[e,r]);var h=e.src?l.get(e.src)||e.src:js.DefaultImagePlaceholder;return sp().createElement("img",Ky({ref:o||i},e,{onLoad:n,width:u,alt:e.alt,src:h}))}function tv(t){return function(t){if(Array.isArray(t))return rv(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||nv(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 ev(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)||nv(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 nv(t,e){if(t){if("string"==typeof t)return rv(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)?rv(t,e):void 0}}function rv(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 ov(){return ov=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},ov.apply(null,arguments)}function iv(t){var e=t.image,n=t.state,r=function(){};return sp().createElement(hy,{displayable:{element:e,skipTransition:n.game.config.elements.img.allowSkipTransition,skipTransform:n.game.config.elements.img.allowSkipTransform,transformOverwrites:{}},child:function(t){return sp().createElement(av,ov({},t,{image:e,handleLoad:r}))},state:n})}function av(t){var e=t.transition,n=t.transformProps,r=t.transformRef,o=t.state,i=t.image,a=t.handleLoad,s=xh().ratio,u=(0,ap.useRef)(null),c=ev((0,ap.useState)([]),2),l=c[0],f=c[1],p={src:js.getSrc(i.state),style:Object.assign(Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{}),{transformOrigin:"center"})},h=[{style:{display:"block",position:"unset"}},{style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxWidth:"none"}}];return(0,ap.useEffect)((function(){var t=i.events.onEvents([{type:js.EventTypes["event:wearable.create"],listener:i.events.on(js.EventTypes["event:wearable.create"],(function(t){f((function(e){return[].concat(tv(e),[t])}))}))}]);return function(){t.cancel()}}),[]),sp().createElement("div",null,sp().createElement(uh.mDiv,ov({tag:"image.aspectScaleContainer",color:"green",border:"dashed",layout:!0,Ref:r,className:"absolute"},k({style:{opacity:0}},n,{style:{display:"inline-block",width:u.current?"".concat(u.current.naturalWidth*s.state.scale,"px"):"auto",height:u.current?"".concat(u.current.naturalHeight*s.state.scale,"px"):"auto"}})),sp().createElement(sp().Fragment,null,(e?e.toElementProps():[{}]).map((function(t,e){var n=k(p,t,h[e]||{});return sp().createElement(Jy,{key:e,props:Object.assign({className:"absolute"},n),id:n.src,onLoad:a,Ref:0===e?u:void 0})}))),sp().createElement("div",{className:ip("w-full h-full top-0 left-0 absolute")},l.map((function(t){return sp().createElement("div",{className:ip("w-full h-full relative"),key:"wearable-"+t.getId()},sp().createElement(iv,{image:t,state:o}))})))))}function sv(t){var e=t.state,n=t.displayable;return sp().createElement(sp().Fragment,null,n.map((function(t){var n;if(t instanceof Vl)return sp().createElement(Yy,{state:e,text:t,key:"text-"+t.getId()});if(t instanceof js)return sp().createElement(iv,{state:e,image:t,key:"image-"+t.getId()});throw new Error("Unsupported displayable type: "+((null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)||t))})))}var uv=o(556),cv=o.n(uv);function lv(t){var e=t.error,n=t.errorInfo;return pp().game.config.app.debug?sp().createElement("div",{className:"text-left"},sp().createElement("h1",null,"It is my fault, NarraLeaf-React cannot initialize the player correctly."),sp().createElement("p",{className:"text-red-700"},"Message: ",e.message),sp().createElement("pre",null,"Error Stack: ",null==e?void 0:e.stack),sp().createElement("pre",null,"Component Stack: ",null==n?void 0:n.componentStack),sp().createElement("pre",null,"Digest: ",null==n?void 0:n.digest)):sp().createElement("div",null,sp().createElement("h1",null,"The game cannot initialize the player correctly."),sp().createElement("p",null,"Please contact the game developer for further assistance."))}function fv(t){return fv="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},fv(t)}function pv(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,hv(r.key),r)}}function hv(t){var e=function(t,e){if("object"!=fv(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fv(e)?e:e+""}function dv(t,e,n){return e=vv(e),function(t,e){if(e&&("object"==fv(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,yv()?Reflect.construct(e,n||[],vv(t).constructor):e.apply(t,n))}function yv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yv=function(){return!!t})()}function vv(t){return vv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vv(t)}function mv(t,e){return mv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},mv(t,e)}var gv=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=dv(this,e,arguments)).state={hasError:!1,error:null,errorInfo:null},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&&mv(t,e)}(e,t),function(t,e,n){return e&&pv(t.prototype,e),n&&pv(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidCatch",value:function(t,e){this.setState({error:t,errorInfo:e}),console.error(t,e)}},{key:"render",value:function(){return this.state.hasError?sp().createElement(lv,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(t){return{hasError:!0,error:t,errorInfo:null}}}])}(sp().Component);function bv(t){var e=t.containerRef,n=xh().ratio;return(0,ap.useEffect)((function(){var t=e.current;if(t){var r=new ResizeObserver((function(){n.requestUpdate()}));return r.observe(t),function(){r.disconnect()}}}),[e.current]),null}function wv(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 Sv(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)?Sv(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 Sv(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 _v(t,e){return t.handle(e)}function kv(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=t.children,u=wv((0,ap.useReducer)((function(t){return t+1}),0),2)[1],c=pp().game,l=wv((0,ap.useReducer)(_v,new $h(c,{update:u,forceUpdate:function(){f.logger.weakWarn("Player","force update"),(0,$y.flushSync)((function(){u()}))},next:v,dispatch:function(t){return p(t)}})),2),f=l[0],p=l[1],h=sp().createRef(),d=c.config.elements.say.use,y=c.config.elements.menu.use;function v(){for(var t=!1;!t;){var e=c.getLiveGame().next(f);if(!e)break;if(x.isAwaitable(e)){t=!0;break}if(e instanceof L){e.nextUnlock().then((function(){v()})),t=!0;break}p(e)}f.stage.update()}(0,ap.useEffect)((function(){return c.getLiveGame().setGameState(f),e&&c.getLiveGame().loadStory(e),function(){c.getLiveGame().setGameState(void 0)}}),[c]),(0,ap.useEffect)((function(){var t=!1,e=Promise.resolve().then((function(){t=!0,i&&i({game:c,gameState:f,liveGame:c.getLiveGame(),storable:c.getLiveGame().getStorable()});var e=f.getLastScene(),n=[];e?n.push({type:"event:scene.mount",listener:e.events.once("event:scene.mount",(function(){f.stage.next()}))}):f.stage.next();var r=f.events.onEvents([{type:$h.EventTypes["event:state.end"],listener:function(){a&&a({game:c,gameState:f,liveGame:c.getLiveGame(),storable:c.getLiveGame().getStorable()})}}]),o=f.events.onEvents([{type:$h.EventTypes["event:state.player.skip"],listener:function(){c.getLiveGame().abortAwaiting(),v()}}]);return f.stage.update(),function(){e&&n.forEach((function(t){e.events.off(t.type,t.listener)})),r.cancel(),o.cancel()}}));return function(){t&&e.then((function(t){return t()}))}}),[]),f.events.emit($h.EventTypes["event:state.player.flush"]);var m=n||c.config.player.width,g=r||c.config.player.height;return sp().createElement(gv,null,sp().createElement(oy,null,sp().createElement("div",{style:{width:"number"==typeof m?"".concat(m,"px"):m,height:"number"==typeof g?"".concat(g,"px"):g},className:ip(o,"__narraleaf_content-player"),ref:h},sp().createElement(sy,{className:ip("flex-grow overflow-auto")},sp().createElement(bv,{containerRef:h}),sp().createElement(jh,null,sp().createElement(zy,{state:f}),sp().createElement(xv,{onLoaded:function(){f.stage.update(),e&&v()},state:f},sp().createElement(Hy,{state:f}),f.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return sp().createElement(By,{key:"scene-"+e.getId(),state:f,scene:e},sp().createElement(sv,{state:f,displayable:n.displayable}),n.texts.map((function(t){var e=t.action,n=t.onClick;return sp().createElement(d,{state:f,key:"say-"+e.id,action:e,onClick:function(){n(),v()}})})),n.menus.map((function(t,e){return sp().createElement("div",{key:"menu-"+e},sp().createElement(y,{state:f,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),v()}}))})))}))),s)))))}function xv(t){var e=t.children,n=t.onLoaded,r=t.state,o=Ty().preloaded,i=wv((0,ap.useState)(!1),2),a=i[0],s=i[1];return(0,ap.useEffect)((function(){var t=o.events.on(my.EventTypes["event:preloaded.ready"],(function(){s(!0),n()})),e=r.events.on($h.EventTypes["event:state.preload.unmount"],(function(){s(!1)}));return function(){o.events.off(my.EventTypes["event:preloaded.ready"],t),r.events.off($h.EventTypes["event:state.preload.unmount"],e)}}),[a]),sp().createElement(sp().Fragment,null,a?e:null)}function Av(t){var e=t.children,n=t.game;return sp().createElement(sp().Fragment,null,sp().createElement(kh,null,sp().createElement(fp,{game:n},sp().createElement(Ey,null,e))))}function Ov(){return Ov=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},Ov.apply(null,arguments)}function Ev(t){var e=t.alignX,n=void 0===e?"center":e,r=t.alignY,o=void 0===r?"center":r,i=t.children,a=t.width,s=t.height,u=t.className,c=xh().ratio,l="left"===n?"justify-start":"right"===n?"justify-end":"justify-center",f="top"===o?"items-start":"bottom"===o?"items-end":"items-center";return sp().createElement(jh,{className:ip("flex absolute",l,f,u,"pointer-events-none"),style:{width:a,height:s,transform:"scale(".concat(c.state.scale,")"),transformOrigin:"".concat(n," ").concat(o),pointerEvents:"all"}},i)}gv.propTypes={children:cv().node.isRequired};var Tv={Left:function(t){return sp().createElement(Ev,Ov({},t,{alignX:"left",alignY:"top"}))},Center:function(t){return sp().createElement(Ev,Ov({},t,{alignX:"center",alignY:"top"}))},Right:function(t){return sp().createElement(Ev,Ov({},t,{alignX:"right",alignY:"top"}))}},jv={Left:function(t){return sp().createElement(Ev,Ov({},t,{alignX:"left",alignY:"center"}))},Center:function(t){return sp().createElement(Ev,Ov({},t,{alignX:"center",alignY:"center"}))},Right:function(t){return sp().createElement(Ev,Ov({},t,{alignX:"right",alignY:"center"}))}},Pv={Left:function(t){return sp().createElement(Ev,Ov({},t,{alignX:"left",alignY:"bottom"}))},Center:function(t){return sp().createElement(Ev,Ov({},t,{alignX:"center",alignY:"bottom"}))},Right:function(t){return sp().createElement(Ev,Ov({},t,{alignX:"right",alignY:"bottom"}))}};function Cv(){return Cv=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},Cv.apply(null,arguments)}var Iv=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},Lv={className:cv().string},Nv={children:cv().node};function Rv(t,e){var n=(0,ap.forwardRef)((function(t,n){var r=t.children,o=t.className,i=Iv(t,["children","className"]);return e(Object.assign({children:r,className:o,$ref:n},i))}));return n.displayName=t,n.propTypes=Object.assign(Object.assign({},Lv),Nv),n}var Mv=Rv("VBox",(function(t){var e=t.children,n=t.className,r=t.$ref,o=Iv(t,["children","className","$ref"]);return sp().createElement("div",Cv({ref:r,className:ip("flex flex-col",n)},o),e)})),Fv=Rv("HBox",(function(t){var e=t.children,n=t.className,r=t.$ref,o=Iv(t,["children","className","$ref"]);return sp().createElement("div",Cv({ref:r,className:ip("flex flex-row",n)},o),e)}));function Dv(t){return Dv="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},Dv(t)}function Bv(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,Vv(r.key),r)}}function Vv(t){var e=function(t,e){if("object"!=Dv(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Dv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Dv(e)?e:e+""}function Gv(t,e,n){return e=Wv(e),function(t,e){if(e&&("object"==Dv(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,Uv()?Reflect.construct(e,n||[],Wv(t).constructor):e.apply(t,n))}function Uv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Uv=function(){return!!t})()}function Wv(t){return Wv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wv(t)}function zv(t,e){return zv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zv(t,e)}var Hv=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=Gv(this,e)).state={opacity:1},t.duration=n,t.easing=r||kl.DefaultEasing,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&&zv(t,e)}(e,t),function(t,e,n){return e&&Bv(t.prototype,e),n&&Bv(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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:function(){t&&t(),n.state.opacity=e.Frames[1]},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,backgroundColor:iu.isImageColor(this.src)?O(this.src):""},src:iu.isImageSrc(this.src)?iu.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(kl);function $v(t){return $v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$v(t)}function qv(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,Yv(r.key),r)}}function Yv(t){var e=function(t,e){if("object"!=$v(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$v(e)?e:e+""}function Xv(t,e,n){return e=Zv(e),function(t,e){if(e&&("object"==$v(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,Kv()?Reflect.construct(e,n||[],Zv(t).constructor):e.apply(t,n))}function Kv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Kv=function(){return!!t})()}function Zv(t){return Zv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zv(t)}function Qv(t,e){return Qv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qv(t,e)}Hv.Frames=[0,1];var Jv=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=Xv(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,r.easing=i||kl.DefaultEasing,r.__stack=T(),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&&Qv(t,e)}(e,t),function(t,e,n){return e&&qv(t.prototype,e),n&&qv(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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)}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,transform:this.state.transform,backgroundColor:iu.isImageColor(this.src)?O(this.src):""},src:iu.isImageSrc(this.src)?iu.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.easing).setSrc(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""}}}])}(kl);function tm(t){return tm="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},tm(t)}function em(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,nm(r.key),r)}}function nm(t){var e=function(t,e){if("object"!=tm(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tm(e)?e:e+""}function rm(t,e,n){return e=im(e),function(t,e){if(e&&("object"==tm(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,om()?Reflect.construct(e,n||[],im(t).constructor):e.apply(t,n))}function om(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(om=function(){return!!t})()}function im(t){return im=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},im(t)}function am(t,e){return am=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},am(t,e)}var sm=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=rm(this,e)).state={opacity:0},t.duration=n,t.easing=r||kl.DefaultEasing,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&&am(t,e)}(e,t),function(t,e,n){return e&&em(t.prototype,e),n&&em(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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:function(){n.state.opacity=e.Frames[1],t&&t()},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity,backgroundColor:iu.isImageColor(this.src)?O(this.src):""},src:iu.isImageSrc(this.src)?iu.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(kl);sm.Frames=[1,0]})(),i})()));
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},387:(t,e,n)=>{"use strict";t.exports=n(73)},12:e=>{"use strict";e.exports=t},33:t=>{"use strict";t.exports=e}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={id:t,exports:{}};return n[t](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nc=void 0;var i={};return(()=>{"use strict";o.r(i),o.d(i,{Align:()=>Kt,BaseImageTransition:()=>xl,BaseTextTransition:()=>Al,BaseTransition:()=>kl,Bottom:()=>Dv,Center:()=>Fv,Character:()=>Zu,CommonPosition:()=>Yt,CommonPositionType:()=>Rt,Condition:()=>_c,Control:()=>Za,Coord2D:()=>Xt,Dissolve:()=>ym,Fade:()=>Jv,FadeIn:()=>sm,Game:()=>pd,GameProviders:()=>Lv,GameState:()=>Zh,HBox:()=>Hv,Image:()=>up,Isolated:()=>Nh,Lambda:()=>Sc,LiveGame:()=>rd,Menu:()=>Gc,Namespace:()=>sf,Pause:()=>ku,Persistent:()=>bf,Player:()=>Cv,Say:()=>Ih,Scene:()=>Lf,Script:()=>Zf,Sentence:()=>Lu,Sound:()=>bu,SoundType:()=>su,Storable:()=>uf,Story:()=>sp,Text:()=>Gl,Top:()=>Mv,Transform:()=>Ji,Utils:()=>au,VBox:()=>zv,Word:()=>Eu,useGame:()=>mp});var t={say:"character:say",action:"character:action",setName:"character:setName"},e={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform",transitionToScene:"scene:transitionToScene"},n={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",flush:"image:flush",initWearable:"image:initWearable",setAppearance:"image:setAppearance"},r={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},a={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat",sleep:"control:sleep"},s={action:"text:action",setText:"text:setText",show:"text:show",hide:"text:hide",applyTransform:"text:applyTransform",init:"text:init",applyTransition:"text:applyTransition",setFontSize:"text:setFontSize"},u={action:"displayable:action",layerMoveUp:"displayable:layerMoveUp",layerMoveDown:"displayable:layerMoveDown",layerMoveTop:"displayable:layerMoveTop",layerMoveBottom:"displayable:layerMoveBottom"},c={action:"persistent:action",set:"persistent:set"};function l(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */l=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 f(t,e,n,r){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new I(r||[]);return o(a,"_invoke",{value:T(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}}}e.wrap=f;var h="suspendedStart",d="suspendedYield",y="executing",v="completed",m={};function g(){}function w(){}function S(){}var _={};c(_,a,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(L([])));x&&x!==n&&r.call(x,a)&&(_=x);var A=S.prototype=g.prototype=Object.create(_);function O(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(o,i,a,s){var u=p(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==b(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=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){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=j(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var c=p(e,n,r);if("normal"===c.type){if(o=r.done?v:d,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function j(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,j(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=p(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;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,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}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 C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function L(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(b(e)+" is not iterable")}return w.prototype=S,o(A,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:w,configurable:!0}),w.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,c(t,u,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},O(E.prototype),c(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new E(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(A),c(A,u,"Generator"),c(A,a,(function(){return this})),c(A,"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=L,I.prototype={constructor:I,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(C),!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,m):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),m},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),m}},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(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=m(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 p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(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,y(r.key),r)}}function d(t,e,n){return e&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function y(t){var e=function(t,e){if("object"!=b(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==b(e)?e:e+""}function v(t){return function(t){if(Array.isArray(t))return g(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(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 m(t,e){if(t){if("string"==typeof t)return g(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)?g(t,e):void 0}}function g(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 b(t){return b="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},b(t)}var w,S=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(t){t[t.string=0]="string",t[t.number=1]="number",t[t.boolean=2]="boolean",t[t.object=3]="object",t[t.array=4]="array",t[t.function=5]="function",t[t.symbol=6]="symbol",t[t[void 0]=7]="undefined",t[t.null=8]="null",t[t.date=9]="date",t[t.regexp=10]="regexp",t[t.other=11]="other"}(w||(w={}));var _=function(t){return"string"==typeof t?w.string:"number"==typeof t?w.number:"boolean"==typeof t?w.boolean:"object"===b(t)?Array.isArray(t)?w.array:null===t?w.null:t instanceof Date?w.date:t instanceof RegExp?w.regexp:w.object:"function"==typeof t?w.function:"symbol"===b(t)?w.symbol:void 0===t?w.undefined:w.other};function k(t,e){var n,r,o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i={};for(var a in t)o(t,a)&&(i[a]=(n=t[a],r=e[a],_(n)===w.object&&_(r)===w.object?n.constructor!==Object||r.constructor!==Object?r||n:k(n,r):Array.isArray(n)&&Array.isArray(r)?r&&r.length>0?v(r):v(n):void 0===n&&Array.isArray(r)?v(r):void 0===r?Array.isArray(n)?v(n):n:Array.isArray(r)?v(r):r));for(var s in e)o(e,s)&&!o(i,s)&&("object"===b(e[s])&&null!==e[s]?e[s].constructor===Object?i[s]=k({},e[s]):Array.isArray(e[s])?i[s]=v(e[s]):i[s]=e[s]:i[s]=e[s]);for(var u=arguments.length,c=new Array(u>2?u-2:0),l=2;l<u;l++)c[l-2]=arguments[l];if(c.length){var f=c[0],p=c.slice(1);return k.apply(void 0,[i,f].concat(v(p)))}return i}_.DataTypes=w;var x=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},n=arguments.length>1?arguments[1]:void 0;p(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=n}return d(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 e,n=f(this.listeners);try{for(n.s();!(e=n.n()).done;){(0,e.value)(this.result)}}catch(t){n.e(t)}finally{n.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 A(t){var e=new WeakSet;return function t(n){if(null===n||"object"!==b(n))return n;if(!e.has(n)){if(e.add(n),Array.isArray(n)){var r,o=[],i=f(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;o.push(t(a))}}catch(t){i.e(t)}finally{i.f()}return o}var s={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(s[u]=t(n[u]));return s}}(t)}function O(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"))}x.nothing=function(t){return t};var E=function(){return d((function t(){p(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(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 S(this,void 0,void 0,l().mark((function e(){var r,o,i,a,s,u,c=this;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.events[t]||(this.events[t]=[]),r=[],o=!1,i=f(this.events[t]);try{for(i.s();!(a=i.n()).done;)s=a.value,(u=s.apply(void 0,n))&&"object"===b(u)&&"function"==typeof u.then?r.push(u):o=!0}catch(t){i.e(t)}finally{i.f()}if(!o){e.next=7;break}return e.abrupt("return",void 0);case 7:if(this.events[t]=this.events[t].filter((function(t){return!r.includes(t)})),0!==r.length){e.next=10;break}return e.abrupt("return",new Promise((function(e){var r=c.on("event:EventDispatcher.register",(function(o,i){if(o===t){c.off(o,r);var a=null==i?void 0:i.apply(void 0,n);a&&a.then?a.then(e):e(a)}}))})));case 10:return e.next=12,Promise.all(r);case 12:return e.abrupt("return",void 0);case 13:case"end":return e.stop()}}),e,this)})))}},{key:"clear",value:function(){this.events={}}}])}();function T(){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 j(t){return new Promise((function(e){return setTimeout(e,t)}))}function P(t,e){if(t===e)return!0;if("object"!==b(t)||"object"!==b(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)||!P(t[a],e[a]))return!1}return!0}var C=function(){return d((function t(e){p(this,t),this.abortHandler=e,this.events=new E,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}}])}();C.EventTypes={"event:skipController.abort":"event:skipController.abort"};var I=function(){return d((function t(){p(this,t),this.locked=!1,this.listeners=[],this.unlockListeners=[]}),[{key:"lock",value:function(){return this.locked=!0,this}},{key:"unlock",value:function(){this.locked=!1;var t,e=f(this.listeners);try{for(e.s();!(t=e.n()).done;){(0,t.value)()}}catch(t){e.e(t)}finally{e.f()}var n,r=f(this.unlockListeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)()}}catch(t){r.e(t)}finally{r.f()}return this.listeners=[],this}},{key:"onUnlock",value:function(t){return this.unlockListeners.push(t),t}},{key:"offUnlock",value:function(t){this.unlockListeners=this.unlockListeners.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return S(this,void 0,void 0,l().mark((function t(){var e=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.locked){t.next=2;break}return t.abrupt("return");case 2:return t.abrupt("return",new Promise((function(t){e.listeners.push(t)})));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locked}}])}(),L=function(){return d((function t(){p(this,t),this.locks=[]}),[{key:"unlock",value:function(t){return t.unlock(),this.off(t),t}},{key:"register",value:function(t){var e=t||new I;return this.locks.push(e),e}},{key:"off",value:function(t){this.locks=this.locks.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return S(this,void 0,void 0,l().mark((function t(){var e;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.locks.map((function(t){return t.nextUnlock()})),t.abrupt("return",Promise.all(e));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locks.some((function(t){return t.isLocked()}))}}])}();function N(t,e){return t?e:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}function R(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return void 0!==t};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&r in e&&n(t[r],r)&&e[r](t[r],r)}var M=function(){return d((function t(){p(this,t),this.taskToken=null}),[{key:"scheduleTask",value:function(t,e){this.taskToken&&this.taskToken.cancel();var n=!1,r=setTimeout((function(){n||t()}),e);return this.taskToken={cancel:function(){clearTimeout(r),n=!0},isCancelled:function(){return n}},this.taskToken}},{key:"cancelTask",value:function(){return this.taskToken&&(this.taskToken.cancel(),this.taskToken=null),this}}])}();function F(t,e,n){var r=t.indexOf(e);if(-1===r)return t;var o=v(t);return o.splice(r,1),o.splice(n,0,e),o}var D=function(){return d((function t(e,n){p(this,t),this.concurrency=e,this.delay=n,this.tasks=[]}),[{key:"addTask",value:function(t){this.tasks.push(t)}},{key:"start",value:function(){return S(this,void 0,void 0,l().mark((function t(){var e,n=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=function(){return S(n,void 0,void 0,l().mark((function t(){var n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==this.tasks.length){t.next=2;break}return t.abrupt("return");case 2:return n=this.tasks.splice(0,this.concurrency),t.next=5,Promise.all(n.map((function(t){return t()})));case 5:return t.next=7,j(this.delay);case 7:return t.next=9,e();case 9:case"end":return t.stop()}}),t,this)})))},t.next=3,e();case 3:case"end":return t.stop()}}),t)})))}}])}();function B(t){var e=!1,n=Promise.resolve().then((function(){return e=!0,t()}));return function(){e&&n.then((function(t){t&&t()}))}}function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function G(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,U(r.key),r)}}function U(t){var e=function(t,e){if("object"!=V(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=V(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==V(e)?e:e+""}var W=function(){return function(t,e,n){return e&&G(t.prototype,e),n&&G(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=T(),this._id=""}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode.getChild()}}},{key:"getId",value:function(){return this._id}},{key:"setId",value:function(t){this._id=t}},{key:"setContent",value:function(t){return this.contentNode.setContent(t),this}},{key:"setContentNode",value:function(t){return this.contentNode=t,this}},{key:"getFutureActions",value:function(t){var e=this.contentNode.getChild();return e&&e.action?[e.action]:[]}}])}();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 H(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */H=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==z(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(z(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 $(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,q(r.key),r)}}function q(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+""}function Y(t,e,n){return e=K(e),function(t,e){if(e&&("object"==z(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,X()?Reflect.construct(e,n||[],K(t).constructor):e.apply(t,n))}function X(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(X=function(){return!!t})()}function K(t){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},K(t)}function Z(t,e){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Z(t,e)}W.ActionTypes={action:"action"};var Q=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())}))},J=function(t){function e(t,n,r){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=Y(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}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&&Z(t,e)}(e,t),function(t,e,n){return e&&$(t.prototype,e),n&&$(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"unknownTypeError",value:function(){throw new Error("Unknown action type: "+this.type)}},{key:"resolveAwaitable",value:function(t,e){var n=this,r=e||new x((function(t){return t}));return Q(n,void 0,void 0,H().mark((function e(){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t(r.resolve.bind(r),r);case 2:case"end":return e.stop()}}),e)}))),r}},{key:"is",value:function(t,e){return this instanceof t&&this.type===e}}])}(W);function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){return 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 nt(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)?nt(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 nt(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 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,ot(r.key),r)}}function ot(t){var e=function(t,e){if("object"!=tt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tt(e)?e:e+""}function it(t,e,n){return e=ct(e),function(t,e){if(e&&("object"==tt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,at()?Reflect.construct(e,n||[],ct(t).constructor):e.apply(t,n))}function at(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(at=function(){return!!t})()}function st(t,e,n,r){var o=ut(ct(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ut(){return ut="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ct(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}},ut.apply(null,arguments)}function ct(t){return ct=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ct(t)}function lt(t,e){return lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},lt(t,e)}var ft=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),it(this,e,arguments)}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&&lt(t,e)}(e,t),function(t,e,n){return e&&rt(t.prototype,e),n&&rt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===r.play){if(e.initSound(t,this.callee),!this.callee.getPlaying())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var o=new x((function(t){return t}));return t.playSound(this.callee,(function(){var e;t.stopSound(n.callee),o.resolve({type:n.type,node:null===(e=n.contentNode)||void 0===e?void 0:e.getChild()})})),o}return t.playSound(this.callee,(function(){t.stopSound(n.callee)})),st(e,"executeAction",this,3)([t])}if(this.type===r.stop)return t.stopSound(this.callee),st(e,"executeAction",this,3)([t]);if(this.type===r.fade){var i=et(this.contentNode.getContent(),1)[0],a=i.start,s=i.end,u=i.duration;if(this.callee.getPlaying()){var c=void 0===a?this.callee.getPlaying().volume():a;this.callee.getPlaying().fade(c,s,u,this.callee.getToken())}return st(e,"executeAction",this,3)([t])}if(this.type===r.setVolume){var l=et(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().volume(l,this.callee.getToken()),st(e,"executeAction",this,3)([t])}if(this.type===r.setRate){var f=et(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().rate(f,this.callee.getToken()),st(e,"executeAction",this,3)([t])}if(this.type===r.pause)return this.callee.getPlaying()&&this.callee.getPlaying().pause(this.callee.getToken()),st(e,"executeAction",this,3)([t]);if(this.type===r.resume)return this.callee.getPlaying()&&this.callee.getPlaying().play(this.callee.getToken()),st(e,"executeAction",this,3)([t]);throw st(e,"unknownTypeError",this,3)([])}}],[{key:"initSound",value:function(t,e){e.getPlaying()||e.setPlaying(new(t.getHowl())(e.getHowlOptions()))}}])}(J);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){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 dt(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)?dt(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 dt(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 yt(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,vt(r.key),r)}}function vt(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+""}function mt(t,e,n){return e=St(e),function(t,e){if(e&&("object"==pt(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,gt()?Reflect.construct(e,n||[],St(t).constructor):e.apply(t,n))}function gt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(gt=function(){return!!t})()}function bt(t,e,n,r){var o=wt(St(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function wt(){return wt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=St(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}},wt.apply(null,arguments)}function St(t){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},St(t)}function _t(t,e){return _t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_t(t,e)}ft.ActionTypes=r;var kt,xt=function(t){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),mt(this,n,arguments)}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)}(n,t),function(t,e,n){return e&&yt(t.prototype,e),n&&yt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"applyTransition",value:function(t,e){var n=this,r=(new x).registerSkipController(new C((function(){return t.logger.info("Background Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransition",e).then((function(){r.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),r}},{key:"executeAction",value:function(t){var r=this;if(this.type===e.action)return bt(n,"executeAction",this,3)([t]);if(this.type===e.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],bt(n,"executeAction",this,3)([t]);if(this.type===e.sleep){var o=new x((function(t){return t})),i=this.contentNode.getContent();return new Promise((function(t){"number"==typeof i?setTimeout((function(){t()}),i):x.isAwaitable(i)?i.then(t):null==i||i.then(t)})).then((function(){o.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),o}if(this.type===e.applyTransition){var a=ht(this.contentNode.getContent(),1)[0];return this.applyTransition(t,a)}if(this.is(n,"scene:init")){var s=new x((function(t){return t}));return n.handleSceneInit(this,t,s)}if(this.type===e.exit){t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var u=new x((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){u.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),u}if(this.type===e.jumpTo){var c=this.contentNode.getContent()[0],l=this.contentNode,f=t.getStory().getScene(c);if(!f)throw this._sceneNotFoundError(this.getSceneName(c));var p=f.getSceneRoot().contentNode;return p&&l.addChild(p),{type:this.type,node:p}}if(this.type===e.setBackgroundMusic){var h=ht(this.contentNode.getContent(),2),d=h[0],y=h[1];return this.callee.events.emit("event:scene.setBackgroundMusic",d,y||0),bt(n,"executeAction",this,3)([t])}if(this.type===e.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),t.game.getLiveGame().getStorable().removeNamespace(this.callee.local.getNamespaceName()),bt(n,"executeAction",this,3)([t]);if(this.type===e.applyTransform){var v=ht(this.contentNode.getContent(),1)[0],m=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransform",v).then((function(){m.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),m}if(this.type===e.transitionToScene){var g=ht(this.contentNode.getContent(),3),b=g[0],w=g[1],S=g[2];if(w){var _=t.getStory().getScene(w);if(!_)throw this._sceneNotFoundError(this.getSceneName(w));if(!_.config.background)return bt(n,"executeAction",this,3)([t]);b.setSrc(_.config.background)}else S&&b.setSrc(S);return this.applyTransition(t,b)}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(t){var n,r;if(this.type===e.jumpTo){var o=this.contentNode.getContent()[0],i=t.getScene(o,!0);i.isSceneRootConstructed()||i.constructSceneRoot(t);var a=null===(n=t.getScene(o,!0).getSceneRoot())||void 0===n?void 0:n.contentNode;return(null==a?void 0:a.action)?[a.action]:[]}var s=null===(r=this.contentNode.getChild())||void 0===r?void 0:r.action;return s?[s]:[]}},{key:"_sceneNotFoundError",value:function(t){return new lu("Scene with name ".concat(t," not found")+"\nMake sure you have registered the scene using story.register"+"\nAction: (id: ".concat(this.getId(),") ").concat(this.type)+"\nAt: ".concat(this.__stack))}},{key:"getSceneName",value:function(t){return"string"==typeof t?t:t.name}}],[{key:"handleSceneInit",value:function(t,e,r){var o=ht(t.contentNode.getContent(),1)[0],i="string"==typeof o?e.getSceneByName(o):o;if(!i)throw t._sceneNotFoundError(t.getSceneName(o));return e.isSceneActive(i)?{type:t.type,node:t.contentNode.getChild()}:(e.registerSrcManager(i.srcManager).addScene(i),i.local.init(e.game.getLiveGame().getStorable()),n.registerEventListeners(i,e,(function(){r.resolve({type:t.type,node:t.contentNode.getChild()}),e.stage.next()})),r)}},{key:"registerEventListeners",value:function(t,e,n){t.events.once("event:scene.unmount",(function(){e.offSrcManager(t.srcManager)})),t.events.once("event:scene.mount",(function(){t.state.backgroundMusic&&(ft.initSound(e,t.state.backgroundMusic),t.events.emit("event:scene.setBackgroundMusic",t.state.backgroundMusic,t.config.backgroundMusicFade))})),t.events.any("event:displayable.init").then((function(){n&&n()}))}}])}(J);function At(t){return At="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},At(t)}function Ot(t,e,n){return e=Tt(e),function(t,e){if(e&&("object"==At(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,Et()?Reflect.construct(e,n||[],Tt(t).constructor):e.apply(t,n))}function Et(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Et=function(){return!!t})()}function Tt(t){return Tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Tt(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&&Pt(t,e)}function Pt(t,e){return Pt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pt(t,e)}function Ct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function It(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,Nt(r.key),r)}}function Lt(t,e,n){return e&&It(t.prototype,e),n&&It(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Nt(t){var e=function(t,e){if("object"!=At(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=At(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==At(e)?e:e+""}xt.ActionTypes=e,function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(kt||(kt={}));var Rt,Mt=function(t){function e(t,n,r){var o;return Ct(this,e),(o=Ot(this,e,[kt.ContentNode])).child=r||null,o.parent=n||null,o.action=t||null,o}return jt(e,t),Lt(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:"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:"create",value:function(t){return(new e).setContent(t)}},{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()}}])}(function(){return Lt((function t(e){Ct(this,t),this.type=e,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}()),Ft="center",Dt="left",Bt="right";function Vt(t){return Vt="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},Vt(t)}function Gt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ut(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,Ht(r.key),r)}}function Wt(t,e,n){return e&&Ut(t.prototype,e),n&&Ut(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function zt(t,e,n){return(e=Ht(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ht(t){var e=function(t,e){if("object"!=Vt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Vt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vt(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(Rt||(Rt={}));var $t=zt(zt(zt({},Rt.Left,"33.33%"),Rt.Center,"50%"),Rt.Right,"66.66%"),qt=function(){function t(){Gt(this,t)}return Wt(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"calc(".concat(e," + 0px)");var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + (").concat(n,"px))")}},{key:"toCoord2D",value:function(t){if(Yt.isCommonPositionType(t))return Xt.fromCommonPosition(t);if(Xt.isCoord2DPosition(t))return t;if(Kt.isAlignPosition(t))return Xt.fromAlignPosition(t);if("object"===Vt(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new Xt(t);throw new Error("Invalid position type")}},{key:"orUnknown",value:function(e){return t.isUnknown(e)||void 0===e?t.Unknown:e}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return Xt.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(Rt).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===Vt(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===Vt(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 Yt||t instanceof Xt||t instanceof Kt}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return Xt.fromCommonPosition(new Yt(t));if(this.isRawCoord2DPosition(t))return new Xt(t);if(this.isRawAlignPosition(t))return Xt.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")}}])}();qt.Unknown=Symbol("Unknown");var Yt=function(){function t(e){Gt(this,t),this.position=e}return Wt(t,[{key:"toCSS",value:function(){return{x:$t[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();Yt.Positions=Rt;var Xt=function(){function t(e,n){Gt(this,t),"object"===Vt(e)?(this.x=qt.orUnknown(e.x),this.y=qt.orUnknown(e.y),this.xoffset=qt.orUnknown(e.xoffset),this.yoffset=qt.orUnknown(e.yoffset)):(this.x=qt.orUnknown(e),this.y=qt.orUnknown(n),this.xoffset=qt.Unknown,this.yoffset=qt.Unknown)}return Wt(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:$t[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:qt.isUnknown(e.xalign)?qt.Unknown:"".concat(100*e.xalign,"%"),y:qt.isUnknown(e.yalign)?qt.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:qt.isUnknown(n.x)?e.x:n.x,y:qt.isUnknown(n.y)?e.y:n.y,xoffset:qt.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:qt.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),Kt=function(){function t(e,n){Gt(this,t),"object"===Vt(e)?(this.xalign=qt.orUnknown(e.xalign),this.yalign=qt.orUnknown(e.yalign),this.xoffset=qt.orUnknown(e.xoffset),this.yoffset=qt.orUnknown(e.yoffset)):(this.xalign=qt.orUnknown(e),this.yalign=qt.orUnknown(n),this.xoffset=qt.Unknown,this.yoffset=qt.Unknown)}return Wt(t,[{key:"toCSS",value:function(){return{x:qt.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:qt.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();function Zt(t){let e;return()=>(void 0===e&&(e=t()),e)}const Qt=Zt((()=>void 0!==window.ScrollTimeline));class Jt{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,e){const n=this.animations.map((n=>Qt()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.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 te=t=>1e3*t,ee=t=>t/1e3;function ne(t,e){return e?t*(1e3/e):0}const re=5;function oe(t,e,n){const r=Math.max(e-re,0);return ne(n-t(r),e-r)}const ie=t=>t;let ae=ie,se=ie;const ue=(t,e,n)=>n>e?e:n<t?t:n,ce=.001,le=.01,fe=10,pe=.05,he=1;function de({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;ae(t<=te(fe),"Spring duration must be 10 seconds or less");let a=1-e;a=ue(pe,he,a),t=ue(le,fe,ee(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=ve(e,a),u=Math.exp(-o);return ce-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=ve(Math.pow(e,2),a);return(-o(e)+ce>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-ce,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<ye;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=te(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 ye=12;function ve(t,e){return t*Math.sqrt(1-e*e)}const me=["duration","bounce"],ge=["stiffness","damping","mass"];function be(t,e){return e.some((e=>void 0!==t[e]))}function we({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:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!be(t,ge)&&be(t,me)){const n=de(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-ee(r.velocity||0)}),h=f||0,d=u/(2*Math.sqrt(s*c)),y=i-o,v=ee(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),d<1){const t=ve(v,d);g=e=>{const n=Math.exp(-d*v*e);return i-n*((h+d*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===d)g=t=>i-Math.exp(-v*t)*(y+(h+v*y)*t);else{const t=v*Math.sqrt(d*d-1);g=e=>{const n=Math.exp(-d*v*e),r=Math.min(t*e,300);return i-n*((h+d*v*y)*Math.sinh(r)+t*y*Math.cosh(r))/t}}return{calculatedDuration:p&&l||null,next:t=>{const r=g(t);if(p)a.done=t>=l;else{let o=0;d<1&&(o=0===t?te(h):oe(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}}}const Se=2e4;function _e(t){let e=0;let n=t.next(e);for(;!n.done&&e<Se;)e+=50,n=t.next(e);return e>=Se?1/0:e}function ke(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(_e(r),Se);return{type:"keyframes",ease:t=>r.next(o*t).value/e,duration:ee(o)}}const xe=(t,e,n)=>t+(e-t)*n,Ae=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r};function Oe(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=Ae(0,e,r);t.push(xe(n,1,o))}}function Ee(t){const e=[0];return Oe(e,t.length-1),e}const Te=t=>Boolean(t&&t.getVelocity);function je(t){return"object"==typeof t&&!Array.isArray(t)}function Pe(t,e,n,r){return"string"==typeof t&&je(e)?function(t,e,n){var r;if("string"==typeof t){let o=document;e&&(se(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||[])}(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function Ce(t){return"function"==typeof t}function Ie(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 Le=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t},Ne=t=>Array.isArray(t)&&"number"!=typeof t[0];function Re(t,e){return Ne(t)?t[Le(0,t.length,e)]:t}function Me(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function Fe(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&&(Me(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:xe(o,i,r[a]),easing:Re(n,a)})}function De(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const Be="easeInOut";function Ve(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function Ge(t,e){return e[t]||(e[t]=[]),e[t]}function Ue(t){return Array.isArray(t)?t:[t]}function We(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const ze=t=>"number"==typeof t,He=t=>t.every(ze),$e=new WeakMap,qe=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ye=new Set(qe),Xe={type:"spring",stiffness:500,damping:25,restSpeed:10},Ke={type:"keyframes",duration:.8},Ze={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Qe=(t,{keyframes:e})=>e.length>2?Ke:Ye.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Xe:Ze;function Je(t,e){return t?t[e]||t.default||t:void 0}const tn=!1,en=!1,nn=!1,rn=t=>null!==t;function on(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(rn),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const an=["read","resolveKeyframes","update","preRender","render","postRender"];function sn(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=an.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:p}=a,h=()=>{const i=en?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),p.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(h))};return{schedule:an.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(h)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<an.length;e++)a[an[e]].cancel(t)},state:o,steps:a}}const{schedule:un,cancel:cn,state:ln,steps:fn}=sn("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:ie,!0),pn=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,hn=1e-7,dn=12;function yn(t,e,n,r){if(t===e&&n===r)return ie;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=pn(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>hn&&++s<dn);return a}(e,0,1,t,n);return t=>0===t||1===t?t:pn(o(t),e,r)}const vn=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,mn=t=>e=>1-t(1-e),gn=yn(.33,1.53,.69,.99),bn=mn(gn),wn=vn(bn),Sn=t=>(t*=2)<1?.5*bn(t):.5*(2-Math.pow(2,-10*(t-1))),_n=t=>1-Math.sin(Math.acos(t)),kn=mn(_n),xn=vn(_n),An=t=>/^0[^.\s]+$/u.test(t);const On=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),En=t=>e=>"string"==typeof e&&e.startsWith(t),Tn=En("--"),jn=En("var(--"),Pn=t=>!!jn(t)&&Cn.test(t.split("/*")[0].trim()),Cn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,In=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ln(t,e,n=1){se(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=In.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 On(t)?parseFloat(t):t}return Pn(o)?Ln(o,e,n+1):o}const Nn={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Rn={...Nn,transform:t=>ue(0,1,t)},Mn={...Nn,default:1},Fn=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Dn=Fn("deg"),Bn=Fn("%"),Vn=Fn("px"),Gn=Fn("vh"),Un=Fn("vw"),Wn={...Bn,parse:t=>Bn.parse(t)/100,transform:t=>Bn.transform(100*t)},zn=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Hn=t=>t===Nn||t===Vn,$n=(t,e)=>parseFloat(t.split(", ")[e]),qn=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return $n(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?$n(e[1],t):0}},Yn=new Set(["x","y","z"]),Xn=qe.filter((t=>!Yn.has(t)));const Kn={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:qn(4,13),y:qn(5,14)};Kn.translateX=Kn.x,Kn.translateY=Kn.y;const Zn=t=>e=>e.test(t),Qn=[Nn,Vn,Bn,Dn,Un,Gn,{test:t=>"auto"===t,parse:t=>t}],Jn=t=>Qn.find(Zn(t)),tr=new Set;let er=!1,nr=!1;function rr(){if(nr){const t=Array.from(tr).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 Xn.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)}))}nr=!1,er=!1,tr.forEach((t=>t.complete())),tr.clear()}function or(){tr.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(nr=!0)}))}class ir{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?(tr.add(this),er||(er=!0,un.read(or),un.resolveKeyframes(rr))):(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),tr.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,tr.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const ar=t=>Math.round(1e5*t)/1e5,sr=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const ur=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,cr=(t,e)=>n=>Boolean("string"==typeof n&&ur.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),lr=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[o,i,a,s]=r.match(sr);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},fr={...Nn,transform:t=>Math.round((t=>ue(0,255,t))(t))},pr={test:cr("rgb","red"),parse:lr("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+fr.transform(t)+", "+fr.transform(e)+", "+fr.transform(n)+", "+ar(Rn.transform(r))+")"};const hr={test:cr("#"),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:pr.transform},dr={test:cr("hsl","hue"),parse:lr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Bn.transform(ar(e))+", "+Bn.transform(ar(n))+", "+ar(Rn.transform(r))+")"},yr={test:t=>pr.test(t)||hr.test(t)||dr.test(t),parse:t=>pr.test(t)?pr.parse(t):dr.test(t)?dr.parse(t):hr.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?pr.transform(t):dr.transform(t)},vr=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const mr="number",gr="color",br="var",wr="var(",Sr="${}",_r=/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 kr(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(_r,(t=>(yr.test(t)?(r.color.push(i),o.push(gr),n.push(yr.parse(t))):t.startsWith(wr)?(r.var.push(i),o.push(br),n.push(t)):(r.number.push(i),o.push(mr),n.push(parseFloat(t))),++i,Sr))).split(Sr);return{values:n,split:a,indexes:r,types:o}}function xr(t){return kr(t).values}function Ar(t){const{split:e,types:n}=kr(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===mr?ar(t[i]):e===gr?yr.transform(t[i]):t[i]}return o}}const Or=t=>"number"==typeof t?0:t;const Er={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(sr))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(vr))||void 0===n?void 0:n.length)||0)>0},parse:xr,createTransformer:Ar,getAnimatableNone:function(t){const e=xr(t);return Ar(t)(e.map(Or))}},Tr=new Set(["brightness","contrast","saturate","opacity"]);function jr(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(sr)||[];if(!r)return t;const o=n.replace(r,"");let i=Tr.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const Pr=/\b([a-z-]*)\(.*?\)/gu,Cr={...Er,getAnimatableNone:t=>{const e=t.match(Pr);return e?e.map(jr).join(" "):t}},Ir={borderWidth:Vn,borderTopWidth:Vn,borderRightWidth:Vn,borderBottomWidth:Vn,borderLeftWidth:Vn,borderRadius:Vn,radius:Vn,borderTopLeftRadius:Vn,borderTopRightRadius:Vn,borderBottomRightRadius:Vn,borderBottomLeftRadius:Vn,width:Vn,maxWidth:Vn,height:Vn,maxHeight:Vn,top:Vn,right:Vn,bottom:Vn,left:Vn,padding:Vn,paddingTop:Vn,paddingRight:Vn,paddingBottom:Vn,paddingLeft:Vn,margin:Vn,marginTop:Vn,marginRight:Vn,marginBottom:Vn,marginLeft:Vn,backgroundPositionX:Vn,backgroundPositionY:Vn},Lr={rotate:Dn,rotateX:Dn,rotateY:Dn,rotateZ:Dn,scale:Mn,scaleX:Mn,scaleY:Mn,scaleZ:Mn,skew:Dn,skewX:Dn,skewY:Dn,distance:Vn,translateX:Vn,translateY:Vn,translateZ:Vn,x:Vn,y:Vn,z:Vn,perspective:Vn,transformPerspective:Vn,opacity:Rn,originX:Wn,originY:Wn,originZ:Vn},Nr={...Nn,transform:Math.round},Rr={...Ir,...Lr,zIndex:Nr,size:Vn,fillOpacity:Rn,strokeOpacity:Rn,numOctaves:Nr},Mr={...Rr,color:yr,backgroundColor:yr,outlineColor:yr,fill:yr,stroke:yr,borderColor:yr,borderTopColor:yr,borderRightColor:yr,borderBottomColor:yr,borderLeftColor:yr,filter:Cr,WebkitFilter:Cr},Fr=t=>Mr[t];function Dr(t,e){let n=Fr(t);return n!==Cr&&(n=Er),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Br=new Set(["auto","none","0"]);class Vr extends ir{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(),Pn(r))){const o=Ln(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!zn.has(n)||2!==t.length)return;const[r,o]=t,i=Jn(r),a=Jn(o);if(i!==a)if(Hn(i)&&Hn(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||An(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&&!Br.has(e)&&kr(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=Dr(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=Kn[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]=Kn[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 Gr;function Ur(){Gr=void 0}const Wr={now:()=>(void 0===Gr&&Wr.set(ln.isProcessing||en?ln.timestamp:performance.now()),Gr),set:t=>{Gr=t,queueMicrotask(Ur)}},zr=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Er.test(t)&&"0"!==t||t.startsWith("url(")));function Hr(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=zr(o,e),s=zr(i,e);return ae(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||Ce(n))&&r)}class $r{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=Wr.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||(or(),rr()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Wr.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!Hr(t,n,r,o)){if(nn||!i)return null==s||s(on(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 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],p={done:!1,value:f},h=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let d=n*e;const y=f+d,v=void 0===a?y:a(y);v!==y&&(d=v-f);const m=t=>-d*Math.exp(-t/r),g=t=>v+m(t),b=t=>{const e=m(t),n=g(t);p.done=Math.abs(e)<=c,p.value=p.done?v:n};let w,S;const _=t=>{var e;(e=p.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,S=we({keyframes:[p.value,h(p.value)],velocity:oe(g,t,p.value),damping:o,stiffness:i,restDelta:c,restSpeed:l}))};return _(0),{calculatedDuration:null,next:t=>{let e=!1;return S||void 0!==w||(e=!0,b(t),_(t)),void 0!==w&&t>=w?S.next(t-w):(!e&&b(t),p)}}}const Yr=yn(.42,0,1,1),Xr=yn(0,0,.58,1),Kr=yn(.42,0,.58,1),Zr=t=>Array.isArray(t)&&"number"==typeof t[0],Qr={linear:ie,easeIn:Yr,easeInOut:Kr,easeOut:Xr,circIn:_n,circInOut:xn,circOut:kn,backIn:bn,backInOut:wn,backOut:gn,anticipate:Sn},Jr=t=>{if(Zr(t)){se(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return yn(e,n,r,o)}return"string"==typeof t?(se(void 0!==Qr[t],`Invalid easing type '${t}'`),Qr[t]):t},to=(t,e)=>n=>e(t(n)),eo=(...t)=>t.reduce(to);function no(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 ro(t,e){return n=>n>0?e:t}const oo=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},io=[hr,pr,dr];function ao(t){const e=(n=t,io.find((t=>t.test(n))));var n;if(ae(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===dr&&(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=no(s,r,t+1/3),i=no(s,r,t),a=no(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 so=(t,e)=>{const n=ao(t),r=ao(e);if(!n||!r)return ro(t,e);const o={...n};return t=>(o.red=oo(n.red,r.red,t),o.green=oo(n.green,r.green,t),o.blue=oo(n.blue,r.blue,t),o.alpha=xe(n.alpha,r.alpha,t),pr.transform(o))},uo=new Set(["none","hidden"]);function co(t,e){return n=>xe(t,e,n)}function lo(t){return"number"==typeof t?co:"string"==typeof t?Pn(t)?ro:yr.test(t)?so:ho:Array.isArray(t)?fo:"object"==typeof t?yr.test(t)?so:po:ro}function fo(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>lo(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function po(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=lo(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const ho=(t,e)=>{const n=Er.createTransformer(e),r=kr(t),o=kr(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?uo.has(t)&&!o.values.length||uo.has(e)&&!r.values.length?function(t,e){return uo.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):eo(fo(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):(ae(!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.`),ro(t,e))};function yo(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return xe(t,e,n);return lo(t)(t,e)}function vo(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(se(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||yo,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]||ie:e;i=eo(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=Ae(t[n],t[n+1],e);return a[n](r)};return n?e=>u(ue(t[0],t[i-1],e)):u}function mo({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=Ne(r)?r.map(Jr):Jr(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Ee(e),t),s=vo(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||Kr)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const go=t=>{const e=({timestamp:e})=>t(e);return{start:()=>un.update(e,!0),stop:()=>cn(e),now:()=>ln.isProcessing?ln.timestamp:Wr.now()}},bo={decay:qr,inertia:qr,tween:mo,keyframes:mo,spring:we},wo=t=>t/100;class So extends $r{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)||ir;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=Ce(e)?e:bo[e]||mo;let s,u;a!==mo&&"number"!=typeof t[0]&&(s=eo(wo,yo(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=_e(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:p,repeatType:h,repeatDelay:d,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(p){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,p+1);Boolean(e%2)&&("reverse"===h?(n=1-n,d&&(n-=d/l)):"mirror"===h&&(b=i)),g=ue(0,1,n)*l}const w=m?{done:!1,value:s[0]}:b.next(g);a&&(w.value=a(w.value));let{done:S}=w;m||null===u||(S=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const _=null===this.holdTime&&("finished"===this.state||"running"===this.state&&S);return _&&void 0!==r&&(w.value=on(s,this.options,r)),y&&y(w.value),_&&this.finish(),w}get duration(){const{resolved:t}=this;return t?ee(t.calculatedDuration):0}get time(){return ee(this.currentTime)}set time(t){t=te(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=ee(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=go,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 _o=new Set(["opacity","clipPath","filter","transform"]),ko=(t,e)=>{let n="";const r=Math.max(Math.round(e/10),2);for(let e=0;e<r;e++)n+=t(Ae(0,r-1,e))+", ";return`linear(${n.substring(0,n.length-2)})`},xo={linearEasing:void 0};function Ao(t,e){const n=Zt(t);return()=>{var t;return null!==(t=xo[e])&&void 0!==t?t:n()}}const Oo=Ao((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function Eo(t){return Boolean("function"==typeof t&&Oo()||!t||"string"==typeof t&&(t in jo||Oo())||Zr(t)||Array.isArray(t)&&t.every(Eo))}const To=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,jo={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:To([0,.65,.55,1]),circOut:To([.55,0,1,.45]),backIn:To([.31,.01,.66,-.59]),backOut:To([.33,1.53,.69,.99])};function Po(t,e){return t?"function"==typeof t&&Oo()?ko(t,e):Zr(t)?To(t):Array.isArray(t)?t.map((t=>Po(t,e)||jo.easeOut)):jo[t]:void 0}function Co(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=Po(s,o);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"})}function Io(t,e){t.timeline=e,t.onfinish=null}const Lo=Zt((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const No={anticipate:Sn,backInOut:wn,circInOut:xn};class Ro extends $r{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new Vr(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("string"==typeof i&&Oo()&&i in No&&(i=No[i]),function(t){return Ce(t.type)||"spring"===t.type||!Eo(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new So({...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=Co(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(Io(l,this.pendingTimeline),this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(on(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 ee(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return ee(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=te(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 ie;const{animation:n}=e;Io(n,t)}else this.pendingTimeline=t;return ie}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 So({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=te(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 Lo()&&n&&_o.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=>{const s=Je(r,t)||{},u=s.delay||r.delay||0;let{elapsed:c=0}=r;c-=te(u);let l={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...s,delay:-c,onUpdate:t=>{e.set(t),s.onUpdate&&s.onUpdate(t)},onComplete:()=>{a(),s.onComplete&&s.onComplete()},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})(s)||(l={...l,...Qe(t,l)}),l.duration&&(l.duration=te(l.duration)),l.repeatDelay&&(l.repeatDelay=te(l.repeatDelay)),void 0!==l.from&&(l.keyframes[0]=l.from);let f=!1;if((!1===l.type||0===l.duration&&!l.repeatDelay)&&(l.duration=0,0===l.delay&&(f=!0)),(nn||tn)&&(f=!0,l.duration=0,l.delay=0),f&&!i&&void 0!==e.get()){const t=on(l.keyframes,s);if(void 0!==t)return un.update((()=>{l.onUpdate(t),l.onComplete()})),new Jt([])}return!i&&Ro.supports(l)?new Ro(l):new So(l)},Fo=t=>Array.isArray(t),Do=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Bo=t=>Fo(t)?t[t.length-1]||0:t;class Vo{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>Me(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 Go={current:void 0};class Uo{constructor(t,e={}){this.version="11.11.9",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=Wr.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=Wr.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 Vo);const n=this.events[t].add(e);return"change"===t?()=>{n(),un.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 Go.current&&Go.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Wr.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return ne(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 Wo(t,e){return new Uo(t,e)}function zo(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Ho(t,e,n,r){if("function"==typeof e){const[o,i]=zo(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]=zo(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function $o(t,e,n){const r=t.getProps();return Ho(r,e,void 0!==n?n:r.custom,t)}function qo(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Wo(n))}const Yo=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Xo="data-"+Yo("framerAppearId");function Ko(t){return t.props[Xo]}function Zo(t,e){if(!t.applyWillChange)return;const n=t.getValue("willChange");return r=n,Boolean(Te(r)&&r.add)?n.add(e):void 0;var r}function Qo({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Jo(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&&Qo(l,e))continue;const s={delay:n,...Je(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=Ko(t);if(n){const t=window.MotionHandoffAnimation(n,e,un);null!==t&&(s.startTime=t,f=!0)}}Zo(t,e),r.start(Mo(e,r,o,t.shouldReduceMotion&&Ye.has(e)?{type:!1}:s,t,f));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{un.update((()=>{s&&function(t,e){const n=$o(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)qo(t,e,Bo(i[e]))}(t,s)}))})),c}const ti={};function ei(t,{layout:e,layoutId:n}){return Ye.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!ti[t]||"opacity"===t)}function ni(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(Te(o[a])||e.style&&Te(e.style[a])||ei(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 ri(t,e,n){const r=ni(t,e,n);for(const n in t)if(Te(t[n])||Te(e[n])){r[-1!==qe.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const oi="undefined"!=typeof window,ii={current:null},ai={current:!1};function si(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function ui(t){return"string"==typeof t||Array.isArray(t)}const ci=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],li=["initial",...ci];function fi(t){return si(t.animate)||li.some((e=>ui(t[e])))}function pi(t){return Boolean(fi(t)||t.variants)}const hi={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"]},di={};for(const t in hi)di[t]={isEnabled:e=>hi[t].some((t=>!!e[t]))};const yi=[...Qn,yr,Er],vi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),mi=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class gi{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=ir,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=Wr.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,un.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=fi(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]&&Te(e)&&e.set(s[t],!1)}}mount(t){this.current=t,$e.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))),ai.current||function(){if(ai.current=!0,oi)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ii.current=t.matches;t.addListener(e),e()}else ii.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||ii.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){$e.delete(this.current),this.projection&&this.projection.unmount(),cn(this.notifyUpdate),cn(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=Ye.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&un.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 di){const e=di[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<mi.length;e++){const n=mi[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(Te(o))t.addValue(r,o);else if(Te(i))t.addValue(r,Wo(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,Wo(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}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=Wo(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&&(On(r)||An(r))?r=parseFloat(r):(o=r,!yi.find(Zn(o))&&Er.test(e)&&(r=Dr(t,e))),this.setBaseTarget(t,Te(r)?r.get():r)),Te(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=Ho(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||Te(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 Vo),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class bi extends gi{constructor(){super(...arguments),this.KeyframeResolver=Vr}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 wi=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Si={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},_i=qe.length;function ki(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(Ye.has(t))a=!0;else if(Tn(t))o[t]=n;else{const e=wi(n,Rr[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<_i;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=wi(s,Rr[a]);u||(o=!1,r+=`${Si[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 xi(t,e,n){return"string"==typeof t?t:Vn.transform(e+n*t)}const Ai={offset:"stroke-dashoffset",array:"stroke-dasharray"},Oi={offset:"strokeDashoffset",array:"strokeDasharray"};function Ei(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(ki(t,c,f),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:p,style:h,dimensions:d}=t;p.transform&&(d&&(h.transform=p.transform),delete p.transform),d&&(void 0!==o||void 0!==i||h.transform)&&(h.transformOrigin=function(t,e,n){return`${xi(e,t.x,t.width)} ${xi(n,t.y,t.height)}`}(d,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(p.x=e),void 0!==n&&(p.y=n),void 0!==r&&(p.scale=r),void 0!==a&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?Ai:Oi;t[i.offset]=Vn.transform(-r);const a=Vn.transform(e),s=Vn.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const Ti=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 ji(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 Pi(t,e,n,r){ji(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Ti.has(n)?n:Yo(n),e.attrs[n])}const Ci=t=>"string"==typeof t&&"svg"===t.toLowerCase();class Ii extends bi{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=vi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Ye.has(e)){const t=Fr(e);return t&&t.default||0}return e=Ti.has(e)?e:Yo(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return ri(t,e,n)}build(t,e,n){Ei(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Pi(t,e,0,r)}mount(t){this.isSVGTag=Ci(t.tagName),super.mount(t)}}function Li(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 Ni extends bi{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=ji}readValueFromInstance(t,e){if(Ye.has(e)){const t=Fr(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(Tn(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Li(t,e)}build(t,e,n){ki(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return ni(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Te(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class Ri extends gi{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function Mi(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 Ii(e):new Ni(e);n.mount(t),$e.set(t,n)}function Fi(t){const e=new Ri({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),$e.set(t,e)}function Di(t,e,n,r){const o=[];if(function(t,e){return Te(t)||"number"==typeof t||"string"==typeof t&&!je(e)}(t,e))o.push(function(t,e,n){const r=Te(t)?t:Wo(t);return r.start(Mo("",r,e,n)),r.animation}(t,je(e)&&e.default||e,n&&n.default||n));else{const i=Pe(t,e,r),a=i.length;se(Boolean(a),"No valid elements provided.");for(let t=0;t<a;t++){const r=i[t],s=r instanceof Element?Mi:Fi;$e.has(r)||s(r);const u=$e.get(r),c={...n};"delay"in c&&"function"==typeof c.delay&&(c.delay=c.delay(t,a)),o.push(...Jo(u,{...e,transition:c},{}))}}return o}function Bi(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r,o){const i=e.duration||.3,a=new Map,s=new Map,u={},c=new Map;let l=0,f=0,p=0;for(let n=0;n<t.length;n++){const a=t[n];if("string"==typeof a){c.set(a,f);continue}if(!Array.isArray(a)){c.set(a.name,Ie(f,a.at,l,c));continue}let[h,d,y={}]=a;void 0!==y.at&&(f=Ie(f,y.at,l,c));let v=0;const m=(t,n,r,a=0,s=0)=>{const u=Ue(t),{delay:c=0,times:l=Ee(u),type:h="keyframes",...d}=n;let{ease:y=e.ease||"easeOut",duration:m}=n;const g="function"==typeof c?c(a,s):c,b=u.length,w=Ce(h)?h:null==o?void 0:o[h];if(b<=2&&w){let t=100;if(2===b&&He(u)){const e=u[1]-u[0];t=Math.abs(e)}const e={...d};void 0!==m&&(e.duration=te(m));const n=ke(e,t,w);y=n.ease,m=n.duration}null!=m||(m=i);const S=f+g,_=S+m;1===l.length&&0===l[0]&&(l[1]=1);const k=l.length-u.length;k>0&&Oe(l,k),1===u.length&&u.unshift(null),Fe(r,u,y,l,S,_),v=Math.max(g+m,v),p=Math.max(_,p)};if(Te(h))m(d,y,Ge("default",Ve(h,s)));else{const t=Pe(h,d,r,u),e=t.length;for(let n=0;n<e;n++){const r=Ve(t[n],s);for(const t in d)m(d[t],We(y,t),Ge(t,r),n,e)}}l=f,f+=v}return s.forEach(((t,r)=>{for(const o in t){const i=t[o];i.sort(De);const s=[],u=[],c=[];for(let t=0;t<i.length;t++){const{at:e,value:n,easing:r}=i[t];s.push(n),u.push(Ae(0,p,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(Be)),1!==u[u.length-1]&&(u.push(1),s.push(null)),a.has(r)||a.set(r,{keyframes:{},transition:{}});const l=a.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:p,ease:c,times:u,...n}}})),a}(t,e,n,{spring:we});return o.forEach((({keyframes:t,transition:e},n)=>{r.push(...Di(n,t,e))})),r}const Vi=function(t,e,n){let r=[];var o;o=t,r=Array.isArray(o)&&Array.isArray(o[0])?Bi(t,e,Gi):Di(t,e,n,Gi);const i=new Jt(r);return Gi&&Gi.animations.push(i),i};var Gi;function Ui(t){return Ui="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},Ui(t)}function Wi(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Wi=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==Ui(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Ui(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 zi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=$i(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 Hi(t){return function(t){if(Array.isArray(t))return qi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$i(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 $i(t,e){if(t){if("string"==typeof t)return qi(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)?qi(t,e):void 0}}function qi(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 Yi(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,Ki(r.key),r)}}function Xi(t,e,n){return(e=Ki(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ki(t){var e=function(t,e){if("object"!=Ui(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ui(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ui(e)?e:e+""}var Zi=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())}))},Qi=Xi(Xi(Xi({},Dt,"25.33%"),Ft,"50%"),Bt,"75.66%"),Ji=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,Hi(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&&Yi(t.prototype,e),n&&Yi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r){var o=e.scope,i=e.overwrites,a=e.target;return Zi(this,void 0,void 0,Wi().mark((function e(){var s=this;return Wi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){Zi(s,void 0,void 0,Wi().mark((function s(){var u,c,l,f,p=this;return Wi().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||e(),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=zi(this.sequences),s.prev=4,f=Wi().mark((function e(){var r,s,u,c,f,h;return Wi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,s=r.props,u=r.options,c=k({},p.propToCSS(n,a.state)),o.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=o.current,Object.assign(f.style,c),a.state=t.mergeState(a.state,s),h=Vi(f,p.propToCSS(n,a.state,i),p.optionsToFramerMotionOptions(u)||{}),p.setControl(h),n.logger.debug("Animating",p.propToCSS(n,a.state,i)),!1!==(null==u?void 0:u.sync)){e.next=14;break}h.then((function(){Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null)})),e.next=18;break;case 14:return e.next=16,new Promise((function(t){return h.then((function(){return t()}))}));case 16:Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null);case 18: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,j(2);case 24:this.setControl(null),e(),r&&r(a.state);case 27:case"end":return s.stop()}}),s,this,[[4,13,16,19]])})))})));case 1: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{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}},fontColor:function(t){return"string"==typeof t?{color:t}:{color:O(t)}}},c={};for(var l in c.transform=t.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:"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 Yt.isCommonPositionType(t)||Xt.isCoord2DPosition(t)||Kt.isAlignPosition(t)}},{key:"left",value:function(e,n){return new t({position:Yt.Positions.Left},{duration:e,ease:n})}},{key:"right",value:function(e,n){return new t({position:Yt.Positions.Right},{duration:e,ease:n})}},{key:"center",value:function(e,n){return new t({position:Yt.Positions.Center},{duration:e,ease:n})}},{key:"positionToCSS",value:function(t,e,n){return t?qt.isRawPosition(t)?qt.D2PositionToCSS(qt.rawPositionToCoord2D(t),n,e):qt.D2PositionToCSS(t.toCSS(),n,e):{}}},{key:"backgroundToCSS",value:function(t){return null==t?{}:au.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:O(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?qt.mergePosition(qt.tryParsePosition(t),qt.tryParsePosition(e)):qt.toCoord2D(qt.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},k(t,e)),{position:n})}},{key:"propToCSSTransform",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.translate,i=void 0===o?[]:o,a=r.scale,s=void 0===a?1:a;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var u=void 0!==e.scale?e.scale:1,c=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},l=c.invertY,f=c.invertX;return["translate(".concat(i[0]||(f?"":"-")+"50%",", ").concat(i[1]||(l?"":"-")+"50%",")"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)"),"scale(".concat(u*s,")")].filter(Boolean).join(" ")}}])}();function ta(t){return ta="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},ta(t)}function ea(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,na(r.key),r)}}function na(t){var e=function(t,e){if("object"!=ta(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ta(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ta(e)?e:e+""}Ji.defaultSequenceOptions={sync:!0,repeat:1},Ji.defaultOptions={duration:0,ease:"linear"},Ji.CommonImagePositionMap=Qi;var ra=function(){return function(t,e,n){return e&&ea(t.prototype,e),n&&ea(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.id=""}),[{key:"setId",value:function(t){this.id=t}},{key:"getId",value:function(){return this.id}},{key:"reset",value:function(){}},{key:"fromData",value:function(t){return this}},{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.setChild(r.contentNode))}return t}}])}();function oa(t){return oa="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},oa(t)}function ia(t){return function(t){if(Array.isArray(t))return ca(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ua(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 aa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=ua(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 sa(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)||ua(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 ua(t,e){if(t){if("string"==typeof t)return ca(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)?ca(t,e):void 0}}function ca(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 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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==oa(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(oa(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 fa(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,pa(r.key),r)}}function pa(t){var e=function(t,e){if("object"!=oa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=oa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==oa(e)?e:e+""}function ha(t,e,n){return e=ma(e),function(t,e){if(e&&("object"==oa(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,da()?Reflect.construct(e,n||[],ma(t).constructor):e.apply(t,n))}function da(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(da=function(){return!!t})()}function ya(t,e,n,r){var o=va(ma(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function va(){return va="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ma(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}},va.apply(null,arguments)}function ma(t){return ma=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ma(t)}function ga(t,e){return ga=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ga(t,e)}var ba,wa=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())}))},Sa=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ha(this,e,arguments)}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&&ga(t,e)}(e,t),function(t,e,n){return e&&fa(t.prototype,e),n&&fa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAllActions",value:function(t,e){return wa(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),t.logger.debug("Control - Next Action",n),n){e.next=4;break}return e.abrupt("return",0);case 4:if(!x.isAwaitable(n)){e.next=16;break}return e.next=7,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 7:if(r=e.sent,!(i=r.node)){e.next=13;break}o=i.action,e.next=14;break;case 13:return e.abrupt("return",0);case 14:e.next=17;break;case 16:o=n;case 17: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 wa(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),!x.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.getChild()}),t.stage.next()})),n):ya(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n=this,r=sa(this.contentNode.getContent(),1)[0];if(this.type===a.do){var o=new x((function(t){return t}));return this.execute(t,o,r)}if(this.type===a.doAsync)return wa(n,void 0,void 0,la().mark((function e(){return la().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,r[0]);case 3:case"end":return e.stop()}}),e,this)}))),ya(e,"executeAction",this,3)([t]);if(this.type===a.any){var i=new x((function(t){return t})),s=r.map((function(e){return n.executeSingleAction(t,e)}));return Promise.any(s).then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if(this.type===a.all){var u=new x((function(t){return t}));return wa(n,void 0,void 0,la().mark((function e(){var n=this;return la().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(r.map((function(e){return n.executeSingleAction(t,e)})));case 2:u.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 4:case"end":return e.stop()}}),e,this)}))),u}if(this.type===a.allAsync)return wa(n,void 0,void 0,la().mark((function e(){var n,o,i;return la().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=aa(r);try{for(n.s();!(o=n.n()).done;)i=o.value,this.executeSingleAction(t,i).then((function(t){}))}catch(t){n.e(t)}finally{n.f()}case 2:case"end":return e.stop()}}),e,this)}))),ya(e,"executeAction",this,3)([t]);if(this.type===a.repeat){var c=sa(this.contentNode.getContent(),2),l=c[0],f=c[1],p=new x((function(t){return t}));return wa(n,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<f)){e.next=8;break}if(!(l.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,l[0]);case 5:n++,e.next=1;break;case 8:p.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 10:case"end":return e.stop()}}),e,this)}))),p}if(this.type===a.sleep){var h=new x((function(t){return t})),d=sa(this.contentNode.getContent(),2)[1];return new Promise((function(t){"number"==typeof d?setTimeout((function(){t()}),d):x.isAwaitable(d)?d.then(t):null==d||d.then(t)})).then((function(){h.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),h}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(t){var n=this.contentNode.getContent()[0],r=ya(e,"getFutureActions",this,3)([t]);return[].concat(ia(n),ia(r))}}])}(J);function _a(t){return _a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_a(t)}function ka(t){return function(t){if(Array.isArray(t))return xa(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 xa(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)?xa(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 xa(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 Aa(t,e,n){return e=Ea(e),function(t,e){if(e&&("object"==_a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Oa()?Reflect.construct(e,n||[],Ea(t).constructor):e.apply(t,n))}function Oa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Oa=function(){return!!t})()}function Ea(t){return Ea=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ea(t)}function Ta(t,e){return Ta=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ta(t,e)}function ja(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pa(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 Ca(t,e,n){return e&&Pa(t.prototype,e),n&&Pa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ia(t){var e=function(t,e){if("object"!=_a(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_a(e)?e:e+""}Sa.ActionTypes=a;var La=Symbol("_Chained"),Na=function(){function t(e){ja(this,t),this[ba]=!0,this.__actions=[],this.__self=e}return Ca(t,[{key:"push",value:function(){var t;(t=this.__actions).push.apply(t,arguments)}},{key:"getActions",value:function(){return this.__actions}},{key:"getSelf",value:function(){return this.__self}},{key:"newChain",value:function(){return this.getSelf().chain()}}],[{key:"isChained",value:function(t){return t&&t[La]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();ba=La;var Ra=function(t){function e(){return ja(this,e),Aa(this,e,arguments)}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&&Ta(t,e)}(e,t),Ca(e,[{key:"chain",value:function(t){var e=Na.isChained(this)?this:this.proxy(this,new Na(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,ka(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}},{key:"combineActions",value:function(t,e){var n=e(this.chain().newChain()),r=new Sa(t.chain(),Sa.ActionTypes.do,(new Mt).setContent([this.construct(Na.toActions([n]))]));return this.chain(r)}}])}(ra);function Ma(t){return Ma="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},Ma(t)}function Fa(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,Da(r.key),r)}}function Da(t){var e=function(t,e){if("object"!=Ma(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ma(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ma(e)?e:e+""}function Ba(t,e,n){return e=Ga(e),function(t,e){if(e&&("object"==Ma(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,Va()?Reflect.construct(e,n||[],Ga(t).constructor):e.apply(t,n))}function Va(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Va=function(){return!!t})()}function Ga(t){return Ga=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ga(t)}function Ua(t,e){return Ua=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ua(t,e)}var Wa=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ba(this,e)}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&&Ua(t,e)}(e,t),function(t,e,n){return e&&Fa(t.prototype,e),n&&Fa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromChained",value:function(t){return t.getActions()}}])}(Ra);function za(t){return za="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},za(t)}function Ha(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,$a(r.key),r)}}function $a(t){var e=function(t,e){if("object"!=za(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=za(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==za(e)?e:e+""}function qa(t,e,n){return e=Xa(e),function(t,e){if(e&&("object"==za(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,Ya()?Reflect.construct(e,n||[],Xa(t).constructor):e.apply(t,n))}function Ya(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ya=function(){return!!t})()}function Xa(t){return Xa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xa(t)}function Ka(t,e){return Ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ka(t,e)}var Za=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),qa(this,e)}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&&Ka(t,e)}(e,t),function(t,e,n){return e&&Ha(t.prototype,e),n&&Ha(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(Sa.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(Sa.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(Sa.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(Sa.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(Sa.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(Sa.ActionTypes.repeat,e,t)}},{key:"sleep",value:function(t){return this.push(Sa.ActionTypes.sleep,[],t)}},{key:"push",value:function(t,e){for(var n=Na.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 Sa(this.chain(),t,(new Mt).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)}},{key:"sleep",value:function(t){return(new e).sleep(t)}}])}(Wa);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 Ja(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,ts(r.key),r)}}function ts(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 es(t,e,n){return e=is(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,ns()?Reflect.construct(e,n||[],is(t).constructor):e.apply(t,n))}function ns(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ns=function(){return!!t})()}function rs(t,e,n,r){var o=os(is(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function os(){return os="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=is(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}},os.apply(null,arguments)}function is(t){return is=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},is(t)}function as(t,e){return as=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},as(t,e)}var ss=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),es(this,e,arguments)}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&&as(t,e)}(e,t),function(t,e,n){return e&&Ja(t.prototype,e),n&&Ja(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=t.getLastSceneIfNot();if(this.type===u.layerMoveUp)return t.moveUpElement(n,this.callee),t.stage.update(),rs(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveDown)return t.moveDownElement(n,this.callee),t.stage.update(),rs(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveTop)return t.moveTopElement(n,this.callee),t.stage.update(),rs(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveBottom)return t.moveBottomElement(n,this.callee),t.stage.update(),rs(e,"executeAction",this,3)([t]);throw this.unknownTypeError()}}])}(J);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 cs(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,ls(r.key),r)}}function ls(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 fs(t,e,n){return e=hs(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,ps()?Reflect.construct(e,n||[],hs(t).constructor):e.apply(t,n))}function ps(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ps=function(){return!!t})()}function hs(t){return hs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hs(t)}function ds(t,e){return ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ds(t,e)}ss.ActionTypes=u;var ys=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),fs(this,e,arguments)}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&&ds(t,e)}(e,t),function(t,e,n){return e&&cs(t.prototype,e),n&&cs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"layerMoveUp",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveUp))}},{key:"layerMoveDown",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveDown))}},{key:"layerMoveTop",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveTop))}},{key:"layerMoveBottom",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveBottom))}},{key:"constructLayerAction",value:function(t,e){return new ss(t,e,new Mt)}}])}(Wa);function vs(t){return vs="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},vs(t)}function ms(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=bs(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 gs(t){return function(t){if(Array.isArray(t))return ws(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||bs(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 bs(t,e){if(t){if("string"==typeof t)return ws(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)?ws(t,e):void 0}}function ws(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 Ss(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _s(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,xs(r.key),r)}}function ks(t,e,n){return e&&_s(t.prototype,e),n&&_s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function xs(t){var e=function(t,e){if("object"!=vs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=vs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vs(e)?e:e+""}function As(t,e,n){return e=Es(e),function(t,e){if(e&&("object"==vs(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,Os()?Reflect.construct(e,n||[],Es(t).constructor):e.apply(t,n))}function Os(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Os=function(){return!!t})()}function Es(t){return Es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Es(t)}function Ts(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&&js(t,e)}function js(t,e){return js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},js(t,e)}ys.EventTypes={"event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"};var Ps=function(t){function e(){var t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;return Ss(this,e),(t=As(this,e)).events=new E,t.ref=void 0,t.name=r.name||"(anonymous)",t.config=k(e.defaultConfig,r,{tag:o||r.tag,position:r.position?qt.tryParsePosition(r.position):new Yt(Rt.Center),currentTags:(null===(n=r.tag)||void 0===n?void 0:n.defaults)?gs(r.tag.defaults):null}),t.state=k({},t.config),t.checkConfig(t.config),t}return Ts(e,t),ks(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this.chain(this._init())}},{key:"checkConfig",value:function(t){var e;if(!Ji.isPosition(t.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");if(_(t.src)===_.DataTypes.string&&t.tag)throw this._mixedSrcError();if(!t.src&&!t.tag)throw this._srcNotSpecifiedError();var n,r=ms(t.wearables);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(!o.config.isWearable)throw this._invalidWearableError(JSON.stringify(o.config))}}catch(t){r.e(t)}finally{r.f()}if(t.tag){var i,a=new Set,s=ms(t.tag.groups);try{for(s.s();!(i=s.n()).done;){var u,c=ms(i.value);try{for(c.s();!(u=c.n()).done;){var l=u.value;if(a.has(l))throw this._invalidTagGroupDefinitionError();a.add(l)}}catch(t){c.e(t)}finally{c.f()}}}catch(t){s.e(t)}finally{s.f()}}if(t.tag){var f,p=this.constructTagMap(t.tag.groups),h=new Set,d=ms(t.tag.defaults);try{for(d.s();!(f=d.n()).done;){var y=f.value;if(h.has(y))throw new Error('Tag conflict\nTag "'.concat(y,'" is conflicting with another tag\nError found in config.tag.defaults'));if(!p.has(y))throw new Error('Tag not found\nTag "'.concat(y,'" is not defined in tagDefinitions\nError found in config.tag.defaults'));null===(e=p.get(y))||void 0===e||e.forEach((function(t){return h.add(t)}))}}catch(t){d.e(t)}finally{d.f()}}return this}},{key:"setSrc",value:function(t,e){var n=this;return this.combineActions(new Za,(function(r){return n._setSrc(r,t,e)}))}},{key:"setAppearance",value:function(t,e){var n=this;return this.combineActions(new Za,(function(r){var o=new Hs(r,Hs.ActionTypes.setAppearance,(new Mt).setContent([t,null==e?void 0:e.copy()]));return r.chain(o).chain(n._flush())}))}},{key:"applyTransform",value:function(t){var e=this;return this.combineActions(new Za,(function(n){var r=new Hs(n,Hs.ActionTypes.applyTransform,(new Mt).setContent([void 0,t.copy(),T()]));return n.chain(r).chain(e._flush())}))}},{key:"show",value:function(t){var e=this,n=t instanceof Ji?t.copy():new Ji([{props:{opacity:1},options:t||{}}]);return this.combineActions(new Za,(function(t){var r=new Hs(t,Hs.ActionTypes.show,(new Mt).setContent([void 0,n]));return t.chain(r).chain(e._flush())}))}},{key:"hide",value:function(t){var e=this;return this.combineActions(new Za,(function(n){var r=new Hs(n,Hs.ActionTypes.hide,(new Mt).setContent([void 0,t instanceof Ji?t.copy():new Ji([{props:{opacity:0},options:t||{}}])]));return n.chain(r).chain(e._flush())}))}},{key:"addWearable",value:function(t){var e,n=ms(Array.isArray(t)?t:[t]);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.config.wearables.push(r),r.config.isWearable=!0}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"bindWearable",value:function(t){return t.addWearable([this]),this}},{key:"toTransform",value:function(){return new Ji(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.config)}},{key:"toData",value:function(){return this.state.disposed||P(this.state,this.config)?null:{state:k({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=k(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_applyTransition",value:function(t){return this.chain(new Hs(this.chain(),"image:applyTransition",(new Mt).setContent([t])))}},{key:"_init",value:function(t){return new Hs(this.chain(),Hs.ActionTypes.init,(new Mt).setContent([t]))}},{key:"_initWearable",value:function(t){return new Hs(this.chain(),Hs.ActionTypes.initWearable,(new Mt).setContent([t]))}},{key:"_flush",value:function(){return new Hs(this.chain(),Hs.ActionTypes.flush,new Mt)}},{key:"reset",value:function(){this.state=k({},this.config)}},{key:"toDisplayableTransform",value:function(){return new Ji(this.state,{duration:0})}},{key:"getTransformState",value:function(){return{position:this.state.position,scale:this.state.scale,rotation:this.state.rotation,opacity:this.state.opacity,display:this.state.display}}},{key:"resolveTags",value:function(t,e){if(!this.state.tag)throw new Error("Tag not defined\nTag must be defined in the image config");var n=this.constructTagMap(this.state.tag.groups),r=new Set,o=function(t){var e,o=ms(t);try{for(o.s();!(e=o.n()).done;){var i=e.value,a=n.get(i);if(a){var s,u=ms(a);try{for(u.s();!(s=u.n()).done;){var c=s.value;r.delete(c)}}catch(t){u.e(t)}finally{u.f()}r.add(i)}}}catch(t){o.e(t)}finally{o.f()}};return o(t),o(e),Array.from(r)}},{key:"_mixedSrcError",value:function(){throw new TypeError("To better understand the behavior of the image, you cannot mix src and tags in the same image. If you are using tags, remove the src from the image config and do not use setSrc method. If you are using src, remove the tags from the image config and do not use setAppearance method.")}},{key:"_invalidSrcHandlerError",value:function(){throw new Error("Invalid src handler, If you are using tags, config.src must be a function that resolves the src from the tags. If you are using src, config.src must be a string or StaticImageData")}},{key:"_srcNotSpecifiedError",value:function(){throw new TypeError("Src not specified\nPlease provide a src or tags in the image config")}},{key:"_invalidWearableError",value:function(t){throw new Error("Invalid wearable\nWearable must be an Image with isWearable set to true\nIt seems like you are trying to add a non-wearable image to wearables\nImage below violates the rule:\n"+t)}},{key:"_invalidTagGroupDefinitionError",value:function(){throw new Error("Invalid tag group definition. Tags in groups must be unique and not conflicting with each other.")}},{key:"constructTagMap",value:function(t){var e,n=new Map,r=ms(t);try{for(r.s();!(e=r.n()).done;){var o,i=e.value,a=ms(i);try{for(a.s();!(o=a.n()).done;){var s=o.value;n.set(s,i)}}catch(t){a.e(t)}finally{a.f()}}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"_setSrc",value:function(t,e,n){if(n){var r=n.copy();r.setSrc(au.srcToString(e)),t._transitionSrc(r)}var o=new Hs(t,Hs.ActionTypes.setSrc,(new Mt).setContent(["string"==typeof e?e:au.staticImageDataToSrc(e)]));return t.chain(o).chain(this._flush())}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new Hs(this.chain(),Hs.ActionTypes.dispose,new Mt))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return qt.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 qt.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}},{key:"getSrc",value:function(t){if("string"==typeof t.src||au.isStaticImageData(t.src)){var n=t.src;return au.isStaticImageData(n)?au.staticImageDataToSrc(n):n}var r=t.src,o=t.currentTags;if(!o)throw new Error("Tags not resolved\nTags must be resolved before getting the src");return e.getSrcFromTags(o,r)}},{key:"getSrcFromTags",value:function(t,e){return e.apply(void 0,gs(t))}},{key:"fromSrc",value:function(t){return new e({src:t})}}])}(ys);Ps.EventTypes=Object.assign(Object.assign({},ys.EventTypes),{"event:wearable.create":"event:wearable.create"}),Ps.DefaultImagePlaceholder="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",Ps.defaultConfig={display:!1,position:new Yt(Rt.Center),scale:1,rotation:0,opacity:0,isWearable:!1,wearables:[],src:Ps.DefaultImagePlaceholder,currentTags:null,autoInit:!0};var Cs=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ss(this,e),(t=As(this,e)).name=n.name||"(anonymous [virtual image proxy])",t.config.opacity=1,t.state.opacity=1,t}return Ts(e,t),ks(e,[{key:"checkConfig",value:function(t){return this}}])}(Ps);function Is(t){return Is="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},Is(t)}function Ls(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 Ns(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)?Ns(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 Ns(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 Rs(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Rs=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==Is(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Is(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 Ms(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"!=Is(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Is(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Is(e)?e:e+""}function Ds(t,e,n){return e=Us(e),function(t,e){if(e&&("object"==Is(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||[],Us(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 Vs(t,e,n,r){var o=Gs(Us(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Gs(){return Gs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Us(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}},Gs.apply(null,arguments)}function Us(t){return Us=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Us(t)}function Ws(t,e){return Ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ws(t,e)}var zs=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())}))},Hs=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ds(this,e,arguments)}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&&Ws(t,e)}(e,t),function(t,e,n){return e&&Ms(t.prototype,e),n&&Ms(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var r=this,o=Object.create(null,{executeAction:{get:function(){return Vs(e,"executeAction",r,1)}},unknownTypeError:{get:function(){return Vs(e,"unknownTypeError",r,1)}}});if(this.type===n.init){if(this.callee.config.isWearable)throw new Error("Cannot init wearable image with init action\nIt seems like you are trying to init a wearable image with an init action, or use this wearable image without parent.");var i=t.findElementByDisplayable(this.callee);i&&t.disposeImage(this.callee,i.scene);var a=this.contentNode.getContent()[0];return t.createImage(this.callee,a),this.resolveAwaitable((function(e){return zs(r,void 0,void 0,Rs().mark((function n(){return Rs().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:displayable.init");case 2:e(o.executeAction.call(this,t)),t.stage.next();case 4:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.initWearable){var s=Ls(this.contentNode.getContent(),1)[0];return this.resolveAwaitable((function(e){return zs(r,void 0,void 0,Rs().mark((function n(){return Rs().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:wearable.create",s);case 2:return n.next=4,s.events.any("event:displayable.init");case 4:e(o.executeAction.call(this,t)),t.stage.next();case 6:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.setSrc){if(this.callee.state.tag)throw this.callee._mixedSrcError();return this.callee.state.src=this.contentNode.getContent()[0],t.logger.debug("Image - Set Src",this.callee.state.src),t.stage.update(),o.executeAction.call(this,t)}if([n.show,n.hide,n.applyTransform].includes(this.type)){var u=new x((function(t){return t})).registerSkipController(new C((function(){return r.type===n.hide&&(r.callee.state.display=!1),o.executeAction.call(r,t)}))),c=this.contentNode.getContent()[1];return this.type===n.show&&(this.callee.state.display=!0,t.stage.update()),t.animateImage(Ps.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){var t;r.type===n.hide&&(r.callee.state.display=!1),u.resolve({type:r.type,node:null===(t=r.contentNode)||void 0===t?void 0:t.getChild()})})),u}if(this.type===n.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),o.executeAction.call(this,t);if(this.type===n.applyTransition){var l=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}}))),f=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",f).then((function(){l.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),l}if(this.type===n.flush)return o.executeAction.call(this,t);if(this.type===n.setAppearance){var p=Ls(this.contentNode.getContent(),2),h=p[0],d=p[1];if(!this.callee.state.tag||!this.callee.state.currentTags)throw this.callee._srcNotSpecifiedError();var y=this.callee.resolveTags(this.callee.state.currentTags,h),v=Ps.getSrcFromTags(y,this.callee.state.src);if(t.logger.debug("Image - Set Appearance",y,v),d){var m=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}})));d.setSrc(v),this.callee.events.any("event:displayable.applyTransition",d).then((function(){r.callee.state.currentTags=y,m.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()}))}return this.callee.state.currentTags=y,o.executeAction.call(this,t)}throw o.unknownTypeError.call(this)}}])}(J);function $s(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 Ys(t,e,n){return e=Js(e),function(t,e){if(e&&("object"==tu(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,Zs()?Reflect.construct(e,n||[],Js(t).constructor):e.apply(t,n))}function Xs(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&&Qs(t,e)}function Ks(t){var e="function"==typeof Map?new Map:void 0;return Ks=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(Zs())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&Qs(o,n.prototype),o}(t,arguments,Js(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Qs(n,t)},Ks(t)}function Zs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Zs=function(){return!!t})()}function Qs(t,e){return Qs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qs(t,e)}function Js(t){return Js=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Js(t)}function tu(t){return tu="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},tu(t)}function eu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nu(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,ou(r.key),r)}}function ru(t,e,n){return e&&nu(t.prototype,e),n&&nu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ou(t){var e=function(t,e){if("object"!=tu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tu(e)?e:e+""}Hs.ActionTypes=n;var iu=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;eu(this,t),this.r=e,this.g=n,this.b=r,this.a=o}return ru(t,[{key:"toString",value:function(){return"rgba(".concat(this.r,", ").concat(this.g,", ").concat(this.b,", ").concat(this.a,")")}},{key:"toHex",value:function(){return"#"+this.r.toString(16)+this.g.toString(16)+this.b.toString(16)}},{key:"toImageColor",value:function(){return{r:this.r,g:this.g,b:this.b,a:this.a}}}],[{key:"isHexString",value:function(t){return"string"==typeof t&&/^#[0-9A-F]{6}$/i.test(t)}},{key:"fromHex",value:function(e){var n=e.slice(1);return new t(parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1)}}])}(),au=function(){function t(){eu(this,t)}return ru(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)&&"string"==typeof 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://")}},{key:"isImageSrc",value:function(e){return"string"==typeof e&&!this.isHexString(e)||t.isStaticImageData(e)}},{key:"isImageColor",value:function(e){return t.isHexString(e)||t.isPlainColor(e)}},{key:"isPlainColor",value:function(t){return t&&("string"==typeof t||"object"===tu(t)&&"r"in t&&"g"in t&&"b"in t)}},{key:"isHexString",value:function(t){return"string"==typeof t&&/^#([0-9A-F]{6}|[0-9A-F]{3})$/i.test(t)}},{key:"toBackgroundSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"toHex",value:function(t){return O(t)}}])}();au.RGBColor=iu;var su,uu=function(t){function e(t,n){return eu(this,e),Ys(this,e,[t,{info:n},"StaticScriptWarning"])}return Xs(e,t),ru(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 eu(this,e),(r=Ys(this,e,[t])).props=n,r.name=o,r}return Xs(e,t),ru(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(Ks(Error))),cu=function(){return ru((function t(e){eu(this,t),this.scene=e}),[{key:"run",value:function(t){var e=new Map,n=new Map,r=[],o=new Set,i=this.scene.getAllChildren(t,this.scene.getSceneRoot());if(!i.length)return null;for(r.push(i[0]);r.length;){var a=r.shift();this.checkAction(t,a,{imageStates:e,scenes:n},o);var s=a.contentNode.getChild();s&&s.action&&r.push(s.action)}return e}},{key:"checkAction",value:function(t,n,r,o){var i=r.imageStates,a=r.scenes;if(n instanceof Hs)i.has(n.callee)||i.set(n.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(i.get(n.callee),n);else if(n instanceof xt){var s=n.callee;if(a.has(s.name)){if(a.get(s.name)!==s){var u="Scene with name: ".concat(s.name," is duplicated\nScene: ").concat(s.name,"\n\nAt: ").concat(n.__stack);throw new uu(u)}}else a.set(s.name,s);if(n.type===e.jumpTo){var c=n.contentNode.getContent()[0],l=t.getScene(c,!0);if(o.has(l))return;o.add(l)}}}},{key:"checkImage",value:function(t,e){if(e.type===n.dispose){if(t.isDisposed){var r="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 uu(r)}t.isDisposed=!0}else if([n.init,n.show,n.hide,n.applyTransform,n.applyTransition].includes(e.type)){if(t.isDisposed){var o="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new uu(o)}}else if(e.type===n.setSrc){var i=e.contentNode.getContent()[0];au.isExternalSrc(i)&&(t.usedExternalSrc=!0)}}}])}(),lu=function(t){function e(t,n){var r;return eu(this,e),(r=Ys(this,e,[e.toMessage(t,n)])).name="RuntimeScriptError",r}return Xs(e,t),ru(e,null,[{key:"toMessage",value:function(t,n){var r=[];return r.push.apply(r,$s(Array.isArray(t)?t:[t])),n&&r.push.apply(r,$s(Array.isArray(n)?n.map(e.getActionTrace):[e.getActionTrace(n)])),r.join("")}},{key:"getActionTrace",value:function(t){return"\nUsing action (id: ".concat(t.getId(),")")+"\n at: ".concat(t.__stack)}}])}(Ks(Error)),fu=function(t){function e(t){var n;return eu(this,e),(n=Ys(this,e,[t])).name="RuntimeGameError",n}return Xs(e,t),ru(e)}(Ks(Error));function pu(t){return pu="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},pu(t)}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,du(r.key),r)}}function du(t){var e=function(t,e){if("object"!=pu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pu(e)?e:e+""}function yu(t,e,n){return e=mu(e),function(t,e){if(e&&("object"==pu(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,vu()?Reflect.construct(e,n||[],mu(t).constructor):e.apply(t,n))}function vu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vu=function(){return!!t})()}function mu(t){return mu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mu(t)}function gu(t,e){return gu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gu(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(su||(su={}));var bu=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=yu(this,e)).state={playing:null,token:null},t.config=k(e.defaultConfig,"string"==typeof n?{src:n}: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&&gu(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:"play",value:function(){if(this.config.type===su.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(ft.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===su.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(ft.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===su.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(ft.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(ft.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(ft.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(ft.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(ft.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(t){return Object.assign({src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1},t||{})}},{key:"getSrc",value:function(){return this.config.src}},{key:"getToken",value:function(){return this.state.token||void 0}},{key:"getPlaying",value:function(){return this.state.playing}},{key:"setToken",value:function(t){this.state.token=void 0===t?null:t}},{key:"setPlaying",value:function(t){return this.state.playing=t,this}},{key:"toData",value:function(){return P(this.config,e.defaultConfig)?null:{config:A(this.config)}}},{key:"fromData",value:function(t){return this.config=k(this.config,t.config),this}},{key:"reset",value:function(){var t;null===(t=this.state.playing)||void 0===t||t.stop(),this.state.playing=null,this.state.token=null}},{key:"pushAction",value:function(t,e){return this.chain(new ft(this.chain(),t,(new Mt).setContent(e)))}}],[{key:"toSoundSrc",value:function(t){return null==t?null:"string"==typeof t?t:t.getSrc()}},{key:"toSound",value:function(t){return null==t?null:"string"==typeof t?new e({src:t}):t}}])}(Wa);function wu(t){return wu="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},wu(t)}function Su(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,_u(r.key),r)}}function _u(t){var e=function(t,e){if("object"!=wu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=wu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==wu(e)?e:e+""}bu.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var ku=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e}return function(t,e,n){return e&&Su(t.prototype,e),n&&Su(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"from",value:function(e){return t.isPauseConstructor(e)?new t:e}},{key:"wait",value:function(e){return new t({duration:e})}},{key:"isPause",value:function(e){return this.isPauseConstructor(e)||e instanceof t}},{key:"isPauseConstructor",value:function(e){return e===t}}])}();function xu(t){return xu="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},xu(t)}function Au(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,Ou(r.key),r)}}function Ou(t){var e=function(t,e){if("object"!=xu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=xu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xu(e)?e:e+""}var Eu=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=e,this.config=k(t.defaultConfig,n)}return function(t,e,n){return e&&Au(t.prototype,e),n&&Au(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"evaluate",value:function(e){var n=this;if(ku.isPause(this.text))return[this];if("function"==typeof this.text){var r=this.text(e);return Array.isArray(r)?r.map((function(r){return t.isWord(r)?r.inherit(n.config).evaluate(e):new t(r,n.config)})).flat():t.isWord(r)?r.inherit(this.config).evaluate(e):[new t(r,this.config)]}return[this]}},{key:"inherit",value:function(t){return this.config.color=this.config.color||t.color,this.config.italic=this.config.italic||t.italic,this.config.bold=this.config.bold||t.bold,this}},{key:"copy",value:function(){return new t(this.text,this.config)}},{key:"isPause",value:function(){return ku.isPause(this.text)}},{key:"toString",value:function(){return"string"==typeof this.text?this.text:""}}],[{key:"isWord",value:function(e){return e instanceof t}},{key:"color",value:function(e,n){return t.isWord(e)?e.copy().inherit({color:n}):new t(e,{color:n})}},{key:"bold",value:function(e){return t.isWord(e)?e.copy().inherit({bold:!0}):new t(e,{bold:!0})}},{key:"italic",value:function(e){return t.isWord(e)?e.copy().inherit({italic:!0}):new t(e,{italic:!0})}},{key:"getText",value:function(t){return t.filter((function(t){return!t.isPause()})).map((function(t){return t.toString()})).join("")}}])}();function Tu(t){return Tu="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},Tu(t)}function ju(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 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"!=Tu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Tu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Tu(e)?e:e+""}Eu.defaultConfig={},Eu.defaultColor="#000";var Lu=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=t.format(e),this.config=k(t.defaultConfig,Object.assign(Object.assign({},n),{voice:bu.toSound(n.voice)})),this.state=A(t.defaultState)}return function(t,e,n){return e&&Cu(t.prototype,e),n&&Cu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"toData",value:function(){return P(this.state,t.defaultState)?null:{state:A(this.state)}}},{key:"fromData",value:function(t){return this.state=k(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}},{key:"setCharacter",value:function(t){return this.config.character=t,this}},{key:"evaluate",value:function(e){for(var n=[],r=0;r<this.text.length;r++){var o=this.text[r].evaluate(e);n.push.apply(n,ju(t.formatStaticWord(o)))}return n}},{key:"copy",value:function(){return new t(ju(this.text),this.config)}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(e)}},{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)e.push(this.formatWord(t[n]));else e.push(this.formatWord(t));return e}},{key:"formatWord",value:function(t){return Eu.isWord(t)?t:new Eu(t)}},{key:"formatStaticWord",value:function(t,e){var n=this;return Array.isArray(t)?t.map((function(t){return n.formatStaticWord(t,e)})).flat(2):[Eu.isWord(t)?t:new Eu(t,e)]}},{key:"isSentencePrompt",value:function(e){return Array.isArray(e)?e.every(t.isSingleWord):t.isSingleWord(e)}},{key:"isSingleWord",value:function(t){return"string"==typeof t||Eu.isWord(t)||ku.isPause(t)||"function"==typeof t}}])}();function Nu(t){return Nu="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},Nu(t)}function Ru(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,Mu(r.key),r)}}function Mu(t){var e=function(t,e){if("object"!=Nu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nu(e)?e:e+""}function Fu(t,e,n){return e=Gu(e),function(t,e){if(e&&("object"==Nu(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,Du()?Reflect.construct(e,n||[],Gu(t).constructor):e.apply(t,n))}function Du(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Du=function(){return!!t})()}function Bu(t,e,n,r){var o=Vu(Gu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Vu(){return Vu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Gu(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}},Vu.apply(null,arguments)}function Gu(t){return Gu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gu(t)}function Uu(t,e){return Uu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Uu(t,e)}Lu.defaultConfig={color:"#000",pause:!0,voice:null,character:null,voiceId:null},Lu.defaultState={display:!0};var Wu=function(e){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),Fu(this,n,arguments)}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&&Uu(t,e)}(n,e),function(t,e,n){return e&&Ru(t.prototype,e),n&&Ru(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"executeAction",value:function(e){var r=this;if(this.type===t.say){var o=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}}))),i=this.contentNode.getContent(),a=n.getVoice(e,i);return a&&(ft.initSound(e,a),e.playSound(a,(function(){e.stopSound(a)}))),e.createText(this.getId(),i,(function(){a&&e.stopSound(a),o.resolve({type:r.type,node:r.contentNode.getChild()})})),o}if(this.type===t.setName)return this.callee.state.name=this.contentNode.getContent()[0],Bu(n,"executeAction",this,3)([e]);throw Bu(n,"unknownTypeError",this,3)([])}}],[{key:"getVoice",value:function(t,e){var n=t.getLastScene();if(!n)throw new Error("No scene found when trying to play voice");var r=e.config,o=r.voiceId,i=r.voice;return o||i?bu.toSound(n.getVoice(o)||i):null}}])}(J);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 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,$u(r.key),r)}}function $u(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 qu(t,e,n){return e=Xu(e),function(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)}(t,Yu()?Reflect.construct(e,n||[],Xu(t).constructor):e.apply(t,n))}function Yu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yu=function(){return!!t})()}function Xu(t){return Xu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xu(t)}function Ku(t,e){return Ku=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ku(t,e)}Wu.ActionTypes=t;var Zu=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=qu(this,e)).config=k(e.defaultConfig,r),n.state={name: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&&Ku(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:"say",value:function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(Array.isArray(t)&&t.every((function(t){return"string"==typeof t}))&&[e].concat(r).length>0&&[e].concat(r).every((function(t){return Lu.isSingleWord(t)}))){var i=t,a=Lu.format([e].concat(r)),s=new Lu(function(t,e){for(var n=[],r=0;r<Math.max(t.length,e.length);r++)r<t.length&&n.push(t[r]),r<e.length&&n.push(e[r]);return n}(i,a),{character:this}),u=new Wu(this.chain(),Wu.ActionTypes.say,(new Mt).setContent(s));return this.chain(u)}var c=e||{},l=t,f=Array.isArray(l)?new Lu(l,Object.assign(Object.assign({},c),{character:this})):(Lu.isSentence(l)?l:new Lu(l,Object.assign(Object.assign({},c),{character:this}))).copy();f.setCharacter(this);var p=new Wu(this.chain(),Wu.ActionTypes.say,(new Mt).setContent(f));return this.chain(p)}},{key:"setName",value:function(t){var e=new Wu(this.chain(),Wu.ActionTypes.setName,(new Mt).setContent([t]));return this.chain(e)}}])}(Wa);function Qu(t){return Qu="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},Qu(t)}function Ju(t){return function(t){if(Array.isArray(t))return tc(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 tc(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)?tc(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 tc(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 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"!=Qu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qu(e)?e:e+""}function rc(t,e,n){return e=ac(e),function(t,e){if(e&&("object"==Qu(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||[],ac(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(){return ic="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ac(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}},ic.apply(null,arguments)}function ac(t){return ac=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ac(t)}function sc(t,e){return sc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},sc(t,e)}Zu.defaultConfig={color:"#000"};var uc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),rc(this,e,arguments)}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&&sc(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:"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.getChild()}}},{key:"getFutureActions",value:function(t){return[].concat(Ju(this.callee._getFutureActions()),Ju(function(t,e,n,r){var o=ic(ac(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([t])))}}])}(J);function cc(t){return cc="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},cc(t)}function lc(t){return function(t){if(Array.isArray(t))return pc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||fc(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 fc(t,e){if(t){if("string"==typeof t)return pc(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)?pc(t,e):void 0}}function pc(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 hc(t,e,n){return e=yc(e),function(t,e){if(e&&("object"==cc(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,dc()?Reflect.construct(e,n||[],yc(t).constructor):e.apply(t,n))}function dc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(dc=function(){return!!t})()}function yc(t){return yc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yc(t)}function vc(t,e){return vc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vc(t,e)}function mc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gc(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,wc(r.key),r)}}function bc(t,e,n){return e&&gc(t.prototype,e),n&&gc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function wc(t){var e=function(t,e){if("object"!=cc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cc(e)?e:e+""}uc.ActionTypes={action:"condition:action"};var Sc=function(){function t(e){mc(this,t),this.handler=e}return bc(t,[{key:"evaluate",value:function(t){var e=t.gameState;return{value:this.handler(this.getCtx({gameState:e}))}}},{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}],[{key:"isLambda",value:function(e){return e instanceof t&&"handler"in e}},{key:"from",value:function(e){return t.isLambda(e)?e:new t(e)}}])}(),_c=function(t){function e(){var t;return mc(this,e),(t=hc(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},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&&vc(t,e)}(e,t),bc(e,[{key:"ElseIf",value:function(t,e){if(this.conditions.Else.action)throw new uu("ELSE condition already set\nYou are trying to set an ELSE-IF condition after an ELSE condition");return this.conditions.ElseIf.push({condition:Sc.isLambda(t)?t:new Sc(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(this.conditions.Else.action)throw new uu("ELSE condition already set\nYou are trying to set multiple ELSE conditions for the same condition");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=fc(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(uc,[this,uc.ActionTypes.action,(new Mt).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=Na.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.setChild(s),i===o.length-1&&e&&a.setChild(e),0===i&&n&&n.setChild(a)}return o}},{key:"_getFutureActions",value:function(){var t,e;return Na.toActions([(null===(t=this.conditions.If.action)||void 0===t?void 0:t[0])||[]].concat(lc(this.conditions.ElseIf.flatMap((function(t){var e;return(null===(e=t.action)||void 0===e?void 0:e[0])||[]}))),[(null===(e=this.conditions.Else.action)||void 0===e?void 0:e[0])||[]]))}},{key:"createIfCondition",value:function(t,e){return this.conditions.If.condition=t instanceof Sc?t:new Sc(t),this.conditions.If.action=this.construct(Array.isArray(e)?e:[e]),this.chain()}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}},{key:"If",value:function(t,n){return(new e).createIfCondition(t,n)}}])}(Wa);function kc(t){return kc="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},kc(t)}function xc(t){return function(t){if(Array.isArray(t))return Ac(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 Ac(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)?Ac(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 Ac(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 Oc(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,Ec(r.key),r)}}function Ec(t){var e=function(t,e){if("object"!=kc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=kc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==kc(e)?e:e+""}function Tc(t,e,n){return e=Cc(e),function(t,e){if(e&&("object"==kc(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,jc()?Reflect.construct(e,n||[],Cc(t).constructor):e.apply(t,n))}function jc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(jc=function(){return!!t})()}function Pc(){return Pc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Cc(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}},Pc.apply(null,arguments)}function Cc(t){return Cc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cc(t)}function Ic(t,e){return Ic=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ic(t,e)}var Lc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Tc(this,e,arguments)}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&&Ic(t,e)}(e,t),function(t,e,n){return e&&Oc(t.prototype,e),n&&Oc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var e=this,n=new x((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(t){var n=this.contentNode.getContent();return[].concat(xc(this.callee._getFutureActions(n.choices)),xc(function(t,e,n,r){var o=Pc(Cc(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([t])))}}])}(J);function Nc(t){return Nc="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},Nc(t)}function Rc(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,Mc(r.key),r)}}function Mc(t){var e=function(t,e){if("object"!=Nc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nc(e)?e:e+""}function Fc(t,e,n){return e=Bc(e),function(t,e){if(e&&("object"==Nc(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,Dc()?Reflect.construct(e,n||[],Bc(t).constructor):e.apply(t,n))}function Dc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Dc=function(){return!!t})()}function Bc(t){return Bc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bc(t)}function Vc(t,e){return Vc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vc(t,e)}Lc.ActionTypes={action:"menu:action"};var Gc=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=Fc(this,e)).choices=[],n.prompt=Lu.isSentence(t)?t:new Lu(t),n.config=k(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&&Vc(t,e)}(e,t),function(t,e,n){return e&&Rc(t.prototype,e),n&&Rc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Lu.isSentence(t)&&e||(Eu.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Lu.toSentence(t),action:Na.toActions(e)}):"object"===Nc(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Lu.toSentence(t.prompt),action:Na.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new Lc(this.chain(),Lc.ActionTypes.action,(new Mt).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action[0]||null})).filter((function(t){return null!==t}))}},{key:"constructNodes",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.setChild(a),o===this.choices.length-1&&e&&i.setChild(e),0===o&&n&&n.setChild(i)}return t}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.constructNodes(e.action),prompt:e.prompt}}))}}])}(Wa);function Uc(t){return Uc="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},Uc(t)}function Wc(t){return function(t){if(Array.isArray(t))return zc(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 zc(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)?zc(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 zc(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 Hc(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,$c(r.key),r)}}function $c(t){var e=function(t,e){if("object"!=Uc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Uc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Uc(e)?e:e+""}function qc(t,e,n){return e=Xc(e),function(t,e){if(e&&("object"==Uc(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,Yc()?Reflect.construct(e,n||[],Xc(t).constructor):e.apply(t,n))}function Yc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yc=function(){return!!t})()}function Xc(t){return Xc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xc(t)}function Kc(t,e){return Kc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kc(t,e)}Gc.defaultConfig={},Gc.targetAction=Lc;var Zc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),qc(this,e)}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&&Kc(t,e)}(e,t),function(t,e,n){return e&&Hc(t.prototype,e),n&&Hc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"fromChained",value:function(t){return t.getActions()}},{key:"forEachChild",value:function(t,e,n){var r=new Set,o=[];for(Array.isArray(e)?o.push.apply(o,Wc(e)):o.push(e);o.length;){var i=o.shift();if(!r.has(i)){r.add(i),n(i);var a=i.getFutureActions(t).filter((function(t){return!r.has(t)}));o.push.apply(o,Wc(a))}}}},{key:"getAllChildren",value:function(t,e){var n=[];return this.forEachChild(t,e,(function(t){return n.push(t)})),n}},{key:"getAllChildrenMap",value:function(t,e){var n=new Map;return this.forEachChild(t,e,(function(t){return n.set(t.getId(),t)})),n}},{key:"getAllElementMap",value:function(t,e){var n=new Map;return this.forEachChild(t,e,(function(t){return n.set(t.callee.getId(),t.callee)})),n}},{key:"getAllChildrenElements",value:function(t,e){return Array.from(new Set(this.getAllChildren(t,e).map((function(t){return t.callee}))))}},{key:"toData",value:function(){return null}},{key:"constructNodes",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(Ra);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(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,tl(r.key),r)}}function tl(t){var e=function(t,e){if("object"!=Qc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qc(e)?e:e+""}var el=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&&Jc(t.prototype,e),n&&Jc(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 bu){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof Ps||au.isStaticImageData(t)){if(t instanceof Ps){if(this.isSrcRegistered(Ps.getSrc(t.state)))return this}else if(this.isSrcRegistered(au.srcToString(t.src)))return this;this.src.push({type:"image",src:new Ps(t instanceof Ps?{src:Ps.getSrc(t.state)}:{src:au.staticImageDataToSrc(t)})})}else if("object"===Qc(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 bu?e:new bu({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 bu?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===Ps.getSrc(e.src.state):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)}},{key:"getFutureSrc",value:function(){return this.future.map((function(t){return t.getSrc()})).flat(2)}}],[{key:"catSrc",value:function(e){var n=new Set,r=new Set,o=new Set;return e.forEach((function(e){var i=e.type,a=e.src;i===t.SrcTypes.image?n.add(a):i===t.SrcTypes.video?r.add(a):o.add(a)})),{image:Array.from(n),video:Array.from(r),audio:Array.from(o)}}},{key:"getSrc",value:function(t){return"string"==typeof t?t:t instanceof Ps?Ps.getSrc(t.state):"image"===t.type?Ps.getSrc(t.src.state):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}},{key:"getPreloadableSrc",value:function(t,r){var o;if(r.is(xt,e.setBackground)){var i=r.contentNode.getContent()[0],a=au.backgroundToSrc(i);if(a)return{type:"image",src:new Ps({src:a}),activeType:"scene"}}else if(r.is(xt,e.jumpTo)){var s=r.contentNode.getContent()[0],u=t.getScene(s,!0).config.background;if(au.isStaticImageData(u)||"string"==typeof u)return{type:"image",src:new Ps({src:u}),activeType:"once"}}else if(r instanceof Hs){var c=r;if(c.callee.config.tag)return{type:"image",src:new Ps({src:Ps.getSrcFromTags(c.callee.config.tag.defaults,c.callee.config.src)}),activeType:"scene"};if(r.is(Hs,n.setSrc)){var l=r.contentNode.getContent()[0];return{type:"image",src:new Ps({src:l}),activeType:"scene"}}if(r.type===n.initWearable)return{type:"image",src:r.contentNode.getContent()[0],activeType:"scene"};if(r.type===n.setAppearance){var f=r.contentNode.getContent()[0];if("function"!=typeof c.callee.config.src)throw c.callee._invalidSrcHandlerError();if(f.length===(null===(o=c.callee.state.tag)||void 0===o?void 0:o.groups.length))return{type:"image",src:Ps.fromSrc(Ps.getSrcFromTags(f,c.callee.config.src)),activeType:"scene"}}else if(r.type===n.init){var p=r.callee.config.src;if("string"==typeof p||au.isStaticImageData(p))return{type:"image",src:new Ps({src:p}),activeType:"scene"}}}return null}}])}();function nl(t){return nl="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},nl(t)}function rl(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,ol(r.key),r)}}function ol(t){var e=function(t,e){if("object"!=nl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=nl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==nl(e)?e:e+""}function il(t,e,n){return e=cl(e),function(t,e){if(e&&("object"==nl(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,al()?Reflect.construct(e,n||[],cl(t).constructor):e.apply(t,n))}function al(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(al=function(){return!!t})()}function sl(t,e,n,r){var o=ul(cl(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ul(){return ul="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=cl(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}},ul.apply(null,arguments)}function cl(t){return cl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cl(t)}function ll(t,e){return ll=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ll(t,e)}el.SrcTypes={image:"image",video:"video",audio:"audio"};var fl=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),il(this,e,arguments)}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&&ll(t,e)}(e,t),function(t,e,n){return e&&rl(t.prototype,e),n&&rl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===s.init){var r=t.findElementByDisplayable(this.callee);r&&t.disposeDisplayable(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createDisplayable(this.callee,o);var i=new x((function(t){return t}));return this.callee.events.any("event:displayable.init").then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if([s.show,s.hide,s.applyTransform].includes(this.type)){var a=new x((function(t){return t})).registerSkipController(new C((function(){return n.type===s.hide&&(n.callee.state.display=!1),sl(e,"executeAction",n,3)([t])}))),u=this.contentNode.getContent()[0];return this.type===s.show&&(this.callee.state.display=!0,t.stage.update()),t.animateText(Gl.EventTypes["event:displayable.applyTransform"],this.callee,[u],(function(){n.type===s.hide&&(n.callee.state.display=!1),a.resolve(sl(e,"executeAction",n,3)([t]))})),a}if(this.type===s.setText)return this.callee.state.text=this.contentNode.getContent()[0],sl(e,"executeAction",this,3)([t]);if(this.type===s.setFontSize){this.callee.state.fontSize=this.contentNode.getContent()[0];var c=new Ji([],{duration:0}),l=new x;return t.animateText(Gl.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){l.resolve(sl(e,"executeAction",n,3)([t]))})),l}if(this.type===s.applyTransition){var f=(new x).registerSkipController(new C((function(){return t.logger.info("NarraLeaf-React: Text Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}}))),p=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",p).then((function(){f.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),f}throw sl(e,"unknownTypeError",this,3)([])}}])}(J);fl.ActionTypes=s;var pl={start:"start",update:"update",end:"end"};function hl(t){return hl="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},hl(t)}function dl(t,e,n){return e=vl(e),function(t,e){if(e&&("object"==hl(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,yl()?Reflect.construct(e,n||[],vl(t).constructor):e.apply(t,n))}function yl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yl=function(){return!!t})()}function vl(t){return vl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vl(t)}function ml(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&&gl(t,e)}function gl(t,e){return gl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gl(t,e)}function bl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wl(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 Sl(t,e,n){return e&&wl(t.prototype,e),n&&wl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _l(t){var e=function(t,e){if("object"!=hl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=hl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==hl(e)?e:e+""}var kl=function(){return Sl((function t(){bl(this,t),this.events=new E}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"copy",value:function(){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(pl.start,null),this.controller=Vi(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(pl.update,r.toElementProps())},onComplete:function(){r.controller=void 0,r.events.emit(pl.end,null),s&&s()}},n)),this.controller}}])}(),xl=function(t){function e(){return bl(this,e),dl(this,e,arguments)}return ml(e,t),Sl(e,[{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(kl);xl.DefaultEasing="linear";var Al=function(t){function e(){return bl(this,e),dl(this,e,arguments)}return ml(e,t),Sl(e,[{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(kl);function Ol(t){return Ol="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},Ol(t)}function El(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,Tl(r.key),r)}}function Tl(t){var e=function(t,e){if("object"!=Ol(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ol(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ol(e)?e:e+""}function jl(t,e,n){return e=Cl(e),function(t,e){if(e&&("object"==Ol(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,Pl()?Reflect.construct(e,n||[],Cl(t).constructor):e.apply(t,n))}function Pl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Pl=function(){return!!t})()}function Cl(t){return Cl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cl(t)}function Il(t,e){return Il=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Il(t,e)}var Ll=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=jl(this,e)).state={fontSize:0},r.startValue=t,r.endValue=n,r.duration=o,r.easing=i,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&&Il(t,e)}(e,t),function(t,e,n){return e&&El(t.prototype,e),n&&El(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"start",value:function(t){var e=this;this.state.fontSize=this.startValue,this.requestAnimation({start:this.startValue,end:this.endValue,duration:this.duration},{onComplete:function(){e.state.fontSize=e.endValue,t&&t()},onUpdate:function(t){e.state.fontSize=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{fontSize:this.state.fontSize}}]}},{key:"copy",value:function(){return new e(this.startValue,this.endValue,this.duration,this.easing)}}])}(Al);function Nl(t){return Nl="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},Nl(t)}function Rl(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,Ml(r.key),r)}}function Ml(t){var e=function(t,e){if("object"!=Nl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nl(e)?e:e+""}function Fl(t,e,n){return e=Bl(e),function(t,e){if(e&&("object"==Nl(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,Dl()?Reflect.construct(e,n||[],Bl(t).constructor):e.apply(t,n))}function Dl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Dl=function(){return!!t})()}function Bl(t){return Bl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bl(t)}function Vl(t,e){return Vl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vl(t,e)}Ll.Frames=[1,0];var Gl=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=Fl(this,e)).events=new E,n.config="string"==typeof t?k({},e.defaultConfig,r,{text:t}):k({},e.defaultConfig,t),n.state=k({},n.config),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&&Vl(t,e)}(e,t),function(t,e,n){return e&&Rl(t.prototype,e),n&&Rl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"applyTransform",value:function(t){var e=this.chain(),n=new fl(e,fl.ActionTypes.applyTransform,(new Mt).setContent([t.copy()]));return e.chain(n)}},{key:"applyTransition",value:function(t){var e=this.chain(),n=this._applyTransition(e,t);return e.chain(n)}},{key:"show",value:function(t){var e=this.chain(),n=t instanceof Ji?t.copy():new Ji([{props:{opacity:1},options:t||{}}]),r=new fl(e,fl.ActionTypes.show,(new Mt).setContent([n]));return e.chain(r)}},{key:"hide",value:function(t){var e=this.chain(),n=t instanceof Ji?t.copy():new Ji([{props:{opacity:1},options:t||{}}]),r=new fl(e,fl.ActionTypes.hide,(new Mt).setContent([n]));return e.chain(r)}},{key:"setText",value:function(t){var e=this.chain(),n=new fl(e,fl.ActionTypes.setText,(new Mt).setContent([t]));return e.chain(n)}},{key:"setFontSize",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return this.combineActions(new Za,(function(o){if(n){var i=new Ll(e.state.fontSize,t,n,r);o.chain(e._applyTransition(o,i))}var a=new fl(o,fl.ActionTypes.setFontSize,(new Mt).setContent([t]));return o.chain(a)}))}},{key:"toData",value:function(){return{state:k({},Ps.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=k({},Ps.deserializeImageState(t.state)),this}},{key:"toTransform",value:function(){return new Ji(this.state,{duration:0})}},{key:"toDisplayableTransform",value:function(){return new Ji(this.state,{duration:0})}},{key:"_init",value:function(t){return new fl(this.chain(),fl.ActionTypes.init,(new Mt).setContent([t]))}},{key:"_applyTransition",value:function(t,e){return new fl(t,fl.ActionTypes.applyTransition,(new Mt).setContent([e]))}}])}(Wa);function Ul(t){return Ul="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},Ul(t)}function Wl(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 zl(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)?zl(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 zl(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 Hl(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"!=Ul(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ul(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ul(e)?e:e+""}function ql(t,e,n){return e=Kl(e),function(t,e){if(e&&("object"==Ul(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,Yl()?Reflect.construct(e,n||[],Kl(t).constructor):e.apply(t,n))}function Yl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yl=function(){return!!t})()}function Xl(){return Xl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Kl(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}},Xl.apply(null,arguments)}function Kl(t){return Kl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kl(t)}function Zl(t,e){return Zl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zl(t,e)}Gl.EventTypes=Object.assign(Object.assign({},ys.EventTypes),{"event:text.show":"event:text.show","event:text.hide":"event:text.hide"}),Gl.defaultConfig={position:new Yt(Yt.Positions.Center),scale:1,rotation:0,opacity:0,alignX:"center",alignY:"center",fontSize:16,fontColor:"#000000",display:!1,text:""};var Ql=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ql(this,e,arguments)}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&&Zl(t,e)}(e,t),function(t,e,n){return e&&Hl(t.prototype,e),n&&Hl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(n.is(e,"persistent:set")){var r=Wl(n.contentNode.getContent(),2),o=r[0],i=r[1],a=t.getStorable().getNamespace(n.callee.getNamespaceName());if("function"==typeof i){var s=a.get(o);a.set(o,i(s))}else a.set(o,i);return function(t,e,n,r){var o=Xl(Kl(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"executeAction",this,3)([t])}throw this.unknownTypeError()}}])}(J);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){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 ef(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)?ef(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 ef(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 nf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rf(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 of(t,e,n){return e&&rf(t.prototype,e),n&&rf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function af(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+""}Ql.ActionTypes=c;var sf=function(){function t(e,n,r){nf(this,t),this.name=e,this.key=r||e,this.content=k({},n)}return of(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\n at namespace "').concat(this.name,'"')),this.content[e]=n,this)}},{key:"get",value:function(t){return this.content[t]}},{key:"equals",value:function(t,e){return this.content[t]===e}},{key:"assign",value:function(t){var e=this;return Object.entries(t).forEach((function(t){var n=tf(t,2),r=n[0],o=n[1];e.set(r,o)})),this}},{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=tf(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=tf(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(Jl(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===Jl(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),uf=function(){return of((function t(){nf(this,t),this.namespaces={}}),[{key:"addNamespace",value:function(t){if(!this.namespaces[t.key])return this.namespaces[t.key]=t,this}},{key:"getNamespace",value:function(t){if(!this.namespaces[t])throw new fu("Namespace ".concat(t," is not initialized, did you forget to register it?")+"\nUse `story.registerPersistent` to register a persistent namespace");return this.namespaces[t]}},{key:"setNamespace",value:function(t,e){return this.namespaces[t]=e,this}},{key:"hasNamespace",value:function(t){return!!this.namespaces[t]}},{key:"removeNamespace",value:function(t){return delete this.namespaces[t],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=tf(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=tf(t,2),r=n[0],o=n[1];e.namespaces[r]?e.namespaces[r].load(o):e.namespaces[r]=new sf(r,o)})):console.warn("No data to load")}},{key:"clear",value:function(){return this.namespaces={},this}}])}();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 lf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ff(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,hf(r.key),r)}}function pf(t,e,n){return e&&ff(t.prototype,e),n&&ff(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function hf(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 df(t,e,n){return e=vf(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,yf()?Reflect.construct(e,n||[],vf(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 vf(t){return vf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vf(t)}function mf(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&&gf(t,e)}function gf(t,e){return gf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gf(t,e)}var bf=function(t){function e(t,n){var r;return lf(this,e),(r=df(this,e)).namespace=r.prefix(t),r.defaultContent=n,r}return mf(e,t),pf(e,[{key:"init",value:function(t){t.hasNamespace(this.namespace)||t.addNamespace(new sf(this.namespace,this.defaultContent))}},{key:"set",value:function(t,e){return this.chain(this.createAction(c.set,[t,e]))}},{key:"equals",value:function(t,e){var n=this;return new Sc((function(r){return r.storable.getNamespace(n.namespace).equals(t,e)}))}},{key:"notEquals",value:function(t,e){var n=this;return new Sc((function(r){return!r.storable.getNamespace(n.namespace).equals(t,e)}))}},{key:"isTrue",value:function(t){var e=this;return new Sc((function(n){return n.storable.getNamespace(e.namespace).equals(t,!0)}))}},{key:"isFalse",value:function(t){var e=this;return new Sc((function(n){return n.storable.getNamespace(e.namespace).equals(t,!1)}))}},{key:"isNotNull",value:function(t){var e=this;return new Sc((function(n){var r=n.storable.getNamespace(e.namespace).get(t);return null!=r}))}},{key:"toWord",value:function(t){var e=this;return new Eu((function(n){var r=n.storable;return[String(r.getNamespace(e.namespace).get(t))]}))}},{key:"get",value:function(t){return this.toWord(t)}},{key:"conditional",value:function(t,e,n){return new Eu((function(r){return Sc.from(t).evaluate(r).value?e:n}))}},{key:"evaluate",value:function(t,e){var n=this;return new Sc((function(r){var o=r.storable;return e(o.getNamespace(n.namespace).get(t))}))}},{key:"getNamespaceName",value:function(){return this.namespace}},{key:"prefix",value:function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NamespacePrefix)+":"+String(t)}},{key:"createAction",value:function(t,e){return new Ql(this.chain(),t,Mt.create(e))}}])}(Wa);bf.NamespacePrefix="persistent";var wf=function(t){function e(t){var n;return lf(this,e),(n=df(this,e,[t,{}])).namespace=n.prefix(t,e.LocalNamespacePrefix),n}return mf(e,t),pf(e,[{key:"init",value:function(t){t.removeNamespace(this.namespace).addNamespace(new sf(this.namespace,this.defaultContent))}}])}(bf);function Sf(t){return Sf="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},Sf(t)}function _f(t){return function(t){if(Array.isArray(t))return xf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||kf(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 kf(t,e){if(t){if("string"==typeof t)return xf(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)?xf(t,e):void 0}}function xf(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 Af(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,Of(r.key),r)}}function Of(t){var e=function(t,e){if("object"!=Sf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Sf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sf(e)?e:e+""}function Ef(t,e,n){return e=Pf(e),function(t,e){if(e&&("object"==Sf(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,Tf()?Reflect.construct(e,n||[],Pf(t).constructor):e.apply(t,n))}function Tf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Tf=function(){return!!t})()}function jf(){return jf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Pf(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}},jf.apply(null,arguments)}function Pf(t){return Pf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pf(t)}function Cf(t,e){return Cf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cf(t,e)}wf.LocalNamespacePrefix="local";var If=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},Lf=function(t){function n(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=Ef(this,n)).srcManager=new el,r.events=new E,r.actions=[],r._userConfig={},r.name=t,r._userConfig=e||{};var o=k(n.defaultConfig,e||{}),i=o.background,a=o.voices,s=If(o,["background","voices"]);return r.config=Object.assign(Object.assign({},s),{voices:a||null,background:i||null}),r.state=k(r.config,{backgroundImageProxy:r._createImageProxy()}),r.local=new wf(t),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&&Cf(t,e)}(n,t),function(t,e,n){return e&&Af(t.prototype,e),n&&Af(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"toBackground",value:function(t){if(au.isImageSrc(t)||au.isImageColor(t))return t;if(t instanceof iu)return t.toImageColor();throw new Error("Invalid background type")}},{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){var n=this;return this.combineActions(new Za,(function(r){if(e){var o=e.copy();o.setSrc(n.toBackground(t)),r._transitionToScene(o,void 0,n.toBackground(t))}return r.chain(new xt(r,"scene:setBackground",(new Mt).setContent([t])))}))}},{key:"applyTransform",value:function(t){return this.chain(new xt(this.chain(),"scene:applyTransform",(new Mt).setContent([t.copy()])))}},{key:"jumpTo",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.combineActions(new Za,(function(r){var o=k({unloadScene:!0},n);return r.chain(new xt(r,"scene:preUnmount",(new Mt).setContent([])))._transitionToScene(o.transition,t).chain(e._init(t)),o.unloadScene&&r.chain(e._exit()),r}))._jumpTo(t)}},{key:"sleep",value:function(t){return this.chain(new xt(this.chain(),"scene:sleep",(new Mt).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,n){return this.chain(new xt(this.chain(),e.setBackgroundMusic,(new Mt).setContent([t,n])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},A(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:this.state.backgroundImageProxy.toData()}}},{key:"fromData",value:function(t){var e=this;return R(t,{state:function(t){R(t,{backgroundMusic:function(t){t&&(e.state.backgroundMusic=(new bu).fromData(t))},background:function(t){t&&(e.state.background=t)}})},backgroundImageState:function(t){t&&(e.state.backgroundImageProxy=(new Ps).fromData(t))}}),this}},{key:"getInitTransform",value:function(){return new Ji([{props:Object.assign(Object.assign({},this.state.backgroundImageProxy.state),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){return this.actions=t,this}},{key:"constructSceneRoot",value:function(t){var e;this.sceneRoot=new xt(this.chain(),"scene:action",new Mt);var r=this.actions,o=(Array.isArray(r)?r.flat(2):r(this).flat(2)).map((function(t){return Na.isChained(t)?t.fromChained(t):t})).flat(2),i=[],a=[];this.getAllChildrenElements(t,o).forEach((function(t){Na.isChained(t)||(t instanceof Ps?i.push(t):t instanceof Gl&&a.push(t))}));var s=[],u=[],c=new Map;i.forEach((function(t){var e;t.config.isWearable?u.push(t):s.push(t);var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=kf(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.config.wearables);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(c.get(o)&&c.get(o)!==t)throw new Error("Wearable image cannot be used multiple times\nYou may bind the same wearable image to multiple parent images\nParent Conflict: "+(null===(e=c.get(o))||void 0===e?void 0:e.getId())+"\nCurrent Parent: "+t.getId());c.set(o,t)}}catch(t){r.e(t)}finally{r.f()}}));var l=[this._init(this)].concat(_f(s.filter((function(t){return t.config.autoInit})).map((function(t){return t._init()}))),_f(u.map((function(t){if(!c.has(t))throw new Error("Wearable image must have a parent image");return c.get(t)._initWearable(t)}))),_f(a.map((function(t){return t._init()}))),_f(o)),f=function(t,e,n,r){var o=jf(Pf(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(n,"constructNodes",this,3)([l]),p=new Mt(this.sceneRoot,void 0,f||void 0).setContent(this);return null==f||f.setParent(p),null===(e=this.sceneRoot)||void 0===e||e.setContentNode(p),this}},{key:"isSceneRootConstructed",value:function(){return!!this.sceneRoot}},{key:"inherit",value:function(t){var e=k(n.defaultConfig,t.config,this._userConfig),r=e.background,o=If(e,["background"]);return this.config=Object.assign(Object.assign({},o),{background:r||null}),this.state=k(this.config,{backgroundImageProxy:this._createImageProxy()}),this}},{key:"registerSrc",value:function(t){var r=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set;if(this.sceneRoot){var i=new Set,a=new Set,s=[this.sceneRoot],u=new Set;for(au.isImageSrc(this.config.background)&&this.srcManager.register(new Ps({src:au.toBackgroundSrc(this.config.background)}));s.length;){var c=s.shift();if(!i.has(c)){if(i.add(c),c instanceof xt){if(c.type===e.jumpTo){var l=c,f=n.getScene(t,l.contentNode.getContent()[0]);if(!f)throw c._sceneNotFoundError(c.getSceneName(l.contentNode.getContent()[0]));var p=el.getPreloadableSrc(t,c);if(p&&this.srcManager.register(p),a.has(l)||o.has(f))continue;a.add(l),u.add(f),o.add(f)}else if(c.type===e.setBackground){var h=el.getPreloadableSrc(t,c);h&&this.srcManager.register(h)}}else if(c instanceof Hs){var d=el.getPreloadableSrc(t,c);d&&this.srcManager.register(d)}else if(c instanceof ft)this.srcManager.register(c.callee);else if(c instanceof Sa){var y=c.getFutureActions(t);s.push.apply(s,_f(y))}s.push.apply(s,_f(c.getFutureActions(t)))}}u.forEach((function(e){e.registerSrc(t,o),r.srcManager.registerFuture(e.srcManager)}))}}},{key:"assignActionId",value:function(t){this.getAllChildren(t,this.sceneRoot||[]).forEach((function(t,e){t.setId("action-".concat(e))}))}},{key:"assignElementId",value:function(t){this.getAllChildrenElements(t,this.sceneRoot||[]).forEach((function(t,e){t.setId("element-".concat(e))}))}},{key:"getVoice",value:function(t){if(!t)return null;var e=this.config.voices;return e?"function"==typeof e?e(t):e[t]||null:null}},{key:"getSceneRoot",value:function(){if(!this.sceneRoot)throw new Error("Scene root is not constructed");return this.sceneRoot}},{key:"reset",value:function(){this.state=k(n.defaultState,this.config),this.state.backgroundImageProxy.reset()}},{key:"toDisplayableTransform",value:function(){return this.state.backgroundImageProxy.toDisplayableTransform()}},{key:"requestImagePreload",value:function(t){this.srcManager.register({type:"image",src:new Ps({src:t})})}},{key:"_createImageProxy",value:function(){return new Cs({opacity:1,src:Ps.DefaultImagePlaceholder})}},{key:"_jumpTo",value:function(t){return this.chain(new xt(this.chain(),"scene:jumpTo",(new Mt).setContent([t])))}},{key:"_exit",value:function(){return new xt(this.chain(),"scene:exit",(new Mt).setContent([]))}},{key:"_transitionToScene",value:function(t,n,r){var o=this.chain();if(t){var i=t.copy(),a=new xt(o,e.transitionToScene,(new Mt).setContent([i,n,r]));o.chain(a)}return o}},{key:"_init",value:function(t){return new xt(this.chain(),"scene:init",(new Mt).setContent([t]))}}],[{key:"isScene",value:function(t){return t instanceof n}},{key:"getScene",value:function(t,e){return"string"==typeof e?t.getScene(e):e}}])}(Zc);function Nf(t){return Nf="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},Nf(t)}function Rf(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"!=Nf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nf(e)?e:e+""}function Ff(t,e,n){return e=Vf(e),function(t,e){if(e&&("object"==Nf(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,Df()?Reflect.construct(e,n||[],Vf(t).constructor):e.apply(t,n))}function Df(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Df=function(){return!!t})()}function Bf(){return Bf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Vf(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}},Bf.apply(null,arguments)}function Vf(t){return Vf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vf(t)}function Gf(t,e){return Gf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gf(t,e)}Lf.EventTypes={"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.setBackgroundMusic":"event:scene.setBackgroundMusic","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},Lf.defaultConfig={invertY:!0,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},Lf.defaultState={backgroundImageProxy:new Cs};var Uf=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ff(this,e,arguments)}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&&Gf(t,e)}(e,t),function(t,e,n){return e&&Rf(t.prototype,e),n&&Rf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),function(t,e,n,r){var o=Bf(Vf(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"executeAction",this,3)([t])}}])}(J);function Wf(t){return Wf="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},Wf(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,Hf(r.key),r)}}function Hf(t){var e=function(t,e){if("object"!=Wf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wf(e)?e:e+""}function $f(t,e,n){return e=Xf(e),qf(t,Yf()?Reflect.construct(e,n||[],Xf(t).constructor):e.apply(t,n))}function qf(t,e){if(e&&("object"==Wf(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 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)}Uf.ActionTypes={action:"script:action"};var Zf=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=$f(this,e)).handler=t,qf(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&&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:"execute",value:function(t){var n=t.gameState;this.handler(e.getCtx({gameState:n}))}},{key:"fromChained",value:function(t){return[new Uf(this.chain(),Uf.ActionTypes.action,(new Mt).setContent(t))]}}],[{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}])}(Wa);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){return function(t){if(Array.isArray(t))return tp(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 tp(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)?tp(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 tp(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 ep(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,np(r.key),r)}}function np(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 rp(t,e,n){return e=ip(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,op()?Reflect.construct(e,n||[],ip(t).constructor):e.apply(t,n))}function op(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(op=function(){return!!t})()}function ip(t){return ip=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ip(t)}function ap(t,e){return ap=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ap(t,e)}var sp=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=rp(this,e)).entryScene=null,n.scenes=new Map,n.persistent=[],n.name=t,n.config=k(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&&ap(t,e)}(e,t),function(t,e,n){return e&&ep(t.prototype,e),n&&ep(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"entry",value:function(t){return this.entryScene=t,this}},{key:"registerScene",value:function(t,e){var n="string"==typeof t?t:t.name,r="string"==typeof t?e:t;if(this.scenes.has(n)&&this.scenes.get(n)!==r)throw new Error("Scene with name ".concat(n," already exists when registering scene"));return this.scenes.set(n,r),this}},{key:"registerPersistent",value:function(t){return this.persistent.push(t),this}},{key:"getScene",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;if(Lf.isScene(t))return t;var r=this.scenes.get(t)||null;if(!r&&e){var o=n||lu;throw Reflect.construct(o,["Scene with name ".concat(t," not found")])}return r}},{key:"constructStory",value:function(){var t=this.entryScene;if(!t)throw new Error("Story must have an entry scene");return this.constructSceneRoots(t),t.registerSrc(this),t.assignActionId(this),t.assignElementId(this),this.runStaticCheck(t),this}},{key:"getAllElementStates",value:function(){var t;return this.getAllChildrenElements(this,(null===(t=this.entryScene)||void 0===t?void 0:t.getSceneRoot())||[]).map((function(t){return{id:t.getId(),data:t.toData()}})).filter((function(t){return!!t.data}))}},{key:"constructSceneRoots",value:function(t){var n=new Set,r=[],o=0;for(t.constructSceneRoot(this),r.push(t.getSceneRoot());r.length;){if(++o>e.MAX_DEPTH)throw new Error("Max depth reached while constructing scene roots (max depth: ".concat(e.MAX_DEPTH,")"));var i=r.shift();if(Lf.isScene(i.callee)){if(n.has(i.callee))continue;i.callee.isSceneRootConstructed()||i.callee.constructSceneRoot(this),n.add(i.callee)}var a=i.getFutureActions(this);r.push.apply(r,Jf(a))}return this}},{key:"initPersistent",value:function(t){return this.persistent.forEach((function(e){e.init(t)})),this}},{key:"runStaticCheck",value:function(t){return new cu(t).run(this)}}])}(Zc);sp.defaultConfig={},sp.MAX_DEPTH=1e4;var up=function t(e){if(!(this instanceof t?this.constructor:void 0))throw new Error("Image is a constructor and should be called with new keyword");return new Ps(e,e.tag)};function cp(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=cp(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}const lp=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=cp(t))&&(r&&(r+=" "),r+=e);return r};var fp=o(12),pp=o.n(fp);function hp(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 dp(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)?dp(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 dp(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 yp=pp().createContext(null);function vp(t){var e=t.children,n=t.game,r=new pd({}),o=hp((0,fp.useState)(n||r),2),i=o[0],a=o[1];return pp().createElement(yp.Provider,{value:{game:i,setGame:a}},e)}function mp(){var t=(0,fp.useContext)(yp);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function gp(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))})}var bp=o(387);const wp=(0,fp.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Sp=(0,fp.createContext)({}),_p=(0,fp.createContext)(null),kp=oi?fp.useLayoutEffect:fp.useEffect,xp=(0,fp.createContext)({strict:!1}),{schedule:Ap,cancel:Op}=sn(queueMicrotask,!1);function Ep(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const Tp=(0,fp.createContext)({});function jp(t,e,n,r,o){var i,a;const{visualElement:s}=(0,fp.useContext)(Sp),u=(0,fp.useContext)(xp),c=(0,fp.useContext)(_p),l=(0,fp.useContext)(wp).reducedMotion,f=(0,fp.useRef)();r=r||u.renderer,!f.current&&r&&(f.current=r(t,{visualState:e,parent:s,props:n,presenceContext:c,blockInitialAnimation:!!c&&!1===c.initial,reducedMotionConfig:l}));const p=f.current,h=(0,fp.useContext)(Tp);!p||p.projection||!o||"html"!==p.type&&"svg"!==p.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:Pp(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&Ep(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(f.current,n,o,h),(0,fp.useInsertionEffect)((()=>{p&&p.update(n,c)}));const d=n[Xo],y=(0,fp.useRef)(Boolean(d)&&!(null===(i=window.MotionHandoffIsComplete)||void 0===i?void 0:i.call(window,d))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,d)));return kp((()=>{p&&(window.MotionIsMounted=!0,p.updateFeatures(),Ap.render(p.render),y.current&&p.animationState&&p.animationState.animateChanges())})),(0,fp.useEffect)((()=>{p&&(!y.current&&p.animationState&&p.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,d)})),y.current=!1))})),p}function Pp(t){if(t)return!1!==t.options.allowProjection?t.projection:Pp(t.parent)}function Cp(t,e,n){return(0,fp.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Ep(n)&&(n.current=r))}),[e])}function Ip(t){const{initial:e,animate:n}=function(t,e){if(fi(t)){const{initial:e,animate:n}=t;return{initial:!1===e||ui(e)?e:void 0,animate:ui(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,fp.useContext)(Sp));return(0,fp.useMemo)((()=>({initial:e,animate:n})),[Lp(e),Lp(n)])}function Lp(t){return Array.isArray(t)?t.join(" "):t}function Np(t){for(const e in t)di[e]={...di[e],...t[e]}}const Rp=(0,fp.createContext)({}),Mp=Symbol.for("motionComponentSymbol");function Fp({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&Np(t);const i=(0,fp.forwardRef)((function(t,i){let a;const s={...(0,fp.useContext)(wp),...t,layoutId:Dp(t)},{isStatic:u}=s,c=Ip(t),l=r(t,u);if(!u&&oi){!function(){(0,fp.useContext)(xp).strict;0}();const t=function(t){const{drag:e,layout:n}=di;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=jp(o,l,s,e,t.ProjectionNode)}return(0,bp.jsxs)(Sp.Provider,{value:c,children:[a&&c.visualElement?(0,bp.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Cp(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[Mp]=o,i}function Dp({layoutId:t}){const e=(0,fp.useContext)(Rp).id;return e&&void 0!==t?e+"-"+t:t}const Bp=["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 Vp(t){return"string"==typeof t&&!t.includes("-")&&!!(Bp.indexOf(t)>-1||/[A-Z]/u.test(t))}function Gp(t){const e=Te(t)?t.get():t;return Do(e)?e.toValue():e}function Up(t){return Ye.has(t)?"transform":_o.has(t)?Yo(t):void 0}const Wp=t=>(e,n)=>{const r=(0,fp.useContext)(Sp),o=(0,fp.useContext)(_p),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:Hp(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,fp.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function zp(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=Ho(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function Hp(t,e,n,r,o){var i;const a={},s=new Set,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]=Gp(c[t]);let{initial:l,animate:f}=t;const p=fi(t),h=pi(t);e&&h&&!p&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let d=!!n&&!1===n.initial;d=d||!1===l;const y=d?f:l;return y&&"boolean"!=typeof y&&!si(y)&&zp(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[d?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!si(f)&&zp(t,f,(t=>{for(const e in t){const t=Up(e);t&&s.add(t)}})),s.size&&(a.willChange=Array.from(s).join(","))),a}const $p=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),qp=()=>({...$p(),attrs:{}}),Yp={useVisualState:Wp({scrapeMotionValuesFromProps:ri,createRenderState:qp,onMount:(t,e,{renderState:n,latestValues:r})=>{un.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),un.render((()=>{Ei(n,r,Ci(e.tagName),t.transformTemplate),Pi(e,n)}))}})},Xp={useVisualState:Wp({applyWillChange:!0,scrapeMotionValuesFromProps:ni,createRenderState:$p})};function Kp(t,e,n){for(const r in e)Te(e[r])||ei(r,n)||(t[r]=e[r])}function Zp(t,e){const n={};return Kp(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,fp.useMemo)((()=>{const n=$p();return ki(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function Qp(t,e){const n={},r=Zp(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 Jp=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 th(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Jp.has(t)}let eh=t=>!th(t);try{(nh=require("@emotion/is-prop-valid").default)&&(eh=t=>t.startsWith("on")?!th(t):nh(t))}catch(ba){}var nh;function rh(t,e,n,r){const o=(0,fp.useMemo)((()=>{const n=qp();return Ei(n,e,Ci(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};Kp(e,t.style,t),o.style={...e,...o.style}}return o}function oh(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(Vp(e)?rh:Qp)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(eh(o)||!0===n&&th(o)||!e&&!th(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==fp.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,fp.useMemo)((()=>Te(c)?c.get():c),[c]);return(0,fp.createElement)(e,{...u,children:l})}}function ih(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Fp({...Vp(n)?Yp:Xp,preloadedFeatures:t,useRender:oh(r),createVisualElement:e,Component:n})}}const ah=gp(ih());function sh(){return sh=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},sh.apply(null,arguments)}function uh(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 ch(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)?ch(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 ch(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 lh=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};function fh(t){var e=t.children,n=t.border,r=void 0===n?"solid":n,o=t.color,i=void 0===o?"red":o,a=t.tag,s=t.borderWidth,u=void 0===s?1:s,c=t.as,l=void 0===c?"div":c,f=t.Ref,p=lh(t,["children","border","color","tag","borderWidth","as","Ref"]),h=mp().game,d=uh((0,fp.useState)(!1),2),y=d[0],v=d[1];if(!h.config.app.inspector)return pp().createElement(l,sh({},p,{ref:f}),e);var m=Object.assign(Object.assign({},p),{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},style:Object.assign(Object.assign({},p.style||{}),{outline:"".concat(u,"px ").concat(r," ").concat(i),zIndex:y?1e3:"auto"})});return pp().createElement(l,sh({},m,{ref:f}),a&&y&&pp().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black text-sm"},a),e)}function ph(t){var e=t.border,n=void 0===e?"solid":e,r=t.color,o=void 0===r?"red":r,i=t.tag,a=t.borderWidth,s=void 0===a?1:a,u=t.as,c=void 0===u?"img":u,l=lh(t,["border","color","tag","borderWidth","as"]),f=mp().game,p=uh((0,fp.useState)(!1),2),h=p[0],d=p[1];if(!f.config.app.inspector)return pp().createElement(c,l);var y=Object.assign(Object.assign({},l),{onMouseEnter:function(){return d(!0)},onMouseLeave:function(){return d(!1)},style:Object.assign(Object.assign({},l.style||{}),{outline:"".concat(n," ").concat(s,"px ").concat(o),zIndex:h?1e3:"auto"})});return pp().createElement("div",null,pp().createElement(c,y),i&&h&&pp().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black"},i))}const hh={Div:function(t){return pp().createElement(fh,sh({},t,{as:"div"}))},Span:function(t){return pp().createElement(fh,sh({},t,{as:"span"}))},Button:function(t){return pp().createElement(fh,sh({},t,{as:"button"}))},Img:function(t){return pp().createElement(ph,sh({},t,{as:"img"}))},mDiv:function(t){return pp().createElement(fh,sh({},t,{as:ah.div,Ref:t.Ref}))}};function dh(t){return dh="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},dh(t)}function yh(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */yh=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==dh(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(dh(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 vh(t){return function(t){if(Array.isArray(t))return bh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||gh(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 mh(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)||gh(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 gh(t,e){if(t){if("string"==typeof t)return bh(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)?bh(t,e):void 0}}function bh(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 wh(t){var e=yh().mark(M),n=t.sentence,r=t.gameState,o=t.useTypeEffect,i=void 0===o||o,a=t.onCompleted,s=t.finished,u=t.count,c=t.className,l=t.words,f=mh((0,fp.useState)(!1),2),p=f[0],h=f[1],d=r.game,y=(0,fp.useMemo)((function(){return l||n.evaluate(Zf.getCtx({gameState:r}))}),[]),v=mh((0,fp.useState)([]),2),m=v[0],g=v[1],b=(0,fp.useRef)(M(y)),w=(0,fp.useRef)(null),S=(0,fp.useRef)(null),_=mh((0,fp.useState)(0),2),k=_[0],x=_[1],A=mh((0,fp.useReducer)((function(t){return t+1}),0),2)[1],E=mh((0,fp.useState)(new Set),2),T=E[0],j=E[1],P=mh((0,fp.useState)(!1),2),C=P[0],I=P[1];function L(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];S.current&&(clearTimeout(S.current),S.current=null);for(var e=!1;!e;){var n=b.current.next(),o=n.done,i=n.value;if(o)h(!0),a&&(r.logger.info("Say","Completed",o,i),a()),e=!0;else if(ku.isPause(i)){if(t)continue;R(ku.from(i)),e=!0}else N(i)}}function N(t){g((function(e){if("\n"!==t&&T.has(t))return e;j((function(e){return new Set(e).add(t)}));var n=e[e.length-1];return n&&"\n"!==n&&"\n"!==t&&n.tag===t.tag?[].concat(vh(e.slice(0,-1)),[{text:n.text+t.text,config:t.config,tag:t.tag,tag2:t.tag2}]):[].concat(vh(e),[t])}))}function R(t){r.logger.info("Say","Paused",t),t.config.duration?w.current=setTimeout((function(){w.current=null,x((function(t){return t+1}))}),t.config.duration):I(!0)}function M(t){var n,r,o,i,a;return yh().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=vh(t),r=0;case 2:if(!(r<n.length)){e.next=24;break}if(o=n[r],!ku.isPause(o.text)){e.next=8;break}return e.next=7,ku.from(o.text);case 7:return e.abrupt("continue",21);case 8:i=0;case 9:if(!(i<o.text.length)){e.next=21;break}if("\n"!==(a=o.text[i])){e.next=16;break}return e.next=14,"\n";case 14:e.next=18;break;case 16:return e.next=18,{text:a,config:o.config,tag:r,tag2:i};case 18:i++,e.next=9;break;case 21:r++,e.next=2;break;case 24:return e.abrupt("return");case 25:case"end":return e.stop()}}),e)}return(0,fp.useEffect)((function(){if(i||L(!0),s&&!p)return w.current&&clearTimeout(w.current),w.current=null,L(!0),void(a&&(r.logger.info("Say","Completed",w.current,s,p),a()));if(p||s||C||w.current)r.logger.debug("Sentence.tsx","locked",p,s,C);else{var t=b.current.next(),e=t.done,n=t.value;if(e)return h(!0),void(a&&(r.logger.info("Say","Completed",e,n),a()));ku.isPause(n)?R(ku.from(n)):(N(n),A(),S.current=setTimeout((function(){x((function(t){return t+1}))}),d.config.elements.say.textInterval))}}),[k,s,C]),(0,fp.useEffect)((function(){if(u&&!w.current){if(C)return I(!1),void x((function(t){return t+1}));L(),x((function(t){return t+1}))}}),[u]),pp().createElement("div",{className:lp("whitespace-pre-wrap",d.config.elementStyles.say.textContainerClassName,{"font-bold":n.config.bold,italic:n.config.italic},c),style:{fontFamily:n.config.fontFamily||d.config.elementStyles.say.fontFamily,fontSize:n.config.fontSize||d.config.elementStyles.say.fontSize}},m.map((function(t,e){return"\n"===t?pp().createElement("br",{key:e}):pp().createElement(hh.Span,{tag:"say.word.".concat(e),key:e,style:Object.assign({color:O(t.config.color||n.config.color||Eu.defaultColor),fontFamily:t.config.fontFamily,fontSize:t.config.fontSize},d.config.app.debug?{outline:"1px dashed red"}:{}),className:lp(d.config.elementStyles.say.textSpanClassName,"whitespace-pre inline-block",{"font-bold":t.config.bold,italic:t.config.italic},t.config.className)},t.config.ruby?pp().createElement("ruby",{className:"align-bottom inline-block"},pp().createElement("rt",{className:"block text-center"},t.config.ruby),t.text):t.text)})))}function Sh(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 _h(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)?_h(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 _h(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 kh(t){return kh="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},kh(t)}function xh(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,Ah(r.key),r)}}function Ah(t){var e=function(t,e){if("object"!=kh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=kh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==kh(e)?e:e+""}var Oh=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,scale:0},this.events=new E,this.lockers=[],this.updater=null}return function(t,e,n){return e&&xh(t.prototype,e),n&&xh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n,r){this.state.width=e,this.state.height=n,this.state.scale=r,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:"requestUpdate",value:function(){this.events.emit(t.EventTypes["event:aspectRatio.requestUpdate"])}},{key:"onRequestedUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.requestUpdate"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.requestUpdate"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();Oh.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume","event:aspectRatio.requestUpdate":"event:aspectRatio.requestUpdate"};var Eh=(0,fp.createContext)(null);function Th(t){var e=t.children,n=Sh((0,fp.useState)((function(){return new Oh})),1)[0];return pp().createElement(Eh.Provider,{value:{ratio:n}},e)}function jh(){var t=(0,fp.useContext)(Eh);if(!Eh||!t)throw new Error("useRatio must be used within a RatioProvider");var e=Sh((0,fp.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,fp.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function Ph(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 Ch(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)?Ch(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 Ch(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 Ih(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.words,l=Ph((0,fp.useState)(!1),2),f=l[0],p=l[1],h=s.game,d=Ph((0,fp.useState)(0),2),y=d[0],v=d[1],m=jh().ratio,g=Ph((0,fp.useState)(new M),1)[0];function b(){h.preference.getPreference(pd.Preferences.autoForward)&&g.cancelTask().scheduleTask((function(){r&&r()}),h.config.elements.say.autoForwardDelay)}return(0,fp.useEffect)((function(){if(window){var t=function(t){h.config.elements.say.nextKey.includes(t.key)&&(f?r&&r():v((function(t){return t+1})))};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")}),[f]),(0,fp.useEffect)((function(){var t=s.events.onEvents([{type:Zh.EventTypes["event:state.player.skip"],listener:s.events.on(Zh.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),f?r&&r():p(!0)}))}]);return function(){t.cancel()}}),[f]),(0,fp.useEffect)((function(){var t=h.preference.onPreferenceChange(pd.Preferences.autoForward,(function(t){t&&f?b():g.cancelTask()}));return function(){t.cancel()}}),[f]),(0,fp.useEffect)((function(){return function(){g.cancelTask()}}),[]),pp().createElement("div",null,u.state.display&&pp().createElement(hh.Div,{tag:"say.aspectScaleContainer",color:"blue",border:"dashed",className:lp("absolute bottom-0 w-[calc(100%-40px)]",a),onClick:function(){f?(r&&r(),b()):v((function(t){return t+1}))},style:Object.assign({},N(h.config.elements.say.useAspectScale,{width:h.config.elements.text.width,height:h.config.elements.text.height}))},pp().createElement(hh.Div,{tag:"say.containerClassName",className:lp(h.config.elementStyles.say.containerClassName),style:Object.assign({},N(h.config.elements.say.useAspectScale,{transform:"scale(".concat(m.state.scale,")"),transformOrigin:"bottom left",width:"100%",height:"100%"}))},pp().createElement("div",{className:lp("bg-white flex flex-col items-start justify-between",h.config.elementStyles.say.contentContainerClassName,"w-full h-full")},pp().createElement(hh.Div,{tag:"say.nameTextClassName",className:lp("rounded-br-md text-black",h.config.elementStyles.say.nameTextClassName)},null===(e=u.config.character)||void 0===e?void 0:e.state.name),pp().createElement(wh,{sentence:u,gameState:s,finished:f,useTypeEffect:i,onCompleted:function(){p(!0),b()},count:y,words:c}),pp().createElement("div",null)))))}function Lh(){return Lh=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},Lh.apply(null,arguments)}function Nh(t){var e=t.children,n=t.className,r=t.props,o=t.style,i=t.$ref,a=jh().ratio,s=a.getStyle();return pp().createElement("div",{className:lp("inset-0",n),style:{width:"100%",height:"100%",minWidth:"".concat(a.state.minWidth,"px"),minHeight:"".concat(a.state.minHeight,"px")}},pp().createElement("div",Lh({style:Object.assign(Object.assign(Object.assign(Object.assign({},s),{position:"relative",overflow:"hidden"}),(null==r?void 0:r.style)||{}),o||{})},r||{},{ref:i}),e))}var Rh={say:Ih,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=t.words,a=mp().game,s=jh().ratio,u=a.config.elements.say.use,c=(0,fp.useMemo)((function(){return n.map((function(t){return Object.assign(Object.assign({},t),{words:t.prompt.evaluate(Zf.getCtx({gameState:o}))})}))}),[]);return pp().createElement(pp().Fragment,null,pp().createElement(Nh,{className:"absolute"},e&&pp().createElement(u,{state:o,action:{sentence:e,character:null,words:i},useTypeEffect:!1,className:"z-10"})),pp().createElement(hh.Div,{color:"green",border:"dashed",className:lp("absolute"),style:{width:"".concat(a.config.player.width,"px"),height:"".concat(a.config.player.height,"px")}},pp().createElement(hh.Div,{tag:"menu.aspectScaleContainer",style:{transform:"scale(".concat(s.state.scale,")"),transformOrigin:"left top"},className:lp("w-full h-full")},pp().createElement(hh.Div,{tag:"menu.containerClassName",className:lp("absolute flex flex-col items-center justify-center min-w-full w-full h-full",a.config.elementStyles.menu.containerClassName)},pp().createElement("div",{className:"p-4 rounded-lg w-full z-20"},pp().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},c.map((function(t,e){return pp().createElement(hh.Button,{tag:"menu.choiceButtonClassName."+e,key:e,className:lp("bg-white text-black p-2 mt-2 w-1/2",a.config.elementStyles.menu.choiceButtonClassName),onClick:function(){return function(t){r(t)}(Object.assign(Object.assign({},t),{evaluated:Eu.getText(t.words)}))}},pp().createElement(wh,{sentence:t.prompt,gameState:o,useTypeEffect:!1,className:lp(a.config.elementStyles.menu.choiceButtonTextClassName),words:t.words}))}))))))))}},Mh=o(196);function Fh(t){return Fh="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},Fh(t)}function Dh(t){return function(t){if(Array.isArray(t))return Bh(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 Bh(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)?Bh(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 Bh(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 Vh(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,Gh(r.key),r)}}function Gh(t){var e=function(t,e){if("object"!=Fh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Fh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Fh(e)?e:e+""}var Uh=function(){return function(t,e,n){return e&&Vh(t.prototype,e),n&&Vh(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.game=e,this.prefix=n}),[{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,Dh(this.colorLog.apply(this,["gray",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,Dh(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,Dh(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,Dh(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,Dh(this.colorLog.apply(this,["gray",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:"weakWarn",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).log.apply(e,Dh(this.colorLog.apply(this,["yellow",t].concat(r))))}}},{key:"group",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this._log(t).join(" ");return this.game.config.app.logger.info&&(n?console.groupCollapsed(r):console.group(r)),{end:function(){e.game.config.app.logger.info&&console.groupEnd()}}}},{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)}},{key:"colorLog",value:function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(0===r.length)return["%c".concat(this.prefix||""," ").concat(e),"color: ".concat(t)];var i=[],a=[],s=[];return this.prefix?(i.push("%c".concat(this.prefix," [").concat(e,"]")),a.push("color: ".concat(t))):(i.push("%c[".concat(e,"]")),a.push("color: ".concat(t))),r.forEach((function(e){"string"==typeof e?(i.push("%c".concat(e)),a.push("color: ".concat(t))):(i.push("%O"),s.push(e),a.push(""))})),[i.join(" ")].concat(a,s)}}])}();function Wh(t){return Wh="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},Wh(t)}function zh(t){return function(t){if(Array.isArray(t))return qh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$h(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hh(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Hh=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==Wh(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(Wh(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 $h(t,e){if(t){if("string"==typeof t)return qh(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)?qh(t,e):void 0}}function qh(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 Yh(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,Xh(r.key),r)}}function Xh(t){var e=function(t,e){if("object"!=Wh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wh(e)?e:e+""}var Kh=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())}))},Zh=function(){return function(t,e,n){return e&&Yh(t.prototype,e),n&&Yh(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 E,this.logger=new Uh(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByDisplayable",value:function(t){return this.state.elements.find((function(e){return e.ele.displayable.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:"isSceneActive",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=$h(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}}}}(this.state.elements);try{for(n.s();!(e=n.n()).done;){if(e.value.scene===t)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}},{key:"moveUpElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,Math.min(n.ele.displayable.indexOf(e)+1,n.ele.displayable.length-1)),this):this}},{key:"moveDownElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,Math.max(n.ele.displayable.indexOf(e)-1,0)),this):this}},{key:"moveTopElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,n.ele.displayable.length-1),this):this}},{key:"moveBottomElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,0),this):this}},{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=e.evaluate(Zf.getCtx({gameState:this}));this.game.getLiveGame().events.emit(rd.EventTypes["event:character.prompt"],{character:e.config.character,sentence:e,text:Eu.getText(a)});var s=this.createWaitableAction({character:e.config.character,sentence:e,id:t,words:a},(function(){i.splice(i.indexOf(s),1),n&&n()}));i.push(s)}},{key:"createMenu",value:function(t,e,n){var r,o=this;if(!t.choices.length)throw new Error("Menu must have at least one choice");var i=null===(r=this.findElementByScene(this.getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!i)throw new Error("Scene not found");var a=t.prompt.evaluate(Zf.getCtx({gameState:this})),s=this.createWaitableAction(Object.assign(Object.assign({},t),{words:a}),(function(t){i.splice(i.indexOf(s),1),e&&e(t),o.game.getLiveGame().events.emit(rd.EventTypes["event:character.prompt"],{character:t.prompt.config.character,sentence:t.prompt,text:t.evaluated})}));i.push(s)}},{key:"createImage",value:function(t,e){var n=this.getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.displayable.push(t),this):this}},{key:"createWearable",value:function(t,e){return t.events.any(Ps.EventTypes["event:wearable.create"],e)}},{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.displayable;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:"createDisplayable",value:function(t,e){var n=this.getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.displayable.push(t),this):this}},{key:"disposeDisplayable",value:function(t,e){var n,r=this.getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.displayable;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Displayables not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.sounds.forEach((function(t){var e;return null===(e=t.getPlaying())||void 0===e?void 0:e.stop()})),this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),t.removeScene(n),n.events.clear()})),this.state.elements=[],this.state.srcManagers=[]}},{key:"initSound",value:function(t,e){return t.getPlaying()||t.setPlaying(new(this.getHowl())(t.getHowlOptions(e))),t}},{key:"playSound",value:function(t,e,n){this.initSound(t,n);var r=t.getPlaying().play(),o=[t.getPlaying().once("end",i.bind(this)),t.getPlaying().once("stop",i.bind(this))];function i(){e&&e(),o.forEach((function(t){return t.off()})),this.state.sounds=this.state.sounds.filter((function(e){return e!==t})),this.stage.next()}return this.state.sounds.push(t),t.state.token=r,r}},{key:"stopSound",value:function(t){var e,n;return(null===(e=t.state.playing)||void 0===e?void 0:e.playing(t.getToken()))&&(null===(n=t.state.playing)||void 0===n||n.stop(t.getToken())),t.setPlaying(null).setToken(null),t}},{key:"transitionSound",value:function(t,e,n){return Kh(this,void 0,void 0,Hh().mark((function r(){var o;return Hh().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=5;break}if(!n){r.next=4;break}return r.next=4,this.fadeSound(t,0,n);case 4:this.stopSound(t);case 5:if(!e){r.next=12;break}if(o=e.config.volume,this.playSound(e,void 0,{volume:0}),!n){r.next=11;break}return r.next=11,this.fadeSound(e,o,n);case 11:e.getPlaying().volume(o,e.getToken());case 12:case"end":return r.stop()}}),r,this)})))}},{key:"fadeSound",value:function(t,e,n){var r,o;return Kh(this,void 0,void 0,Hh().mark((function i(){var a;return Hh().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return a=null===(r=t.getPlaying())||void 0===r?void 0:r.volume(t.getToken()),null===(o=t.getPlaying())||void 0===o||o.fade(a,e,n,t.getToken()),i.next=4,j(n);case 4:return i.abrupt("return",void 0);case 5:case"end":return i.stop()}}),i)})))}},{key:"getHowl",value:function(){return Mh.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(zh(n)))}},{key:"animateText",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(zh(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:"getSceneByName",value:function(t){var e;return(null===(e=this.game.getLiveGame().story)||void 0===e?void 0:e.getScene(t))||null}},{key:"getStory",value:function(){if(!this.game.getLiveGame().story)throw new fu("Story not loaded");return this.game.getLiveGame().story}},{key:"dispose",value:function(){this.forceReset()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{displayable:t.ele.displayable.map((function(t){return t.getId()}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;if(this.state.elements=[],!this.game.getLiveGame().story)throw new Error("No story loaded");t.scenes.forEach((function(t){var r=t.sceneId,o=t.elements;n.logger.debug("Loading scene: "+r);var i=e.get(r);if(!i)throw new fu("Scene not found, id: "+r+"\nNarraLeaf cannot find the element with the id from the saved game");var a={scene:i,ele:{menus:[],texts:[],displayable:o.displayable.map((function(t){if(!e.has(t))throw new fu("Displayable not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game\nThis may be caused by the damage of the saved game file or the change of the story file");return e.get(t)}))}};n.state.elements.push(a),n.registerSrcManager(i.srcManager),xt.registerEventListeners(i,n)}))}},{key:"getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new fu('Scene not found, please call "scene.activate()" first.');return e}},{key:"getElementMap",value:function(){return{texts:[],menus:[],displayable:[]}}},{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:"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 Qh(t){return Qh="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},Qh(t)}function Jh(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 td(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)?td(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 td(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 ed(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,nd(r.key),r)}}function nd(t){var e=function(t,e){if("object"!=Qh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qh(e)?e:e+""}Zh.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip","event:state.preload.unmount":"event:state.preload.unmount","event:state.preload.loaded":"event:state.preload.loaded","event:state.player.flush":"event:state.player.flush"};var rd=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gameLock=new L,this.events=new E,this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this.gameState=void 0,this._lockedCount=0,this.currentAction=null,this._nextLock=new I,this.game=e,this.storable=new uf,this.initNamespaces()}return function(t,e,n){return e&&ed(t.prototype,e),n&&ed(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"initNamespaces",value:function(){return this.storable.clear().addNamespace(new sf(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this.story&&this.story.initPersistent(this.storable),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t.constructStory(),this}},{key:"serialize",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState,o=this.story;if(!o)throw new Error("No story loaded");var i=this.storable.toData(),a=r.toData(),s=(null===(t=this.getCurrentAction())||void 0===t?void 0:t.getId())||null,u=o.getAllElementStates();return{name:(null===(e=this.currentSavedGame)||void 0===e?void 0:e.name)||"",meta:{created:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.meta.created)||Date.now(),updated:Date.now()},game:{store:i,stage:a,currentAction:s,elementStates:u}}}},{key:"deserialize",value:function(t){var e;if(!this.gameState)throw new Error("No game state");var n=this.gameState,r=this.story;if(!r)throw new Error("No story loaded");this.reset({gameState:n}),n.stage.forceUpdate();var o=new Map,i=new Map,a=t.game,s=a.store,u=a.stage,c=a.elementStates,l=a.currentAction;if(r.forEachChild(r,(null===(e=r.entryScene)||void 0===e?void 0:e.getSceneRoot())||[],(function(t){o.set(t.getId(),t),i.set(t.callee.getId(),t.callee)})),this.storable.clear().load(s),c.forEach((function(t){var e=t.id,r=t.data;n.logger.debug("restore element",e);var o=i.get(e);if(!o)throw new Error("Element not found, id: "+e+"\nNarraLeaf cannot find the element with the id from the saved game");o.reset(),o.fromData(r)})),this.currentSavedGame=t,n.loadData(u,i),l){var f=o.get(l);if(!f)throw new Error("Action not found, id: "+l+"\nNarraLeaf cannot find the action with the id from the saved game");this.currentAction=f}n.stage.forceUpdate(),n.stage.next()}},{key:"onCharacterPrompt",value:function(e){var n=this,r=t.EventTypes["event:character.prompt"],o=this.events.on(r,e);return{cancel:function(){n.events.off(r,o)}}}},{key:"onMenuChoose",value:function(e){var n=this,r=t.EventTypes["event:menu.choose"],o=this.events.on(r,e);return{cancel:function(){n.events.off(r,o)}}}},{key:"newGame",value:function(){var t,e,n,r,o;if(!this.gameState)throw new Error("No game state");var i=this.gameState,a=i.logger.group("LiveGame");this.reset({gameState:i}),this.initNamespaces();var s=this.getNewSavedGame();s.name="NewGame-"+Date.now(),this.currentSavedGame=s,this.currentAction=(null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.getSceneRoot())||null;var u=null===(n=this.story)||void 0===n?void 0:n.getAllElementMap(this.story,(null===(o=null===(r=this.story)||void 0===r?void 0:r.entryScene)||void 0===o?void 0:o.getSceneRoot())||[]);return u?u.forEach((function(t){i.logger.debug("reset element",t),t.reset()})):i.logger.warn("No elements found"),i.stage.forceUpdate(),i.stage.next(),a.end(),this}},{key:"reset",value:function(t){var e=t.gameState;this.lockedAwaiting&&this.lockedAwaiting.abort(),this.currentAction=null,this.lockedAwaiting=null,this.currentSavedGame=null,e.forceReset()}},{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;if(this.gameLock.isLocked())return this.gameLock;if(this._nextLock.isLocked())return null;if(this._nextLock.lock(),!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("LiveGame locked: dead cycle detected\nPlease refresh the page");return this._nextLock.unlock(),this.lockedAwaiting}var r=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==r?void 0:r.node)||void 0===e?void 0:e.action)||null,this.lockedAwaiting=null,this.currentAction||t.events.emit(Zh.EventTypes["event:state.end"]),t.logger.debug("next action (lockedAwaiting)",r),this._nextLock.unlock(),r||null}if(!this.currentAction)return t.logger.weakWarn("LiveGame","No current action"),this._nextLock.unlock(),null;var o=this.currentAction.executeAction(t);return x.isAwaitable(o)?(this.lockedAwaiting=o,this._nextLock.unlock(),o):(t.logger.debug("next action",o),this._lockedCount=0,this.currentAction=(null===(n=o.node)||void 0===n?void 0:n.action)||null,this._nextLock.unlock(),o)}},{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=e.executeAction(t);return x.isAwaitable(r)?r:(null===(n=null==r?void 0:r.node)||void 0===n?void 0:n.action)||null}},{key:"setGameState",value:function(t){return this.gameState=t,this}},{key:"getGameState",value:function(){return this.gameState}},{key:"getAllPredictableActions",value:function(t,n,r){for(var o,i,s,u=(null==n?void 0:n.contentNode)||null,c=[],l=[],f=new Set;(u||l.length)&&!(r&&c.length>=r);)if(u||(u=l.pop().contentNode),[uc].some((function(t){return(null==u?void 0:u.action)&&u.action instanceof t})))u=null;else if(u.action&&u.action.is(xt,e.jumpTo)){var p=Jh(u.action.contentNode.getContent(),1)[0],h=t.getScene(p);if(!h)throw u.action._sceneNotFoundError(u.action.getSceneName(p));if(f.has(h)){u=null;continue}f.add(h),u=(null===(o=h.getSceneRoot())||void 0===o?void 0:o.contentNode)||null}else{if(u.action&&u.action.is(Sa,a.do)){var d=Jh(u.action.contentNode.getContent(),1)[0];(null===(i=u.getChild())||void 0===i?void 0:i.action)&&l.push(u.getChild().action),u=(null===(s=d[0])||void 0===s?void 0:s.contentNode)||null}u.action&&c.push(u.action),u=u.getChild()}return c}},{key:"getNewSavedGame",value:function(){var t,e;return{name:"",meta:{created:Date.now(),updated:Date.now()},game:{store:{},stage:{scenes:[]},elementStates:[],currentAction:(null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.getSceneRoot().getId())||null}}}}])}();function od(t){return od="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},od(t)}function id(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,ad(r.key),r)}}function ad(t){var e=function(t,e){if("object"!=od(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=od(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==od(e)?e:e+""}rd.DefaultNamespaces={game:{}},rd.GameSpacesKey={game:"game"},rd.EventTypes={"event:character.prompt":"event:character.prompt","event:menu.choose":"event:menu.choose"};var sd,ud=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.settings=e,this.events=new E}return function(t,e,n){return e&&id(t.prototype,e),n&&id(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"setPreference",value:function(e,n){this.settings[e]=n,this.events.emit(t.EventTypes["event:game.preference.change"],e,n)}},{key:"getPreference",value:function(t){return this.settings[t]}},{key:"getPreferences",value:function(){return this.settings}},{key:"onPreferenceChange",value:function(e,n){var r=this,o=this.events.on(t.EventTypes["event:game.preference.change"],(function(t,r){"string"==typeof e?e===t&&n&&n(r):e(t,r)}));return{cancel:function(){return r.events.off(t.EventTypes["event:game.preference.change"],o)}}}},{key:"importPreferences",value:function(t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.setPreference(e,t[e])}},{key:"exportPreferences",value:function(){var t={};for(var e in this.settings)Object.prototype.hasOwnProperty.call(this.settings,e)&&(t[e]=this.settings[e]);return t}}])}();function cd(t){return cd="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},cd(t)}function ld(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,fd(r.key),r)}}function fd(t){var e=function(t,e){if("object"!=cd(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cd(e)?e:e+""}ud.EventTypes={"event:game.preference.change":"event:game.preference.change"},function(t){t.game="game"}(sd||(sd={}));var pd=function(){return function(t,e,n){return e&&ld(t.prototype,e),n&&ld(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.liveGame=null,this.preference=new ud(t.DefaultPreference),this.config=k(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Rh).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 rd(this)}}])}();pd.defaultSettings={volume:1},pd.ComponentTypes={say:"say",menu:"menu"},pd.DefaultPreference={autoForward:!1,skip:!0},pd.Preferences={autoForward:"autoForward",skip:"skip"},pd.DefaultConfig={player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:1920,height:1080,skipKey:["Control"],skipInterval:100,ratioUpdateInterval:50,preloadDelay:100,preloadConcurrency:5,waitForPreload:!1,preloadAllImages:!0,forceClearCache:!1,maxPreloadActions:10,cursor:null,cursorHeight:30,cursorWidth:30},elements:{say:{nextKey:[" "],textInterval:50,use:Rh.say,useAspectScale:!0,autoForwardDelay:3e3},img:{slowLoadWarning:!0,slowLoadThreshold:2e3,allowSkipTransform:!0,allowSkipTransition:!0},menu:{use:Rh.menu},background:{allowSkipTransform:!0,allowSkipTransition:!1},text:{allowSkipTransform:!0,allowSkipTransition:!0,width:1920,height:216}},elementStyles:{say:{contentContainerClassName:"",containerClassName:"",nameTextClassName:"",textContainerClassName:"",textSpanClassName:"",rubyClassName:""},menu:{containerClassName:"",choiceButtonClassName:"",choiceButtonTextClassName:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1},inspector:!1}},pd.GameSettingsNamespace=sd;var hd=o(72),dd=o.n(hd),yd=o(825),vd=o.n(yd),md=o(659),gd=o.n(md),bd=o(56),wd=o.n(bd),Sd=o(540),_d=o.n(Sd),kd=o(113),xd=o.n(kd),Ad=o(587),Od={};Od.styleTagTransform=xd(),Od.setAttributes=wd(),Od.insert=gd().bind(null,"head"),Od.domAPI=vd(),Od.insertStyleElement=_d();dd()(Ad.A,Od);Ad.A&&Ad.A.locals&&Ad.A.locals;function Ed({children:t,features:e,strict:n=!1}){const[,r]=(0,fp.useState)(!Td(e)),o=(0,fp.useRef)(void 0);if(!Td(e)){const{renderer:t,...n}=e;o.current=t,Np(n)}return(0,fp.useEffect)((()=>{Td(e)&&e().then((({renderer:t,...e})=>{Np(e),o.current=t,r(!0)}))}),[]),(0,bp.jsx)(xp.Provider,{value:{renderer:o.current,strict:n},children:t})}function Td(t){return"function"==typeof t}function jd(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 Pd(t,e,n={}){var r;const o=$o(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(Jo(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(Cd).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(Pd(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 Cd(t,e){return t.sortNodePosition(e)}const Id=li.length;function Ld(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Ld(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<Id;n++){const r=li[n],o=t.props[r];(ui(o)||!1===o)&&(e[r]=o)}return e}const Nd=[...ci].reverse(),Rd=ci.length;function Md(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=>Pd(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=Pd(t,e,n);else{const o="function"==typeof e?$o(t,e,n.custom):e;r=Promise.all(Jo(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Fd(t){let e=Md(t),n=Vd(),r=!0;const o=e=>(n,r)=>{var o;const i=$o(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{props:a}=t,s=Ld(t.parent)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<Rd;e++){const p=Nd[e],h=n[p],d=void 0!==a[p]?a[p]:s[p],y=ui(d),v=p===i?h.isActive:null;!1===v&&(f=e);let m=d===s[p]&&d!==a[p]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),h.protectedKeys={...l},!h.isActive&&null===v||!d&&!h.prevProp||si(d)||"boolean"==typeof d)continue;const g=Dd(h.prevProp,d);let b=g||p===i&&h.isActive&&!m&&y||e>f&&y,w=!1;const S=Array.isArray(d)?d:[d];let _=S.reduce(o(p),{});!1===v&&(_={});const{prevResolvedValues:k={}}=h,x={...k,..._},A=e=>{b=!0,c.has(e)&&(w=!0,c.delete(e)),h.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=_[t],n=k[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Fo(e)&&Fo(n)?!jd(e,n):e!==n,r?null!=e?A(t):c.add(t):void 0!==e&&c.has(t)?A(t):h.protectedKeys[t]=!0}h.prevProp=d,h.prevResolvedValues=_,h.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(b=!1);b&&(!(m&&g)||w)&&u.push(...S.map((t=>({animation:t,options:{type:p}}))))}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 p=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(p=!1),r=!1,p?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=Vd(),r=!0}}}function Dd(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!jd(e,t)}function Bd(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Vd(){return{animate:Bd(!0),whileInView:Bd(),whileHover:Bd(),whileTap:Bd(),whileDrag:Bd(),whileFocus:Bd(),exit:Bd()}}class Gd{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Ud=0;const Wd={animation:{Feature:class extends Gd{constructor(t){super(t),t.animationState||(t.animationState=Fd(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();si(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 Gd{constructor(){super(...arguments),this.id=Ud++}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 zd(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Hd(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const $d=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Hd(e));function qd(t,e,n,r){return zd(t,e,$d(n),r)}function Yd(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Xd=Yd("dragHorizontal"),Kd=Yd("dragVertical");function Zd(){const t=function(t){let e=!1;if("y"===t)e=Kd();else if("x"===t)e=Xd();else{const t=Xd(),n=Kd();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function Qd(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return qd(t.current,n,((n,o)=>{if("touch"===n.pointerType||Zd())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&un.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Jd=(t,e)=>!!e&&(t===e||Jd(t,e.parentElement));function ty(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Hd(n))}const ey=new WeakMap,ny=new WeakMap,ry=t=>{const e=ey.get(t.target);e&&e(t)},oy=t=>{t.forEach(ry)};function iy(t,e,n){const r=function({root:t,...e}){const n=t||document;ny.has(n)||ny.set(n,{});const r=ny.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(oy,{root:t,...e})),r[o]}(e);return ey.set(t,n),r.observe(t),()=>{ey.delete(t),r.unobserve(t)}}const ay={some:0,all:1};const sy={inView:{Feature:class extends Gd{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:ay[r]};return iy(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 Gd{constructor(){super(...arguments),this.removeStartListeners=ie,this.removeEndListeners=ie,this.removeAccessibleListeners=ie,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=qd(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Jd(this.node.current,t.target)?n:r;i&&un.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=qd(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=eo(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=zd(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=zd(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&ty("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&un.postRender((()=>n(t,e)))}))})),ty("down",((t,e)=>{this.startPress(t,e)}))})),e=zd(this.node.current,"blur",(()=>{this.isPressing&&ty("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=eo(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&&un.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Zd()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&un.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=qd(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=zd(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=eo(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Gd{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=eo(zd(this.node.current,"focus",(()=>this.onFocus())),zd(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Gd{mount(){this.unmount=eo(Qd(this.node,!0),Qd(this.node,!1))}unmount(){}}}},uy={renderer:(t,e)=>Vp(t)?new Ii(e):new Ni(e,{allowProjection:t!==fp.Fragment}),...Wd,...sy};function cy(t){var e=t.children;return pp().createElement(Ed,{features:uy,strict:!0},e)}function ly(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 fy(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)?fy(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 fy(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 py(t){var e=t.children,n=t.className,r=ly((0,fp.useState)({}),2),o=r[0],i=r[1],a=jh().ratio,s=mp().game,u=ly((0,fp.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,fp.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("NarraLeaf-React: 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"});var p=e/s.config.player.width;a.update(e,n,p),a.updateMin(c,l),u()}}};a.setUpdate(e);var n,r,o,f=(n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)},r=s.config.player.ratioUpdateInterval,o=null,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];o&&clearTimeout(o),o=setTimeout((function(){n.apply(void 0,e)}),r)});f(),window.addEventListener("resize",f);var p=a.onRequestedUpdate(f);return function(){window.removeEventListener("resize",f),clearTimeout(t),p()}}),[a]),pp().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},pp().createElement("div",{className:lp(n),style:o},e))}function hy(t){return hy="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},hy(t)}function dy(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */dy=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==hy(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(hy(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 yy(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 vy(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)?vy(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 vy(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 my=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 gy(t){var e=this,n=t.state,r=t.displayable,o=t.child,i=r.element,a=r.state,s=void 0===a?i:a,u=(0,fp.useRef)(null),c=yy((0,fp.useState)(null),2),l=c[0],f=c[1],p=yy((0,fp.useState)([]),2)[1],h=yy((0,fp.useState)(null),2),d=h[0],y=h[1],v=yy((0,fp.useState)({}),2),m=v[0],g=v[1];function b(t){if(d&&d.getControl()&&(n.logger.warn("Displayable Animation","processing transform not completed"),d.getControl().complete(),d.setControl(null)),!u.current)throw new Error("scope not ready");t instanceof Ji?Object.assign(u.current.style,t.propToCSS(n,s.state,r.transformOverwrites)):Object.assign(u.current.style,t)}function w(t){return f(t),t?new Promise((function(e){var r=t.events.onEvents([{type:pl.update,listener:t.events.on(pl.update,(function(t){p(t)}))},{type:pl.end,listener:t.events.on(pl.end,(function(){f(null),n.logger.debug("transition end",t)}))},{type:pl.start,listener:t.events.on(pl.start,(function(){n.logger.debug("transition start",t)}))}]);t.start((function(){r.cancel(),e()}))})):(n.logger.warn("transition not set"),Promise.resolve())}function S(t){return my(this,void 0,void 0,dy().mark((function e(){return dy().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(n,s.state,r.transformOverwrites)),y(t),e.next=4,t.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(e){s.state=k(s.state,e),g({style:t.propToCSS(n,s.state,r.transformOverwrites)}),y(null)}));case 4:case"end":return e.stop()}}),e)})))}return(0,fp.useEffect)((function(){var t="event:displayable.applyTransition",o="event:displayable.applyTransform",a="event:displayable.init",c=i.events.onEvents([{type:t,listener:i.events.on(t,w)},{type:o,listener:i.events.on(o,S)},{type:a,listener:i.events.on(a,(function(){return my(e,void 0,void 0,dy().mark((function t(){var e;return dy().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.toDisplayableTransform(),n.logger.debug("init transform",e),t.next=4,e.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(t){s.state=k(s.state,t)}));case 4:case"end":return t.stop()}}),t)})))}))}]);return function(){c.cancel()}}),[]),(0,fp.useEffect)((function(){if(!u.current)throw new Error("Scope not ready. Using element: ".concat(i.constructor.name))}),[]),(0,fp.useEffect)((function(){var t=n.events.onEvents([{type:Zh.EventTypes["event:state.player.skip"],listener:n.events.on(Zh.EventTypes["event:state.player.skip"],(function(){r.skipTransform&&d&&d.getControl()&&(d.getControl().complete(),d.setControl(null),n.logger.debug("transform skip")),r.skipTransition&&l&&l.controller&&(l.controller.complete(),f(null),n.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[l,d]),pp().createElement(pp().Fragment,null,o({transformRef:u,transition:l,transform:d,transformProps:m,state:n}))}function by(t){return by="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},by(t)}function wy(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,Sy(r.key),r)}}function Sy(t){var e=function(t,e){if("object"!=by(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=by(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==by(e)?e:e+""}var _y=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 E}return function(t,e,n){return e&&wy(t.prototype,e),n&&wy(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 el.getSrc(t)}}])}();function ky(t){return ky="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},ky(t)}function xy(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ay(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)?Ay(t,e):void 0}}(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 Ay(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 Oy(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,Ey(r.key),r)}}function Ey(t){var e=function(t,e){if("object"!=ky(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ky(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ky(e)?e:e+""}_y.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 Ty=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.src=new Map,this.preloadTasks=new Map}return function(t,e,n){return e&&Oy(t.prototype,e),n&&Oy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"has",value:function(t){return this.src.has(t)}},{key:"add",value:function(t,e){return this.src.set(t,e),this}},{key:"remove",value:function(t){return this.src.delete(t),this}},{key:"get",value:function(t){return this.src.get(t)}},{key:"clear",value:function(){return this.src.clear(),this}},{key:"size",value:function(){return this.src.size}},{key:"isPreloading",value:function(t){return this.preloadTasks.has(t)}},{key:"preload",value:function(e){var n=this;if(this.src.has(e)||this.preloadTasks.has(e))return{abort:function(){},onFinished:function(){}};var r=new AbortController,o=r.signal,i={promise:t.getImage(e,o),controller:r};return this.preloadTasks.set(e,i),i.promise.then((function(t){n.preloadTasks.delete(e),t&&n.add(e,t)})),{abort:function(){r.abort(),n.preloadTasks.delete(e)},onFinished:function(t){i.promise.then(t)}}}},{key:"abortAll",value:function(){this.preloadTasks.forEach((function(t){t.controller.abort()})),this.preloadTasks.clear()}},{key:"abort",value:function(t){var e=this.preloadTasks.get(t);e&&(e.controller.abort(),this.preloadTasks.delete(t))}},{key:"preloadedSrc",value:function(){return Array.from(this.src.values())}},{key:"filter",value:function(t){var e,n=xy(this.src.keys());try{for(n.s();!(e=n.n()).done;){var r=e.value;t.includes(r)||this.src.delete(r)}}catch(t){n.e(t)}finally{n.f()}return this}}],[{key:"getImage",value:function(t,e){return function(t,e){return S(this,void 0,void 0,l().mark((function n(){var r,o;return l().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,fetch(t,e);case 2:return r=n.sent,n.next=5,r.blob();case 5:return o=n.sent,n.abrupt("return",new Promise((function(t){var e=new FileReader;e.onload=function(){t(e.result)},e.readAsDataURL(o)})));case 7:case"end":return n.stop()}}),n)})))}(t,{signal:e})}}])}();function jy(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 Py(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)?Py(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 Py(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 Cy=(0,fp.createContext)(null);function Iy(t){var e=t.children,n=jy((0,fp.useState)(new _y),1)[0],r=jy((0,fp.useState)(new Ty),1)[0];return pp().createElement(pp().Fragment,null,pp().createElement(Cy.Provider,{value:{preloaded:n,cacheManager:r}},e))}function Ly(){if(!Cy)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,fp.useContext)(Cy)}function Ny(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 Ry(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)?Ry(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 Ry(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 My(){return My=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},My.apply(null,arguments)}function Fy(t){var e=t.scene,n=t.props,r=t.state;return pp().createElement(gy,{displayable:{element:e,skipTransform:r.game.config.elements.background.allowSkipTransform,skipTransition:r.game.config.elements.background.allowSkipTransition},child:function(t){return pp().createElement(Dy,My({},t,{scene:e,props:n}))},state:r})}function Dy(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.state,i=t.scene,a=t.props,s=jh().ratio,u=Ly().cacheManager,c=Ny(pp().useState(!1),2),l=c[0],f=c[1];function p(){l||(f(!0),i.events.emit(Lf.EventTypes["event:scene.imageLoaded"]),o.logger.debug("BackgroundTransition","Image loaded",i))}var h="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAgAB9sWFXTkAAAAASUVORK5CYII=",d={src:h,style:Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{})};return pp().createElement("div",null,pp().createElement(ah.div,My({layout:!0,ref:e,className:"absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"},k({style:Object.assign({},s.getStyle())},n)),(r?r.toElementProps():[{}]).map((function(t,e){var n,r=k(d,a,t);return pp().createElement("img",My({alt:r.alt},r,{onLoad:p,src:(n=r.src,n?u.has(n)?u.get(n):n:h),className:"absolute",key:e}))}))))}function By(t){return By="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},By(t)}function Vy(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Vy=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 P(r||[]);return o(a,"_invoke",{value:O(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 p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);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"==By(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 O(e,n,r){var o=p;return function(i,a){if(o===d)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===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,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 T(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,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(By(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,P.prototype={constructor:P,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(j),!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),j(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;j(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 Gy(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 Uy(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)?Uy(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 Uy(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 Wy=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 zy(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=jh().ratio,a=Gy((0,fp.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1];return(0,fp.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(Lf.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){return Wy(this,void 0,void 0,Vy().mark((function r(){var o,i;return Vy().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=s,i=t,r.next=4,n.transitionSound(o,i,e);case 4:if(i){r.next=6;break}return r.abrupt("return");case 6:u(i);case 7:case"end":return r.stop()}}),r)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(Lf.EventTypes["event:scene.preUnmount"],(function(){s&&function(t,e){return Wy(this,void 0,void 0,Vy().mark((function r(){return Vy().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.fadeSound(t,0,e);case 2:n.stopSound(t);case 3:case"end":return r.stop()}}),r)})))}(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,fp.useEffect)((function(){return e.events.emit(Lf.EventTypes["event:scene.mount"]),function(){e.events.emit(Lf.EventTypes["event:scene.unmount"])}}),[]),pp().createElement("div",{className:o},pp().createElement(Fy,{scene:e,props:{width:i.state.width,height:i.state.height,src:au.isImageSrc(e.state.background)?au.srcToString(e.state.background):void 0,style:{backgroundColor:au.isImageColor(e.state.background)?au.toHex(e.state.background):void 0}},state:n}),r)}function Hy(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=qy(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 $y(t){return function(t){if(Array.isArray(t))return Yy(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||qy(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 qy(t,e){if(t){if("string"==typeof t)return Yy(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)?Yy(t,e):void 0}}function Yy(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 Xy(t){var e=t.state,n=Ly(),r=n.preloaded,o=n.cacheManager,i=mp().game,a=(0,fp.useRef)(new Set),s="Preload",u=e.getLastScene(),c=i.getLiveGame().getCurrentAction(),l=i.getLiveGame().story;return(0,fp.useEffect)((function(){var t,n;if("undefined"==typeof fetch)return r.events.emit(_y.EventTypes["event:preloaded.ready"]),void e.logger.warn(s,"Fetch is not supported in this environment, skipping preload");if(!i.config.player.preloadAllImages)return r.events.emit(_y.EventTypes["event:preloaded.ready"]),void e.logger.debug(s,"Preload all images is disabled, skipping preload");if(i.config.player.forceClearCache&&(o.clear(),e.logger.weakWarn(s,"Cache cleared")),l){var a=performance.now(),c=el.catSrc([].concat($y((null===(t=null==u?void 0:u.srcManager)||void 0===t?void 0:t.src)||[]),$y((null===(n=null==u?void 0:u.srcManager)||void 0===n?void 0:n.getFutureSrc())||[]))),f=new D(i.config.player.preloadConcurrency,i.config.player.preloadDelay),p=[],h=e.logger.group(s,!0);e.logger.debug(s,"preloading:",c);var d,y=Hy(c.image);try{var v=function(){var t=d.value,n=el.getSrc(t);if(p.push(n),o.has(n)||o.isPreloading(n))return e.logger.debug(s,"Image already loaded (".concat(c.image.indexOf(t)+1,"/").concat(c.image.length,")"),n),1;f.addTask((function(){return new Promise((function(r){o.preload(n).onFinished((function(){e.logger.debug(s,"Image loaded (".concat(c.image.indexOf(t)+1,"/").concat(c.image.length,")"),n),r()}))}))}))};for(y.s();!(d=y.n()).done;)v()}catch(t){y.e(t)}finally{y.f()}return h.end(),f.start().then((function(){e.logger.info(s,"Image preload","loaded ".concat(o.size()," images in ").concat(performance.now()-a,"ms")),i.config.player.waitForPreload&&r.events.emit(_y.EventTypes["event:preloaded.ready"]),e.events.emit(Zh.EventTypes["event:state.preload.loaded"]),o.filter(p)})),i.config.player.waitForPreload||r.events.emit(_y.EventTypes["event:preloaded.ready"]),r.events.emit(_y.EventTypes["event:preloaded.mount"]),function(){e.events.emit(Zh.EventTypes["event:state.preload.unmount"]),e.logger.debug(s,"Preload unmounted")}}e.logger.weakWarn(s,"Story not found, skipping preload")}),[u,l]),(0,fp.useEffect)((function(){a.current.clear()}),[u]),(0,fp.useEffect)((function(){if("undefined"!=typeof fetch&&!i.config.player.preloadAllImages)if(l){var t=performance.now(),n=i.getLiveGame().getAllPredictableActions(l,c,i.config.player.maxPreloadActions).map((function(t){return el.getPreloadableSrc(l,t)})).filter((function(t){return null!==t}));n.filter((function(t){return"scene"===(null==t?void 0:t.activeType)})).forEach((function(t){a.current.has(t)||a.current.add(t)}));var r=el.catSrc([].concat($y(a.current),$y(n))),u=new D(i.config.player.preloadConcurrency,i.config.player.preloadDelay),f=[],p=e.logger.group(s);e.logger.debug(s,"preloading:",r);var h,d=Hy(r.image);try{var y=function(){var t=h.value,n=el.getSrc(t);if(f.push(n),o.has(n)||o.isPreloading(n))return e.logger.debug(s,"Image already loaded (".concat(r.image.indexOf(t)+1,"/").concat(r.image.length,")"),n),1;u.addTask((function(){return new Promise((function(i){o.preload(n).onFinished((function(){e.logger.debug(s,"Image loaded (".concat(r.image.indexOf(t)+1,"/").concat(r.image.length,")"),n),i()}))}))}))};for(d.s();!(h=d.n()).done;)y()}catch(t){d.e(t)}finally{d.f()}p.end(),u.start().then((function(){e.logger.info(s,"Image preload (quick reload)","loaded ".concat(o.size()," images in ").concat(performance.now()-t,"ms")),o.filter(f)}))}else e.logger.weakWarn(s,"Story not found, skipping preload")}),[c,l]),null}function Ky(t){var e=t.state,n=mp().game;return(0,fp.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&n.preference.getPreference(pd.Preferences.skip)&&e.events.emit(Zh.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\nThis component must be rendered in a browser environment")}),[]),pp().createElement(pp().Fragment,null)}var Zy=o(33);function Qy(){return Qy=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},Qy.apply(null,arguments)}function Jy(t){var e=t.state,n=t.text,r={scale:function(t){return{width:"fit-content"}},transform:function(t){return{transform:Ji.propToCSSTransform(e,t,{translate:["left"===n.config.alignX?"0%":"right"===n.config.alignX?"-100%":void 0,"top"===n.config.alignY?"100%":"bottom"===n.config.alignY?"0%":void 0]})}}};return pp().createElement(gy,{displayable:{element:n,skipTransform:e.game.config.elements.text.allowSkipTransform,skipTransition:e.game.config.elements.text.allowSkipTransition,transformOverwrites:r},child:function(t){return pp().createElement(tv,Qy({},t,{text:n}))},state:e})}function tv(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.text,i=jh().ratio,a={style:{width:"fit-content",whiteSpace:"nowrap",fontSize:o.state.fontSize}},s=[{}],u=lp(o.config.className);return pp().createElement(hh.Div,null,pp().createElement(hh.mDiv,Qy({tag:"text.container",color:"green",border:"dashed",layout:!0,Ref:e,className:"absolute"},k({style:{opacity:0}},n,{style:{width:"fit-content"}})),r?r.toElementProps().map((function(t,e){var n=k(a,t,{style:{transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}},s[e]||{});return pp().createElement(hh.Span,Qy({tag:"text.transition."+e,key:e},n,{className:u}),pp().createElement("span",null,o.state.text))})):pp().createElement(hh.Div,Qy({tag:"text.transition.last",color:"green",border:"dashed",key:"last"},k(a,{style:{width:"fit-content",transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}})),pp().createElement(hh.Span,{className:u},o.state.text))))}function ev(){return ev=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},ev.apply(null,arguments)}function nv(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 rv(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)?rv(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 rv(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 ov(t){var e=t.props,n=t.onLoad,r=t.id,o=t.Ref,i=(0,fp.useRef)(null),a=jh().ratio,s=nv(pp().useState(0),2),u=s[0],c=s[1],l=Ly().cacheManager,f=mp().game;function p(){var t=o||i;t.current&&c(t.current.naturalWidth*a.state.scale)}(0,fp.useEffect)((function(){var t;!e.src||l.has(e.src)&&!l.isPreloading(e.src)||null===(t=f.getLiveGame().getGameState())||void 0===t||t.logger.warn("AspectScaleImage",'Image not preloaded: "'.concat(e.src,'". ')+"\nThis may be caused by complicated image action behavior that cannot be predicted. \nTo fix this issue, you can manually register the image using scene.requestImagePreload(YourImageSrc). ")}),[e,e.src,r]),(0,fp.useEffect)((function(){return p(),a.onUpdate(p)}),[e,r]);var h=e.src?l.get(e.src)||e.src:Ps.DefaultImagePlaceholder;return pp().createElement("img",ev({ref:o||i},e,{onLoad:n,width:u,alt:e.alt,src:h}))}function iv(t){return function(t){if(Array.isArray(t))return uv(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||sv(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 av(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)||sv(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 sv(t,e){if(t){if("string"==typeof t)return uv(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)?uv(t,e):void 0}}function uv(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 cv(){return cv=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},cv.apply(null,arguments)}function lv(t){var e=t.image,n=t.state,r=function(){};return pp().createElement(gy,{displayable:{element:e,skipTransition:n.game.config.elements.img.allowSkipTransition,skipTransform:n.game.config.elements.img.allowSkipTransform,transformOverwrites:{}},child:function(t){return pp().createElement(fv,cv({},t,{image:e,handleLoad:r}))},state:n})}function fv(t){var e=t.transition,n=t.transformProps,r=t.transformRef,o=t.state,i=t.image,a=t.handleLoad,s=jh().ratio,u=(0,fp.useRef)(null),c=av((0,fp.useState)([]),2),l=c[0],f=c[1],p={src:Ps.getSrc(i.state),style:Object.assign(Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{}),{transformOrigin:"center"})},h=[{style:{display:"block",position:"unset"}},{style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxWidth:"none"}}];return(0,fp.useEffect)((function(){var t=i.events.onEvents([{type:Ps.EventTypes["event:wearable.create"],listener:i.events.on(Ps.EventTypes["event:wearable.create"],(function(t){f((function(e){return[].concat(iv(e),[t])}))}))}]);return function(){t.cancel()}}),[]),pp().createElement("div",null,pp().createElement(hh.mDiv,cv({tag:"image.aspectScaleContainer",color:"green",border:"dashed",layout:!0,Ref:r,className:"absolute"},k({style:{opacity:0}},n,{style:{display:"inline-block",width:u.current?"".concat(u.current.naturalWidth*s.state.scale,"px"):"auto",height:u.current?"".concat(u.current.naturalHeight*s.state.scale,"px"):"auto"}})),pp().createElement(pp().Fragment,null,(e?e.toElementProps():[{}]).map((function(t,e){var n=k(p,t,h[e]||{});return pp().createElement(ov,{key:e,props:Object.assign({className:"absolute"},n),id:n.src,onLoad:a,Ref:0===e?u:void 0})}))),pp().createElement("div",{className:lp("w-full h-full top-0 left-0 absolute")},l.map((function(t){return pp().createElement("div",{className:lp("w-full h-full relative"),key:"wearable-"+t.getId()},pp().createElement(lv,{image:t,state:o}))})))))}function pv(t){var e=t.state,n=t.displayable;return pp().createElement(pp().Fragment,null,n.map((function(t){var n;if(t instanceof Gl)return pp().createElement(Jy,{state:e,text:t,key:"text-"+t.getId()});if(t instanceof Ps)return pp().createElement(lv,{state:e,image:t,key:"image-"+t.getId()});throw new Error("Unsupported displayable type: "+((null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)||t))})))}var hv=o(556),dv=o.n(hv);function yv(t){var e=t.error,n=t.errorInfo;return mp().game.config.app.debug?pp().createElement("div",{className:"text-left"},pp().createElement("h1",null,"It is my fault, NarraLeaf-React cannot initialize the player correctly."),pp().createElement("p",{className:"text-red-700"},"Message: ",e.message),pp().createElement("pre",null,"Error Stack: ",null==e?void 0:e.stack),pp().createElement("pre",null,"Component Stack: ",null==n?void 0:n.componentStack),pp().createElement("pre",null,"Digest: ",null==n?void 0:n.digest)):pp().createElement("div",null,pp().createElement("h1",null,"The game cannot initialize the player correctly."),pp().createElement("p",null,"Please contact the game developer for further assistance."))}function vv(t){return vv="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},vv(t)}function mv(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,gv(r.key),r)}}function gv(t){var e=function(t,e){if("object"!=vv(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=vv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vv(e)?e:e+""}function bv(t,e,n){return e=Sv(e),function(t,e){if(e&&("object"==vv(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,wv()?Reflect.construct(e,n||[],Sv(t).constructor):e.apply(t,n))}function wv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(wv=function(){return!!t})()}function Sv(t){return Sv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sv(t)}function _v(t,e){return _v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_v(t,e)}var kv=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=bv(this,e,arguments)).state={hasError:!1,error:null,errorInfo:null},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&&_v(t,e)}(e,t),function(t,e,n){return e&&mv(t.prototype,e),n&&mv(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidCatch",value:function(t,e){this.setState({error:t,errorInfo:e}),console.error(t,e)}},{key:"render",value:function(){return this.state.hasError?pp().createElement(yv,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(t){return{hasError:!0,error:t,errorInfo:null}}}])}(pp().Component);function xv(t){var e=t.containerRef,n=jh().ratio;return(0,fp.useEffect)((function(){var t=e.current;if(t){var r=new ResizeObserver((function(){n.requestUpdate()}));return r.observe(t),function(){r.disconnect()}}}),[e.current]),null}function Av(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 Ov(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)?Ov(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 Ov(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 Ev(t){var e=t.src,n=t.width,r=t.height,o=Av((0,fp.useState)({x:0,y:0}),2),i=o[0],a=o[1],s=Av((0,fp.useState)(!1),2),u=s[0],c=s[1],l=(0,fp.useRef)(null),f=jh().ratio;return(0,fp.useEffect)((function(){var t=function(t){if(l.current){var e=l.current.getBoundingClientRect(),n=t.clientX-e.left,r=t.clientY-e.top;a({x:n,y:r}),u||c(!0)}};return window.addEventListener("mousemove",t),function(){window.removeEventListener("mousemove",t)}}),[u]),pp().createElement(Nh,{$ref:l,className:"overflow-hidden relative"},pp().createElement("img",{src:e,style:{position:"absolute",left:i.x,top:i.y,width:n,height:r,pointerEvents:"none",zIndex:1001,display:u?"block":"none",cursor:"none",transform:"scale(".concat(f.state.scale,")")},alt:""}))}function Tv(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 jv(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)?jv(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 jv(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 Pv(t,e){return t.handle(e)}function Cv(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=t.children,u=Tv((0,fp.useReducer)((function(t){return t+1}),0),2)[1],c=mp().game,l=Tv((0,fp.useReducer)(Pv,new Zh(c,{update:u,forceUpdate:function(){f.logger.weakWarn("Player","force update"),(0,Zy.flushSync)((function(){u()}))},next:w,dispatch:function(t){return p(t)}})),2),f=l[0],p=l[1],h=pp().createRef(),d=Tv((0,fp.useState)(!1),2),y=d[0],v=d[1],m=pp().useRef(!1),g=c.config.elements.say.use,b=c.config.elements.menu.use;function w(){for(var t=!1;!t;){var e=c.getLiveGame().next(f);if(!e)break;if(x.isAwaitable(e)){t=!0;break}if(e instanceof L){e.nextUnlock().then((function(){w()})),t=!0;break}p(e)}f.stage.update()}(0,fp.useEffect)((function(){return c.getLiveGame().setGameState(f),e&&c.getLiveGame().loadStory(e),function(){c.getLiveGame().setGameState(void 0)}}),[c]),(0,fp.useEffect)((function(){return B((function(){v(!0);var t=f.getLastScene(),e=[];t?e.push({type:"event:scene.mount",listener:t.events.once("event:scene.mount",(function(){f.stage.next()}))}):f.stage.next();var n=f.events.onEvents([{type:Zh.EventTypes["event:state.end"],listener:function(){a&&a({game:c,gameState:f,liveGame:c.getLiveGame(),storable:c.getLiveGame().getStorable()})}}]),r=f.events.onEvents([{type:Zh.EventTypes["event:state.player.skip"],listener:function(){c.getLiveGame().abortAwaiting(),w()}}]);return f.stage.update(),function(){t&&e.forEach((function(e){t.events.off(e.type,e.listener)})),n.cancel(),r.cancel()}}))}),[]),(0,fp.useEffect)((function(){return B((function(){y&&i&&!m.current&&(m.current=!0,i({game:c,gameState:f,liveGame:c.getLiveGame(),storable:c.getLiveGame().getStorable()}))}))}),[y]),f.events.emit(Zh.EventTypes["event:state.player.flush"]);var S=n||c.config.player.width,_=r||c.config.player.height;return pp().createElement(kv,null,pp().createElement(cy,null,pp().createElement("div",{style:{width:"number"==typeof S?"".concat(S,"px"):S,height:"number"==typeof _?"".concat(_,"px"):_},className:lp(o,"__narraleaf_content-player"),ref:h},pp().createElement(py,{className:lp("flex-grow overflow-auto")},pp().createElement(xv,{containerRef:h}),pp().createElement(Nh,{style:{cursor:f.game.config.player.cursor?"none":"auto"}},c.config.player.cursor&&pp().createElement(Ev,{src:c.config.player.cursor,width:c.config.player.cursorWidth,height:c.config.player.cursorHeight}),pp().createElement(Xy,{state:f}),pp().createElement(Iv,{onLoaded:function(){f.stage.update(),e&&w()},state:f},pp().createElement(Ky,{state:f}),f.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return pp().createElement(zy,{key:"scene-"+e.getId(),state:f,scene:e},pp().createElement(pv,{state:f,displayable:n.displayable}),n.texts.map((function(t){var e=t.action,n=t.onClick;return pp().createElement(g,{state:f,key:"say-"+e.id,action:e,onClick:function(){n(),w()}})})),n.menus.map((function(t,e){var n=t.action,r=t.onClick;return pp().createElement("div",{key:"menu-"+e},pp().createElement(b,{state:f,prompt:n.prompt,choices:n.choices,afterChoose:function(t){r(t),w()},words:n.words}))})))}))),s)))))}function Iv(t){var e=t.children,n=t.onLoaded,r=t.state,o=Ly().preloaded,i=Tv((0,fp.useState)(!1),2),a=i[0],s=i[1];return(0,fp.useEffect)((function(){var t=o.events.on(_y.EventTypes["event:preloaded.ready"],(function(){s(!0),n()})),e=r.events.on(Zh.EventTypes["event:state.preload.unmount"],(function(){s(!1)}));return function(){o.events.off(_y.EventTypes["event:preloaded.ready"],t),r.events.off(Zh.EventTypes["event:state.preload.unmount"],e)}}),[a]),pp().createElement(pp().Fragment,null,a?e:null)}function Lv(t){var e=t.children,n=t.game;return pp().createElement(pp().Fragment,null,pp().createElement(Th,null,pp().createElement(vp,{game:n},pp().createElement(Iy,null,e))))}function Nv(){return Nv=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},Nv.apply(null,arguments)}function Rv(t){var e=t.alignX,n=void 0===e?"center":e,r=t.alignY,o=void 0===r?"center":r,i=t.children,a=t.width,s=t.height,u=t.className,c=jh().ratio,l="left"===n?"justify-start":"right"===n?"justify-end":"justify-center",f="top"===o?"items-start":"bottom"===o?"items-end":"items-center";return pp().createElement(Nh,{className:lp("flex absolute",l,f,u,"pointer-events-none"),style:{width:a,height:s,transform:"scale(".concat(c.state.scale,")"),transformOrigin:"".concat(n," ").concat(o),pointerEvents:"all"}},i)}kv.propTypes={children:dv().node.isRequired};var Mv={Left:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"left",alignY:"top"}))},Center:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"center",alignY:"top"}))},Right:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"right",alignY:"top"}))}},Fv={Left:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"left",alignY:"center"}))},Center:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"center",alignY:"center"}))},Right:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"right",alignY:"center"}))}},Dv={Left:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"left",alignY:"bottom"}))},Center:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"center",alignY:"bottom"}))},Right:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"right",alignY:"bottom"}))}};function Bv(){return Bv=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},Bv.apply(null,arguments)}var Vv=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},Gv={className:dv().string},Uv={children:dv().node};function Wv(t,e){var n=(0,fp.forwardRef)((function(t,n){var r=t.children,o=t.className,i=Vv(t,["children","className"]);return e(Object.assign({children:r,className:o,$ref:n},i))}));return n.displayName=t,n.propTypes=Object.assign(Object.assign({},Gv),Uv),n}var zv=Wv("VBox",(function(t){var e=t.children,n=t.className,r=t.$ref,o=Vv(t,["children","className","$ref"]);return pp().createElement("div",Bv({ref:r,className:lp("flex flex-col",n)},o),e)})),Hv=Wv("HBox",(function(t){var e=t.children,n=t.className,r=t.$ref,o=Vv(t,["children","className","$ref"]);return pp().createElement("div",Bv({ref:r,className:lp("flex flex-row",n)},o),e)}));function $v(t){return $v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$v(t)}function qv(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,Yv(r.key),r)}}function Yv(t){var e=function(t,e){if("object"!=$v(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$v(e)?e:e+""}function Xv(t,e,n){return e=Zv(e),function(t,e){if(e&&("object"==$v(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,Kv()?Reflect.construct(e,n||[],Zv(t).constructor):e.apply(t,n))}function Kv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Kv=function(){return!!t})()}function Zv(t){return Zv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zv(t)}function Qv(t,e){return Qv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qv(t,e)}var Jv=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=Xv(this,e)).state={opacity:1},t.duration=n,t.easing=r||xl.DefaultEasing,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&&Qv(t,e)}(e,t),function(t,e,n){return e&&qv(t.prototype,e),n&&qv(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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:function(){t&&t(),n.state.opacity=e.Frames[1]},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,backgroundColor:au.isImageColor(this.src)?O(this.src):""},src:au.isImageSrc(this.src)?au.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(xl);function tm(t){return tm="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},tm(t)}function em(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,nm(r.key),r)}}function nm(t){var e=function(t,e){if("object"!=tm(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tm(e)?e:e+""}function rm(t,e,n){return e=im(e),function(t,e){if(e&&("object"==tm(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,om()?Reflect.construct(e,n||[],im(t).constructor):e.apply(t,n))}function om(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(om=function(){return!!t})()}function im(t){return im=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},im(t)}function am(t,e){return am=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},am(t,e)}Jv.Frames=[0,1];var sm=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=rm(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,r.easing=i||xl.DefaultEasing,r.__stack=T(),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&&am(t,e)}(e,t),function(t,e,n){return e&&em(t.prototype,e),n&&em(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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)}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,transform:this.state.transform,backgroundColor:au.isImageColor(this.src)?O(this.src):""},src:au.isImageSrc(this.src)?au.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.easing).setSrc(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""}}}])}(xl);function um(t){return um="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},um(t)}function cm(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,lm(r.key),r)}}function lm(t){var e=function(t,e){if("object"!=um(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=um(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==um(e)?e:e+""}function fm(t,e,n){return e=hm(e),function(t,e){if(e&&("object"==um(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,pm()?Reflect.construct(e,n||[],hm(t).constructor):e.apply(t,n))}function pm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(pm=function(){return!!t})()}function hm(t){return hm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hm(t)}function dm(t,e){return dm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dm(t,e)}var ym=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=fm(this,e)).state={opacity:0},t.duration=n,t.easing=r||xl.DefaultEasing,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&&dm(t,e)}(e,t),function(t,e,n){return e&&cm(t.prototype,e),n&&cm(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{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:function(){n.state.opacity=e.Frames[1],t&&t()},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity,backgroundColor:au.isImageColor(this.src)?O(this.src):""},src:au.isImageSrc(this.src)?au.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(xl);ym.Frames=[1,0]})(),i})()));