narraleaf-react 0.0.1-beta.12 → 0.0.1-beta.13
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/LICENSE +373 -0
- package/README.md +12 -48
- package/dist/game/nlcore/action/action.d.ts +1 -0
- package/dist/game/nlcore/action/actionable.d.ts +1 -16
- package/dist/game/nlcore/action/actions.d.ts +2 -1
- package/dist/game/nlcore/action/baseElement.d.ts +5 -0
- package/dist/game/nlcore/action/chain.d.ts +6 -2
- package/dist/game/nlcore/action/constructable.d.ts +10 -38
- package/dist/game/nlcore/action/tree/actionTree.d.ts +2 -2
- package/dist/game/nlcore/common/Utils.d.ts +4 -3
- package/dist/game/nlcore/elements/image.d.ts +1 -1
- package/dist/game/nlcore/elements/scene.d.ts +32 -13
- package/dist/game/nlcore/elements/story.d.ts +6 -27
- package/dist/game/nlcore/game.d.ts +7 -17
- package/dist/game/nlcore/gameTypes.d.ts +1 -4
- package/dist/game/player/gameState.d.ts +5 -4
- package/dist/main.js +3 -3
- package/dist/util/data.d.ts +2 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.NarraleafReact=e(require("react")):t.NarraleafReact=e(t.React)}(this,(t=>(()=>{var e={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%;\n}\n@media (min-width: 640px) {\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .container {\n max-width: 1536px;\n }\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.m-4 {\n margin: 1rem;\n}\n.mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.flex {\n display: flex;\n}\n.table {\n display: table;\n}\n.hidden {\n display: none;\n}\n.h-\\[calc\\(33\\%-40px\\)\\] {\n height: calc(33% - 40px);\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.max-w-\\[80\\%\\] {\n max-width: 80%;\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-col {\n flex-direction: column;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\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.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-center {\n text-align: center;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / 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.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;\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}\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")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.NarraleafReact=e(require("react")):t.NarraleafReact=e(t.React)}(this,(t=>(()=>{var e={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%;\n}\n@media (min-width: 640px) {\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .container {\n max-width: 1536px;\n }\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.m-4 {\n margin: 1rem;\n}\n.mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-\\[calc\\(33\\%-40px\\)\\] {\n height: calc(33% - 40px);\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.max-w-\\[80\\%\\] {\n max-width: 80%;\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-col {\n flex-direction: column;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\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.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-center {\n text-align: center;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / 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.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;\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}\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
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* goldfirestudios.com
|
|
8
8
|
*
|
|
9
9
|
* MIT License
|
|
10
|
-
*/!function(){"use strict";var o=function(){this.init()};o.prototype={init:function(){var t=this||i;return t._counter=1e3,t._html5AudioPool=[],t.html5PoolSize=10,t._codecs={},t._howls=[],t._muted=!1,t._volume=1,t._canPlayEvent="canplaythrough",t._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,t.masterGain=null,t.noAudio=!1,t.usingWebAudio=!0,t.autoSuspend=!0,t.ctx=null,t.autoUnlock=!0,t._setup(),t},volume:function(t){var e=this||i;if(t=parseFloat(t),e.ctx||p(),void 0!==t&&t>=0&&t<=1){if(e._volume=t,e._muted)return e;e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t,i.ctx.currentTime);for(var n=0;n<e._howls.length;n++)if(!e._howls[n]._webAudio)for(var r=e._howls[n]._getSoundIds(),o=0;o<r.length;o++){var a=e._howls[n]._soundById(r[o]);a&&a._node&&(a._node.volume=a._volume*t)}return e}return e._volume},mute:function(t){var e=this||i;e.ctx||p(),e._muted=t,e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t?0:e._volume,i.ctx.currentTime);for(var n=0;n<e._howls.length;n++)if(!e._howls[n]._webAudio)for(var r=e._howls[n]._getSoundIds(),o=0;o<r.length;o++){var a=e._howls[n]._soundById(r[o]);a&&a._node&&(a._node.muted=!!t||a._muted)}return e},stop:function(){for(var t=this||i,e=0;e<t._howls.length;e++)t._howls[e].stop();return t},unload:function(){for(var t=this||i,e=t._howls.length-1;e>=0;e--)t._howls[e].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,p()),t},codecs:function(t){return(this||i)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||i;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(t){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||i,e=null;try{e="undefined"!=typeof Audio?new Audio:null}catch(e){return t}if(!e||"function"!=typeof e.canPlayType)return t;var n=e.canPlayType("audio/mpeg;").replace(/^no$/,""),r=t._navigator?t._navigator.userAgent:"",o=r.match(/OPR\/(\d+)/g),a=o&&parseInt(o[0].split("/")[1],10)<33,s=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),u=r.match(/Version\/(.*?) /),c=s&&u&&parseInt(u[1],10)<15;return t._codecs={mp3:!(a||!n&&!e.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!n,opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(e.canPlayType('audio/wav; codecs="1"')||e.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!e.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(e.canPlayType("audio/x-m4b;")||e.canPlayType("audio/m4b;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!e.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(e.canPlayType("audio/x-flac;")||e.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_unlockAudio:function(){var t=this||i;if(!t._audioUnlocked&&t.ctx){t._audioUnlocked=!1,t.autoUnlock=!1,t._mobileUnloaded||44100===t.ctx.sampleRate||(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var e=function(n){for(;t._html5AudioPool.length<t.html5PoolSize;)try{var r=new Audio;r._unlocked=!0,t._releaseHtml5Audio(r)}catch(n){t.noAudio=!0;break}for(var o=0;o<t._howls.length;o++)if(!t._howls[o]._webAudio)for(var i=t._howls[o]._getSoundIds(),a=0;a<i.length;a++){var s=t._howls[o]._soundById(i[a]);s&&s._node&&!s._node._unlocked&&(s._node._unlocked=!0,s._node.load())}t._autoResume();var u=t.ctx.createBufferSource();u.buffer=t._scratchBuffer,u.connect(t.ctx.destination),void 0===u.start?u.noteOn(0):u.start(0),"function"==typeof t.ctx.resume&&t.ctx.resume(),u.onended=function(){u.disconnect(0),t._audioUnlocked=!0,document.removeEventListener("touchstart",e,!0),document.removeEventListener("touchend",e,!0),document.removeEventListener("click",e,!0),document.removeEventListener("keydown",e,!0);for(var n=0;n<t._howls.length;n++)t._howls[n]._emit("unlock")}};return document.addEventListener("touchstart",e,!0),document.addEventListener("touchend",e,!0),document.addEventListener("click",e,!0),document.addEventListener("keydown",e,!0),t}},_obtainHtml5Audio:function(){var t=this||i;if(t._html5AudioPool.length)return t._html5AudioPool.pop();var e=(new Audio).play();return e&&"undefined"!=typeof Promise&&(e instanceof Promise||"function"==typeof e.then)&&e.catch((function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")})),new Audio},_releaseHtml5Audio:function(t){var e=this||i;return t._unlocked&&e._html5AudioPool.push(t),e},_autoSuspend:function(){var t=this;if(t.autoSuspend&&t.ctx&&void 0!==t.ctx.suspend&&i.usingWebAudio){for(var e=0;e<t._howls.length;e++)if(t._howls[e]._webAudio)for(var n=0;n<t._howls[e]._sounds.length;n++)if(!t._howls[e]._sounds[n]._paused)return t;return t._suspendTimer&&clearTimeout(t._suspendTimer),t._suspendTimer=setTimeout((function(){if(t.autoSuspend){t._suspendTimer=null,t.state="suspending";var e=function(){t.state="suspended",t._resumeAfterSuspend&&(delete t._resumeAfterSuspend,t._autoResume())};t.ctx.suspend().then(e,e)}}),3e4),t}},_autoResume:function(){var t=this;if(t.ctx&&void 0!==t.ctx.resume&&i.usingWebAudio)return"running"===t.state&&"interrupted"!==t.ctx.state&&t._suspendTimer?(clearTimeout(t._suspendTimer),t._suspendTimer=null):"suspended"===t.state||"running"===t.state&&"interrupted"===t.ctx.state?(t.ctx.resume().then((function(){t.state="running";for(var e=0;e<t._howls.length;e++)t._howls[e]._emit("resume")})),t._suspendTimer&&(clearTimeout(t._suspendTimer),t._suspendTimer=null)):"suspending"===t.state&&(t._resumeAfterSuspend=!0),t}};var i=new o,a=function(t){t.src&&0!==t.src.length?this.init(t):console.error("An array of source files must be passed with any new Howl.")};a.prototype={init:function(t){var e=this;return i.ctx||p(),e._autoplay=t.autoplay||!1,e._format="string"!=typeof t.format?t.format:[t.format],e._html5=t.html5||!1,e._muted=t.mute||!1,e._loop=t.loop||!1,e._pool=t.pool||5,e._preload="boolean"!=typeof t.preload&&"metadata"!==t.preload||t.preload,e._rate=t.rate||1,e._sprite=t.sprite||{},e._src="string"!=typeof t.src?t.src:[t.src],e._volume=void 0!==t.volume?t.volume:1,e._xhr={method:t.xhr&&t.xhr.method?t.xhr.method:"GET",headers:t.xhr&&t.xhr.headers?t.xhr.headers:null,withCredentials:!(!t.xhr||!t.xhr.withCredentials)&&t.xhr.withCredentials},e._duration=0,e._state="unloaded",e._sounds=[],e._endTimers={},e._queue=[],e._playLock=!1,e._onend=t.onend?[{fn:t.onend}]:[],e._onfade=t.onfade?[{fn:t.onfade}]:[],e._onload=t.onload?[{fn:t.onload}]:[],e._onloaderror=t.onloaderror?[{fn:t.onloaderror}]:[],e._onplayerror=t.onplayerror?[{fn:t.onplayerror}]:[],e._onpause=t.onpause?[{fn:t.onpause}]:[],e._onplay=t.onplay?[{fn:t.onplay}]:[],e._onstop=t.onstop?[{fn:t.onstop}]:[],e._onmute=t.onmute?[{fn:t.onmute}]:[],e._onvolume=t.onvolume?[{fn:t.onvolume}]:[],e._onrate=t.onrate?[{fn:t.onrate}]:[],e._onseek=t.onseek?[{fn:t.onseek}]:[],e._onunlock=t.onunlock?[{fn:t.onunlock}]:[],e._onresume=[],e._webAudio=i.usingWebAudio&&!e._html5,void 0!==i.ctx&&i.ctx&&i.autoUnlock&&i._unlockAudio(),i._howls.push(e),e._autoplay&&e._queue.push({event:"play",action:function(){e.play()}}),e._preload&&"none"!==e._preload&&e.load(),e},load:function(){var t=this,e=null;if(i.noAudio)t._emit("loaderror",null,"No audio support.");else{"string"==typeof t._src&&(t._src=[t._src]);for(var n=0;n<t._src.length;n++){var r,o;if(t._format&&t._format[n])r=t._format[n];else{if("string"!=typeof(o=t._src[n])){t._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}(r=/^data:audio\/([^;,]+);/i.exec(o))||(r=/\.([^.]+)$/.exec(o.split("?",1)[0])),r&&(r=r[1].toLowerCase())}if(r||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),r&&i.codecs(r)){e=t._src[n];break}}if(e)return t._src=e,t._state="loading","https:"===window.location.protocol&&"http:"===e.slice(0,5)&&(t._html5=!0,t._webAudio=!1),new s(t),t._webAudio&&c(t),t;t._emit("loaderror",null,"No codec support for selected audio sources.")}},play:function(t,e){var n=this,r=null;if("number"==typeof t)r=t,t=null;else{if("string"==typeof t&&"loaded"===n._state&&!n._sprite[t])return null;if(void 0===t&&(t="__default",!n._playLock)){for(var o=0,a=0;a<n._sounds.length;a++)n._sounds[a]._paused&&!n._sounds[a]._ended&&(o++,r=n._sounds[a]._id);1===o?t=null:r=null}}var s=r?n._soundById(r):n._inactiveSound();if(!s)return null;if(r&&!t&&(t=s._sprite||"__default"),"loaded"!==n._state){s._sprite=t,s._ended=!1;var u=s._id;return n._queue.push({event:"play",action:function(){n.play(u)}}),u}if(r&&!s._paused)return e||n._loadQueue("play"),s._id;n._webAudio&&i._autoResume();var c=Math.max(0,s._seek>0?s._seek:n._sprite[t][0]/1e3),l=Math.max(0,(n._sprite[t][0]+n._sprite[t][1])/1e3-c),f=1e3*l/Math.abs(s._rate),d=n._sprite[t][0]/1e3,p=(n._sprite[t][0]+n._sprite[t][1])/1e3;s._sprite=t,s._ended=!1;var h=function(){s._paused=!1,s._seek=c,s._start=d,s._stop=p,s._loop=!(!s._loop&&!n._sprite[t][2])};if(!(c>=p)){var y=s._node;if(n._webAudio){var v=function(){n._playLock=!1,h(),n._refreshBuffer(s);var t=s._muted||n._muted?0:s._volume;y.gain.setValueAtTime(t,i.ctx.currentTime),s._playStart=i.ctx.currentTime,void 0===y.bufferSource.start?s._loop?y.bufferSource.noteGrainOn(0,c,86400):y.bufferSource.noteGrainOn(0,c,l):s._loop?y.bufferSource.start(0,c,86400):y.bufferSource.start(0,c,l),f!==1/0&&(n._endTimers[s._id]=setTimeout(n._ended.bind(n,s),f)),e||setTimeout((function(){n._emit("play",s._id),n._loadQueue()}),0)};"running"===i.state&&"interrupted"!==i.ctx.state?v():(n._playLock=!0,n.once("resume",v),n._clearTimer(s._id))}else{var m=function(){y.currentTime=c,y.muted=s._muted||n._muted||i._muted||y.muted,y.volume=s._volume*i.volume(),y.playbackRate=s._rate;try{var r=y.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(n._playLock=!0,h(),r.then((function(){n._playLock=!1,y._unlocked=!0,e?n._loadQueue():n._emit("play",s._id)})).catch((function(){n._playLock=!1,n._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),s._ended=!0,s._paused=!0}))):e||(n._playLock=!1,h(),n._emit("play",s._id)),y.playbackRate=s._rate,y.paused)return void n._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==t||s._loop?n._endTimers[s._id]=setTimeout(n._ended.bind(n,s),f):(n._endTimers[s._id]=function(){n._ended(s),y.removeEventListener("ended",n._endTimers[s._id],!1)},y.addEventListener("ended",n._endTimers[s._id],!1))}catch(t){n._emit("playerror",s._id,t)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===y.src&&(y.src=n._src,y.load());var g=window&&window.ejecta||!y.readyState&&i._navigator.isCocoonJS;if(y.readyState>=3||g)m();else{n._playLock=!0,n._state="loading";var b=function(){n._state="loaded",m(),y.removeEventListener(i._canPlayEvent,b,!1)};y.addEventListener(i._canPlayEvent,b,!1),n._clearTimer(s._id)}}return s._id}n._ended(s)},pause:function(t){var e=this;if("loaded"!==e._state||e._playLock)return e._queue.push({event:"pause",action:function(){e.pause(t)}}),e;for(var n=e._getSoundIds(t),r=0;r<n.length;r++){e._clearTimer(n[r]);var o=e._soundById(n[r]);if(o&&!o._paused&&(o._seek=e.seek(n[r]),o._rateSeek=0,o._paused=!0,e._stopFade(n[r]),o._node))if(e._webAudio){if(!o._node.bufferSource)continue;void 0===o._node.bufferSource.stop?o._node.bufferSource.noteOff(0):o._node.bufferSource.stop(0),e._cleanBuffer(o._node)}else isNaN(o._node.duration)&&o._node.duration!==1/0||o._node.pause();arguments[1]||e._emit("pause",o?o._id:null)}return e},stop:function(t,e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"stop",action:function(){n.stop(t)}}),n;for(var r=n._getSoundIds(t),o=0;o<r.length;o++){n._clearTimer(r[o]);var i=n._soundById(r[o]);i&&(i._seek=i._start||0,i._rateSeek=0,i._paused=!0,i._ended=!0,n._stopFade(r[o]),i._node&&(n._webAudio?i._node.bufferSource&&(void 0===i._node.bufferSource.stop?i._node.bufferSource.noteOff(0):i._node.bufferSource.stop(0),n._cleanBuffer(i._node)):isNaN(i._node.duration)&&i._node.duration!==1/0||(i._node.currentTime=i._start||0,i._node.pause(),i._node.duration===1/0&&n._clearSound(i._node))),e||n._emit("stop",i._id))}return n},mute:function(t,e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"mute",action:function(){n.mute(t,e)}}),n;if(void 0===e){if("boolean"!=typeof t)return n._muted;n._muted=t}for(var r=n._getSoundIds(e),o=0;o<r.length;o++){var a=n._soundById(r[o]);a&&(a._muted=t,a._interval&&n._stopFade(a._id),n._webAudio&&a._node?a._node.gain.setValueAtTime(t?0:a._volume,i.ctx.currentTime):a._node&&(a._node.muted=!!i._muted||t),n._emit("mute",a._id))}return n},volume:function(){var t,e,n,r=this,o=arguments;if(0===o.length)return r._volume;if(1===o.length||2===o.length&&void 0===o[1]?r._getSoundIds().indexOf(o[0])>=0?e=parseInt(o[0],10):t=parseFloat(o[0]):o.length>=2&&(t=parseFloat(o[0]),e=parseInt(o[1],10)),!(void 0!==t&&t>=0&&t<=1))return(n=e?r._soundById(e):r._sounds[0])?n._volume:0;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"volume",action:function(){r.volume.apply(r,o)}}),r;void 0===e&&(r._volume=t),e=r._getSoundIds(e);for(var a=0;a<e.length;a++)(n=r._soundById(e[a]))&&(n._volume=t,o[2]||r._stopFade(e[a]),r._webAudio&&n._node&&!n._muted?n._node.gain.setValueAtTime(t,i.ctx.currentTime):n._node&&!n._muted&&(n._node.volume=t*i.volume()),r._emit("volume",n._id));return r},fade:function(t,e,n,r){var o=this;if("loaded"!==o._state||o._playLock)return o._queue.push({event:"fade",action:function(){o.fade(t,e,n,r)}}),o;t=Math.min(Math.max(0,parseFloat(t)),1),e=Math.min(Math.max(0,parseFloat(e)),1),n=parseFloat(n),o.volume(t,r);for(var a=o._getSoundIds(r),s=0;s<a.length;s++){var u=o._soundById(a[s]);if(u){if(r||o._stopFade(a[s]),o._webAudio&&!u._muted){var c=i.ctx.currentTime,l=c+n/1e3;u._volume=t,u._node.gain.setValueAtTime(t,c),u._node.gain.linearRampToValueAtTime(e,l)}o._startFadeInterval(u,t,e,n,a[s],void 0===r)}}return o},_startFadeInterval:function(t,e,n,r,o,i){var a=this,s=e,u=n-e,c=Math.abs(u/.01),l=Math.max(4,c>0?r/c:r),f=Date.now();t._fadeTo=n,t._interval=setInterval((function(){var o=(Date.now()-f)/r;f=Date.now(),s+=u*o,s=Math.round(100*s)/100,s=u<0?Math.max(n,s):Math.min(n,s),a._webAudio?t._volume=s:a.volume(s,t._id,!0),i&&(a._volume=s),(n<e&&s<=n||n>e&&s>=n)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,a.volume(n,t._id),a._emit("fade",t._id))}),l)},_stopFade:function(t){var e=this,n=e._soundById(t);return n&&n._interval&&(e._webAudio&&n._node.gain.cancelScheduledValues(i.ctx.currentTime),clearInterval(n._interval),n._interval=null,e.volume(n._fadeTo,t),n._fadeTo=null,e._emit("fade",t)),e},loop:function(){var t,e,n,r=this,o=arguments;if(0===o.length)return r._loop;if(1===o.length){if("boolean"!=typeof o[0])return!!(n=r._soundById(parseInt(o[0],10)))&&n._loop;t=o[0],r._loop=t}else 2===o.length&&(t=o[0],e=parseInt(o[1],10));for(var i=r._getSoundIds(e),a=0;a<i.length;a++)(n=r._soundById(i[a]))&&(n._loop=t,r._webAudio&&n._node&&n._node.bufferSource&&(n._node.bufferSource.loop=t,t&&(n._node.bufferSource.loopStart=n._start||0,n._node.bufferSource.loopEnd=n._stop,r.playing(i[a])&&(r.pause(i[a],!0),r.play(i[a],!0)))));return r},rate:function(){var t,e,n,r=this,o=arguments;if(0===o.length)e=r._sounds[0]._id;else if(1===o.length){r._getSoundIds().indexOf(o[0])>=0?e=parseInt(o[0],10):t=parseFloat(o[0])}else 2===o.length&&(t=parseFloat(o[0]),e=parseInt(o[1],10));if("number"!=typeof t)return(n=r._soundById(e))?n._rate:r._rate;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"rate",action:function(){r.rate.apply(r,o)}}),r;void 0===e&&(r._rate=t),e=r._getSoundIds(e);for(var a=0;a<e.length;a++)if(n=r._soundById(e[a])){r.playing(e[a])&&(n._rateSeek=r.seek(e[a]),n._playStart=r._webAudio?i.ctx.currentTime:n._playStart),n._rate=t,r._webAudio&&n._node&&n._node.bufferSource?n._node.bufferSource.playbackRate.setValueAtTime(t,i.ctx.currentTime):n._node&&(n._node.playbackRate=t);var s=r.seek(e[a]),u=1e3*((r._sprite[n._sprite][0]+r._sprite[n._sprite][1])/1e3-s)/Math.abs(n._rate);!r._endTimers[e[a]]&&n._paused||(r._clearTimer(e[a]),r._endTimers[e[a]]=setTimeout(r._ended.bind(r,n),u)),r._emit("rate",n._id)}return r},seek:function(){var t,e,n=this,r=arguments;if(0===r.length)n._sounds.length&&(e=n._sounds[0]._id);else if(1===r.length){n._getSoundIds().indexOf(r[0])>=0?e=parseInt(r[0],10):n._sounds.length&&(e=n._sounds[0]._id,t=parseFloat(r[0]))}else 2===r.length&&(t=parseFloat(r[0]),e=parseInt(r[1],10));if(void 0===e)return 0;if("number"==typeof t&&("loaded"!==n._state||n._playLock))return n._queue.push({event:"seek",action:function(){n.seek.apply(n,r)}}),n;var o=n._soundById(e);if(o){if(!("number"==typeof t&&t>=0)){if(n._webAudio){var a=n.playing(e)?i.ctx.currentTime-o._playStart:0,s=o._rateSeek?o._rateSeek-o._seek:0;return o._seek+(s+a*Math.abs(o._rate))}return o._node.currentTime}var u=n.playing(e);u&&n.pause(e,!0),o._seek=t,o._ended=!1,n._clearTimer(e),n._webAudio||!o._node||isNaN(o._node.duration)||(o._node.currentTime=t);var c=function(){u&&n.play(e,!0),n._emit("seek",e)};if(u&&!n._webAudio){var l=function(){n._playLock?setTimeout(l,0):c()};setTimeout(l,0)}else c()}return n},playing:function(t){var e=this;if("number"==typeof t){var n=e._soundById(t);return!!n&&!n._paused}for(var r=0;r<e._sounds.length;r++)if(!e._sounds[r]._paused)return!0;return!1},duration:function(t){var e=this,n=e._duration,r=e._soundById(t);return r&&(n=e._sprite[r._sprite][1]/1e3),n},state:function(){return this._state},unload:function(){for(var t=this,e=t._sounds,n=0;n<e.length;n++)e[n]._paused||t.stop(e[n]._id),t._webAudio||(t._clearSound(e[n]._node),e[n]._node.removeEventListener("error",e[n]._errorFn,!1),e[n]._node.removeEventListener(i._canPlayEvent,e[n]._loadFn,!1),e[n]._node.removeEventListener("ended",e[n]._endFn,!1),i._releaseHtml5Audio(e[n]._node)),delete e[n]._node,t._clearTimer(e[n]._id);var r=i._howls.indexOf(t);r>=0&&i._howls.splice(r,1);var o=!0;for(n=0;n<i._howls.length;n++)if(i._howls[n]._src===t._src||t._src.indexOf(i._howls[n]._src)>=0){o=!1;break}return u&&o&&delete u[t._src],i.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,e,n,r){var o=this["_on"+t];return"function"==typeof e&&o.push(r?{id:n,fn:e,once:r}:{id:n,fn:e}),this},off:function(t,e,n){var r=this,o=r["_on"+t],i=0;if("number"==typeof e&&(n=e,e=null),e||n)for(i=0;i<o.length;i++){var a=n===o[i].id;if(e===o[i].fn&&a||!e&&a){o.splice(i,1);break}}else if(t)r["_on"+t]=[];else{var s=Object.keys(r);for(i=0;i<s.length;i++)0===s[i].indexOf("_on")&&Array.isArray(r[s[i]])&&(r[s[i]]=[])}return r},once:function(t,e,n){return this.on(t,e,n,1),this},_emit:function(t,e,n){for(var r=this,o=r["_on"+t],i=o.length-1;i>=0;i--)o[i].id&&o[i].id!==e&&"load"!==t||(setTimeout(function(t){t.call(this,e,n)}.bind(r,o[i].fn),0),o[i].once&&r.off(t,o[i].fn,o[i].id));return r._loadQueue(t),r},_loadQueue:function(t){var e=this;if(e._queue.length>0){var n=e._queue[0];n.event===t&&(e._queue.shift(),e._loadQueue()),t||n.action()}return e},_ended:function(t){var e=this,n=t._sprite;if(!e._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime<t._stop)return setTimeout(e._ended.bind(e,t),100),e;var r=!(!t._loop&&!e._sprite[n][2]);if(e._emit("end",t._id),!e._webAudio&&r&&e.stop(t._id,!0).play(t._id),e._webAudio&&r){e._emit("play",t._id),t._seek=t._start||0,t._rateSeek=0,t._playStart=i.ctx.currentTime;var o=1e3*(t._stop-t._start)/Math.abs(t._rate);e._endTimers[t._id]=setTimeout(e._ended.bind(e,t),o)}return e._webAudio&&!r&&(t._paused=!0,t._ended=!0,t._seek=t._start||0,t._rateSeek=0,e._clearTimer(t._id),e._cleanBuffer(t._node),i._autoSuspend()),e._webAudio||r||e.stop(t._id,!0),e},_clearTimer:function(t){var e=this;if(e._endTimers[t]){if("function"!=typeof e._endTimers[t])clearTimeout(e._endTimers[t]);else{var n=e._soundById(t);n&&n._node&&n._node.removeEventListener("ended",e._endTimers[t],!1)}delete e._endTimers[t]}return e},_soundById:function(t){for(var e=this,n=0;n<e._sounds.length;n++)if(t===e._sounds[n]._id)return e._sounds[n];return null},_inactiveSound:function(){var t=this;t._drain();for(var e=0;e<t._sounds.length;e++)if(t._sounds[e]._ended)return t._sounds[e].reset();return new s(t)},_drain:function(){var t=this,e=t._pool,n=0,r=0;if(!(t._sounds.length<e)){for(r=0;r<t._sounds.length;r++)t._sounds[r]._ended&&n++;for(r=t._sounds.length-1;r>=0;r--){if(n<=e)return;t._sounds[r]._ended&&(t._webAudio&&t._sounds[r]._node&&t._sounds[r]._node.disconnect(0),t._sounds.splice(r,1),n--)}}},_getSoundIds:function(t){if(void 0===t){for(var e=[],n=0;n<this._sounds.length;n++)e.push(this._sounds[n]._id);return e}return[t]},_refreshBuffer:function(t){return t._node.bufferSource=i.ctx.createBufferSource(),t._node.bufferSource.buffer=u[this._src],t._panner?t._node.bufferSource.connect(t._panner):t._node.bufferSource.connect(t._node),t._node.bufferSource.loop=t._loop,t._loop&&(t._node.bufferSource.loopStart=t._start||0,t._node.bufferSource.loopEnd=t._stop||0),t._node.bufferSource.playbackRate.setValueAtTime(t._rate,i.ctx.currentTime),this},_cleanBuffer:function(t){var e=i._navigator&&i._navigator.vendor.indexOf("Apple")>=0;if(!t.bufferSource)return this;if(i._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),e))try{t.bufferSource.buffer=i._scratchBuffer}catch(t){}return t.bufferSource=null,this},_clearSound:function(t){/MSIE |Trident\//.test(i._navigator&&i._navigator.userAgent)||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var s=function(t){this._parent=t,this.init()};s.prototype={init:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++i._counter,e._sounds.push(t),t.create(),t},create:function(){var t=this,e=t._parent,n=i._muted||t._muted||t._parent._muted?0:t._volume;return e._webAudio?(t._node=void 0===i.ctx.createGain?i.ctx.createGainNode():i.ctx.createGain(),t._node.gain.setValueAtTime(n,i.ctx.currentTime),t._node.paused=!0,t._node.connect(i.masterGain)):i.noAudio||(t._node=i._obtainHtml5Audio(),t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(i._canPlayEvent,t._loadFn,!1),t._endFn=t._endListener.bind(t),t._node.addEventListener("ended",t._endFn,!1),t._node.src=e._src,t._node.preload=!0===e._preload?"auto":e._preload,t._node.volume=n*i.volume(),t._node.load()),t},reset:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++i._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorFn,!1)},_loadListener:function(){var t=this,e=t._parent;e._duration=Math.ceil(10*t._node.duration)/10,0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),t._node.removeEventListener(i._canPlayEvent,t._loadFn,!1)},_endListener:function(){var t=this,e=t._parent;e._duration===1/0&&(e._duration=Math.ceil(10*t._node.duration)/10,e._sprite.__default[1]===1/0&&(e._sprite.__default[1]=1e3*e._duration),e._ended(t)),t._node.removeEventListener("ended",t._endFn,!1)}};var u={},c=function(t){var e=t._src;if(u[e])return t._duration=u[e].duration,void d(t);if(/^data:[^;]+;base64,/.test(e)){for(var n=atob(e.split(",")[1]),r=new Uint8Array(n.length),o=0;o<n.length;++o)r[o]=n.charCodeAt(o);f(r.buffer,t)}else{var i=new XMLHttpRequest;i.open(t._xhr.method,e,!0),i.withCredentials=t._xhr.withCredentials,i.responseType="arraybuffer",t._xhr.headers&&Object.keys(t._xhr.headers).forEach((function(e){i.setRequestHeader(e,t._xhr.headers[e])})),i.onload=function(){var e=(i.status+"")[0];"0"===e||"2"===e||"3"===e?f(i.response,t):t._emit("loaderror",null,"Failed loading audio file with status: "+i.status+".")},i.onerror=function(){t._webAudio&&(t._html5=!0,t._webAudio=!1,t._sounds=[],delete u[e],t.load())},l(i)}},l=function(t){try{t.send()}catch(e){t.onerror()}},f=function(t,e){var n=function(){e._emit("loaderror",null,"Decoding audio data failed.")},r=function(t){t&&e._sounds.length>0?(u[e._src]=t,d(e,t)):n()};"undefined"!=typeof Promise&&1===i.ctx.decodeAudioData.length?i.ctx.decodeAudioData(t).then(r).catch(n):i.ctx.decodeAudioData(t,r,n)},d=function(t,e){e&&!t._duration&&(t._duration=e.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},p=function(){if(i.usingWebAudio){try{"undefined"!=typeof AudioContext?i.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?i.ctx=new webkitAudioContext:i.usingWebAudio=!1}catch(t){i.usingWebAudio=!1}i.ctx||(i.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(i._navigator&&i._navigator.platform),e=i._navigator&&i._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),n=e?parseInt(e[1],10):null;if(t&&n&&n<9){var r=/safari/.test(i._navigator&&i._navigator.userAgent.toLowerCase());i._navigator&&!r&&(i.usingWebAudio=!1)}i.usingWebAudio&&(i.masterGain=void 0===i.ctx.createGain?i.ctx.createGainNode():i.ctx.createGain(),i.masterGain.gain.setValueAtTime(i._muted?0:i._volume,i.ctx.currentTime),i.masterGain.connect(i.ctx.destination)),i._setup()}};void 0===(r=function(){return{Howler:i,Howl:a}}.apply(e,[]))||(t.exports=r),e.Howler=i,e.Howl=a,void 0!==n.g?(n.g.HowlerGlobal=o,n.g.Howler=i,n.g.Howl=a,n.g.Sound=s):"undefined"!=typeof window&&(window.HowlerGlobal=o,window.Howler=i,window.Howl=a,window.Sound=s)}(),
|
|
10
|
+
*/!function(){"use strict";var o=function(){this.init()};o.prototype={init:function(){var t=this||i;return t._counter=1e3,t._html5AudioPool=[],t.html5PoolSize=10,t._codecs={},t._howls=[],t._muted=!1,t._volume=1,t._canPlayEvent="canplaythrough",t._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,t.masterGain=null,t.noAudio=!1,t.usingWebAudio=!0,t.autoSuspend=!0,t.ctx=null,t.autoUnlock=!0,t._setup(),t},volume:function(t){var e=this||i;if(t=parseFloat(t),e.ctx||d(),void 0!==t&&t>=0&&t<=1){if(e._volume=t,e._muted)return e;e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t,i.ctx.currentTime);for(var n=0;n<e._howls.length;n++)if(!e._howls[n]._webAudio)for(var r=e._howls[n]._getSoundIds(),o=0;o<r.length;o++){var a=e._howls[n]._soundById(r[o]);a&&a._node&&(a._node.volume=a._volume*t)}return e}return e._volume},mute:function(t){var e=this||i;e.ctx||d(),e._muted=t,e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t?0:e._volume,i.ctx.currentTime);for(var n=0;n<e._howls.length;n++)if(!e._howls[n]._webAudio)for(var r=e._howls[n]._getSoundIds(),o=0;o<r.length;o++){var a=e._howls[n]._soundById(r[o]);a&&a._node&&(a._node.muted=!!t||a._muted)}return e},stop:function(){for(var t=this||i,e=0;e<t._howls.length;e++)t._howls[e].stop();return t},unload:function(){for(var t=this||i,e=t._howls.length-1;e>=0;e--)t._howls[e].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,d()),t},codecs:function(t){return(this||i)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||i;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(t){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||i,e=null;try{e="undefined"!=typeof Audio?new Audio:null}catch(e){return t}if(!e||"function"!=typeof e.canPlayType)return t;var n=e.canPlayType("audio/mpeg;").replace(/^no$/,""),r=t._navigator?t._navigator.userAgent:"",o=r.match(/OPR\/(\d+)/g),a=o&&parseInt(o[0].split("/")[1],10)<33,s=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),u=r.match(/Version\/(.*?) /),c=s&&u&&parseInt(u[1],10)<15;return t._codecs={mp3:!(a||!n&&!e.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!n,opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(e.canPlayType('audio/wav; codecs="1"')||e.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!e.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(e.canPlayType("audio/x-m4b;")||e.canPlayType("audio/m4b;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!e.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(e.canPlayType("audio/x-flac;")||e.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_unlockAudio:function(){var t=this||i;if(!t._audioUnlocked&&t.ctx){t._audioUnlocked=!1,t.autoUnlock=!1,t._mobileUnloaded||44100===t.ctx.sampleRate||(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var e=function(n){for(;t._html5AudioPool.length<t.html5PoolSize;)try{var r=new Audio;r._unlocked=!0,t._releaseHtml5Audio(r)}catch(n){t.noAudio=!0;break}for(var o=0;o<t._howls.length;o++)if(!t._howls[o]._webAudio)for(var i=t._howls[o]._getSoundIds(),a=0;a<i.length;a++){var s=t._howls[o]._soundById(i[a]);s&&s._node&&!s._node._unlocked&&(s._node._unlocked=!0,s._node.load())}t._autoResume();var u=t.ctx.createBufferSource();u.buffer=t._scratchBuffer,u.connect(t.ctx.destination),void 0===u.start?u.noteOn(0):u.start(0),"function"==typeof t.ctx.resume&&t.ctx.resume(),u.onended=function(){u.disconnect(0),t._audioUnlocked=!0,document.removeEventListener("touchstart",e,!0),document.removeEventListener("touchend",e,!0),document.removeEventListener("click",e,!0),document.removeEventListener("keydown",e,!0);for(var n=0;n<t._howls.length;n++)t._howls[n]._emit("unlock")}};return document.addEventListener("touchstart",e,!0),document.addEventListener("touchend",e,!0),document.addEventListener("click",e,!0),document.addEventListener("keydown",e,!0),t}},_obtainHtml5Audio:function(){var t=this||i;if(t._html5AudioPool.length)return t._html5AudioPool.pop();var e=(new Audio).play();return e&&"undefined"!=typeof Promise&&(e instanceof Promise||"function"==typeof e.then)&&e.catch((function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")})),new Audio},_releaseHtml5Audio:function(t){var e=this||i;return t._unlocked&&e._html5AudioPool.push(t),e},_autoSuspend:function(){var t=this;if(t.autoSuspend&&t.ctx&&void 0!==t.ctx.suspend&&i.usingWebAudio){for(var e=0;e<t._howls.length;e++)if(t._howls[e]._webAudio)for(var n=0;n<t._howls[e]._sounds.length;n++)if(!t._howls[e]._sounds[n]._paused)return t;return t._suspendTimer&&clearTimeout(t._suspendTimer),t._suspendTimer=setTimeout((function(){if(t.autoSuspend){t._suspendTimer=null,t.state="suspending";var e=function(){t.state="suspended",t._resumeAfterSuspend&&(delete t._resumeAfterSuspend,t._autoResume())};t.ctx.suspend().then(e,e)}}),3e4),t}},_autoResume:function(){var t=this;if(t.ctx&&void 0!==t.ctx.resume&&i.usingWebAudio)return"running"===t.state&&"interrupted"!==t.ctx.state&&t._suspendTimer?(clearTimeout(t._suspendTimer),t._suspendTimer=null):"suspended"===t.state||"running"===t.state&&"interrupted"===t.ctx.state?(t.ctx.resume().then((function(){t.state="running";for(var e=0;e<t._howls.length;e++)t._howls[e]._emit("resume")})),t._suspendTimer&&(clearTimeout(t._suspendTimer),t._suspendTimer=null)):"suspending"===t.state&&(t._resumeAfterSuspend=!0),t}};var i=new o,a=function(t){t.src&&0!==t.src.length?this.init(t):console.error("An array of source files must be passed with any new Howl.")};a.prototype={init:function(t){var e=this;return i.ctx||d(),e._autoplay=t.autoplay||!1,e._format="string"!=typeof t.format?t.format:[t.format],e._html5=t.html5||!1,e._muted=t.mute||!1,e._loop=t.loop||!1,e._pool=t.pool||5,e._preload="boolean"!=typeof t.preload&&"metadata"!==t.preload||t.preload,e._rate=t.rate||1,e._sprite=t.sprite||{},e._src="string"!=typeof t.src?t.src:[t.src],e._volume=void 0!==t.volume?t.volume:1,e._xhr={method:t.xhr&&t.xhr.method?t.xhr.method:"GET",headers:t.xhr&&t.xhr.headers?t.xhr.headers:null,withCredentials:!(!t.xhr||!t.xhr.withCredentials)&&t.xhr.withCredentials},e._duration=0,e._state="unloaded",e._sounds=[],e._endTimers={},e._queue=[],e._playLock=!1,e._onend=t.onend?[{fn:t.onend}]:[],e._onfade=t.onfade?[{fn:t.onfade}]:[],e._onload=t.onload?[{fn:t.onload}]:[],e._onloaderror=t.onloaderror?[{fn:t.onloaderror}]:[],e._onplayerror=t.onplayerror?[{fn:t.onplayerror}]:[],e._onpause=t.onpause?[{fn:t.onpause}]:[],e._onplay=t.onplay?[{fn:t.onplay}]:[],e._onstop=t.onstop?[{fn:t.onstop}]:[],e._onmute=t.onmute?[{fn:t.onmute}]:[],e._onvolume=t.onvolume?[{fn:t.onvolume}]:[],e._onrate=t.onrate?[{fn:t.onrate}]:[],e._onseek=t.onseek?[{fn:t.onseek}]:[],e._onunlock=t.onunlock?[{fn:t.onunlock}]:[],e._onresume=[],e._webAudio=i.usingWebAudio&&!e._html5,void 0!==i.ctx&&i.ctx&&i.autoUnlock&&i._unlockAudio(),i._howls.push(e),e._autoplay&&e._queue.push({event:"play",action:function(){e.play()}}),e._preload&&"none"!==e._preload&&e.load(),e},load:function(){var t=this,e=null;if(i.noAudio)t._emit("loaderror",null,"No audio support.");else{"string"==typeof t._src&&(t._src=[t._src]);for(var n=0;n<t._src.length;n++){var r,o;if(t._format&&t._format[n])r=t._format[n];else{if("string"!=typeof(o=t._src[n])){t._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}(r=/^data:audio\/([^;,]+);/i.exec(o))||(r=/\.([^.]+)$/.exec(o.split("?",1)[0])),r&&(r=r[1].toLowerCase())}if(r||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),r&&i.codecs(r)){e=t._src[n];break}}if(e)return t._src=e,t._state="loading","https:"===window.location.protocol&&"http:"===e.slice(0,5)&&(t._html5=!0,t._webAudio=!1),new s(t),t._webAudio&&c(t),t;t._emit("loaderror",null,"No codec support for selected audio sources.")}},play:function(t,e){var n=this,r=null;if("number"==typeof t)r=t,t=null;else{if("string"==typeof t&&"loaded"===n._state&&!n._sprite[t])return null;if(void 0===t&&(t="__default",!n._playLock)){for(var o=0,a=0;a<n._sounds.length;a++)n._sounds[a]._paused&&!n._sounds[a]._ended&&(o++,r=n._sounds[a]._id);1===o?t=null:r=null}}var s=r?n._soundById(r):n._inactiveSound();if(!s)return null;if(r&&!t&&(t=s._sprite||"__default"),"loaded"!==n._state){s._sprite=t,s._ended=!1;var u=s._id;return n._queue.push({event:"play",action:function(){n.play(u)}}),u}if(r&&!s._paused)return e||n._loadQueue("play"),s._id;n._webAudio&&i._autoResume();var c=Math.max(0,s._seek>0?s._seek:n._sprite[t][0]/1e3),l=Math.max(0,(n._sprite[t][0]+n._sprite[t][1])/1e3-c),f=1e3*l/Math.abs(s._rate),p=n._sprite[t][0]/1e3,d=(n._sprite[t][0]+n._sprite[t][1])/1e3;s._sprite=t,s._ended=!1;var h=function(){s._paused=!1,s._seek=c,s._start=p,s._stop=d,s._loop=!(!s._loop&&!n._sprite[t][2])};if(!(c>=d)){var y=s._node;if(n._webAudio){var v=function(){n._playLock=!1,h(),n._refreshBuffer(s);var t=s._muted||n._muted?0:s._volume;y.gain.setValueAtTime(t,i.ctx.currentTime),s._playStart=i.ctx.currentTime,void 0===y.bufferSource.start?s._loop?y.bufferSource.noteGrainOn(0,c,86400):y.bufferSource.noteGrainOn(0,c,l):s._loop?y.bufferSource.start(0,c,86400):y.bufferSource.start(0,c,l),f!==1/0&&(n._endTimers[s._id]=setTimeout(n._ended.bind(n,s),f)),e||setTimeout((function(){n._emit("play",s._id),n._loadQueue()}),0)};"running"===i.state&&"interrupted"!==i.ctx.state?v():(n._playLock=!0,n.once("resume",v),n._clearTimer(s._id))}else{var m=function(){y.currentTime=c,y.muted=s._muted||n._muted||i._muted||y.muted,y.volume=s._volume*i.volume(),y.playbackRate=s._rate;try{var r=y.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(n._playLock=!0,h(),r.then((function(){n._playLock=!1,y._unlocked=!0,e?n._loadQueue():n._emit("play",s._id)})).catch((function(){n._playLock=!1,n._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),s._ended=!0,s._paused=!0}))):e||(n._playLock=!1,h(),n._emit("play",s._id)),y.playbackRate=s._rate,y.paused)return void n._emit("playerror",s._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==t||s._loop?n._endTimers[s._id]=setTimeout(n._ended.bind(n,s),f):(n._endTimers[s._id]=function(){n._ended(s),y.removeEventListener("ended",n._endTimers[s._id],!1)},y.addEventListener("ended",n._endTimers[s._id],!1))}catch(t){n._emit("playerror",s._id,t)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===y.src&&(y.src=n._src,y.load());var g=window&&window.ejecta||!y.readyState&&i._navigator.isCocoonJS;if(y.readyState>=3||g)m();else{n._playLock=!0,n._state="loading";var b=function(){n._state="loaded",m(),y.removeEventListener(i._canPlayEvent,b,!1)};y.addEventListener(i._canPlayEvent,b,!1),n._clearTimer(s._id)}}return s._id}n._ended(s)},pause:function(t){var e=this;if("loaded"!==e._state||e._playLock)return e._queue.push({event:"pause",action:function(){e.pause(t)}}),e;for(var n=e._getSoundIds(t),r=0;r<n.length;r++){e._clearTimer(n[r]);var o=e._soundById(n[r]);if(o&&!o._paused&&(o._seek=e.seek(n[r]),o._rateSeek=0,o._paused=!0,e._stopFade(n[r]),o._node))if(e._webAudio){if(!o._node.bufferSource)continue;void 0===o._node.bufferSource.stop?o._node.bufferSource.noteOff(0):o._node.bufferSource.stop(0),e._cleanBuffer(o._node)}else isNaN(o._node.duration)&&o._node.duration!==1/0||o._node.pause();arguments[1]||e._emit("pause",o?o._id:null)}return e},stop:function(t,e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"stop",action:function(){n.stop(t)}}),n;for(var r=n._getSoundIds(t),o=0;o<r.length;o++){n._clearTimer(r[o]);var i=n._soundById(r[o]);i&&(i._seek=i._start||0,i._rateSeek=0,i._paused=!0,i._ended=!0,n._stopFade(r[o]),i._node&&(n._webAudio?i._node.bufferSource&&(void 0===i._node.bufferSource.stop?i._node.bufferSource.noteOff(0):i._node.bufferSource.stop(0),n._cleanBuffer(i._node)):isNaN(i._node.duration)&&i._node.duration!==1/0||(i._node.currentTime=i._start||0,i._node.pause(),i._node.duration===1/0&&n._clearSound(i._node))),e||n._emit("stop",i._id))}return n},mute:function(t,e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"mute",action:function(){n.mute(t,e)}}),n;if(void 0===e){if("boolean"!=typeof t)return n._muted;n._muted=t}for(var r=n._getSoundIds(e),o=0;o<r.length;o++){var a=n._soundById(r[o]);a&&(a._muted=t,a._interval&&n._stopFade(a._id),n._webAudio&&a._node?a._node.gain.setValueAtTime(t?0:a._volume,i.ctx.currentTime):a._node&&(a._node.muted=!!i._muted||t),n._emit("mute",a._id))}return n},volume:function(){var t,e,n,r=this,o=arguments;if(0===o.length)return r._volume;if(1===o.length||2===o.length&&void 0===o[1]?r._getSoundIds().indexOf(o[0])>=0?e=parseInt(o[0],10):t=parseFloat(o[0]):o.length>=2&&(t=parseFloat(o[0]),e=parseInt(o[1],10)),!(void 0!==t&&t>=0&&t<=1))return(n=e?r._soundById(e):r._sounds[0])?n._volume:0;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"volume",action:function(){r.volume.apply(r,o)}}),r;void 0===e&&(r._volume=t),e=r._getSoundIds(e);for(var a=0;a<e.length;a++)(n=r._soundById(e[a]))&&(n._volume=t,o[2]||r._stopFade(e[a]),r._webAudio&&n._node&&!n._muted?n._node.gain.setValueAtTime(t,i.ctx.currentTime):n._node&&!n._muted&&(n._node.volume=t*i.volume()),r._emit("volume",n._id));return r},fade:function(t,e,n,r){var o=this;if("loaded"!==o._state||o._playLock)return o._queue.push({event:"fade",action:function(){o.fade(t,e,n,r)}}),o;t=Math.min(Math.max(0,parseFloat(t)),1),e=Math.min(Math.max(0,parseFloat(e)),1),n=parseFloat(n),o.volume(t,r);for(var a=o._getSoundIds(r),s=0;s<a.length;s++){var u=o._soundById(a[s]);if(u){if(r||o._stopFade(a[s]),o._webAudio&&!u._muted){var c=i.ctx.currentTime,l=c+n/1e3;u._volume=t,u._node.gain.setValueAtTime(t,c),u._node.gain.linearRampToValueAtTime(e,l)}o._startFadeInterval(u,t,e,n,a[s],void 0===r)}}return o},_startFadeInterval:function(t,e,n,r,o,i){var a=this,s=e,u=n-e,c=Math.abs(u/.01),l=Math.max(4,c>0?r/c:r),f=Date.now();t._fadeTo=n,t._interval=setInterval((function(){var o=(Date.now()-f)/r;f=Date.now(),s+=u*o,s=Math.round(100*s)/100,s=u<0?Math.max(n,s):Math.min(n,s),a._webAudio?t._volume=s:a.volume(s,t._id,!0),i&&(a._volume=s),(n<e&&s<=n||n>e&&s>=n)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,a.volume(n,t._id),a._emit("fade",t._id))}),l)},_stopFade:function(t){var e=this,n=e._soundById(t);return n&&n._interval&&(e._webAudio&&n._node.gain.cancelScheduledValues(i.ctx.currentTime),clearInterval(n._interval),n._interval=null,e.volume(n._fadeTo,t),n._fadeTo=null,e._emit("fade",t)),e},loop:function(){var t,e,n,r=this,o=arguments;if(0===o.length)return r._loop;if(1===o.length){if("boolean"!=typeof o[0])return!!(n=r._soundById(parseInt(o[0],10)))&&n._loop;t=o[0],r._loop=t}else 2===o.length&&(t=o[0],e=parseInt(o[1],10));for(var i=r._getSoundIds(e),a=0;a<i.length;a++)(n=r._soundById(i[a]))&&(n._loop=t,r._webAudio&&n._node&&n._node.bufferSource&&(n._node.bufferSource.loop=t,t&&(n._node.bufferSource.loopStart=n._start||0,n._node.bufferSource.loopEnd=n._stop,r.playing(i[a])&&(r.pause(i[a],!0),r.play(i[a],!0)))));return r},rate:function(){var t,e,n,r=this,o=arguments;if(0===o.length)e=r._sounds[0]._id;else if(1===o.length){r._getSoundIds().indexOf(o[0])>=0?e=parseInt(o[0],10):t=parseFloat(o[0])}else 2===o.length&&(t=parseFloat(o[0]),e=parseInt(o[1],10));if("number"!=typeof t)return(n=r._soundById(e))?n._rate:r._rate;if("loaded"!==r._state||r._playLock)return r._queue.push({event:"rate",action:function(){r.rate.apply(r,o)}}),r;void 0===e&&(r._rate=t),e=r._getSoundIds(e);for(var a=0;a<e.length;a++)if(n=r._soundById(e[a])){r.playing(e[a])&&(n._rateSeek=r.seek(e[a]),n._playStart=r._webAudio?i.ctx.currentTime:n._playStart),n._rate=t,r._webAudio&&n._node&&n._node.bufferSource?n._node.bufferSource.playbackRate.setValueAtTime(t,i.ctx.currentTime):n._node&&(n._node.playbackRate=t);var s=r.seek(e[a]),u=1e3*((r._sprite[n._sprite][0]+r._sprite[n._sprite][1])/1e3-s)/Math.abs(n._rate);!r._endTimers[e[a]]&&n._paused||(r._clearTimer(e[a]),r._endTimers[e[a]]=setTimeout(r._ended.bind(r,n),u)),r._emit("rate",n._id)}return r},seek:function(){var t,e,n=this,r=arguments;if(0===r.length)n._sounds.length&&(e=n._sounds[0]._id);else if(1===r.length){n._getSoundIds().indexOf(r[0])>=0?e=parseInt(r[0],10):n._sounds.length&&(e=n._sounds[0]._id,t=parseFloat(r[0]))}else 2===r.length&&(t=parseFloat(r[0]),e=parseInt(r[1],10));if(void 0===e)return 0;if("number"==typeof t&&("loaded"!==n._state||n._playLock))return n._queue.push({event:"seek",action:function(){n.seek.apply(n,r)}}),n;var o=n._soundById(e);if(o){if(!("number"==typeof t&&t>=0)){if(n._webAudio){var a=n.playing(e)?i.ctx.currentTime-o._playStart:0,s=o._rateSeek?o._rateSeek-o._seek:0;return o._seek+(s+a*Math.abs(o._rate))}return o._node.currentTime}var u=n.playing(e);u&&n.pause(e,!0),o._seek=t,o._ended=!1,n._clearTimer(e),n._webAudio||!o._node||isNaN(o._node.duration)||(o._node.currentTime=t);var c=function(){u&&n.play(e,!0),n._emit("seek",e)};if(u&&!n._webAudio){var l=function(){n._playLock?setTimeout(l,0):c()};setTimeout(l,0)}else c()}return n},playing:function(t){var e=this;if("number"==typeof t){var n=e._soundById(t);return!!n&&!n._paused}for(var r=0;r<e._sounds.length;r++)if(!e._sounds[r]._paused)return!0;return!1},duration:function(t){var e=this,n=e._duration,r=e._soundById(t);return r&&(n=e._sprite[r._sprite][1]/1e3),n},state:function(){return this._state},unload:function(){for(var t=this,e=t._sounds,n=0;n<e.length;n++)e[n]._paused||t.stop(e[n]._id),t._webAudio||(t._clearSound(e[n]._node),e[n]._node.removeEventListener("error",e[n]._errorFn,!1),e[n]._node.removeEventListener(i._canPlayEvent,e[n]._loadFn,!1),e[n]._node.removeEventListener("ended",e[n]._endFn,!1),i._releaseHtml5Audio(e[n]._node)),delete e[n]._node,t._clearTimer(e[n]._id);var r=i._howls.indexOf(t);r>=0&&i._howls.splice(r,1);var o=!0;for(n=0;n<i._howls.length;n++)if(i._howls[n]._src===t._src||t._src.indexOf(i._howls[n]._src)>=0){o=!1;break}return u&&o&&delete u[t._src],i.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,e,n,r){var o=this["_on"+t];return"function"==typeof e&&o.push(r?{id:n,fn:e,once:r}:{id:n,fn:e}),this},off:function(t,e,n){var r=this,o=r["_on"+t],i=0;if("number"==typeof e&&(n=e,e=null),e||n)for(i=0;i<o.length;i++){var a=n===o[i].id;if(e===o[i].fn&&a||!e&&a){o.splice(i,1);break}}else if(t)r["_on"+t]=[];else{var s=Object.keys(r);for(i=0;i<s.length;i++)0===s[i].indexOf("_on")&&Array.isArray(r[s[i]])&&(r[s[i]]=[])}return r},once:function(t,e,n){return this.on(t,e,n,1),this},_emit:function(t,e,n){for(var r=this,o=r["_on"+t],i=o.length-1;i>=0;i--)o[i].id&&o[i].id!==e&&"load"!==t||(setTimeout(function(t){t.call(this,e,n)}.bind(r,o[i].fn),0),o[i].once&&r.off(t,o[i].fn,o[i].id));return r._loadQueue(t),r},_loadQueue:function(t){var e=this;if(e._queue.length>0){var n=e._queue[0];n.event===t&&(e._queue.shift(),e._loadQueue()),t||n.action()}return e},_ended:function(t){var e=this,n=t._sprite;if(!e._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime<t._stop)return setTimeout(e._ended.bind(e,t),100),e;var r=!(!t._loop&&!e._sprite[n][2]);if(e._emit("end",t._id),!e._webAudio&&r&&e.stop(t._id,!0).play(t._id),e._webAudio&&r){e._emit("play",t._id),t._seek=t._start||0,t._rateSeek=0,t._playStart=i.ctx.currentTime;var o=1e3*(t._stop-t._start)/Math.abs(t._rate);e._endTimers[t._id]=setTimeout(e._ended.bind(e,t),o)}return e._webAudio&&!r&&(t._paused=!0,t._ended=!0,t._seek=t._start||0,t._rateSeek=0,e._clearTimer(t._id),e._cleanBuffer(t._node),i._autoSuspend()),e._webAudio||r||e.stop(t._id,!0),e},_clearTimer:function(t){var e=this;if(e._endTimers[t]){if("function"!=typeof e._endTimers[t])clearTimeout(e._endTimers[t]);else{var n=e._soundById(t);n&&n._node&&n._node.removeEventListener("ended",e._endTimers[t],!1)}delete e._endTimers[t]}return e},_soundById:function(t){for(var e=this,n=0;n<e._sounds.length;n++)if(t===e._sounds[n]._id)return e._sounds[n];return null},_inactiveSound:function(){var t=this;t._drain();for(var e=0;e<t._sounds.length;e++)if(t._sounds[e]._ended)return t._sounds[e].reset();return new s(t)},_drain:function(){var t=this,e=t._pool,n=0,r=0;if(!(t._sounds.length<e)){for(r=0;r<t._sounds.length;r++)t._sounds[r]._ended&&n++;for(r=t._sounds.length-1;r>=0;r--){if(n<=e)return;t._sounds[r]._ended&&(t._webAudio&&t._sounds[r]._node&&t._sounds[r]._node.disconnect(0),t._sounds.splice(r,1),n--)}}},_getSoundIds:function(t){if(void 0===t){for(var e=[],n=0;n<this._sounds.length;n++)e.push(this._sounds[n]._id);return e}return[t]},_refreshBuffer:function(t){return t._node.bufferSource=i.ctx.createBufferSource(),t._node.bufferSource.buffer=u[this._src],t._panner?t._node.bufferSource.connect(t._panner):t._node.bufferSource.connect(t._node),t._node.bufferSource.loop=t._loop,t._loop&&(t._node.bufferSource.loopStart=t._start||0,t._node.bufferSource.loopEnd=t._stop||0),t._node.bufferSource.playbackRate.setValueAtTime(t._rate,i.ctx.currentTime),this},_cleanBuffer:function(t){var e=i._navigator&&i._navigator.vendor.indexOf("Apple")>=0;if(!t.bufferSource)return this;if(i._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),e))try{t.bufferSource.buffer=i._scratchBuffer}catch(t){}return t.bufferSource=null,this},_clearSound:function(t){/MSIE |Trident\//.test(i._navigator&&i._navigator.userAgent)||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var s=function(t){this._parent=t,this.init()};s.prototype={init:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++i._counter,e._sounds.push(t),t.create(),t},create:function(){var t=this,e=t._parent,n=i._muted||t._muted||t._parent._muted?0:t._volume;return e._webAudio?(t._node=void 0===i.ctx.createGain?i.ctx.createGainNode():i.ctx.createGain(),t._node.gain.setValueAtTime(n,i.ctx.currentTime),t._node.paused=!0,t._node.connect(i.masterGain)):i.noAudio||(t._node=i._obtainHtml5Audio(),t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(i._canPlayEvent,t._loadFn,!1),t._endFn=t._endListener.bind(t),t._node.addEventListener("ended",t._endFn,!1),t._node.src=e._src,t._node.preload=!0===e._preload?"auto":e._preload,t._node.volume=n*i.volume(),t._node.load()),t},reset:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++i._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorFn,!1)},_loadListener:function(){var t=this,e=t._parent;e._duration=Math.ceil(10*t._node.duration)/10,0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),t._node.removeEventListener(i._canPlayEvent,t._loadFn,!1)},_endListener:function(){var t=this,e=t._parent;e._duration===1/0&&(e._duration=Math.ceil(10*t._node.duration)/10,e._sprite.__default[1]===1/0&&(e._sprite.__default[1]=1e3*e._duration),e._ended(t)),t._node.removeEventListener("ended",t._endFn,!1)}};var u={},c=function(t){var e=t._src;if(u[e])return t._duration=u[e].duration,void p(t);if(/^data:[^;]+;base64,/.test(e)){for(var n=atob(e.split(",")[1]),r=new Uint8Array(n.length),o=0;o<n.length;++o)r[o]=n.charCodeAt(o);f(r.buffer,t)}else{var i=new XMLHttpRequest;i.open(t._xhr.method,e,!0),i.withCredentials=t._xhr.withCredentials,i.responseType="arraybuffer",t._xhr.headers&&Object.keys(t._xhr.headers).forEach((function(e){i.setRequestHeader(e,t._xhr.headers[e])})),i.onload=function(){var e=(i.status+"")[0];"0"===e||"2"===e||"3"===e?f(i.response,t):t._emit("loaderror",null,"Failed loading audio file with status: "+i.status+".")},i.onerror=function(){t._webAudio&&(t._html5=!0,t._webAudio=!1,t._sounds=[],delete u[e],t.load())},l(i)}},l=function(t){try{t.send()}catch(e){t.onerror()}},f=function(t,e){var n=function(){e._emit("loaderror",null,"Decoding audio data failed.")},r=function(t){t&&e._sounds.length>0?(u[e._src]=t,p(e,t)):n()};"undefined"!=typeof Promise&&1===i.ctx.decodeAudioData.length?i.ctx.decodeAudioData(t).then(r).catch(n):i.ctx.decodeAudioData(t,r,n)},p=function(t,e){e&&!t._duration&&(t._duration=e.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},d=function(){if(i.usingWebAudio){try{"undefined"!=typeof AudioContext?i.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?i.ctx=new webkitAudioContext:i.usingWebAudio=!1}catch(t){i.usingWebAudio=!1}i.ctx||(i.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(i._navigator&&i._navigator.platform),e=i._navigator&&i._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),n=e?parseInt(e[1],10):null;if(t&&n&&n<9){var r=/safari/.test(i._navigator&&i._navigator.userAgent.toLowerCase());i._navigator&&!r&&(i.usingWebAudio=!1)}i.usingWebAudio&&(i.masterGain=void 0===i.ctx.createGain?i.ctx.createGainNode():i.ctx.createGain(),i.masterGain.gain.setValueAtTime(i._muted?0:i._volume,i.ctx.currentTime),i.masterGain.connect(i.ctx.destination)),i._setup()}};void 0===(r=function(){return{Howler:i,Howl:a}}.apply(e,[]))||(t.exports=r),e.Howler=i,e.Howl=a,void 0!==n.g?(n.g.HowlerGlobal=o,n.g.Howler=i,n.g.Howl=a,n.g.Sound=s):"undefined"!=typeof window&&(window.HowlerGlobal=o,window.Howler=i,window.Howl=a,window.Sound=s)}(),
|
|
11
11
|
/*!
|
|
12
12
|
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
|
|
13
13
|
*
|
|
@@ -28,4 +28,4 @@ function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.p
|
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the MIT license found in the
|
|
30
30
|
* LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/function c(t,e,n){var r,i={},c=null,l=null;for(r in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,r)&&!u.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:c,ref:l,props:i,_owner:s.current}}e.jsx=c,e.jsxs=c},848:(t,e,n)=>{"use strict";t.exports=n(20)},72:t=>{"use strict";var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var i={},a=[],s=0;s<t.length;s++){var u=t[s],c=r.base?u[0]+r.base:u[0],l=i[c]||0,f="".concat(c," ").concat(l);i[c]=l+1;var d=n(f),p={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var h=o(p,r);r.byIndex=s,e.splice(s,0,{identifier:f,updater:h,references:1})}a.push(f)}return a}function o(t,e){var n=e.domAPI(e);n.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var i=r(t=t||[],o=o||{});return function(t){t=t||[];for(var a=0;a<i.length;a++){var s=n(i[a]);e[s].references--}for(var u=r(t,o),c=0;c<i.length;c++){var l=n(i[c]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}i=u}}},659:t=>{"use strict";var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},56:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},12:e=>{"use strict";e.exports=t}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={id:t,exports:{}};return e[t](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nc=void 0;var o={};return(()=>{"use strict";function t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return n};var e,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(e){l=function(t,e,n){return t[e]=n}}function d(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new I(r||[]);return i(a,"_invoke",{value:O(t,n,s)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=d;var h="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,s,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(M([])));x&&x!==r&&o.call(x,s)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function T(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(r,i,a,s){var u=p(t[r],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==f(l)&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function O(t,n,r){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=P(s,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var c=p(t,n,r);if("normal"===c.type){if(o=r.done?m:y,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function P(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=p(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(f(t)+" is not iterable")}return w.prototype=_,i(A,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},n.awrap=function(t){return{__await:t}},T(E.prototype),l(E.prototype,u,(function(){return this})),n.AsyncIterator=E,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new E(d(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(A),l(A,c,"Generator"),l(A,s,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=M,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}function e(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=c(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s(r.key),r)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}function u(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}r.r(o),r.d(o,{Align:()=>Ne,Base:()=>Hf,Character:()=>Gt,ColoredSentence:()=>Yt,CommonPosition:()=>Me,CommonPositionType:()=>_e,Condition:()=>Ys,Control:()=>nu,Coord2D:()=>Le,Dissolve:()=>pd,Fade:()=>Zf,FadeIn:()=>id,Game:()=>ue,GameProviders:()=>Df,GameState:()=>G,Image:()=>Fa,Isolated:()=>ot,Lambda:()=>qs,LiveGame:()=>ce,Menu:()=>lu,Player:()=>Ff,Say:()=>qt,Scene:()=>Gu,Script:()=>Ju,Sentence:()=>$t,Sound:()=>Pu,SoundType:()=>wu,Story:()=>sc,Transform:()=>Pa,Utils:()=>Is,Word:()=>Ht,useGame:()=>pt});var d=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function p(t,e){var n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r={},o=function(t,e,n){return"object"!==f(e)||null===e||Array.isArray(e)||"object"!==f(n)||null===n||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n)?e.map((function(t,e){return"object"===f(t)&&null!==t&&!Array.isArray(t)&&n[e]?p(t,n[e]):t})):void 0!==n?n:e:e.constructor!==Object||n.constructor!==Object?n||e:p(e,n)};for(var i in t)n(t,i)&&(r[i]=o(0,t[i],e[i]));for(var a in e)n(e,a)&&!n(r,a)&&("object"===f(e[a])&&null!==e[a]?e[a].constructor!==Object?r[a]=e[a]:r[a]=p({},e[a]):r[a]=e[a]);for(var s=arguments.length,c=new Array(s>2?s-2:0),l=2;l<s;l++)c[l-2]=arguments[l];if(c.length){var d=c[0],h=c.slice(1);return p.apply(void 0,[r,d].concat(u(h)))}return r}var h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},r=arguments.length>1?arguments[1]:void 0;n(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=r}return a(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var n,r=e(this.listeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)(this.result)}}catch(t){r.e(t)}finally{r.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function y(t){var n=new WeakSet;return function t(r){if(null===r||"object"!==f(r))return r;if(!n.has(r)){if(n.add(r),Array.isArray(r)){var o,i=[],a=e(r);try{for(a.s();!(o=a.n()).done;){var s=o.value;i.push(t(s))}}catch(t){a.e(t)}finally{a.f()}return i}var u={};for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(u[c]=t(r[c]));return u}}(t)}function v(t){return"string"==typeof t?t:"#".concat((t.r||0).toString(16).padStart(2,"0")).concat((t.g||0).toString(16).padStart(2,"0")).concat((t.b||0).toString(16).padStart(2,"0")).concat(void 0!==t.a?t.a.toString(16).padStart(2,"0"):"")}var m=function(){return a((function t(){n(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return d(this,void 0,void 0,t().mark((function r(){var i,a,s,u,c,l=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.events[n]||(this.events[n]=[]),i=[],a=e(this.events[n]);try{for(a.s();!(s=a.n()).done;)u=s.value,(c=u.apply(void 0,o))&&"object"===f(c)&&"function"==typeof c.then&&i.push(c)}catch(t){a.e(t)}finally{a.f()}if(this.events[n]=this.events[n].filter((function(t){return!i.includes(t)})),0!==i.length){t.next=7;break}return t.abrupt("return",new Promise((function(t){var e=l.on("event:EventDispatcher.register",(function(r,i){if(r===n){l.off(r,e);var a=null==i?void 0:i.apply(void 0,o);a&&a.then?a.then(t):t(a)}}))})));case 7:return t.next=9,Promise.all(i);case 9:return t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),r,this)})))}}])}();function g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function b(t){return new Promise((function(e){return setTimeout(e,t)}))}function w(t,e){if(t===e)return!0;if("object"!==f(t)||"object"!==f(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!w(t[a],e[a]))return!1}return!0}var _=function(){return a((function t(e,r){n(this,t),this.game=e,this.prefix=r}),[{key:"log",value:function(t){if(this.game.config.app.logger.log){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"info",value:function(t){if(this.game.config.app.logger.info){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).info.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"warn",value:function(t){if(this.game.config.app.logger.warn){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).warn.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"error",value:function(t){if(this.game.config.app.logger.error){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).error.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"debug",value:function(t){if(this.game.config.app.logger.debug){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).debug.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"trace",value:function(t){if(this.game.config.app.logger.trace){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console.trace(this._log.apply(this,[t].concat(n)))}}},{key:"_log",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===n.length?[this.prefix||"",t]:["".concat(this.prefix||""," [").concat(t,"]")].concat(n)}}])}(),S=function(){return a((function t(e){n(this,t),this.abortHandler=e,this.events=new m,this.aborted=!1}),[{key:"abort",value:function(){return this.aborted||(this.aborted=!0,this.result=this.abortHandler.apply(this,arguments)),this.result}},{key:"isAborted",value:function(){return this.aborted}},{key:"cancel",value:function(){this.aborted=!0}}])}();function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return A(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,P(r.key),r)}}function O(t,e,n){return e&&E(t.prototype,e),n&&E(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function P(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==k(e)?e:e+""}S.EventTypes={"event:skipController.abort":"event:skipController.abort"};var j=function(){function t(e,n,r){T(this,t),this.name=e,this.key=r||e,this.content=p({},n)}return O(t,[{key:"set",value:function(e,n){return t.isSerializable(n)?(this.content[e]=n,this):(console.warn('Value "'.concat(n,'" in key "').concat(String(e),'" is not serializable, and will not be set\nat namespace "').concat(this.name,'"')),this.content[e]=n,this)}},{key:"get",value:function(t){return this.content[t]}},{key:"toData",value:function(){return this.serialize()}},{key:"load",value:function(t){t?this.content=t:console.warn("No data to load")}},{key:"serialize",value:function(){var t=this,e={};return Object.entries(this.content).forEach((function(n){var r=x(n,2),o=r[0],i=r[1];e[o]=t.wrap(i)})),e}},{key:"deserialize",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=x(t,2),r=n[0],o=n[1];e.content[r]=e.unwrap(o)})):console.warn("No data to load")}},{key:"toTypeName",value:function(t){return t instanceof Date?"date":"any"}},{key:"wrap",value:function(t){return{any:function(t){return{type:"any",data:t}},date:function(t){return{type:"date",data:t.toString()}}}[this.toTypeName(t)](t)}},{key:"unwrap",value:function(t){var e={any:function(t){return t.data},date:function(t){return new Date(t.data)}};return e[t.type](t)}}],[{key:"isSerializable",value:function(e){return!!["number","string","boolean"].includes(k(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===k(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),C=function(){return O((function t(){T(this,t),this.namespaces={}}),[{key:"addNamespace",value:function(t){return this.namespaces[t.key]=t,this}},{key:"getNamespace",value:function(t){return this.namespaces[t]}},{key:"setNamespace",value:function(t,e){return this.namespaces[t]=e,this}},{key:"getNamespaces",value:function(){return this.namespaces}},{key:"keys",value:function(){return Object.keys(this.namespaces)}},{key:"values",value:function(){return Object.values(this.namespaces)}},{key:"entries",value:function(){return Object.entries(this.namespaces)}},{key:"toData",value:function(){return this.entries().reduce((function(t,e){var n=x(e,2),r=n[0],o=n[1];return t[r]=o.toData(),t}),{})}},{key:"load",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=x(t,2),r=n[0],o=n[1];e.namespaces[r]?e.namespaces[r].load(o):console.warn("Namespace ".concat(r," not found in ").concat(e.constructor.name))})):console.warn("No data to load")}}])}();function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function M(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,L(r.key),r)}}function L(t){var e=function(t,e){if("object"!=I(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==I(e)?e:e+""}var N=r(196);function R(t){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(t)}function F(t){return function(t){if(Array.isArray(t))return t}(t)||B(t)||D(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(t){return function(t){if(Array.isArray(t))return $(t)}(t)||B(t)||D(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(t,e){if(t){if("string"==typeof t)return $(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(t,e):void 0}}function B(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function $(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function U(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,H(r.key),r)}}function H(t){var e=function(t,e){if("object"!=R(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==R(e)?e:e+""}var G=function(){return function(t,e,n){return e&&U(t.prototype,e),n&&U(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={sounds:[],srcManagers:[],elements:[]},this.currentHandling=null,this.stage=n,this.game=e,this.events=new m,this.logger=new _(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByImage",value:function(t){return this.state.elements.find((function(e){return e.ele.images.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this._getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=this.createWaitableAction({character:e.character,sentence:e,id:t},(function(){i.splice(i.indexOf(a),1),n&&n()}));i.push(a)}},{key:"createMenu",value:function(t,e,n){var r;if(!t.choices.length)throw new Error("Menu must have at least one choice");var o=null===(r=this.findElementByScene(this._getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!o)throw new Error("Scene not found");var i=this.createWaitableAction(t,(function(t){o.splice(o.indexOf(i),1),e&&e(t)}));o.push(i)}},{key:"createImage",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.images.push(t),this):this}},{key:"disposeImage",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.images;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Image not found");return o.splice(i,1),this}},{key:"playSound",value:function(t,e){var n=t.play(),r=[t.once("end",o.bind(this)),t.once("stop",o.bind(this))];function o(){e&&e(),r.forEach((function(t){return t.off()})),this.stage.next()}return n}},{key:"getHowl",value:function(){return N.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(V(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"toData",value:function(){return{elements:this.state.elements.map((function(t){return{scene:t.scene.id,ele:{images:t.ele.images.map((function(t){return t.id}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;this.state.elements=[];var r=this.game.getLiveGame().story;if(!r)throw new Error("No story loaded");var o=r.getAllElements(e);t.elements.forEach((function(t){var e=F(r.findElementsByIds([t.scene].concat(V(t.ele.images)),o)),i={scene:e[0],ele:{images:e.slice(1),menus:[],texts:[]}};n.state.elements.push(i),n.state.srcManagers.push(i.scene.srcManager)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],images:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"_getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new Error('Scene not found, please call "scene.activate()" first.');return e}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}])}();function z(t){var e,n,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=z(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}G.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip"};const W=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=z(t))&&(r&&(r+=" "),r+=e);return r};var q=r(12),Y=r.n(q);function X(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return K(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?K(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function K(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Z(t){return Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z(t)}function Q(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,J(r.key),r)}}function J(t){var e=function(t,e){if("object"!=Z(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Z(e)?e:e+""}var tt=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={width:0,height:0,minWidth:800,minHeight:450,paused:!1},this.events=new m,this.lockers=[],this.updater=null}return function(t,e,n){return e&&Q(t.prototype,e),n&&Q(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n){this.state.width=e,this.state.height=n,this.events.emit(t.EventTypes["event:aspectRatio.update"],e,n)}},{key:"updateMin",value:function(t,e){this.state.minWidth=t,this.state.minHeight=e}},{key:"lock",value:function(){var t=Symbol();return this.lockers.push(t),t}},{key:"unlock",value:function(t){if(t&&!this.lockers.includes(t))throw new Error("Locker not found");return this.lockers=this.lockers.filter((function(e){return e!==t})),this.triggerUpdate(),null}},{key:"isLocked",value:function(){return!!this.lockers.length}},{key:"getStyle",value:function(){return{width:"".concat(this.state.width,"px"),height:"".concat(this.state.height,"px")}}},{key:"setUpdate",value:function(t){this.updater=t}},{key:"pause",value:function(){this.state.paused=!0,this.events.emit(t.EventTypes["event:aspectRatio.pause"])}},{key:"resume",value:function(){this.state.paused=!1,this.events.emit(t.EventTypes["event:aspectRatio.resume"])}},{key:"onUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.update"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.update"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();tt.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume"};var et=(0,q.createContext)(null);function nt(t){var e=t.children,n=X((0,q.useState)(new tt),1)[0];return Y().createElement(et.Provider,{value:{ratio:n}},e)}function rt(){var t=(0,q.useContext)(et);if(!et||!t)throw new Error("useRatio must be used within a RatioProvider");var e=X((0,q.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,q.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function ot(t){var e=t.children,n=t.className,r=rt().ratio,o=r.getStyle();return Y().createElement("div",{className:W("inset-0 flex items-center justify-center",n),style:{width:"100%",height:"100%",minWidth:"".concat(r.state.minWidth,"px"),minHeight:"".concat(r.state.minHeight,"px")}},Y().createElement("div",{style:Object.assign(Object.assign({},o),{position:"relative"})},e))}function it(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return at(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function at(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}const st=function(t){var e=t.text,n=t.speed,r=t.onComplete,o=t.className,i=it((0,q.useState)(""),2),a=i[0],s=i[1],u=it((0,q.useState)(0),2),c=u[0],l=u[1];return(0,q.useEffect)((function(){if(c<e.length){if(" "!==e[c]){var t=setTimeout((function(){s((function(t){return t+e[c]})),l((function(t){return t+1}))}),n);return function(){return clearTimeout(t)}}s((function(t){return t+" "})),l((function(t){return t+1}))}else r&&r()}),[c,e,n,r]),Y().createElement("span",{className:o},a)};function ut(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ct(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ct(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var lt,ft=Y().createContext(null);function dt(t){var e=t.children,n=t.game,r=new ue({}),o=ut((0,q.useState)(n||r),2),i=o[0],a=o[1];return Y().createElement(ft.Provider,{value:{game:i,setGame:a}},e)}function pt(){var t=(0,q.useContext)(ft);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function ht(t){return ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ht(t)}function yt(t){return function(t){if(Array.isArray(t))return vt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return vt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function mt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,wt(r.key),r)}}function bt(t,e,n){return e&>(t.prototype,e),n&>(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function wt(t){var e=function(t,e){if("object"!=ht(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ht(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ht(e)?e:e+""}var _t=Symbol("_Chained"),St=function(){function t(){mt(this,t),this[lt]=!0,this.__actions=[]}return bt(t,[{key:"push",value:function(){var t;(t=this.__actions).push.apply(t,arguments)}},{key:"getActions",value:function(){return this.__actions}}],[{key:"isChained",value:function(t){return t&&t[_t]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(2)}}])}();lt=_t;var kt=function(){return bt((function t(){mt(this,t)}),[{key:"chain",value:function(t){var e=St.isChained(this)?this:this.proxy(this,new St);if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,yt(n)),e}},{key:"proxy",value:function(t,e){var n=new Proxy(t,{get:function(t,r){if(r in e)return e[r];var o=t[r];return"function"==typeof o?o.bind(n):o},set:function(t,e,n){return t[e]=n,!0}});return n}}])}();function xt(t){return xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xt(t)}function At(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Tt(r.key),r)}}function Tt(t){var e=function(t,e){if("object"!=xt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=xt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xt(e)?e:e+""}function Et(t,e,n){return e=Pt(e),function(t,e){if(e&&("object"==xt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ot()?Reflect.construct(e,n||[],Pt(t).constructor):e.apply(t,n))}function Ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ot=function(){return!!t})()}function Pt(t){return Pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pt(t)}function jt(t,e){return jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jt(t,e)}var Ct=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.IdPrefixes.Actionable;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Et(this,e)).id=ue.getIdManager().prefix(n,ue.getIdManager().getStringId(),"-"),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jt(t,e)}(e,t),function(t,e,n){return e&&At(t.prototype,e),n&&At(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toActions",value:function(){return[]}},{key:"toData",value:function(){return null}},{key:"fromData",value:function(t){return this}},{key:"fromChained",value:function(t){return t.getActions()}}])}(kt);function It(t){return It="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},It(t)}function Mt(t,e,n){return e=Nt(e),function(t,e){if(e&&("object"==It(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Lt()?Reflect.construct(e,n||[],Nt(t).constructor):e.apply(t,n))}function Lt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Lt=function(){return!!t})()}function Nt(t){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nt(t)}function Rt(t,e){return Rt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rt(t,e)}function Ft(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Vt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Bt(r.key),r)}}function Dt(t,e,n){return e&&Vt(t.prototype,e),n&&Vt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Bt(t){var e=function(t,e){if("object"!=It(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=It(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==It(e)?e:e+""}Ct.IdPrefixes={Actionable:"actionable",Condition:"$0",Control:"$1",Image:"$2",Script:"$3",Sound:"$4",Text:"$5",Menu:"$6"};var $t=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ft(this,t),this.character=e,this.text=this.format(n),this.config=p(t.defaultConfig,r),this.id=ue.getIdManager().getStringId(),this.state=y(t.defaultState)}return Dt(t,[{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)Ht.isWord(t[n])?e.push(t[n]):e.push(new Ht(t[n]));else e.push(Ht.isWord(t)?t:new Ht(t));return e}},{key:"toData",value:function(){return w(this.state,t.defaultState)?null:{state:y(this.state)}}},{key:"fromData",value:function(t){return this.state=p(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(null,e)}}])}();$t.defaultConfig={color:"#000",pause:!0,voice:null},$t.defaultState={display:!0};var Ut,Ht=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ft(this,t),this.text=e,this.config=p(t.defaultConfig,n)}return Dt(t,null,[{key:"isWord",value:function(e){return e instanceof t}}])}();Ht.defaultConfig={},Ht.defaultColor="#000",function(t){t.adv="adv",t.nvl="nvl"}(Ut||(Ut={}));var Gt=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ft(this,e),(n=Mt(this,e,[Ct.IdPrefixes.Text])).name=t,n.config=p({},e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Rt(t,e)}(e,t),Dt(e,[{key:"say",value:function(t){var e=Array.isArray(t)?new $t(this,t,{}):$t.isSentence(t)?t:new $t(this,t,{}),n=new ds(this,ds.ActionTypes.say,new ke(ue.getIdManager().getStringId()).setContent(e));return this.chain(n)}}])}(Ct);function zt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Wt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wt(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Wt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function qt(t){var e,n=t.action,r=t.onClick,o=t.useTypeEffect,i=void 0===o||o,a=t.className,s=t.state,u=n.sentence,c=n.character,l=zt((0,q.useState)(0),2),f=l[0],d=l[1],p=zt((0,q.useState)(!1),2),h=p[0],y=p[1],m=pt().game,g=function(){d((function(t){return t+1})),f===u.text.length-1&&y(!0)};return(0,q.useEffect)((function(){if(window){var t=function(t){m.config.elements.say.nextKey.includes(t.key)&&(h?r&&r():y(!0))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[h]),(0,q.useEffect)((function(){var t=s.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:s.events.on(G.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),y(!0),r&&r()}))}]);return function(){t.cancel()}})),Y().createElement(ot,{className:"absolute"},u.state.display&&(c&&c.config.mode!==Gt.Modes.adv?Y().createElement(Y().Fragment,null," "):Y().createElement("div",{className:W("absolute flex items-center justify-center bottom-0 w-[calc(100%-40px)] h-[calc(33%-40px)] m-4 bg-white",m.config.elementStyles.say.container,a),onClick:function(){h?r&&r():y(!0)}},Y().createElement("div",{className:W("absolute top-0 left-0 p-1.25 rounded-br-md m-4",m.config.elementStyles.say.nameText)},(null===(e=u.character)||void 0===e?void 0:e.name)||""),Y().createElement("div",{className:W("text-center max-w-[80%] mx-auto",m.config.elementStyles.say.textContainer)},u.text.map((function(t,e){var n=t.config.color||u.config.color||Ht.defaultColor;return h?Y().createElement("span",{key:e,style:{color:"string"==typeof n?n:v(n)},className:W(m.config.elementStyles.say.textSpan)},t.text):e>f?null:Y().createElement("span",{key:e,style:{color:v(n)},className:W(m.config.elementStyles.say.textSpan)},i?Y().createElement(st,{text:t.text,onComplete:e===f?g:void 0,speed:m.config.elements.say.textInterval,className:W(m.config.elementStyles.say.textSpan)}):t.text)}))))))}function Yt(t){var e=t.sentence,n=t.className;return Y().createElement(Y().Fragment,null,e.text.map((function(t,r){var o=t.config.color||e.config.color||Ht.defaultColor;return Y().createElement("span",{key:r,style:{color:v(o)},className:n},t.text)})))}Gt.Modes=Ut,Gt.defaultConfig={mode:Ut.adv};var Xt={say:qt,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=pt().game,a=i.config.elements.say.use;return Y().createElement(Y().Fragment,null,Y().createElement(ot,{className:"absolute"},Y().createElement("div",{className:"absolute flex flex-col items-center justify-center min-w-full w-full h-full"},e&&Y().createElement(a,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"}))),Y().createElement(ot,{className:"absolute"},Y().createElement("div",{className:W("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.container)},Y().createElement("div",{className:"p-4 rounded-lg w-full z-20"},Y().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return Y().createElement("button",{key:e,className:W("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButton),onClick:function(){return function(t){r(t)}(t)}},Y().createElement(Yt,{key:e,sentence:t.prompt,className:W(i.config.elementStyles.menu.choiceButtonText)}))})))))))}};function Kt(t){return Kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kt(t)}function Zt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,te(r.key),r)}}function Jt(t,e,n){return e&&Qt(t.prototype,e),n&&Qt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function te(t){var e=function(t,e){if("object"!=Kt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Kt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Kt(e)?e:e+""}function ee(t,e,n){return e=re(e),function(t,e){if(e&&("object"==Kt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ne()?Reflect.construct(e,n||[],re(t).constructor):e.apply(t,n))}function ne(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ne=function(){return!!t})()}function re(t){return re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},re(t)}function oe(t,e){return oe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},oe(t,e)}var ie,ae=function(t){function e(){var t;return Zt(this,e),(t=ee(this,e,arguments)).id=0,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&oe(t,e)}(e,t),Jt(e,[{key:"getId",value:function(){return this.id++}},{key:"getStringId",value:function(){return(this.id++).toString()}},{key:"prefix",value:function(t,e){return t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:":")+e}}])}(function(){var t=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return function(t,e,n){return e&&M(t.prototype,e),n&&M(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"getInstance",value:function(){return t._instance||(t._instance=new this),t._instance}}])}();return t._instance=null,t}()),se=function(){return Jt((function t(){Zt(this,t),this.id=0}),[{key:"getId",value:function(){return this.id++}},{key:"getStringId",value:function(){return(this.id++).toString()}},{key:"prefix",value:function(t,e){return t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:":")+e}}])}();!function(t){t.game="game"}(ie||(ie={}));var ue=function(){return Jt((function t(e){Zt(this,t),this.liveGame=null,this.config=p(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Xt).includes(t))throw new Error("Invalid key ".concat(t));if("function"!=typeof e)throw new Error("Invalid component for key ".concat(t));return this.config.elements[t].use=e,this}},{key:"getLiveGame",value:function(){if(!this.liveGame){var t=this.createLiveGame();return this.liveGame=t,t}return this.liveGame}},{key:"createLiveGame",value:function(){return new ce(this)}}],[{key:"getIdManager",value:function(){return ae.getInstance()}}])}();ue.defaultSettings={volume:1},ue.ComponentTypes={say:"say",menu:"menu"},ue.DefaultConfig={version:"v0.0.0",player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:"100%",height:"100%",skipKey:["Control"],skipInterval:100},elements:{say:{nextKey:[" "],textInterval:50,use:Xt.say},img:{slowLoadWarning:!0,slowLoadThreshold:2e3},menu:{use:Xt.menu}},elementStyles:{say:{container:"",nameText:"",textContainer:"",textSpan:""},menu:{container:"",choiceButton:"",choiceButtonText:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1}}},ue.GameSettingsNamespace=ie;var ce=function(){function t(e){Zt(this,t),this.currentSceneNumber=null,this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this._lockedCount=0,this.currentAction=null,this.game=e,this.storable=new C,this.initNamespaces(),this.idManager=new se}return Jt(t,[{key:"getDefaultSavedGame",value:function(){return{name:"_",version:this.game.config.version,meta:{created:Date.now(),updated:Date.now()},game:{store:{},elementState:[],nodeChildIdMap:{},stage:{elements:[]},currentScene:0,currentAction:null}}}},{key:"initNamespaces",value:function(){return this.storable.addNamespace(new j(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t,this}},{key:"newGame",value:function(){var t,e;this.initNamespaces(),this.currentAction=(null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.sceneRoot)||null;var n=this.getDefaultSavedGame();return n.name="NewGame-"+Date.now(),this.currentSavedGame=n,this}},{key:"deserialize",value:function(t,e){var n=e.gameState,r=this.story;if(!r)throw new Error("No story loaded");if(t.version!==this.game.config.version)throw new Error("Saved game version mismatch");var o=r.getAllActions(),i=t.game,a=i.store,s=i.elementState,u=i.nodeChildIdMap,c=i.currentAction,l=i.stage;this.storable.load(a),r._setAllElementState(s,o),r._setNodeChildByMap(u,o),c?this.setCurrentAction(r.findActionById(c,o)||null):this.setCurrentAction(null),this.currentSavedGame=t,n.loadData(l,o)}},{key:"serialize",value:function(t){var e,n,r,o=t.gameState,i=this.story;if(!i)throw new Error("No story loaded");var a=i.getAllActions(),s=i._getAllElementState(a),u=Object.fromEntries(i._getNodeChildIdMap(a)),c=o.toData();return{name:(null===(e=this.currentSavedGame)||void 0===e?void 0:e.name)||"_",version:this.game.config.version,meta:{created:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.meta.created)||Date.now(),updated:Date.now()},game:{store:this.storable.toData(),elementState:s,stage:c,nodeChildIdMap:u,currentScene:0,currentAction:(null===(r=this.getCurrentAction())||void 0===r?void 0:r.getId())||null}}}},{key:"getCurrentAction",value:function(){return this.currentAction}},{key:"setCurrentAction",value:function(t){return this.currentAction=t,this}},{key:"next",value:function(t){var e,n,r;if(!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("Locked awaiting");return this.lockedAwaiting}var o=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==o?void 0:o.node)||void 0===e?void 0:e.action)||null,t.logger.debug("next action",o),this.lockedAwaiting=null,o||null}if(!this.currentAction)return t.events.emit(G.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),null;var i=this.currentAction.executeAction(t);return h.isAwaitable(i)?(this.lockedAwaiting=i,i):(t.logger.debug("next action",i),this._lockedCount=0,this.currentAction=(null===(r=null===(n=i.node)||void 0===n?void 0:n.child)||void 0===r?void 0:r.action)||null,i)}},{key:"abortAwaiting",value:function(){var t;if(this.lockedAwaiting){var e=this.lockedAwaiting.abort();this.currentAction=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.action)||null,this.lockedAwaiting=null}}},{key:"executeAction",value:function(t,e){var n,r,o=e.executeAction(t);return h.isAwaitable(o)?o:(null===(r=null===(n=null==o?void 0:o.node)||void 0===n?void 0:n.child)||void 0===r?void 0:r.action)||null}}])}();ce.DefaultNamespaces={game:{}},ce.GameSpacesKey={game:"game"};function le(t){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(t)}function fe(t,e,n){return e=pe(e),function(t,e){if(e&&("object"==le(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,de()?Reflect.construct(e,n||[],pe(t).constructor):e.apply(t,n))}function de(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(de=function(){return!!t})()}function pe(t){return pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pe(t)}function he(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ye(t,e)}function ye(t,e){return ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ye(t,e)}function ve(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function me(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,be(r.key),r)}}function ge(t,e,n){return e&&me(t.prototype,e),n&&me(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function be(t){var e=function(t,e){if("object"!=le(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=le(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==le(e)?e:e+""}var we;!function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(we||(we={}));var _e,Se=function(){return ge((function t(e,n){ve(this,t),this.id=e,this.type=n,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}(),ke=function(t){function e(t,n,r,o){var i;return ve(this,e),(i=fe(this,e,[ue.getIdManager().prefix("node",t,"-"),we.ContentNode])).child=o||null,i.parent=r||null,i.action=n||null,i}return he(e,t),ge(e,[{key:"setParent",value:function(t){if(t===this)throw new Error("Cannot set parent to itself");return this.parent=t,this}},{key:"setChild",value:function(t){if(t===this)throw new Error("Cannot set child to itself");return this.child=t,t&&t.parent!==this&&t.remove().setParent(this),this}},{key:"getChild",value:function(){return this.child||null}},{key:"getParent",value:function(){return this.parent||null}},{key:"setInitChild",value:function(t){return this.initChild=t,this.setChild(t)}},{key:"addChild",value:function(t){return this.setChild(t),this}},{key:"removeChild",value:function(t){return t&&this.child===t?(this.child=null,t.setParent(null)):t||(this.child=null),this}},{key:"remove",value:function(){var t;return null===(t=this.parent)||void 0===t||t.removeChild(this),this}},{key:"hasChild",value:function(){return!!this.child}}],[{key:"forEachParent",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getParent()}},{key:"forEachChild",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getChild()}}])}(Se),xe={center:"center",left:"left",right:"right"};function Ae(t){return Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae(t)}function Te(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ee(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,je(r.key),r)}}function Oe(t,e,n){return e&&Ee(t.prototype,e),n&&Ee(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Pe(t,e,n){return(e=je(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function je(t){var e=function(t,e){if("object"!=Ae(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ae(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ae(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(_e||(_e={}));var Ce=Pe(Pe(Pe({},_e.Left,"33.33%"),_e.Center,"50%"),_e.Right,"66.66%"),Ie=function(){function t(){Te(this,t)}return Oe(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"".concat(e);var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + ").concat(n,"px)")}},{key:"toCoord2D",value:function(t){if(Me.isCommonPositionType(t))return Le.fromCommonPosition(t);if(Le.isCoord2DPosition(t))return t;if(Ne.isAlignPosition(t))return Le.fromAlignPosition(t);if("object"===Ae(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new Le(t);throw new Error("Invalid position type")}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return Le.merge(n,r)}},{key:"serializePosition",value:function(e){var n=this.toCoord2D(e);return{x:t.isUnknown(n.x)?0:n.x,y:t.isUnknown(n.y)?0:n.y,xoffset:t.isUnknown(n.xoffset)?0:n.xoffset,yoffset:t.isUnknown(n.yoffset)?0:n.yoffset}}},{key:"isRawCommonPositionType",value:function(t){return Object.values(_e).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===Ae(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===Ae(t)&&("xalign"in t||"yalign"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawPosition",value:function(t){return this.isRawCommonPositionType(t)||this.isRawCoord2DPosition(t)||this.isRawAlignPosition(t)}},{key:"isPosition",value:function(t){return t instanceof Me||t instanceof Le||t instanceof Ne}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return Le.fromCommonPosition(new Me(t));if(this.isRawCoord2DPosition(t))return new Le(t);if(this.isRawAlignPosition(t))return Le.fromAlignPosition(t);throw new Error("Invalid position type")}},{key:"tryParsePosition",value:function(t){if(this.isPosition(t))return t;if(this.isRawPosition(t))return this.rawPositionToCoord2D(t);throw new Error("Invalid position type")}}])}();Ie.Unknown=Symbol("Unknown");var Me=function(){function t(e){Te(this,t),this.position=e}return Oe(t,[{key:"toCSS",value:function(){return{x:Ce[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();Me.Positions=_e;var Le=function(){function t(e,n){Te(this,t),"object"===Ae(e)?(this.x=e.x||Ie.Unknown,this.y=e.y||Ie.Unknown,this.xoffset=e.xoffset||Ie.Unknown,this.yoffset=e.yoffset||Ie.Unknown):(this.x=e||Ie.Unknown,this.y=n||Ie.Unknown,this.xoffset=Ie.Unknown,this.yoffset=Ie.Unknown)}return Oe(t,[{key:"toCSS",value:function(){return{x:this.x,y:this.y,xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isCoord2DPosition",value:function(e){return e instanceof t}},{key:"fromCommonPosition",value:function(e){return new t({x:Ce[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:Ie.isUnknown(e.xalign)?Ie.Unknown:"".concat(100*e.xalign,"%"),y:Ie.isUnknown(e.yalign)?Ie.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:Ie.isUnknown(n.x)?e.x:n.x,y:Ie.isUnknown(n.y)?e.y:n.y,xoffset:Ie.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:Ie.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),Ne=function(){function t(e,n){Te(this,t),"object"===Ae(e)?(this.xalign=e.xalign||Ie.Unknown,this.yalign=e.yalign||Ie.Unknown,this.xoffset=e.xoffset||Ie.Unknown,this.yoffset=e.yoffset||Ie.Unknown):(this.xalign=e||Ie.Unknown,this.yalign=n||Ie.Unknown,this.xoffset=Ie.Unknown,this.yoffset=Ie.Unknown)}return Oe(t,[{key:"toCSS",value:function(){return{x:Ie.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:Ie.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();const Re=t=>t;let Fe=Re,Ve=Re;function De(t,e,n){var r;if("string"==typeof t){let o=document;e&&(Ve(Boolean(e.current),"Scope provided, but no element detected."),o=e.current),n?(null!==(r=n[t])&&void 0!==r||(n[t]=o.querySelectorAll(t)),t=n[t]):t=o.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}const Be=new WeakMap,$e=!1,Ue=!1;const He=["read","resolveKeyframes","update","preRender","render","postRender"];function Ge(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=He.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,o=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function s(e){i.has(e)&&(u.schedule(e),t()),e(a)}const u={schedule:(t,o=!1,a=!1)=>{const s=a&&r?e:n;return o&&i.add(t),s.has(t)||s.add(t),t},cancel:t=>{n.delete(t),i.delete(t)},process:t=>{a=t,r?o=!0:(r=!0,[e,n]=[n,e],n.clear(),e.forEach(s),r=!1,o&&(o=!1,u.process(t)))}};return u}(i),t)),{}),{read:s,resolveKeyframes:u,update:c,preRender:l,render:f,postRender:d}=a,p=()=>{const i=Ue?o.timestamp:performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(i-o.timestamp,40),1),o.timestamp=i,o.isProcessing=!0,s.process(o),u.process(o),c.process(o),l.process(o),f.process(o),d.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(p))};return{schedule:He.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(p)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<He.length;e++)a[He[e]].cancel(t)},state:o,steps:a}}const{schedule:ze,cancel:We,state:qe,steps:Ye}=Ge("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Re,!0);function Xe(t){let e;return()=>(void 0===e&&(e=t()),e)}const Ke=Xe((()=>void 0!==window.ScrollTimeline));class Ze{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>{if(!Ke()||!e.attachTimeline)return e.pause(),function(t,e){let n;const r=()=>{const{currentTime:r}=e,o=(null===r?0:r.value)/100;n!==o&&t(o),n=o};return ze.update(r,!0),()=>We(r)}((t=>{e.time=e.duration*t}),t);e.attachTimeline(t)}));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Qe=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Je=new Set(Qe),tn=t=>1e3*t,en=t=>t/1e3,nn={type:"spring",stiffness:500,damping:25,restSpeed:10},rn={type:"keyframes",duration:.8},on={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},an=(t,{keyframes:e})=>e.length>2?rn:Je.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:nn:on;function sn(t,e){return t[e]||t.default||t}const un=!1,cn=t=>null!==t;function ln(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(cn),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const fn=t=>/^0[^.\s]+$/u.test(t);const dn=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),pn=t=>e=>"string"==typeof e&&e.startsWith(t),hn=pn("--"),yn=pn("var(--"),vn=t=>!!yn(t)&&mn.test(t.split("/*")[0].trim()),mn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,gn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function bn(t,e,n=1){Ve(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,o]=function(t){const e=gn.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${null!=n?n:r}`,o]}(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const t=i.trim();return dn(t)?parseFloat(t):t}return vn(o)?bn(o,e,n+1):o}const wn=(t,e,n)=>n>e?e:n<t?t:n,_n={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Sn={..._n,transform:t=>wn(0,1,t)},kn={..._n,default:1},xn=t=>Math.round(1e5*t)/1e5,An=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,Tn=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,En=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function On(t){return"string"==typeof t}const Pn=t=>({test:e=>On(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),jn=Pn("deg"),Cn=Pn("%"),In=Pn("px"),Mn=Pn("vh"),Ln=Pn("vw"),Nn={...Cn,parse:t=>Cn.parse(t)/100,transform:t=>Cn.transform(100*t)},Rn=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Fn=t=>t===_n||t===In,Vn=(t,e)=>parseFloat(t.split(", ")[e]),Dn=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return Vn(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?Vn(e[1],t):0}},Bn=new Set(["x","y","z"]),$n=Qe.filter((t=>!Bn.has(t)));const Un={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:Dn(4,13),y:Dn(5,14)};Un.translateX=Un.x,Un.translateY=Un.y;const Hn=t=>e=>e.test(t),Gn=[_n,In,Cn,jn,Ln,Mn,{test:t=>"auto"===t,parse:t=>t}],zn=t=>Gn.find(Hn(t)),Wn=new Set;let qn=!1,Yn=!1;function Xn(){if(Yn){const t=Array.from(Wn).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return $n.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var r;null===(r=t.getValue(e))||void 0===r||r.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}Yn=!1,qn=!1,Wn.forEach((t=>t.complete())),Wn.clear()}function Kn(){Wn.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Yn=!0)}))}class Zn{constructor(t,e,n,r,o,i=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=r,this.element=o,this.isAsync=i}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Wn.add(this),qn||(qn=!0,ze.read(Kn),ze.resolveKeyframes(Xn))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let o=0;o<t.length;o++)if(null===t[o])if(0===o){const o=null==r?void 0:r.get(),i=t[t.length-1];if(void 0!==o)t[0]=o;else if(n&&e){const r=n.readValue(e,i);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=i),r&&void 0===o&&r.set(t[0])}else t[o]=t[o-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Wn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Wn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Qn=(t,e)=>n=>Boolean(On(n)&&En.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),Jn=(t,e,n)=>r=>{if(!On(r))return r;const[o,i,a,s]=r.match(An);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},tr={..._n,transform:t=>Math.round((t=>wn(0,255,t))(t))},er={test:Qn("rgb","red"),parse:Jn("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+tr.transform(t)+", "+tr.transform(e)+", "+tr.transform(n)+", "+xn(Sn.transform(r))+")"};const nr={test:Qn("#"),parse:function(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:er.transform},rr={test:Qn("hsl","hue"),parse:Jn("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Cn.transform(xn(e))+", "+Cn.transform(xn(n))+", "+xn(Sn.transform(r))+")"},or={test:t=>er.test(t)||nr.test(t)||rr.test(t),parse:t=>er.test(t)?er.parse(t):rr.test(t)?rr.parse(t):nr.parse(t),transform:t=>On(t)?t:t.hasOwnProperty("red")?er.transform(t):rr.transform(t)};const ir="number",ar="color",sr="var",ur="var(",cr="${}",lr=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function fr(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(lr,(t=>(or.test(t)?(r.color.push(i),o.push(ar),n.push(or.parse(t))):t.startsWith(ur)?(r.var.push(i),o.push(sr),n.push(t)):(r.number.push(i),o.push(ir),n.push(parseFloat(t))),++i,cr))).split(cr);return{values:n,split:a,indexes:r,types:o}}function dr(t){return fr(t).values}function pr(t){const{split:e,types:n}=fr(t),r=e.length;return t=>{let o="";for(let i=0;i<r;i++)if(o+=e[i],void 0!==t[i]){const e=n[i];o+=e===ir?xn(t[i]):e===ar?or.transform(t[i]):t[i]}return o}}const hr=t=>"number"==typeof t?0:t;const yr={test:function(t){var e,n;return isNaN(t)&&On(t)&&((null===(e=t.match(An))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(Tn))||void 0===n?void 0:n.length)||0)>0},parse:dr,createTransformer:pr,getAnimatableNone:function(t){const e=dr(t);return pr(t)(e.map(hr))}},vr=new Set(["brightness","contrast","saturate","opacity"]);function mr(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(An)||[];if(!r)return t;const o=n.replace(r,"");let i=vr.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const gr=/\b([a-z-]*)\(.*?\)/gu,br={...yr,getAnimatableNone:t=>{const e=t.match(gr);return e?e.map(mr).join(" "):t}},wr={..._n,transform:Math.round},_r={borderWidth:In,borderTopWidth:In,borderRightWidth:In,borderBottomWidth:In,borderLeftWidth:In,borderRadius:In,radius:In,borderTopLeftRadius:In,borderTopRightRadius:In,borderBottomRightRadius:In,borderBottomLeftRadius:In,width:In,maxWidth:In,height:In,maxHeight:In,size:In,top:In,right:In,bottom:In,left:In,padding:In,paddingTop:In,paddingRight:In,paddingBottom:In,paddingLeft:In,margin:In,marginTop:In,marginRight:In,marginBottom:In,marginLeft:In,rotate:jn,rotateX:jn,rotateY:jn,rotateZ:jn,scale:kn,scaleX:kn,scaleY:kn,scaleZ:kn,skew:jn,skewX:jn,skewY:jn,distance:In,translateX:In,translateY:In,translateZ:In,x:In,y:In,z:In,perspective:In,transformPerspective:In,opacity:Sn,originX:Nn,originY:Nn,originZ:In,zIndex:wr,backgroundPositionX:In,backgroundPositionY:In,fillOpacity:Sn,strokeOpacity:Sn,numOctaves:wr},Sr={..._r,color:or,backgroundColor:or,outlineColor:or,fill:or,stroke:or,borderColor:or,borderTopColor:or,borderRightColor:or,borderBottomColor:or,borderLeftColor:or,filter:br,WebkitFilter:br},kr=t=>Sr[t];function xr(t,e){let n=kr(t);return n!==br&&(n=yr),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Ar=new Set(["auto","none","0"]);class Tr extends Zn{constructor(t,e,n,r,o){super(t,e,n,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let r=t[n];if("string"==typeof r&&(r=r.trim(),vn(r))){const o=bn(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Rn.has(n)||2!==t.length)return;const[r,o]=t,i=zn(r),a=zn(o);if(i!==a)if(Fn(i)&&Fn(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(r=t[e])?0===r:null===r||"none"===r||"0"===r||fn(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,o=0;for(;o<t.length&&!r;){const e=t[o];"string"==typeof e&&!Ar.has(e)&&fr(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=xr(n,r)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Un[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const r=e[e.length-1];void 0!==r&&t.getValue(n,r).jump(r,!1)}measureEndState(){var t;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=Un[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==a&&void 0===this.finalKeyframe&&(this.finalKeyframe=a),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach((([t,n])=>{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}let Er;function Or(){Er=void 0}const Pr={now:()=>(void 0===Er&&Pr.set(qe.isProcessing||Ue?qe.timestamp:performance.now()),Er),set:t=>{Er=t,queueMicrotask(Or)}},jr=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!yr.test(t)&&"0"!==t||t.startsWith("url(")));class Cr{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:i="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Pr.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:o,repeatType:i,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Kn(),Xn()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Pr.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!function(t,e,n,r){const o=t[0];if(null===o)return!1;if("display"===e||"visibility"===e)return!0;const i=t[t.length-1],a=jr(o,e),s=jr(i,e);return Fe(a===s,`You are trying to animate ${e} from "${o}" to "${i}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${i} via the \`style\` property.`),!(!a||!s)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||"spring"===n&&r)}(t,n,r,o)){if(un||!i)return null==s||s(ln(t,this.options,e)),null==a||a(),void this.resolveFinishedPromise();this.options.duration=0}const c=this.initPlayback(t,e);!1!==c&&(this._resolved={keyframes:t,finalKeyframe:e,...c},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function Ir(t,e){return e?t*(1e3/e):0}const Mr=5;function Lr(t,e,n){const r=Math.max(e-Mr,0);return Ir(n-t(r),e-r)}const Nr=.001,Rr=.01,Fr=10,Vr=.05,Dr=1;function Br({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;Fe(t<=tn(Fr),"Spring duration must be 10 seconds or less");let a=1-e;a=wn(Vr,Dr,a),t=wn(Rr,Fr,en(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=Ur(e,a),u=Math.exp(-o);return Nr-i/s*u},i=e=>{const r=e*a*t,i=r*n+n,s=Math.pow(a,2)*Math.pow(e,2)*t,u=Math.exp(-r),c=Ur(Math.pow(e,2),a);return(-o(e)+Nr>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-Nr,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<$r;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=tn(t),isNaN(s))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(s,2)*r;return{stiffness:e,damping:2*a*Math.sqrt(r*e),duration:t}}}const $r=12;function Ur(t,e){return t*Math.sqrt(1-e*e)}const Hr=["duration","bounce"],Gr=["stiffness","damping","mass"];function zr(t,e){return e.some((e=>void 0!==t[e]))}function Wr({keyframes:t,restDelta:e,restSpeed:n,...r}){const o=t[0],i=t[t.length-1],a={done:!1,value:o},{stiffness:s,damping:u,mass:c,duration:l,velocity:f,isResolvedFromDuration:d}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!zr(t,Gr)&&zr(t,Hr)){const n=Br(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-en(r.velocity||0)}),p=f||0,h=u/(2*Math.sqrt(s*c)),y=i-o,v=en(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),h<1){const t=Ur(v,h);g=e=>{const n=Math.exp(-h*v*e);return i-n*((p+h*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===h)g=t=>i-Math.exp(-v*t)*(y+(p+v*y)*t);else{const t=v*Math.sqrt(h*h-1);g=e=>{const n=Math.exp(-h*v*e),r=Math.min(t*e,300);return i-n*((p+h*v*y)*Math.sinh(r)+t*y*Math.cosh(r))/t}}return{calculatedDuration:d&&l||null,next:t=>{const r=g(t);if(d)a.done=t>=l;else{let o=0;h<1&&(o=0===t?tn(p):Lr(g,t,r));const s=Math.abs(o)<=n,u=Math.abs(i-r)<=e;a.done=s&&u}return a.value=a.done?i:r,a}}}function qr({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:u,restDelta:c=.5,restSpeed:l}){const f=t[0],d={done:!1,value:f},p=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let h=n*e;const y=f+h,v=void 0===a?y:a(y);v!==y&&(h=v-f);const m=t=>-h*Math.exp(-t/r),g=t=>v+m(t),b=t=>{const e=m(t),n=g(t);d.done=Math.abs(e)<=c,d.value=d.done?v:n};let w,_;const S=t=>{var e;(e=d.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,_=Wr({keyframes:[d.value,p(d.value)],velocity:Lr(g,t,d.value),damping:o,stiffness:i,restDelta:c,restSpeed:l}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return _||void 0!==w||(e=!0,b(t),S(t)),void 0!==w&&t>=w?_.next(t-w):(!e&&b(t),d)}}}const Yr=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Xr=1e-7,Kr=12;function Zr(t,e,n,r){if(t===e&&n===r)return Re;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Yr(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>Xr&&++s<Kr);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Yr(o(t),e,r)}const Qr=Zr(.42,0,1,1),Jr=Zr(0,0,.58,1),to=Zr(.42,0,.58,1),eo=t=>Array.isArray(t)&&"number"!=typeof t[0],no=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,ro=t=>e=>1-t(1-e),oo=t=>1-Math.sin(Math.acos(t)),io=ro(oo),ao=no(oo),so=Zr(.33,1.53,.69,.99),uo=ro(so),co={linear:Re,easeIn:Qr,easeInOut:to,easeOut:Jr,circIn:oo,circInOut:ao,circOut:io,backIn:uo,backInOut:no(uo),backOut:so,anticipate:t=>(t*=2)<1?.5*uo(t):.5*(2-Math.pow(2,-10*(t-1)))},lo=t=>{if(Array.isArray(t)){Ve(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return Zr(e,n,r,o)}return"string"==typeof t?(Ve(void 0!==co[t],`Invalid easing type '${t}'`),co[t]):t},fo=(t,e)=>n=>e(t(n)),po=(...t)=>t.reduce(fo),ho=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},yo=(t,e,n)=>t+(e-t)*n;function vo(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function mo(t,e){return n=>n>0?e:t}const go=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},bo=[nr,er,rr];function wo(t){const e=(n=t,bo.find((t=>t.test(n))));var n;if(Fe(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let r=e.parse(t);return e===rr&&(r=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,i=0,a=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,s=2*n-r;o=vo(s,r,t+1/3),i=vo(s,r,t),a=vo(s,r,t-1/3)}else o=i=a=n;return{red:Math.round(255*o),green:Math.round(255*i),blue:Math.round(255*a),alpha:r}}(r)),r}const _o=(t,e)=>{const n=wo(t),r=wo(e);if(!n||!r)return mo(t,e);const o={...n};return t=>(o.red=go(n.red,r.red,t),o.green=go(n.green,r.green,t),o.blue=go(n.blue,r.blue,t),o.alpha=yo(n.alpha,r.alpha,t),er.transform(o))},So=new Set(["none","hidden"]);function ko(t,e){return n=>yo(t,e,n)}function xo(t){return"number"==typeof t?ko:"string"==typeof t?vn(t)?mo:or.test(t)?_o:Eo:Array.isArray(t)?Ao:"object"==typeof t?or.test(t)?_o:To:mo}function Ao(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>xo(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function To(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=xo(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const Eo=(t,e)=>{const n=yr.createTransformer(e),r=fr(t),o=fr(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?So.has(t)&&!o.values.length||So.has(e)&&!r.values.length?function(t,e){return So.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):po(Ao(function(t,e){var n;const r=[],o={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],s=t.indexes[a][o[a]],u=null!==(n=t.values[s])&&void 0!==n?n:0;r[i]=u,o[a]++}return r}(r,o),o.values),n):(Fe(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),mo(t,e))};function Oo(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return yo(t,e,n);return xo(t)(t,e)}function Po(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(Ve(i===e.length,"Both input and output ranges must be the same length"),1===i)return()=>e[0];if(2===i&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const r=[],o=n||Oo,i=t.length-1;for(let n=0;n<i;n++){let i=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||Re:e;i=po(t,i)}r.push(i)}return r}(e,r,o),s=a.length,u=e=>{let n=0;if(s>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=ho(t[n],t[n+1],e);return a[n](r)};return n?e=>u(wn(t[0],t[i-1],e)):u}function jo(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=ho(0,e,r);t.push(yo(n,1,o))}}function Co(t){const e=[0];return jo(e,t.length-1),e}function Io({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=eo(r)?r.map(lo):lo(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Co(e),t),s=Po(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||to)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const Mo=2e4;function Lo(t){let e=0;let n=t.next(e);for(;!n.done&&e<Mo;)e+=50,n=t.next(e);return e>=Mo?1/0:e}const No=t=>{const e=({timestamp:e})=>t(e);return{start:()=>ze.update(e,!0),stop:()=>We(e),now:()=>qe.isProcessing?qe.timestamp:Pr.now()}},Ro={decay:qr,inertia:qr,tween:Io,keyframes:Io,spring:Wr},Fo=t=>t/100;class Vo extends Cr{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:r,keyframes:o}=this.options,i=(null==r?void 0:r.KeyframeResolver)||Zn;this.resolver=new i(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:o,velocity:i=0}=this.options,a=Ro[e]||Io;let s,u;a!==Io&&"number"!=typeof t[0]&&(s=po(Fo,Oo(t[0],t[1])),t=[0,100]);const c=a({...this.options,keyframes:t});"mirror"===o&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-i})),null===c.calculatedDuration&&(c.calculatedDuration=Lo(c));const{calculatedDuration:l}=c,f=l+r;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:s,calculatedDuration:l,resolvedDuration:f,totalDuration:f*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:o,mirroredGenerator:i,mapPercentToKeyframes:a,keyframes:s,calculatedDuration:u,totalDuration:c,resolvedDuration:l}=n;if(null===this.startTime)return o.next(0);const{delay:f,repeat:d,repeatType:p,repeatDelay:h,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-f*(this.speed>=0?1:-1),m=this.speed>=0?v<0:v>c;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let g=this.currentTime,b=o;if(d){const t=Math.min(this.currentTime,c)/l;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===p?(n=1-n,h&&(n-=h/l)):"mirror"===p&&(b=i)),g=wn(0,1,n)*l}const w=m?{done:!1,value:s[0]}:b.next(g);a&&(w.value=a(w.value));let{done:_}=w;m||null===u||(_=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&_);return S&&void 0!==r&&(w.value=ln(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?en(t.calculatedDuration):0}get time(){return en(this.currentTime)}set time(t){t=tn(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=en(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=No,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const Do=new Set(["opacity","clipPath","filter","transform"]),Bo=t=>Array.isArray(t)&&"number"==typeof t[0];function $o(t){return Boolean(!t||"string"==typeof t&&t in Ho||Bo(t)||Array.isArray(t)&&t.every($o))}const Uo=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Ho={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Uo([0,.65,.55,1]),circOut:Uo([.55,0,1,.45]),backIn:Uo([.31,.01,.66,-.59]),backOut:Uo([.33,1.53,.69,.99])};function Go(t){return zo(t)||Ho.easeOut}function zo(t){return t?Bo(t)?Uo(t):Array.isArray(t)?t.map(Go):Ho[t]:void 0}const Wo=Xe((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class qo extends Cr{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new Tr(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:a,motionValue:s,name:u,startTime:c}=this.options;if(!(null===(n=s.owner)||void 0===n?void 0:n.current))return!1;if(function(t){return"spring"===t.type||!$o(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new Vo({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const o=[];let i=0;for(;!r.done&&i<2e4;)r=n.sample(i),o.push(r.value),i+=10;return{times:void 0,keyframes:o,duration:i-10,ease:"linear"}}(t,c);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,o=l.times,i=l.ease,a="keyframes"}const l=function(t,e,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:a="loop",ease:s,times:u}={}){const c={[e]:n};u&&(c.offset=u);const l=zo(s);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(l.timeline=this.pendingTimeline,this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(ln(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:l,duration:r,times:o,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return en(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return en(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=tn(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return Re;const{animation:n}=e;n.timeline=t,n.onfinish=null}else this.pendingTimeline=t;return Re}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:r,type:o,ease:i,times:a}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:s,element:u,...c}=this.options,l=new Vo({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=tn(this.time);t.setWithVelocity(l.sample(f-10).value,l.sample(f).value,10)}const{onStop:s}=this.options;s&&s(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:i,type:a}=t;return Wo()&&n&&Do.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const Yo=(t,e,n,r={},o,i,a)=>s=>{const u=sn(r,t)||{},c=u.delay||r.delay||0;let{elapsed:l=0}=r;l-=tn(c);let f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-l,onUpdate:t=>{e.set(t),u.onUpdate&&u.onUpdate(t)},onComplete:()=>{s(),u.onComplete&&u.onComplete(),a&&a()},onStop:a,name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(u)||(f={...f,...an(t,f)}),f.duration&&(f.duration=tn(f.duration)),f.repeatDelay&&(f.repeatDelay=tn(f.repeatDelay)),void 0!==f.from&&(f.keyframes[0]=f.from);let d=!1;if((!1===f.type||0===f.duration&&!f.repeatDelay)&&(f.duration=0,0===f.delay&&(d=!0)),(un||$e)&&(d=!0,f.duration=0,f.delay=0),d&&!i&&void 0!==e.get()){const t=ln(f.keyframes,u);if(void 0!==t)return ze.update((()=>{f.onUpdate(t),f.onComplete()})),new Ze([])}return!i&&qo.supports(f)?new qo(f):new Vo(f)},Xo=t=>Array.isArray(t),Ko=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Zo=t=>Xo(t)?t[t.length-1]||0:t;function Qo(t,e){-1===t.indexOf(e)&&t.push(e)}function Jo(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class ti{constructor(){this.subscriptions=[]}add(t){return Qo(this.subscriptions,t),()=>Jo(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ei={current:void 0};class ni{constructor(t,e={}){this.version="11.5.4",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=Pr.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=Pr.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new ti);const n=this.events[t].add(e);return"change"===t?()=>{n(),ze.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return ei.current&&ei.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Pr.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Ir(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ri(t,e){return new ni(t,e)}function oi(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function ii(t,e,n,r){if("function"==typeof e){const[o,i]=oi(r);e=e(void 0!==n?n:t.custom,o,i)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[o,i]=oi(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function ai(t,e,n){const r=t.getProps();return ii(r,e,void 0!==n?n:r.custom,t)}function si(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,ri(n))}const ui=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ci="data-"+ui("framerAppearId");function li(t){return t.props[ci]}function fi(t){return Je.has(t)?"transform":Do.has(t)?ui(t):void 0}class di extends ni{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(t){const e=fi(t);if(!e)return;const n=this.counts.get(e)||0;this.counts.set(e,n+1),0===n&&(this.output.push(e),this.update());let r=!1;return()=>{if(r)return;r=!0;const t=this.counts.get(e)-1;this.counts.set(e,t),0===t&&(Jo(this.output,e),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}const pi=t=>Boolean(t&&t.getVelocity);function hi(t,e){var n;if(!t.applyWillChange)return;let r=t.getValue("willChange");return r||(null===(n=t.props.style)||void 0===n?void 0:n.willChange)||(r=new di("auto"),t.addValue("willChange",r)),o=r,Boolean(pi(o)&&o.add)?r.add(e):void 0;var o}function yi({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function vi(t,e,{delay:n=0,transitionOverride:r,type:o}={}){var i;let{transition:a=t.getDefaultTransition(),transitionEnd:s,...u}=e;r&&(a=r);const c=[],l=o&&t.animationState&&t.animationState.getState()[o];for(const e in u){const r=t.getValue(e,null!==(i=t.latestValues[e])&&void 0!==i?i:null),o=u[e];if(void 0===o||l&&yi(l,e))continue;const s={delay:n,...sn(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=li(t);if(n){const t=window.MotionHandoffAnimation(n,e,ze);null!==t&&(s.startTime=t,f=!0)}}r.start(Yo(e,r,o,t.shouldReduceMotion&&Je.has(e)?{type:!1}:s,t,f,hi(t,e)));const d=r.animation;d&&c.push(d)}return s&&Promise.all(c).then((()=>{ze.update((()=>{s&&function(t,e){const n=ai(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)si(t,e,Zo(i[e]))}(t,s)}))})),c}const mi={};function gi(t,{layout:e,layoutId:n}){return Je.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!mi[t]||"opacity"===t)}function bi(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(pi(o[a])||e.style&&pi(e.style[a])||gi(a,t)||void 0!==(null===(r=null==n?void 0:n.getValue(a))||void 0===r?void 0:r.liveStyle))&&(i[a]=o[a]);return n&&o&&"string"==typeof o.willChange&&(n.applyWillChange=!1),i}function wi(t,e,n){const r=bi(t,e,n);for(const n in t)if(pi(t[n])||pi(e[n])){r[-1!==Qe.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const _i="undefined"!=typeof window,Si={current:null},ki={current:!1};function xi(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function Ai(t){return"string"==typeof t||Array.isArray(t)}const Ti=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ei=["initial",...Ti];function Oi(t){return xi(t.animate)||Ei.some((e=>Ai(t[e])))}function Pi(t){return Boolean(Oi(t)||t.variants)}const ji={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ci={};for(const t in ji)Ci[t]={isEnabled:e=>ji[t].some((t=>!!e[t]))};const Ii=[...Gn,or,yr],Mi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Li=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Ni=Ei.length;class Ri{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:o,visualState:i},a={}){this.applyWillChange=!1,this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Zn,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,ze.render(this.render,!1,!0))};const{latestValues:s,renderState:u}=i;this.latestValues=s,this.baseTarget={...s},this.initialValues=e.initial?{...s}:{},this.renderState=u,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=Oi(e),this.isVariantNode=Pi(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:c,...l}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in l){const e=l[t];void 0!==s[t]&&pi(e)&&e.set(s[t],!1)}}mount(t){this.current=t,Be.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),ki.current||function(){if(ki.current=!0,_i)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Si.current=t.matches;t.addListener(e),e()}else Si.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Si.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Be.delete(this.current),this.projection&&this.projection.unmount(),We(this.notifyUpdate),We(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=Je.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&ze.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),o=e.on("renderRequest",this.scheduleRender);let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),o(),i&&i(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in Ci){const e=Ci[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<Li.length;e++){const n=Li[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){for(const r in e){const o=e[r],i=n[r];if(pi(o))t.addValue(r,o);else if(pi(i))t.addValue(r,ri(o,{owner:t}));else if(i!==o)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(o):e.hasAnimated||e.set(o)}else{const e=t.getStaticValue(r);t.addValue(r,ri(void 0!==e?e:o,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const e={};for(let t=0;t<Ni;t++){const n=Ei[t],r=this.props[n];(Ai(r)||!1===r)&&(e[n]=r)}return e}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=ri(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let r=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var o;return null!=r&&("string"==typeof r&&(dn(r)||fn(r))?r=parseFloat(r):(o=r,!Ii.find(Hn(o))&&yr.test(e)&&(r=xr(t,e))),this.setBaseTarget(t,pi(r)?r.get():r)),pi(r)?r.get():r}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const o=ii(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);o&&(r=o[t])}if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,t);return void 0===o||pi(o)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:o}on(t,e){return this.events[t]||(this.events[t]=new ti),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Fi extends Ri{constructor(){super(...arguments),this.KeyframeResolver=Tr}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}}const Vi=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Di={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Bi=Qe.length;function $i(t,e,n){const{style:r,vars:o,transformOrigin:i}=t;let a=!1,s=!1;for(const t in e){const n=e[t];if(Je.has(t))a=!0;else if(hn(t))o[t]=n;else{const e=Vi(n,_r[t]);t.startsWith("origin")?(s=!0,i[t]=e):r[t]=e}}if(e.transform||(a||n?r.transform=function(t,e,n){let r="",o=!0;for(let i=0;i<Bi;i++){const a=Qe[i],s=t[a];if(void 0===s)continue;let u=!0;if(u="number"==typeof s?s===(a.startsWith("scale")?1:0):0===parseFloat(s),!u||n){const t=Vi(s,_r[a]);u||(o=!1,r+=`${Di[a]||a}(${t}) `),n&&(e[a]=t)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),s){const{originX:t="50%",originY:e="50%",originZ:n=0}=i;r.transformOrigin=`${t} ${e} ${n}`}}function Ui(t,e,n){return"string"==typeof t?t:In.transform(e+n*t)}const Hi={offset:"stroke-dashoffset",array:"stroke-dasharray"},Gi={offset:"strokeDashoffset",array:"strokeDasharray"};function zi(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if($i(t,c,f),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:d,style:p,dimensions:h}=t;d.transform&&(h&&(p.transform=d.transform),delete d.transform),h&&(void 0!==o||void 0!==i||p.transform)&&(p.transformOrigin=function(t,e,n){return`${Ui(e,t.x,t.width)} ${Ui(n,t.y,t.height)}`}(h,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(d.x=e),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==a&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?Hi:Gi;t[i.offset]=In.transform(-r);const a=In.transform(e),s=In.transform(n);t[i.array]=`${a} ${s}`}(d,a,s,u,!1)}const Wi=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function qi(t,{style:e,vars:n},r,o){Object.assign(t.style,e,o&&o.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}function Yi(t,e,n,r){qi(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Wi.has(n)?n:ui(n),e.attrs[n])}const Xi=t=>"string"==typeof t&&"svg"===t.toLowerCase();class Ki extends Fi{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Mi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Je.has(e)){const t=kr(e);return t&&t.default||0}return e=Wi.has(e)?e:ui(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return wi(t,e,n)}build(t,e,n){zi(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Yi(t,e,0,r)}mount(t){this.isSVGTag=Xi(t.tagName),super.mount(t)}}function Zi(t,e){return function({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}class Qi extends Fi{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=qi}readValueFromInstance(t,e){if(Je.has(e)){const t=kr(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(hn(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Zi(t,e)}build(t,e,n){$i(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return bi(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;pi(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}function Ji(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=function(t){return t instanceof SVGElement&&"svg"!==t.tagName}(t)?new Ki(e):new Qi(e);n.mount(t),Be.set(t,n)}function ta(t,e,n){const r=pi(t)?t:ri(t);return r.start(Yo("",r,e,n)),r.animation}function ea(t,e=100){const n=Wr({keyframes:[0,e],...t}),r=Math.min(Lo(n),Mo);return{type:"keyframes",ease:t=>n.next(r*t).value/e,duration:en(r)}}function na(t,e,n,r){var o;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(o=r.get(e))&&void 0!==o?o:t}const ra=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t};function oa(t,e){return eo(t)?t[ra(0,t.length,e)]:t}function ia(t,e,n,r,o,i){!function(t,e,n){for(let r=0;r<t.length;r++){const o=t[r];o.at>e&&o.at<n&&(Jo(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:yo(o,i,r[a]),easing:oa(n,a)})}function aa(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const sa="easeInOut";function ua(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function ca(t,e){return e[t]||(e[t]=[]),e[t]}function la(t){return Array.isArray(t)?t:[t]}function fa(t,e){return t[e]?{...t,...t[e]}:{...t}}const da=t=>"number"==typeof t,pa=t=>t.every(da);function ha(t,e,n,r){const o=De(t,r),i=o.length;Ve(Boolean(i),"No valid element provided.");const a=[];for(let t=0;t<i;t++){const r=o[t];Be.has(r)||Ji(r);const s=Be.get(r),u={...n};"function"==typeof u.delay&&(u.delay=u.delay(t,i)),a.push(...vi(s,{...e,transition:u},{}))}return new Ze(a)}function ya(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r){const o=e.duration||.3,i=new Map,a=new Map,s={},u=new Map;let c=0,l=0,f=0;for(let n=0;n<t.length;n++){const i=t[n];if("string"==typeof i){u.set(i,l);continue}if(!Array.isArray(i)){u.set(i.name,na(l,i.at,c,u));continue}let[d,p,h={}]=i;void 0!==h.at&&(l=na(l,h.at,c,u));let y=0;const v=(t,n,r,i=0,a=0)=>{const s=la(t),{delay:u=0,times:c=Co(s),type:d="keyframes",...p}=n;let{ease:h=e.ease||"easeOut",duration:v}=n;const m="function"==typeof u?u(i,a):u,g=s.length;if(g<=2&&"spring"===d){let t=100;if(2===g&&pa(s)){const e=s[1]-s[0];t=Math.abs(e)}const e={...p};void 0!==v&&(e.duration=tn(v));const n=ea(e,t);h=n.ease,v=n.duration}null!=v||(v=o);const b=l+m,w=b+v;1===c.length&&0===c[0]&&(c[1]=1);const _=c.length-s.length;_>0&&jo(c,_),1===s.length&&s.unshift(null),ia(r,s,h,c,b,w),y=Math.max(m+v,y),f=Math.max(w,f)};if(pi(d))v(p,h,ca("default",ua(d,a)));else{const t=De(d,r,s),e=t.length;for(let n=0;n<e;n++){const r=ua(t[n],a);for(const t in p)v(p[t],fa(h,t),ca(t,r),n,e)}}c=l,l+=y}return a.forEach(((t,r)=>{for(const o in t){const a=t[o];a.sort(aa);const s=[],u=[],c=[];for(let t=0;t<a.length;t++){const{at:e,value:n,easing:r}=a[t];s.push(n),u.push(ho(0,f,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(sa)),1!==u[u.length-1]&&(u.push(1),s.push(null)),i.has(r)||i.set(r,{keyframes:{},transition:{}});const l=i.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:f,ease:c,times:u,...n}}})),i}(t,e,n);return o.forEach((({keyframes:t,transition:e},n)=>{let o;o=pi(n)?ta(n,t.default,e.default):ha(n,t,e),r.push(o)})),new Ze(r)}const va=function(t,e,n){let r;var o;return o=t,r=Array.isArray(o)&&Array.isArray(o[0])?ya(t,e,ma):function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?ha(t,e,n,ma):ta(t,e,n),ma&&ma.animations.push(r),r};var ma;function ga(t){return ga="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ga(t)}function ba(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ba=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==ga(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(ga(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function wa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Sa(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function _a(t){return function(t){if(Array.isArray(t))return ka(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Sa(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sa(t,e){if(t){if("string"==typeof t)return ka(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ka(t,e):void 0}}function ka(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function xa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ta(r.key),r)}}function Aa(t,e,n){return(e=Ta(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ta(t){var e=function(t,e){if("object"!=ga(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ga(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ga(e)?e:e+""}var Ea=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Oa=Aa(Aa(Aa({},xe.left,"25.33%"),xe.center,"50%"),xe.right,"75.66%"),Pa=function(){function t(e,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequences=[],this.control=null,this.transformers={},Array.isArray(e)){var r;(r=this.sequences).push.apply(r,_a(e)),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions,n||{})}else{var o=e,i=n||t.defaultOptions;this.sequences.push({props:o,options:i||{}}),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions)}}return function(t,e,n){return e&&xa(t.prototype,e),n&&xa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r,o){var i=e.scope,a=e.overwrites;return Ea(this,void 0,void 0,ba().mark((function e(){var s=this;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=p(r,{}),e.abrupt("return",new Promise((function(e){Ea(s,void 0,void 0,ba().mark((function s(){var u,c,l,f,d=this;return ba().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||(e(),o&&o(r)),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=wa(this.sequences),s.prev=4,f=ba().mark((function e(){var o,s,u,c,f,h;return ba().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=l.value,s=o.props,u=o.options,c=p({},d.propToCSS(n,r)),i.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=i.current,Object.assign(f.style,c),r=t.mergeState(r,s),h=va(f,d.propToCSS(n,r,a),d.optionsToFramerMotionOptions(u)||{}),d.setControl(h),!1===(null==u?void 0:u.sync)){e.next=16;break}return e.next=12,new Promise((function(t){return h.then((function(){return t()}))}));case 12:Object.assign(f.style,d.propToCSS(n,r,a)),d.setControl(null),e.next=17;break;case 16:h.then((function(){Object.assign(f.style,d.propToCSS(n,r,a)),d.setControl(null)}));case 17:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){s.next=11;break}return s.delegateYield(f(),"t0",9);case 9:s.next=7;break;case 11:s.next=16;break;case 13:s.prev=13,s.t1=s.catch(4),c.e(s.t1);case 16:return s.prev=16,c.f(),s.finish(16);case 19:u++,s.next=2;break;case 22:return s.next=24,b(2);case 24:this.setControl(null),this.sequenceOptions.sync&&(e(),o&&o(r));case 26:case"end":return s.stop()}}),s,this,[[4,13,16,19]])})))})));case 2:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return"scale"in n?{width:"".concat(100*n.scale,"%")}:{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}}},c={};for(var l in c.transform=this.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"propToCSSTransform",value:function(t,e){var n;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var r=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},o=r.invertY,i=r.invertX;return["translate(".concat(i?"":"-","50%, ").concat(o?"":"-","50%)"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)")].filter(Boolean).join(" ")}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],[{key:"isPosition",value:function(t){return Me.isCommonPositionType(t)||Le.isCoord2DPosition(t)||Ne.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return Ie.D2PositionToCSS(t.toCSS(),n,e)}},{key:"backgroundToCSS",value:function(t){return null==t?{}:Is.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:v(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?Ie.mergePosition(Ie.tryParsePosition(t),Ie.tryParsePosition(e)):Ie.toCoord2D(Ie.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},p(t,e)),{position:n})}}])}();function ja(t){return ja="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ja(t)}function Ca(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ia(r.key),r)}}function Ia(t){var e=function(t,e){if("object"!=ja(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ja(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ja(e)?e:e+""}function Ma(t,e,n){return e=Na(e),function(t,e){if(e&&("object"==ja(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,La()?Reflect.construct(e,n||[],Na(t).constructor):e.apply(t,n))}function La(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(La=function(){return!!t})()}function Na(t){return Na=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Na(t)}function Ra(t,e){return Ra=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ra(t,e)}Pa.defaultSequenceOptions={sync:!0,repeat:1},Pa.defaultOptions={duration:0,ease:"linear"},Pa.CommonImagePositionMap=Oa;var Fa=function(t){function e(t,n){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=Ma(this,e,[Ct.IdPrefixes.Image])).events=new m,r.ref=void 0,"string"==typeof t?(r.name=t,r.config=p(e.defaultConfig,n||{}),r.config.position&&(r.config.position=Ie.tryParsePosition(r.config.position))):(r.name="",r.config=p(e.defaultConfig,t),r.config.position&&(r.config.position=Ie.tryParsePosition(r.config.position))),r.state=p({},r.config),r.checkConfig(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ra(t,e)}(e,t),function(t,e,n){return e&&Ca(t.prototype,e),n&&Ca(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this.chain(this._init())}},{key:"checkConfig",value:function(){if(!this.config.src)throw new Error("Image src is required");if(!Pa.isPosition(this.config.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");return this}},{key:"setSrc",value:function(t,e){var n=this.chain();if(e){var r=e.copy();r.setSrc(Is.srcToString(t)),n._transitionSrc(r)}var o=new ys(this,ys.ActionTypes.setSrc,new ke(ue.getIdManager().getStringId()).setContent(["string"==typeof t?t:Is.staticImageDataToSrc(t)]));return n.chain(o)}},{key:"applyTransform",value:function(t){var e=new ys(this,ys.ActionTypes.applyTransform,new ke(ue.getIdManager().getStringId()).setContent([void 0,t,g()]));return this.chain(e)}},{key:"show",value:function(t){var e=t instanceof Pa?t:new Pa([{props:{opacity:1},options:t||{}}]),n=new ys(this,ys.ActionTypes.show,new ke(ue.getIdManager().getStringId()).setContent([void 0,e]));return this.chain(n)}},{key:"hide",value:function(t){var e=new ys(this,ys.ActionTypes.hide,new ke(ue.getIdManager().getStringId()).setContent([void 0,t instanceof Pa?t:new Pa([{props:{opacity:0},options:t||{}}])]));return this.chain(e)}},{key:"toTransform",value:function(){return new Pa(this.state,{duration:0})}},{key:"setScope",value:function(t){return this.ref=t,this}},{key:"getScope",value:function(){return this.ref}},{key:"copy",value:function(){return new e(this.name,this.config)}},{key:"toData",value:function(){return this.state.disposed||w(this.state,this.config)?null:{state:p({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=p(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_setTransition",value:function(t){return this.chain(new ys(this,ys.ActionTypes.setTransition,new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"_applyTransition",value:function(t){return this.chain(new ys(this,"image:applyTransition",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._setTransition(e)._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new ys(this,ys.ActionTypes.dispose,new ke(ue.getIdManager().getStringId())))}},{key:"_init",value:function(t){return new ys(this,ys.ActionTypes.init,new ke(ue.getIdManager().getStringId()).setContent([t]))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return Ie.serializePosition(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}},{key:"deserializeImageState",value:function(t){var e={position:function(t){return Ie.toCoord2D(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}}])}(Ct);function Va(t){return Va="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Va(t)}function Da(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ba(r.key),r)}}function Ba(t){var e=function(t,e){if("object"!=Va(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Va(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Va(e)?e:e+""}Fa.EventTypes={"event:image.show":"event:image.show","event:image.hide":"event:image.hide","event:image.init":"event:image.init","event:image.applyTransform":"event:image.applyTransform","event:image.mount":"event:image.mount","event:image.unmount":"event:image.unmount","event:image.ready":"event:image.ready","event:image.elementLoaded":"event:image.elementLoaded","event:image.setTransition":"event:image.setTransition"},Fa.defaultConfig={src:"",display:!1,position:new Me(_e.Center),scale:1,rotation:0,opacity:0},Fa.ImagePosition=xe;var $a=function(){return function(t,e,n){return e&&Da(t.prototype,e),n&&Da(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.callee=e,this.type=n,this.contentNode=r,this.__stack=g(),this._id=ue.getIdManager().prefix("action",ue.getIdManager().getStringId(),"-")}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode}}},{key:"getId",value:function(){return this._id}},{key:"getFutureActions",value:function(){var t=this.contentNode.child;return t&&t.action?[t.action]:[]}}])}();$a.ActionTypes={action:"action"};var Ua={say:"character:say",action:"character:action"},Ha={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",setTransition:"scene:setTransition",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform"},Ga={action:"image:action",setSrc:"image:setSrc",setPosition:"image:setPosition",show:"image:show",hide:"image:hide",applyTransform:"image:applyTransform",init:"image:init",dispose:"image:dispose",setTransition:"image:setTransition",applyTransition:"image:applyTransition"},za={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},Wa={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat"};function qa(t){return qa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qa(t)}function Ya(t){return function(t){if(Array.isArray(t))return Qa(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Za(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xa(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Xa=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==qa(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(qa(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Ka(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||Za(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Za(t,e){if(t){if("string"==typeof t)return Qa(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qa(t,e):void 0}}function Qa(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ja(t,e,n,r){var o=ts(ss(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ts(){return ts="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ss(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},ts.apply(null,arguments)}function es(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ns(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,os(r.key),r)}}function rs(t,e,n){return e&&ns(t.prototype,e),n&&ns(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function os(t){var e=function(t,e){if("object"!=qa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=qa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qa(e)?e:e+""}function is(t,e,n){return e=ss(e),function(t,e){if(e&&("object"==qa(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,as()?Reflect.construct(e,n||[],ss(t).constructor):e.apply(t,n))}function as(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(as=function(){return!!t})()}function ss(t){return ss=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ss(t)}function us(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cs(t,e)}function cs(t,e){return cs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cs(t,e)}var ls=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},fs=function(t){function e(t,n,r){var o;return es(this,e),(o=is(this,e,[t,n,r])).callee=t,o.contentNode.action=o,o}return us(e,t),rs(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}}])}($a),ds=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Ua.say){var r=new h((function(t){return t})).registerSkipController(new S((function(){return{type:n.type,node:n.contentNode.getChild()}}))),o=this.contentNode.getContent();return t.createText(this.contentNode.id,o,(function(){r.resolve({type:n.type,node:n.contentNode.getChild()})})),r}return Ja(e,"executeAction",this,3)([t])}}])}(fs);ds.ActionTypes=Ua;var ps=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var n,r=this;if(this.type===Ha.action)return Ja(e,"executeAction",this,3)([t]);if(this.type===Ha.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],Ja(e,"executeAction",this,3)([t]);if(this.type===Ha.sleep){var o=new h((function(t){return t})),i=this.contentNode.getContent();return new Promise((function(t){"number"==typeof i?setTimeout((function(){t()}),i):h.isAwaitable(i)?i.then(t):null==i||i.then(t)})).then((function(){o.resolve({type:r.type,node:r.contentNode.child}),t.stage.next()})),o}if(this.type===Ha.applyTransition){var a=(new h).registerSkipController(new S((function(){return t.logger.info("NarraLeaf-React: Background Transition","Skipped"),{type:r.type,node:r.contentNode.getChild()}}))),s=this.contentNode.getContent()[0];return this.callee.events.any("event:scene.applyTransition",s).then((function(){a.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),a}if(this.type===Ha.init){if(this.callee._liveState.active)return Ja(e,"executeAction",this,3)([t]);this.callee._liveState.active=!0;var u=new h((function(t){return t}));return t.registerSrcManager(this.callee.srcManager).addScene(this.callee),this.callee.events.once("event:scene.unmount",(function(){t.offSrcManager(r.callee.srcManager)})),this.callee.events.once("event:scene.mount",(function(){r.callee.state.backgroundMusic&&(bs.initSound(t,r.callee.state.backgroundMusic),r.callee.events.emit("event:scene.setBackgroundMusic",r.callee.state.backgroundMusic,r.callee.config.backgroundMusicFade))})),this.callee.events.once("event:scene.imageLoaded",(function(){var e=r.callee._initTransform();r.callee.events.any("event:scene.initTransform",e).then((function(){u.resolve({type:r.type,node:r.contentNode.child}),t.stage.next()}))})),u}if(this.type===Ha.exit){this.callee._liveState.active=!1,t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var c=new h((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){c.resolve({type:r.type,node:r.contentNode.child}),t.stage.next()})),c}if(this.type===Ha.jumpTo){var l=this.contentNode.getContent()[0],f=this.contentNode,d=(null===(n=l.sceneRoot)||void 0===n?void 0:n.contentNode)||null;return d&&f.addChild(d),Ja(e,"executeAction",this,3)([t])}if(this.type===Ha.setBackgroundMusic){var p=Ka(this.contentNode.getContent(),2),y=p[0],v=p[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),Ja(e,"executeAction",this,3)([t])}if(this.type===Ha.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),Ja(e,"executeAction",this,3)([t]);if(this.type===Ha.applyTransform){var m=Ka(this.contentNode.getContent(),1)[0],g=new h((function(t){return t})).registerSkipController(new S((function(){return{type:r.type,node:r.contentNode.getChild()}})));return this.callee.events.any("event:scene.applyTransform",m).then((function(){g.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,e,n;if(this.type===Ha.jumpTo){var r=null===(e=null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.sceneRoot)||void 0===e?void 0:e.contentNode;return(null==r?void 0:r.action)?[r.action]:[]}var o=null===(n=this.contentNode.child)||void 0===n?void 0:n.action;return o?[o]:[]}}])}(fs);ps.ActionTypes=Ha;var hs=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e)}(fs);hs.ActionTypes={action:"story:action"};var ys=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Ga.init){var r=t.findElementByImage(this.callee);r&&t.disposeImage(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createImage(this.callee,o);var i=new h((function(t){return t}));return this.callee.events.once("event:image.mount",(function(){return ls(n,void 0,void 0,Xa().mark((function e(){var n;return Xa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=this.callee.getScope())||void 0===n?void 0:n.current){e.next=3;break}return e.next=3,this.callee.events.any(Fa.EventTypes["event:image.elementLoaded"]);case 3:return e.next=5,this.callee.events.any("event:image.init");case 5:i.resolve({type:this.type,node:this.contentNode.child}),t.stage.next();case 7:case"end":return e.stop()}}),e,this)})))})),i}if(this.type===Ga.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.stage.forceUpdate(),Ja(e,"executeAction",this,3)([t]);if([Ga.show,Ga.hide,Ga.applyTransform].includes(this.type)){var a=new h((function(t){return t})).registerSkipController(new S((function(){return n.type===Ga.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}}))),s=this.contentNode.getContent()[1];return this.type===Ga.show&&(this.callee.state.display=!0,t.stage.forceUpdate()),t.animateImage(Fa.EventTypes["event:image.applyTransform"],this.callee,[s],(function(){var t;n.type===Ga.hide&&(n.callee.state.display=!1),a.resolve({type:n.type,node:(null===(t=n.contentNode)||void 0===t?void 0:t.child)||null})})),a}if(this.type===Ga.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),Ja(e,"executeAction",this,3)([t]);if(this.type===Ga.setTransition)return this.callee.events.emit("event:image.setTransition",this.contentNode.getContent()[0]),Ja(e,"executeAction",this,3)([t]);if(this.type===Ga.applyTransition){var u=new h((function(t){return t})).registerSkipController(new S((function(){return n.type===Ga.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}})));return this.contentNode.getContent()[0].start((function(){u.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),u}throw Ja(e,"unknownType",this,3)([])}}])}(fs);ys.ActionTypes=Ga;var vs=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var e,n,r=this.callee.evaluate(this.contentNode.getContent(),{gameState:t});return null===(e=null==r?void 0:r[r.length-1])||void 0===e||e.contentNode.addChild(this.contentNode.getChild()),this.contentNode.addChild((null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.contentNode)||null),{type:this.type,node:this.contentNode}}},{key:"getFutureActions",value:function(){return[].concat(Ya(this.callee._getFutureActions()),Ya(Ja(e,"getFutureActions",this,3)([])))}}])}(fs);vs.ActionTypes={action:"condition:action"};var ms=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),{type:this.type,node:this.contentNode}}}])}(fs);ms.ActionTypes={action:"script:action"};var gs=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var e=this,n=new h((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent();return[].concat(Ya(this.callee._getFutureActions(t.choices)),Ya(Ja(e,"getFutureActions",this,3)([])))}}])}(fs);gs.ActionTypes={action:"menu:action"};var bs=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===za.play){if(e.initSound(t,this.callee),!this.callee.$getHowl())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var r=new h((function(t){return t})),o=t.playSound(this.callee.$getHowl(),(function(){var t;n.callee.$stop(),r.resolve({type:n.type,node:(null===(t=n.contentNode)||void 0===t?void 0:t.child)||null})}));return this.callee.$setToken(o),r}var i=t.playSound(this.callee.$getHowl(),(function(){n.callee.$stop()}));return this.callee.$setToken(i),Ja(e,"executeAction",this,3)([t])}if(this.type===za.stop)return this.callee.$getHowl()&&(this.callee.$getHowl().stop(),this.callee.$stop()),Ja(e,"executeAction",this,3)([t]);if(this.type===za.fade){var a=Ka(this.contentNode.getContent(),1)[0],s=a.start,u=a.end,c=a.duration;if(this.callee.$getHowl()){var l=void 0===s?this.callee.$getHowl().volume():s;this.callee.$getHowl().fade(l,u,c,this.callee.$getToken())}return Ja(e,"executeAction",this,3)([t])}if(this.type===za.setVolume){var f=Ka(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().volume(f,this.callee.$getToken()),Ja(e,"executeAction",this,3)([t])}if(this.type===za.setRate){var d=Ka(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().rate(d,this.callee.$getToken()),Ja(e,"executeAction",this,3)([t])}if(this.type===za.pause)return this.callee.$getHowl()&&this.callee.$getHowl().pause(this.callee.$getToken()),Ja(e,"executeAction",this,3)([t]);if(this.type===za.resume)return this.callee.$getHowl()&&this.callee.$getHowl().play(this.callee.$getToken()),Ja(e,"executeAction",this,3)([t]);throw Ja(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.$getHowl()||e.$setHowl(new(t.getHowl())(e.getHowlOptions()))}}])}(fs);bs.ActionTypes=za;var ws=function(t){function e(){return es(this,e),is(this,e,arguments)}return us(e,t),rs(e,[{key:"executeAllActions",value:function(t,e){return ls(this,void 0,void 0,Xa().mark((function n(){var r,o,i;return Xa().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=Xa().mark((function e(){var n,r,i;return Xa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o)){e.next=3;break}return e.abrupt("return",0);case 3:if(!h.isAwaitable(n)){e.next=15;break}return e.next=6,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 6:if(r=e.sent,i=r.node){e.next=12;break}return e.abrupt("return",0);case 12:o=i.action;case 13:e.next=16;break;case 15:o=n;case 16:case"end":return e.stop()}}),e)}));case 3:if(r||!o){n.next=10;break}return n.delegateYield(i(),"t0",5);case 5:if(0!==n.t0){n.next=8;break}return n.abrupt("break",10);case 8:n.next=3;break;case 10:case"end":return n.stop()}}),n)})))}},{key:"executeSingleAction",value:function(t,e){return ls(this,void 0,void 0,Xa().mark((function n(){var r,o,i;return Xa().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!h.isAwaitable(r)){n.next=9;break}return n.next=4,new Promise((function(t){r.then((function(e){return t(r.result)}))}));case 4:return o=n.sent,i=o.node,n.abrupt("return",i);case 9:return n.abrupt("return",r);case 10:case"end":return n.stop()}}),n)})))}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.child})})),n):Ja(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n,r,o=this,i=Ka(this.contentNode.getContent(),1)[0];if(this.type===Wa.do){var a=null===(n=i[0])||void 0===n?void 0:n.contentNode,s=null===(r=i[i.length-1])||void 0===r?void 0:r.contentNode,u=this.contentNode.getChild();return null==s||s.addChild(u),this.contentNode.addChild(a||null),Ja(e,"executeAction",this,3)([t])}if(this.type===Wa.doAsync)return ls(o,void 0,void 0,Xa().mark((function e(){return Xa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),Ja(e,"executeAction",this,3)([t]);if(this.type===Wa.any){var c=new h((function(t){return t})),l=i.map((function(e){return o.executeSingleAction(t,e)}));return Promise.any(l).then((function(){c.resolve({type:o.type,node:o.contentNode.getChild()})})),c}if(this.type===Wa.all){var f=new h((function(t){return t}));return this.execute(t,f,i)}if(this.type===Wa.allAsync)return ls(o,void 0,void 0,Xa().mark((function e(){return Xa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),Ja(e,"executeAction",this,3)([t]);if(this.type===Wa.repeat){var d=Ka(this.contentNode.getContent(),2),p=d[0],y=d[1];return ls(o,void 0,void 0,Xa().mark((function e(){var n;return Xa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<y)){e.next=8;break}if(!(p.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,p[0]);case 5:n++,e.next=1;break;case 8:case"end":return e.stop()}}),e,this)}))),Ja(e,"executeAction",this,3)([t])}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=Ja(e,"getFutureActions",this,3)([]);return[].concat(Ya(t),Ya(n))}}])}(fs);function _s(t){return _s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_s(t)}function Ss(t,e,n){return e=Es(e),function(t,e){if(e&&("object"==_s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,As()?Reflect.construct(e,n||[],Es(t).constructor):e.apply(t,n))}function ks(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ts(t,e)}function xs(t){var e="function"==typeof Map?new Map:void 0;return xs=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(As())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&Ts(o,n.prototype),o}(t,arguments,Es(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Ts(n,t)},xs(t)}function As(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(As=function(){return!!t})()}function Ts(t,e){return Ts=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ts(t,e)}function Es(t){return Es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Es(t)}function Os(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ps(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Cs(r.key),r)}}function js(t,e,n){return e&&Ps(t.prototype,e),n&&Ps(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Cs(t){var e=function(t,e){if("object"!=_s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_s(e)?e:e+""}ws.ActionTypes=Wa;var Is=function(){function t(){Os(this,t)}return js(t,null,[{key:"srcToString",value:function(t){return"string"==typeof t?t:t.src}},{key:"staticImageDataToSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"isStaticImageData",value:function(t){return void 0!==(null==t?void 0:t.src)}},{key:"backgroundToSrc",value:function(e){return t.isStaticImageData(e)?e.src:(null==e?void 0:e.url)||null}},{key:"isExternalSrc",value:function(t){return t.startsWith("http://")||t.startsWith("https://")}}])}(),Ms=function(t){function e(t){return Os(this,e),Ss(this,e,[t,{},"StaticScriptWarning"])}return ks(e,t),js(e,null,[{key:"isWarning",value:function(t){return t instanceof e}}])}(function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UseError";return Os(this,e),(r=Ss(this,e,[t])).props=n,r.name=o,r}return ks(e,t),js(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(xs(Error))),Ls=function(){return js((function t(e){Os(this,t),this.scene=e}),[{key:"run",value:function(){var t=new Map,e=[],n=new Set;if(!this.scene.getAllActions().length)return null;for(e.push(this.scene.getAllActions()[0]);e.length;){var r=e.shift();this.checkAction(r,t,n);var o=r.contentNode.child;o&&o.action&&e.push(o.action)}return t}},{key:"checkAction",value:function(t,e,n){if(t instanceof ys)e.has(t.callee)||e.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(e.get(t.callee),t);else if(t instanceof ps&&t.type===Ha.jumpTo){var r=t.contentNode.getContent()[0];if(n.has(r))return;n.add(r)}}},{key:"checkImage",value:function(t,e){if(e.type===Ga.dispose){if(t.isDisposed){var n="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Ms(n)}t.isDisposed=!0}else if([Ga.init,Ga.show,Ga.hide,Ga.applyTransform,Ga.applyTransition].includes(e.type)){if(t.isDisposed){var r="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Ms(r)}}else if(e.type===Ga.setSrc){var o=e.contentNode.getContent()[0];Is.isExternalSrc(o)&&(t.usedExternalSrc=!0)}}}])}();function Ns(t){return Ns="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ns(t)}function Rs(t){return function(t){if(Array.isArray(t))return Vs(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Fs(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fs(t,e){if(t){if("string"==typeof t)return Vs(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vs(t,e):void 0}}function Vs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ds(t,e,n){return e=$s(e),function(t,e){if(e&&("object"==Ns(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Bs()?Reflect.construct(e,n||[],$s(t).constructor):e.apply(t,n))}function Bs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Bs=function(){return!!t})()}function $s(t){return $s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$s(t)}function Us(t,e){return Us=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Us(t,e)}function Hs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ws(r.key),r)}}function zs(t,e,n){return e&&Gs(t.prototype,e),n&&Gs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ws(t){var e=function(t,e){if("object"!=Ns(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ns(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ns(e)?e:e+""}var qs=function(){return zs((function t(e){Hs(this,t),this.handler=e}),[{key:"evaluate",value:function(t){var e=t.gameState;return{value:this.handler(this.getCtx({gameState:e}))}}},{key:"getCtx",value:function(t){return{gameState:t.gameState}}}])}(),Ys=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Hs(this,e),(t=Ds(this,e,[Ct.IdPrefixes.Condition])).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=p(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Us(t,e)}(e,t),zs(e,[{key:"If",value:function(t,e){return this.conditions.If.condition=t instanceof qs?t:new qs(t),this.conditions.If.action=this.construct(Array.isArray(e)?e:[e]),this.chain()}},{key:"ElseIf",value:function(t,e){return this.conditions.ElseIf.push({condition:t instanceof qs?t:new qs(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){return this.conditions.Else.action=this.construct(Array.isArray(t)?t:[t]),this.chain()}},{key:"evaluate",value:function(t,e){var n,r,o={gameState:e.gameState},i=null===(n=t.If.condition)||void 0===n?void 0:n.evaluate(o);if(null==i?void 0:i.value)return t.If.action||null;var a,s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Fs(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(t.ElseIf);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=null===(r=u.condition)||void 0===r?void 0:r.evaluate(o);if(null==c?void 0:c.value)return u.action||null}}catch(t){s.e(t)}finally{s.f()}return t.Else.action||null}},{key:"fromChained",value:function(t){return[Reflect.construct(vs,[this,vs.ActionTypes.action,new ke(ue.getIdManager().getStringId()).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=St.toActions(t),i=0;i<o.length;i++){var a=o[i].contentNode,s=null===(r=o[i+1])||void 0===r?void 0:r.contentNode;s&&a.setInitChild(s),i===o.length-1&&e&&a.setInitChild(e),0===i&&n&&n.setInitChild(a)}return o}},{key:"_getFutureActions",value:function(){return[].concat(Rs(this.conditions.If.action||[]),Rs(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),Rs(this.conditions.Else.action||[]))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(Ct);function Xs(t){return Xs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xs(t)}function Ks(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Zs(r.key),r)}}function Zs(t){var e=function(t,e){if("object"!=Xs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Xs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xs(e)?e:e+""}function Qs(t,e,n){return e=tu(e),function(t,e){if(e&&("object"==Xs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Js()?Reflect.construct(e,n||[],tu(t).constructor):e.apply(t,n))}function Js(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Js=function(){return!!t})()}function tu(t){return tu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tu(t)}function eu(t,e){return eu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},eu(t,e)}Ys.defaultConfig={};var nu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Qs(this,e,[Ct.IdPrefixes.Control])}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&eu(t,e)}(e,t),function(t,e,n){return e&&Ks(t.prototype,e),n&&Ks(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(ws.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(ws.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(ws.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(ws.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(ws.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(ws.ActionTypes.repeat,e,t)}},{key:"construct",value:function(t){for(var e,n=0;n<t.length;n++){var r=t[n];0!==n&&(null===(e=t[n-1])||void 0===e||e.contentNode.setInitChild(r.contentNode))}return t}},{key:"push",value:function(t,e){for(var n=St.toActions(e),r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=new ws(this,t,new ke(ue.getIdManager().getStringId()).setContent([this.construct(n)].concat(o)));return this.chain(a)}}],[{key:"do",value:function(t){return(new e).do(t)}},{key:"doAsync",value:function(t){return(new e).doAsync(t)}},{key:"any",value:function(t){return(new e).any(t)}},{key:"all",value:function(t){return(new e).all(t)}},{key:"allAsync",value:function(t){return(new e).allAsync(t)}},{key:"repeat",value:function(t,n){return(new e).repeat(t,n)}}])}(Ct);function ru(t){return ru="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ru(t)}function ou(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,iu(r.key),r)}}function iu(t){var e=function(t,e){if("object"!=ru(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ru(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ru(e)?e:e+""}function au(t,e,n){return e=uu(e),function(t,e){if(e&&("object"==ru(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,su()?Reflect.construct(e,n||[],uu(t).constructor):e.apply(t,n))}function su(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(su=function(){return!!t})()}function uu(t){return uu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uu(t)}function cu(t,e){return cu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cu(t,e)}var lu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=au(this,e,[Ct.IdPrefixes.Menu])).choices=[],n.prompt=$t.isSentence(t)?t:new $t(null,t),n.config=p(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cu(t,e)}(e,t),function(t,e,n){return e&&ou(t.prototype,e),n&&ou(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return $t.isSentence(t)&&e||(Ht.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:$t.toSentence(t),action:St.toActions(e)}):"object"===ru(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:$t.toSentence(t.prompt),action:St.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new gs(this,gs.ActionTypes.action,new ke(ue.getIdManager().getStringId()).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"construct",value:function(t,e,n){for(var r,o=0;o<t.length;o++){var i=t[o].contentNode,a=null===(r=t[o+1])||void 0===r?void 0:r.contentNode;a&&i.setInitChild(a),o===this.choices.length-1&&e&&i.setInitChild(e),0===o&&n&&n.setInitChild(i)}return t}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action})).flat(2)}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.construct(e.action),prompt:e.prompt}}))}}])}(Ct);function fu(t){return fu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fu(t)}function du(t){return function(t){if(Array.isArray(t))return pu(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return pu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pu(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function hu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yu(r.key),r)}}function yu(t){var e=function(t,e){if("object"!=fu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fu(e)?e:e+""}function vu(t,e,n){return e=gu(e),function(t,e){if(e&&("object"==fu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,mu()?Reflect.construct(e,n||[],gu(t).constructor):e.apply(t,n))}function mu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(mu=function(){return!!t})()}function gu(t){return gu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gu(t)}function bu(t,e){return bu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bu(t,e)}lu.defaultConfig={},lu.targetAction=gs;var wu,_u=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=vu(this,e)).actions=[],t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&bu(t,e)}(e,t),function(t,e,n){return e&&hu(t.prototype,e),n&&hu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setRoot",value:function(t){var e,n;return null===(e=this.actions[0])||void 0===e||e.contentNode.setParent(t),t.setChild(null===(n=this.actions[0])||void 0===n?void 0:n.contentNode),this.actions[0]}},{key:"_getActions",value:function(){return this.actions}},{key:"getAllActions",value:function(t,e){var n=new Set;return this.forEachAction((function(t){return n.add(t)}),t,e),Array.from(n)}},{key:"forEachAction",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=[];((arguments.length>2?arguments[2]:void 0)||this._getActions()).forEach((function(r){var o=[];for(o.push(r);o.length>0;){var i=o.shift();if(i.type===Ha.jumpTo){if(!e||n.includes(i.getId()))continue;n.push(i.getId())}t(i);var a=i.getFutureActions();o.push.apply(o,du(a))}}))}},{key:"findActionById",value:function(t,e){if(e)return e.find((function(e){return e.getId()===t}))||null;var n=this._getActions(),r=[],o=[];for(r.push.apply(r,du(n));r.length>0;){var i=r.shift();if(i.getId()===t)return i;if(i.type===Ha.jumpTo){if(o.includes(i.getId()))continue;o.push(i.getId())}r.push.apply(r,du(i.getFutureActions()))}return null}},{key:"getAllElements",value:function(t){var e=t||this.getAllActions(),n=new Set(e.map((function(t){return t.callee})));return Array.from(n)}},{key:"getActionsByType",value:function(t,e){return(e||this.getAllActions()).filter((function(e){return e.type===t}))}},{key:"getAllNodes",value:function(t){var e=t||this.getAllActions(),n=new Set(e.map((function(t){return t.contentNode})));return Array.from(n)}},{key:"findNodeById",value:function(t,e){var n;return(null===(n=(e||this.getAllActions()).find((function(e){return e.contentNode.id===t})))||void 0===n?void 0:n.contentNode)||null}},{key:"findElementById",value:function(t,e){return e.find((function(e){return e.id===t}))||null}},{key:"findElementsByIds",value:function(t,e){var n=new Map;return e.forEach((function(t){return n.set(t.id,t)})),t.map((function(t){return n.get(t)})).filter(Boolean)}},{key:"fromChained",value:function(t){return t.getActions()}},{key:"construct",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setInitChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setInitChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(kt);function Su(t){return Su="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Su(t)}function ku(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xu(r.key),r)}}function xu(t){var e=function(t,e){if("object"!=Su(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Su(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Su(e)?e:e+""}function Au(t,e,n){return e=Eu(e),function(t,e){if(e&&("object"==Su(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Tu()?Reflect.construct(e,n||[],Eu(t).constructor):e.apply(t,n))}function Tu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Tu=function(){return!!t})()}function Eu(t){return Eu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Eu(t)}function Ou(t,e){return Ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ou(t,e)}_u.targetAction=$a,function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(wu||(wu={}));var Pu=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Au(this,e,[Ct.IdPrefixes.Sound])).state={playing:null,token:null},t.config=p(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ou(t,e)}(e,t),function(t,e,n){return e&&ku(t.prototype,e),n&&ku(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===wu.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(bs.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===wu.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(bs.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===wu.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(bs.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(bs.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(bs.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(bs.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(bs.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(){return{src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1}}},{key:"getSrc",value:function(){return this.config.src}},{key:"$setToken",value:function(t){this.state.token=t}},{key:"$getToken",value:function(){return this.state.token}},{key:"$setHowl",value:function(t){this.state.playing=t}},{key:"$getHowl",value:function(){return this.state.playing}},{key:"$stop",value:function(){this.$setToken(null),this.$setHowl(null)}},{key:"toData",value:function(){return w(this.config,e.defaultConfig)?null:{config:y(this.config)}}},{key:"fromData",value:function(t){return this.config=p(this.config,t.config),this}},{key:"pushAction",value:function(t,e){return this.chain(new bs(this,t,new ke(ue.getIdManager().getStringId()).setContent(e)))}}])}(Ct);function ju(t){return ju="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ju(t)}function Cu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Iu(r.key),r)}}function Iu(t){var e=function(t,e){if("object"!=ju(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ju(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ju(e)?e:e+""}Pu.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var Mu=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.src=[],this.future=[]}return function(t,e,n){return e&&Cu(t.prototype,e),n&&Cu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"register",value:function(t,e){var n=this;if(Array.isArray(t))t.forEach((function(t){return n.register(t)}));else if(t instanceof Pu){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof Fa||Is.isStaticImageData(t)){if(t instanceof Fa){if(this.isSrcRegistered(Is.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(Is.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof Fa?t:new Fa("",{src:Is.staticImageDataToSrc(t)})})}else if("object"===ju(t)){if(this.isSrcRegistered(t.src||""))return this;this.src.push(t)}else if("audio"===t){if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e instanceof Pu?e:new Pu({src:e})})}else{if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e})}return this}},{key:"isSrcRegistered",value:function(e){var n=e instanceof Pu?e.getSrc():e;return this.src.some((function(e){return e.type===t.SrcTypes.audio?n===e.src.getSrc():e.type===t.SrcTypes.image?n===Is.srcToString(e.src.state.src):n===e.src}))}},{key:"getSrc",value:function(){return this.src}},{key:"getSrcByType",value:function(t){return this.src.filter((function(e){return e.type===t}))}},{key:"registerFuture",value:function(t){return this.future.includes(t)||this.hasFuture(t)||this.future.push(t),this}},{key:"hasFuture",value:function(t){return this.future.includes(t)}}])}();function Lu(t){return Lu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lu(t)}function Nu(t){return function(t){if(Array.isArray(t))return Ru(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ru(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ru(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ru(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Fu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Vu(r.key),r)}}function Vu(t){var e=function(t,e){if("object"!=Lu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Lu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Lu(e)?e:e+""}function Du(t,e,n){return e=Uu(e),function(t,e){if(e&&("object"==Lu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Bu()?Reflect.construct(e,n||[],Uu(t).constructor):e.apply(t,n))}function Bu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Bu=function(){return!!t})()}function $u(){return $u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Uu(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},$u.apply(null,arguments)}function Uu(t){return Uu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uu(t)}function Hu(t,e){return Hu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Hu(t,e)}Mu.SrcTypes={image:"image",video:"video",audio:"audio"};var Gu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.defaultConfig;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Du(this,e)).srcManager=new Mu,n.events=new m,n._liveState={active:!1},n.id=ue.getIdManager().getStringId(),n.name=t,n.config=p(e.defaultConfig,r),n.state=p(e.defaultState,n.config),n.backgroundImageState={position:new Me(_e.Center)},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Hu(t,e)}(e,t),function(t,e,n){return e&&Fu(t.prototype,e),n&&Fu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"activate",value:function(){return this.chain(this._init(this))}},{key:"deactivate",value:function(){return this.chain(this._exit())}},{key:"setBackground",value:function(t,e){if(e){var n=e.copy();n.setSrc(Is.backgroundToSrc(t)),this.transitionSceneBackground(void 0,n)}return this.chain(new ps(this,"scene:setBackground",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"applyTransform",value:function(t){return this.chain(new ps(this,"scene:applyTransform",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"jumpTo",value:function(t,e){var n=e||{};return this.chain(new ps(this,"scene:preUnmount",new ke(ue.getIdManager().getStringId()).setContent([])))._transitionToScene(t,n.transition).chain(t._init()).chain(this._exit())._jumpTo(t)}},{key:"transitionSceneBackground",value:function(t,e){return this._transitionToScene(t,e)}},{key:"sleep",value:function(t){return this.chain(new ps(this,"scene:sleep",new ke(ue.getIdManager().getStringId()).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,e){return this.chain(new ps(this,Ha.setBackgroundMusic,new ke(ue.getIdManager().getStringId()).setContent([t,e])))}},{key:"_$getBackgroundMusic",value:function(){return this.state.backgroundMusic}},{key:"toData",value:function(){var t;return w(this.state,this.config)?null:{state:Object.assign(Object.assign({},y(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background,backgroundImageState:Fa.serializeImageState(this.backgroundImageState)})}}},{key:"fromData",value:function(t){return this.state=p(this.state,t.state),t.state.backgroundMusic&&(this.state.backgroundMusic=(new Pu).fromData(t.state.backgroundMusic),this.state.background=t.state.background),t.state.backgroundImageState&&(this.backgroundImageState=Fa.deserializeImageState(t.state.backgroundImageState)),this}},{key:"_setTransition",value:function(t){return this.chain(new ps(this,"scene:setTransition",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"_applyTransition",value:function(t){return this.chain(new ps(this,"scene:applyTransition",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"_toTransform",value:function(){return new Pa([{props:this.backgroundImageState,options:{duration:0}}])}},{key:"_initTransform",value:function(){return new Pa([{props:Object.assign(Object.assign({},this.backgroundImageState),{opacity:1}),options:{duration:0}}])}},{key:"registerSrc",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.sceneRoot){var n=new Set,r=[this.sceneRoot],o=new Set;for(Is.backgroundToSrc(this.config.background)&&this.srcManager.register(new Fa({src:Is.backgroundToSrc(this.config.background)}));r.length;){var i=r.shift();if(i instanceof ps){if(i.type===Ha.jumpTo){var a=i,s=a.contentNode.getContent()[0];if(n.has(a)||e.has(s))continue;n.add(a),o.add(s),e.add(s)}else if(i.type===Ha.setBackground){var u=i.contentNode.getContent()[0];this.srcManager.register(new Fa({src:Is.backgroundToSrc(u)}))}}else if(i instanceof ys){var c=i;if(this.srcManager.register(c.callee),i.type===Ga.setSrc){var l=i.contentNode.getContent()[0];this.srcManager.register(new Fa({src:l}))}}else if(i instanceof bs)this.srcManager.register(i.callee);else if(i instanceof ws){var f=i.getFutureActions();r.push.apply(r,Nu(f))}r.push.apply(r,Nu(i.getFutureActions()))}o.forEach((function(n){n.registerSrc(e),t.srcManager.registerFuture(n.srcManager)}))}}},{key:"action",value:function(t){var n=(Array.isArray(t)?t.flat(2):t(this).flat(2)).map((function(t){return St.isChained(t)?t.fromChained(t):t})).flat(2),r=this.getAllElements(this.getAllActions(!1,n)).filter((function(t){return t instanceof Fa&&!St.isChained(t)})),o=[this._init(this)].concat(Nu(r.map((function(t){return t._init()}))),Nu(n)),i=function(t,e,n,r){var o=$u(Uu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"construct",this,3)([o]),a=new ke(ue.getIdManager().getStringId(),void 0,void 0,i||void 0).setContent(this);return null==i||i.setParent(a),this.sceneRoot=new ps(this,"scene:action",a),this}},{key:"_jumpTo",value:function(t){return this.chain(new ps(this,"scene:jumpTo",new ke(ue.getIdManager().getStringId()).setContent([t])))}},{key:"_exit",value:function(){return new ps(this,"scene:exit",new ke(ue.getIdManager().getStringId()).setContent([]))}},{key:"_transitionToScene",value:function(t,e){var n=this.chain();if(e){var r=e.copy();t&&r.setSrc(Is.backgroundToSrc(t.state.background)),n._applyTransition(r)}return n}},{key:"_init",value:function(){return new ps(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,"scene:init",new ke(ue.getIdManager().getStringId()).setContent([]))}}])}(_u);function zu(t){return zu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zu(t)}function Wu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,qu(r.key),r)}}function qu(t){var e=function(t,e){if("object"!=zu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=zu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==zu(e)?e:e+""}function Yu(t,e,n){return e=Zu(e),Xu(t,Ku()?Reflect.construct(e,n||[],Zu(t).constructor):e.apply(t,n))}function Xu(t,e){if(e&&("object"==zu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Ku(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ku=function(){return!!t})()}function Zu(t){return Zu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zu(t)}function Qu(t,e){return Qu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qu(t,e)}Gu.EventTypes={"event:scene.applyTransition":"event:scene.applyTransition","event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.initTransform":"event:scene.initTransform","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:scene.applyTransform":"event:scene.applyTransform"},Gu.defaultConfig={background:null,invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},Gu.defaultState={},Gu.targetAction=ps;var Ju=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Yu(this,e,[Ct.IdPrefixes.Script])).cleaner=null,n.handler=t,Xu(n,n.chain())}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qu(t,e)}(e,t),function(t,e,n){return e&&Wu(t.prototype,e),n&&Wu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var e=t.gameState;this.cleaner=this.handler(this.getCtx({gameState:e}))||null}},{key:"getCtx",value:function(t){return{script:this,gameState:t.gameState}}},{key:"fromChained",value:function(t){return[new ms(this,ms.ActionTypes.action,new ke(ue.getIdManager().getStringId()).setContent(t))]}}])}(Ct);function tc(t){return tc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tc(t)}function ec(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nc(r.key),r)}}function nc(t){var e=function(t,e){if("object"!=tc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tc(e)?e:e+""}function rc(t,e,n){return e=ic(e),function(t,e){if(e&&("object"==tc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,oc()?Reflect.construct(e,n||[],ic(t).constructor):e.apply(t,n))}function oc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(oc=function(){return!!t})()}function ic(t){return ic=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ic(t)}function ac(t,e){return ac=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ac(t,e)}var sc=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=rc(this,e)).entryScene=null,n.id=ue.getIdManager().getStringId(),n.name=t,n.config=p(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ac(t,e)}(e,t),function(t,e,n){return e&&ec(t.prototype,e),n&&ec(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"_setAllElementState",value:function(t,e){var n=e||this.getAllActions(),r=new Map;t.forEach((function(t){return r.set(t.id,t.data)})),this.getAllElements(n).forEach((function(t){var e=r.get(t.id);e&&t.fromData(e)}))}},{key:"_getAllElementState",value:function(t){var e=t||this.getAllActions();return this.getAllElements(e).map((function(t){return{id:t.id,data:t.toData()}})).filter((function(t){return null!==t.data}))}},{key:"_getNodeChildIdMap",value:function(t){var e=t||this.getAllActions(),n=new Map;return e.forEach((function(t){var e,r=t.contentNode;(null===(e=r.child)||void 0===e?void 0:e.id)&&r.initChild!==r.child&&n.set(r.id,r.child.id)})),n}},{key:"_setNodeChildByMap",value:function(t,e){if(t){var n=t instanceof Map?t:new Map(Object.entries(t)),r=e||this.getAllActions(),o=this._getMappedNodes(this.getAllNodes(r));r.forEach((function(t){var e=t.contentNode,r=n.get(e.id),i=r&&o.get(r);i&&e.setChild(i)}))}}},{key:"_getMappedNodes",value:function(t){var e=new Map;return t.forEach((function(t){return e.set(t.id,t)})),e}},{key:"toData",value:function(){return null}},{key:"fromData",value:function(t){return this}},{key:"entry",value:function(t){if(!t.sceneRoot)throw new Error("No actions in scene, please add actions to scene first");return this.entryScene=t,t.registerSrc(),new Ls(t).run(),this}}])}(_u);sc.defaultConfig={},sc.targetAction=hs;var uc=r(72),cc=r.n(uc),lc=r(825),fc=r.n(lc),dc=r(659),pc=r.n(dc),hc=r(56),yc=r.n(hc),vc=r(540),mc=r.n(vc),gc=r(113),bc=r.n(gc),wc=r(587),_c={};_c.styleTagTransform=bc(),_c.setAttributes=yc(),_c.insert=pc().bind(null,"head"),_c.domAPI=fc(),_c.insertStyleElement=mc();cc()(wc.A,_c);wc.A&&wc.A.locals&&wc.A.locals;var Sc=r(848);const kc=(0,q.createContext)({strict:!1});function xc(t){for(const e in t)Ci[e]={...Ci[e],...t[e]}}function Ac({children:t,features:e,strict:n=!1}){const[,r]=(0,q.useState)(!Tc(e)),o=(0,q.useRef)(void 0);if(!Tc(e)){const{renderer:t,...n}=e;o.current=t,xc(n)}return(0,q.useEffect)((()=>{Tc(e)&&e().then((({renderer:t,...e})=>{xc(e),o.current=t,r(!0)}))}),[]),(0,Sc.jsx)(kc.Provider,{value:{renderer:o.current,strict:n},children:t})}function Tc(t){return"function"==typeof t}function Ec(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Oc(t,e,n={}){var r;const o=ai(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(i=n.transitionOverride);const a=o?()=>Promise.all(vi(t,o,n)):()=>Promise.resolve(),s=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:o=0,staggerChildren:a,staggerDirection:s}=i;return function(t,e,n=0,r=0,o=1,i){const a=[],s=(t.variantChildren.size-1)*r,u=1===o?(t=0)=>t*r:(t=0)=>s-t*r;return Array.from(t.variantChildren).sort(Pc).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(Oc(t,e,{...i,delay:n+u(r)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(a)}(t,e,o+r,a,s,n)}:()=>Promise.resolve(),{when:u}=i;if(u){const[t,e]="beforeChildren"===u?[a,s]:[s,a];return t().then((()=>e()))}return Promise.all([a(),s(n.delay)])}function Pc(t,e){return t.sortNodePosition(e)}const jc=[...Ti].reverse(),Cc=Ti.length;function Ic(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const o=e.map((e=>Oc(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=Oc(t,e,n);else{const o="function"==typeof e?ai(t,e,n.custom):e;r=Promise.all(vi(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Mc(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Ec(e,t)}function Lc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Nc(){return{animate:Lc(!0),whileInView:Lc(),whileHover:Lc(),whileTap:Lc(),whileDrag:Lc(),whileFocus:Lc(),exit:Lc()}}class Rc{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Fc=0;const Vc={animation:{Feature:class extends Rc{constructor(t){super(t),t.animationState||(t.animationState=function(t){let e=Ic(t),n=Nc(),r=!0;const o=e=>(n,r)=>{var o;const i=ai(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const a=t.getProps(),s=t.getVariantContext(!0)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<Cc;e++){const d=jc[e],p=n[d],h=void 0!==a[d]?a[d]:s[d],y=Ai(h),v=d===i?p.isActive:null;!1===v&&(f=e);let m=h===s[d]&&h!==a[d]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),p.protectedKeys={...l},!p.isActive&&null===v||!h&&!p.prevProp||xi(h)||"boolean"==typeof h)continue;let g=Mc(p.prevProp,h)||d===i&&p.isActive&&!m&&y||e>f&&y,b=!1;const w=Array.isArray(h)?h:[h];let _=w.reduce(o(d),{});!1===v&&(_={});const{prevResolvedValues:S={}}=p,k={...S,..._},x=e=>{g=!0,c.has(e)&&(b=!0,c.delete(e)),p.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in k){const e=_[t],n=S[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Xo(e)&&Xo(n)?!Ec(e,n):e!==n,r?null!=e?x(t):c.add(t):void 0!==e&&c.has(t)?x(t):p.protectedKeys[t]=!0}p.prevProp=h,p.prevResolvedValues=_,p.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(g=!1),!g||m&&!b||u.push(...w.map((t=>({animation:t,options:{type:d}}))))}if(c.size){const e={};c.forEach((n=>{const r=t.getBaseTarget(n),o=t.getValue(n);o&&(o.liveStyle=!0),e[n]=null!=r?r:null})),u.push({animation:e})}let d=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(d=!1),r=!1,d?e(u):Promise.resolve()}return{animateChanges:i,setActive:function(e,r){var o;if(n[e].isActive===r)return Promise.resolve();null===(o=t.variantChildren)||void 0===o||o.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const a=i(e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Nc(),r=!0}}}(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();xi(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends Rc{constructor(){super(...arguments),this.id=Fc++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const r=this.node.animationState.setActive("exit",!t);e&&!t&&r.then((()=>e(this.id)))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}};function Dc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Bc(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const $c=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Bc(e));function Uc(t,e,n,r){return Dc(t,e,$c(n),r)}function Hc(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Gc=Hc("dragHorizontal"),zc=Hc("dragVertical");function Wc(){const t=function(t){let e=!1;if("y"===t)e=zc();else if("x"===t)e=Gc();else{const t=Gc(),n=zc();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function qc(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return Uc(t.current,n,((n,o)=>{if("touch"===n.pointerType||Wc())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&ze.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Yc=(t,e)=>!!e&&(t===e||Yc(t,e.parentElement));function Xc(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Bc(n))}const Kc=new WeakMap,Zc=new WeakMap,Qc=t=>{const e=Kc.get(t.target);e&&e(t)},Jc=t=>{t.forEach(Qc)};function tl(t,e,n){const r=function({root:t,...e}){const n=t||document;Zc.has(n)||Zc.set(n,{});const r=Zc.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Jc,{root:t,...e})),r[o]}(e);return Kc.set(t,n),r.observe(t),()=>{Kc.delete(t),r.unobserve(t)}}const el={some:0,all:1};const nl={inView:{Feature:class extends Rc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:r="some",once:o}=t,i={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:el[r]};return tl(this.node.current,i,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,o&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),i=e?n:r;i&&i(t)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Rc{constructor(){super(...arguments),this.removeStartListeners=Re,this.removeEndListeners=Re,this.removeAccessibleListeners=Re,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=Uc(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Yc(this.node.current,t.target)?n:r;i&&ze.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=Uc(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=po(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=Dc(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=Dc(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&Xc("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&ze.postRender((()=>n(t,e)))}))})),Xc("down",((t,e)=>{this.startPress(t,e)}))})),e=Dc(this.node.current,"blur",(()=>{this.isPressing&&Xc("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=po(t,e)}}startPress(t,e){this.isPressing=!0;const{onTapStart:n,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&ze.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Wc()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&ze.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=Uc(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=Dc(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=po(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Rc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=po(Dc(this.node.current,"focus",(()=>this.onFocus())),Dc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Rc{mount(){this.unmount=po(qc(this.node,!0),qc(this.node,!1))}unmount(){}}}},rl=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ol(t){return"string"==typeof t&&!t.includes("-")&&!!(rl.indexOf(t)>-1||/[A-Z]/u.test(t))}const il={renderer:(t,e)=>ol(t)?new Ki(e):new Qi(e,{allowProjection:t!==q.Fragment}),...Vc,...nl};function al(t){var e=t.children;return Y().createElement(Ac,{features:il,strict:!0},e)}function sl(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ul(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ul(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ul(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function cl(t){var e=t.children,n=t.className,r=sl((0,q.useState)({}),2),o=r[0],i=r[1],a=rt().ratio,s=pt().game,u=sl((0,q.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,q.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("Ratio is locked, skipping update");else{var t=document.getElementById(s.config.player.contentContainerId);if(t){var e,n,r=t.clientWidth,o=t.clientHeight,f=s.config.player.aspectRatio;r/o>f?(e=o*f,n=o):(e=r,n=r/f),e<c&&(e=c),n<l&&(n=l),i({width:"".concat(e,"px"),height:"".concat(n,"px"),margin:"auto",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center"}),a.update(e,n),a.updateMin(c,l),u()}}};a.setUpdate(e);var n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)};return e(),window.addEventListener("resize",n),function(){window.removeEventListener("resize",n),clearTimeout(t)}}),[a]),Y().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},Y().createElement("div",{className:W(n),style:o},e))}var ll={start:"start",update:"update",end:"end"};function fl(t){var e=t.children,n=rt().ratio,r=pt().game,o=(0,q.useRef)(null);return(0,q.useEffect)((function(){if(!o.current)throw new Error("Content container not found")}),[r.config.player.contentContainerId]),Y().createElement(Y().Fragment,null,Y().createElement("div",{ref:o,className:W("absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"),style:Object.assign({},n.getStyle())},e))}function dl(t){return dl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dl(t)}function pl(){return pl=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},pl.apply(null,arguments)}function hl(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */hl=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==dl(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(dl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function yl(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return vl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vl(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var ml=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function gl(t){var e=this,n=t.scene,r=t.props,o=t.state,i=(0,q.useRef)(null),a=pt().game,s=yl((0,q.useState)(null),2),u=s[0],c=s[1],l=yl((0,q.useState)([]),2)[1],f=yl((0,q.useState)(null),2),d=f[0],h=f[1],y=yl((0,q.useState)({}),2),v=y[0],m=y[1];function g(){n.events.emit(Gu.EventTypes["event:scene.imageLoaded"])}function b(t){if(d&&d.getControl()&&(console.warn("processing transform not completed"),d.getControl().complete(),d.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof Pa?Object.assign(i.current.style,t.propToCSS(o,n.backgroundImageState)):Object.assign(i.current.style,t)}(0,q.useEffect)((function(){var t=n.events.onEvents([{type:Gu.EventTypes["event:scene.applyTransition"],listener:n.events.on(Gu.EventTypes["event:scene.applyTransition"],(function(t){return c(t),t?new Promise((function(e){var n=t.events.onEvents([{type:ll.update,listener:t.events.on(ll.update,(function(t){l(t),o.logger.debug("transition update",{progress:t})}))},{type:ll.end,listener:t.events.on(ll.end,(function(){c(null),e(),o.logger.debug("transition end",u)}))},{type:ll.start,listener:t.events.on(ll.start,(function(){o.logger.debug("transition start",u)}))}]);t.start((function(){n.cancel(),e()}))})):(o.logger.warn("transition not set"),Promise.resolve())}))},{type:Gu.EventTypes["event:scene.applyTransform"],listener:n.events.on(Gu.EventTypes["event:scene.applyTransform"],(function(t){return ml(e,void 0,void 0,hl().mark((function e(){return hl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(o,n.backgroundImageState)),h(t),e.next=4,t.animate({scope:i},o,n.backgroundImageState,(function(e){n.backgroundImageState=p(n.backgroundImageState,e),m({style:t.propToCSS(o,n.backgroundImageState)}),h(null)}));case 4:case"end":return e.stop()}}),e)})))}))},{type:Gu.EventTypes["event:scene.initTransform"],listener:n.events.on(Gu.EventTypes["event:scene.initTransform"],(function(t){return ml(e,void 0,void 0,hl().mark((function e(){return hl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o.logger.debug("init transform",t),e.next=3,t.animate({scope:i},o,n.backgroundImageState,(function(t){n.backgroundImageState=p(n.backgroundImageState,t)}));case 3:case"end":return e.stop()}}),e)})))}))}]);return function(){t.cancel()}}),[n]),(0,q.useEffect)((function(){b(n.backgroundImageState)}),[]),(0,q.useEffect)((function(){var t=o.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:o.events.on(G.EventTypes["event:state.player.skip"],(function(){d&&d.getControl()&&(d.getControl().complete(),d.setControl(null))}))}]);return function(){t.cancel()}}),[d]);var w,_="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",S={src:_,style:Object.assign({opacity:0},a.config.app.debug?{border:"1px solid red"}:{})};return Y().createElement("div",null,u?u.toElementProps().map((function(t,e,n){var o=p(S,r,v,t);return Y().createElement(fl,{key:e},Y().createElement("img",pl({alt:o.alt},o,{onLoad:g,src:o.src||_,ref:e===n.length-1?i:void 0,className:"absolute"})))})):(w=p(S,r,v),Y().createElement(fl,null,Y().createElement("img",pl({alt:w.alt},w,{onLoad:g,ref:i,src:w.src||_,className:"absolute"})))))}function bl(t){return bl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bl(t)}function wl(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */wl=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==bl(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(bl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function _l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Sl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sl(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var kl=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function xl(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=rt().ratio,a=_l((0,q.useState)((function(){return e._$getBackgroundMusic()})),2),s=a[0],u=a[1],c=_l((0,q.useState)(null),2),l=c[0],f=c[1],d=_l((0,q.useState)(null),2),p=d[0],h=d[1];function y(t,e){return kl(this,void 0,void 0,wl().mark((function n(){var r;return wl().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.$getHowl()&&t.$getHowl().playing(t.$getToken())){n.next=2;break}return n.abrupt("return",Promise.resolve());case 2:return r=t.$getHowl().volume(t.$getToken()),n.next=5,new Promise((function(n){t.$getHowl().fade(r,0,e,t.$getToken()),h((function(){return n})),f(setTimeout((function(){t.$getHowl().stop(),t.$getHowl().volume(r),t.$setToken(null),n(),h(null)}),e))}));case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))}return(0,q.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(Gu.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){var n,r,o,i,a,c;return kl(this,void 0,void 0,wl().mark((function d(){var v,m;return wl().wrap((function(d){for(;;)switch(d.prev=d.next){case 0:if(l&&(clearTimeout(l),f(null),p&&(p(),h(null))),m=t,!(v=s)){d.next=12;break}if(!e){d.next=9;break}return d.next=7,y(v,e);case 7:d.next=12;break;case 9:null===(n=v.$getHowl())||void 0===n||n.stop(),null===(r=v.$getHowl())||void 0===r||r.volume(0),v.$setToken(null);case 12:if(m){d.next=14;break}return d.abrupt("return");case 14:null===(o=m.$getHowl())||void 0===o||o.volume(0),m.$setToken(null===(i=m.$getHowl())||void 0===i?void 0:i.play(m.$getToken()||void 0)),e?null===(a=m.$getHowl())||void 0===a||a.fade(0,m.config.volume,e,m.$getToken()):null===(c=m.$getHowl())||void 0===c||c.volume(m.config.volume,m.$getToken()),u(m);case 18:case"end":return d.stop()}}),d)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(Gu.EventTypes["event:scene.preUnmount"],(function(){l&&(clearTimeout(l),p&&p()),s&&y(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,q.useEffect)((function(){return e.events.emit(Gu.EventTypes["event:scene.mount"]),function(){e.events.emit(Gu.EventTypes["event:scene.unmount"])}}),[]),Y().createElement("div",{className:o},Y().createElement(gl,{scene:e,props:{width:i.state.width,height:i.state.height,src:Is.backgroundToSrc(e.state.background)},state:n}),r)}function Al(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}const Tl=(0,q.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),El=(0,q.createContext)({}),Ol=(0,q.createContext)(null),Pl=_i?q.useLayoutEffect:q.useEffect,{schedule:jl,cancel:Cl}=Ge(queueMicrotask,!1);function Il(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const Ml=(0,q.createContext)({});let Ll=!1;function Nl(t,e,n,r,o){var i;const{visualElement:a}=(0,q.useContext)(El),s=(0,q.useContext)(kc),u=(0,q.useContext)(Ol),c=(0,q.useContext)(Tl).reducedMotion,l=(0,q.useRef)();r=r||s.renderer,!l.current&&r&&(l.current=r(t,{visualState:e,parent:a,props:n,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:c}));const f=l.current,d=(0,q.useContext)(Ml);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Fl(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&Il(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(l.current,n,o,d),(0,q.useInsertionEffect)((()=>{f&&f.update(n,u)}));const p=n[ci],h=(0,q.useRef)(Boolean(p)&&!window.MotionHandoffIsComplete&&(null===(i=window.MotionHasOptimisedAnimation)||void 0===i?void 0:i.call(window,p)));return Pl((()=>{f&&(f.updateFeatures(),jl.render(f.render),h.current&&f.animationState&&f.animationState.animateChanges())})),(0,q.useEffect)((()=>{f&&(!h.current&&f.animationState&&f.animationState.animateChanges(),h.current=!1,Ll||(Ll=!0,queueMicrotask(Rl)))})),f}function Rl(){window.MotionHandoffIsComplete=!0}function Fl(t){if(t)return!1!==t.options.allowProjection?t.projection:Fl(t.parent)}function Vl(t,e,n){return(0,q.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Il(n)&&(n.current=r))}),[e])}function Dl(t){const{initial:e,animate:n}=function(t,e){if(Oi(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Ai(e)?e:void 0,animate:Ai(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,q.useContext)(El));return(0,q.useMemo)((()=>({initial:e,animate:n})),[Bl(e),Bl(n)])}function Bl(t){return Array.isArray(t)?t.join(" "):t}const $l=(0,q.createContext)({}),Ul=Symbol.for("motionComponentSymbol");function Hl({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&xc(t);const i=(0,q.forwardRef)((function(t,i){let a;const s={...(0,q.useContext)(Tl),...t,layoutId:Gl(t)},{isStatic:u}=s,c=Dl(t),l=r(t,u);if(!u&&_i){!function(){(0,q.useContext)(kc).strict;0}();const t=function(t){const{drag:e,layout:n}=Ci;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(s);a=t.MeasureLayout,c.visualElement=Nl(o,l,s,e,t.ProjectionNode)}return(0,Sc.jsxs)(El.Provider,{value:c,children:[a&&c.visualElement?(0,Sc.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Vl(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[Ul]=o,i}function Gl({layoutId:t}){const e=(0,q.useContext)($l).id;return e&&void 0!==t?e+"-"+t:t}function zl(t){const e=pi(t)?t.get():t;return Ko(e)?e.toValue():e}const Wl=t=>(e,n)=>{const r=(0,q.useContext)(El),o=(0,q.useContext)(Ol),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:Xl(o,i,a,!s&&t,e),renderState:n()};return r&&(u.mount=t=>r(o,t,u)),u}(t,e,r,o,n);return n?i():function(t){const e=(0,q.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function ql(t,e){const n=fi(e);n&&Qo(t,n)}function Yl(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=ii(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function Xl(t,e,n,r,o){var i;const a={},s=[],u=r&&void 0===(null===(i=t.style)||void 0===i?void 0:i.willChange),c=o(t,{});for(const t in c)a[t]=zl(c[t]);let{initial:l,animate:f}=t;const d=Oi(t),p=Pi(t);e&&p&&!d&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let h=!!n&&!1===n.initial;h=h||!1===l;const y=h?f:l;return y&&"boolean"!=typeof y&&!xi(y)&&Yl(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[h?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!xi(f)&&Yl(t,f,(t=>{for(const e in t)ql(s,e)})),s.length&&(a.willChange=s.join(","))),a}const Kl=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Zl=()=>({...Kl(),attrs:{}}),Ql={useVisualState:Wl({scrapeMotionValuesFromProps:wi,createRenderState:Zl,onMount:(t,e,{renderState:n,latestValues:r})=>{ze.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),ze.render((()=>{zi(n,r,Xi(e.tagName),t.transformTemplate),Yi(e,n)}))}})},Jl={useVisualState:Wl({applyWillChange:!0,scrapeMotionValuesFromProps:bi,createRenderState:Kl})};function tf(t,e,n){for(const r in e)pi(e[r])||gi(r,n)||(t[r]=e[r])}function ef(t,e){const n={};return tf(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,q.useMemo)((()=>{const n=Kl();return $i(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function nf(t,e){const n={},r=ef(t,e);return t.drag&&!1!==t.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const rf=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function of(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||rf.has(t)}let af=t=>!of(t);try{(sf=require("@emotion/is-prop-valid").default)&&(af=t=>t.startsWith("on")?!of(t):sf(t))}catch(lt){}var sf;function uf(t,e,n,r){const o=(0,q.useMemo)((()=>{const n=Zl();return zi(n,e,Xi(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};tf(e,t.style,t),o.style={...e,...o.style}}return o}function cf(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(ol(e)?uf:nf)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(af(o)||!0===n&&of(o)||!e&&!of(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==q.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,q.useMemo)((()=>pi(c)?c.get():c),[c]);return(0,q.createElement)(e,{...u,children:l})}}function lf(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Hl({...ol(n)?Ql:Jl,preloadedFeatures:t,useRender:cf(r),createVisualElement:e,Component:n})}}const ff=Al(lf());function df(t){return df="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},df(t)}function pf(){return pf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},pf.apply(null,arguments)}function hf(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */hf=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",p="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==df(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=d;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(df(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function yf(t){return function(t){if(Array.isArray(t))return gf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||mf(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||mf(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mf(t,e){if(t){if("string"==typeof t)return gf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gf(t,e):void 0}}function gf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var bf=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function wf(t){var e=this,n=t.image,r=t.state,o=t.onAnimationEnd,i=(0,q.useRef)(null),a=vf((0,q.useState)(null),2),s=a[0],u=a[1],c=vf((0,q.useState)({style:{}}),2),l=c[0],f=c[1],d=vf((0,q.useState)(null),2),h=d[0],y=d[1],v=vf((0,q.useState)([]),2)[1],m=vf((0,q.useState)(0),2),g=m[0],b=m[1],w=pt().game;(0,q.useEffect)((function(){n.setScope(i),n.events.emit(Fa.EventTypes["event:image.mount"]);var t=n.events.onEvents([].concat(yf([Fa.EventTypes["event:image.show"],Fa.EventTypes["event:image.hide"],Fa.EventTypes["event:image.applyTransform"]].map((function(t){return{type:t,listener:n.events.on(t,(function(t){return bf(e,void 0,void 0,hf().mark((function e(){return hf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(t.propToCSS(r,n.state)),u(t),r.logger.debug("transform",t,t.propToCSS(r,n.state)),e.next=5,t.animate({scope:i},r,n.state,(function(e){n.state=p(n.state,e),f({style:t.propToCSS(r,n.state)}),o&&o(),u(null)}));case 5:return e.abrupt("return",!0);case 6:case"end":return e.stop()}}),e)})))}))}}))),[{type:Fa.EventTypes["event:image.init"],listener:n.events.on(Fa.EventTypes["event:image.init"],(function(){return bf(e,void 0,void 0,hf().mark((function t(){return hf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.toTransform().animate({scope:i},r,n.state,(function(t){n.state=p(n.state,t),f({style:n.toTransform().propToCSS(r,n.state)})}));case 2:case"end":return t.stop()}}),t)})))}))}]));return S(n.toTransform().propToCSS(r,n.state)),n.events.emit(Fa.EventTypes["event:image.ready"],i),function(){t.cancel(),n.events.emit(Fa.EventTypes["event:image.unmount"])}}),[]),(0,q.useEffect)((function(){var t=n.events.onEvents([{type:Fa.EventTypes["event:image.setTransition"],listener:n.events.on(Fa.EventTypes["event:image.setTransition"],(function(t){y(t)}))}]);return function(){t.cancel()}}),[h,n]),(0,q.useEffect)((function(){var t=h?h.events.onEvents([{type:ll.update,listener:h.events.on(ll.update,(function(t){v(t)}))},{type:ll.end,listener:h.events.on(ll.end,(function(){y(null)}))}]):null;return function(){var e;null===(e=null==t?void 0:t.cancel)||void 0===e||e.call(t)}}),[h]),(0,q.useEffect)((function(){b(performance.now())}),[]),(0,q.useEffect)((function(){var t=r.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:r.events.on(G.EventTypes["event:state.player.skip"],(function(){s&&s.getControl()&&(s.getControl().complete(),s.setControl(null),r.logger.debug("transform skip")),h&&h.controller&&(h.controller.complete(),y(null),r.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[h,s]);var _=function(){var t=performance.now()-g,e=w.config.elements.img.slowLoadThreshold;t>e&&w.config.elements.img.slowLoadWarning&&r.logger.warn("NarraLeaf-React","Image took ".concat(t,"ms to load, which exceeds the threshold of ").concat(e,"ms. ")+"Consider enable cache for the image, so Preloader can preload it before it's used. To disable this warning, set `elements.img.slowLoadWarning` to false in the game config.")};function S(t){if(s&&s.getControl()&&(console.warn("processing transform not completed"),s.getControl().complete(),s.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof Pa?Object.assign(i.current.style,t.propToCSS(r,n.state)):Object.assign(i.current.style,t)}var k={className:"absolute",src:Is.staticImageDataToSrc(n.state.src),style:Object.assign({opacity:0},w.config.app.debug?{border:"1px solid red"}:{})};return Y().createElement(ot,{className:"absolute overflow-hidden"},h?h.toElementProps().map((function(t,e,n){var r=p(k,l,t);return Y().createElement(ff.img,pf({key:e,alt:r.alt},r,{ref:e===n.length-1?i:void 0,onLoad:_,layout:!0}))})):Y().createElement(ff.img,pf({ref:i,alt:"image"},p(k,l),{onLoad:_})))}function _f(t){return _f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_f(t)}function Sf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,kf(r.key),r)}}function kf(t){var e=function(t,e){if("object"!=_f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_f(e)?e:e+""}var xf=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.preloaded=[],this.events=new m}return function(t,e,n){return e&&Sf(t.prototype,e),n&&Sf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"add",value:function(e){return this.has(this.getSrc(e))||(this.preloaded.push(e),this.events.emit(t.EventTypes["event:preloaded.add"],e),this.events.emit(t.EventTypes["event:preloaded.change"])),this}},{key:"get",value:function(t){var e=this;return this.preloaded.find((function(n){return e.getSrc(n)===t}))}},{key:"has",value:function(t){var e=this;return Array.isArray(t)?t.every((function(t){return e.has(t)})):this.preloaded.some((function(n){return e.getSrc(n)===t}))}},{key:"remove",value:function(e){var n=this;if(Array.isArray(e)){var r=e.map((function(t){return n.getSrc(t)}));return this.preloaded=this.preloaded.filter((function(t){return!r.includes(n.getSrc(t))})),this}var o=this.getSrc(e);return this.preloaded=this.preloaded.filter((function(t){return n.getSrc(t)!==o})),this.events.emit(t.EventTypes["event:preloaded.remove"],e),this.events.emit(t.EventTypes["event:preloaded.change"]),this}},{key:"clear",value:function(){return this.preloaded=[],this}},{key:"getSrc",value:function(t){return"string"==typeof t?t:"image"===t.type?Is.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function Af(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Tf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tf(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}xf.EventTypes={"event:preloaded.add":"event:preloaded.add","event:preloaded.remove":"event:preloaded.remove","event:preloaded.change":"event:preloaded.change","event:preloaded.mount":"event:preloaded.mount","event:preloaded.ready":"event:preloaded.ready"};var Ef=(0,q.createContext)(null);function Of(t){var e=t.children,n=Af((0,q.useState)(new xf),1)[0];return Y().createElement(Y().Fragment,null,Y().createElement(Ef.Provider,{value:{preloaded:n}},e))}function Pf(){if(!Ef)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,q.useContext)(Ef)}function jf(t){return function(t){if(Array.isArray(t))return Cf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Cf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cf(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function If(t){var e=t.state,n=t.srcManager,r=Pf().preloaded;return(0,q.useEffect)((function(){var t,o;if("undefined"!=typeof window){var i=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,a=(null===(o=e.getLastScene())||void 0===o?void 0:o.srcManager.future)||[],s=[].concat(jf(n.src),jf(i?i.src:[]),jf(a.map((function(t){return t.src})).flat(2))),u={image:new Set,audio:new Set,video:new Set};s.forEach((function(t){t.type===Mu.SrcTypes.image?u.image.add(t.src):t.type===Mu.SrcTypes.audio?u.audio.add(t.src):t.type===Mu.SrcTypes.video&&u.video.add(t.src)})),e.logger.debug("Preloading",u,a),r.preloaded=r.preloaded.filter((function(t){if(t.type===Mu.SrcTypes.audio){var e=u[t.type].has(t.src);return e||(e=Array.from(u[t.type]).some((function(e){return r.getSrc(t)===r.getSrc(e.config.src)}))),e}if(t.type===Mu.SrcTypes.image)return u[t.type].has(t.src);var n=r.getSrc(t);return u[t.type].has(n)}));var c=[];return u.image.forEach((function(t){var n=new Image;n.src=Is.srcToString(t.state.src),n.onload=function(){e.logger.debug("Image loaded",t.state.src)},c.push(n),r.add({type:"image",src:t})})),Promise.all([]).then((function(){e.logger.log("Preloaded","Preloaded ".concat(u.image.size," images")),r.events.emit(xf.EventTypes["event:preloaded.ready"])})),u.audio.forEach((function(t){t.$getHowl()||t.$setHowl(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),r.events.emit(xf.EventTypes["event:preloaded.mount"]),function(){c.forEach((function(t){t.onload=null}))}}console.warn("Window is not supported in this environment")}),[e]),null}function Mf(t){var e=t.state,n=pt().game;return(0,q.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&e.events.emit(G.EventTypes["event:state.player.skip"])},r=n.config.player.skipInterval,o=0,function(){var e=Date.now();if(!(e-o<r))return o=e,t.apply(void 0,arguments)});return window.addEventListener("keydown",i),function(){window.removeEventListener("keydown",i)}}e.logger.warn("NarraLeaf-React: Announcer","Cannot listen to window events")}),[]),Y().createElement(Y().Fragment,null)}function Lf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Nf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nf(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Rf(t,e){return t.handle(e)}function Ff(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=Lf((0,q.useReducer)((function(t){return t+1}),0),2)[1],u=pt().game,c=Lf((0,q.useReducer)(Rf,new G(u,{forceUpdate:function(){s()},next:y,dispatch:function(t){return f(t)}})),2),l=c[0],f=c[1],d=u.config.elements.say.use,p=u.config.elements.menu.use;function y(){for(var t=!1;!t;){var e=u.getLiveGame().next(l);if(!e)break;if(h.isAwaitable(e)){t=!0;break}f(e)}l.stage.forceUpdate()}(0,q.useEffect)((function(){e&&u.getLiveGame().loadStory(e)}),[e,u]),(0,q.useEffect)((function(){i&&i({game:u,state:l});var t=l.getLastScene(),e=[];t?e.push({type:"event:scene.mount",listener:t.events.once("event:scene.mount",(function(){l.stage.next()}))}):l.stage.next();var n=l.events.onEvents([{type:G.EventTypes["event:state.end"],listener:function(){a&&a({game:u,state:l})}}]),r=l.events.onEvents([{type:G.EventTypes["event:state.player.skip"],listener:function(){u.getLiveGame().abortAwaiting(),y()}}]);return l.stage.forceUpdate(),function(){t&&e.forEach((function(e){t.events.off(e.type,e.listener)})),n.cancel(),r.cancel()}}),[]);var v=n||u.config.player.width,m=r||u.config.player.height;return Y().createElement(al,null,Y().createElement("div",{style:{width:"number"==typeof v?"".concat(v,"px"):v,height:"number"==typeof m?"".concat(m,"px"):m},className:W(o,"__narraleaf_content-player")},Y().createElement(cl,{className:W("flex-grow overflow-auto")},Y().createElement(ot,{className:"relative"},l.state.srcManagers.map((function(t,e){return Y().createElement(If,{key:e,state:l,srcManager:t})})),Y().createElement(Vf,{onLoaded:function(){l.stage.forceUpdate(),e&&y()}},Y().createElement(Mf,{state:l}),l.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return Y().createElement(xl,{key:"scene-"+e.id,state:l,scene:e},n.images.map((function(t){return Y().createElement(wf,{key:"image-"+t.id,image:t,state:l})})),n.texts.map((function(t){var e=t.action,n=t.onClick;return Y().createElement(d,{state:l,key:"say-"+e.id,action:e,onClick:function(){n(),y()}})})),n.menus.map((function(t,e){return Y().createElement("div",{key:"menu-"+e},Y().createElement(p,{state:l,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),y()}}))})))})))))))}function Vf(t){var e=t.children,n=t.onLoaded,r=Pf().preloaded,o=Lf((0,q.useState)(!1),2),i=o[0],a=o[1];return(0,q.useEffect)((function(){var t=r.events.on(xf.EventTypes["event:preloaded.ready"],(function(){a(!0),n()}));return function(){r.events.off(xf.EventTypes["event:preloaded.ready"],t)}}),[i]),Y().createElement(Y().Fragment,null,i?e:null)}function Df(t){var e=t.children,n=t.game;return Y().createElement(Y().Fragment,null,Y().createElement(nt,null,Y().createElement(dt,{game:n},Y().createElement(Of,null,e))))}function Bf(t){return Bf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bf(t)}function $f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Uf(r.key),r)}}function Uf(t){var e=function(t,e){if("object"!=Bf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Bf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bf(e)?e:e+""}var Hf=function(){return function(t,e,n){return e&&$f(t.prototype,e),n&&$f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=new m}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(ll.start,null),this.controller=va(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(ll.update,r.toElementProps())},onComplete:function(){r.events.emit(ll.end,null),s&&s(),r.controller=void 0}},n)),this.controller}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}();function Gf(t){return Gf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gf(t)}function zf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Wf(r.key),r)}}function Wf(t){var e=function(t,e){if("object"!=Gf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Gf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gf(e)?e:e+""}function qf(t,e,n){return e=Xf(e),function(t,e){if(e&&("object"==Gf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Yf()?Reflect.construct(e,n||[],Xf(t).constructor):e.apply(t,n))}function Yf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yf=function(){return!!t})()}function Xf(t){return Xf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xf(t)}function Kf(t,e){return Kf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kf(t,e)}var Zf=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=qf(this,e)).state={opacity:1},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Gu?Is.backgroundToSrc(r.config.background):Is.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Kf(t,e)}(e,t),function(t,e,n){return e&&zf(t.prototype,e),n&&zf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{},{style:{opacity:this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Hf);function Qf(t){return Qf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qf(t)}function Jf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,td(r.key),r)}}function td(t){var e=function(t,e){if("object"!=Qf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qf(e)?e:e+""}function ed(t,e,n){return e=rd(e),function(t,e){if(e&&("object"==Qf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,nd()?Reflect.construct(e,n||[],rd(t).constructor):e.apply(t,n))}function nd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(nd=function(){return!!t})()}function rd(t){return rd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rd(t)}function od(t,e){return od=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},od(t,e)}Zf.Frames=[0,1];var id=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3?arguments[3]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=ed(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,i&&(r.src="string"==typeof i?i:i instanceof Gu?Is.backgroundToSrc(i.config.background):Is.staticImageDataToSrc(i)),r.__stack=g(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&od(t,e)}(e,t),function(t,e,n){return e&&Jf(t.prototype,e),n&&Jf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}})}},{key:"toElementProps",value:function(){return[{},{style:{opacity:this.state.opacity,transform:this.state.transform},src:this.src}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])}(Hf);function ad(t){return ad="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ad(t)}function sd(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ud(r.key),r)}}function ud(t){var e=function(t,e){if("object"!=ad(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ad(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ad(e)?e:e+""}function cd(t,e,n){return e=fd(e),function(t,e){if(e&&("object"==ad(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ld()?Reflect.construct(e,n||[],fd(t).constructor):e.apply(t,n))}function ld(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ld=function(){return!!t})()}function fd(t){return fd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fd(t)}function dd(t,e){return dd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dd(t,e)}var pd=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=cd(this,e)).state={opacity:0},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof Gu?Is.backgroundToSrc(r.config.background):Is.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&dd(t,e)}(e,t),function(t,e,n){return e&&sd(t.prototype,e),n&&sd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Hf);pd.Frames=[1,0]})(),o})()));
|
|
31
|
+
*/function c(t,e,n){var r,i={},c=null,l=null;for(r in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,r)&&!u.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:c,ref:l,props:i,_owner:s.current}}e.jsx=c,e.jsxs=c},848:(t,e,n)=>{"use strict";t.exports=n(20)},72:t=>{"use strict";var e=[];function n(t){for(var n=-1,r=0;r<e.length;r++)if(e[r].identifier===t){n=r;break}return n}function r(t,r){for(var i={},a=[],s=0;s<t.length;s++){var u=t[s],c=r.base?u[0]+r.base:u[0],l=i[c]||0,f="".concat(c," ").concat(l);i[c]=l+1;var p=n(f),d={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)e[p].references++,e[p].updater(d);else{var h=o(d,r);r.byIndex=s,e.splice(s,0,{identifier:f,updater:h,references:1})}a.push(f)}return a}function o(t,e){var n=e.domAPI(e);n.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var i=r(t=t||[],o=o||{});return function(t){t=t||[];for(var a=0;a<i.length;a++){var s=n(i[a]);e[s].references--}for(var u=r(t,o),c=0;c<i.length;c++){var l=n(i[c]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}i=u}}},659:t=>{"use strict";var e={};t.exports=function(t,n){var r=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},56:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},12:e=>{"use strict";e.exports=t}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={id:t,exports:{}};return e[t](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nc=void 0;var o={};return(()=>{"use strict";function t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return n};var e,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(e){l=function(t,e,n){return t[e]=n}}function p(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),s=new I(r||[]);return i(a,"_invoke",{value:O(t,n,s)}),a}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=p;var h="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,s,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(M([])));x&&x!==r&&o.call(x,s)&&(S=x);var A=_.prototype=b.prototype=Object.create(S);function T(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(r,i,a,s){var u=d(t[r],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==f(l)&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function O(t,n,r){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=P(s,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?m:y,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function P(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(f(t)+" is not iterable")}return w.prototype=_,i(A,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l(t,c,"GeneratorFunction")),t.prototype=Object.create(A),t},n.awrap=function(t){return{__await:t}},T(E.prototype),l(E.prototype,u,(function(){return this})),n.AsyncIterator=E,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new E(p(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(A),l(A,c,"Generator"),l(A,s,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=M,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(C),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},n}function e(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=c(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s(r.key),r)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}function u(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}r.r(o),r.d(o,{Align:()=>De,Base:()=>Wf,Character:()=>Xt,ColoredSentence:()=>Jt,CommonPosition:()=>Fe,CommonPositionType:()=>Ae,Condition:()=>Zs,Control:()=>iu,Coord2D:()=>Ve,Dissolve:()=>vp,Fade:()=>tp,FadeIn:()=>up,Game:()=>pe,GameProviders:()=>Hf,GameState:()=>U,Image:()=>Ua,Isolated:()=>et,Lambda:()=>Ks,LiveGame:()=>de,Menu:()=>du,Player:()=>Bf,Say:()=>Qt,Scene:()=>qu,Script:()=>nc,Sentence:()=>Wt,Sound:()=>Iu,SoundType:()=>ku,Story:()=>lc,Transform:()=>Ma,Utils:()=>Ns,Word:()=>Yt,useGame:()=>ct});var p=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 d(t,e){var n=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r={},o=function(t,e,n){return"object"!==f(e)||null===e||Array.isArray(e)||"object"!==f(n)||null===n||Array.isArray(n)?Array.isArray(e)&&Array.isArray(n)?e.map((function(t,e){return"object"===f(t)&&null!==t&&!Array.isArray(t)&&n[e]?d(t,n[e]):t})):void 0!==n?n:e:e.constructor!==Object||n.constructor!==Object?n||e:d(e,n)};for(var i in t)n(t,i)&&(r[i]=o(0,t[i],e[i]));for(var a in e)n(e,a)&&!n(r,a)&&("object"===f(e[a])&&null!==e[a]?e[a].constructor!==Object?r[a]=e[a]:r[a]=d({},e[a]):r[a]=e[a]);for(var s=arguments.length,c=new Array(s>2?s-2:0),l=2;l<s;l++)c[l-2]=arguments[l];if(c.length){var p=c[0],h=c.slice(1);return d.apply(void 0,[r,p].concat(u(h)))}return r}var h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},r=arguments.length>1?arguments[1]:void 0;n(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=r}return a(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var n,r=e(this.listeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)(this.result)}}catch(t){r.e(t)}finally{r.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function y(t){var n=new WeakSet;return function t(r){if(null===r||"object"!==f(r))return r;if(!n.has(r)){if(n.add(r),Array.isArray(r)){var o,i=[],a=e(r);try{for(a.s();!(o=a.n()).done;){var s=o.value;i.push(t(s))}}catch(t){a.e(t)}finally{a.f()}return i}var u={};for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(u[c]=t(r[c]));return u}}(t)}function v(t){return"string"==typeof t?t:"#".concat((t.r||0).toString(16).padStart(2,"0")).concat((t.g||0).toString(16).padStart(2,"0")).concat((t.b||0).toString(16).padStart(2,"0")).concat(void 0!==t.a?t.a.toString(16).padStart(2,"0"):"")}var m=function(){return a((function t(){n(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return p(this,void 0,void 0,t().mark((function r(){var i,a,s,u,c,l=this;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.events[n]||(this.events[n]=[]),i=[],a=e(this.events[n]);try{for(a.s();!(s=a.n()).done;)u=s.value,(c=u.apply(void 0,o))&&"object"===f(c)&&"function"==typeof c.then&&i.push(c)}catch(t){a.e(t)}finally{a.f()}if(this.events[n]=this.events[n].filter((function(t){return!i.includes(t)})),0!==i.length){t.next=7;break}return t.abrupt("return",new Promise((function(t){var e=l.on("event:EventDispatcher.register",(function(r,i){if(r===n){l.off(r,e);var a=null==i?void 0:i.apply(void 0,o);a&&a.then?a.then(t):t(a)}}))})));case 7:return t.next=9,Promise.all(i);case 9:return t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),r,this)})))}},{key:"reset",value:function(){this.events={}}}])}();function g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function b(t){return new Promise((function(e){return setTimeout(e,t)}))}function w(t,e){if(t===e)return!0;if("object"!==f(t)||"object"!==f(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!w(t[a],e[a]))return!1}return!0}var _=function(){return a((function t(e,r){n(this,t),this.game=e,this.prefix=r}),[{key:"log",value:function(t){if(this.game.config.app.logger.log){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"info",value:function(t){if(this.game.config.app.logger.info){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).info.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"warn",value:function(t){if(this.game.config.app.logger.warn){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).warn.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"error",value:function(t){if(this.game.config.app.logger.error){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).error.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"debug",value:function(t){if(this.game.config.app.logger.debug){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).debug.apply(e,u(this._log.apply(this,[t].concat(r))))}}},{key:"trace",value:function(t){if(this.game.config.app.logger.trace){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console.trace(this._log.apply(this,[t].concat(n)))}}},{key:"_log",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===n.length?[this.prefix||"",t]:["".concat(this.prefix||""," [").concat(t,"]")].concat(n)}}])}(),S=function(){return a((function t(e){n(this,t),this.abortHandler=e,this.events=new m,this.aborted=!1}),[{key:"abort",value:function(){return this.aborted||(this.aborted=!0,this.result=this.abortHandler.apply(this,arguments)),this.result}},{key:"isAborted",value:function(){return this.aborted}},{key:"cancel",value:function(){this.aborted=!0}}])}();function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return A(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,P(r.key),r)}}function O(t,e,n){return e&&E(t.prototype,e),n&&E(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function P(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==k(e)?e:e+""}S.EventTypes={"event:skipController.abort":"event:skipController.abort"};var j=function(){function t(e,n,r){T(this,t),this.name=e,this.key=r||e,this.content=d({},n)}return O(t,[{key:"set",value:function(e,n){return t.isSerializable(n)?(this.content[e]=n,this):(console.warn('Value "'.concat(n,'" in key "').concat(String(e),'" is not serializable, and will not be set\nat namespace "').concat(this.name,'"')),this.content[e]=n,this)}},{key:"get",value:function(t){return this.content[t]}},{key:"toData",value:function(){return this.serialize()}},{key:"load",value:function(t){t?this.content=t:console.warn("No data to load")}},{key:"serialize",value:function(){var t=this,e={};return Object.entries(this.content).forEach((function(n){var r=x(n,2),o=r[0],i=r[1];e[o]=t.wrap(i)})),e}},{key:"deserialize",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=x(t,2),r=n[0],o=n[1];e.content[r]=e.unwrap(o)})):console.warn("No data to load")}},{key:"toTypeName",value:function(t){return t instanceof Date?"date":"any"}},{key:"wrap",value:function(t){return{any:function(t){return{type:"any",data:t}},date:function(t){return{type:"date",data:t.toString()}}}[this.toTypeName(t)](t)}},{key:"unwrap",value:function(t){var e={any:function(t){return t.data},date:function(t){return new Date(t.data)}};return e[t.type](t)}}],[{key:"isSerializable",value:function(e){return!!["number","string","boolean"].includes(k(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===k(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),C=function(){return O((function t(){T(this,t),this.namespaces={}}),[{key:"addNamespace",value:function(t){return this.namespaces[t.key]=t,this}},{key:"getNamespace",value:function(t){return this.namespaces[t]}},{key:"setNamespace",value:function(t,e){return this.namespaces[t]=e,this}},{key:"getNamespaces",value:function(){return this.namespaces}},{key:"keys",value:function(){return Object.keys(this.namespaces)}},{key:"values",value:function(){return Object.values(this.namespaces)}},{key:"entries",value:function(){return Object.entries(this.namespaces)}},{key:"toData",value:function(){return this.entries().reduce((function(t,e){var n=x(e,2),r=n[0],o=n[1];return t[r]=o.toData(),t}),{})}},{key:"load",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=x(t,2),r=n[0],o=n[1];e.namespaces[r]?e.namespaces[r].load(o):console.warn("Namespace ".concat(r," not found in ").concat(e.constructor.name))})):console.warn("No data to load")}}])}();function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function M(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,L(r.key),r)}}function L(t){var e=function(t,e){if("object"!=I(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==I(e)?e:e+""}var N=r(196);function R(t){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(t)}function F(t){return function(t){if(Array.isArray(t))return V(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 V(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)?V(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 V(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 D(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,B(r.key),r)}}function B(t){var e=function(t,e){if("object"!=R(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==R(e)?e:e+""}var U=function(){return function(t,e,n){return e&&D(t.prototype,e),n&&D(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={sounds:[],srcManagers:[],elements:[]},this.currentHandling=null,this.stage=n,this.game=e,this.events=new m,this.logger=new _(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByImage",value:function(t){return this.state.elements.find((function(e){return e.ele.images.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this._getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=this.createWaitableAction({character:e.character,sentence:e,id:t},(function(){i.splice(i.indexOf(a),1),n&&n()}));i.push(a)}},{key:"createMenu",value:function(t,e,n){var r;if(!t.choices.length)throw new Error("Menu must have at least one choice");var o=null===(r=this.findElementByScene(this._getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!o)throw new Error("Scene not found");var i=this.createWaitableAction(t,(function(t){o.splice(o.indexOf(i),1),e&&e(t)}));o.push(i)}},{key:"createImage",value:function(t,e){var n=this._getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.images.push(t),this):this}},{key:"disposeImage",value:function(t,e){var n,r=this._getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.images;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Image not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),n._liveState.active=!1,n.events.reset()}))}},{key:"playSound",value:function(t,e){var n=t.play(),r=[t.once("end",o.bind(this)),t.once("stop",o.bind(this))];function o(){e&&e(),r.forEach((function(t){return t.off()})),this.stage.next()}return n}},{key:"getHowl",value:function(){return N.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(F(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{images:t.ele.images.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,i=e.get(r);if(!i)throw new Error("Scene not found, id: "+r+"\nNarraLeaf cannot find the element with the id from the saved game");var a={scene:i,ele:{images:o.images.map((function(t){if(!e.has(t))throw new Error("Image not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game");return e.get(t)})),menus:[],texts:[]}};n.state.elements.push(a),n.state.srcManagers.push(a.scene.srcManager)}))}},{key:"getElementMap",value:function(){return{texts:[],menus:[],images:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"_getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new Error('Scene not found, please call "scene.activate()" first.');return e}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}])}();function H(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=H(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}U.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip"};const G=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=H(t))&&(r&&(r+=" "),r+=e);return r};var $=r(12),z=r.n($);function W(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 q(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)?q(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 q(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 Y(t){return Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Y(t)}function X(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,K(r.key),r)}}function K(t){var e=function(t,e){if("object"!=Y(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Y(e)?e:e+""}var Z=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={width:0,height:0,minWidth:800,minHeight:450,paused:!1},this.events=new m,this.lockers=[],this.updater=null}return function(t,e,n){return e&&X(t.prototype,e),n&&X(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n){this.state.width=e,this.state.height=n,this.events.emit(t.EventTypes["event:aspectRatio.update"],e,n)}},{key:"updateMin",value:function(t,e){this.state.minWidth=t,this.state.minHeight=e}},{key:"lock",value:function(){var t=Symbol();return this.lockers.push(t),t}},{key:"unlock",value:function(t){if(t&&!this.lockers.includes(t))throw new Error("Locker not found");return this.lockers=this.lockers.filter((function(e){return e!==t})),this.triggerUpdate(),null}},{key:"isLocked",value:function(){return!!this.lockers.length}},{key:"getStyle",value:function(){return{width:"".concat(this.state.width,"px"),height:"".concat(this.state.height,"px")}}},{key:"setUpdate",value:function(t){this.updater=t}},{key:"pause",value:function(){this.state.paused=!0,this.events.emit(t.EventTypes["event:aspectRatio.pause"])}},{key:"resume",value:function(){this.state.paused=!1,this.events.emit(t.EventTypes["event:aspectRatio.resume"])}},{key:"onUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.update"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.update"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();Z.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume"};var Q=(0,$.createContext)(null);function J(t){var e=t.children,n=W((0,$.useState)(new Z),1)[0];return z().createElement(Q.Provider,{value:{ratio:n}},e)}function tt(){var t=(0,$.useContext)(Q);if(!Q||!t)throw new Error("useRatio must be used within a RatioProvider");var e=W((0,$.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,$.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function et(t){var e=t.children,n=t.className,r=tt().ratio,o=r.getStyle();return z().createElement("div",{className:G("inset-0 flex items-center justify-center",n),style:{width:"100%",height:"100%",minWidth:"".concat(r.state.minWidth,"px"),minHeight:"".concat(r.state.minHeight,"px")}},z().createElement("div",{style:Object.assign(Object.assign({},o),{position:"relative"})},e))}function nt(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 rt(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)?rt(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 rt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}const ot=function(t){var e=t.text,n=t.speed,r=t.onComplete,o=t.className,i=nt((0,$.useState)(""),2),a=i[0],s=i[1],u=nt((0,$.useState)(0),2),c=u[0],l=u[1];return(0,$.useEffect)((function(){if(c<e.length){if(" "!==e[c]){var t=setTimeout((function(){s((function(t){return t+e[c]})),l((function(t){return t+1}))}),n);return function(){return clearTimeout(t)}}s((function(t){return t+" "})),l((function(t){return t+1}))}else r&&r()}),[c,e,n,r]),z().createElement("span",{className:o},a)};function it(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return at(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function at(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var st=z().createContext(null);function ut(t){var e=t.children,n=t.game,r=new pe({}),o=it((0,$.useState)(n||r),2),i=o[0],a=o[1];return z().createElement(st.Provider,{value:{game:i,setGame:a}},e)}function ct(){var t=(0,$.useContext)(st);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function lt(t){return lt="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},lt(t)}function ft(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,pt(r.key),r)}}function pt(t){var e=function(t,e){if("object"!=lt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=lt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==lt(e)?e:e+""}var dt,ht=function(){return function(t,e,n){return e&&ft(t.prototype,e),n&&ft(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}}])}();function yt(t){return yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(t)}function vt(t){return function(t){if(Array.isArray(t))return mt(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 mt(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)?mt(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 mt(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 gt(t,e,n){return e=wt(e),function(t,e){if(e&&("object"==yt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,bt()?Reflect.construct(e,n||[],wt(t).constructor):e.apply(t,n))}function bt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(bt=function(){return!!t})()}function wt(t){return wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wt(t)}function _t(t,e){return _t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_t(t,e)}function St(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,At(r.key),r)}}function xt(t,e,n){return e&&kt(t.prototype,e),n&&kt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function At(t){var e=function(t,e){if("object"!=yt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=yt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yt(e)?e:e+""}var Tt=Symbol("_Chained"),Et=function(){function t(e){St(this,t),this[dt]=!0,this.__actions=[],this.__self=e}return xt(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:"isChained",value:function(t){return t&&t[Tt]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(2)}}])}();dt=Tt;var Ot=function(t){function e(){return St(this,e),gt(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&&_t(t,e)}(e,t),xt(e,[{key:"chain",value:function(t){var e=Et.isChained(this)?this:this.proxy(this,new Et(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,vt(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}}])}(ht);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 jt(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,Ct(r.key),r)}}function Ct(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 It(t,e,n){return e=Lt(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,Mt()?Reflect.construct(e,n||[],Lt(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 Lt(t){return Lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Lt(t)}function Nt(t,e){return Nt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Nt(t,e)}var Rt=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)}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&&Nt(t,e)}(e,t),function(t,e,n){return e&&jt(t.prototype,e),n&&jt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromData",value:function(t){return this}},{key:"fromChained",value:function(t){return t.getActions()}}])}(Ot);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 Vt(t,e,n){return e=Bt(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,Dt()?Reflect.construct(e,n||[],Bt(t).constructor):e.apply(t,n))}function Dt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Dt=function(){return!!t})()}function Bt(t){return Bt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bt(t)}function Ut(t,e){return Ut=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ut(t,e)}function Ht(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 $t(t,e,n){return e&&Gt(t.prototype,e),n&&Gt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function zt(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+""}var Wt=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ht(this,t),this.character=e,this.text=this.format(n),this.config=d(t.defaultConfig,r),this.id=pe.getIdManager().getStringId(),this.state=y(t.defaultState)}return $t(t,[{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)Yt.isWord(t[n])?e.push(t[n]):e.push(new Yt(t[n]));else e.push(Yt.isWord(t)?t:new Yt(t));return e}},{key:"toData",value:function(){return w(this.state,t.defaultState)?null:{state:y(this.state)}}},{key:"fromData",value:function(t){return this.state=d(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(null,e)}}])}();Wt.defaultConfig={color:"#000",pause:!0,voice:null},Wt.defaultState={display:!0};var qt,Yt=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ht(this,t),this.text=e,this.config=d(t.defaultConfig,n)}return $t(t,null,[{key:"isWord",value:function(e){return e instanceof t}}])}();Yt.defaultConfig={},Yt.defaultColor="#000",function(t){t.adv="adv",t.nvl="nvl"}(qt||(qt={}));var Xt=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ht(this,e),(n=Vt(this,e)).name=t,n.config=d({},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&&Ut(t,e)}(e,t),$t(e,[{key:"say",value:function(t){var e=Array.isArray(t)?new Wt(this,t,{}):Wt.isSentence(t)?t:new Wt(this,t,{}),n=new vs(this.chain(),vs.ActionTypes.say,new Ee(pe.getIdManager().getStringId()).setContent(e));return this.chain(n)}}])}(Rt);function Kt(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 Zt(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)?Zt(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 Zt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Qt(t){var e,n=t.action,r=t.onClick,o=t.useTypeEffect,i=void 0===o||o,a=t.className,s=t.state,u=n.sentence,c=n.character,l=Kt((0,$.useState)(0),2),f=l[0],p=l[1],d=Kt((0,$.useState)(!1),2),h=d[0],y=d[1],m=ct().game,g=function(){p((function(t){return t+1})),f===u.text.length-1&&y(!0)};return(0,$.useEffect)((function(){if(window){var t=function(t){m.config.elements.say.nextKey.includes(t.key)&&(h?r&&r():y(!0))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[h]),(0,$.useEffect)((function(){var t=s.events.onEvents([{type:U.EventTypes["event:state.player.skip"],listener:s.events.on(U.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),y(!0),r&&r()}))}]);return function(){t.cancel()}})),z().createElement(et,{className:"absolute"},u.state.display&&(c&&c.config.mode!==Xt.Modes.adv?z().createElement(z().Fragment,null," "):z().createElement("div",{className:G("absolute flex items-center justify-center bottom-0 w-[calc(100%-40px)] h-[calc(33%-40px)] m-4 bg-white",m.config.elementStyles.say.container,a),onClick:function(){h?r&&r():y(!0)}},z().createElement("div",{className:G("absolute top-0 left-0 p-1.25 rounded-br-md m-4",m.config.elementStyles.say.nameText)},(null===(e=u.character)||void 0===e?void 0:e.name)||""),z().createElement("div",{className:G("text-center max-w-[80%] mx-auto",m.config.elementStyles.say.textContainer)},u.text.map((function(t,e){var n=t.config.color||u.config.color||Yt.defaultColor;return h?z().createElement("span",{key:e,style:{color:"string"==typeof n?n:v(n)},className:G(m.config.elementStyles.say.textSpan)},t.text):e>f?null:z().createElement("span",{key:e,style:{color:v(n)},className:G(m.config.elementStyles.say.textSpan)},i?z().createElement(ot,{text:t.text,onComplete:e===f?g:void 0,speed:m.config.elements.say.textInterval,className:G(m.config.elementStyles.say.textSpan)}):t.text)}))))))}function Jt(t){var e=t.sentence,n=t.className;return z().createElement(z().Fragment,null,e.text.map((function(t,r){var o=t.config.color||e.config.color||Yt.defaultColor;return z().createElement("span",{key:r,style:{color:v(o)},className:n},t.text)})))}Xt.Modes=qt,Xt.defaultConfig={mode:qt.adv};var te={say:Qt,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=ct().game,a=i.config.elements.say.use;return z().createElement(z().Fragment,null,z().createElement(et,{className:"absolute"},z().createElement("div",{className:"absolute flex flex-col items-center justify-center min-w-full w-full h-full"},e&&z().createElement(a,{state:o,action:{sentence:e,character:null},useTypeEffect:!1,className:"z-10"}))),z().createElement(et,{className:"absolute"},z().createElement("div",{className:G("absolute flex flex-col items-center justify-center min-w-full w-full h-full",i.config.elementStyles.menu.container)},z().createElement("div",{className:"p-4 rounded-lg w-full z-20"},z().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},n.map((function(t,e){return z().createElement("button",{key:e,className:G("bg-white text-black p-2 mt-2 w-1/2",i.config.elementStyles.menu.choiceButton),onClick:function(){return function(t){r(t)}(t)}},z().createElement(Jt,{key:e,sentence:t.prompt,className:G(i.config.elementStyles.menu.choiceButtonText)}))})))))))}};function ee(t){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ee(t)}function ne(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function re(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,ie(r.key),r)}}function oe(t,e,n){return e&&re(t.prototype,e),n&&re(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ie(t){var e=function(t,e){if("object"!=ee(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ee(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ee(e)?e:e+""}function ae(t,e,n){return e=ue(e),function(t,e){if(e&&("object"==ee(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,se()?Reflect.construct(e,n||[],ue(t).constructor):e.apply(t,n))}function se(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(se=function(){return!!t})()}function ue(t){return ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ue(t)}function ce(t,e){return ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ce(t,e)}var le,fe=function(t){function e(){var t;return ne(this,e),(t=ae(this,e,arguments)).id=0,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ce(t,e)}(e,t),oe(e,[{key:"getId",value:function(){return this.id++}},{key:"getStringId",value:function(){return(this.id++).toString()}},{key:"prefix",value:function(t,e){return t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:":")+e}}])}(function(){var t=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return function(t,e,n){return e&&M(t.prototype,e),n&&M(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"getInstance",value:function(){return t._instance||(t._instance=new this),t._instance}}])}();return t._instance=null,t}());!function(t){t.game="game"}(le||(le={}));var pe=function(){return oe((function t(e){ne(this,t),this.liveGame=null,this.config=d(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(te).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 de(this)}}],[{key:"getIdManager",value:function(){return fe.getInstance()}}])}();pe.defaultSettings={volume:1},pe.ComponentTypes={say:"say",menu:"menu"},pe.DefaultConfig={version:"v0.0.0",player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:"100%",height:"100%",skipKey:["Control"],skipInterval:100},elements:{say:{nextKey:[" "],textInterval:50,use:te.say},img:{slowLoadWarning:!0,slowLoadThreshold:2e3},menu:{use:te.menu}},elementStyles:{say:{container:"",nameText:"",textContainer:"",textSpan:""},menu:{container:"",choiceButton:"",choiceButtonText:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1}}},pe.GameSettingsNamespace=le;var de=function(){function t(e){ne(this,t),this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this._lockedCount=0,this.currentAction=null,this.game=e,this.storable=new C,this.initNamespaces()}return oe(t,[{key:"initNamespaces",value:function(){return this.storable.addNamespace(new j(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t.constructStory(),this}},{key:"newGame",value:function(){var t,e;this.initNamespaces(),this.currentAction=(null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.sceneRoot)||null;var n=this.getNewSavedGame();return n.name="NewGame-"+Date.now(),this.currentSavedGame=n,this}},{key:"deserialize",value:function(t,e){var n,r=e.gameState,o=this.story;if(!o)throw new Error("No story loaded");this.reset({gameState:r});var i=new Map,a=new Map,s=t.game,u=s.store,c=s.stage,l=s.elementStates,f=s.currentAction;if(o.forEachChild((null===(n=o.entryScene)||void 0===n?void 0:n.sceneRoot)||[],(function(t){i.set(t.getId(),t),a.set(t.callee.getId(),t.callee)})),this.storable.load(u),l.forEach((function(t){var e=t.id,n=t.data,r=a.get(e);if(!r)throw new Error("Element not found, id: "+e+"\nNarraLeaf cannot find the element with the id from the saved game");r.fromData(n)})),this.currentSavedGame=t,r.loadData(c,a),f){var p=i.get(f);if(!p)throw new Error("Action not found, id: "+f+"\nNarraLeaf cannot find the action with the id from the saved game");this.currentAction=p}}},{key:"reset",value:function(t){var e,n,r=t.gameState;this.currentAction=(null===(n=null===(e=this.story)||void 0===e?void 0:e.entryScene)||void 0===n?void 0:n.sceneRoot)||null,this.lockedAwaiting=null,this.currentSavedGame=null,r.forceReset()}},{key:"serialize",value:function(t){var e,n,r,o=t.gameState,i=this.story;if(!i)throw new Error("No story loaded");var a=this.storable.toData(),s=o.toData(),u=(null===(e=this.getCurrentAction())||void 0===e?void 0:e.getId())||null,c=i.getAllElementStates();return{name:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.name)||"",meta:{created:(null===(r=this.currentSavedGame)||void 0===r?void 0:r.meta.created)||Date.now(),updated:Date.now()},game:{store:a,stage:s,currentAction:u,elementStates:c}}}},{key:"getCurrentAction",value:function(){return this.currentAction}},{key:"setCurrentAction",value:function(t){return this.currentAction=t,this}},{key:"next",value:function(t){var e,n,r;if(!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("Locked awaiting");return this.lockedAwaiting}var o=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==o?void 0:o.node)||void 0===e?void 0:e.action)||null,t.logger.debug("next action",o),this.lockedAwaiting=null,o||null}if(!this.currentAction)return t.events.emit(U.EventTypes["event:state.end"]),t.logger.warn("LiveGame","No current action"),null;var i=this.currentAction.executeAction(t);return h.isAwaitable(i)?(this.lockedAwaiting=i,i):(t.logger.debug("next action",i),this._lockedCount=0,this.currentAction=(null===(r=null===(n=i.node)||void 0===n?void 0:n.getChild())||void 0===r?void 0:r.action)||null,i)}},{key:"abortAwaiting",value:function(){var t;if(this.lockedAwaiting){var e=this.lockedAwaiting.abort();this.currentAction=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.action)||null,this.lockedAwaiting=null}}},{key:"executeAction",value:function(t,e){var n,r,o=e.executeAction(t);return h.isAwaitable(o)?o:(null===(r=null===(n=null==o?void 0:o.node)||void 0===n?void 0:n.getChild())||void 0===r?void 0:r.action)||null}},{key:"getNewSavedGame",value:function(){var t,e,n;return{name:"",meta:{created:Date.now(),updated:Date.now()},game:{store:{},stage:{scenes:[]},elementStates:[],currentAction:(null===(n=null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.sceneRoot)||void 0===n?void 0:n.getId())||null}}}}])}();de.DefaultNamespaces={game:{}},de.GameSpacesKey={game:"game"};function he(t){return he="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},he(t)}function ye(t,e,n){return e=me(e),function(t,e){if(e&&("object"==he(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,ve()?Reflect.construct(e,n||[],me(t).constructor):e.apply(t,n))}function ve(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ve=function(){return!!t})()}function me(t){return me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},me(t)}function ge(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&&be(t,e)}function be(t,e){return be=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},be(t,e)}function we(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ke(r.key),r)}}function Se(t,e,n){return e&&_e(t.prototype,e),n&&_e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ke(t){var e=function(t,e){if("object"!=he(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=he(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==he(e)?e:e+""}var xe;!function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(xe||(xe={}));var Ae,Te=function(){return Se((function t(e,n){we(this,t),this.id=e,this.type=n,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}(),Ee=function(t){function e(t,n,r,o){var i;return we(this,e),(i=ye(this,e,[pe.getIdManager().prefix("node",t,"-"),xe.ContentNode])).child=o||null,i.parent=r||null,i.action=n||null,i}return ge(e,t),Se(e,[{key:"setParent",value:function(t){if(t===this)throw new Error("Cannot set parent to itself");return this.parent=t,this}},{key:"setChild",value:function(t){if(t===this)throw new Error("Cannot set child to itself");return this.child=t,t&&t.parent!==this&&t.remove().setParent(this),this}},{key:"getChild",value:function(){return this.child||null}},{key:"getParent",value:function(){return this.parent||null}},{key:"setInitChild",value:function(t){return this.initChild=t,this.setChild(t)}},{key:"addChild",value:function(t){return this.setChild(t),this}},{key:"removeChild",value:function(t){return t&&this.child===t?(this.child=null,t.setParent(null)):t||(this.child=null),this}},{key:"remove",value:function(){var t;return null===(t=this.parent)||void 0===t||t.removeChild(this),this}},{key:"hasChild",value:function(){return!!this.child}}],[{key:"forEachParent",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getParent()}},{key:"forEachChild",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getChild()}}])}(Te),Oe={center:"center",left:"left",right:"right"};function Pe(t){return Pe="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},Pe(t)}function je(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ce(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,Le(r.key),r)}}function Ie(t,e,n){return e&&Ce(t.prototype,e),n&&Ce(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Me(t,e,n){return(e=Le(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Le(t){var e=function(t,e){if("object"!=Pe(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Pe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pe(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(Ae||(Ae={}));var Ne=Me(Me(Me({},Ae.Left,"33.33%"),Ae.Center,"50%"),Ae.Right,"66.66%"),Re=function(){function t(){je(this,t)}return Ie(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"".concat(e);var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + ").concat(n,"px)")}},{key:"toCoord2D",value:function(t){if(Fe.isCommonPositionType(t))return Ve.fromCommonPosition(t);if(Ve.isCoord2DPosition(t))return t;if(De.isAlignPosition(t))return Ve.fromAlignPosition(t);if("object"===Pe(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new Ve(t);throw new Error("Invalid position type")}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return Ve.merge(n,r)}},{key:"serializePosition",value:function(e){var n=this.toCoord2D(e);return{x:t.isUnknown(n.x)?0:n.x,y:t.isUnknown(n.y)?0:n.y,xoffset:t.isUnknown(n.xoffset)?0:n.xoffset,yoffset:t.isUnknown(n.yoffset)?0:n.yoffset}}},{key:"isRawCommonPositionType",value:function(t){return Object.values(Ae).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===Pe(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===Pe(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 Fe||t instanceof Ve||t instanceof De}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return Ve.fromCommonPosition(new Fe(t));if(this.isRawCoord2DPosition(t))return new Ve(t);if(this.isRawAlignPosition(t))return Ve.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")}}])}();Re.Unknown=Symbol("Unknown");var Fe=function(){function t(e){je(this,t),this.position=e}return Ie(t,[{key:"toCSS",value:function(){return{x:Ne[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();Fe.Positions=Ae;var Ve=function(){function t(e,n){je(this,t),"object"===Pe(e)?(this.x=e.x||Re.Unknown,this.y=e.y||Re.Unknown,this.xoffset=e.xoffset||Re.Unknown,this.yoffset=e.yoffset||Re.Unknown):(this.x=e||Re.Unknown,this.y=n||Re.Unknown,this.xoffset=Re.Unknown,this.yoffset=Re.Unknown)}return Ie(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:Ne[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:Re.isUnknown(e.xalign)?Re.Unknown:"".concat(100*e.xalign,"%"),y:Re.isUnknown(e.yalign)?Re.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:Re.isUnknown(n.x)?e.x:n.x,y:Re.isUnknown(n.y)?e.y:n.y,xoffset:Re.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:Re.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),De=function(){function t(e,n){je(this,t),"object"===Pe(e)?(this.xalign=e.xalign||Re.Unknown,this.yalign=e.yalign||Re.Unknown,this.xoffset=e.xoffset||Re.Unknown,this.yoffset=e.yoffset||Re.Unknown):(this.xalign=e||Re.Unknown,this.yalign=n||Re.Unknown,this.xoffset=Re.Unknown,this.yoffset=Re.Unknown)}return Ie(t,[{key:"toCSS",value:function(){return{x:Re.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:Re.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();const Be=t=>t;let Ue=Be,He=Be;function Ge(t,e,n){var r;if("string"==typeof t){let o=document;e&&(He(Boolean(e.current),"Scope provided, but no element detected."),o=e.current),n?(null!==(r=n[t])&&void 0!==r||(n[t]=o.querySelectorAll(t)),t=n[t]):t=o.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}const $e=new WeakMap,ze=!1,We=!1;const qe=["read","resolveKeyframes","update","preRender","render","postRender"];function Ye(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=qe.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,d=()=>{const i=We?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(d))};return{schedule:qe.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(d)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<qe.length;e++)a[qe[e]].cancel(t)},state:o,steps:a}}const{schedule:Xe,cancel:Ke,state:Ze,steps:Qe}=Ye("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Be,!0);function Je(t){let e;return()=>(void 0===e&&(e=t()),e)}const tn=Je((()=>void 0!==window.ScrollTimeline));class en{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map((e=>{if(!tn()||!e.attachTimeline)return e.pause(),function(t,e){let n;const r=()=>{const{currentTime:r}=e,o=(null===r?0:r.value)/100;n!==o&&t(o),n=o};return Xe.update(r,!0),()=>Ke(r)}((t=>{e.time=e.duration*t}),t);e.attachTimeline(t)}));return()=>{e.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const nn=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],rn=new Set(nn),on=t=>1e3*t,an=t=>t/1e3,sn={type:"spring",stiffness:500,damping:25,restSpeed:10},un={type:"keyframes",duration:.8},cn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ln=(t,{keyframes:e})=>e.length>2?un:rn.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:sn:cn;function fn(t,e){return t[e]||t.default||t}const pn=!1,dn=t=>null!==t;function hn(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(dn),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const yn=t=>/^0[^.\s]+$/u.test(t);const vn=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),mn=t=>e=>"string"==typeof e&&e.startsWith(t),gn=mn("--"),bn=mn("var(--"),wn=t=>!!bn(t)&&_n.test(t.split("/*")[0].trim()),_n=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Sn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function kn(t,e,n=1){He(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=Sn.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 vn(t)?parseFloat(t):t}return wn(o)?kn(o,e,n+1):o}const xn=(t,e,n)=>n>e?e:n<t?t:n,An={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Tn={...An,transform:t=>xn(0,1,t)},En={...An,default:1},On=t=>Math.round(1e5*t)/1e5,Pn=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,jn=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Cn=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function In(t){return"string"==typeof t}const Mn=t=>({test:e=>In(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Ln=Mn("deg"),Nn=Mn("%"),Rn=Mn("px"),Fn=Mn("vh"),Vn=Mn("vw"),Dn={...Nn,parse:t=>Nn.parse(t)/100,transform:t=>Nn.transform(100*t)},Bn=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Un=t=>t===An||t===Rn,Hn=(t,e)=>parseFloat(t.split(", ")[e]),Gn=(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}},$n=new Set(["x","y","z"]),zn=nn.filter((t=>!$n.has(t)));const Wn={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:Gn(4,13),y:Gn(5,14)};Wn.translateX=Wn.x,Wn.translateY=Wn.y;const qn=t=>e=>e.test(t),Yn=[An,Rn,Nn,Ln,Vn,Fn,{test:t=>"auto"===t,parse:t=>t}],Xn=t=>Yn.find(qn(t)),Kn=new Set;let Zn=!1,Qn=!1;function Jn(){if(Qn){const t=Array.from(Kn).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 zn.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)}))}Qn=!1,Zn=!1,Kn.forEach((t=>t.complete())),Kn.clear()}function tr(){Kn.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Qn=!0)}))}class er{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?(Kn.add(this),Zn||(Zn=!0,Xe.read(tr),Xe.resolveKeyframes(Jn))):(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),Kn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Kn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const nr=(t,e)=>n=>Boolean(In(n)&&Cn.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),rr=(t,e,n)=>r=>{if(!In(r))return r;const[o,i,a,s]=r.match(Pn);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},or={...An,transform:t=>Math.round((t=>xn(0,255,t))(t))},ir={test:nr("rgb","red"),parse:rr("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+or.transform(t)+", "+or.transform(e)+", "+or.transform(n)+", "+On(Tn.transform(r))+")"};const ar={test:nr("#"),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:ir.transform},sr={test:nr("hsl","hue"),parse:rr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Nn.transform(On(e))+", "+Nn.transform(On(n))+", "+On(Tn.transform(r))+")"},ur={test:t=>ir.test(t)||ar.test(t)||sr.test(t),parse:t=>ir.test(t)?ir.parse(t):sr.test(t)?sr.parse(t):ar.parse(t),transform:t=>In(t)?t:t.hasOwnProperty("red")?ir.transform(t):sr.transform(t)};const cr="number",lr="color",fr="var",pr="var(",dr="${}",hr=/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 yr(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(hr,(t=>(ur.test(t)?(r.color.push(i),o.push(lr),n.push(ur.parse(t))):t.startsWith(pr)?(r.var.push(i),o.push(fr),n.push(t)):(r.number.push(i),o.push(cr),n.push(parseFloat(t))),++i,dr))).split(dr);return{values:n,split:a,indexes:r,types:o}}function vr(t){return yr(t).values}function mr(t){const{split:e,types:n}=yr(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===cr?On(t[i]):e===lr?ur.transform(t[i]):t[i]}return o}}const gr=t=>"number"==typeof t?0:t;const br={test:function(t){var e,n;return isNaN(t)&&In(t)&&((null===(e=t.match(Pn))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(jn))||void 0===n?void 0:n.length)||0)>0},parse:vr,createTransformer:mr,getAnimatableNone:function(t){const e=vr(t);return mr(t)(e.map(gr))}},wr=new Set(["brightness","contrast","saturate","opacity"]);function _r(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(Pn)||[];if(!r)return t;const o=n.replace(r,"");let i=wr.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const Sr=/\b([a-z-]*)\(.*?\)/gu,kr={...br,getAnimatableNone:t=>{const e=t.match(Sr);return e?e.map(_r).join(" "):t}},xr={...An,transform:Math.round},Ar={borderWidth:Rn,borderTopWidth:Rn,borderRightWidth:Rn,borderBottomWidth:Rn,borderLeftWidth:Rn,borderRadius:Rn,radius:Rn,borderTopLeftRadius:Rn,borderTopRightRadius:Rn,borderBottomRightRadius:Rn,borderBottomLeftRadius:Rn,width:Rn,maxWidth:Rn,height:Rn,maxHeight:Rn,size:Rn,top:Rn,right:Rn,bottom:Rn,left:Rn,padding:Rn,paddingTop:Rn,paddingRight:Rn,paddingBottom:Rn,paddingLeft:Rn,margin:Rn,marginTop:Rn,marginRight:Rn,marginBottom:Rn,marginLeft:Rn,rotate:Ln,rotateX:Ln,rotateY:Ln,rotateZ:Ln,scale:En,scaleX:En,scaleY:En,scaleZ:En,skew:Ln,skewX:Ln,skewY:Ln,distance:Rn,translateX:Rn,translateY:Rn,translateZ:Rn,x:Rn,y:Rn,z:Rn,perspective:Rn,transformPerspective:Rn,opacity:Tn,originX:Dn,originY:Dn,originZ:Rn,zIndex:xr,backgroundPositionX:Rn,backgroundPositionY:Rn,fillOpacity:Tn,strokeOpacity:Tn,numOctaves:xr},Tr={...Ar,color:ur,backgroundColor:ur,outlineColor:ur,fill:ur,stroke:ur,borderColor:ur,borderTopColor:ur,borderRightColor:ur,borderBottomColor:ur,borderLeftColor:ur,filter:kr,WebkitFilter:kr},Er=t=>Tr[t];function Or(t,e){let n=Er(t);return n!==kr&&(n=br),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Pr=new Set(["auto","none","0"]);class jr extends er{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(),wn(r))){const o=kn(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Bn.has(n)||2!==t.length)return;const[r,o]=t,i=Xn(r),a=Xn(o);if(i!==a)if(Un(i)&&Un(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||yn(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&&!Pr.has(e)&&yr(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=Or(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=Wn[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]=Wn[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 Cr;function Ir(){Cr=void 0}const Mr={now:()=>(void 0===Cr&&Mr.set(Ze.isProcessing||We?Ze.timestamp:performance.now()),Cr),set:t=>{Cr=t,queueMicrotask(Ir)}},Lr=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!br.test(t)&&"0"!==t||t.startsWith("url(")));class Nr{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=Mr.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||(tr(),Jn()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Mr.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!function(t,e,n,r){const o=t[0];if(null===o)return!1;if("display"===e||"visibility"===e)return!0;const i=t[t.length-1],a=Lr(o,e),s=Lr(i,e);return Ue(a===s,`You are trying to animate ${e} from "${o}" to "${i}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${i} via the \`style\` property.`),!(!a||!s)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||"spring"===n&&r)}(t,n,r,o)){if(pn||!i)return null==s||s(hn(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 Rr(t,e){return e?t*(1e3/e):0}const Fr=5;function Vr(t,e,n){const r=Math.max(e-Fr,0);return Rr(n-t(r),e-r)}const Dr=.001,Br=.01,Ur=10,Hr=.05,Gr=1;function $r({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;Ue(t<=on(Ur),"Spring duration must be 10 seconds or less");let a=1-e;a=xn(Hr,Gr,a),t=xn(Br,Ur,an(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=Wr(e,a),u=Math.exp(-o);return Dr-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=Wr(Math.pow(e,2),a);return(-o(e)+Dr>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-Dr,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<zr;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=on(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 zr=12;function Wr(t,e){return t*Math.sqrt(1-e*e)}const qr=["duration","bounce"],Yr=["stiffness","damping","mass"];function Xr(t,e){return e.some((e=>void 0!==t[e]))}function Kr({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(!Xr(t,Yr)&&Xr(t,qr)){const n=$r(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-an(r.velocity||0)}),d=f||0,h=u/(2*Math.sqrt(s*c)),y=i-o,v=an(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),h<1){const t=Wr(v,h);g=e=>{const n=Math.exp(-h*v*e);return i-n*((d+h*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===h)g=t=>i-Math.exp(-v*t)*(y+(d+v*y)*t);else{const t=v*Math.sqrt(h*h-1);g=e=>{const n=Math.exp(-h*v*e),r=Math.min(t*e,300);return i-n*((d+h*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;h<1&&(o=0===t?on(d):Vr(g,t,r));const s=Math.abs(o)<=n,u=Math.abs(i-r)<=e;a.done=s&&u}return a.value=a.done?i:r,a}}}function Zr({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},d=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let h=n*e;const y=f+h,v=void 0===a?y:a(y);v!==y&&(h=v-f);const m=t=>-h*Math.exp(-t/r),g=t=>v+m(t),b=t=>{const e=m(t),n=g(t);p.done=Math.abs(e)<=c,p.value=p.done?v:n};let w,_;const S=t=>{var e;(e=p.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,_=Kr({keyframes:[p.value,d(p.value)],velocity:Vr(g,t,p.value),damping:o,stiffness:i,restDelta:c,restSpeed:l}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return _||void 0!==w||(e=!0,b(t),S(t)),void 0!==w&&t>=w?_.next(t-w):(!e&&b(t),p)}}}const Qr=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Jr=1e-7,to=12;function eo(t,e,n,r){if(t===e&&n===r)return Be;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Qr(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>Jr&&++s<to);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Qr(o(t),e,r)}const no=eo(.42,0,1,1),ro=eo(0,0,.58,1),oo=eo(.42,0,.58,1),io=t=>Array.isArray(t)&&"number"!=typeof t[0],ao=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,so=t=>e=>1-t(1-e),uo=t=>1-Math.sin(Math.acos(t)),co=so(uo),lo=ao(uo),fo=eo(.33,1.53,.69,.99),po=so(fo),ho={linear:Be,easeIn:no,easeInOut:oo,easeOut:ro,circIn:uo,circInOut:lo,circOut:co,backIn:po,backInOut:ao(po),backOut:fo,anticipate:t=>(t*=2)<1?.5*po(t):.5*(2-Math.pow(2,-10*(t-1)))},yo=t=>{if(Array.isArray(t)){He(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return eo(e,n,r,o)}return"string"==typeof t?(He(void 0!==ho[t],`Invalid easing type '${t}'`),ho[t]):t},vo=(t,e)=>n=>e(t(n)),mo=(...t)=>t.reduce(vo),go=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},bo=(t,e,n)=>t+(e-t)*n;function wo(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 _o(t,e){return n=>n>0?e:t}const So=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},ko=[ar,ir,sr];function xo(t){const e=(n=t,ko.find((t=>t.test(n))));var n;if(Ue(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===sr&&(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=wo(s,r,t+1/3),i=wo(s,r,t),a=wo(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=xo(t),r=xo(e);if(!n||!r)return _o(t,e);const o={...n};return t=>(o.red=So(n.red,r.red,t),o.green=So(n.green,r.green,t),o.blue=So(n.blue,r.blue,t),o.alpha=bo(n.alpha,r.alpha,t),ir.transform(o))},To=new Set(["none","hidden"]);function Eo(t,e){return n=>bo(t,e,n)}function Oo(t){return"number"==typeof t?Eo:"string"==typeof t?wn(t)?_o:ur.test(t)?Ao:Co:Array.isArray(t)?Po:"object"==typeof t?ur.test(t)?Ao:jo:_o}function Po(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>Oo(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function jo(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=Oo(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const Co=(t,e)=>{const n=br.createTransformer(e),r=yr(t),o=yr(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?To.has(t)&&!o.values.length||To.has(e)&&!r.values.length?function(t,e){return To.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):mo(Po(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):(Ue(!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.`),_o(t,e))};function Io(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return bo(t,e,n);return Oo(t)(t,e)}function Mo(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(He(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||Io,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]||Be:e;i=mo(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=go(t[n],t[n+1],e);return a[n](r)};return n?e=>u(xn(t[0],t[i-1],e)):u}function Lo(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=go(0,e,r);t.push(bo(n,1,o))}}function No(t){const e=[0];return Lo(e,t.length-1),e}function Ro({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=io(r)?r.map(yo):yo(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:No(e),t),s=Mo(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||oo)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const Fo=2e4;function Vo(t){let e=0;let n=t.next(e);for(;!n.done&&e<Fo;)e+=50,n=t.next(e);return e>=Fo?1/0:e}const Do=t=>{const e=({timestamp:e})=>t(e);return{start:()=>Xe.update(e,!0),stop:()=>Ke(e),now:()=>Ze.isProcessing?Ze.timestamp:Mr.now()}},Bo={decay:Zr,inertia:Zr,tween:Ro,keyframes:Ro,spring:Kr},Uo=t=>t/100;class Ho extends Nr{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)||er;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=Bo[e]||Ro;let s,u;a!==Ro&&"number"!=typeof t[0]&&(s=mo(Uo,Io(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=Vo(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:d,repeatDelay:h,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-f*(this.speed>=0?1:-1),m=this.speed>=0?v<0:v>c;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let g=this.currentTime,b=o;if(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"===d?(n=1-n,h&&(n-=h/l)):"mirror"===d&&(b=i)),g=xn(0,1,n)*l}const w=m?{done:!1,value:s[0]}:b.next(g);a&&(w.value=a(w.value));let{done:_}=w;m||null===u||(_=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&_);return S&&void 0!==r&&(w.value=hn(s,this.options,r)),y&&y(w.value),S&&this.finish(),w}get duration(){const{resolved:t}=this;return t?an(t.calculatedDuration):0}get time(){return an(this.currentTime)}set time(t){t=on(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=an(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Do,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 Go=new Set(["opacity","clipPath","filter","transform"]),$o=t=>Array.isArray(t)&&"number"==typeof t[0];function zo(t){return Boolean(!t||"string"==typeof t&&t in qo||$o(t)||Array.isArray(t)&&t.every(zo))}const Wo=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,qo={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Wo([0,.65,.55,1]),circOut:Wo([.55,0,1,.45]),backIn:Wo([.31,.01,.66,-.59]),backOut:Wo([.33,1.53,.69,.99])};function Yo(t){return Xo(t)||qo.easeOut}function Xo(t){return t?$o(t)?Wo(t):Array.isArray(t)?t.map(Yo):qo[t]:void 0}const Ko=Je((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class Zo extends Nr{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new jr(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:a,motionValue:s,name:u,startTime:c}=this.options;if(!(null===(n=s.owner)||void 0===n?void 0:n.current))return!1;if(function(t){return"spring"===t.type||!zo(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new Ho({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const o=[];let i=0;for(;!r.done&&i<2e4;)r=n.sample(i),o.push(r.value),i+=10;return{times:void 0,keyframes:o,duration:i-10,ease:"linear"}}(t,c);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,o=l.times,i=l.ease,a="keyframes"}const l=function(t,e,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:a="loop",ease:s,times:u}={}){const c={[e]:n};u&&(c.offset=u);const l=Xo(s);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(l.timeline=this.pendingTimeline,this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(hn(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 an(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return an(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=on(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 Be;const{animation:n}=e;n.timeline=t,n.onfinish=null}else this.pendingTimeline=t;return Be}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 Ho({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=on(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 Ko()&&n&&Go.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const Qo=(t,e,n,r={},o,i,a)=>s=>{const u=fn(r,t)||{},c=u.delay||r.delay||0;let{elapsed:l=0}=r;l-=on(c);let f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-l,onUpdate:t=>{e.set(t),u.onUpdate&&u.onUpdate(t)},onComplete:()=>{s(),u.onComplete&&u.onComplete(),a&&a()},onStop:a,name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(u)||(f={...f,...ln(t,f)}),f.duration&&(f.duration=on(f.duration)),f.repeatDelay&&(f.repeatDelay=on(f.repeatDelay)),void 0!==f.from&&(f.keyframes[0]=f.from);let p=!1;if((!1===f.type||0===f.duration&&!f.repeatDelay)&&(f.duration=0,0===f.delay&&(p=!0)),(pn||ze)&&(p=!0,f.duration=0,f.delay=0),p&&!i&&void 0!==e.get()){const t=hn(f.keyframes,u);if(void 0!==t)return Xe.update((()=>{f.onUpdate(t),f.onComplete()})),new en([])}return!i&&Zo.supports(f)?new Zo(f):new Ho(f)},Jo=t=>Array.isArray(t),ti=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),ei=t=>Jo(t)?t[t.length-1]||0:t;function ni(t,e){-1===t.indexOf(e)&&t.push(e)}function ri(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class oi{constructor(){this.subscriptions=[]}add(t){return ni(this.subscriptions,t),()=>ri(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 ii={current:void 0};class ai{constructor(t,e={}){this.version="11.5.4",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=Mr.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=Mr.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 oi);const n=this.events[t].add(e);return"change"===t?()=>{n(),Xe.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 ii.current&&ii.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Mr.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Rr(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 si(t,e){return new ai(t,e)}function ui(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function ci(t,e,n,r){if("function"==typeof e){const[o,i]=ui(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]=ui(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function li(t,e,n){const r=t.getProps();return ci(r,e,void 0!==n?n:r.custom,t)}function fi(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,si(n))}const pi=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),di="data-"+pi("framerAppearId");function hi(t){return t.props[di]}function yi(t){return rn.has(t)?"transform":Go.has(t)?pi(t):void 0}class vi extends ai{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(t){const e=yi(t);if(!e)return;const n=this.counts.get(e)||0;this.counts.set(e,n+1),0===n&&(this.output.push(e),this.update());let r=!1;return()=>{if(r)return;r=!0;const t=this.counts.get(e)-1;this.counts.set(e,t),0===t&&(ri(this.output,e),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}const mi=t=>Boolean(t&&t.getVelocity);function gi(t,e){var n;if(!t.applyWillChange)return;let r=t.getValue("willChange");return r||(null===(n=t.props.style)||void 0===n?void 0:n.willChange)||(r=new vi("auto"),t.addValue("willChange",r)),o=r,Boolean(mi(o)&&o.add)?r.add(e):void 0;var o}function bi({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function wi(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&&bi(l,e))continue;const s={delay:n,...fn(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=hi(t);if(n){const t=window.MotionHandoffAnimation(n,e,Xe);null!==t&&(s.startTime=t,f=!0)}}r.start(Qo(e,r,o,t.shouldReduceMotion&&rn.has(e)?{type:!1}:s,t,f,gi(t,e)));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{Xe.update((()=>{s&&function(t,e){const n=li(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)fi(t,e,ei(i[e]))}(t,s)}))})),c}const _i={};function Si(t,{layout:e,layoutId:n}){return rn.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!_i[t]||"opacity"===t)}function ki(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(mi(o[a])||e.style&&mi(e.style[a])||Si(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 xi(t,e,n){const r=ki(t,e,n);for(const n in t)if(mi(t[n])||mi(e[n])){r[-1!==nn.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const Ai="undefined"!=typeof window,Ti={current:null},Ei={current:!1};function Oi(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function Pi(t){return"string"==typeof t||Array.isArray(t)}const ji=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ci=["initial",...ji];function Ii(t){return Oi(t.animate)||Ci.some((e=>Pi(t[e])))}function Mi(t){return Boolean(Ii(t)||t.variants)}const Li={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"]},Ni={};for(const t in Li)Ni[t]={isEnabled:e=>Li[t].some((t=>!!e[t]))};const Ri=[...Yn,ur,br],Fi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Vi=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Di=Ci.length;class Bi{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=er,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,Xe.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=Ii(e),this.isVariantNode=Mi(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]&&mi(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))),Ei.current||function(){if(Ei.current=!0,Ai)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Ti.current=t.matches;t.addListener(e),e()}else Ti.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Ti.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){$e.delete(this.current),this.projection&&this.projection.unmount(),Ke(this.notifyUpdate),Ke(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=rn.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&Xe.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 Ni){const e=Ni[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(mi(o))t.addValue(r,o);else if(mi(i))t.addValue(r,si(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,si(void 0!==e?e:o,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const e={};for(let t=0;t<Di;t++){const n=Ci[t],r=this.props[n];(Pi(r)||!1===r)&&(e[n]=r)}return e}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=si(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&&(vn(r)||yn(r))?r=parseFloat(r):(o=r,!Ri.find(qn(o))&&br.test(e)&&(r=Or(t,e))),this.setBaseTarget(t,mi(r)?r.get():r)),mi(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=ci(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||mi(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 oi),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Ui extends Bi{constructor(){super(...arguments),this.KeyframeResolver=jr}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 Hi=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Gi={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$i=nn.length;function zi(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(rn.has(t))a=!0;else if(gn(t))o[t]=n;else{const e=Hi(n,Ar[t]);t.startsWith("origin")?(s=!0,i[t]=e):r[t]=e}}if(e.transform||(a||n?r.transform=function(t,e,n){let r="",o=!0;for(let i=0;i<$i;i++){const a=nn[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=Hi(s,Ar[a]);u||(o=!1,r+=`${Gi[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 Wi(t,e,n){return"string"==typeof t?t:Rn.transform(e+n*t)}const qi={offset:"stroke-dashoffset",array:"stroke-dasharray"},Yi={offset:"strokeDashoffset",array:"strokeDasharray"};function Xi(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(zi(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:d,dimensions:h}=t;p.transform&&(h&&(d.transform=p.transform),delete p.transform),h&&(void 0!==o||void 0!==i||d.transform)&&(d.transformOrigin=function(t,e,n){return`${Wi(e,t.x,t.width)} ${Wi(n,t.y,t.height)}`}(h,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?qi:Yi;t[i.offset]=Rn.transform(-r);const a=Rn.transform(e),s=Rn.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const Ki=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 Zi(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 Qi(t,e,n,r){Zi(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Ki.has(n)?n:pi(n),e.attrs[n])}const Ji=t=>"string"==typeof t&&"svg"===t.toLowerCase();class ta extends Ui{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Fi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(rn.has(e)){const t=Er(e);return t&&t.default||0}return e=Ki.has(e)?e:pi(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return xi(t,e,n)}build(t,e,n){Xi(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Qi(t,e,0,r)}mount(t){this.isSVGTag=Ji(t.tagName),super.mount(t)}}function ea(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 na extends Ui{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=Zi}readValueFromInstance(t,e){if(rn.has(e)){const t=Er(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(gn(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return ea(t,e)}build(t,e,n){zi(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return ki(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;mi(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}function ra(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 ta(e):new na(e);n.mount(t),$e.set(t,n)}function oa(t,e,n){const r=mi(t)?t:si(t);return r.start(Qo("",r,e,n)),r.animation}function ia(t,e=100){const n=Kr({keyframes:[0,e],...t}),r=Math.min(Vo(n),Fo);return{type:"keyframes",ease:t=>n.next(r*t).value/e,duration:an(r)}}function aa(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 sa=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t};function ua(t,e){return io(t)?t[sa(0,t.length,e)]:t}function ca(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&&(ri(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:bo(o,i,r[a]),easing:ua(n,a)})}function la(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const fa="easeInOut";function pa(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function da(t,e){return e[t]||(e[t]=[]),e[t]}function ha(t){return Array.isArray(t)?t:[t]}function ya(t,e){return t[e]?{...t,...t[e]}:{...t}}const va=t=>"number"==typeof t,ma=t=>t.every(va);function ga(t,e,n,r){const o=Ge(t,r),i=o.length;He(Boolean(i),"No valid element provided.");const a=[];for(let t=0;t<i;t++){const r=o[t];$e.has(r)||ra(r);const s=$e.get(r),u={...n};"function"==typeof u.delay&&(u.delay=u.delay(t,i)),a.push(...wi(s,{...e,transition:u},{}))}return new en(a)}function ba(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r){const o=e.duration||.3,i=new Map,a=new Map,s={},u=new Map;let c=0,l=0,f=0;for(let n=0;n<t.length;n++){const i=t[n];if("string"==typeof i){u.set(i,l);continue}if(!Array.isArray(i)){u.set(i.name,aa(l,i.at,c,u));continue}let[p,d,h={}]=i;void 0!==h.at&&(l=aa(l,h.at,c,u));let y=0;const v=(t,n,r,i=0,a=0)=>{const s=ha(t),{delay:u=0,times:c=No(s),type:p="keyframes",...d}=n;let{ease:h=e.ease||"easeOut",duration:v}=n;const m="function"==typeof u?u(i,a):u,g=s.length;if(g<=2&&"spring"===p){let t=100;if(2===g&&ma(s)){const e=s[1]-s[0];t=Math.abs(e)}const e={...d};void 0!==v&&(e.duration=on(v));const n=ia(e,t);h=n.ease,v=n.duration}null!=v||(v=o);const b=l+m,w=b+v;1===c.length&&0===c[0]&&(c[1]=1);const _=c.length-s.length;_>0&&Lo(c,_),1===s.length&&s.unshift(null),ca(r,s,h,c,b,w),y=Math.max(m+v,y),f=Math.max(w,f)};if(mi(p))v(d,h,da("default",pa(p,a)));else{const t=Ge(p,r,s),e=t.length;for(let n=0;n<e;n++){const r=pa(t[n],a);for(const t in d)v(d[t],ya(h,t),da(t,r),n,e)}}c=l,l+=y}return a.forEach(((t,r)=>{for(const o in t){const a=t[o];a.sort(la);const s=[],u=[],c=[];for(let t=0;t<a.length;t++){const{at:e,value:n,easing:r}=a[t];s.push(n),u.push(go(0,f,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(fa)),1!==u[u.length-1]&&(u.push(1),s.push(null)),i.has(r)||i.set(r,{keyframes:{},transition:{}});const l=i.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:f,ease:c,times:u,...n}}})),i}(t,e,n);return o.forEach((({keyframes:t,transition:e},n)=>{let o;o=mi(n)?oa(n,t.default,e.default):ga(n,t,e),r.push(o)})),new en(r)}const wa=function(t,e,n){let r;var o;return o=t,r=Array.isArray(o)&&Array.isArray(o[0])?ba(t,e,_a):function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?ga(t,e,n,_a):oa(t,e,n),_a&&_a.animations.push(r),r};var _a;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 ka(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ka=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Sa(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=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Sa(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function xa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Ta(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function Aa(t){return function(t){if(Array.isArray(t))return Ea(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Ta(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 Ta(t,e){if(t){if("string"==typeof t)return Ea(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)?Ea(t,e):void 0}}function Ea(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 Oa(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 Pa(t,e,n){return(e=ja(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ja(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+""}var Ca=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())}))},Ia=Pa(Pa(Pa({},Oe.left,"25.33%"),Oe.center,"50%"),Oe.right,"75.66%"),Ma=function(){function t(e,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequences=[],this.control=null,this.transformers={},Array.isArray(e)){var r;(r=this.sequences).push.apply(r,Aa(e)),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions,n||{})}else{var o=e,i=n||t.defaultOptions;this.sequences.push({props:o,options:i||{}}),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions)}}return function(t,e,n){return e&&Oa(t.prototype,e),n&&Oa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r,o){var i=e.scope,a=e.overwrites;return Ca(this,void 0,void 0,ka().mark((function e(){var s=this;return ka().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=d(r,{}),e.abrupt("return",new Promise((function(e){Ca(s,void 0,void 0,ka().mark((function s(){var u,c,l,f,p=this;return ka().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||(e(),o&&o(r)),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=xa(this.sequences),s.prev=4,f=ka().mark((function e(){var o,s,u,c,f,h;return ka().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=l.value,s=o.props,u=o.options,c=d({},p.propToCSS(n,r)),i.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=i.current,Object.assign(f.style,c),r=t.mergeState(r,s),h=wa(f,p.propToCSS(n,r,a),p.optionsToFramerMotionOptions(u)||{}),p.setControl(h),!1===(null==u?void 0:u.sync)){e.next=16;break}return e.next=12,new Promise((function(t){return h.then((function(){return t()}))}));case 12:Object.assign(f.style,p.propToCSS(n,r,a)),p.setControl(null),e.next=17;break;case 16:h.then((function(){Object.assign(f.style,p.propToCSS(n,r,a)),p.setControl(null)}));case 17:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){s.next=11;break}return s.delegateYield(f(),"t0",9);case 9:s.next=7;break;case 11:s.next=16;break;case 13:s.prev=13,s.t1=s.catch(4),c.e(s.t1);case 16:return s.prev=16,c.f(),s.finish(16);case 19:u++,s.next=2;break;case 22:return s.next=24,b(2);case 24:this.setControl(null),this.sequenceOptions.sync&&(e(),o&&o(r));case 26:case"end":return s.stop()}}),s,this,[[4,13,16,19]])})))})));case 2:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return"scale"in n?{width:"".concat(100*n.scale,"%")}:{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}}},c={};for(var l in c.transform=this.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"propToCSSTransform",value:function(t,e){var n;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var r=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},o=r.invertY,i=r.invertX;return["translate(".concat(i?"":"-","50%, ").concat(o?"":"-","50%)"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)")].filter(Boolean).join(" ")}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],[{key:"isPosition",value:function(t){return Fe.isCommonPositionType(t)||Ve.isCoord2DPosition(t)||De.isAlignPosition(t)}},{key:"positionToCSS",value:function(t,e,n){return Re.D2PositionToCSS(t.toCSS(),n,e)}},{key:"backgroundToCSS",value:function(t){return null==t?{}:Ns.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:v(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?Re.mergePosition(Re.tryParsePosition(t),Re.tryParsePosition(e)):Re.toCoord2D(Re.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},d(t,e)),{position:n})}}])}();function La(t){return La="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},La(t)}function Na(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,Ra(r.key),r)}}function Ra(t){var e=function(t,e){if("object"!=La(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=La(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==La(e)?e:e+""}function Fa(t,e,n){return e=Da(e),function(t,e){if(e&&("object"==La(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||[],Da(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 Da(t){return Da=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Da(t)}function Ba(t,e){return Ba=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ba(t,e)}Ma.defaultSequenceOptions={sync:!0,repeat:1},Ma.defaultOptions={duration:0,ease:"linear"},Ma.CommonImagePositionMap=Ia;var Ua=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=Fa(this,e)).events=new m,r.ref=void 0,"string"==typeof t?(r.name=t,r.config=d(e.defaultConfig,n||{}),r.config.position&&(r.config.position=Re.tryParsePosition(r.config.position))):(r.name="",r.config=d(e.defaultConfig,t),r.config.position&&(r.config.position=Re.tryParsePosition(r.config.position))),r.state=d({},r.config),r.checkConfig(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ba(t,e)}(e,t),function(t,e,n){return e&&Na(t.prototype,e),n&&Na(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this.chain(this._init())}},{key:"checkConfig",value:function(){if(!this.config.src)throw new Error("Image src is required");if(!Ma.isPosition(this.config.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");return this}},{key:"setSrc",value:function(t,e){var n=this.chain();if(e){var r=e.copy();r.setSrc(Ns.srcToString(t)),n._transitionSrc(r)}var o=new gs(this.chain(),gs.ActionTypes.setSrc,new Ee(pe.getIdManager().getStringId()).setContent(["string"==typeof t?t:Ns.staticImageDataToSrc(t)]));return n.chain(o)}},{key:"applyTransform",value:function(t){var e=new gs(this.chain(),gs.ActionTypes.applyTransform,new Ee(pe.getIdManager().getStringId()).setContent([void 0,t,g()]));return this.chain(e)}},{key:"show",value:function(t){var e=t instanceof Ma?t:new Ma([{props:{opacity:1},options:t||{}}]),n=new gs(this.chain(),gs.ActionTypes.show,new Ee(pe.getIdManager().getStringId()).setContent([void 0,e]));return this.chain(n)}},{key:"hide",value:function(t){var e=new gs(this.chain(),gs.ActionTypes.hide,new Ee(pe.getIdManager().getStringId()).setContent([void 0,t instanceof Ma?t:new Ma([{props:{opacity:0},options:t||{}}])]));return this.chain(e)}},{key:"toTransform",value:function(){return new Ma(this.state,{duration:0})}},{key:"setScope",value:function(t){return this.ref=t,this}},{key:"getScope",value:function(){return this.ref}},{key:"copy",value:function(){return new e(this.name,this.config)}},{key:"toData",value:function(){return this.state.disposed||w(this.state,this.config)?null:{state:d({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=d(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_setTransition",value:function(t){return this.chain(new gs(this.chain(),gs.ActionTypes.setTransition,new Ee(pe.getIdManager().getStringId()).setContent([t])))}},{key:"_applyTransition",value:function(t){return this.chain(new gs(this.chain(),"image:applyTransition",new Ee(pe.getIdManager().getStringId()).setContent([t])))}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._setTransition(e)._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new gs(this.chain(),gs.ActionTypes.dispose,new Ee(pe.getIdManager().getStringId())))}},{key:"_init",value:function(t){return new gs(this.chain(),gs.ActionTypes.init,new Ee(pe.getIdManager().getStringId()).setContent([t]))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return Re.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 Re.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}}])}(Rt);function Ha(t){return Ha="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},Ha(t)}function Ga(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"!=Ha(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ha(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ha(e)?e:e+""}Ua.EventTypes={"event:image.show":"event:image.show","event:image.hide":"event:image.hide","event:image.init":"event:image.init","event:image.applyTransform":"event:image.applyTransform","event:image.mount":"event:image.mount","event:image.unmount":"event:image.unmount","event:image.ready":"event:image.ready","event:image.elementLoaded":"event:image.elementLoaded","event:image.setTransition":"event:image.setTransition"},Ua.defaultConfig={src:"",display:!1,position:new Fe(Ae.Center),scale:1,rotation:0,opacity:0},Ua.ImagePosition=Oe;var za=function(){return function(t,e,n){return e&&Ga(t.prototype,e),n&&Ga(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.callee=e,this.type=n,this.contentNode=r,this.__stack=g(),this._id=""}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode}}},{key:"getId",value:function(){return this._id}},{key:"setId",value:function(t){this._id=t}},{key:"getFutureActions",value:function(){var t=this.contentNode.getChild();return t&&t.action?[t.action]:[]}}])}();za.ActionTypes={action:"action"};var Wa={say:"character:say",action:"character:action"},qa={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",setTransition:"scene:setTransition",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform"},Ya={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"},Xa={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},Ka={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat"};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){return function(t){if(Array.isArray(t))return ns(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||es(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 Ja(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Ja=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Za(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=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Za(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function ts(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)||es(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 es(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}}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(t,e,n,r){var o=os(fs(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=fs(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,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function as(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,us(r.key),r)}}function ss(t,e,n){return e&&as(t.prototype,e),n&&as(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function us(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 cs(t,e,n){return e=fs(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,ls()?Reflect.construct(e,n||[],fs(t).constructor):e.apply(t,n))}function ls(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ls=function(){return!!t})()}function fs(t){return fs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fs(t)}function ps(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)}function ds(t,e){return ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ds(t,e)}var hs=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())}))},ys=function(t){function e(t,n,r){var o;return is(this,e),(o=cs(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}return ps(e,t),ss(e,[{key:"unknownType",value:function(){throw new Error("Unknown action type: "+this.type)}}])}(za),vs=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ps(e,t),ss(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Wa.say){var r=new h((function(t){return t})).registerSkipController(new S((function(){return{type:n.type,node:n.contentNode.getChild()}}))),o=this.contentNode.getContent();return t.createText(this.contentNode.id,o,(function(){r.resolve({type:n.type,node:n.contentNode.getChild()})})),r}return rs(e,"executeAction",this,3)([t])}}])}(ys);vs.ActionTypes=Wa;var ms=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ps(e,t),ss(e,[{key:"executeAction",value:function(t){var n,r=this;if(this.type===qa.action)return rs(e,"executeAction",this,3)([t]);if(this.type===qa.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],rs(e,"executeAction",this,3)([t]);if(this.type===qa.sleep){var o=new h((function(t){return t})),i=this.contentNode.getContent();return new Promise((function(t){"number"==typeof i?setTimeout((function(){t()}),i):h.isAwaitable(i)?i.then(t):null==i||i.then(t)})).then((function(){o.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),o}if(this.type===qa.applyTransition){var a=(new h).registerSkipController(new S((function(){return t.logger.info("NarraLeaf-React: Background Transition","Skipped"),{type:r.type,node:r.contentNode.getChild()}}))),s=this.contentNode.getContent()[0];return this.callee.events.any("event:scene.applyTransition",s).then((function(){a.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),a}if(this.type===qa.init){if(this.callee._liveState.active)return rs(e,"executeAction",this,3)([t]);this.callee._liveState.active=!0;var u=new h((function(t){return t}));return t.registerSrcManager(this.callee.srcManager).addScene(this.callee),this.callee.events.once("event:scene.unmount",(function(){t.offSrcManager(r.callee.srcManager)})),this.callee.events.once("event:scene.mount",(function(){r.callee.state.backgroundMusic&&(Ss.initSound(t,r.callee.state.backgroundMusic),r.callee.events.emit("event:scene.setBackgroundMusic",r.callee.state.backgroundMusic,r.callee.config.backgroundMusicFade))})),this.callee.events.once("event:scene.imageLoaded",(function(){var e=r.callee.getInitTransform();r.callee.events.any("event:scene.initTransform",e).then((function(){u.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()}))})),u}if(this.type===qa.exit){this.callee._liveState.active=!1,t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var c=new h((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){c.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),c}if(this.type===qa.jumpTo){var l=this.contentNode.getContent()[0],f=this.contentNode,p=(null===(n=l.sceneRoot)||void 0===n?void 0:n.contentNode)||null;return p&&f.addChild(p),rs(e,"executeAction",this,3)([t])}if(this.type===qa.setBackgroundMusic){var d=ts(this.contentNode.getContent(),2),y=d[0],v=d[1];return this.callee.events.emit("event:scene.setBackgroundMusic",y,v||0),rs(e,"executeAction",this,3)([t])}if(this.type===qa.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),rs(e,"executeAction",this,3)([t]);if(this.type===qa.applyTransform){var m=ts(this.contentNode.getContent(),1)[0],g=new h((function(t){return t})).registerSkipController(new S((function(){return{type:r.type,node:r.contentNode.getChild()}})));return this.callee.events.any("event:scene.applyTransform",m).then((function(){g.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),g}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(){var t,e,n;if(this.type===qa.jumpTo){var r=null===(e=null===(t=this.contentNode.getContent()[0])||void 0===t?void 0:t.sceneRoot)||void 0===e?void 0:e.contentNode;return(null==r?void 0:r.action)?[r.action]:[]}var o=null===(n=this.contentNode.getChild())||void 0===n?void 0:n.action;return o?[o]:[]}}])}(ys);ms.ActionTypes=qa,(function(t){function e(){return is(this,e),cs(this,e,arguments)}return ps(e,t),ss(e)}(ys)).ActionTypes={action:"story:action"};var gs=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ps(e,t),ss(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Ya.init){var r=t.findElementByImage(this.callee);r&&t.disposeImage(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createImage(this.callee,o);var i=new h((function(t){return t}));return this.callee.events.once("event:image.mount",(function(){return hs(n,void 0,void 0,Ja().mark((function e(){var n;return Ja().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=this.callee.getScope())||void 0===n?void 0:n.current){e.next=3;break}return e.next=3,this.callee.events.any(Ua.EventTypes["event:image.elementLoaded"]);case 3:return e.next=5,this.callee.events.any("event:image.init");case 5:i.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 7:case"end":return e.stop()}}),e,this)})))})),i}if(this.type===Ya.setSrc)return this.callee.state.src=this.contentNode.getContent()[0],t.stage.forceUpdate(),rs(e,"executeAction",this,3)([t]);if([Ya.show,Ya.hide,Ya.applyTransform].includes(this.type)){var a=new h((function(t){return t})).registerSkipController(new S((function(){return n.type===Ya.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}}))),s=this.contentNode.getContent()[1];return this.type===Ya.show&&(this.callee.state.display=!0,t.stage.forceUpdate()),t.animateImage(Ua.EventTypes["event:image.applyTransform"],this.callee,[s],(function(){var t;n.type===Ya.hide&&(n.callee.state.display=!1),a.resolve({type:n.type,node:null===(t=n.contentNode)||void 0===t?void 0:t.getChild()})})),a}if(this.type===Ya.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),rs(e,"executeAction",this,3)([t]);if(this.type===Ya.setTransition)return this.callee.events.emit("event:image.setTransition",this.contentNode.getContent()[0]),rs(e,"executeAction",this,3)([t]);if(this.type===Ya.applyTransition){var u=new h((function(t){return t})).registerSkipController(new S((function(){return n.type===Ya.hide&&(n.callee.state.display=!1),{type:n.type,node:n.contentNode.getChild()}})));return this.contentNode.getContent()[0].start((function(){u.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),u}throw rs(e,"unknownType",this,3)([])}}])}(ys);gs.ActionTypes=Ya;var bs=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ps(e,t),ss(e,[{key:"executeAction",value:function(t){var e,n,r=this.callee.evaluate(this.contentNode.getContent(),{gameState:t});return null===(e=null==r?void 0:r[r.length-1])||void 0===e||e.contentNode.addChild(this.contentNode.getChild()),this.contentNode.addChild((null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.contentNode)||null),{type:this.type,node:this.contentNode}}},{key:"getFutureActions",value:function(){return[].concat(Qa(this.callee._getFutureActions()),Qa(rs(e,"getFutureActions",this,3)([])))}}])}(ys);bs.ActionTypes={action:"condition:action"};var ws=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ps(e,t),ss(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),{type:this.type,node:this.contentNode}}}])}(ys);ws.ActionTypes={action:"script:action"};var _s=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ps(e,t),ss(e,[{key:"executeAction",value:function(t){var e=this,n=new h((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent();return[].concat(Qa(this.callee._getFutureActions(t.choices)),Qa(rs(e,"getFutureActions",this,3)([])))}}])}(ys);_s.ActionTypes={action:"menu:action"};var Ss=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ps(e,t),ss(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===Xa.play){if(e.initSound(t,this.callee),!this.callee.$getHowl())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var r=new h((function(t){return t})),o=t.playSound(this.callee.$getHowl(),(function(){var t;n.callee.$stop(),r.resolve({type:n.type,node:null===(t=n.contentNode)||void 0===t?void 0:t.getChild()})}));return this.callee.$setToken(o),r}var i=t.playSound(this.callee.$getHowl(),(function(){n.callee.$stop()}));return this.callee.$setToken(i),rs(e,"executeAction",this,3)([t])}if(this.type===Xa.stop)return this.callee.$getHowl()&&(this.callee.$getHowl().stop(),this.callee.$stop()),rs(e,"executeAction",this,3)([t]);if(this.type===Xa.fade){var a=ts(this.contentNode.getContent(),1)[0],s=a.start,u=a.end,c=a.duration;if(this.callee.$getHowl()){var l=void 0===s?this.callee.$getHowl().volume():s;this.callee.$getHowl().fade(l,u,c,this.callee.$getToken())}return rs(e,"executeAction",this,3)([t])}if(this.type===Xa.setVolume){var f=ts(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().volume(f,this.callee.$getToken()),rs(e,"executeAction",this,3)([t])}if(this.type===Xa.setRate){var p=ts(this.contentNode.getContent(),1)[0];return this.callee.$getHowl()&&this.callee.$getHowl().rate(p,this.callee.$getToken()),rs(e,"executeAction",this,3)([t])}if(this.type===Xa.pause)return this.callee.$getHowl()&&this.callee.$getHowl().pause(this.callee.$getToken()),rs(e,"executeAction",this,3)([t]);if(this.type===Xa.resume)return this.callee.$getHowl()&&this.callee.$getHowl().play(this.callee.$getToken()),rs(e,"executeAction",this,3)([t]);throw rs(e,"unknownType",this,3)([])}}],[{key:"initSound",value:function(t,e){e.$getHowl()||e.$setHowl(new(t.getHowl())(e.getHowlOptions()))}}])}(ys);Ss.ActionTypes=Xa;var ks=function(t){function e(){return is(this,e),cs(this,e,arguments)}return ps(e,t),ss(e,[{key:"executeAllActions",value:function(t,e){return hs(this,void 0,void 0,Ja().mark((function n(){var r,o,i;return Ja().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=Ja().mark((function e(){var n,r,i;return Ja().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o)){e.next=3;break}return e.abrupt("return",0);case 3:if(!h.isAwaitable(n)){e.next=15;break}return e.next=6,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 6:if(r=e.sent,i=r.node){e.next=12;break}return e.abrupt("return",0);case 12:o=i.action;case 13:e.next=16;break;case 15:o=n;case 16:case"end":return e.stop()}}),e)}));case 3:if(r||!o){n.next=10;break}return n.delegateYield(i(),"t0",5);case 5:if(0!==n.t0){n.next=8;break}return n.abrupt("break",10);case 8:n.next=3;break;case 10:case"end":return n.stop()}}),n)})))}},{key:"executeSingleAction",value:function(t,e){return hs(this,void 0,void 0,Ja().mark((function n(){var r,o,i;return Ja().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!h.isAwaitable(r)){n.next=9;break}return n.next=4,new Promise((function(t){r.then((function(e){return t(r.result)}))}));case 4:return o=n.sent,i=o.node,n.abrupt("return",i);case 9:return n.abrupt("return",r);case 10:case"end":return n.stop()}}),n)})))}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.getChild()})})),n):rs(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n,r,o=this,i=ts(this.contentNode.getContent(),1)[0];if(this.type===Ka.do){var a=null===(n=i[0])||void 0===n?void 0:n.contentNode,s=null===(r=i[i.length-1])||void 0===r?void 0:r.contentNode,u=this.contentNode.getChild();return null==s||s.addChild(u),this.contentNode.addChild(a||null),rs(e,"executeAction",this,3)([t])}if(this.type===Ka.doAsync)return hs(o,void 0,void 0,Ja().mark((function e(){return Ja().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),rs(e,"executeAction",this,3)([t]);if(this.type===Ka.any){var c=new h((function(t){return t})),l=i.map((function(e){return o.executeSingleAction(t,e)}));return Promise.any(l).then((function(){c.resolve({type:o.type,node:o.contentNode.getChild()})})),c}if(this.type===Ka.all){var f=new h((function(t){return t}));return this.execute(t,f,i)}if(this.type===Ka.allAsync)return hs(o,void 0,void 0,Ja().mark((function e(){return Ja().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,i[0]);case 3:case"end":return e.stop()}}),e,this)}))),rs(e,"executeAction",this,3)([t]);if(this.type===Ka.repeat){var p=ts(this.contentNode.getContent(),2),d=p[0],y=p[1];return hs(o,void 0,void 0,Ja().mark((function e(){var n;return Ja().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<y)){e.next=8;break}if(!(d.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,d[0]);case 5:n++,e.next=1;break;case 8:case"end":return e.stop()}}),e,this)}))),rs(e,"executeAction",this,3)([t])}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(){var t=this.contentNode.getContent()[0],n=rs(e,"getFutureActions",this,3)([]);return[].concat(Qa(t),Qa(n))}}])}(ys);function xs(t){return xs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xs(t)}function As(t,e,n){return e=js(e),function(t,e){if(e&&("object"==xs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Os()?Reflect.construct(e,n||[],js(t).constructor):e.apply(t,n))}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&&Ps(t,e)}function Es(t){var e="function"==typeof Map?new Map:void 0;return Es=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(Os())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&Ps(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}}),Ps(n,t)},Es(t)}function Os(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Os=function(){return!!t})()}function Ps(t,e){return Ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ps(t,e)}function js(t){return js=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},js(t)}function Cs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Is(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 Ms(t,e,n){return e&&Is(t.prototype,e),n&&Is(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ls(t){var e=function(t,e){if("object"!=xs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=xs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xs(e)?e:e+""}ks.ActionTypes=Ka;var Ns=function(){function t(){Cs(this,t)}return Ms(t,null,[{key:"srcToString",value:function(t){return"string"==typeof t?t:t.src}},{key:"staticImageDataToSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"isStaticImageData",value:function(t){return void 0!==(null==t?void 0:t.src)}},{key:"backgroundToSrc",value:function(e){return t.isStaticImageData(e)?e.src:(null==e?void 0:e.url)||null}},{key:"isExternalSrc",value:function(t){return t.startsWith("http://")||t.startsWith("https://")}}])}(),Rs=function(t){function e(t,n){return Cs(this,e),As(this,e,[t,{info:n},"StaticScriptWarning"])}return Ts(e,t),Ms(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 Cs(this,e),(r=As(this,e,[t])).props=n,r.name=o,r}return Ts(e,t),Ms(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(Es(Error))),Fs=function(){return Ms((function t(e){Cs(this,t),this.scene=e}),[{key:"run",value:function(){if(!this.scene.sceneRoot)return null;var t=new Map,e=new Map,n=[],r=new Set,o=this.scene.getAllChildren(this.scene.sceneRoot);if(!o.length)return null;for(n.push(o[0]);n.length;){var i=n.shift();this.checkAction(i,{imageStates:t,scenes:e},r);var a=i.contentNode.getChild();a&&a.action&&n.push(a.action)}return t}},{key:"checkAction",value:function(t,e,n){var r=e.imageStates,o=e.scenes;if(t instanceof gs)r.has(t.callee)||r.set(t.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(r.get(t.callee),t);else if(t instanceof ms){var i=t.callee;if(o.has(i.name)){if(o.get(i.name)!==i){var a="Scene with name: ".concat(i.name," is duplicated\nScene: ").concat(i.name,"\n\nAt: ").concat(t.__stack);throw new Rs(a)}}else o.set(i.name,i);if(t.type===qa.jumpTo){var s=t.contentNode.getContent()[0];if(n.has(s))return;n.add(s)}}}},{key:"checkImage",value:function(t,e){if(e.type===Ya.dispose){if(t.isDisposed){var n="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Rs(n)}t.isDisposed=!0}else if([Ya.init,Ya.show,Ya.hide,Ya.applyTransform,Ya.applyTransition].includes(e.type)){if(t.isDisposed){var r="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Rs(r)}}else if(e.type===Ya.setSrc){var o=e.contentNode.getContent()[0];Ns.isExternalSrc(o)&&(t.usedExternalSrc=!0)}}}])}();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 Ds(t){return function(t){if(Array.isArray(t))return Us(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 Us(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)?Us(t,e):void 0}}function Us(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 Hs(t,e,n){return e=$s(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,Gs()?Reflect.construct(e,n||[],$s(t).constructor):e.apply(t,n))}function Gs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Gs=function(){return!!t})()}function $s(t){return $s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$s(t)}function zs(t,e){return zs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zs(t,e)}function Ws(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qs(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 Ys(t,e,n){return e&&qs(t.prototype,e),n&&qs(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+""}var Ks=function(){return Ys((function t(e){Ws(this,t),this.handler=e}),[{key:"evaluate",value:function(t){var e=t.gameState;return{value:this.handler(this.getCtx({gameState:e}))}}},{key:"getCtx",value:function(t){return{gameState:t.gameState}}}])}(),Zs=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ws(this,e),(t=Hs(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t.config=d(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&zs(t,e)}(e,t),Ys(e,[{key:"If",value:function(t,e){return this.conditions.If.condition=t instanceof Ks?t:new Ks(t),this.conditions.If.action=this.construct(Array.isArray(e)?e:[e]),this.chain()}},{key:"ElseIf",value:function(t,e){return this.conditions.ElseIf.push({condition:t instanceof Ks?t:new Ks(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){return this.conditions.Else.action=this.construct(Array.isArray(t)?t:[t]),this.chain()}},{key:"evaluate",value:function(t,e){var n,r,o={gameState:e.gameState},i=null===(n=t.If.condition)||void 0===n?void 0:n.evaluate(o);if(null==i?void 0:i.value)return t.If.action||null;var a,s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=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}}}}(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(bs,[this,bs.ActionTypes.action,new Ee(pe.getIdManager().getStringId()).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=Et.toActions(t),i=0;i<o.length;i++){var a=o[i].contentNode,s=null===(r=o[i+1])||void 0===r?void 0:r.contentNode;s&&a.setInitChild(s),i===o.length-1&&e&&a.setInitChild(e),0===i&&n&&n.setInitChild(a)}return o}},{key:"_getFutureActions",value:function(){return[].concat(Ds(this.conditions.If.action||[]),Ds(this.conditions.ElseIf.flatMap((function(t){return t.action||[]}))),Ds(this.conditions.Else.action||[]))}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}}])}(Rt);function Qs(t){return Qs="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},Qs(t)}function Js(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,tu(r.key),r)}}function tu(t){var e=function(t,e){if("object"!=Qs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qs(e)?e:e+""}function eu(t,e,n){return e=ru(e),function(t,e){if(e&&("object"==Qs(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,nu()?Reflect.construct(e,n||[],ru(t).constructor):e.apply(t,n))}function nu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(nu=function(){return!!t})()}function ru(t){return ru=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ru(t)}function ou(t,e){return ou=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ou(t,e)}Zs.defaultConfig={};var iu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),eu(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&&ou(t,e)}(e,t),function(t,e,n){return e&&Js(t.prototype,e),n&&Js(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(ks.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(ks.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(ks.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(ks.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(ks.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(ks.ActionTypes.repeat,e,t)}},{key:"construct",value:function(t){for(var e,n=0;n<t.length;n++){var r=t[n];0!==n&&(null===(e=t[n-1])||void 0===e||e.contentNode.setInitChild(r.contentNode))}return t}},{key:"push",value:function(t,e){for(var n=Et.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 ks(this.chain(),t,new Ee(pe.getIdManager().getStringId()).setContent([this.construct(n)].concat(o)));return this.chain(a)}}],[{key:"do",value:function(t){return(new e).do(t)}},{key:"doAsync",value:function(t){return(new e).doAsync(t)}},{key:"any",value:function(t){return(new e).any(t)}},{key:"all",value:function(t){return(new e).all(t)}},{key:"allAsync",value:function(t){return(new e).allAsync(t)}},{key:"repeat",value:function(t,n){return(new e).repeat(t,n)}}])}(Rt);function au(t){return au="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},au(t)}function 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,uu(r.key),r)}}function uu(t){var e=function(t,e){if("object"!=au(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=au(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==au(e)?e:e+""}function cu(t,e,n){return e=fu(e),function(t,e){if(e&&("object"==au(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,lu()?Reflect.construct(e,n||[],fu(t).constructor):e.apply(t,n))}function lu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(lu=function(){return!!t})()}function fu(t){return fu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fu(t)}function pu(t,e){return pu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},pu(t,e)}var du=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=cu(this,e)).choices=[],n.prompt=Wt.isSentence(t)?t:new Wt(null,t),n.config=d(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&&pu(t,e)}(e,t),function(t,e,n){return e&&su(t.prototype,e),n&&su(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Wt.isSentence(t)&&e||(Yt.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Wt.toSentence(t),action:Et.toActions(e)}):"object"===au(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Wt.toSentence(t.prompt),action:Et.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new _s(this.chain(),_s.ActionTypes.action,new Ee(pe.getIdManager().getStringId()).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"construct",value:function(t,e,n){for(var r,o=0;o<t.length;o++){var i=t[o].contentNode,a=null===(r=t[o+1])||void 0===r?void 0:r.contentNode;a&&i.setInitChild(a),o===this.choices.length-1&&e&&i.setInitChild(e),0===o&&n&&n.setInitChild(i)}return t}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action})).flat(2)}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.construct(e.action),prompt:e.prompt}}))}}])}(Rt);function hu(t){return hu="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},hu(t)}function yu(t){return function(t){if(Array.isArray(t))return vu(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 vu(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)?vu(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 vu(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 mu(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,gu(r.key),r)}}function gu(t){var e=function(t,e){if("object"!=hu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=hu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==hu(e)?e:e+""}function bu(t,e,n){return e=_u(e),function(t,e){if(e&&("object"==hu(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,wu()?Reflect.construct(e,n||[],_u(t).constructor):e.apply(t,n))}function wu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(wu=function(){return!!t})()}function _u(t){return _u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_u(t)}function Su(t,e){return Su=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Su(t,e)}du.defaultConfig={},du.targetAction=_s;var ku,xu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),bu(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&&Su(t,e)}(e,t),function(t,e,n){return e&&mu(t.prototype,e),n&&mu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"fromChained",value:function(t){return t.getActions()}},{key:"forEachChild",value:function(t,e){var n=new Set,r=[];for(Array.isArray(t)?r.push.apply(r,yu(t)):r.push(t);r.length;){var o=r.shift();if(!n.has(o)){n.add(o),e(o);var i=o.getFutureActions().filter((function(t){return!n.has(t)}));r.push.apply(r,yu(i))}}}},{key:"getAllChildren",value:function(t){var e=[];return this.forEachChild(t,(function(t){return e.push(t)})),e}},{key:"getAllChildrenMap",value:function(t){var e=new Map;return this.forEachChild(t,(function(t){return e.set(t.getId(),t)})),e}},{key:"getAllElementMap",value:function(t){var e=new Map;return this.forEachChild(t,(function(t){return e.set(t.getId(),t.callee)})),e}},{key:"getAllChildrenElements",value:function(t){return Array.from(new Set(this.getAllChildren(t).map((function(t){return t.callee}))))}},{key:"toData",value:function(){return null}},{key:"fromData",value:function(t){return this}},{key:"construct",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setInitChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setInitChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(Ot);function Au(t){return Au="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Au(t)}function Tu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Eu(r.key),r)}}function Eu(t){var e=function(t,e){if("object"!=Au(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Au(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Au(e)?e:e+""}function Ou(t,e,n){return e=ju(e),function(t,e){if(e&&("object"==Au(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Pu()?Reflect.construct(e,n||[],ju(t).constructor):e.apply(t,n))}function Pu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Pu=function(){return!!t})()}function ju(t){return ju=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ju(t)}function Cu(t,e){return Cu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cu(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(ku||(ku={}));var Iu=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=Ou(this,e)).state={playing:null,token:null},t.config=d(e.defaultConfig,n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cu(t,e)}(e,t),function(t,e,n){return e&&Tu(t.prototype,e),n&&Tu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===ku.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(Ss.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===ku.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(Ss.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===ku.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(Ss.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(Ss.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(Ss.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(Ss.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(Ss.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(){return{src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1}}},{key:"getSrc",value:function(){return this.config.src}},{key:"$setToken",value:function(t){this.state.token=t}},{key:"$getToken",value:function(){return this.state.token}},{key:"$setHowl",value:function(t){this.state.playing=t}},{key:"$getHowl",value:function(){return this.state.playing}},{key:"$stop",value:function(){this.$setToken(null),this.$setHowl(null)}},{key:"toData",value:function(){return w(this.config,e.defaultConfig)?null:{config:y(this.config)}}},{key:"fromData",value:function(t){return this.config=d(this.config,t.config),this}},{key:"pushAction",value:function(t,e){return this.chain(new Ss(this.chain(),t,new Ee(pe.getIdManager().getStringId()).setContent(e)))}}])}(Rt);function Mu(t){return Mu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mu(t)}function Lu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Nu(r.key),r)}}function Nu(t){var e=function(t,e){if("object"!=Mu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Mu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Mu(e)?e:e+""}Iu.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var Ru=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&&Lu(t.prototype,e),n&&Lu(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 Iu){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof Ua||Ns.isStaticImageData(t)){if(t instanceof Ua){if(this.isSrcRegistered(Ns.srcToString(t.state.src)))return this}else if(this.isSrcRegistered(Ns.srcToString(t.src)))return this;this.src.push({type:"image",src:t instanceof Ua?t:new Ua("",{src:Ns.staticImageDataToSrc(t)})})}else if("object"===Mu(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 Iu?e:new Iu({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 Iu?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===Ns.srcToString(e.src.state.src):n===e.src}))}},{key:"getSrc",value:function(){return this.src}},{key:"getSrcByType",value:function(t){return this.src.filter((function(e){return e.type===t}))}},{key:"registerFuture",value:function(t){return this.future.includes(t)||this.hasFuture(t)||this.future.push(t),this}},{key:"hasFuture",value:function(t){return this.future.includes(t)}}])}();function 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 Vu(t){return function(t){if(Array.isArray(t))return Du(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 Du(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)?Du(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 Du(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 Bu(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,Uu(r.key),r)}}function Uu(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 Hu(t,e,n){return e=zu(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,Gu()?Reflect.construct(e,n||[],zu(t).constructor):e.apply(t,n))}function Gu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Gu=function(){return!!t})()}function $u(){return $u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=zu(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},$u.apply(null,arguments)}function zu(t){return zu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zu(t)}function Wu(t,e){return Wu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wu(t,e)}Ru.SrcTypes={image:"image",video:"video",audio:"audio"};var qu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.defaultConfig;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Hu(this,e)).srcManager=new Ru,n.events=new m,n._liveState={active:!1},n.id=t,n.name=t,n.config=d(e.defaultConfig,r),n.state=d(e.defaultState,n.config),n.backgroundImageState={position:new Fe(Ae.Center)},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wu(t,e)}(e,t),function(t,e,n){return e&&Bu(t.prototype,e),n&&Bu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"activate",value:function(){return this.chain(this._init(this))}},{key:"deactivate",value:function(){return this.chain(this._exit())}},{key:"setBackground",value:function(t,e){if(e){var n=e.copy();n.setSrc(Ns.backgroundToSrc(t)),this._transitionSceneBackground(void 0,n)}return this.chain(new ms(this.chain(),"scene:setBackground",new Ee(pe.getIdManager().getStringId()).setContent([t])))}},{key:"applyTransform",value:function(t){return this.chain(new ms(this.chain(),"scene:applyTransform",new Ee(pe.getIdManager().getStringId()).setContent([t])))}},{key:"jumpTo",value:function(t,e){var n=e||{};return this.chain(new ms(this.chain(),"scene:preUnmount",new Ee(pe.getIdManager().getStringId()).setContent([])))._transitionToScene(t,n.transition).chain(t._init()).chain(this._exit())._jumpTo(t)}},{key:"sleep",value:function(t){return this.chain(new ms(this.chain(),"scene:sleep",new Ee(pe.getIdManager().getStringId()).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,e){return this.chain(new ms(this.chain(),qa.setBackgroundMusic,new Ee(pe.getIdManager().getStringId()).setContent([t,e])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},y(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:Ua.serializeImageState(this.backgroundImageState)}}},{key:"fromData",value:function(t){return this.state=d(this.state,t.state),t.state.backgroundMusic&&(this.state.backgroundMusic=(new Iu).fromData(t.state.backgroundMusic),this.state.background=t.state.background),t.backgroundImageState&&(this.backgroundImageState=Ua.deserializeImageState(t.backgroundImageState)),this}},{key:"getInitTransform",value:function(){return new Ma([{props:Object.assign(Object.assign({},this.backgroundImageState),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){var n=(Array.isArray(t)?t.flat(2):t(this).flat(2)).map((function(t){return Et.isChained(t)?t.fromChained(t):t})).flat(2),r=this.getAllChildrenElements(n).filter((function(t){return t instanceof Ua&&!Et.isChained(t)})),o=[this._init(this)].concat(Vu(r.map((function(t){return t._init()}))),Vu(n)),i=function(t,e,n,r){var o=$u(zu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"construct",this,3)([o]),a=new Ee(pe.getIdManager().getStringId(),void 0,void 0,i||void 0).setContent(this);return null==i||i.setParent(a),this.sceneRoot=new ms(this.chain(),"scene:action",a),this}},{key:"registerSrc",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Set;if(this.sceneRoot){var n=new Set,r=[this.sceneRoot],o=new Set;for(Ns.backgroundToSrc(this.config.background)&&this.srcManager.register(new Ua({src:Ns.backgroundToSrc(this.config.background)}));r.length;){var i=r.shift();if(i instanceof ms){if(i.type===qa.jumpTo){var a=i,s=a.contentNode.getContent()[0];if(n.has(a)||e.has(s))continue;n.add(a),o.add(s),e.add(s)}else if(i.type===qa.setBackground){var u=i.contentNode.getContent()[0];this.srcManager.register(new Ua({src:Ns.backgroundToSrc(u)}))}}else if(i instanceof gs){var c=i;if(this.srcManager.register(c.callee),i.type===Ya.setSrc){var l=i.contentNode.getContent()[0];this.srcManager.register(new Ua({src:l}))}}else if(i instanceof Ss)this.srcManager.register(i.callee);else if(i instanceof ks){var f=i.getFutureActions();r.push.apply(r,Vu(f))}r.push.apply(r,Vu(i.getFutureActions()))}o.forEach((function(n){n.registerSrc(e),t.srcManager.registerFuture(n.srcManager)}))}}},{key:"assignActionId",value:function(){this.getAllChildren(this.sceneRoot||[]).forEach((function(t,e){t.setId("action-".concat(e))}))}},{key:"assignElementId",value:function(){this.getAllChildrenElements(this.sceneRoot||[]).forEach((function(t,e){t.setId("element-".concat(e))}))}},{key:"_applyTransition",value:function(t){return this.chain(new ms(this.chain(),"scene:applyTransition",new Ee(pe.getIdManager().getStringId()).setContent([t])))}},{key:"_transitionSceneBackground",value:function(t,e){return this._transitionToScene(t,e)}},{key:"_jumpTo",value:function(t){return this.chain(new ms(this.chain(),"scene:jumpTo",new Ee(pe.getIdManager().getStringId()).setContent([t])))}},{key:"_exit",value:function(){return new ms(this.chain(),"scene:exit",new Ee(pe.getIdManager().getStringId()).setContent([]))}},{key:"_transitionToScene",value:function(t,e){var n=this.chain();if(e){var r=e.copy();t&&r.setSrc(Ns.backgroundToSrc(t.state.background)),n._applyTransition(r)}return n}},{key:"_init",value:function(){return new ms((arguments.length>0&&void 0!==arguments[0]?arguments[0]:this).chain(),"scene:init",new Ee(pe.getIdManager().getStringId()).setContent([]))}}])}(xu);function Yu(t){return Yu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yu(t)}function 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,Ku(r.key),r)}}function Ku(t){var e=function(t,e){if("object"!=Yu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Yu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Yu(e)?e:e+""}function Zu(t,e,n){return e=tc(e),Qu(t,Ju()?Reflect.construct(e,n||[],tc(t).constructor):e.apply(t,n))}function Qu(t,e){if(e&&("object"==Yu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Ju(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ju=function(){return!!t})()}function tc(t){return tc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tc(t)}function ec(t,e){return ec=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ec(t,e)}qu.EventTypes={"event:scene.applyTransition":"event:scene.applyTransition","event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.initTransform":"event:scene.initTransform","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:scene.applyTransform":"event:scene.applyTransform"},qu.defaultConfig={background:null,invertY:!1,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},qu.defaultState={};var nc=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=Zu(this,e)).cleaner=null,n.handler=t,Qu(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&&ec(t,e)}(e,t),function(t,e,n){return e&&Xu(t.prototype,e),n&&Xu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var e=t.gameState;this.cleaner=this.handler(this.getCtx({gameState:e}))||null}},{key:"getCtx",value:function(t){return{script:this,gameState:t.gameState}}},{key:"fromChained",value:function(t){return[new ws(this.chain(),ws.ActionTypes.action,new Ee(pe.getIdManager().getStringId()).setContent(t))]}}])}(Rt);function rc(t){return rc="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},rc(t)}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,ic(r.key),r)}}function ic(t){var e=function(t,e){if("object"!=rc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=rc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==rc(e)?e:e+""}function ac(t,e,n){return e=uc(e),function(t,e){if(e&&("object"==rc(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,sc()?Reflect.construct(e,n||[],uc(t).constructor):e.apply(t,n))}function sc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(sc=function(){return!!t})()}function uc(t){return uc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uc(t)}function cc(t,e){return cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cc(t,e)}var lc=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=ac(this,e)).entryScene=null,n.id=pe.getIdManager().getStringId(),n.name=t,n.config=d(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&&cc(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:"entry",value:function(t){return this.entryScene=t,this}},{key:"constructStory",value:function(){var t=this.entryScene;if(!t)throw new Error("Story must have an entry scene");return t.registerSrc(),t.assignActionId(),t.assignElementId(),this.runStaticCheck(t),this}},{key:"getAllElementStates",value:function(){var t;return this.getAllChildrenElements((null===(t=this.entryScene)||void 0===t?void 0:t.sceneRoot)||[]).map((function(t){return{id:t.getId(),data:t.toData()}})).filter((function(t){return!!t.data}))}},{key:"runStaticCheck",value:function(t){return new Fs(t).run()}}])}(xu);lc.defaultConfig={};var fc=r(72),pc=r.n(fc),dc=r(825),hc=r.n(dc),yc=r(659),vc=r.n(yc),mc=r(56),gc=r.n(mc),bc=r(540),wc=r.n(bc),_c=r(113),Sc=r.n(_c),kc=r(587),xc={};xc.styleTagTransform=Sc(),xc.setAttributes=gc(),xc.insert=vc().bind(null,"head"),xc.domAPI=hc(),xc.insertStyleElement=wc();pc()(kc.A,xc);kc.A&&kc.A.locals&&kc.A.locals;var Ac=r(848);const Tc=(0,$.createContext)({strict:!1});function Ec(t){for(const e in t)Ni[e]={...Ni[e],...t[e]}}function Oc({children:t,features:e,strict:n=!1}){const[,r]=(0,$.useState)(!Pc(e)),o=(0,$.useRef)(void 0);if(!Pc(e)){const{renderer:t,...n}=e;o.current=t,Ec(n)}return(0,$.useEffect)((()=>{Pc(e)&&e().then((({renderer:t,...e})=>{Ec(e),o.current=t,r(!0)}))}),[]),(0,Ac.jsx)(Tc.Provider,{value:{renderer:o.current,strict:n},children:t})}function Pc(t){return"function"==typeof t}function jc(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 Cc(t,e,n={}){var r;const o=li(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(wi(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(Ic).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(Cc(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 Ic(t,e){return t.sortNodePosition(e)}const Mc=[...ji].reverse(),Lc=ji.length;function Nc(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=>Cc(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=Cc(t,e,n);else{const o="function"==typeof e?li(t,e,n.custom):e;r=Promise.all(wi(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Rc(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!jc(e,t)}function Fc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Vc(){return{animate:Fc(!0),whileInView:Fc(),whileHover:Fc(),whileTap:Fc(),whileDrag:Fc(),whileFocus:Fc(),exit:Fc()}}class Dc{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Bc=0;const Uc={animation:{Feature:class extends Dc{constructor(t){super(t),t.animationState||(t.animationState=function(t){let e=Nc(t),n=Vc(),r=!0;const o=e=>(n,r)=>{var o;const i=li(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const a=t.getProps(),s=t.getVariantContext(!0)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<Lc;e++){const p=Mc[e],d=n[p],h=void 0!==a[p]?a[p]:s[p],y=Pi(h),v=p===i?d.isActive:null;!1===v&&(f=e);let m=h===s[p]&&h!==a[p]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),d.protectedKeys={...l},!d.isActive&&null===v||!h&&!d.prevProp||Oi(h)||"boolean"==typeof h)continue;let g=Rc(d.prevProp,h)||p===i&&d.isActive&&!m&&y||e>f&&y,b=!1;const w=Array.isArray(h)?h:[h];let _=w.reduce(o(p),{});!1===v&&(_={});const{prevResolvedValues:S={}}=d,k={...S,..._},x=e=>{g=!0,c.has(e)&&(b=!0,c.delete(e)),d.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in k){const e=_[t],n=S[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Jo(e)&&Jo(n)?!jc(e,n):e!==n,r?null!=e?x(t):c.add(t):void 0!==e&&c.has(t)?x(t):d.protectedKeys[t]=!0}d.prevProp=h,d.prevResolvedValues=_,d.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(g=!1),!g||m&&!b||u.push(...w.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=Vc(),r=!0}}}(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Oi(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 Dc{constructor(){super(...arguments),this.id=Bc++}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 Hc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Gc(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const $c=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Gc(e));function zc(t,e,n,r){return Hc(t,e,$c(n),r)}function Wc(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const qc=Wc("dragHorizontal"),Yc=Wc("dragVertical");function Xc(){const t=function(t){let e=!1;if("y"===t)e=Yc();else if("x"===t)e=qc();else{const t=qc(),n=Yc();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function Kc(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return zc(t.current,n,((n,o)=>{if("touch"===n.pointerType||Xc())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&Xe.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Zc=(t,e)=>!!e&&(t===e||Zc(t,e.parentElement));function Qc(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Gc(n))}const Jc=new WeakMap,tl=new WeakMap,el=t=>{const e=Jc.get(t.target);e&&e(t)},nl=t=>{t.forEach(el)};function rl(t,e,n){const r=function({root:t,...e}){const n=t||document;tl.has(n)||tl.set(n,{});const r=tl.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(nl,{root:t,...e})),r[o]}(e);return Jc.set(t,n),r.observe(t),()=>{Jc.delete(t),r.unobserve(t)}}const ol={some:0,all:1};const il={inView:{Feature:class extends Dc{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:ol[r]};return rl(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 Dc{constructor(){super(...arguments),this.removeStartListeners=Be,this.removeEndListeners=Be,this.removeAccessibleListeners=Be,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=zc(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Zc(this.node.current,t.target)?n:r;i&&Xe.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=zc(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=mo(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=Hc(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=Hc(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&Qc("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&Xe.postRender((()=>n(t,e)))}))})),Qc("down",((t,e)=>{this.startPress(t,e)}))})),e=Hc(this.node.current,"blur",(()=>{this.isPressing&&Qc("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=mo(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&&Xe.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Xc()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Xe.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=zc(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=Hc(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=mo(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Dc{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=mo(Hc(this.node.current,"focus",(()=>this.onFocus())),Hc(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Dc{mount(){this.unmount=mo(Kc(this.node,!0),Kc(this.node,!1))}unmount(){}}}},al=["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 sl(t){return"string"==typeof t&&!t.includes("-")&&!!(al.indexOf(t)>-1||/[A-Z]/u.test(t))}const ul={renderer:(t,e)=>sl(t)?new ta(e):new na(e,{allowProjection:t!==$.Fragment}),...Uc,...il};function cl(t){var e=t.children;return z().createElement(Oc,{features:ul,strict:!0},e)}function ll(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 fl(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)?fl(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 fl(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 pl(t){var e=t.children,n=t.className,r=ll((0,$.useState)({}),2),o=r[0],i=r[1],a=tt().ratio,s=ct().game,u=ll((0,$.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,$.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("Ratio is locked, skipping update");else{var t=document.getElementById(s.config.player.contentContainerId);if(t){var e,n,r=t.clientWidth,o=t.clientHeight,f=s.config.player.aspectRatio;r/o>f?(e=o*f,n=o):(e=r,n=r/f),e<c&&(e=c),n<l&&(n=l),i({width:"".concat(e,"px"),height:"".concat(n,"px"),margin:"auto",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center"}),a.update(e,n),a.updateMin(c,l),u()}}};a.setUpdate(e);var n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)};return e(),window.addEventListener("resize",n),function(){window.removeEventListener("resize",n),clearTimeout(t)}}),[a]),z().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},z().createElement("div",{className:G(n),style:o},e))}var dl={start:"start",update:"update",end:"end"};function hl(t){var e=t.children,n=tt().ratio,r=ct().game,o=(0,$.useRef)(null);return(0,$.useEffect)((function(){if(!o.current)throw new Error("Content container not found")}),[r.config.player.contentContainerId]),z().createElement(z().Fragment,null,z().createElement("div",{ref:o,className:G("absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"),style:Object.assign({},n.getStyle())},e))}function yl(t){return yl="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},yl(t)}function vl(){return vl=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},vl.apply(null,arguments)}function ml(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ml=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==yl(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=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(yl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function gl(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 bl(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)?bl(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 bl(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 wl=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 _l(t){var e=this,n=t.scene,r=t.props,o=t.state,i=(0,$.useRef)(null),a=ct().game,s=gl((0,$.useState)(null),2),u=s[0],c=s[1],l=gl((0,$.useState)([]),2)[1],f=gl((0,$.useState)(null),2),p=f[0],h=f[1],y=gl((0,$.useState)({}),2),v=y[0],m=y[1];function g(){n.events.emit(qu.EventTypes["event:scene.imageLoaded"])}function b(t){if(p&&p.getControl()&&(console.warn("processing transform not completed"),p.getControl().complete(),p.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof Ma?Object.assign(i.current.style,t.propToCSS(o,n.backgroundImageState)):Object.assign(i.current.style,t)}(0,$.useEffect)((function(){var t=n.events.onEvents([{type:qu.EventTypes["event:scene.applyTransition"],listener:n.events.on(qu.EventTypes["event:scene.applyTransition"],(function(t){return c(t),t?new Promise((function(e){var n=t.events.onEvents([{type:dl.update,listener:t.events.on(dl.update,(function(t){l(t)}))},{type:dl.end,listener:t.events.on(dl.end,(function(){c(null),e(),o.logger.debug("transition end",u)}))},{type:dl.start,listener:t.events.on(dl.start,(function(){o.logger.debug("transition start",u)}))}]);t.start((function(){n.cancel(),e()}))})):(o.logger.warn("transition not set"),Promise.resolve())}))},{type:qu.EventTypes["event:scene.applyTransform"],listener:n.events.on(qu.EventTypes["event:scene.applyTransform"],(function(t){return wl(e,void 0,void 0,ml().mark((function e(){return ml().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(o,n.backgroundImageState)),h(t),e.next=4,t.animate({scope:i},o,n.backgroundImageState,(function(e){n.backgroundImageState=d(n.backgroundImageState,e),m({style:t.propToCSS(o,n.backgroundImageState)}),h(null)}));case 4:case"end":return e.stop()}}),e)})))}))},{type:qu.EventTypes["event:scene.initTransform"],listener:n.events.on(qu.EventTypes["event:scene.initTransform"],(function(t){return wl(e,void 0,void 0,ml().mark((function e(){return ml().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o.logger.debug("init transform",t),e.next=3,t.animate({scope:i},o,n.backgroundImageState,(function(t){n.backgroundImageState=d(n.backgroundImageState,t)}));case 3:case"end":return e.stop()}}),e)})))}))}]);return function(){t.cancel()}}),[n]),(0,$.useEffect)((function(){b(n.backgroundImageState)}),[]),(0,$.useEffect)((function(){var t=o.events.onEvents([{type:U.EventTypes["event:state.player.skip"],listener:o.events.on(U.EventTypes["event:state.player.skip"],(function(){p&&p.getControl()&&(p.getControl().complete(),p.setControl(null))}))}]);return function(){t.cancel()}}),[p]);var w,_="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",S={src:_,style:Object.assign({opacity:0},a.config.app.debug?{border:"1px solid red"}:{})};return z().createElement("div",null,u?u.toElementProps().map((function(t,e,n){var o=d(S,r,v,t);return z().createElement(hl,{key:e},z().createElement("img",vl({alt:o.alt},o,{onLoad:g,src:o.src||_,ref:e===n.length-1?i:void 0,className:"absolute"})))})):(w=d(S,r,v),z().createElement(hl,null,z().createElement("img",vl({alt:w.alt},w,{onLoad:g,ref:i,src:w.src||_,className:"absolute"})))))}function Sl(t){return Sl="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},Sl(t)}function kl(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */kl=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Sl(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=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Sl(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function xl(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 Al(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)?Al(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 Al(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 Tl=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 El(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=tt().ratio,a=xl((0,$.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1],c=xl((0,$.useState)(null),2),l=c[0],f=c[1],p=xl((0,$.useState)(null),2),d=p[0],h=p[1];function y(t,e){return Tl(this,void 0,void 0,kl().mark((function n(){var r;return kl().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.$getHowl()&&t.$getHowl().playing(t.$getToken())){n.next=2;break}return n.abrupt("return",Promise.resolve());case 2:return r=t.$getHowl().volume(t.$getToken()),n.next=5,new Promise((function(n){t.$getHowl().fade(r,0,e,t.$getToken()),h((function(){return n})),f(setTimeout((function(){t.$getHowl().stop(),t.$getHowl().volume(r),t.$setToken(null),n(),h(null)}),e))}));case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n)})))}return(0,$.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(qu.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){var n,r,o,i,a,c;return Tl(this,void 0,void 0,kl().mark((function p(){var v,m;return kl().wrap((function(p){for(;;)switch(p.prev=p.next){case 0:if(l&&(clearTimeout(l),f(null),d&&(d(),h(null))),m=t,!(v=s)){p.next=12;break}if(!e){p.next=9;break}return p.next=7,y(v,e);case 7:p.next=12;break;case 9:null===(n=v.$getHowl())||void 0===n||n.stop(),null===(r=v.$getHowl())||void 0===r||r.volume(0),v.$setToken(null);case 12:if(m){p.next=14;break}return p.abrupt("return");case 14:null===(o=m.$getHowl())||void 0===o||o.volume(0),m.$setToken(null===(i=m.$getHowl())||void 0===i?void 0:i.play(m.$getToken()||void 0)),e?null===(a=m.$getHowl())||void 0===a||a.fade(0,m.config.volume,e,m.$getToken()):null===(c=m.$getHowl())||void 0===c||c.volume(m.config.volume,m.$getToken()),u(m);case 18:case"end":return p.stop()}}),p)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(qu.EventTypes["event:scene.preUnmount"],(function(){l&&(clearTimeout(l),d&&d()),s&&y(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,$.useEffect)((function(){return e.events.emit(qu.EventTypes["event:scene.mount"]),function(){e.events.emit(qu.EventTypes["event:scene.unmount"])}}),[]),z().createElement("div",{className:o},z().createElement(_l,{scene:e,props:{width:i.state.width,height:i.state.height,src:Ns.backgroundToSrc(e.state.background)},state:n}),r)}function Ol(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}const Pl=(0,$.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),jl=(0,$.createContext)({}),Cl=(0,$.createContext)(null),Il=Ai?$.useLayoutEffect:$.useEffect,{schedule:Ml,cancel:Ll}=Ye(queueMicrotask,!1);function Nl(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const Rl=(0,$.createContext)({});let Fl=!1;function Vl(t,e,n,r,o){var i;const{visualElement:a}=(0,$.useContext)(jl),s=(0,$.useContext)(Tc),u=(0,$.useContext)(Cl),c=(0,$.useContext)(Pl).reducedMotion,l=(0,$.useRef)();r=r||s.renderer,!l.current&&r&&(l.current=r(t,{visualState:e,parent:a,props:n,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:c}));const f=l.current,p=(0,$.useContext)(Rl);!f||f.projection||!o||"html"!==f.type&&"svg"!==f.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Bl(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&Nl(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(l.current,n,o,p),(0,$.useInsertionEffect)((()=>{f&&f.update(n,u)}));const d=n[di],h=(0,$.useRef)(Boolean(d)&&!window.MotionHandoffIsComplete&&(null===(i=window.MotionHasOptimisedAnimation)||void 0===i?void 0:i.call(window,d)));return Il((()=>{f&&(f.updateFeatures(),Ml.render(f.render),h.current&&f.animationState&&f.animationState.animateChanges())})),(0,$.useEffect)((()=>{f&&(!h.current&&f.animationState&&f.animationState.animateChanges(),h.current=!1,Fl||(Fl=!0,queueMicrotask(Dl)))})),f}function Dl(){window.MotionHandoffIsComplete=!0}function Bl(t){if(t)return!1!==t.options.allowProjection?t.projection:Bl(t.parent)}function Ul(t,e,n){return(0,$.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Nl(n)&&(n.current=r))}),[e])}function Hl(t){const{initial:e,animate:n}=function(t,e){if(Ii(t)){const{initial:e,animate:n}=t;return{initial:!1===e||Pi(e)?e:void 0,animate:Pi(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,$.useContext)(jl));return(0,$.useMemo)((()=>({initial:e,animate:n})),[Gl(e),Gl(n)])}function Gl(t){return Array.isArray(t)?t.join(" "):t}const $l=(0,$.createContext)({}),zl=Symbol.for("motionComponentSymbol");function Wl({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&Ec(t);const i=(0,$.forwardRef)((function(t,i){let a;const s={...(0,$.useContext)(Pl),...t,layoutId:ql(t)},{isStatic:u}=s,c=Hl(t),l=r(t,u);if(!u&&Ai){!function(){(0,$.useContext)(Tc).strict;0}();const t=function(t){const{drag:e,layout:n}=Ni;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=Vl(o,l,s,e,t.ProjectionNode)}return(0,Ac.jsxs)(jl.Provider,{value:c,children:[a&&c.visualElement?(0,Ac.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Ul(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[zl]=o,i}function ql({layoutId:t}){const e=(0,$.useContext)($l).id;return e&&void 0!==t?e+"-"+t:t}function Yl(t){const e=mi(t)?t.get():t;return ti(e)?e.toValue():e}const Xl=t=>(e,n)=>{const r=(0,$.useContext)(jl),o=(0,$.useContext)(Cl),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:Ql(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,$.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function Kl(t,e){const n=yi(e);n&&ni(t,n)}function Zl(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=ci(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function Ql(t,e,n,r,o){var i;const a={},s=[],u=r&&void 0===(null===(i=t.style)||void 0===i?void 0:i.willChange),c=o(t,{});for(const t in c)a[t]=Yl(c[t]);let{initial:l,animate:f}=t;const p=Ii(t),d=Mi(t);e&&d&&!p&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let h=!!n&&!1===n.initial;h=h||!1===l;const y=h?f:l;return y&&"boolean"!=typeof y&&!Oi(y)&&Zl(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[h?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!Oi(f)&&Zl(t,f,(t=>{for(const e in t)Kl(s,e)})),s.length&&(a.willChange=s.join(","))),a}const Jl=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),tf=()=>({...Jl(),attrs:{}}),ef={useVisualState:Xl({scrapeMotionValuesFromProps:xi,createRenderState:tf,onMount:(t,e,{renderState:n,latestValues:r})=>{Xe.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),Xe.render((()=>{Xi(n,r,Ji(e.tagName),t.transformTemplate),Qi(e,n)}))}})},nf={useVisualState:Xl({applyWillChange:!0,scrapeMotionValuesFromProps:ki,createRenderState:Jl})};function rf(t,e,n){for(const r in e)mi(e[r])||Si(r,n)||(t[r]=e[r])}function of(t,e){const n={};return rf(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,$.useMemo)((()=>{const n=Jl();return zi(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function af(t,e){const n={},r=of(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 sf=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 uf(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||sf.has(t)}let cf=t=>!uf(t);try{(lf=require("@emotion/is-prop-valid").default)&&(cf=t=>t.startsWith("on")?!uf(t):lf(t))}catch(dt){}var lf;function ff(t,e,n,r){const o=(0,$.useMemo)((()=>{const n=tf();return Xi(n,e,Ji(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};rf(e,t.style,t),o.style={...e,...o.style}}return o}function pf(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(sl(e)?ff:af)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(cf(o)||!0===n&&uf(o)||!e&&!uf(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==$.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,$.useMemo)((()=>mi(c)?c.get():c),[c]);return(0,$.createElement)(e,{...u,children:l})}}function df(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Wl({...sl(n)?ef:nf,preloadedFeatures:t,useRender:pf(r),createVisualElement:e,Component:n})}}const hf=Ol(df());function yf(t){return yf="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},yf(t)}function vf(){return vf=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},vf.apply(null,arguments)}function mf(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */mf=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",d="suspendedYield",h="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(C([])));S&&S!==n&&r.call(S,a)&&(w=S);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==yf(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=p;return function(i,a){if(o===h)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=h;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(yf(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),P(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function gf(t){return function(t){if(Array.isArray(t))return _f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||wf(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 bf(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)||wf(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 wf(t,e){if(t){if("string"==typeof t)return _f(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)?_f(t,e):void 0}}function _f(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 Sf=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 kf(t){var e=this,n=t.image,r=t.state,o=t.onAnimationEnd,i=(0,$.useRef)(null),a=bf((0,$.useState)(null),2),s=a[0],u=a[1],c=bf((0,$.useState)({style:{}}),2),l=c[0],f=c[1],p=bf((0,$.useState)(null),2),h=p[0],y=p[1],v=bf((0,$.useState)([]),2)[1],m=bf((0,$.useState)(0),2),g=m[0],b=m[1],w=ct().game;(0,$.useEffect)((function(){n.setScope(i),n.events.emit(Ua.EventTypes["event:image.mount"]);var t=n.events.onEvents([].concat(gf([Ua.EventTypes["event:image.show"],Ua.EventTypes["event:image.hide"],Ua.EventTypes["event:image.applyTransform"]].map((function(t){return{type:t,listener:n.events.on(t,(function(t){return Sf(e,void 0,void 0,mf().mark((function e(){return mf().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return S(t.propToCSS(r,n.state)),u(t),r.logger.debug("transform",t,t.propToCSS(r,n.state)),e.next=5,t.animate({scope:i},r,n.state,(function(e){n.state=d(n.state,e),f({style:t.propToCSS(r,n.state)}),o&&o(),u(null)}));case 5:return e.abrupt("return",!0);case 6:case"end":return e.stop()}}),e)})))}))}}))),[{type:Ua.EventTypes["event:image.init"],listener:n.events.on(Ua.EventTypes["event:image.init"],(function(){return Sf(e,void 0,void 0,mf().mark((function t(){return mf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.toTransform().animate({scope:i},r,n.state,(function(t){n.state=d(n.state,t),f({style:n.toTransform().propToCSS(r,n.state)})}));case 2:case"end":return t.stop()}}),t)})))}))}]));return S(n.toTransform().propToCSS(r,n.state)),n.events.emit(Ua.EventTypes["event:image.ready"],i),function(){t.cancel(),n.events.emit(Ua.EventTypes["event:image.unmount"])}}),[]),(0,$.useEffect)((function(){var t=n.events.onEvents([{type:Ua.EventTypes["event:image.setTransition"],listener:n.events.on(Ua.EventTypes["event:image.setTransition"],(function(t){y(t)}))}]);return function(){t.cancel()}}),[h,n]),(0,$.useEffect)((function(){var t=h?h.events.onEvents([{type:dl.update,listener:h.events.on(dl.update,(function(t){v(t)}))},{type:dl.end,listener:h.events.on(dl.end,(function(){y(null)}))}]):null;return function(){var e;null===(e=null==t?void 0:t.cancel)||void 0===e||e.call(t)}}),[h]),(0,$.useEffect)((function(){b(performance.now())}),[]),(0,$.useEffect)((function(){var t=r.events.onEvents([{type:U.EventTypes["event:state.player.skip"],listener:r.events.on(U.EventTypes["event:state.player.skip"],(function(){s&&s.getControl()&&(s.getControl().complete(),s.setControl(null),r.logger.debug("transform skip")),h&&h.controller&&(h.controller.complete(),y(null),r.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[h,s]);var _=function(){var t=performance.now()-g,e=w.config.elements.img.slowLoadThreshold;t>e&&w.config.elements.img.slowLoadWarning&&r.logger.warn("NarraLeaf-React","Image took ".concat(t,"ms to load, which exceeds the threshold of ").concat(e,"ms. ")+"Consider enable cache for the image, so Preloader can preload it before it's used. To disable this warning, set `elements.img.slowLoadWarning` to false in the game config.")};function S(t){if(s&&s.getControl()&&(console.warn("processing transform not completed"),s.getControl().complete(),s.setControl(null)),!i.current)throw new Error("scope not ready");t instanceof Ma?Object.assign(i.current.style,t.propToCSS(r,n.state)):Object.assign(i.current.style,t)}var k={className:"absolute",src:Ns.staticImageDataToSrc(n.state.src),style:Object.assign({opacity:0},w.config.app.debug?{border:"1px solid red"}:{})};return z().createElement(et,{className:"absolute overflow-hidden"},h?h.toElementProps().map((function(t,e,n){var r=d(k,l,t);return z().createElement(hf.img,vf({key:e,alt:r.alt},r,{ref:e===n.length-1?i:void 0,onLoad:_,layout:!0}))})):z().createElement(hf.img,vf({ref:i,alt:"image"},d(k,l),{onLoad:_})))}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 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,Tf(r.key),r)}}function Tf(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+""}var Ef=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.preloaded=[],this.events=new m}return function(t,e,n){return e&&Af(t.prototype,e),n&&Af(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"add",value:function(e){return this.has(this.getSrc(e))||(this.preloaded.push(e),this.events.emit(t.EventTypes["event:preloaded.add"],e),this.events.emit(t.EventTypes["event:preloaded.change"])),this}},{key:"get",value:function(t){var e=this;return this.preloaded.find((function(n){return e.getSrc(n)===t}))}},{key:"has",value:function(t){var e=this;return Array.isArray(t)?t.every((function(t){return e.has(t)})):this.preloaded.some((function(n){return e.getSrc(n)===t}))}},{key:"remove",value:function(e){var n=this;if(Array.isArray(e)){var r=e.map((function(t){return n.getSrc(t)}));return this.preloaded=this.preloaded.filter((function(t){return!r.includes(n.getSrc(t))})),this}var o=this.getSrc(e);return this.preloaded=this.preloaded.filter((function(t){return n.getSrc(t)!==o})),this.events.emit(t.EventTypes["event:preloaded.remove"],e),this.events.emit(t.EventTypes["event:preloaded.change"]),this}},{key:"clear",value:function(){return this.preloaded=[],this}},{key:"getSrc",value:function(t){return"string"==typeof t?t:"image"===t.type?Ns.srcToString(t.src.state.src):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}}])}();function Of(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 Pf(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)?Pf(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 Pf(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}Ef.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 jf=(0,$.createContext)(null);function Cf(t){var e=t.children,n=Of((0,$.useState)(new Ef),1)[0];return z().createElement(z().Fragment,null,z().createElement(jf.Provider,{value:{preloaded:n}},e))}function If(){if(!jf)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,$.useContext)(jf)}function Mf(t){return function(t){if(Array.isArray(t))return Lf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Lf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lf(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Nf(t){var e=t.state,n=t.srcManager,r=If().preloaded;return(0,$.useEffect)((function(){var t,o;if("undefined"!=typeof window){var i=null===(t=e.getLastScene())||void 0===t?void 0:t.srcManager,a=(null===(o=e.getLastScene())||void 0===o?void 0:o.srcManager.future)||[],s=[].concat(Mf(n.src),Mf(i?i.src:[]),Mf(a.map((function(t){return t.src})).flat(2))),u={image:new Set,audio:new Set,video:new Set};s.forEach((function(t){t.type===Ru.SrcTypes.image?u.image.add(t.src):t.type===Ru.SrcTypes.audio?u.audio.add(t.src):t.type===Ru.SrcTypes.video&&u.video.add(t.src)})),e.logger.debug("Preloading",u,a),r.preloaded=r.preloaded.filter((function(t){if(t.type===Ru.SrcTypes.audio){var e=u[t.type].has(t.src);return e||(e=Array.from(u[t.type]).some((function(e){return r.getSrc(t)===r.getSrc(e.config.src)}))),e}if(t.type===Ru.SrcTypes.image)return u[t.type].has(t.src);var n=r.getSrc(t);return u[t.type].has(n)}));var c=[];return u.image.forEach((function(t){var n=new Image;n.src=Ns.srcToString(t.state.src),n.onload=function(){e.logger.debug("Image loaded",t.state.src)},c.push(n),r.add({type:"image",src:t})})),Promise.all([]).then((function(){e.logger.log("Preloaded","Preloaded ".concat(u.image.size," images")),r.events.emit(Ef.EventTypes["event:preloaded.ready"])})),u.audio.forEach((function(t){t.$getHowl()||t.$setHowl(new(e.getHowl())({src:t.config.src,loop:t.config.loop,volume:t.config.volume,autoplay:!1,preload:!0}))})),r.events.emit(Ef.EventTypes["event:preloaded.mount"]),function(){c.forEach((function(t){t.onload=null}))}}console.warn("Window is not supported in this environment")}),[e]),null}function Rf(t){var e=t.state,n=ct().game;return(0,$.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&e.events.emit(U.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")}),[]),z().createElement(z().Fragment,null)}function Ff(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 Vf(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)?Vf(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 Vf(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 Df(t,e){return t.handle(e)}function Bf(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=Ff((0,$.useReducer)((function(t){return t+1}),0),2)[1],u=ct().game,c=Ff((0,$.useReducer)(Df,new U(u,{forceUpdate:function(){s()},next:y,dispatch:function(t){return f(t)}})),2),l=c[0],f=c[1],p=u.config.elements.say.use,d=u.config.elements.menu.use;function y(){for(var t=!1;!t;){var e=u.getLiveGame().next(l);if(!e)break;if(h.isAwaitable(e)){t=!0;break}f(e)}l.stage.forceUpdate()}(0,$.useEffect)((function(){e&&u.getLiveGame().loadStory(e)}),[e,u]),(0,$.useEffect)((function(){i&&i({game:u,state:l});var t=l.getLastScene(),e=[];t?e.push({type:"event:scene.mount",listener:t.events.once("event:scene.mount",(function(){l.stage.next()}))}):l.stage.next();var n=l.events.onEvents([{type:U.EventTypes["event:state.end"],listener:function(){a&&a({game:u,state:l})}}]),r=l.events.onEvents([{type:U.EventTypes["event:state.player.skip"],listener:function(){u.getLiveGame().abortAwaiting(),y()}}]);return l.stage.forceUpdate(),function(){t&&e.forEach((function(e){t.events.off(e.type,e.listener)})),n.cancel(),r.cancel()}}),[]);var v=n||u.config.player.width,m=r||u.config.player.height;return z().createElement(cl,null,z().createElement("div",{style:{width:"number"==typeof v?"".concat(v,"px"):v,height:"number"==typeof m?"".concat(m,"px"):m},className:G(o,"__narraleaf_content-player")},z().createElement(pl,{className:G("flex-grow overflow-auto")},z().createElement(et,{className:"relative"},l.state.srcManagers.map((function(t,e){return z().createElement(Nf,{key:e,state:l,srcManager:t})})),z().createElement(Uf,{onLoaded:function(){l.stage.forceUpdate(),e&&y()}},z().createElement(Rf,{state:l}),l.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return z().createElement(El,{key:"scene-"+e.id,state:l,scene:e},n.images.map((function(t){return z().createElement(kf,{key:"image-"+t.getId(),image:t,state:l})})),n.texts.map((function(t){var e=t.action,n=t.onClick;return z().createElement(p,{state:l,key:"say-"+e.id,action:e,onClick:function(){n(),y()}})})),n.menus.map((function(t,e){return z().createElement("div",{key:"menu-"+e},z().createElement(d,{state:l,prompt:t.action.prompt,choices:t.action.choices,afterChoose:function(e){t.onClick(e),y()}}))})))})))))))}function Uf(t){var e=t.children,n=t.onLoaded,r=If().preloaded,o=Ff((0,$.useState)(!1),2),i=o[0],a=o[1];return(0,$.useEffect)((function(){var t=r.events.on(Ef.EventTypes["event:preloaded.ready"],(function(){a(!0),n()}));return function(){r.events.off(Ef.EventTypes["event:preloaded.ready"],t)}}),[i]),z().createElement(z().Fragment,null,i?e:null)}function Hf(t){var e=t.children,n=t.game;return z().createElement(z().Fragment,null,z().createElement(J,null,z().createElement(ut,{game:n},z().createElement(Cf,null,e))))}function Gf(t){return Gf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gf(t)}function $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,zf(r.key),r)}}function zf(t){var e=function(t,e){if("object"!=Gf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Gf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gf(e)?e:e+""}var Wf=function(){return function(t,e,n){return e&&$f(t.prototype,e),n&&$f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=new m}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(dl.start,null),this.controller=wa(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(dl.update,r.toElementProps())},onComplete:function(){r.events.emit(dl.end,null),s&&s(),r.controller=void 0}},n)),this.controller}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}();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 Yf(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,Xf(r.key),r)}}function Xf(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 Kf(t,e,n){return e=Qf(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,Zf()?Reflect.construct(e,n||[],Qf(t).constructor):e.apply(t,n))}function Zf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Zf=function(){return!!t})()}function Qf(t){return Qf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qf(t)}function Jf(t,e){return Jf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jf(t,e)}var tp=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=Kf(this,e)).state={opacity:1},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof qu?Ns.backgroundToSrc(r.config.background):Ns.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jf(t,e)}(e,t),function(t,e,n){return e&&Yf(t.prototype,e),n&&Yf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{},{style:{opacity:this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Wf);function ep(t){return ep="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},ep(t)}function np(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,rp(r.key),r)}}function rp(t){var e=function(t,e){if("object"!=ep(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ep(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ep(e)?e:e+""}function op(t,e,n){return e=ap(e),function(t,e){if(e&&("object"==ep(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,ip()?Reflect.construct(e,n||[],ap(t).constructor):e.apply(t,n))}function ip(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ip=function(){return!!t})()}function ap(t){return ap=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ap(t)}function sp(t,e){return sp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},sp(t,e)}tp.Frames=[0,1];var up=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=op(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,i&&(r.src="string"==typeof i?i:i instanceof qu?Ns.backgroundToSrc(i.config.background):Ns.staticImageDataToSrc(i)),r.__stack=g(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&sp(t,e)}(e,t),function(t,e,n){return e&&np(t.prototype,e),n&&np(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}})}},{key:"toElementProps",value:function(){return[{},{style:{opacity:this.state.opacity,transform:this.state.transform},src:this.src}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])}(Wf);function cp(t){return cp="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},cp(t)}function lp(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,fp(r.key),r)}}function fp(t){var e=function(t,e){if("object"!=cp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cp(e)?e:e+""}function pp(t,e,n){return e=hp(e),function(t,e){if(e&&("object"==cp(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,dp()?Reflect.construct(e,n||[],hp(t).constructor):e.apply(t,n))}function dp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(dp=function(){return!!t})()}function hp(t){return hp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hp(t)}function yp(t,e){return yp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},yp(t,e)}var vp=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=pp(this,e)).state={opacity:0},t.duration=n,r&&(t.src="string"==typeof r?r:r instanceof qu?Ns.backgroundToSrc(r.config.background):Ns.staticImageDataToSrc(r)),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&yp(t,e)}(e,t),function(t,e,n){return e&&lp(t.prototype,e),n&&lp(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){this.src=t}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:t,onUpdate:function(t){n.state.opacity=t}})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity},src:this.src}]}},{key:"copy",value:function(){return new e(this.duration,this.src)}}])}(Wf);vp.Frames=[1,0]})(),o})()));
|