narraleaf-react 0.2.2 → 0.2.4-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/game/nlcore/action/actions/controlAction.d.ts +1 -1
- package/dist/game/nlcore/common/Utils.d.ts +1 -51
- package/dist/game/nlcore/common/elements.d.ts +2 -1
- package/dist/game/nlcore/elements/character/pause.d.ts +0 -1
- package/dist/game/nlcore/elements/character/sentence.d.ts +0 -22
- package/dist/game/nlcore/elements/character.d.ts +0 -6
- package/dist/game/nlcore/elements/condition.d.ts +0 -13
- package/dist/game/nlcore/elements/control.d.ts +1 -4
- package/dist/game/nlcore/elements/displayable/displayable.d.ts +1 -38
- package/dist/game/nlcore/elements/displayable/image.d.ts +12 -22
- package/dist/game/nlcore/elements/displayable/text.d.ts +0 -8
- package/dist/game/nlcore/elements/menu.d.ts +0 -4
- package/dist/game/nlcore/elements/persistent/type.d.ts +0 -18
- package/dist/game/nlcore/elements/persistent.d.ts +3 -14
- package/dist/game/nlcore/elements/scene.d.ts +3 -43
- package/dist/game/nlcore/elements/script.d.ts +0 -1
- package/dist/game/nlcore/elements/sound.d.ts +0 -5
- package/dist/game/nlcore/elements/story.d.ts +0 -2
- package/dist/game/nlcore/elements/transform/position.d.ts +3 -46
- package/dist/game/nlcore/elements/transform/transform.d.ts +5 -1
- package/dist/game/nlcore/elements/transform/type.d.ts +0 -9
- package/dist/game/nlcore/elements/transition/baseTransitions.d.ts +1 -1
- package/dist/game/nlcore/elements/transition/type.d.ts +0 -15
- package/dist/game/nlcore/game/liveGame.d.ts +0 -33
- package/dist/game/nlcore/game/preference.d.ts +3 -7
- package/dist/game/nlcore/gameTypes.d.ts +4 -0
- package/dist/game/player/elements/displayable/Displayable.d.ts +1 -23
- package/dist/game/player/elements/displayable/Displayables.d.ts +1 -7
- package/dist/game/player/elements/displayable/Text.d.ts +1 -7
- package/dist/game/player/elements/displayable/type.d.ts +1 -15
- package/dist/game/player/elements/image/AspectScaleImage.d.ts +1 -8
- package/dist/game/player/elements/image/Image.d.ts +1 -7
- package/dist/game/player/elements/menu/Menu.d.ts +1 -3
- package/dist/game/player/elements/player/KeyEventAnnouncer.d.ts +1 -5
- package/dist/game/player/elements/player/SizeUpdateAnnouncer.d.ts +1 -4
- package/dist/game/player/elements/preload/Preload.d.ts +1 -4
- package/dist/game/player/elements/say/Say.d.ts +1 -3
- package/dist/game/player/elements/say/Sentence.d.ts +1 -15
- package/dist/game/player/elements/scene/Background.d.ts +1 -5
- package/dist/game/player/elements/scene/BackgroundTransition.d.ts +1 -8
- package/dist/game/player/elements/scene/Scene.d.ts +1 -9
- package/dist/game/player/elements/type.d.ts +1 -1
- package/dist/game/player/gameState.d.ts +0 -1
- package/dist/game/player/gameState.type.d.ts +1 -20
- package/dist/game/player/lib/PlayerFrames.d.ts +5 -1
- package/dist/game/player/lib/preferences.d.ts +3 -0
- package/dist/game/player/libElements.d.ts +3 -2
- package/dist/game/player/provider/game-state.d.ts +0 -5
- package/dist/game/player/provider/preloaded.d.ts +0 -11
- package/dist/game/player/provider/ratio.d.ts +0 -50
- package/dist/main.js +6 -6
- package/dist/util/data.d.ts +2 -2
- package/package.json +10 -7
- package/dist/game/player/elements/say/TypingEffect.d.ts +0 -13
- package/dist/game/player/lib/Motion.d.ts +0 -4
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.NarraleafReact=e(require("react"),require("react-dom")):t.NarraleafReact=e(t.React,t.ReactDOM)}(this,((t,e)=>(()=>{var n={587:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(601),o=n.n(r),i=n(314),a=n.n(i)()(o());a.push([t.id,"/*\n! tailwindcss v3.4.11 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n.\\!container {\n width: 100% !important;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n\n .\\!container {\n max-width: 640px !important;\n }\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .\\!container {\n max-width: 768px !important;\n }\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .\\!container {\n max-width: 1024px !important;\n }\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .\\!container {\n max-width: 1280px !important;\n }\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .\\!container {\n max-width: 1536px !important;\n }\n\n .container {\n max-width: 1536px;\n }\n}\n.pointer-events-none {\n pointer-events: none;\n}\n.\\!visible {\n visibility: visible !important;\n}\n.visible {\n visibility: visible;\n}\n.static {\n position: static;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.inset-0 {\n inset: 0px;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-10 {\n z-index: 10;\n}\n.z-20 {\n z-index: 20;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.block {\n display: block;\n}\n.inline-block {\n display: inline-block;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-\\[calc\\(100\\%-40px\\)\\] {\n width: calc(100% - 40px);\n}\n.w-full {\n width: 100%;\n}\n.min-w-full {\n min-width: 100%;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.resize {\n resize: both;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-start {\n align-items: flex-start;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.whitespace-pre {\n white-space: pre;\n}\n.whitespace-pre-wrap {\n white-space: pre-wrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-br-md {\n border-bottom-right-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-black {\n --tw-border-opacity: 1;\n border-color: rgb(0 0 0 / var(--tw-border-opacity));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.bg-cover {\n background-size: cover;\n}\n.bg-center {\n background-position: center;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.align-bottom {\n vertical-align: bottom;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.italic {\n font-style: italic;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n.text-red-700 {\n --tw-text-opacity: 1;\n color: rgb(185 28 28 / var(--tw-text-opacity));\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.outline {\n outline-style: solid;\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.\\!transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter !important;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter !important;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;\n transition-duration: 150ms !important;\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.__narraleaf_content-player * {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.__narraleaf_content-player img {\n pointer-events: none;\n -webkit-user-drag: none;\n -webkit-user-select: none;\n}\n",""]);const s=a},314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,i){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var u=this[s][0];null!=u&&(a[u]=!0)}for(var c=0;c<t.length;c++){var l=[].concat(t[c]);r&&a[l[0]]||(void 0!==i&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},601:t=>{"use strict";t.exports=function(t){return t[1]}},196:(t,e,n)=>{var r;
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.NarraleafReact=e(require("react"),require("react-dom")):t.NarraleafReact=e(t.React,t.ReactDOM)}(this,((t,e)=>(()=>{var n={587:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(601),o=n.n(r),i=n(314),a=n.n(i)()(o());a.push([t.id,"*, ::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! tailwindcss v3.4.17 | 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]:where(:not([hidden=\"until-found\"])) {\n display: none;\n}\n.\\!container {\n width: 100% !important;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n\n .\\!container {\n max-width: 640px !important;\n }\n\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n\n .\\!container {\n max-width: 768px !important;\n }\n\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n\n .\\!container {\n max-width: 1024px !important;\n }\n\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n\n .\\!container {\n max-width: 1280px !important;\n }\n\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n\n .\\!container {\n max-width: 1536px !important;\n }\n\n .container {\n max-width: 1536px;\n }\n}\n.pointer-events-none {\n pointer-events: none;\n}\n.\\!visible {\n visibility: visible !important;\n}\n.visible {\n visibility: visible;\n}\n.static {\n position: static;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.inset-0 {\n inset: 0px;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-10 {\n z-index: 10;\n}\n.z-20 {\n z-index: 20;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.block {\n display: block;\n}\n.inline-block {\n display: inline-block;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-\\[calc\\(100\\%-40px\\)\\] {\n width: calc(100% - 40px);\n}\n.w-full {\n width: 100%;\n}\n.min-w-full {\n min-width: 100%;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.resize {\n resize: both;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-start {\n align-items: flex-start;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.whitespace-pre {\n white-space: pre;\n}\n.whitespace-pre-wrap {\n white-space: pre-wrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-br-md {\n border-bottom-right-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-black {\n --tw-border-opacity: 1;\n border-color: rgb(0 0 0 / var(--tw-border-opacity, 1));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bg-cover {\n background-size: cover;\n}\n.bg-center {\n background-position: center;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.align-bottom {\n vertical-align: bottom;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.italic {\n font-style: italic;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity, 1));\n}\n.text-red-700 {\n --tw-text-opacity: 1;\n color: rgb(185 28 28 / var(--tw-text-opacity, 1));\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.outline {\n outline-style: solid;\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.__narraleaf_content-player * {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n.__narraleaf_content-player img {\n pointer-events: none;\n -webkit-user-drag: none;\n -webkit-user-select: none;\n}\n",""]);const s=a},314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",r=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),r&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),r&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,r,o,i){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(r)for(var s=0;s<this.length;s++){var u=this[s][0];null!=u&&(a[u]=!0)}for(var c=0;c<t.length;c++){var l=[].concat(t[c]);r&&a[l[0]]||(void 0!==i&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),n&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=n):l[2]=n),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},601:t=>{"use strict";t.exports=function(t){return t[1]}},196:(t,e,n)=>{var r;
|
|
2
2
|
/*!
|
|
3
3
|
* howler.js v2.2.4
|
|
4
4
|
* howlerjs.com
|
|
@@ -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||h(),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||h(),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,h()),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||h(),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,h=(n._sprite[t][0]+n._sprite[t][1])/1e3;s._sprite=t,s._ended=!1;var d=function(){s._paused=!1,s._seek=c,s._start=p,s._stop=h,s._loop=!(!s._loop&&!n._sprite[t][2])};if(!(c>=h)){var y=s._node;if(n._webAudio){var v=function(){n._playLock=!1,d(),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,d(),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,d(),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())},h=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||h(),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||h(),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,h()),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||h(),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,h=(n._sprite[t][0]+n._sprite[t][1])/1e3;s._sprite=t,s._ended=!1;var d=function(){s._paused=!1,s._seek=c,s._start=p,s._stop=h,s._loop=!(!s._loop&&!n._sprite[t][2])};if(!(c>=h)){var y=s._node;if(n._webAudio){var m=function(){n._playLock=!1,d(),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?m():(n._playLock=!0,n.once("resume",m),n._clearTimer(s._id))}else{var v=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,d(),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,d(),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)v();else{n._playLock=!0,n._state="loading";var b=function(){n._state="loaded",v(),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())},h=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
|
*
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
*
|
|
20
20
|
* MIT License
|
|
21
21
|
*/
|
|
22
|
-
function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var e=this;if(!e.ctx||!e.ctx.listener)return e;for(var n=e._howls.length-1;n>=0;n--)e._howls[n].stereo(t);return e},HowlerGlobal.prototype.pos=function(t,e,n){var r=this;return r.ctx&&r.ctx.listener?(e="number"!=typeof e?r._pos[1]:e,n="number"!=typeof n?r._pos[2]:n,"number"!=typeof t?r._pos:(r._pos=[t,e,n],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(t,e,n,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return e="number"!=typeof e?s[1]:e,n="number"!=typeof n?s[2]:n,r="number"!=typeof r?s[3]:r,o="number"!=typeof o?s[4]:o,i="number"!=typeof i?s[5]:i,"number"!=typeof t?s:(a._orientation=[t,e,n,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(t,e,n,r,o,i),a)},Howl.prototype.init=(t=Howl.prototype.init,function(e){var n=this;return n._orientation=e.orientation||[1,0,0],n._stereo=e.stereo||null,n._pos=e.pos||null,n._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},n._onstereo=e.onstereo?[{fn:e.onstereo}]:[],n._onpos=e.onpos?[{fn:e.onpos}]:[],n._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,n){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(t,n)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===n){if("number"!=typeof t)return r._stereo;r._stereo=t,r._pos=[t,0,0]}for(var i=r._getSoundIds(n),a=0;a<i.length;a++){var s=r._soundById(i[a]);if(s){if("number"!=typeof t)return s._stereo;s._stereo=t,s._pos=[t,0,0],s._node&&(s._pannerAttr.panningModel="equalpower",s._panner&&s._panner.pan||e(s,o),"spatial"===o?void 0!==s._panner.positionX?(s._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),s._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),s._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):s._panner.setPosition(t,0,0):s._panner.pan.setValueAtTime(t,Howler.ctx.currentTime)),r._emit("stereo",s._id)}}return r},Howl.prototype.pos=function(t,n,r,o){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"pos",action:function(){i.pos(t,n,r,o)}}),i;if(n="number"!=typeof n?0:n,r="number"!=typeof r?-.5:r,void 0===o){if("number"!=typeof t)return i._pos;i._pos=[t,n,r]}for(var a=i._getSoundIds(o),s=0;s<a.length;s++){var u=i._soundById(a[s]);if(u){if("number"!=typeof t)return u._pos;u._pos=[t,n,r],u._node&&(u._panner&&!u._panner.pan||e(u,"spatial"),void 0!==u._panner.positionX?(u._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(n,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):u._panner.setPosition(t,n,r)),i._emit("pos",u._id)}}return i},Howl.prototype.orientation=function(t,n,r,o){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"orientation",action:function(){i.orientation(t,n,r,o)}}),i;if(n="number"!=typeof n?i._orientation[1]:n,r="number"!=typeof r?i._orientation[2]:r,void 0===o){if("number"!=typeof t)return i._orientation;i._orientation=[t,n,r]}for(var a=i._getSoundIds(o),s=0;s<a.length;s++){var u=i._soundById(a[s]);if(u){if("number"!=typeof t)return u._orientation;u._orientation=[t,n,r],u._node&&(u._panner||(u._pos||(u._pos=i._pos||[0,0,-.5]),e(u,"spatial")),void 0!==u._panner.orientationX?(u._panner.orientationX.setValueAtTime(t,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(n,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):u._panner.setOrientation(t,n,r)),i._emit("orientation",u._id)}}return i},Howl.prototype.pannerAttr=function(){var t,n,r,o=this,i=arguments;if(!o._webAudio)return o;if(0===i.length)return o._pannerAttr;if(1===i.length){if("object"!=typeof i[0])return(r=o._soundById(parseInt(i[0],10)))?r._pannerAttr:o._pannerAttr;t=i[0],void 0===n&&(t.pannerAttr||(t.pannerAttr={coneInnerAngle:t.coneInnerAngle,coneOuterAngle:t.coneOuterAngle,coneOuterGain:t.coneOuterGain,distanceModel:t.distanceModel,maxDistance:t.maxDistance,refDistance:t.refDistance,rolloffFactor:t.rolloffFactor,panningModel:t.panningModel}),o._pannerAttr={coneInnerAngle:void 0!==t.pannerAttr.coneInnerAngle?t.pannerAttr.coneInnerAngle:o._coneInnerAngle,coneOuterAngle:void 0!==t.pannerAttr.coneOuterAngle?t.pannerAttr.coneOuterAngle:o._coneOuterAngle,coneOuterGain:void 0!==t.pannerAttr.coneOuterGain?t.pannerAttr.coneOuterGain:o._coneOuterGain,distanceModel:void 0!==t.pannerAttr.distanceModel?t.pannerAttr.distanceModel:o._distanceModel,maxDistance:void 0!==t.pannerAttr.maxDistance?t.pannerAttr.maxDistance:o._maxDistance,refDistance:void 0!==t.pannerAttr.refDistance?t.pannerAttr.refDistance:o._refDistance,rolloffFactor:void 0!==t.pannerAttr.rolloffFactor?t.pannerAttr.rolloffFactor:o._rolloffFactor,panningModel:void 0!==t.pannerAttr.panningModel?t.pannerAttr.panningModel:o._panningModel})}else 2===i.length&&(t=i[0],n=parseInt(i[1],10));for(var a=o._getSoundIds(n),s=0;s<a.length;s++)if(r=o._soundById(a[s])){var u=r._pannerAttr;u={coneInnerAngle:void 0!==t.coneInnerAngle?t.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:void 0!==t.coneOuterAngle?t.coneOuterAngle:u.coneOuterAngle,coneOuterGain:void 0!==t.coneOuterGain?t.coneOuterGain:u.coneOuterGain,distanceModel:void 0!==t.distanceModel?t.distanceModel:u.distanceModel,maxDistance:void 0!==t.maxDistance?t.maxDistance:u.maxDistance,refDistance:void 0!==t.refDistance?t.refDistance:u.refDistance,rolloffFactor:void 0!==t.rolloffFactor?t.rolloffFactor:u.rolloffFactor,panningModel:void 0!==t.panningModel?t.panningModel:u.panningModel};var c=r._panner;c||(r._pos||(r._pos=o._pos||[0,0,-.5]),e(r,"spatial"),c=r._panner),c.coneInnerAngle=u.coneInnerAngle,c.coneOuterAngle=u.coneOuterAngle,c.coneOuterGain=u.coneOuterGain,c.distanceModel=u.distanceModel,c.maxDistance=u.maxDistance,c.refDistance=u.refDistance,c.rolloffFactor=u.rolloffFactor,c.panningModel=u.panningModel}return o},Sound.prototype.init=function(t){return function(){var e=this,n=e._parent;e._orientation=n._orientation,e._stereo=n._stereo,e._pos=n._pos,e._pannerAttr=n._pannerAttr,t.call(this),e._stereo?n.stereo(e._stereo):e._pos&&n.pos(e._pos[0],e._pos[1],e._pos[2],e._id)}}(Sound.prototype.init),Sound.prototype.reset=function(t){return function(){var e=this,n=e._parent;return e._orientation=n._orientation,e._stereo=n._stereo,e._pos=n._pos,e._pannerAttr=n._pannerAttr,e._stereo?n.stereo(e._stereo):e._pos?n.pos(e._pos[0],e._pos[1],e._pos[2],e._id):e._panner&&(e._panner.disconnect(0),e._panner=void 0,n._refreshBuffer(e)),t.call(this)}}(Sound.prototype.reset);var e=function(t,e){"spatial"===(e=e||"spatial")?(t._panner=Howler.ctx.createPanner(),t._panner.coneInnerAngle=t._pannerAttr.coneInnerAngle,t._panner.coneOuterAngle=t._pannerAttr.coneOuterAngle,t._panner.coneOuterGain=t._pannerAttr.coneOuterGain,t._panner.distanceModel=t._pannerAttr.distanceModel,t._panner.maxDistance=t._pannerAttr.maxDistance,t._panner.refDistance=t._pannerAttr.refDistance,t._panner.rolloffFactor=t._pannerAttr.rolloffFactor,t._panner.panningModel=t._pannerAttr.panningModel,void 0!==t._panner.positionX?(t._panner.positionX.setValueAtTime(t._pos[0],Howler.ctx.currentTime),t._panner.positionY.setValueAtTime(t._pos[1],Howler.ctx.currentTime),t._panner.positionZ.setValueAtTime(t._pos[2],Howler.ctx.currentTime)):t._panner.setPosition(t._pos[0],t._pos[1],t._pos[2]),void 0!==t._panner.orientationX?(t._panner.orientationX.setValueAtTime(t._orientation[0],Howler.ctx.currentTime),t._panner.orientationY.setValueAtTime(t._orientation[1],Howler.ctx.currentTime),t._panner.orientationZ.setValueAtTime(t._orientation[2],Howler.ctx.currentTime)):t._panner.setOrientation(t._orientation[0],t._orientation[1],t._orientation[2])):(t._panner=Howler.ctx.createStereoPanner(),t._panner.pan.setValueAtTime(t._stereo,Howler.ctx.currentTime)),t._panner.connect(t._node),t._paused||t._parent.pause(t._id,!0).play(t._id,!0)}}()},694:(t,e,n)=>{"use strict";var r=n(925);function o(){}function i(){}i.resetWarningCache=o,t.exports=function(){function t(t,e,n,o,i,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},556:(t,e,n)=>{t.exports=n(694)()},925:t=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},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),h={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)e[p].references++,e[p].updater(h);else{var d=o(h,r);r.byIndex=s,e.splice(s,0,{identifier:f,updater:d,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))}}},73:(t,e,n)=>{"use strict";var r=n(12),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};
|
|
22
|
+
function(){"use strict";var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var e=this;if(!e.ctx||!e.ctx.listener)return e;for(var n=e._howls.length-1;n>=0;n--)e._howls[n].stereo(t);return e},HowlerGlobal.prototype.pos=function(t,e,n){var r=this;return r.ctx&&r.ctx.listener?(e="number"!=typeof e?r._pos[1]:e,n="number"!=typeof n?r._pos[2]:n,"number"!=typeof t?r._pos:(r._pos=[t,e,n],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(t,e,n,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return e="number"!=typeof e?s[1]:e,n="number"!=typeof n?s[2]:n,r="number"!=typeof r?s[3]:r,o="number"!=typeof o?s[4]:o,i="number"!=typeof i?s[5]:i,"number"!=typeof t?s:(a._orientation=[t,e,n,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(t,e,n,r,o,i),a)},Howl.prototype.init=(t=Howl.prototype.init,function(e){var n=this;return n._orientation=e.orientation||[1,0,0],n._stereo=e.stereo||null,n._pos=e.pos||null,n._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},n._onstereo=e.onstereo?[{fn:e.onstereo}]:[],n._onpos=e.onpos?[{fn:e.onpos}]:[],n._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,n){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(t,n)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===n){if("number"!=typeof t)return r._stereo;r._stereo=t,r._pos=[t,0,0]}for(var i=r._getSoundIds(n),a=0;a<i.length;a++){var s=r._soundById(i[a]);if(s){if("number"!=typeof t)return s._stereo;s._stereo=t,s._pos=[t,0,0],s._node&&(s._pannerAttr.panningModel="equalpower",s._panner&&s._panner.pan||e(s,o),"spatial"===o?void 0!==s._panner.positionX?(s._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),s._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),s._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):s._panner.setPosition(t,0,0):s._panner.pan.setValueAtTime(t,Howler.ctx.currentTime)),r._emit("stereo",s._id)}}return r},Howl.prototype.pos=function(t,n,r,o){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"pos",action:function(){i.pos(t,n,r,o)}}),i;if(n="number"!=typeof n?0:n,r="number"!=typeof r?-.5:r,void 0===o){if("number"!=typeof t)return i._pos;i._pos=[t,n,r]}for(var a=i._getSoundIds(o),s=0;s<a.length;s++){var u=i._soundById(a[s]);if(u){if("number"!=typeof t)return u._pos;u._pos=[t,n,r],u._node&&(u._panner&&!u._panner.pan||e(u,"spatial"),void 0!==u._panner.positionX?(u._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(n,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(r,Howler.ctx.currentTime)):u._panner.setPosition(t,n,r)),i._emit("pos",u._id)}}return i},Howl.prototype.orientation=function(t,n,r,o){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"orientation",action:function(){i.orientation(t,n,r,o)}}),i;if(n="number"!=typeof n?i._orientation[1]:n,r="number"!=typeof r?i._orientation[2]:r,void 0===o){if("number"!=typeof t)return i._orientation;i._orientation=[t,n,r]}for(var a=i._getSoundIds(o),s=0;s<a.length;s++){var u=i._soundById(a[s]);if(u){if("number"!=typeof t)return u._orientation;u._orientation=[t,n,r],u._node&&(u._panner||(u._pos||(u._pos=i._pos||[0,0,-.5]),e(u,"spatial")),void 0!==u._panner.orientationX?(u._panner.orientationX.setValueAtTime(t,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(n,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(r,Howler.ctx.currentTime)):u._panner.setOrientation(t,n,r)),i._emit("orientation",u._id)}}return i},Howl.prototype.pannerAttr=function(){var t,n,r,o=this,i=arguments;if(!o._webAudio)return o;if(0===i.length)return o._pannerAttr;if(1===i.length){if("object"!=typeof i[0])return(r=o._soundById(parseInt(i[0],10)))?r._pannerAttr:o._pannerAttr;t=i[0],void 0===n&&(t.pannerAttr||(t.pannerAttr={coneInnerAngle:t.coneInnerAngle,coneOuterAngle:t.coneOuterAngle,coneOuterGain:t.coneOuterGain,distanceModel:t.distanceModel,maxDistance:t.maxDistance,refDistance:t.refDistance,rolloffFactor:t.rolloffFactor,panningModel:t.panningModel}),o._pannerAttr={coneInnerAngle:void 0!==t.pannerAttr.coneInnerAngle?t.pannerAttr.coneInnerAngle:o._coneInnerAngle,coneOuterAngle:void 0!==t.pannerAttr.coneOuterAngle?t.pannerAttr.coneOuterAngle:o._coneOuterAngle,coneOuterGain:void 0!==t.pannerAttr.coneOuterGain?t.pannerAttr.coneOuterGain:o._coneOuterGain,distanceModel:void 0!==t.pannerAttr.distanceModel?t.pannerAttr.distanceModel:o._distanceModel,maxDistance:void 0!==t.pannerAttr.maxDistance?t.pannerAttr.maxDistance:o._maxDistance,refDistance:void 0!==t.pannerAttr.refDistance?t.pannerAttr.refDistance:o._refDistance,rolloffFactor:void 0!==t.pannerAttr.rolloffFactor?t.pannerAttr.rolloffFactor:o._rolloffFactor,panningModel:void 0!==t.pannerAttr.panningModel?t.pannerAttr.panningModel:o._panningModel})}else 2===i.length&&(t=i[0],n=parseInt(i[1],10));for(var a=o._getSoundIds(n),s=0;s<a.length;s++)if(r=o._soundById(a[s])){var u=r._pannerAttr;u={coneInnerAngle:void 0!==t.coneInnerAngle?t.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:void 0!==t.coneOuterAngle?t.coneOuterAngle:u.coneOuterAngle,coneOuterGain:void 0!==t.coneOuterGain?t.coneOuterGain:u.coneOuterGain,distanceModel:void 0!==t.distanceModel?t.distanceModel:u.distanceModel,maxDistance:void 0!==t.maxDistance?t.maxDistance:u.maxDistance,refDistance:void 0!==t.refDistance?t.refDistance:u.refDistance,rolloffFactor:void 0!==t.rolloffFactor?t.rolloffFactor:u.rolloffFactor,panningModel:void 0!==t.panningModel?t.panningModel:u.panningModel};var c=r._panner;c||(r._pos||(r._pos=o._pos||[0,0,-.5]),e(r,"spatial"),c=r._panner),c.coneInnerAngle=u.coneInnerAngle,c.coneOuterAngle=u.coneOuterAngle,c.coneOuterGain=u.coneOuterGain,c.distanceModel=u.distanceModel,c.maxDistance=u.maxDistance,c.refDistance=u.refDistance,c.rolloffFactor=u.rolloffFactor,c.panningModel=u.panningModel}return o},Sound.prototype.init=function(t){return function(){var e=this,n=e._parent;e._orientation=n._orientation,e._stereo=n._stereo,e._pos=n._pos,e._pannerAttr=n._pannerAttr,t.call(this),e._stereo?n.stereo(e._stereo):e._pos&&n.pos(e._pos[0],e._pos[1],e._pos[2],e._id)}}(Sound.prototype.init),Sound.prototype.reset=function(t){return function(){var e=this,n=e._parent;return e._orientation=n._orientation,e._stereo=n._stereo,e._pos=n._pos,e._pannerAttr=n._pannerAttr,e._stereo?n.stereo(e._stereo):e._pos?n.pos(e._pos[0],e._pos[1],e._pos[2],e._id):e._panner&&(e._panner.disconnect(0),e._panner=void 0,n._refreshBuffer(e)),t.call(this)}}(Sound.prototype.reset);var e=function(t,e){"spatial"===(e=e||"spatial")?(t._panner=Howler.ctx.createPanner(),t._panner.coneInnerAngle=t._pannerAttr.coneInnerAngle,t._panner.coneOuterAngle=t._pannerAttr.coneOuterAngle,t._panner.coneOuterGain=t._pannerAttr.coneOuterGain,t._panner.distanceModel=t._pannerAttr.distanceModel,t._panner.maxDistance=t._pannerAttr.maxDistance,t._panner.refDistance=t._pannerAttr.refDistance,t._panner.rolloffFactor=t._pannerAttr.rolloffFactor,t._panner.panningModel=t._pannerAttr.panningModel,void 0!==t._panner.positionX?(t._panner.positionX.setValueAtTime(t._pos[0],Howler.ctx.currentTime),t._panner.positionY.setValueAtTime(t._pos[1],Howler.ctx.currentTime),t._panner.positionZ.setValueAtTime(t._pos[2],Howler.ctx.currentTime)):t._panner.setPosition(t._pos[0],t._pos[1],t._pos[2]),void 0!==t._panner.orientationX?(t._panner.orientationX.setValueAtTime(t._orientation[0],Howler.ctx.currentTime),t._panner.orientationY.setValueAtTime(t._orientation[1],Howler.ctx.currentTime),t._panner.orientationZ.setValueAtTime(t._orientation[2],Howler.ctx.currentTime)):t._panner.setOrientation(t._orientation[0],t._orientation[1],t._orientation[2])):(t._panner=Howler.ctx.createStereoPanner(),t._panner.pan.setValueAtTime(t._stereo,Howler.ctx.currentTime)),t._panner.connect(t._node),t._paused||t._parent.pause(t._id,!0).play(t._id,!0)}}()},694:(t,e,n)=>{"use strict";var r=n(925);function o(){}function i(){}i.resetWarningCache=o,t.exports=function(){function t(t,e,n,o,i,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},556:(t,e,n)=>{t.exports=n(694)()},925:t=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},698:(t,e)=>{"use strict";var n=Symbol.for("react.transitional.element");
|
|
23
23
|
/**
|
|
24
24
|
* @license React
|
|
25
|
-
* react-jsx-runtime.production.
|
|
25
|
+
* react-jsx-runtime.production.js
|
|
26
26
|
*
|
|
27
|
-
* Copyright (c)
|
|
27
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the MIT license found in the
|
|
30
30
|
* LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/function c(t,e,n){var r,i={},c=null,l=null;for(r in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,r)&&!u.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:o,type:t,key:c,ref:l,props:i,_owner:s.current}}e.jsx=c,e.jsxs=c},387:(t,e,n)=>{"use strict";t.exports=n(73)},12:e=>{"use strict";e.exports=t},33:t=>{"use strict";t.exports=e}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={id:t,exports:{}};return n[t](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nc=void 0;var i={};return(()=>{"use strict";o.r(i),o.d(i,{Align:()=>Kt,BaseImageTransition:()=>xl,BaseTextTransition:()=>Al,BaseTransition:()=>kl,Bottom:()=>Dv,Center:()=>Fv,Character:()=>Zu,CommonPosition:()=>Yt,CommonPositionType:()=>Rt,Condition:()=>_c,Control:()=>Za,Coord2D:()=>Xt,Dissolve:()=>ym,Fade:()=>Jv,FadeIn:()=>sm,Game:()=>pd,GameProviders:()=>Lv,GameState:()=>Zh,HBox:()=>Hv,Image:()=>up,Isolated:()=>Nh,Lambda:()=>Sc,LiveGame:()=>rd,Menu:()=>Gc,Namespace:()=>sf,Pause:()=>ku,Persistent:()=>bf,Player:()=>Cv,Say:()=>Ih,Scene:()=>Lf,Script:()=>Zf,Sentence:()=>Lu,Sound:()=>bu,SoundType:()=>su,Storable:()=>uf,Story:()=>sp,Text:()=>Gl,Top:()=>Mv,Transform:()=>Ji,Utils:()=>au,VBox:()=>zv,Word:()=>Eu,useGame:()=>mp});var t={say:"character:say",action:"character:action",setName:"character:setName"},e={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform",transitionToScene:"scene:transitionToScene"},n={action:"image:action",setSrc:"image:setSrc",setPosition:"image:setPosition",show:"image:show",hide:"image:hide",applyTransform:"image:applyTransform",init:"image:init",dispose:"image:dispose",setTransition:"image:setTransition",applyTransition:"image:applyTransition",flush:"image:flush",initWearable:"image:initWearable",setAppearance:"image:setAppearance"},r={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},a={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat",sleep:"control:sleep"},s={action:"text:action",setText:"text:setText",show:"text:show",hide:"text:hide",applyTransform:"text:applyTransform",init:"text:init",applyTransition:"text:applyTransition",setFontSize:"text:setFontSize"},u={action:"displayable:action",layerMoveUp:"displayable:layerMoveUp",layerMoveDown:"displayable:layerMoveDown",layerMoveTop:"displayable:layerMoveTop",layerMoveBottom:"displayable:layerMoveBottom"},c={action:"persistent:action",set:"persistent:set"};function l(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */l=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new I(r||[]);return o(a,"_invoke",{value:T(t,n,s)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var h="suspendedStart",d="suspendedYield",y="executing",v="completed",m={};function g(){}function w(){}function S(){}var _={};c(_,a,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(L([])));x&&x!==n&&r.call(x,a)&&(_=x);var A=S.prototype=g.prototype=Object.create(_);function O(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(o,i,a,s){var u=p(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==b(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function T(e,n,r){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=j(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var c=p(e,n,r);if("normal"===c.type){if(o=r.done?v:d,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function j(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,j(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=p(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function L(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(b(e)+" is not iterable")}return w.prototype=S,o(A,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:w,configurable:!0}),w.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,c(t,u,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},O(E.prototype),c(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new E(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(A),c(A,u,"Generator"),c(A,a,(function(){return this})),c(A,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=L,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:L(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=m(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}function d(t,e,n){return e&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function y(t){var e=function(t,e){if("object"!=b(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==b(e)?e:e+""}function v(t){return function(t){if(Array.isArray(t))return g(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){if(t){if("string"==typeof t)return g(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(t,e):void 0}}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function b(t){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(t)}var w,S=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};!function(t){t[t.string=0]="string",t[t.number=1]="number",t[t.boolean=2]="boolean",t[t.object=3]="object",t[t.array=4]="array",t[t.function=5]="function",t[t.symbol=6]="symbol",t[t[void 0]=7]="undefined",t[t.null=8]="null",t[t.date=9]="date",t[t.regexp=10]="regexp",t[t.other=11]="other"}(w||(w={}));var _=function(t){return"string"==typeof t?w.string:"number"==typeof t?w.number:"boolean"==typeof t?w.boolean:"object"===b(t)?Array.isArray(t)?w.array:null===t?w.null:t instanceof Date?w.date:t instanceof RegExp?w.regexp:w.object:"function"==typeof t?w.function:"symbol"===b(t)?w.symbol:void 0===t?w.undefined:w.other};function k(t,e){var n,r,o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i={};for(var a in t)o(t,a)&&(i[a]=(n=t[a],r=e[a],_(n)===w.object&&_(r)===w.object?n.constructor!==Object||r.constructor!==Object?r||n:k(n,r):Array.isArray(n)&&Array.isArray(r)?r&&r.length>0?v(r):v(n):void 0===n&&Array.isArray(r)?v(r):void 0===r?Array.isArray(n)?v(n):n:Array.isArray(r)?v(r):r));for(var s in e)o(e,s)&&!o(i,s)&&("object"===b(e[s])&&null!==e[s]?e[s].constructor===Object?i[s]=k({},e[s]):Array.isArray(e[s])?i[s]=v(e[s]):i[s]=e[s]:i[s]=e[s]);for(var u=arguments.length,c=new Array(u>2?u-2:0),l=2;l<u;l++)c[l-2]=arguments[l];if(c.length){var f=c[0],p=c.slice(1);return k.apply(void 0,[i,f].concat(v(p)))}return i}_.DataTypes=w;var x=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},n=arguments.length>1?arguments[1]:void 0;p(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=n}return d(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var e,n=f(this.listeners);try{for(n.s();!(e=n.n()).done;){(0,e.value)(this.result)}}catch(t){n.e(t)}finally{n.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function A(t){var e=new WeakSet;return function t(n){if(null===n||"object"!==b(n))return n;if(!e.has(n)){if(e.add(n),Array.isArray(n)){var r,o=[],i=f(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;o.push(t(a))}}catch(t){i.e(t)}finally{i.f()}return o}var s={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(s[u]=t(n[u]));return s}}(t)}function O(t){return"string"==typeof t?t:"#".concat((t.r||0).toString(16).padStart(2,"0")).concat((t.g||0).toString(16).padStart(2,"0")).concat((t.b||0).toString(16).padStart(2,"0")).concat(void 0===t.a?"":t.a.toString(16).padStart(2,"0"))}x.nothing=function(t){return t};var E=function(){return d((function t(){p(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return S(this,void 0,void 0,l().mark((function e(){var r,o,i,a,s,u,c=this;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.events[t]||(this.events[t]=[]),r=[],o=!1,i=f(this.events[t]);try{for(i.s();!(a=i.n()).done;)s=a.value,(u=s.apply(void 0,n))&&"object"===b(u)&&"function"==typeof u.then?r.push(u):o=!0}catch(t){i.e(t)}finally{i.f()}if(!o){e.next=7;break}return e.abrupt("return",void 0);case 7:if(this.events[t]=this.events[t].filter((function(t){return!r.includes(t)})),0!==r.length){e.next=10;break}return e.abrupt("return",new Promise((function(e){var r=c.on("event:EventDispatcher.register",(function(o,i){if(o===t){c.off(o,r);var a=null==i?void 0:i.apply(void 0,n);a&&a.then?a.then(e):e(a)}}))})));case 10:return e.next=12,Promise.all(r);case 12:return e.abrupt("return",void 0);case 13:case"end":return e.stop()}}),e,this)})))}},{key:"clear",value:function(){this.events={}}}])}();function T(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function j(t){return new Promise((function(e){return setTimeout(e,t)}))}function P(t,e){if(t===e)return!0;if("object"!==b(t)||"object"!==b(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!P(t[a],e[a]))return!1}return!0}var C=function(){return d((function t(e){p(this,t),this.abortHandler=e,this.events=new E,this.aborted=!1}),[{key:"abort",value:function(){return this.aborted||(this.aborted=!0,this.result=this.abortHandler.apply(this,arguments)),this.result}},{key:"isAborted",value:function(){return this.aborted}},{key:"cancel",value:function(){this.aborted=!0}}])}();C.EventTypes={"event:skipController.abort":"event:skipController.abort"};var I=function(){return d((function t(){p(this,t),this.locked=!1,this.listeners=[],this.unlockListeners=[]}),[{key:"lock",value:function(){return this.locked=!0,this}},{key:"unlock",value:function(){this.locked=!1;var t,e=f(this.listeners);try{for(e.s();!(t=e.n()).done;){(0,t.value)()}}catch(t){e.e(t)}finally{e.f()}var n,r=f(this.unlockListeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)()}}catch(t){r.e(t)}finally{r.f()}return this.listeners=[],this}},{key:"onUnlock",value:function(t){return this.unlockListeners.push(t),t}},{key:"offUnlock",value:function(t){this.unlockListeners=this.unlockListeners.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return S(this,void 0,void 0,l().mark((function t(){var e=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.locked){t.next=2;break}return t.abrupt("return");case 2:return t.abrupt("return",new Promise((function(t){e.listeners.push(t)})));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locked}}])}(),L=function(){return d((function t(){p(this,t),this.locks=[]}),[{key:"unlock",value:function(t){return t.unlock(),this.off(t),t}},{key:"register",value:function(t){var e=t||new I;return this.locks.push(e),e}},{key:"off",value:function(t){this.locks=this.locks.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return S(this,void 0,void 0,l().mark((function t(){var e;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.locks.map((function(t){return t.nextUnlock()})),t.abrupt("return",Promise.all(e));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locks.some((function(t){return t.isLocked()}))}}])}();function N(t,e){return t?e:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}function R(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return void 0!==t};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&r in e&&n(t[r],r)&&e[r](t[r],r)}var M=function(){return d((function t(){p(this,t),this.taskToken=null}),[{key:"scheduleTask",value:function(t,e){this.taskToken&&this.taskToken.cancel();var n=!1,r=setTimeout((function(){n||t()}),e);return this.taskToken={cancel:function(){clearTimeout(r),n=!0},isCancelled:function(){return n}},this.taskToken}},{key:"cancelTask",value:function(){return this.taskToken&&(this.taskToken.cancel(),this.taskToken=null),this}}])}();function F(t,e,n){var r=t.indexOf(e);if(-1===r)return t;var o=v(t);return o.splice(r,1),o.splice(n,0,e),o}var D=function(){return d((function t(e,n){p(this,t),this.concurrency=e,this.delay=n,this.tasks=[]}),[{key:"addTask",value:function(t){this.tasks.push(t)}},{key:"start",value:function(){return S(this,void 0,void 0,l().mark((function t(){var e,n=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=function(){return S(n,void 0,void 0,l().mark((function t(){var n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==this.tasks.length){t.next=2;break}return t.abrupt("return");case 2:return n=this.tasks.splice(0,this.concurrency),t.next=5,Promise.all(n.map((function(t){return t()})));case 5:return t.next=7,j(this.delay);case 7:return t.next=9,e();case 9:case"end":return t.stop()}}),t,this)})))},t.next=3,e();case 3:case"end":return t.stop()}}),t)})))}}])}();function B(t){var e=!1,n=Promise.resolve().then((function(){return e=!0,t()}));return function(){e&&n.then((function(t){t&&t()}))}}function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function G(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,U(r.key),r)}}function U(t){var e=function(t,e){if("object"!=V(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=V(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==V(e)?e:e+""}var W=function(){return function(t,e,n){return e&&G(t.prototype,e),n&&G(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.callee=e,this.type=n,this.contentNode=r,this.__stack=T(),this._id=""}),[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode.getChild()}}},{key:"getId",value:function(){return this._id}},{key:"setId",value:function(t){this._id=t}},{key:"setContent",value:function(t){return this.contentNode.setContent(t),this}},{key:"setContentNode",value:function(t){return this.contentNode=t,this}},{key:"getFutureActions",value:function(t){var e=this.contentNode.getChild();return e&&e.action?[e.action]:[]}}])}();function z(t){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},z(t)}function H(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */H=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==z(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(z(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function $(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,q(r.key),r)}}function q(t){var e=function(t,e){if("object"!=z(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==z(e)?e:e+""}function Y(t,e,n){return e=K(e),function(t,e){if(e&&("object"==z(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,X()?Reflect.construct(e,n||[],K(t).constructor):e.apply(t,n))}function X(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(X=function(){return!!t})()}function K(t){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},K(t)}function Z(t,e){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Z(t,e)}W.ActionTypes={action:"action"};var Q=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},J=function(t){function e(t,n,r){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=Y(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Z(t,e)}(e,t),function(t,e,n){return e&&$(t.prototype,e),n&&$(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"unknownTypeError",value:function(){throw new Error("Unknown action type: "+this.type)}},{key:"resolveAwaitable",value:function(t,e){var n=this,r=e||new x((function(t){return t}));return Q(n,void 0,void 0,H().mark((function e(){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t(r.resolve.bind(r),r);case 2:case"end":return e.stop()}}),e)}))),r}},{key:"is",value:function(t,e){return this instanceof t&&this.type===e}}])}(W);function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return nt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nt(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function rt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ot(r.key),r)}}function ot(t){var e=function(t,e){if("object"!=tt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tt(e)?e:e+""}function it(t,e,n){return e=ct(e),function(t,e){if(e&&("object"==tt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,at()?Reflect.construct(e,n||[],ct(t).constructor):e.apply(t,n))}function at(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(at=function(){return!!t})()}function st(t,e,n,r){var o=ut(ct(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ut(){return ut="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ct(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},ut.apply(null,arguments)}function ct(t){return ct=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ct(t)}function lt(t,e){return lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},lt(t,e)}var ft=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),it(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&<(t,e)}(e,t),function(t,e,n){return e&&rt(t.prototype,e),n&&rt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===r.play){if(e.initSound(t,this.callee),!this.callee.getPlaying())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var o=new x((function(t){return t}));return t.playSound(this.callee,(function(){var e;t.stopSound(n.callee),o.resolve({type:n.type,node:null===(e=n.contentNode)||void 0===e?void 0:e.getChild()})})),o}return t.playSound(this.callee,(function(){t.stopSound(n.callee)})),st(e,"executeAction",this,3)([t])}if(this.type===r.stop)return t.stopSound(this.callee),st(e,"executeAction",this,3)([t]);if(this.type===r.fade){var i=et(this.contentNode.getContent(),1)[0],a=i.start,s=i.end,u=i.duration;if(this.callee.getPlaying()){var c=void 0===a?this.callee.getPlaying().volume():a;this.callee.getPlaying().fade(c,s,u,this.callee.getToken())}return st(e,"executeAction",this,3)([t])}if(this.type===r.setVolume){var l=et(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().volume(l,this.callee.getToken()),st(e,"executeAction",this,3)([t])}if(this.type===r.setRate){var f=et(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().rate(f,this.callee.getToken()),st(e,"executeAction",this,3)([t])}if(this.type===r.pause)return this.callee.getPlaying()&&this.callee.getPlaying().pause(this.callee.getToken()),st(e,"executeAction",this,3)([t]);if(this.type===r.resume)return this.callee.getPlaying()&&this.callee.getPlaying().play(this.callee.getToken()),st(e,"executeAction",this,3)([t]);throw st(e,"unknownTypeError",this,3)([])}}],[{key:"initSound",value:function(t,e){e.getPlaying()||e.setPlaying(new(t.getHowl())(e.getHowlOptions()))}}])}(J);function pt(t){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(t)}function ht(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return dt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dt(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function yt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,vt(r.key),r)}}function vt(t){var e=function(t,e){if("object"!=pt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pt(e)?e:e+""}function mt(t,e,n){return e=St(e),function(t,e){if(e&&("object"==pt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,gt()?Reflect.construct(e,n||[],St(t).constructor):e.apply(t,n))}function gt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(gt=function(){return!!t})()}function bt(t,e,n,r){var o=wt(St(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function wt(){return wt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=St(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},wt.apply(null,arguments)}function St(t){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},St(t)}function _t(t,e){return _t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_t(t,e)}ft.ActionTypes=r;var kt,xt=function(t){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),mt(this,n,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_t(t,e)}(n,t),function(t,e,n){return e&&yt(t.prototype,e),n&&yt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"applyTransition",value:function(t,e){var n=this,r=(new x).registerSkipController(new C((function(){return t.logger.info("Background Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransition",e).then((function(){r.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),r}},{key:"executeAction",value:function(t){var r=this;if(this.type===e.action)return bt(n,"executeAction",this,3)([t]);if(this.type===e.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],bt(n,"executeAction",this,3)([t]);if(this.type===e.sleep){var o=new x((function(t){return t})),i=this.contentNode.getContent();return new Promise((function(t){"number"==typeof i?setTimeout((function(){t()}),i):x.isAwaitable(i)?i.then(t):null==i||i.then(t)})).then((function(){o.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),o}if(this.type===e.applyTransition){var a=ht(this.contentNode.getContent(),1)[0];return this.applyTransition(t,a)}if(this.is(n,"scene:init")){var s=new x((function(t){return t}));return n.handleSceneInit(this,t,s)}if(this.type===e.exit){t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var u=new x((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){u.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),u}if(this.type===e.jumpTo){var c=this.contentNode.getContent()[0],l=this.contentNode,f=t.getStory().getScene(c);if(!f)throw this._sceneNotFoundError(this.getSceneName(c));var p=f.getSceneRoot().contentNode;return p&&l.addChild(p),{type:this.type,node:p}}if(this.type===e.setBackgroundMusic){var h=ht(this.contentNode.getContent(),2),d=h[0],y=h[1];return this.callee.events.emit("event:scene.setBackgroundMusic",d,y||0),bt(n,"executeAction",this,3)([t])}if(this.type===e.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),t.game.getLiveGame().getStorable().removeNamespace(this.callee.local.getNamespaceName()),bt(n,"executeAction",this,3)([t]);if(this.type===e.applyTransform){var v=ht(this.contentNode.getContent(),1)[0],m=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransform",v).then((function(){m.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),m}if(this.type===e.transitionToScene){var g=ht(this.contentNode.getContent(),3),b=g[0],w=g[1],S=g[2];if(w){var _=t.getStory().getScene(w);if(!_)throw this._sceneNotFoundError(this.getSceneName(w));if(!_.config.background)return bt(n,"executeAction",this,3)([t]);b.setSrc(_.config.background)}else S&&b.setSrc(S);return this.applyTransition(t,b)}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(t){var n,r;if(this.type===e.jumpTo){var o=this.contentNode.getContent()[0],i=t.getScene(o,!0);i.isSceneRootConstructed()||i.constructSceneRoot(t);var a=null===(n=t.getScene(o,!0).getSceneRoot())||void 0===n?void 0:n.contentNode;return(null==a?void 0:a.action)?[a.action]:[]}var s=null===(r=this.contentNode.getChild())||void 0===r?void 0:r.action;return s?[s]:[]}},{key:"_sceneNotFoundError",value:function(t){return new lu("Scene with name ".concat(t," not found")+"\nMake sure you have registered the scene using story.register"+"\nAction: (id: ".concat(this.getId(),") ").concat(this.type)+"\nAt: ".concat(this.__stack))}},{key:"getSceneName",value:function(t){return"string"==typeof t?t:t.name}}],[{key:"handleSceneInit",value:function(t,e,r){var o=ht(t.contentNode.getContent(),1)[0],i="string"==typeof o?e.getSceneByName(o):o;if(!i)throw t._sceneNotFoundError(t.getSceneName(o));return e.isSceneActive(i)?{type:t.type,node:t.contentNode.getChild()}:(e.registerSrcManager(i.srcManager).addScene(i),i.local.init(e.game.getLiveGame().getStorable()),n.registerEventListeners(i,e,(function(){r.resolve({type:t.type,node:t.contentNode.getChild()}),e.stage.next()})),r)}},{key:"registerEventListeners",value:function(t,e,n){t.events.once("event:scene.unmount",(function(){e.offSrcManager(t.srcManager)})),t.events.once("event:scene.mount",(function(){t.state.backgroundMusic&&(ft.initSound(e,t.state.backgroundMusic),t.events.emit("event:scene.setBackgroundMusic",t.state.backgroundMusic,t.config.backgroundMusicFade))})),t.events.any("event:displayable.init").then((function(){n&&n()}))}}])}(J);function At(t){return At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},At(t)}function Ot(t,e,n){return e=Tt(e),function(t,e){if(e&&("object"==At(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Et()?Reflect.construct(e,n||[],Tt(t).constructor):e.apply(t,n))}function Et(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Et=function(){return!!t})()}function Tt(t){return Tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Tt(t)}function jt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pt(t,e)}function Pt(t,e){return Pt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pt(t,e)}function Ct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function It(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Nt(r.key),r)}}function Lt(t,e,n){return e&&It(t.prototype,e),n&&It(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Nt(t){var e=function(t,e){if("object"!=At(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=At(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==At(e)?e:e+""}xt.ActionTypes=e,function(t){t.TreeNode="TreeNode",t.ContentNode="ContentNode"}(kt||(kt={}));var Rt,Mt=function(t){function e(t,n,r){var o;return Ct(this,e),(o=Ot(this,e,[kt.ContentNode])).child=r||null,o.parent=n||null,o.action=t||null,o}return jt(e,t),Lt(e,[{key:"setParent",value:function(t){if(t===this)throw new Error("Cannot set parent to itself");return this.parent=t,this}},{key:"setChild",value:function(t){if(t===this)throw new Error("Cannot set child to itself");return this.child=t,t&&t.parent!==this&&t.remove().setParent(this),this}},{key:"getChild",value:function(){return this.child||null}},{key:"getParent",value:function(){return this.parent||null}},{key:"addChild",value:function(t){return this.setChild(t),this}},{key:"removeChild",value:function(t){return t&&this.child===t?(this.child=null,t.setParent(null)):t||(this.child=null),this}},{key:"remove",value:function(){var t;return null===(t=this.parent)||void 0===t||t.removeChild(this),this}},{key:"hasChild",value:function(){return!!this.child}}],[{key:"create",value:function(t){return(new e).setContent(t)}},{key:"forEachParent",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getParent()}},{key:"forEachChild",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getChild()}}])}(function(){return Lt((function t(e){Ct(this,t),this.type=e,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}()),Ft="center",Dt="left",Bt="right";function Vt(t){return Vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vt(t)}function Gt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ut(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ht(r.key),r)}}function Wt(t,e,n){return e&&Ut(t.prototype,e),n&&Ut(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function zt(t,e,n){return(e=Ht(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ht(t){var e=function(t,e){if("object"!=Vt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Vt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vt(e)?e:e+""}!function(t){t.Left="left",t.Center="center",t.Right="right"}(Rt||(Rt={}));var $t=zt(zt(zt({},Rt.Left,"33.33%"),Rt.Center,"50%"),Rt.Right,"66.66%"),qt=function(){function t(){Gt(this,t)}return Wt(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"calc(".concat(e," + 0px)");var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + (").concat(n,"px))")}},{key:"toCoord2D",value:function(t){if(Yt.isCommonPositionType(t))return Xt.fromCommonPosition(t);if(Xt.isCoord2DPosition(t))return t;if(Kt.isAlignPosition(t))return Xt.fromAlignPosition(t);if("object"===Vt(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new Xt(t);throw new Error("Invalid position type")}},{key:"orUnknown",value:function(e){return t.isUnknown(e)||void 0===e?t.Unknown:e}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return Xt.merge(n,r)}},{key:"serializePosition",value:function(e){var n=this.toCoord2D(e);return{x:t.isUnknown(n.x)?0:n.x,y:t.isUnknown(n.y)?0:n.y,xoffset:t.isUnknown(n.xoffset)?0:n.xoffset,yoffset:t.isUnknown(n.yoffset)?0:n.yoffset}}},{key:"isRawCommonPositionType",value:function(t){return Object.values(Rt).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===Vt(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===Vt(t)&&("xalign"in t||"yalign"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawPosition",value:function(t){return this.isRawCommonPositionType(t)||this.isRawCoord2DPosition(t)||this.isRawAlignPosition(t)}},{key:"isPosition",value:function(t){return t instanceof Yt||t instanceof Xt||t instanceof Kt}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return Xt.fromCommonPosition(new Yt(t));if(this.isRawCoord2DPosition(t))return new Xt(t);if(this.isRawAlignPosition(t))return Xt.fromAlignPosition(t);throw new Error("Invalid position type")}},{key:"tryParsePosition",value:function(t){if(this.isPosition(t))return t;if(this.isRawPosition(t))return this.rawPositionToCoord2D(t);throw new Error("Invalid position type")}}])}();qt.Unknown=Symbol("Unknown");var Yt=function(){function t(e){Gt(this,t),this.position=e}return Wt(t,[{key:"toCSS",value:function(){return{x:$t[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();Yt.Positions=Rt;var Xt=function(){function t(e,n){Gt(this,t),"object"===Vt(e)?(this.x=qt.orUnknown(e.x),this.y=qt.orUnknown(e.y),this.xoffset=qt.orUnknown(e.xoffset),this.yoffset=qt.orUnknown(e.yoffset)):(this.x=qt.orUnknown(e),this.y=qt.orUnknown(n),this.xoffset=qt.Unknown,this.yoffset=qt.Unknown)}return Wt(t,[{key:"toCSS",value:function(){return{x:this.x,y:this.y,xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isCoord2DPosition",value:function(e){return e instanceof t}},{key:"fromCommonPosition",value:function(e){return new t({x:$t[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:qt.isUnknown(e.xalign)?qt.Unknown:"".concat(100*e.xalign,"%"),y:qt.isUnknown(e.yalign)?qt.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:qt.isUnknown(n.x)?e.x:n.x,y:qt.isUnknown(n.y)?e.y:n.y,xoffset:qt.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:qt.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),Kt=function(){function t(e,n){Gt(this,t),"object"===Vt(e)?(this.xalign=qt.orUnknown(e.xalign),this.yalign=qt.orUnknown(e.yalign),this.xoffset=qt.orUnknown(e.xoffset),this.yoffset=qt.orUnknown(e.yoffset)):(this.xalign=qt.orUnknown(e),this.yalign=qt.orUnknown(n),this.xoffset=qt.Unknown,this.yoffset=qt.Unknown)}return Wt(t,[{key:"toCSS",value:function(){return{x:qt.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:qt.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();function Zt(t){let e;return()=>(void 0===e&&(e=t()),e)}const Qt=Zt((()=>void 0!==window.ScrollTimeline));class Jt{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map((n=>Qt()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const te=t=>1e3*t,ee=t=>t/1e3;function ne(t,e){return e?t*(1e3/e):0}const re=5;function oe(t,e,n){const r=Math.max(e-re,0);return ne(n-t(r),e-r)}const ie=t=>t;let ae=ie,se=ie;const ue=(t,e,n)=>n>e?e:n<t?t:n,ce=.001,le=.01,fe=10,pe=.05,he=1;function de({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i;ae(t<=te(fe),"Spring duration must be 10 seconds or less");let a=1-e;a=ue(pe,he,a),t=ue(le,fe,ee(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=ve(e,a),u=Math.exp(-o);return ce-i/s*u},i=e=>{const r=e*a*t,i=r*n+n,s=Math.pow(a,2)*Math.pow(e,2)*t,u=Math.exp(-r),c=ve(Math.pow(e,2),a);return(-o(e)+ce>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-ce,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<ye;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=te(t),isNaN(s))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(s,2)*r;return{stiffness:e,damping:2*a*Math.sqrt(r*e),duration:t}}}const ye=12;function ve(t,e){return t*Math.sqrt(1-e*e)}const me=["duration","bounce"],ge=["stiffness","damping","mass"];function be(t,e){return e.some((e=>void 0!==t[e]))}function we({keyframes:t,restDelta:e,restSpeed:n,...r}){const o=t[0],i=t[t.length-1],a={done:!1,value:o},{stiffness:s,damping:u,mass:c,duration:l,velocity:f,isResolvedFromDuration:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!be(t,ge)&&be(t,me)){const n=de(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...r,velocity:-ee(r.velocity||0)}),h=f||0,d=u/(2*Math.sqrt(s*c)),y=i-o,v=ee(Math.sqrt(s/c)),m=Math.abs(y)<5;let g;if(n||(n=m?.01:2),e||(e=m?.005:.5),d<1){const t=ve(v,d);g=e=>{const n=Math.exp(-d*v*e);return i-n*((h+d*v*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}}else if(1===d)g=t=>i-Math.exp(-v*t)*(y+(h+v*y)*t);else{const t=v*Math.sqrt(d*d-1);g=e=>{const n=Math.exp(-d*v*e),r=Math.min(t*e,300);return i-n*((h+d*v*y)*Math.sinh(r)+t*y*Math.cosh(r))/t}}return{calculatedDuration:p&&l||null,next:t=>{const r=g(t);if(p)a.done=t>=l;else{let o=0;d<1&&(o=0===t?te(h):oe(g,t,r));const s=Math.abs(o)<=n,u=Math.abs(i-r)<=e;a.done=s&&u}return a.value=a.done?i:r,a}}}const Se=2e4;function _e(t){let e=0;let n=t.next(e);for(;!n.done&&e<Se;)e+=50,n=t.next(e);return e>=Se?1/0:e}function ke(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(_e(r),Se);return{type:"keyframes",ease:t=>r.next(o*t).value/e,duration:ee(o)}}const xe=(t,e,n)=>t+(e-t)*n,Ae=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r};function Oe(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=Ae(0,e,r);t.push(xe(n,1,o))}}function Ee(t){const e=[0];return Oe(e,t.length-1),e}const Te=t=>Boolean(t&&t.getVelocity);function je(t){return"object"==typeof t&&!Array.isArray(t)}function Pe(t,e,n,r){return"string"==typeof t&&je(e)?function(t,e,n){var r;if("string"==typeof t){let o=document;e&&(se(Boolean(e.current),"Scope provided, but no element detected."),o=e.current),n?(null!==(r=n[t])&&void 0!==r||(n[t]=o.querySelectorAll(t)),t=n[t]):t=o.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function Ce(t){return"function"==typeof t}function Ie(t,e,n,r){var o;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(o=r.get(e))&&void 0!==o?o:t}const Le=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t},Ne=t=>Array.isArray(t)&&"number"!=typeof t[0];function Re(t,e){return Ne(t)?t[Le(0,t.length,e)]:t}function Me(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function Fe(t,e,n,r,o,i){!function(t,e,n){for(let r=0;r<t.length;r++){const o=t[r];o.at>e&&o.at<n&&(Me(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:xe(o,i,r[a]),easing:Re(n,a)})}function De(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}const Be="easeInOut";function Ve(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function Ge(t,e){return e[t]||(e[t]=[]),e[t]}function Ue(t){return Array.isArray(t)?t:[t]}function We(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const ze=t=>"number"==typeof t,He=t=>t.every(ze),$e=new WeakMap,qe=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ye=new Set(qe),Xe={type:"spring",stiffness:500,damping:25,restSpeed:10},Ke={type:"keyframes",duration:.8},Ze={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Qe=(t,{keyframes:e})=>e.length>2?Ke:Ye.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Xe:Ze;function Je(t,e){return t?t[e]||t.default||t:void 0}const tn=!1,en=!1,nn=!1,rn=t=>null!==t;function on(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(rn),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const an=["read","resolveKeyframes","update","preRender","render","postRender"];function sn(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=an.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,r=!1,o=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function s(e){i.has(e)&&(u.schedule(e),t()),e(a)}const u={schedule:(t,o=!1,a=!1)=>{const s=a&&r?e:n;return o&&i.add(t),s.has(t)||s.add(t),t},cancel:t=>{n.delete(t),i.delete(t)},process:t=>{a=t,r?o=!0:(r=!0,[e,n]=[n,e],n.clear(),e.forEach(s),r=!1,o&&(o=!1,u.process(t)))}};return u}(i),t)),{}),{read:s,resolveKeyframes:u,update:c,preRender:l,render:f,postRender:p}=a,h=()=>{const i=en?o.timestamp:performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(i-o.timestamp,40),1),o.timestamp=i,o.isProcessing=!0,s.process(o),u.process(o),c.process(o),l.process(o),f.process(o),p.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(h))};return{schedule:an.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(h)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<an.length;e++)a[an[e]].cancel(t)},state:o,steps:a}}const{schedule:un,cancel:cn,state:ln,steps:fn}=sn("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:ie,!0),pn=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,hn=1e-7,dn=12;function yn(t,e,n,r){if(t===e&&n===r)return ie;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=pn(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>hn&&++s<dn);return a}(e,0,1,t,n);return t=>0===t||1===t?t:pn(o(t),e,r)}const vn=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,mn=t=>e=>1-t(1-e),gn=yn(.33,1.53,.69,.99),bn=mn(gn),wn=vn(bn),Sn=t=>(t*=2)<1?.5*bn(t):.5*(2-Math.pow(2,-10*(t-1))),_n=t=>1-Math.sin(Math.acos(t)),kn=mn(_n),xn=vn(_n),An=t=>/^0[^.\s]+$/u.test(t);const On=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),En=t=>e=>"string"==typeof e&&e.startsWith(t),Tn=En("--"),jn=En("var(--"),Pn=t=>!!jn(t)&&Cn.test(t.split("/*")[0].trim()),Cn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,In=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ln(t,e,n=1){se(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,o]=function(t){const e=In.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${null!=n?n:r}`,o]}(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const t=i.trim();return On(t)?parseFloat(t):t}return Pn(o)?Ln(o,e,n+1):o}const Nn={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Rn={...Nn,transform:t=>ue(0,1,t)},Mn={...Nn,default:1},Fn=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Dn=Fn("deg"),Bn=Fn("%"),Vn=Fn("px"),Gn=Fn("vh"),Un=Fn("vw"),Wn={...Bn,parse:t=>Bn.parse(t)/100,transform:t=>Bn.transform(100*t)},zn=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Hn=t=>t===Nn||t===Vn,$n=(t,e)=>parseFloat(t.split(", ")[e]),qn=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return $n(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?$n(e[1],t):0}},Yn=new Set(["x","y","z"]),Xn=qe.filter((t=>!Yn.has(t)));const Kn={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:qn(4,13),y:qn(5,14)};Kn.translateX=Kn.x,Kn.translateY=Kn.y;const Zn=t=>e=>e.test(t),Qn=[Nn,Vn,Bn,Dn,Un,Gn,{test:t=>"auto"===t,parse:t=>t}],Jn=t=>Qn.find(Zn(t)),tr=new Set;let er=!1,nr=!1;function rr(){if(nr){const t=Array.from(tr).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return Xn.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var r;null===(r=t.getValue(e))||void 0===r||r.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}nr=!1,er=!1,tr.forEach((t=>t.complete())),tr.clear()}function or(){tr.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(nr=!0)}))}class ir{constructor(t,e,n,r,o,i=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=r,this.element=o,this.isAsync=i}scheduleResolve(){this.isScheduled=!0,this.isAsync?(tr.add(this),er||(er=!0,un.read(or),un.resolveKeyframes(rr))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:r}=this;for(let o=0;o<t.length;o++)if(null===t[o])if(0===o){const o=null==r?void 0:r.get(),i=t[t.length-1];if(void 0!==o)t[0]=o;else if(n&&e){const r=n.readValue(e,i);null!=r&&(t[0]=r)}void 0===t[0]&&(t[0]=i),r&&void 0===o&&r.set(t[0])}else t[o]=t[o-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),tr.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,tr.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const ar=t=>Math.round(1e5*t)/1e5,sr=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const ur=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,cr=(t,e)=>n=>Boolean("string"==typeof n&&ur.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),lr=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[o,i,a,s]=r.match(sr);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},fr={...Nn,transform:t=>Math.round((t=>ue(0,255,t))(t))},pr={test:cr("rgb","red"),parse:lr("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+fr.transform(t)+", "+fr.transform(e)+", "+fr.transform(n)+", "+ar(Rn.transform(r))+")"};const hr={test:cr("#"),parse:function(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:pr.transform},dr={test:cr("hsl","hue"),parse:lr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Bn.transform(ar(e))+", "+Bn.transform(ar(n))+", "+ar(Rn.transform(r))+")"},yr={test:t=>pr.test(t)||hr.test(t)||dr.test(t),parse:t=>pr.test(t)?pr.parse(t):dr.test(t)?dr.parse(t):hr.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?pr.transform(t):dr.transform(t)},vr=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const mr="number",gr="color",br="var",wr="var(",Sr="${}",_r=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function kr(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(_r,(t=>(yr.test(t)?(r.color.push(i),o.push(gr),n.push(yr.parse(t))):t.startsWith(wr)?(r.var.push(i),o.push(br),n.push(t)):(r.number.push(i),o.push(mr),n.push(parseFloat(t))),++i,Sr))).split(Sr);return{values:n,split:a,indexes:r,types:o}}function xr(t){return kr(t).values}function Ar(t){const{split:e,types:n}=kr(t),r=e.length;return t=>{let o="";for(let i=0;i<r;i++)if(o+=e[i],void 0!==t[i]){const e=n[i];o+=e===mr?ar(t[i]):e===gr?yr.transform(t[i]):t[i]}return o}}const Or=t=>"number"==typeof t?0:t;const Er={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(sr))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(vr))||void 0===n?void 0:n.length)||0)>0},parse:xr,createTransformer:Ar,getAnimatableNone:function(t){const e=xr(t);return Ar(t)(e.map(Or))}},Tr=new Set(["brightness","contrast","saturate","opacity"]);function jr(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(sr)||[];if(!r)return t;const o=n.replace(r,"");let i=Tr.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const Pr=/\b([a-z-]*)\(.*?\)/gu,Cr={...Er,getAnimatableNone:t=>{const e=t.match(Pr);return e?e.map(jr).join(" "):t}},Ir={borderWidth:Vn,borderTopWidth:Vn,borderRightWidth:Vn,borderBottomWidth:Vn,borderLeftWidth:Vn,borderRadius:Vn,radius:Vn,borderTopLeftRadius:Vn,borderTopRightRadius:Vn,borderBottomRightRadius:Vn,borderBottomLeftRadius:Vn,width:Vn,maxWidth:Vn,height:Vn,maxHeight:Vn,top:Vn,right:Vn,bottom:Vn,left:Vn,padding:Vn,paddingTop:Vn,paddingRight:Vn,paddingBottom:Vn,paddingLeft:Vn,margin:Vn,marginTop:Vn,marginRight:Vn,marginBottom:Vn,marginLeft:Vn,backgroundPositionX:Vn,backgroundPositionY:Vn},Lr={rotate:Dn,rotateX:Dn,rotateY:Dn,rotateZ:Dn,scale:Mn,scaleX:Mn,scaleY:Mn,scaleZ:Mn,skew:Dn,skewX:Dn,skewY:Dn,distance:Vn,translateX:Vn,translateY:Vn,translateZ:Vn,x:Vn,y:Vn,z:Vn,perspective:Vn,transformPerspective:Vn,opacity:Rn,originX:Wn,originY:Wn,originZ:Vn},Nr={...Nn,transform:Math.round},Rr={...Ir,...Lr,zIndex:Nr,size:Vn,fillOpacity:Rn,strokeOpacity:Rn,numOctaves:Nr},Mr={...Rr,color:yr,backgroundColor:yr,outlineColor:yr,fill:yr,stroke:yr,borderColor:yr,borderTopColor:yr,borderRightColor:yr,borderBottomColor:yr,borderLeftColor:yr,filter:Cr,WebkitFilter:Cr},Fr=t=>Mr[t];function Dr(t,e){let n=Fr(t);return n!==Cr&&(n=Er),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Br=new Set(["auto","none","0"]);class Vr extends ir{constructor(t,e,n,r,o){super(t,e,n,r,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let r=t[n];if("string"==typeof r&&(r=r.trim(),Pn(r))){const o=Ln(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!zn.has(n)||2!==t.length)return;const[r,o]=t,i=Jn(r),a=Jn(o);if(i!==a)if(Hn(i)&&Hn(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)("number"==typeof(r=t[e])?0===r:null===r||"none"===r||"0"===r||An(r))&&n.push(e);var r;n.length&&function(t,e,n){let r,o=0;for(;o<t.length&&!r;){const e=t[o];"string"==typeof e&&!Br.has(e)&&kr(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=Dr(n,r)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Kn[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const r=e[e.length-1];void 0!==r&&t.getValue(n,r).jump(r,!1)}measureEndState(){var t;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const i=r.length-1,a=r[i];r[i]=Kn[n](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==a&&void 0===this.finalKeyframe&&(this.finalKeyframe=a),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach((([t,n])=>{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}let Gr;function Ur(){Gr=void 0}const Wr={now:()=>(void 0===Gr&&Wr.set(ln.isProcessing||en?ln.timestamp:performance.now()),Gr),set:t=>{Gr=t,queueMicrotask(Ur)}},zr=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Er.test(t)&&"0"!==t||t.startsWith("url(")));function Hr(t,e,n,r){const o=t[0];if(null===o)return!1;if("display"===e||"visibility"===e)return!0;const i=t[t.length-1],a=zr(o,e),s=zr(i,e);return ae(a===s,`You are trying to animate ${e} from "${o}" to "${i}". ${o} is not an animatable value - to enable this animation set ${o} to a value animatable to ${i} via the \`style\` property.`),!(!a||!s)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||Ce(n))&&r)}class $r{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:r=0,repeatDelay:o=0,repeatType:i="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Wr.now(),this.options={autoplay:t,delay:e,type:n,repeat:r,repeatDelay:o,repeatType:i,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(or(),rr()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Wr.now(),this.hasAttemptedResolve=!0;const{name:n,type:r,velocity:o,delay:i,onComplete:a,onUpdate:s,isGenerator:u}=this.options;if(!u&&!Hr(t,n,r,o)){if(nn||!i)return null==s||s(on(t,this.options,e)),null==a||a(),void this.resolveFinishedPromise();this.options.duration=0}const c=this.initPlayback(t,e);!1!==c&&(this._resolved={keyframes:t,finalKeyframe:e,...c},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function qr({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:u,restDelta:c=.5,restSpeed:l}){const f=t[0],p={done:!1,value:f},h=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let d=n*e;const y=f+d,v=void 0===a?y:a(y);v!==y&&(d=v-f);const m=t=>-d*Math.exp(-t/r),g=t=>v+m(t),b=t=>{const e=m(t),n=g(t);p.done=Math.abs(e)<=c,p.value=p.done?v:n};let w,S;const _=t=>{var e;(e=p.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,S=we({keyframes:[p.value,h(p.value)],velocity:oe(g,t,p.value),damping:o,stiffness:i,restDelta:c,restSpeed:l}))};return _(0),{calculatedDuration:null,next:t=>{let e=!1;return S||void 0!==w||(e=!0,b(t),_(t)),void 0!==w&&t>=w?S.next(t-w):(!e&&b(t),p)}}}const Yr=yn(.42,0,1,1),Xr=yn(0,0,.58,1),Kr=yn(.42,0,.58,1),Zr=t=>Array.isArray(t)&&"number"==typeof t[0],Qr={linear:ie,easeIn:Yr,easeInOut:Kr,easeOut:Xr,circIn:_n,circInOut:xn,circOut:kn,backIn:bn,backInOut:wn,backOut:gn,anticipate:Sn},Jr=t=>{if(Zr(t)){se(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return yn(e,n,r,o)}return"string"==typeof t?(se(void 0!==Qr[t],`Invalid easing type '${t}'`),Qr[t]):t},to=(t,e)=>n=>e(t(n)),eo=(...t)=>t.reduce(to);function no(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function ro(t,e){return n=>n>0?e:t}const oo=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},io=[hr,pr,dr];function ao(t){const e=(n=t,io.find((t=>t.test(n))));var n;if(ae(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(e))return!1;let r=e.parse(t);return e===dr&&(r=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,i=0,a=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,s=2*n-r;o=no(s,r,t+1/3),i=no(s,r,t),a=no(s,r,t-1/3)}else o=i=a=n;return{red:Math.round(255*o),green:Math.round(255*i),blue:Math.round(255*a),alpha:r}}(r)),r}const so=(t,e)=>{const n=ao(t),r=ao(e);if(!n||!r)return ro(t,e);const o={...n};return t=>(o.red=oo(n.red,r.red,t),o.green=oo(n.green,r.green,t),o.blue=oo(n.blue,r.blue,t),o.alpha=xe(n.alpha,r.alpha,t),pr.transform(o))},uo=new Set(["none","hidden"]);function co(t,e){return n=>xe(t,e,n)}function lo(t){return"number"==typeof t?co:"string"==typeof t?Pn(t)?ro:yr.test(t)?so:ho:Array.isArray(t)?fo:"object"==typeof t?yr.test(t)?so:po:ro}function fo(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>lo(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function po(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=lo(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const ho=(t,e)=>{const n=Er.createTransformer(e),r=kr(t),o=kr(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?uo.has(t)&&!o.values.length||uo.has(e)&&!r.values.length?function(t,e){return uo.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):eo(fo(function(t,e){var n;const r=[],o={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],s=t.indexes[a][o[a]],u=null!==(n=t.values[s])&&void 0!==n?n:0;r[i]=u,o[a]++}return r}(r,o),o.values),n):(ae(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),ro(t,e))};function yo(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return xe(t,e,n);return lo(t)(t,e)}function vo(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(se(i===e.length,"Both input and output ranges must be the same length"),1===i)return()=>e[0];if(2===i&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const r=[],o=n||yo,i=t.length-1;for(let n=0;n<i;n++){let i=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||ie:e;i=eo(t,i)}r.push(i)}return r}(e,r,o),s=a.length,u=e=>{let n=0;if(s>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=Ae(t[n],t[n+1],e);return a[n](r)};return n?e=>u(ue(t[0],t[i-1],e)):u}function mo({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=Ne(r)?r.map(Jr):Jr(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Ee(e),t),s=vo(a,e,{ease:Array.isArray(o)?o:(u=e,c=o,u.map((()=>c||Kr)).splice(0,u.length-1))});var u,c;return{calculatedDuration:t,next:e=>(i.value=s(e),i.done=e>=t,i)}}const go=t=>{const e=({timestamp:e})=>t(e);return{start:()=>un.update(e,!0),stop:()=>cn(e),now:()=>ln.isProcessing?ln.timestamp:Wr.now()}},bo={decay:qr,inertia:qr,tween:mo,keyframes:mo,spring:we},wo=t=>t/100;class So extends $r{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:r,keyframes:o}=this.options,i=(null==r?void 0:r.KeyframeResolver)||ir;this.resolver=new i(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:o,velocity:i=0}=this.options,a=Ce(e)?e:bo[e]||mo;let s,u;a!==mo&&"number"!=typeof t[0]&&(s=eo(wo,yo(t[0],t[1])),t=[0,100]);const c=a({...this.options,keyframes:t});"mirror"===o&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-i})),null===c.calculatedDuration&&(c.calculatedDuration=_e(c));const{calculatedDuration:l}=c,f=l+r;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:s,calculatedDuration:l,resolvedDuration:f,totalDuration:f*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:o,mirroredGenerator:i,mapPercentToKeyframes:a,keyframes:s,calculatedDuration:u,totalDuration:c,resolvedDuration:l}=n;if(null===this.startTime)return o.next(0);const{delay:f,repeat:p,repeatType:h,repeatDelay:d,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const v=this.currentTime-f*(this.speed>=0?1:-1),m=this.speed>=0?v<0:v>c;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let g=this.currentTime,b=o;if(p){const t=Math.min(this.currentTime,c)/l;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,p+1);Boolean(e%2)&&("reverse"===h?(n=1-n,d&&(n-=d/l)):"mirror"===h&&(b=i)),g=ue(0,1,n)*l}const w=m?{done:!1,value:s[0]}:b.next(g);a&&(w.value=a(w.value));let{done:S}=w;m||null===u||(S=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const _=null===this.holdTime&&("finished"===this.state||"running"===this.state&&S);return _&&void 0!==r&&(w.value=on(s,this.options,r)),y&&y(w.value),_&&this.finish(),w}get duration(){const{resolved:t}=this;return t?ee(t.calculatedDuration):0}get time(){return ee(this.currentTime)}set time(t){t=te(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=ee(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=go,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const _o=new Set(["opacity","clipPath","filter","transform"]),ko=(t,e)=>{let n="";const r=Math.max(Math.round(e/10),2);for(let e=0;e<r;e++)n+=t(Ae(0,r-1,e))+", ";return`linear(${n.substring(0,n.length-2)})`},xo={linearEasing:void 0};function Ao(t,e){const n=Zt(t);return()=>{var t;return null!==(t=xo[e])&&void 0!==t?t:n()}}const Oo=Ao((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function Eo(t){return Boolean("function"==typeof t&&Oo()||!t||"string"==typeof t&&(t in jo||Oo())||Zr(t)||Array.isArray(t)&&t.every(Eo))}const To=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,jo={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:To([0,.65,.55,1]),circOut:To([.55,0,1,.45]),backIn:To([.31,.01,.66,-.59]),backOut:To([.33,1.53,.69,.99])};function Po(t,e){return t?"function"==typeof t&&Oo()?ko(t,e):Zr(t)?To(t):Array.isArray(t)?t.map((t=>Po(t,e)||jo.easeOut)):jo[t]:void 0}function Co(t,e,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:a="loop",ease:s,times:u}={}){const c={[e]:n};u&&(c.offset=u);const l=Po(s,o);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}function Io(t,e){t.timeline=e,t.onfinish=null}const Lo=Zt((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const No={anticipate:Sn,backInOut:wn,circInOut:xn};class Ro extends $r{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new Vr(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:r=300,times:o,ease:i,type:a,motionValue:s,name:u,startTime:c}=this.options;if(!(null===(n=s.owner)||void 0===n?void 0:n.current))return!1;if("string"==typeof i&&Oo()&&i in No&&(i=No[i]),function(t){return Ce(t.type)||"spring"===t.type||!Eo(t.ease)}(this.options)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new So({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const o=[];let i=0;for(;!r.done&&i<2e4;)r=n.sample(i),o.push(r.value),i+=10;return{times:void 0,keyframes:o,duration:i-10,ease:"linear"}}(t,c);1===(t=l.keyframes).length&&(t[1]=t[0]),r=l.duration,o=l.times,i=l.ease,a="keyframes"}const l=Co(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return l.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(Io(l,this.pendingTimeline),this.pendingTimeline=void 0):l.onfinish=()=>{const{onComplete:n}=this.options;s.set(on(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:l,duration:r,times:o,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return ee(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return ee(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=te(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return ie;const{animation:n}=e;Io(n,t)}else this.pendingTimeline=t;return ie}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:r,type:o,ease:i,times:a}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:s,element:u,...c}=this.options,l=new So({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=te(this.time);t.setWithVelocity(l.sample(f-10).value,l.sample(f).value,10)}const{onStop:s}=this.options;s&&s(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:i,type:a}=t;return Lo()&&n&&_o.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const Mo=(t,e,n,r={},o,i)=>a=>{const s=Je(r,t)||{},u=s.delay||r.delay||0;let{elapsed:c=0}=r;c-=te(u);let l={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...s,delay:-c,onUpdate:t=>{e.set(t),s.onUpdate&&s.onUpdate(t)},onComplete:()=>{a(),s.onComplete&&s.onComplete()},name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(s)||(l={...l,...Qe(t,l)}),l.duration&&(l.duration=te(l.duration)),l.repeatDelay&&(l.repeatDelay=te(l.repeatDelay)),void 0!==l.from&&(l.keyframes[0]=l.from);let f=!1;if((!1===l.type||0===l.duration&&!l.repeatDelay)&&(l.duration=0,0===l.delay&&(f=!0)),(nn||tn)&&(f=!0,l.duration=0,l.delay=0),f&&!i&&void 0!==e.get()){const t=on(l.keyframes,s);if(void 0!==t)return un.update((()=>{l.onUpdate(t),l.onComplete()})),new Jt([])}return!i&&Ro.supports(l)?new Ro(l):new So(l)},Fo=t=>Array.isArray(t),Do=t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue),Bo=t=>Fo(t)?t[t.length-1]||0:t;class Vo{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>Me(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Go={current:void 0};class Uo{constructor(t,e={}){this.version="11.11.9",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=Wr.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=Wr.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new Vo);const n=this.events[t].add(e);return"change"===t?()=>{n(),un.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return Go.current&&Go.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Wr.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return ne(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Wo(t,e){return new Uo(t,e)}function zo(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Ho(t,e,n,r){if("function"==typeof e){const[o,i]=zo(r);e=e(void 0!==n?n:t.custom,o,i)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[o,i]=zo(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function $o(t,e,n){const r=t.getProps();return Ho(r,e,void 0!==n?n:r.custom,t)}function qo(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Wo(n))}const Yo=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Xo="data-"+Yo("framerAppearId");function Ko(t){return t.props[Xo]}function Zo(t,e){if(!t.applyWillChange)return;const n=t.getValue("willChange");return r=n,Boolean(Te(r)&&r.add)?n.add(e):void 0;var r}function Qo({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function Jo(t,e,{delay:n=0,transitionOverride:r,type:o}={}){var i;let{transition:a=t.getDefaultTransition(),transitionEnd:s,...u}=e;r&&(a=r);const c=[],l=o&&t.animationState&&t.animationState.getState()[o];for(const e in u){const r=t.getValue(e,null!==(i=t.latestValues[e])&&void 0!==i?i:null),o=u[e];if(void 0===o||l&&Qo(l,e))continue;const s={delay:n,...Je(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=Ko(t);if(n){const t=window.MotionHandoffAnimation(n,e,un);null!==t&&(s.startTime=t,f=!0)}}Zo(t,e),r.start(Mo(e,r,o,t.shouldReduceMotion&&Ye.has(e)?{type:!1}:s,t,f));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{un.update((()=>{s&&function(t,e){const n=$o(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)qo(t,e,Bo(i[e]))}(t,s)}))})),c}const ti={};function ei(t,{layout:e,layoutId:n}){return Ye.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!ti[t]||"opacity"===t)}function ni(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(Te(o[a])||e.style&&Te(e.style[a])||ei(a,t)||void 0!==(null===(r=null==n?void 0:n.getValue(a))||void 0===r?void 0:r.liveStyle))&&(i[a]=o[a]);return n&&o&&"string"==typeof o.willChange&&(n.applyWillChange=!1),i}function ri(t,e,n){const r=ni(t,e,n);for(const n in t)if(Te(t[n])||Te(e[n])){r[-1!==qe.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const oi="undefined"!=typeof window,ii={current:null},ai={current:!1};function si(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function ui(t){return"string"==typeof t||Array.isArray(t)}const ci=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],li=["initial",...ci];function fi(t){return si(t.animate)||li.some((e=>ui(t[e])))}function pi(t){return Boolean(fi(t)||t.variants)}const hi={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},di={};for(const t in hi)di[t]={isEnabled:e=>hi[t].some((t=>!!e[t]))};const yi=[...Qn,yr,Er],vi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),mi=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class gi{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:o,visualState:i},a={}){this.applyWillChange=!1,this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ir,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=Wr.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,un.render(this.render,!1,!0))};const{latestValues:s,renderState:u}=i;this.latestValues=s,this.baseTarget={...s},this.initialValues=e.initial?{...s}:{},this.renderState=u,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=fi(e),this.isVariantNode=pi(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:c,...l}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in l){const e=l[t];void 0!==s[t]&&Te(e)&&e.set(s[t],!1)}}mount(t){this.current=t,$e.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((t,e)=>this.bindToMotionValue(e,t))),ai.current||function(){if(ai.current=!0,oi)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ii.current=t.matches;t.addListener(e),e()}else ii.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||ii.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){$e.delete(this.current),this.projection&&this.projection.unmount(),cn(this.notifyUpdate),cn(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=Ye.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&un.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),o=e.on("renderRequest",this.scheduleRender);let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{r(),o(),i&&i(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in di){const e=di[t];if(!e)continue;const{isEnabled:n,Feature:r}=e;if(!this.features[t]&&r&&n(this.props)&&(this.features[t]=new r(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<mi.length;e++){const n=mi[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){for(const r in e){const o=e[r],i=n[r];if(Te(o))t.addValue(r,o);else if(Te(i))t.addValue(r,Wo(o,{owner:t}));else if(i!==o)if(t.hasValue(r)){const e=t.getValue(r);!0===e.liveStyle?e.jump(o):e.hasAnimated||e.set(o)}else{const e=t.getStaticValue(r);t.addValue(r,Wo(void 0!==e?e:o,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Wo(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let r=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var o;return null!=r&&("string"==typeof r&&(On(r)||An(r))?r=parseFloat(r):(o=r,!yi.find(Zn(o))&&Er.test(e)&&(r=Dr(t,e))),this.setBaseTarget(t,Te(r)?r.get():r)),Te(r)?r.get():r}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let r;if("string"==typeof n||"object"==typeof n){const o=Ho(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);o&&(r=o[t])}if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,t);return void 0===o||Te(o)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:o}on(t,e){return this.events[t]||(this.events[t]=new Vo),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class bi extends gi{constructor(){super(...arguments),this.KeyframeResolver=Vr}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}}const wi=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Si={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},_i=qe.length;function ki(t,e,n){const{style:r,vars:o,transformOrigin:i}=t;let a=!1,s=!1;for(const t in e){const n=e[t];if(Ye.has(t))a=!0;else if(Tn(t))o[t]=n;else{const e=wi(n,Rr[t]);t.startsWith("origin")?(s=!0,i[t]=e):r[t]=e}}if(e.transform||(a||n?r.transform=function(t,e,n){let r="",o=!0;for(let i=0;i<_i;i++){const a=qe[i],s=t[a];if(void 0===s)continue;let u=!0;if(u="number"==typeof s?s===(a.startsWith("scale")?1:0):0===parseFloat(s),!u||n){const t=wi(s,Rr[a]);u||(o=!1,r+=`${Si[a]||a}(${t}) `),n&&(e[a]=t)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}(e,t.transform,n):r.transform&&(r.transform="none")),s){const{originX:t="50%",originY:e="50%",originZ:n=0}=i;r.transformOrigin=`${t} ${e} ${n}`}}function xi(t,e,n){return"string"==typeof t?t:Vn.transform(e+n*t)}const Ai={offset:"stroke-dashoffset",array:"stroke-dasharray"},Oi={offset:"strokeDashoffset",array:"strokeDasharray"};function Ei(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(ki(t,c,f),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:p,style:h,dimensions:d}=t;p.transform&&(d&&(h.transform=p.transform),delete p.transform),d&&(void 0!==o||void 0!==i||h.transform)&&(h.transformOrigin=function(t,e,n){return`${xi(e,t.x,t.width)} ${xi(n,t.y,t.height)}`}(d,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(p.x=e),void 0!==n&&(p.y=n),void 0!==r&&(p.scale=r),void 0!==a&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?Ai:Oi;t[i.offset]=Vn.transform(-r);const a=Vn.transform(e),s=Vn.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const Ti=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function ji(t,{style:e,vars:n},r,o){Object.assign(t.style,e,o&&o.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}function Pi(t,e,n,r){ji(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Ti.has(n)?n:Yo(n),e.attrs[n])}const Ci=t=>"string"==typeof t&&"svg"===t.toLowerCase();class Ii extends bi{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=vi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Ye.has(e)){const t=Fr(e);return t&&t.default||0}return e=Ti.has(e)?e:Yo(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return ri(t,e,n)}build(t,e,n){Ei(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Pi(t,e,0,r)}mount(t){this.isSVGTag=Ci(t.tagName),super.mount(t)}}function Li(t,e){return function({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}class Ni extends bi{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=ji}readValueFromInstance(t,e){if(Ye.has(e)){const t=Fr(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(Tn(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Li(t,e)}build(t,e,n){ki(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return ni(t,e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Te(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}class Ri extends gi{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function Mi(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=function(t){return t instanceof SVGElement&&"svg"!==t.tagName}(t)?new Ii(e):new Ni(e);n.mount(t),$e.set(t,n)}function Fi(t){const e=new Ri({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),$e.set(t,e)}function Di(t,e,n,r){const o=[];if(function(t,e){return Te(t)||"number"==typeof t||"string"==typeof t&&!je(e)}(t,e))o.push(function(t,e,n){const r=Te(t)?t:Wo(t);return r.start(Mo("",r,e,n)),r.animation}(t,je(e)&&e.default||e,n&&n.default||n));else{const i=Pe(t,e,r),a=i.length;se(Boolean(a),"No valid elements provided.");for(let t=0;t<a;t++){const r=i[t],s=r instanceof Element?Mi:Fi;$e.has(r)||s(r);const u=$e.get(r),c={...n};"delay"in c&&"function"==typeof c.delay&&(c.delay=c.delay(t,a)),o.push(...Jo(u,{...e,transition:c},{}))}}return o}function Bi(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r,o){const i=e.duration||.3,a=new Map,s=new Map,u={},c=new Map;let l=0,f=0,p=0;for(let n=0;n<t.length;n++){const a=t[n];if("string"==typeof a){c.set(a,f);continue}if(!Array.isArray(a)){c.set(a.name,Ie(f,a.at,l,c));continue}let[h,d,y={}]=a;void 0!==y.at&&(f=Ie(f,y.at,l,c));let v=0;const m=(t,n,r,a=0,s=0)=>{const u=Ue(t),{delay:c=0,times:l=Ee(u),type:h="keyframes",...d}=n;let{ease:y=e.ease||"easeOut",duration:m}=n;const g="function"==typeof c?c(a,s):c,b=u.length,w=Ce(h)?h:null==o?void 0:o[h];if(b<=2&&w){let t=100;if(2===b&&He(u)){const e=u[1]-u[0];t=Math.abs(e)}const e={...d};void 0!==m&&(e.duration=te(m));const n=ke(e,t,w);y=n.ease,m=n.duration}null!=m||(m=i);const S=f+g,_=S+m;1===l.length&&0===l[0]&&(l[1]=1);const k=l.length-u.length;k>0&&Oe(l,k),1===u.length&&u.unshift(null),Fe(r,u,y,l,S,_),v=Math.max(g+m,v),p=Math.max(_,p)};if(Te(h))m(d,y,Ge("default",Ve(h,s)));else{const t=Pe(h,d,r,u),e=t.length;for(let n=0;n<e;n++){const r=Ve(t[n],s);for(const t in d)m(d[t],We(y,t),Ge(t,r),n,e)}}l=f,f+=v}return s.forEach(((t,r)=>{for(const o in t){const i=t[o];i.sort(De);const s=[],u=[],c=[];for(let t=0;t<i.length;t++){const{at:e,value:n,easing:r}=i[t];s.push(n),u.push(Ae(0,p,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift(Be)),1!==u[u.length-1]&&(u.push(1),s.push(null)),a.has(r)||a.set(r,{keyframes:{},transition:{}});const l=a.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:p,ease:c,times:u,...n}}})),a}(t,e,n,{spring:we});return o.forEach((({keyframes:t,transition:e},n)=>{r.push(...Di(n,t,e))})),r}const Vi=function(t,e,n){let r=[];var o;o=t,r=Array.isArray(o)&&Array.isArray(o[0])?Bi(t,e,Gi):Di(t,e,n,Gi);const i=new Jt(r);return Gi&&Gi.animations.push(i),i};var Gi;function Ui(t){return Ui="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ui(t)}function Wi(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Wi=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Ui(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Ui(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function zi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=$i(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function Hi(t){return function(t){if(Array.isArray(t))return qi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$i(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $i(t,e){if(t){if("string"==typeof t)return qi(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qi(t,e):void 0}}function qi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Yi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ki(r.key),r)}}function Xi(t,e,n){return(e=Ki(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ki(t){var e=function(t,e){if("object"!=Ui(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ui(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ui(e)?e:e+""}var Zi=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Qi=Xi(Xi(Xi({},Dt,"25.33%"),Ft,"50%"),Bt,"75.66%"),Ji=function(){function t(e,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequences=[],this.control=null,this.transformers={},Array.isArray(e)){var r;(r=this.sequences).push.apply(r,Hi(e)),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions,n||{})}else{var o=e,i=n||t.defaultOptions;this.sequences.push({props:o,options:i||{}}),this.sequenceOptions=Object.assign({},t.defaultSequenceOptions)}}return function(t,e,n){return e&&Yi(t.prototype,e),n&&Yi(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"animate",value:function(e,n,r){var o=e.scope,i=e.overwrites,a=e.target;return Zi(this,void 0,void 0,Wi().mark((function e(){var s=this;return Wi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){Zi(s,void 0,void 0,Wi().mark((function s(){var u,c,l,f,p=this;return Wi().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||e(),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=zi(this.sequences),s.prev=4,f=Wi().mark((function e(){var r,s,u,c,f,h;return Wi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,s=r.props,u=r.options,c=k({},p.propToCSS(n,a.state)),o.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=o.current,Object.assign(f.style,c),a.state=t.mergeState(a.state,s),h=Vi(f,p.propToCSS(n,a.state,i),p.optionsToFramerMotionOptions(u)||{}),p.setControl(h),n.logger.debug("Animating",p.propToCSS(n,a.state,i)),!1!==(null==u?void 0:u.sync)){e.next=14;break}h.then((function(){Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null)})),e.next=18;break;case 14:return e.next=16,new Promise((function(t){return h.then((function(){return t()}))}));case 16:Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null);case 18:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){s.next=11;break}return s.delegateYield(f(),"t0",9);case 9:s.next=7;break;case 11:s.next=16;break;case 13:s.prev=13,s.t1=s.catch(4),c.e(s.t1);case 16:return s.prev=16,c.f(),s.finish(16);case 19:u++,s.next=2;break;case 22:return s.next=24,j(2);case 24:this.setControl(null),e(),r&&r(a.state);case 27:case"end":return s.stop()}}),s,this,[[4,13,16,19]])})))})));case 1:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}},fontColor:function(t){return"string"==typeof t?{color:t}:{color:O(t)}}},c={};for(var l in c.transform=t.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],[{key:"isPosition",value:function(t){return Yt.isCommonPositionType(t)||Xt.isCoord2DPosition(t)||Kt.isAlignPosition(t)}},{key:"left",value:function(e,n){return new t({position:Yt.Positions.Left},{duration:e,ease:n})}},{key:"right",value:function(e,n){return new t({position:Yt.Positions.Right},{duration:e,ease:n})}},{key:"center",value:function(e,n){return new t({position:Yt.Positions.Center},{duration:e,ease:n})}},{key:"positionToCSS",value:function(t,e,n){return t?qt.isRawPosition(t)?qt.D2PositionToCSS(qt.rawPositionToCoord2D(t),n,e):qt.D2PositionToCSS(t.toCSS(),n,e):{}}},{key:"backgroundToCSS",value:function(t){return null==t?{}:au.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:O(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?qt.mergePosition(qt.tryParsePosition(t),qt.tryParsePosition(e)):qt.toCoord2D(qt.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},k(t,e)),{position:n})}},{key:"propToCSSTransform",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.translate,i=void 0===o?[]:o,a=r.scale,s=void 0===a?1:a;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var u=void 0!==e.scale?e.scale:1,c=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},l=c.invertY,f=c.invertX;return["translate(".concat(i[0]||(f?"":"-")+"50%",", ").concat(i[1]||(l?"":"-")+"50%",")"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)"),"scale(".concat(u*s,")")].filter(Boolean).join(" ")}}])}();function ta(t){return ta="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ta(t)}function ea(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,na(r.key),r)}}function na(t){var e=function(t,e){if("object"!=ta(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ta(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ta(e)?e:e+""}Ji.defaultSequenceOptions={sync:!0,repeat:1},Ji.defaultOptions={duration:0,ease:"linear"},Ji.CommonImagePositionMap=Qi;var ra=function(){return function(t,e,n){return e&&ea(t.prototype,e),n&&ea(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=""}),[{key:"setId",value:function(t){this.id=t}},{key:"getId",value:function(){return this.id}},{key:"reset",value:function(){}},{key:"fromData",value:function(t){return this}},{key:"construct",value:function(t){for(var e,n=0;n<t.length;n++){var r=t[n];0!==n&&(null===(e=t[n-1])||void 0===e||e.contentNode.setChild(r.contentNode))}return t}}])}();function oa(t){return oa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oa(t)}function ia(t){return function(t){if(Array.isArray(t))return ca(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ua(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function aa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=ua(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function sa(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||ua(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ua(t,e){if(t){if("string"==typeof t)return ca(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ca(t,e):void 0}}function ca(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function la(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */la=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==oa(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(oa(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function fa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,pa(r.key),r)}}function pa(t){var e=function(t,e){if("object"!=oa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=oa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==oa(e)?e:e+""}function ha(t,e,n){return e=ma(e),function(t,e){if(e&&("object"==oa(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,da()?Reflect.construct(e,n||[],ma(t).constructor):e.apply(t,n))}function da(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(da=function(){return!!t})()}function ya(t,e,n,r){var o=va(ma(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function va(){return va="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ma(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},va.apply(null,arguments)}function ma(t){return ma=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ma(t)}function ga(t,e){return ga=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ga(t,e)}var ba,wa=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Sa=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ha(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ga(t,e)}(e,t),function(t,e,n){return e&&fa(t.prototype,e),n&&fa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAllActions",value:function(t,e){return wa(this,void 0,void 0,la().mark((function n(){var r,o,i;return la().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=la().mark((function e(){var n,r,i;return la().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o),t.logger.debug("Control - Next Action",n),n){e.next=4;break}return e.abrupt("return",0);case 4:if(!x.isAwaitable(n)){e.next=16;break}return e.next=7,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 7:if(r=e.sent,!(i=r.node)){e.next=13;break}o=i.action,e.next=14;break;case 13:return e.abrupt("return",0);case 14:e.next=17;break;case 16:o=n;case 17:case"end":return e.stop()}}),e)}));case 3:if(r||!o){n.next=10;break}return n.delegateYield(i(),"t0",5);case 5:if(0!==n.t0){n.next=8;break}return n.abrupt("break",10);case 8:n.next=3;break;case 10:case"end":return n.stop()}}),n)})))}},{key:"executeSingleAction",value:function(t,e){return wa(this,void 0,void 0,la().mark((function n(){var r,o,i;return la().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.game.getLiveGame().executeAction(t,e),!x.isAwaitable(r)){n.next=9;break}return n.next=4,new Promise((function(t){r.then((function(e){return t(r.result)}))}));case 4:return o=n.sent,i=o.node,n.abrupt("return",i);case 9:return n.abrupt("return",r);case 10:case"end":return n.stop()}}),n)})))}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),n):ya(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n=this,r=sa(this.contentNode.getContent(),1)[0];if(this.type===a.do){var o=new x((function(t){return t}));return this.execute(t,o,r)}if(this.type===a.doAsync)return wa(n,void 0,void 0,la().mark((function e(){return la().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,r[0]);case 3:case"end":return e.stop()}}),e,this)}))),ya(e,"executeAction",this,3)([t]);if(this.type===a.any){var i=new x((function(t){return t})),s=r.map((function(e){return n.executeSingleAction(t,e)}));return Promise.any(s).then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if(this.type===a.all){var u=new x((function(t){return t}));return wa(n,void 0,void 0,la().mark((function e(){var n=this;return la().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(r.map((function(e){return n.executeSingleAction(t,e)})));case 2:u.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 4:case"end":return e.stop()}}),e,this)}))),u}if(this.type===a.allAsync)return wa(n,void 0,void 0,la().mark((function e(){var n,o,i;return la().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=aa(r);try{for(n.s();!(o=n.n()).done;)i=o.value,this.executeSingleAction(t,i).then((function(t){}))}catch(t){n.e(t)}finally{n.f()}case 2:case"end":return e.stop()}}),e,this)}))),ya(e,"executeAction",this,3)([t]);if(this.type===a.repeat){var c=sa(this.contentNode.getContent(),2),l=c[0],f=c[1],p=new x((function(t){return t}));return wa(n,void 0,void 0,la().mark((function e(){var n;return la().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<f)){e.next=8;break}if(!(l.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,l[0]);case 5:n++,e.next=1;break;case 8:p.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 10:case"end":return e.stop()}}),e,this)}))),p}if(this.type===a.sleep){var h=new x((function(t){return t})),d=sa(this.contentNode.getContent(),2)[1];return new Promise((function(t){"number"==typeof d?setTimeout((function(){t()}),d):x.isAwaitable(d)?d.then(t):null==d||d.then(t)})).then((function(){h.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),h}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(t){var n=this.contentNode.getContent()[0],r=ya(e,"getFutureActions",this,3)([t]);return[].concat(ia(n),ia(r))}}])}(J);function _a(t){return _a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_a(t)}function ka(t){return function(t){if(Array.isArray(t))return xa(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return xa(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xa(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xa(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Aa(t,e,n){return e=Ea(e),function(t,e){if(e&&("object"==_a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Oa()?Reflect.construct(e,n||[],Ea(t).constructor):e.apply(t,n))}function Oa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Oa=function(){return!!t})()}function Ea(t){return Ea=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ea(t)}function Ta(t,e){return Ta=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ta(t,e)}function ja(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ia(r.key),r)}}function Ca(t,e,n){return e&&Pa(t.prototype,e),n&&Pa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ia(t){var e=function(t,e){if("object"!=_a(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_a(e)?e:e+""}Sa.ActionTypes=a;var La=Symbol("_Chained"),Na=function(){function t(e){ja(this,t),this[ba]=!0,this.__actions=[],this.__self=e}return Ca(t,[{key:"push",value:function(){var t;(t=this.__actions).push.apply(t,arguments)}},{key:"getActions",value:function(){return this.__actions}},{key:"getSelf",value:function(){return this.__self}},{key:"newChain",value:function(){return this.getSelf().chain()}}],[{key:"isChained",value:function(t){return t&&t[La]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();ba=La;var Ra=function(t){function e(){return ja(this,e),Aa(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ta(t,e)}(e,t),Ca(e,[{key:"chain",value:function(t){var e=Na.isChained(this)?this:this.proxy(this,new Na(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,ka(n)),e}},{key:"proxy",value:function(t,e){var n=new Proxy(t,{get:function(t,r){if(r in e)return e[r];var o=t[r];return"function"==typeof o?o.bind(n):o},set:function(t,e,n){return t[e]=n,!0}});return n}},{key:"combineActions",value:function(t,e){var n=e(this.chain().newChain()),r=new Sa(t.chain(),Sa.ActionTypes.do,(new Mt).setContent([this.construct(Na.toActions([n]))]));return this.chain(r)}}])}(ra);function Ma(t){return Ma="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ma(t)}function Fa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Da(r.key),r)}}function Da(t){var e=function(t,e){if("object"!=Ma(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ma(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ma(e)?e:e+""}function Ba(t,e,n){return e=Ga(e),function(t,e){if(e&&("object"==Ma(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Va()?Reflect.construct(e,n||[],Ga(t).constructor):e.apply(t,n))}function Va(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Va=function(){return!!t})()}function Ga(t){return Ga=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ga(t)}function Ua(t,e){return Ua=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ua(t,e)}var Wa=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ba(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ua(t,e)}(e,t),function(t,e,n){return e&&Fa(t.prototype,e),n&&Fa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"toData",value:function(){return null}},{key:"fromChained",value:function(t){return t.getActions()}}])}(Ra);function za(t){return za="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},za(t)}function Ha(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,$a(r.key),r)}}function $a(t){var e=function(t,e){if("object"!=za(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=za(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==za(e)?e:e+""}function qa(t,e,n){return e=Xa(e),function(t,e){if(e&&("object"==za(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ya()?Reflect.construct(e,n||[],Xa(t).constructor):e.apply(t,n))}function Ya(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ya=function(){return!!t})()}function Xa(t){return Xa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xa(t)}function Ka(t,e){return Ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ka(t,e)}var Za=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),qa(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ka(t,e)}(e,t),function(t,e,n){return e&&Ha(t.prototype,e),n&&Ha(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"do",value:function(t){return this.push(Sa.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(Sa.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(Sa.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(Sa.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(Sa.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(Sa.ActionTypes.repeat,e,t)}},{key:"sleep",value:function(t){return this.push(Sa.ActionTypes.sleep,[],t)}},{key:"push",value:function(t,e){for(var n=Na.toActions(e),r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=new Sa(this.chain(),t,(new Mt).setContent([this.construct(n)].concat(o)));return this.chain(a)}}],[{key:"do",value:function(t){return(new e).do(t)}},{key:"doAsync",value:function(t){return(new e).doAsync(t)}},{key:"any",value:function(t){return(new e).any(t)}},{key:"all",value:function(t){return(new e).all(t)}},{key:"allAsync",value:function(t){return(new e).allAsync(t)}},{key:"repeat",value:function(t,n){return(new e).repeat(t,n)}},{key:"sleep",value:function(t){return(new e).sleep(t)}}])}(Wa);function Qa(t){return Qa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qa(t)}function Ja(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ts(r.key),r)}}function ts(t){var e=function(t,e){if("object"!=Qa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qa(e)?e:e+""}function es(t,e,n){return e=is(e),function(t,e){if(e&&("object"==Qa(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ns()?Reflect.construct(e,n||[],is(t).constructor):e.apply(t,n))}function ns(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ns=function(){return!!t})()}function rs(t,e,n,r){var o=os(is(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function os(){return os="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=is(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},os.apply(null,arguments)}function is(t){return is=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},is(t)}function as(t,e){return as=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},as(t,e)}var ss=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),es(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&as(t,e)}(e,t),function(t,e,n){return e&&Ja(t.prototype,e),n&&Ja(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=t.getLastSceneIfNot();if(this.type===u.layerMoveUp)return t.moveUpElement(n,this.callee),t.stage.update(),rs(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveDown)return t.moveDownElement(n,this.callee),t.stage.update(),rs(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveTop)return t.moveTopElement(n,this.callee),t.stage.update(),rs(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveBottom)return t.moveBottomElement(n,this.callee),t.stage.update(),rs(e,"executeAction",this,3)([t]);throw this.unknownTypeError()}}])}(J);function us(t){return us="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},us(t)}function cs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ls(r.key),r)}}function ls(t){var e=function(t,e){if("object"!=us(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=us(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==us(e)?e:e+""}function fs(t,e,n){return e=hs(e),function(t,e){if(e&&("object"==us(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ps()?Reflect.construct(e,n||[],hs(t).constructor):e.apply(t,n))}function ps(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ps=function(){return!!t})()}function hs(t){return hs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hs(t)}function ds(t,e){return ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ds(t,e)}ss.ActionTypes=u;var ys=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),fs(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ds(t,e)}(e,t),function(t,e,n){return e&&cs(t.prototype,e),n&&cs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"layerMoveUp",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveUp))}},{key:"layerMoveDown",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveDown))}},{key:"layerMoveTop",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveTop))}},{key:"layerMoveBottom",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveBottom))}},{key:"constructLayerAction",value:function(t,e){return new ss(t,e,new Mt)}}])}(Wa);function vs(t){return vs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vs(t)}function ms(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=bs(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function gs(t){return function(t){if(Array.isArray(t))return ws(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||bs(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bs(t,e){if(t){if("string"==typeof t)return ws(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ws(t,e):void 0}}function ws(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ss(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xs(r.key),r)}}function ks(t,e,n){return e&&_s(t.prototype,e),n&&_s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function xs(t){var e=function(t,e){if("object"!=vs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=vs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vs(e)?e:e+""}function As(t,e,n){return e=Es(e),function(t,e){if(e&&("object"==vs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Os()?Reflect.construct(e,n||[],Es(t).constructor):e.apply(t,n))}function Os(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Os=function(){return!!t})()}function Es(t){return Es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Es(t)}function Ts(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&js(t,e)}function js(t,e){return js=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},js(t,e)}ys.EventTypes={"event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"};var Ps=function(t){function e(){var t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;return Ss(this,e),(t=As(this,e)).events=new E,t.ref=void 0,t.name=r.name||"(anonymous)",t.config=k(e.defaultConfig,r,{tag:o||r.tag,position:r.position?qt.tryParsePosition(r.position):new Yt(Rt.Center),currentTags:(null===(n=r.tag)||void 0===n?void 0:n.defaults)?gs(r.tag.defaults):null}),t.state=k({},t.config),t.checkConfig(t.config),t}return Ts(e,t),ks(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this.chain(this._init())}},{key:"checkConfig",value:function(t){var e;if(!Ji.isPosition(t.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");if(_(t.src)===_.DataTypes.string&&t.tag)throw this._mixedSrcError();if(!t.src&&!t.tag)throw this._srcNotSpecifiedError();var n,r=ms(t.wearables);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(!o.config.isWearable)throw this._invalidWearableError(JSON.stringify(o.config))}}catch(t){r.e(t)}finally{r.f()}if(t.tag){var i,a=new Set,s=ms(t.tag.groups);try{for(s.s();!(i=s.n()).done;){var u,c=ms(i.value);try{for(c.s();!(u=c.n()).done;){var l=u.value;if(a.has(l))throw this._invalidTagGroupDefinitionError();a.add(l)}}catch(t){c.e(t)}finally{c.f()}}}catch(t){s.e(t)}finally{s.f()}}if(t.tag){var f,p=this.constructTagMap(t.tag.groups),h=new Set,d=ms(t.tag.defaults);try{for(d.s();!(f=d.n()).done;){var y=f.value;if(h.has(y))throw new Error('Tag conflict\nTag "'.concat(y,'" is conflicting with another tag\nError found in config.tag.defaults'));if(!p.has(y))throw new Error('Tag not found\nTag "'.concat(y,'" is not defined in tagDefinitions\nError found in config.tag.defaults'));null===(e=p.get(y))||void 0===e||e.forEach((function(t){return h.add(t)}))}}catch(t){d.e(t)}finally{d.f()}}return this}},{key:"setSrc",value:function(t,e){var n=this;return this.combineActions(new Za,(function(r){return n._setSrc(r,t,e)}))}},{key:"setAppearance",value:function(t,e){var n=this;return this.combineActions(new Za,(function(r){var o=new Hs(r,Hs.ActionTypes.setAppearance,(new Mt).setContent([t,null==e?void 0:e.copy()]));return r.chain(o).chain(n._flush())}))}},{key:"applyTransform",value:function(t){var e=this;return this.combineActions(new Za,(function(n){var r=new Hs(n,Hs.ActionTypes.applyTransform,(new Mt).setContent([void 0,t.copy(),T()]));return n.chain(r).chain(e._flush())}))}},{key:"show",value:function(t){var e=this,n=t instanceof Ji?t.copy():new Ji([{props:{opacity:1},options:t||{}}]);return this.combineActions(new Za,(function(t){var r=new Hs(t,Hs.ActionTypes.show,(new Mt).setContent([void 0,n]));return t.chain(r).chain(e._flush())}))}},{key:"hide",value:function(t){var e=this;return this.combineActions(new Za,(function(n){var r=new Hs(n,Hs.ActionTypes.hide,(new Mt).setContent([void 0,t instanceof Ji?t.copy():new Ji([{props:{opacity:0},options:t||{}}])]));return n.chain(r).chain(e._flush())}))}},{key:"addWearable",value:function(t){var e,n=ms(Array.isArray(t)?t:[t]);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.config.wearables.push(r),r.config.isWearable=!0}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"bindWearable",value:function(t){return t.addWearable([this]),this}},{key:"toTransform",value:function(){return new Ji(this.state,{duration:0})}},{key:"setScope",value:function(t){return this.ref=t,this}},{key:"getScope",value:function(){return this.ref}},{key:"copy",value:function(){return new e(this.config)}},{key:"toData",value:function(){return this.state.disposed||P(this.state,this.config)?null:{state:k({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=k(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_applyTransition",value:function(t){return this.chain(new Hs(this.chain(),"image:applyTransition",(new Mt).setContent([t])))}},{key:"_init",value:function(t){return new Hs(this.chain(),Hs.ActionTypes.init,(new Mt).setContent([t]))}},{key:"_initWearable",value:function(t){return new Hs(this.chain(),Hs.ActionTypes.initWearable,(new Mt).setContent([t]))}},{key:"_flush",value:function(){return new Hs(this.chain(),Hs.ActionTypes.flush,new Mt)}},{key:"reset",value:function(){this.state=k({},this.config)}},{key:"toDisplayableTransform",value:function(){return new Ji(this.state,{duration:0})}},{key:"getTransformState",value:function(){return{position:this.state.position,scale:this.state.scale,rotation:this.state.rotation,opacity:this.state.opacity,display:this.state.display}}},{key:"resolveTags",value:function(t,e){if(!this.state.tag)throw new Error("Tag not defined\nTag must be defined in the image config");var n=this.constructTagMap(this.state.tag.groups),r=new Set,o=function(t){var e,o=ms(t);try{for(o.s();!(e=o.n()).done;){var i=e.value,a=n.get(i);if(a){var s,u=ms(a);try{for(u.s();!(s=u.n()).done;){var c=s.value;r.delete(c)}}catch(t){u.e(t)}finally{u.f()}r.add(i)}}}catch(t){o.e(t)}finally{o.f()}};return o(t),o(e),Array.from(r)}},{key:"_mixedSrcError",value:function(){throw new TypeError("To better understand the behavior of the image, you cannot mix src and tags in the same image. If you are using tags, remove the src from the image config and do not use setSrc method. If you are using src, remove the tags from the image config and do not use setAppearance method.")}},{key:"_invalidSrcHandlerError",value:function(){throw new Error("Invalid src handler, If you are using tags, config.src must be a function that resolves the src from the tags. If you are using src, config.src must be a string or StaticImageData")}},{key:"_srcNotSpecifiedError",value:function(){throw new TypeError("Src not specified\nPlease provide a src or tags in the image config")}},{key:"_invalidWearableError",value:function(t){throw new Error("Invalid wearable\nWearable must be an Image with isWearable set to true\nIt seems like you are trying to add a non-wearable image to wearables\nImage below violates the rule:\n"+t)}},{key:"_invalidTagGroupDefinitionError",value:function(){throw new Error("Invalid tag group definition. Tags in groups must be unique and not conflicting with each other.")}},{key:"constructTagMap",value:function(t){var e,n=new Map,r=ms(t);try{for(r.s();!(e=r.n()).done;){var o,i=e.value,a=ms(i);try{for(a.s();!(o=a.n()).done;){var s=o.value;n.set(s,i)}}catch(t){a.e(t)}finally{a.f()}}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"_setSrc",value:function(t,e,n){if(n){var r=n.copy();r.setSrc(au.srcToString(e)),t._transitionSrc(r)}var o=new Hs(t,Hs.ActionTypes.setSrc,(new Mt).setContent(["string"==typeof e?e:au.staticImageDataToSrc(e)]));return t.chain(o).chain(this._flush())}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new Hs(this.chain(),Hs.ActionTypes.dispose,new Mt))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return qt.serializePosition(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}},{key:"deserializeImageState",value:function(t){var e={position:function(t){return qt.toCoord2D(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}},{key:"getSrc",value:function(t){if("string"==typeof t.src||au.isStaticImageData(t.src)){var n=t.src;return au.isStaticImageData(n)?au.staticImageDataToSrc(n):n}var r=t.src,o=t.currentTags;if(!o)throw new Error("Tags not resolved\nTags must be resolved before getting the src");return e.getSrcFromTags(o,r)}},{key:"getSrcFromTags",value:function(t,e){return e.apply(void 0,gs(t))}},{key:"fromSrc",value:function(t){return new e({src:t})}}])}(ys);Ps.EventTypes=Object.assign(Object.assign({},ys.EventTypes),{"event:wearable.create":"event:wearable.create"}),Ps.DefaultImagePlaceholder="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",Ps.defaultConfig={display:!1,position:new Yt(Rt.Center),scale:1,rotation:0,opacity:0,isWearable:!1,wearables:[],src:Ps.DefaultImagePlaceholder,currentTags:null,autoInit:!0};var Cs=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ss(this,e),(t=As(this,e)).name=n.name||"(anonymous [virtual image proxy])",t.config.opacity=1,t.state.opacity=1,t}return Ts(e,t),ks(e,[{key:"checkConfig",value:function(t){return this}}])}(Ps);function Is(t){return Is="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Is(t)}function Ls(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ns(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ns(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ns(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Rs(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Rs=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Is(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Is(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Ms(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Fs(r.key),r)}}function Fs(t){var e=function(t,e){if("object"!=Is(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Is(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Is(e)?e:e+""}function Ds(t,e,n){return e=Us(e),function(t,e){if(e&&("object"==Is(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Bs()?Reflect.construct(e,n||[],Us(t).constructor):e.apply(t,n))}function Bs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Bs=function(){return!!t})()}function Vs(t,e,n,r){var o=Gs(Us(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Gs(){return Gs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Us(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Gs.apply(null,arguments)}function Us(t){return Us=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Us(t)}function Ws(t,e){return Ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ws(t,e)}var zs=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Hs=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ds(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ws(t,e)}(e,t),function(t,e,n){return e&&Ms(t.prototype,e),n&&Ms(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var r=this,o=Object.create(null,{executeAction:{get:function(){return Vs(e,"executeAction",r,1)}},unknownTypeError:{get:function(){return Vs(e,"unknownTypeError",r,1)}}});if(this.type===n.init){if(this.callee.config.isWearable)throw new Error("Cannot init wearable image with init action\nIt seems like you are trying to init a wearable image with an init action, or use this wearable image without parent.");var i=t.findElementByDisplayable(this.callee);i&&t.disposeImage(this.callee,i.scene);var a=this.contentNode.getContent()[0];return t.createImage(this.callee,a),this.resolveAwaitable((function(e){return zs(r,void 0,void 0,Rs().mark((function n(){return Rs().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:displayable.init");case 2:e(o.executeAction.call(this,t)),t.stage.next();case 4:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.initWearable){var s=Ls(this.contentNode.getContent(),1)[0];return this.resolveAwaitable((function(e){return zs(r,void 0,void 0,Rs().mark((function n(){return Rs().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:wearable.create",s);case 2:return n.next=4,s.events.any("event:displayable.init");case 4:e(o.executeAction.call(this,t)),t.stage.next();case 6:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.setSrc){if(this.callee.state.tag)throw this.callee._mixedSrcError();return this.callee.state.src=this.contentNode.getContent()[0],t.logger.debug("Image - Set Src",this.callee.state.src),t.stage.update(),o.executeAction.call(this,t)}if([n.show,n.hide,n.applyTransform].includes(this.type)){var u=new x((function(t){return t})).registerSkipController(new C((function(){return r.type===n.hide&&(r.callee.state.display=!1),o.executeAction.call(r,t)}))),c=this.contentNode.getContent()[1];return this.type===n.show&&(this.callee.state.display=!0,t.stage.update()),t.animateImage(Ps.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){var t;r.type===n.hide&&(r.callee.state.display=!1),u.resolve({type:r.type,node:null===(t=r.contentNode)||void 0===t?void 0:t.getChild()})})),u}if(this.type===n.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),o.executeAction.call(this,t);if(this.type===n.applyTransition){var l=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}}))),f=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",f).then((function(){l.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),l}if(this.type===n.flush)return o.executeAction.call(this,t);if(this.type===n.setAppearance){var p=Ls(this.contentNode.getContent(),2),h=p[0],d=p[1];if(!this.callee.state.tag||!this.callee.state.currentTags)throw this.callee._srcNotSpecifiedError();var y=this.callee.resolveTags(this.callee.state.currentTags,h),v=Ps.getSrcFromTags(y,this.callee.state.src);if(t.logger.debug("Image - Set Appearance",y,v),d){var m=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}})));d.setSrc(v),this.callee.events.any("event:displayable.applyTransition",d).then((function(){r.callee.state.currentTags=y,m.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()}))}return this.callee.state.currentTags=y,o.executeAction.call(this,t)}throw o.unknownTypeError.call(this)}}])}(J);function $s(t){return function(t){if(Array.isArray(t))return qs(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return qs(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qs(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ys(t,e,n){return e=Js(e),function(t,e){if(e&&("object"==tu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Zs()?Reflect.construct(e,n||[],Js(t).constructor):e.apply(t,n))}function Xs(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qs(t,e)}function Ks(t){var e="function"==typeof Map?new Map:void 0;return Ks=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(Zs())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&Qs(o,n.prototype),o}(t,arguments,Js(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Qs(n,t)},Ks(t)}function Zs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Zs=function(){return!!t})()}function Qs(t,e){return Qs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qs(t,e)}function Js(t){return Js=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Js(t)}function tu(t){return tu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tu(t)}function eu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ou(r.key),r)}}function ru(t,e,n){return e&&nu(t.prototype,e),n&&nu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ou(t){var e=function(t,e){if("object"!=tu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tu(e)?e:e+""}Hs.ActionTypes=n;var iu=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;eu(this,t),this.r=e,this.g=n,this.b=r,this.a=o}return ru(t,[{key:"toString",value:function(){return"rgba(".concat(this.r,", ").concat(this.g,", ").concat(this.b,", ").concat(this.a,")")}},{key:"toHex",value:function(){return"#"+this.r.toString(16)+this.g.toString(16)+this.b.toString(16)}},{key:"toImageColor",value:function(){return{r:this.r,g:this.g,b:this.b,a:this.a}}}],[{key:"isHexString",value:function(t){return"string"==typeof t&&/^#[0-9A-F]{6}$/i.test(t)}},{key:"fromHex",value:function(e){var n=e.slice(1);return new t(parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1)}}])}(),au=function(){function t(){eu(this,t)}return ru(t,null,[{key:"srcToString",value:function(t){return"string"==typeof t?t:t.src}},{key:"staticImageDataToSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"isStaticImageData",value:function(t){return void 0!==(null==t?void 0:t.src)&&"string"==typeof t.src}},{key:"backgroundToSrc",value:function(e){return t.isStaticImageData(e)?e.src:(null==e?void 0:e.url)||null}},{key:"isExternalSrc",value:function(t){return t.startsWith("http://")||t.startsWith("https://")}},{key:"isImageSrc",value:function(e){return"string"==typeof e&&!this.isHexString(e)||t.isStaticImageData(e)}},{key:"isImageColor",value:function(e){return t.isHexString(e)||t.isPlainColor(e)}},{key:"isPlainColor",value:function(t){return t&&("string"==typeof t||"object"===tu(t)&&"r"in t&&"g"in t&&"b"in t)}},{key:"isHexString",value:function(t){return"string"==typeof t&&/^#([0-9A-F]{6}|[0-9A-F]{3})$/i.test(t)}},{key:"toBackgroundSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"toHex",value:function(t){return O(t)}}])}();au.RGBColor=iu;var su,uu=function(t){function e(t,n){return eu(this,e),Ys(this,e,[t,{info:n},"StaticScriptWarning"])}return Xs(e,t),ru(e,null,[{key:"isWarning",value:function(t){return t instanceof e}}])}(function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UseError";return eu(this,e),(r=Ys(this,e,[t])).props=n,r.name=o,r}return Xs(e,t),ru(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(Ks(Error))),cu=function(){return ru((function t(e){eu(this,t),this.scene=e}),[{key:"run",value:function(t){var e=new Map,n=new Map,r=[],o=new Set,i=this.scene.getAllChildren(t,this.scene.getSceneRoot());if(!i.length)return null;for(r.push(i[0]);r.length;){var a=r.shift();this.checkAction(t,a,{imageStates:e,scenes:n},o);var s=a.contentNode.getChild();s&&s.action&&r.push(s.action)}return e}},{key:"checkAction",value:function(t,n,r,o){var i=r.imageStates,a=r.scenes;if(n instanceof Hs)i.has(n.callee)||i.set(n.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(i.get(n.callee),n);else if(n instanceof xt){var s=n.callee;if(a.has(s.name)){if(a.get(s.name)!==s){var u="Scene with name: ".concat(s.name," is duplicated\nScene: ").concat(s.name,"\n\nAt: ").concat(n.__stack);throw new uu(u)}}else a.set(s.name,s);if(n.type===e.jumpTo){var c=n.contentNode.getContent()[0],l=t.getScene(c,!0);if(o.has(l))return;o.add(l)}}}},{key:"checkImage",value:function(t,e){if(e.type===n.dispose){if(t.isDisposed){var r="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new uu(r)}t.isDisposed=!0}else if([n.init,n.show,n.hide,n.applyTransform,n.applyTransition].includes(e.type)){if(t.isDisposed){var o="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new uu(o)}}else if(e.type===n.setSrc){var i=e.contentNode.getContent()[0];au.isExternalSrc(i)&&(t.usedExternalSrc=!0)}}}])}(),lu=function(t){function e(t,n){var r;return eu(this,e),(r=Ys(this,e,[e.toMessage(t,n)])).name="RuntimeScriptError",r}return Xs(e,t),ru(e,null,[{key:"toMessage",value:function(t,n){var r=[];return r.push.apply(r,$s(Array.isArray(t)?t:[t])),n&&r.push.apply(r,$s(Array.isArray(n)?n.map(e.getActionTrace):[e.getActionTrace(n)])),r.join("")}},{key:"getActionTrace",value:function(t){return"\nUsing action (id: ".concat(t.getId(),")")+"\n at: ".concat(t.__stack)}}])}(Ks(Error)),fu=function(t){function e(t){var n;return eu(this,e),(n=Ys(this,e,[t])).name="RuntimeGameError",n}return Xs(e,t),ru(e)}(Ks(Error));function pu(t){return pu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pu(t)}function hu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,du(r.key),r)}}function du(t){var e=function(t,e){if("object"!=pu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pu(e)?e:e+""}function yu(t,e,n){return e=mu(e),function(t,e){if(e&&("object"==pu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,vu()?Reflect.construct(e,n||[],mu(t).constructor):e.apply(t,n))}function vu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vu=function(){return!!t})()}function mu(t){return mu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mu(t)}function gu(t,e){return gu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gu(t,e)}!function(t){t.soundEffect="soundEffect",t.music="music",t.voice="voice",t.backgroundMusic="backgroundMusic"}(su||(su={}));var bu=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=yu(this,e)).state={playing:null,token:null},t.config=k(e.defaultConfig,"string"==typeof n?{src:n}:n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gu(t,e)}(e,t),function(t,e,n){return e&&hu(t.prototype,e),n&&hu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"play",value:function(){if(this.config.type===su.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(ft.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===su.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(ft.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===su.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(ft.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(ft.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(ft.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(ft.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(ft.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(t){return Object.assign({src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1},t||{})}},{key:"getSrc",value:function(){return this.config.src}},{key:"getToken",value:function(){return this.state.token||void 0}},{key:"getPlaying",value:function(){return this.state.playing}},{key:"setToken",value:function(t){this.state.token=void 0===t?null:t}},{key:"setPlaying",value:function(t){return this.state.playing=t,this}},{key:"toData",value:function(){return P(this.config,e.defaultConfig)?null:{config:A(this.config)}}},{key:"fromData",value:function(t){return this.config=k(this.config,t.config),this}},{key:"reset",value:function(){var t;null===(t=this.state.playing)||void 0===t||t.stop(),this.state.playing=null,this.state.token=null}},{key:"pushAction",value:function(t,e){return this.chain(new ft(this.chain(),t,(new Mt).setContent(e)))}}],[{key:"toSoundSrc",value:function(t){return null==t?null:"string"==typeof t?t:t.getSrc()}},{key:"toSound",value:function(t){return null==t?null:"string"==typeof t?new e({src:t}):t}}])}(Wa);function wu(t){return wu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wu(t)}function Su(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_u(r.key),r)}}function _u(t){var e=function(t,e){if("object"!=wu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=wu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==wu(e)?e:e+""}bu.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var ku=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e}return function(t,e,n){return e&&Su(t.prototype,e),n&&Su(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,null,[{key:"from",value:function(e){return t.isPauseConstructor(e)?new t:e}},{key:"wait",value:function(e){return new t({duration:e})}},{key:"isPause",value:function(e){return this.isPauseConstructor(e)||e instanceof t}},{key:"isPauseConstructor",value:function(e){return e===t}}])}();function xu(t){return xu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xu(t)}function Au(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ou(r.key),r)}}function Ou(t){var e=function(t,e){if("object"!=xu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=xu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xu(e)?e:e+""}var Eu=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=e,this.config=k(t.defaultConfig,n)}return function(t,e,n){return e&&Au(t.prototype,e),n&&Au(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"evaluate",value:function(e){var n=this;if(ku.isPause(this.text))return[this];if("function"==typeof this.text){var r=this.text(e);return Array.isArray(r)?r.map((function(r){return t.isWord(r)?r.inherit(n.config).evaluate(e):new t(r,n.config)})).flat():t.isWord(r)?r.inherit(this.config).evaluate(e):[new t(r,this.config)]}return[this]}},{key:"inherit",value:function(t){return this.config.color=this.config.color||t.color,this.config.italic=this.config.italic||t.italic,this.config.bold=this.config.bold||t.bold,this}},{key:"copy",value:function(){return new t(this.text,this.config)}},{key:"isPause",value:function(){return ku.isPause(this.text)}},{key:"toString",value:function(){return"string"==typeof this.text?this.text:""}}],[{key:"isWord",value:function(e){return e instanceof t}},{key:"color",value:function(e,n){return t.isWord(e)?e.copy().inherit({color:n}):new t(e,{color:n})}},{key:"bold",value:function(e){return t.isWord(e)?e.copy().inherit({bold:!0}):new t(e,{bold:!0})}},{key:"italic",value:function(e){return t.isWord(e)?e.copy().inherit({italic:!0}):new t(e,{italic:!0})}},{key:"getText",value:function(t){return t.filter((function(t){return!t.isPause()})).map((function(t){return t.toString()})).join("")}}])}();function Tu(t){return Tu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tu(t)}function ju(t){return function(t){if(Array.isArray(t))return Pu(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Pu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pu(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Cu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Iu(r.key),r)}}function Iu(t){var e=function(t,e){if("object"!=Tu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Tu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Tu(e)?e:e+""}Eu.defaultConfig={},Eu.defaultColor="#000";var Lu=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=t.format(e),this.config=k(t.defaultConfig,Object.assign(Object.assign({},n),{voice:bu.toSound(n.voice)})),this.state=A(t.defaultState)}return function(t,e,n){return e&&Cu(t.prototype,e),n&&Cu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"toData",value:function(){return P(this.state,t.defaultState)?null:{state:A(this.state)}}},{key:"fromData",value:function(t){return this.state=k(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}},{key:"setCharacter",value:function(t){return this.config.character=t,this}},{key:"evaluate",value:function(e){for(var n=[],r=0;r<this.text.length;r++){var o=this.text[r].evaluate(e);n.push.apply(n,ju(t.formatStaticWord(o)))}return n}},{key:"copy",value:function(){return new t(ju(this.text),this.config)}}],[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(e)}},{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)e.push(this.formatWord(t[n]));else e.push(this.formatWord(t));return e}},{key:"formatWord",value:function(t){return Eu.isWord(t)?t:new Eu(t)}},{key:"formatStaticWord",value:function(t,e){var n=this;return Array.isArray(t)?t.map((function(t){return n.formatStaticWord(t,e)})).flat(2):[Eu.isWord(t)?t:new Eu(t,e)]}},{key:"isSentencePrompt",value:function(e){return Array.isArray(e)?e.every(t.isSingleWord):t.isSingleWord(e)}},{key:"isSingleWord",value:function(t){return"string"==typeof t||Eu.isWord(t)||ku.isPause(t)||"function"==typeof t}}])}();function Nu(t){return Nu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nu(t)}function Ru(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mu(r.key),r)}}function Mu(t){var e=function(t,e){if("object"!=Nu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nu(e)?e:e+""}function Fu(t,e,n){return e=Gu(e),function(t,e){if(e&&("object"==Nu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Du()?Reflect.construct(e,n||[],Gu(t).constructor):e.apply(t,n))}function Du(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Du=function(){return!!t})()}function Bu(t,e,n,r){var o=Vu(Gu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Vu(){return Vu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Gu(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Vu.apply(null,arguments)}function Gu(t){return Gu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gu(t)}function Uu(t,e){return Uu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Uu(t,e)}Lu.defaultConfig={color:"#000",pause:!0,voice:null,character:null,voiceId:null},Lu.defaultState={display:!0};var Wu=function(e){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),Fu(this,n,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Uu(t,e)}(n,e),function(t,e,n){return e&&Ru(t.prototype,e),n&&Ru(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"executeAction",value:function(e){var r=this;if(this.type===t.say){var o=new x((function(t){return t})).registerSkipController(new C((function(){return{type:r.type,node:r.contentNode.getChild()}}))),i=this.contentNode.getContent(),a=n.getVoice(e,i);return a&&(ft.initSound(e,a),e.playSound(a,(function(){e.stopSound(a)}))),e.createText(this.getId(),i,(function(){a&&e.stopSound(a),o.resolve({type:r.type,node:r.contentNode.getChild()})})),o}if(this.type===t.setName)return this.callee.state.name=this.contentNode.getContent()[0],Bu(n,"executeAction",this,3)([e]);throw Bu(n,"unknownTypeError",this,3)([])}}],[{key:"getVoice",value:function(t,e){var n=t.getLastScene();if(!n)throw new Error("No scene found when trying to play voice");var r=e.config,o=r.voiceId,i=r.voice;return o||i?bu.toSound(n.getVoice(o)||i):null}}])}(J);function zu(t){return zu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zu(t)}function Hu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,$u(r.key),r)}}function $u(t){var e=function(t,e){if("object"!=zu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=zu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==zu(e)?e:e+""}function qu(t,e,n){return e=Xu(e),function(t,e){if(e&&("object"==zu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Yu()?Reflect.construct(e,n||[],Xu(t).constructor):e.apply(t,n))}function Yu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yu=function(){return!!t})()}function Xu(t){return Xu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xu(t)}function Ku(t,e){return Ku=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ku(t,e)}Wu.ActionTypes=t;var Zu=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=qu(this,e)).config=k(e.defaultConfig,r),n.state={name:t||""},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ku(t,e)}(e,t),function(t,e,n){return e&&Hu(t.prototype,e),n&&Hu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"say",value:function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(Array.isArray(t)&&t.every((function(t){return"string"==typeof t}))&&[e].concat(r).length>0&&[e].concat(r).every((function(t){return Lu.isSingleWord(t)}))){var i=t,a=Lu.format([e].concat(r)),s=new Lu(function(t,e){for(var n=[],r=0;r<Math.max(t.length,e.length);r++)r<t.length&&n.push(t[r]),r<e.length&&n.push(e[r]);return n}(i,a),{character:this}),u=new Wu(this.chain(),Wu.ActionTypes.say,(new Mt).setContent(s));return this.chain(u)}var c=e||{},l=t,f=Array.isArray(l)?new Lu(l,Object.assign(Object.assign({},c),{character:this})):(Lu.isSentence(l)?l:new Lu(l,Object.assign(Object.assign({},c),{character:this}))).copy();f.setCharacter(this);var p=new Wu(this.chain(),Wu.ActionTypes.say,(new Mt).setContent(f));return this.chain(p)}},{key:"setName",value:function(t){var e=new Wu(this.chain(),Wu.ActionTypes.setName,(new Mt).setContent([t]));return this.chain(e)}}])}(Wa);function Qu(t){return Qu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qu(t)}function Ju(t){return function(t){if(Array.isArray(t))return tc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return tc(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tc(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ec(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nc(r.key),r)}}function nc(t){var e=function(t,e){if("object"!=Qu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qu(e)?e:e+""}function rc(t,e,n){return e=ac(e),function(t,e){if(e&&("object"==Qu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,oc()?Reflect.construct(e,n||[],ac(t).constructor):e.apply(t,n))}function oc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(oc=function(){return!!t})()}function ic(){return ic="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ac(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},ic.apply(null,arguments)}function ac(t){return ac=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ac(t)}function sc(t,e){return sc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},sc(t,e)}Zu.defaultConfig={color:"#000"};var uc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),rc(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&sc(t,e)}(e,t),function(t,e,n){return e&&ec(t.prototype,e),n&&ec(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var e,n,r=this.callee.evaluate(this.contentNode.getContent(),{gameState:t});return null===(e=null==r?void 0:r[r.length-1])||void 0===e||e.contentNode.addChild(this.contentNode.getChild()),this.contentNode.addChild((null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.contentNode)||null),{type:this.type,node:this.contentNode.getChild()}}},{key:"getFutureActions",value:function(t){return[].concat(Ju(this.callee._getFutureActions()),Ju(function(t,e,n,r){var o=ic(ac(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([t])))}}])}(J);function cc(t){return cc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cc(t)}function lc(t){return function(t){if(Array.isArray(t))return pc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||fc(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fc(t,e){if(t){if("string"==typeof t)return pc(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pc(t,e):void 0}}function pc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function hc(t,e,n){return e=yc(e),function(t,e){if(e&&("object"==cc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,dc()?Reflect.construct(e,n||[],yc(t).constructor):e.apply(t,n))}function dc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(dc=function(){return!!t})()}function yc(t){return yc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yc(t)}function vc(t,e){return vc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vc(t,e)}function mc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,wc(r.key),r)}}function bc(t,e,n){return e&&gc(t.prototype,e),n&&gc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function wc(t){var e=function(t,e){if("object"!=cc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cc(e)?e:e+""}uc.ActionTypes={action:"condition:action"};var Sc=function(){function t(e){mc(this,t),this.handler=e}return bc(t,[{key:"evaluate",value:function(t){var e=t.gameState;return{value:this.handler(this.getCtx({gameState:e}))}}},{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}],[{key:"isLambda",value:function(e){return e instanceof t&&"handler"in e}},{key:"from",value:function(e){return t.isLambda(e)?e:new t(e)}}])}(),_c=function(t){function e(){var t;return mc(this,e),(t=hc(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vc(t,e)}(e,t),bc(e,[{key:"ElseIf",value:function(t,e){if(this.conditions.Else.action)throw new uu("ELSE condition already set\nYou are trying to set an ELSE-IF condition after an ELSE condition");return this.conditions.ElseIf.push({condition:Sc.isLambda(t)?t:new Sc(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(this.conditions.Else.action)throw new uu("ELSE condition already set\nYou are trying to set multiple ELSE conditions for the same condition");return this.conditions.Else.action=this.construct(Array.isArray(t)?t:[t]),this.chain()}},{key:"evaluate",value:function(t,e){var n,r,o={gameState:e.gameState},i=null===(n=t.If.condition)||void 0===n?void 0:n.evaluate(o);if(null==i?void 0:i.value)return t.If.action||null;var a,s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=fc(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(t.ElseIf);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=null===(r=u.condition)||void 0===r?void 0:r.evaluate(o);if(null==c?void 0:c.value)return u.action||null}}catch(t){s.e(t)}finally{s.f()}return t.Else.action||null}},{key:"fromChained",value:function(t){return[Reflect.construct(uc,[this,uc.ActionTypes.action,(new Mt).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=Na.toActions(t),i=0;i<o.length;i++){var a=o[i].contentNode,s=null===(r=o[i+1])||void 0===r?void 0:r.contentNode;s&&a.setChild(s),i===o.length-1&&e&&a.setChild(e),0===i&&n&&n.setChild(a)}return o}},{key:"_getFutureActions",value:function(){var t,e;return Na.toActions([(null===(t=this.conditions.If.action)||void 0===t?void 0:t[0])||[]].concat(lc(this.conditions.ElseIf.flatMap((function(t){var e;return(null===(e=t.action)||void 0===e?void 0:e[0])||[]}))),[(null===(e=this.conditions.Else.action)||void 0===e?void 0:e[0])||[]]))}},{key:"createIfCondition",value:function(t,e){return this.conditions.If.condition=t instanceof Sc?t:new Sc(t),this.conditions.If.action=this.construct(Array.isArray(e)?e:[e]),this.chain()}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}},{key:"If",value:function(t,n){return(new e).createIfCondition(t,n)}}])}(Wa);function kc(t){return kc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kc(t)}function xc(t){return function(t){if(Array.isArray(t))return Ac(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ac(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ac(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ac(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Oc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ec(r.key),r)}}function Ec(t){var e=function(t,e){if("object"!=kc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=kc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==kc(e)?e:e+""}function Tc(t,e,n){return e=Cc(e),function(t,e){if(e&&("object"==kc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,jc()?Reflect.construct(e,n||[],Cc(t).constructor):e.apply(t,n))}function jc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(jc=function(){return!!t})()}function Pc(){return Pc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Cc(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Pc.apply(null,arguments)}function Cc(t){return Cc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cc(t)}function Ic(t,e){return Ic=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ic(t,e)}var Lc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Tc(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ic(t,e)}(e,t),function(t,e,n){return e&&Oc(t.prototype,e),n&&Oc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var e=this,n=new x((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(t){var n=this.contentNode.getContent();return[].concat(xc(this.callee._getFutureActions(n.choices)),xc(function(t,e,n,r){var o=Pc(Cc(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"getFutureActions",this,3)([t])))}}])}(J);function Nc(t){return Nc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nc(t)}function Rc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mc(r.key),r)}}function Mc(t){var e=function(t,e){if("object"!=Nc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nc(e)?e:e+""}function Fc(t,e,n){return e=Bc(e),function(t,e){if(e&&("object"==Nc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Dc()?Reflect.construct(e,n||[],Bc(t).constructor):e.apply(t,n))}function Dc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Dc=function(){return!!t})()}function Bc(t){return Bc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bc(t)}function Vc(t,e){return Vc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vc(t,e)}Lc.ActionTypes={action:"menu:action"};var Gc=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Fc(this,e)).choices=[],n.prompt=Lu.isSentence(t)?t:new Lu(t),n.config=k(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vc(t,e)}(e,t),function(t,e,n){return e&&Rc(t.prototype,e),n&&Rc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"choose",value:function(t,e){var n=this.chain();return Lu.isSentence(t)&&e||(Eu.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:Lu.toSentence(t),action:Na.toActions(e)}):"object"===Nc(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:Lu.toSentence(t.prompt),action:Na.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new Lc(this.chain(),Lc.ActionTypes.action,(new Mt).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action[0]||null})).filter((function(t){return null!==t}))}},{key:"constructNodes",value:function(t,e,n){for(var r,o=0;o<t.length;o++){var i=t[o].contentNode,a=null===(r=t[o+1])||void 0===r?void 0:r.contentNode;a&&i.setChild(a),o===this.choices.length-1&&e&&i.setChild(e),0===o&&n&&n.setChild(i)}return t}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.constructNodes(e.action),prompt:e.prompt}}))}}])}(Wa);function Uc(t){return Uc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uc(t)}function Wc(t){return function(t){if(Array.isArray(t))return zc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return zc(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zc(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Hc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,$c(r.key),r)}}function $c(t){var e=function(t,e){if("object"!=Uc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Uc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Uc(e)?e:e+""}function qc(t,e,n){return e=Xc(e),function(t,e){if(e&&("object"==Uc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Yc()?Reflect.construct(e,n||[],Xc(t).constructor):e.apply(t,n))}function Yc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yc=function(){return!!t})()}function Xc(t){return Xc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xc(t)}function Kc(t,e){return Kc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kc(t,e)}Gc.defaultConfig={},Gc.targetAction=Lc;var Zc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),qc(this,e)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Kc(t,e)}(e,t),function(t,e,n){return e&&Hc(t.prototype,e),n&&Hc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"fromChained",value:function(t){return t.getActions()}},{key:"forEachChild",value:function(t,e,n){var r=new Set,o=[];for(Array.isArray(e)?o.push.apply(o,Wc(e)):o.push(e);o.length;){var i=o.shift();if(!r.has(i)){r.add(i),n(i);var a=i.getFutureActions(t).filter((function(t){return!r.has(t)}));o.push.apply(o,Wc(a))}}}},{key:"getAllChildren",value:function(t,e){var n=[];return this.forEachChild(t,e,(function(t){return n.push(t)})),n}},{key:"getAllChildrenMap",value:function(t,e){var n=new Map;return this.forEachChild(t,e,(function(t){return n.set(t.getId(),t)})),n}},{key:"getAllElementMap",value:function(t,e){var n=new Map;return this.forEachChild(t,e,(function(t){return n.set(t.callee.getId(),t.callee)})),n}},{key:"getAllChildrenElements",value:function(t,e){return Array.from(new Set(this.getAllChildren(t,e).map((function(t){return t.callee}))))}},{key:"toData",value:function(){return null}},{key:"constructNodes",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setChild(o.contentNode))}return t.length?t[0].contentNode:null}}])}(Ra);function Qc(t){return Qc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qc(t)}function Jc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,tl(r.key),r)}}function tl(t){var e=function(t,e){if("object"!=Qc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qc(e)?e:e+""}var el=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.src=[],this.future=[]}return function(t,e,n){return e&&Jc(t.prototype,e),n&&Jc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"register",value:function(t,e){var n=this;if(Array.isArray(t))t.forEach((function(t){return n.register(t)}));else if(t instanceof bu){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof Ps||au.isStaticImageData(t)){if(t instanceof Ps){if(this.isSrcRegistered(Ps.getSrc(t.state)))return this}else if(this.isSrcRegistered(au.srcToString(t.src)))return this;this.src.push({type:"image",src:new Ps(t instanceof Ps?{src:Ps.getSrc(t.state)}:{src:au.staticImageDataToSrc(t)})})}else if("object"===Qc(t)){if(this.isSrcRegistered(t.src||""))return this;this.src.push(t)}else if("audio"===t){if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e instanceof bu?e:new bu({src:e})})}else{if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e})}return this}},{key:"isSrcRegistered",value:function(e){var n=e instanceof bu?e.getSrc():e;return this.src.some((function(e){return e.type===t.SrcTypes.audio?n===e.src.getSrc():e.type===t.SrcTypes.image?n===Ps.getSrc(e.src.state):n===e.src}))}},{key:"getSrc",value:function(){return this.src}},{key:"getSrcByType",value:function(t){return this.src.filter((function(e){return e.type===t}))}},{key:"registerFuture",value:function(t){return this.future.includes(t)||this.hasFuture(t)||this.future.push(t),this}},{key:"hasFuture",value:function(t){return this.future.includes(t)}},{key:"getFutureSrc",value:function(){return this.future.map((function(t){return t.getSrc()})).flat(2)}}],[{key:"catSrc",value:function(e){var n=new Set,r=new Set,o=new Set;return e.forEach((function(e){var i=e.type,a=e.src;i===t.SrcTypes.image?n.add(a):i===t.SrcTypes.video?r.add(a):o.add(a)})),{image:Array.from(n),video:Array.from(r),audio:Array.from(o)}}},{key:"getSrc",value:function(t){return"string"==typeof t?t:t instanceof Ps?Ps.getSrc(t.state):"image"===t.type?Ps.getSrc(t.src.state):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}},{key:"getPreloadableSrc",value:function(t,r){var o;if(r.is(xt,e.setBackground)){var i=r.contentNode.getContent()[0],a=au.backgroundToSrc(i);if(a)return{type:"image",src:new Ps({src:a}),activeType:"scene"}}else if(r.is(xt,e.jumpTo)){var s=r.contentNode.getContent()[0],u=t.getScene(s,!0).config.background;if(au.isStaticImageData(u)||"string"==typeof u)return{type:"image",src:new Ps({src:u}),activeType:"once"}}else if(r instanceof Hs){var c=r;if(c.callee.config.tag)return{type:"image",src:new Ps({src:Ps.getSrcFromTags(c.callee.config.tag.defaults,c.callee.config.src)}),activeType:"scene"};if(r.is(Hs,n.setSrc)){var l=r.contentNode.getContent()[0];return{type:"image",src:new Ps({src:l}),activeType:"scene"}}if(r.type===n.initWearable)return{type:"image",src:r.contentNode.getContent()[0],activeType:"scene"};if(r.type===n.setAppearance){var f=r.contentNode.getContent()[0];if("function"!=typeof c.callee.config.src)throw c.callee._invalidSrcHandlerError();if(f.length===(null===(o=c.callee.state.tag)||void 0===o?void 0:o.groups.length))return{type:"image",src:Ps.fromSrc(Ps.getSrcFromTags(f,c.callee.config.src)),activeType:"scene"}}else if(r.type===n.init){var p=r.callee.config.src;if("string"==typeof p||au.isStaticImageData(p))return{type:"image",src:new Ps({src:p}),activeType:"scene"}}}return null}}])}();function nl(t){return nl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nl(t)}function rl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ol(r.key),r)}}function ol(t){var e=function(t,e){if("object"!=nl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=nl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==nl(e)?e:e+""}function il(t,e,n){return e=cl(e),function(t,e){if(e&&("object"==nl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,al()?Reflect.construct(e,n||[],cl(t).constructor):e.apply(t,n))}function al(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(al=function(){return!!t})()}function sl(t,e,n,r){var o=ul(cl(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ul(){return ul="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=cl(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},ul.apply(null,arguments)}function cl(t){return cl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cl(t)}function ll(t,e){return ll=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ll(t,e)}el.SrcTypes={image:"image",video:"video",audio:"audio"};var fl=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),il(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ll(t,e)}(e,t),function(t,e,n){return e&&rl(t.prototype,e),n&&rl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(this.type===s.init){var r=t.findElementByDisplayable(this.callee);r&&t.disposeDisplayable(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createDisplayable(this.callee,o);var i=new x((function(t){return t}));return this.callee.events.any("event:displayable.init").then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if([s.show,s.hide,s.applyTransform].includes(this.type)){var a=new x((function(t){return t})).registerSkipController(new C((function(){return n.type===s.hide&&(n.callee.state.display=!1),sl(e,"executeAction",n,3)([t])}))),u=this.contentNode.getContent()[0];return this.type===s.show&&(this.callee.state.display=!0,t.stage.update()),t.animateText(Gl.EventTypes["event:displayable.applyTransform"],this.callee,[u],(function(){n.type===s.hide&&(n.callee.state.display=!1),a.resolve(sl(e,"executeAction",n,3)([t]))})),a}if(this.type===s.setText)return this.callee.state.text=this.contentNode.getContent()[0],sl(e,"executeAction",this,3)([t]);if(this.type===s.setFontSize){this.callee.state.fontSize=this.contentNode.getContent()[0];var c=new Ji([],{duration:0}),l=new x;return t.animateText(Gl.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){l.resolve(sl(e,"executeAction",n,3)([t]))})),l}if(this.type===s.applyTransition){var f=(new x).registerSkipController(new C((function(){return t.logger.info("NarraLeaf-React: Text Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}}))),p=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",p).then((function(){f.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),f}throw sl(e,"unknownTypeError",this,3)([])}}])}(J);fl.ActionTypes=s;var pl={start:"start",update:"update",end:"end"};function hl(t){return hl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hl(t)}function dl(t,e,n){return e=vl(e),function(t,e){if(e&&("object"==hl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,yl()?Reflect.construct(e,n||[],vl(t).constructor):e.apply(t,n))}function yl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yl=function(){return!!t})()}function vl(t){return vl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vl(t)}function ml(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gl(t,e)}function gl(t,e){return gl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gl(t,e)}function bl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_l(r.key),r)}}function Sl(t,e,n){return e&&wl(t.prototype,e),n&&wl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _l(t){var e=function(t,e){if("object"!=hl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=hl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==hl(e)?e:e+""}var kl=function(){return Sl((function t(){bl(this,t),this.events=new E}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(pl.start,null),this.controller=Vi(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(pl.update,r.toElementProps())},onComplete:function(){r.controller=void 0,r.events.emit(pl.end,null),s&&s()}},n)),this.controller}}])}(),xl=function(t){function e(){return bl(this,e),dl(this,e,arguments)}return ml(e,t),Sl(e,[{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(kl);xl.DefaultEasing="linear";var Al=function(t){function e(){return bl(this,e),dl(this,e,arguments)}return ml(e,t),Sl(e,[{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}(kl);function Ol(t){return Ol="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ol(t)}function El(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Tl(r.key),r)}}function Tl(t){var e=function(t,e){if("object"!=Ol(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ol(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ol(e)?e:e+""}function jl(t,e,n){return e=Cl(e),function(t,e){if(e&&("object"==Ol(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Pl()?Reflect.construct(e,n||[],Cl(t).constructor):e.apply(t,n))}function Pl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Pl=function(){return!!t})()}function Cl(t){return Cl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cl(t)}function Il(t,e){return Il=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Il(t,e)}var Ll=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3?arguments[3]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=jl(this,e)).state={fontSize:0},r.startValue=t,r.endValue=n,r.duration=o,r.easing=i,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Il(t,e)}(e,t),function(t,e,n){return e&&El(t.prototype,e),n&&El(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"start",value:function(t){var e=this;this.state.fontSize=this.startValue,this.requestAnimation({start:this.startValue,end:this.endValue,duration:this.duration},{onComplete:function(){e.state.fontSize=e.endValue,t&&t()},onUpdate:function(t){e.state.fontSize=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{fontSize:this.state.fontSize}}]}},{key:"copy",value:function(){return new e(this.startValue,this.endValue,this.duration,this.easing)}}])}(Al);function Nl(t){return Nl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nl(t)}function Rl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ml(r.key),r)}}function Ml(t){var e=function(t,e){if("object"!=Nl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nl(e)?e:e+""}function Fl(t,e,n){return e=Bl(e),function(t,e){if(e&&("object"==Nl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Dl()?Reflect.construct(e,n||[],Bl(t).constructor):e.apply(t,n))}function Dl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Dl=function(){return!!t})()}function Bl(t){return Bl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bl(t)}function Vl(t,e){return Vl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vl(t,e)}Ll.Frames=[1,0];var Gl=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=Fl(this,e)).events=new E,n.config="string"==typeof t?k({},e.defaultConfig,r,{text:t}):k({},e.defaultConfig,t),n.state=k({},n.config),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vl(t,e)}(e,t),function(t,e,n){return e&&Rl(t.prototype,e),n&&Rl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"applyTransform",value:function(t){var e=this.chain(),n=new fl(e,fl.ActionTypes.applyTransform,(new Mt).setContent([t.copy()]));return e.chain(n)}},{key:"applyTransition",value:function(t){var e=this.chain(),n=this._applyTransition(e,t);return e.chain(n)}},{key:"show",value:function(t){var e=this.chain(),n=t instanceof Ji?t.copy():new Ji([{props:{opacity:1},options:t||{}}]),r=new fl(e,fl.ActionTypes.show,(new Mt).setContent([n]));return e.chain(r)}},{key:"hide",value:function(t){var e=this.chain(),n=t instanceof Ji?t.copy():new Ji([{props:{opacity:1},options:t||{}}]),r=new fl(e,fl.ActionTypes.hide,(new Mt).setContent([n]));return e.chain(r)}},{key:"setText",value:function(t){var e=this.chain(),n=new fl(e,fl.ActionTypes.setText,(new Mt).setContent([t]));return e.chain(n)}},{key:"setFontSize",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return this.combineActions(new Za,(function(o){if(n){var i=new Ll(e.state.fontSize,t,n,r);o.chain(e._applyTransition(o,i))}var a=new fl(o,fl.ActionTypes.setFontSize,(new Mt).setContent([t]));return o.chain(a)}))}},{key:"toData",value:function(){return{state:k({},Ps.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=k({},Ps.deserializeImageState(t.state)),this}},{key:"toTransform",value:function(){return new Ji(this.state,{duration:0})}},{key:"toDisplayableTransform",value:function(){return new Ji(this.state,{duration:0})}},{key:"_init",value:function(t){return new fl(this.chain(),fl.ActionTypes.init,(new Mt).setContent([t]))}},{key:"_applyTransition",value:function(t,e){return new fl(t,fl.ActionTypes.applyTransition,(new Mt).setContent([e]))}}])}(Wa);function Ul(t){return Ul="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ul(t)}function Wl(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return zl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zl(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Hl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,$l(r.key),r)}}function $l(t){var e=function(t,e){if("object"!=Ul(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ul(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ul(e)?e:e+""}function ql(t,e,n){return e=Kl(e),function(t,e){if(e&&("object"==Ul(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Yl()?Reflect.construct(e,n||[],Kl(t).constructor):e.apply(t,n))}function Yl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yl=function(){return!!t})()}function Xl(){return Xl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Kl(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Xl.apply(null,arguments)}function Kl(t){return Kl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Kl(t)}function Zl(t,e){return Zl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zl(t,e)}Gl.EventTypes=Object.assign(Object.assign({},ys.EventTypes),{"event:text.show":"event:text.show","event:text.hide":"event:text.hide"}),Gl.defaultConfig={position:new Yt(Yt.Positions.Center),scale:1,rotation:0,opacity:0,alignX:"center",alignY:"center",fontSize:16,fontColor:"#000000",display:!1,text:""};var Ql=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ql(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zl(t,e)}(e,t),function(t,e,n){return e&&Hl(t.prototype,e),n&&Hl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){var n=this;if(n.is(e,"persistent:set")){var r=Wl(n.contentNode.getContent(),2),o=r[0],i=r[1],a=t.getStorable().getNamespace(n.callee.getNamespaceName());if("function"==typeof i){var s=a.get(o);a.set(o,i(s))}else a.set(o,i);return function(t,e,n,r){var o=Xl(Kl(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"executeAction",this,3)([t])}throw this.unknownTypeError()}}])}(J);function Jl(t){return Jl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jl(t)}function tf(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ef(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ef(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ef(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function nf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,af(r.key),r)}}function of(t,e,n){return e&&rf(t.prototype,e),n&&rf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function af(t){var e=function(t,e){if("object"!=Jl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Jl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jl(e)?e:e+""}Ql.ActionTypes=c;var sf=function(){function t(e,n,r){nf(this,t),this.name=e,this.key=r||e,this.content=k({},n)}return of(t,[{key:"set",value:function(e,n){return t.isSerializable(n)?(this.content[e]=n,this):(console.warn('Value "'.concat(n,'" in key "').concat(String(e),'" is not serializable, and will not be set\n at namespace "').concat(this.name,'"')),this.content[e]=n,this)}},{key:"get",value:function(t){return this.content[t]}},{key:"equals",value:function(t,e){return this.content[t]===e}},{key:"assign",value:function(t){var e=this;return Object.entries(t).forEach((function(t){var n=tf(t,2),r=n[0],o=n[1];e.set(r,o)})),this}},{key:"toData",value:function(){return this.serialize()}},{key:"load",value:function(t){t?this.content=t:console.warn("No data to load")}},{key:"serialize",value:function(){var t=this,e={};return Object.entries(this.content).forEach((function(n){var r=tf(n,2),o=r[0],i=r[1];e[o]=t.wrap(i)})),e}},{key:"deserialize",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=tf(t,2),r=n[0],o=n[1];e.content[r]=e.unwrap(o)})):console.warn("No data to load")}},{key:"toTypeName",value:function(t){return t instanceof Date?"date":"any"}},{key:"wrap",value:function(t){return{any:function(t){return{type:"any",data:t}},date:function(t){return{type:"date",data:t.toString()}}}[this.toTypeName(t)](t)}},{key:"unwrap",value:function(t){var e={any:function(t){return t.data},date:function(t){return new Date(t.data)}};return e[t.type](t)}}],[{key:"isSerializable",value:function(e){return!!["number","string","boolean"].includes(Jl(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===Jl(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),uf=function(){return of((function t(){nf(this,t),this.namespaces={}}),[{key:"addNamespace",value:function(t){if(!this.namespaces[t.key])return this.namespaces[t.key]=t,this}},{key:"getNamespace",value:function(t){if(!this.namespaces[t])throw new fu("Namespace ".concat(t," is not initialized, did you forget to register it?")+"\nUse `story.registerPersistent` to register a persistent namespace");return this.namespaces[t]}},{key:"setNamespace",value:function(t,e){return this.namespaces[t]=e,this}},{key:"hasNamespace",value:function(t){return!!this.namespaces[t]}},{key:"removeNamespace",value:function(t){return delete this.namespaces[t],this}},{key:"getNamespaces",value:function(){return this.namespaces}},{key:"keys",value:function(){return Object.keys(this.namespaces)}},{key:"values",value:function(){return Object.values(this.namespaces)}},{key:"entries",value:function(){return Object.entries(this.namespaces)}},{key:"toData",value:function(){return this.entries().reduce((function(t,e){var n=tf(e,2),r=n[0],o=n[1];return t[r]=o.toData(),t}),{})}},{key:"load",value:function(t){var e=this;t?Object.entries(t).forEach((function(t){var n=tf(t,2),r=n[0],o=n[1];e.namespaces[r]?e.namespaces[r].load(o):e.namespaces[r]=new sf(r,o)})):console.warn("No data to load")}},{key:"clear",value:function(){return this.namespaces={},this}}])}();function cf(t){return cf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cf(t)}function lf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ff(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,hf(r.key),r)}}function pf(t,e,n){return e&&ff(t.prototype,e),n&&ff(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function hf(t){var e=function(t,e){if("object"!=cf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cf(e)?e:e+""}function df(t,e,n){return e=vf(e),function(t,e){if(e&&("object"==cf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,yf()?Reflect.construct(e,n||[],vf(t).constructor):e.apply(t,n))}function yf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(yf=function(){return!!t})()}function vf(t){return vf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vf(t)}function mf(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gf(t,e)}function gf(t,e){return gf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gf(t,e)}var bf=function(t){function e(t,n){var r;return lf(this,e),(r=df(this,e)).namespace=r.prefix(t),r.defaultContent=n,r}return mf(e,t),pf(e,[{key:"init",value:function(t){t.hasNamespace(this.namespace)||t.addNamespace(new sf(this.namespace,this.defaultContent))}},{key:"set",value:function(t,e){return this.chain(this.createAction(c.set,[t,e]))}},{key:"equals",value:function(t,e){var n=this;return new Sc((function(r){return r.storable.getNamespace(n.namespace).equals(t,e)}))}},{key:"notEquals",value:function(t,e){var n=this;return new Sc((function(r){return!r.storable.getNamespace(n.namespace).equals(t,e)}))}},{key:"isTrue",value:function(t){var e=this;return new Sc((function(n){return n.storable.getNamespace(e.namespace).equals(t,!0)}))}},{key:"isFalse",value:function(t){var e=this;return new Sc((function(n){return n.storable.getNamespace(e.namespace).equals(t,!1)}))}},{key:"isNotNull",value:function(t){var e=this;return new Sc((function(n){var r=n.storable.getNamespace(e.namespace).get(t);return null!=r}))}},{key:"toWord",value:function(t){var e=this;return new Eu((function(n){var r=n.storable;return[String(r.getNamespace(e.namespace).get(t))]}))}},{key:"get",value:function(t){return this.toWord(t)}},{key:"conditional",value:function(t,e,n){return new Eu((function(r){return Sc.from(t).evaluate(r).value?e:n}))}},{key:"evaluate",value:function(t,e){var n=this;return new Sc((function(r){var o=r.storable;return e(o.getNamespace(n.namespace).get(t))}))}},{key:"getNamespaceName",value:function(){return this.namespace}},{key:"prefix",value:function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NamespacePrefix)+":"+String(t)}},{key:"createAction",value:function(t,e){return new Ql(this.chain(),t,Mt.create(e))}}])}(Wa);bf.NamespacePrefix="persistent";var wf=function(t){function e(t){var n;return lf(this,e),(n=df(this,e,[t,{}])).namespace=n.prefix(t,e.LocalNamespacePrefix),n}return mf(e,t),pf(e,[{key:"init",value:function(t){t.removeNamespace(this.namespace).addNamespace(new sf(this.namespace,this.defaultContent))}}])}(bf);function Sf(t){return Sf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sf(t)}function _f(t){return function(t){if(Array.isArray(t))return xf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||kf(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kf(t,e){if(t){if("string"==typeof t)return xf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xf(t,e):void 0}}function xf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Af(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Of(r.key),r)}}function Of(t){var e=function(t,e){if("object"!=Sf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Sf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sf(e)?e:e+""}function Ef(t,e,n){return e=Pf(e),function(t,e){if(e&&("object"==Sf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Tf()?Reflect.construct(e,n||[],Pf(t).constructor):e.apply(t,n))}function Tf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Tf=function(){return!!t})()}function jf(){return jf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Pf(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},jf.apply(null,arguments)}function Pf(t){return Pf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pf(t)}function Cf(t,e){return Cf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cf(t,e)}wf.LocalNamespacePrefix="local";var If=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},Lf=function(t){function n(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=Ef(this,n)).srcManager=new el,r.events=new E,r.actions=[],r._userConfig={},r.name=t,r._userConfig=e||{};var o=k(n.defaultConfig,e||{}),i=o.background,a=o.voices,s=If(o,["background","voices"]);return r.config=Object.assign(Object.assign({},s),{voices:a||null,background:i||null}),r.state=k(r.config,{backgroundImageProxy:r._createImageProxy()}),r.local=new wf(t),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cf(t,e)}(n,t),function(t,e,n){return e&&Af(t.prototype,e),n&&Af(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"toBackground",value:function(t){if(au.isImageSrc(t)||au.isImageColor(t))return t;if(t instanceof iu)return t.toImageColor();throw new Error("Invalid background type")}},{key:"activate",value:function(){return this.chain(this._init(this))}},{key:"deactivate",value:function(){return this.chain(this._exit())}},{key:"setBackground",value:function(t,e){var n=this;return this.combineActions(new Za,(function(r){if(e){var o=e.copy();o.setSrc(n.toBackground(t)),r._transitionToScene(o,void 0,n.toBackground(t))}return r.chain(new xt(r,"scene:setBackground",(new Mt).setContent([t])))}))}},{key:"applyTransform",value:function(t){return this.chain(new xt(this.chain(),"scene:applyTransform",(new Mt).setContent([t.copy()])))}},{key:"jumpTo",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.combineActions(new Za,(function(r){var o=k({unloadScene:!0},n);return r.chain(new xt(r,"scene:preUnmount",(new Mt).setContent([])))._transitionToScene(o.transition,t).chain(e._init(t)),o.unloadScene&&r.chain(e._exit()),r}))._jumpTo(t)}},{key:"sleep",value:function(t){return this.chain(new xt(this.chain(),"scene:sleep",(new Mt).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,n){return this.chain(new xt(this.chain(),e.setBackgroundMusic,(new Mt).setContent([t,n])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},A(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:this.state.backgroundImageProxy.toData()}}},{key:"fromData",value:function(t){var e=this;return R(t,{state:function(t){R(t,{backgroundMusic:function(t){t&&(e.state.backgroundMusic=(new bu).fromData(t))},background:function(t){t&&(e.state.background=t)}})},backgroundImageState:function(t){t&&(e.state.backgroundImageProxy=(new Ps).fromData(t))}}),this}},{key:"getInitTransform",value:function(){return new Ji([{props:Object.assign(Object.assign({},this.state.backgroundImageProxy.state),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){return this.actions=t,this}},{key:"constructSceneRoot",value:function(t){var e;this.sceneRoot=new xt(this.chain(),"scene:action",new Mt);var r=this.actions,o=(Array.isArray(r)?r.flat(2):r(this).flat(2)).map((function(t){return Na.isChained(t)?t.fromChained(t):t})).flat(2),i=[],a=[];this.getAllChildrenElements(t,o).forEach((function(t){Na.isChained(t)||(t instanceof Ps?i.push(t):t instanceof Gl&&a.push(t))}));var s=[],u=[],c=new Map;i.forEach((function(t){var e;t.config.isWearable?u.push(t):s.push(t);var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=kf(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(t.config.wearables);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(c.get(o)&&c.get(o)!==t)throw new Error("Wearable image cannot be used multiple times\nYou may bind the same wearable image to multiple parent images\nParent Conflict: "+(null===(e=c.get(o))||void 0===e?void 0:e.getId())+"\nCurrent Parent: "+t.getId());c.set(o,t)}}catch(t){r.e(t)}finally{r.f()}}));var l=[this._init(this)].concat(_f(s.filter((function(t){return t.config.autoInit})).map((function(t){return t._init()}))),_f(u.map((function(t){if(!c.has(t))throw new Error("Wearable image must have a parent image");return c.get(t)._initWearable(t)}))),_f(a.map((function(t){return t._init()}))),_f(o)),f=function(t,e,n,r){var o=jf(Pf(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(n,"constructNodes",this,3)([l]),p=new Mt(this.sceneRoot,void 0,f||void 0).setContent(this);return null==f||f.setParent(p),null===(e=this.sceneRoot)||void 0===e||e.setContentNode(p),this}},{key:"isSceneRootConstructed",value:function(){return!!this.sceneRoot}},{key:"inherit",value:function(t){var e=k(n.defaultConfig,t.config,this._userConfig),r=e.background,o=If(e,["background"]);return this.config=Object.assign(Object.assign({},o),{background:r||null}),this.state=k(this.config,{backgroundImageProxy:this._createImageProxy()}),this}},{key:"registerSrc",value:function(t){var r=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set;if(this.sceneRoot){var i=new Set,a=new Set,s=[this.sceneRoot],u=new Set;for(au.isImageSrc(this.config.background)&&this.srcManager.register(new Ps({src:au.toBackgroundSrc(this.config.background)}));s.length;){var c=s.shift();if(!i.has(c)){if(i.add(c),c instanceof xt){if(c.type===e.jumpTo){var l=c,f=n.getScene(t,l.contentNode.getContent()[0]);if(!f)throw c._sceneNotFoundError(c.getSceneName(l.contentNode.getContent()[0]));var p=el.getPreloadableSrc(t,c);if(p&&this.srcManager.register(p),a.has(l)||o.has(f))continue;a.add(l),u.add(f),o.add(f)}else if(c.type===e.setBackground){var h=el.getPreloadableSrc(t,c);h&&this.srcManager.register(h)}}else if(c instanceof Hs){var d=el.getPreloadableSrc(t,c);d&&this.srcManager.register(d)}else if(c instanceof ft)this.srcManager.register(c.callee);else if(c instanceof Sa){var y=c.getFutureActions(t);s.push.apply(s,_f(y))}s.push.apply(s,_f(c.getFutureActions(t)))}}u.forEach((function(e){e.registerSrc(t,o),r.srcManager.registerFuture(e.srcManager)}))}}},{key:"assignActionId",value:function(t){this.getAllChildren(t,this.sceneRoot||[]).forEach((function(t,e){t.setId("action-".concat(e))}))}},{key:"assignElementId",value:function(t){this.getAllChildrenElements(t,this.sceneRoot||[]).forEach((function(t,e){t.setId("element-".concat(e))}))}},{key:"getVoice",value:function(t){if(!t)return null;var e=this.config.voices;return e?"function"==typeof e?e(t):e[t]||null:null}},{key:"getSceneRoot",value:function(){if(!this.sceneRoot)throw new Error("Scene root is not constructed");return this.sceneRoot}},{key:"reset",value:function(){this.state=k(n.defaultState,this.config),this.state.backgroundImageProxy.reset()}},{key:"toDisplayableTransform",value:function(){return this.state.backgroundImageProxy.toDisplayableTransform()}},{key:"requestImagePreload",value:function(t){this.srcManager.register({type:"image",src:new Ps({src:t})})}},{key:"_createImageProxy",value:function(){return new Cs({opacity:1,src:Ps.DefaultImagePlaceholder})}},{key:"_jumpTo",value:function(t){return this.chain(new xt(this.chain(),"scene:jumpTo",(new Mt).setContent([t])))}},{key:"_exit",value:function(){return new xt(this.chain(),"scene:exit",(new Mt).setContent([]))}},{key:"_transitionToScene",value:function(t,n,r){var o=this.chain();if(t){var i=t.copy(),a=new xt(o,e.transitionToScene,(new Mt).setContent([i,n,r]));o.chain(a)}return o}},{key:"_init",value:function(t){return new xt(this.chain(),"scene:init",(new Mt).setContent([t]))}}],[{key:"isScene",value:function(t){return t instanceof n}},{key:"getScene",value:function(t,e){return"string"==typeof e?t.getScene(e):e}}])}(Zc);function Nf(t){return Nf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nf(t)}function Rf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mf(r.key),r)}}function Mf(t){var e=function(t,e){if("object"!=Nf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nf(e)?e:e+""}function Ff(t,e,n){return e=Vf(e),function(t,e){if(e&&("object"==Nf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Df()?Reflect.construct(e,n||[],Vf(t).constructor):e.apply(t,n))}function Df(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Df=function(){return!!t})()}function Bf(){return Bf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Vf(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Bf.apply(null,arguments)}function Vf(t){return Vf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vf(t)}function Gf(t,e){return Gf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gf(t,e)}Lf.EventTypes={"event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},Lf.defaultConfig={invertY:!0,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},Lf.defaultState={backgroundImageProxy:new Cs};var Uf=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ff(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gf(t,e)}(e,t),function(t,e,n){return e&&Rf(t.prototype,e),n&&Rf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),function(t,e,n,r){var o=Bf(Vf(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}(e,"executeAction",this,3)([t])}}])}(J);function Wf(t){return Wf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wf(t)}function zf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hf(r.key),r)}}function Hf(t){var e=function(t,e){if("object"!=Wf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wf(e)?e:e+""}function $f(t,e,n){return e=Xf(e),qf(t,Yf()?Reflect.construct(e,n||[],Xf(t).constructor):e.apply(t,n))}function qf(t,e){if(e&&("object"==Wf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Yf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Yf=function(){return!!t})()}function Xf(t){return Xf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xf(t)}function Kf(t,e){return Kf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kf(t,e)}Uf.ActionTypes={action:"script:action"};var Zf=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=$f(this,e)).handler=t,qf(n,n.chain())}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Kf(t,e)}(e,t),function(t,e,n){return e&&zf(t.prototype,e),n&&zf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"execute",value:function(t){var n=t.gameState;this.handler(e.getCtx({gameState:n}))}},{key:"fromChained",value:function(t){return[new Uf(this.chain(),Uf.ActionTypes.action,(new Mt).setContent(t))]}}],[{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}])}(Wa);function Qf(t){return Qf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qf(t)}function Jf(t){return function(t){if(Array.isArray(t))return tp(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return tp(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tp(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tp(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ep(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,np(r.key),r)}}function np(t){var e=function(t,e){if("object"!=Qf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qf(e)?e:e+""}function rp(t,e,n){return e=ip(e),function(t,e){if(e&&("object"==Qf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,op()?Reflect.construct(e,n||[],ip(t).constructor):e.apply(t,n))}function op(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(op=function(){return!!t})()}function ip(t){return ip=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ip(t)}function ap(t,e){return ap=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ap(t,e)}var sp=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=rp(this,e)).entryScene=null,n.scenes=new Map,n.persistent=[],n.name=t,n.config=k(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ap(t,e)}(e,t),function(t,e,n){return e&&ep(t.prototype,e),n&&ep(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"entry",value:function(t){return this.entryScene=t,this}},{key:"registerScene",value:function(t,e){var n="string"==typeof t?t:t.name,r="string"==typeof t?e:t;if(this.scenes.has(n)&&this.scenes.get(n)!==r)throw new Error("Scene with name ".concat(n," already exists when registering scene"));return this.scenes.set(n,r),this}},{key:"registerPersistent",value:function(t){return this.persistent.push(t),this}},{key:"getScene",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;if(Lf.isScene(t))return t;var r=this.scenes.get(t)||null;if(!r&&e){var o=n||lu;throw Reflect.construct(o,["Scene with name ".concat(t," not found")])}return r}},{key:"constructStory",value:function(){var t=this.entryScene;if(!t)throw new Error("Story must have an entry scene");return this.constructSceneRoots(t),t.registerSrc(this),t.assignActionId(this),t.assignElementId(this),this.runStaticCheck(t),this}},{key:"getAllElementStates",value:function(){var t;return this.getAllChildrenElements(this,(null===(t=this.entryScene)||void 0===t?void 0:t.getSceneRoot())||[]).map((function(t){return{id:t.getId(),data:t.toData()}})).filter((function(t){return!!t.data}))}},{key:"constructSceneRoots",value:function(t){var n=new Set,r=[],o=0;for(t.constructSceneRoot(this),r.push(t.getSceneRoot());r.length;){if(++o>e.MAX_DEPTH)throw new Error("Max depth reached while constructing scene roots (max depth: ".concat(e.MAX_DEPTH,")"));var i=r.shift();if(Lf.isScene(i.callee)){if(n.has(i.callee))continue;i.callee.isSceneRootConstructed()||i.callee.constructSceneRoot(this),n.add(i.callee)}var a=i.getFutureActions(this);r.push.apply(r,Jf(a))}return this}},{key:"initPersistent",value:function(t){return this.persistent.forEach((function(e){e.init(t)})),this}},{key:"runStaticCheck",value:function(t){return new cu(t).run(this)}}])}(Zc);sp.defaultConfig={},sp.MAX_DEPTH=1e4;var up=function t(e){if(!(this instanceof t?this.constructor:void 0))throw new Error("Image is a constructor and should be called with new keyword");return new Ps(e,e.tag)};function cp(t){var e,n,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=cp(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}const lp=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=cp(t))&&(r&&(r+=" "),r+=e);return r};var fp=o(12),pp=o.n(fp);function hp(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return dp(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dp(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dp(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var yp=pp().createContext(null);function vp(t){var e=t.children,n=t.game,r=new pd({}),o=hp((0,fp.useState)(n||r),2),i=o[0],a=o[1];return pp().createElement(yp.Provider,{value:{game:i,setGame:a}},e)}function mp(){var t=(0,fp.useContext)(yp);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function gp(t){if("undefined"==typeof Proxy)return t;const e=new Map;return new Proxy(((...e)=>t(...e)),{get:(n,r)=>"create"===r?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}var bp=o(387);const wp=(0,fp.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Sp=(0,fp.createContext)({}),_p=(0,fp.createContext)(null),kp=oi?fp.useLayoutEffect:fp.useEffect,xp=(0,fp.createContext)({strict:!1}),{schedule:Ap,cancel:Op}=sn(queueMicrotask,!1);function Ep(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const Tp=(0,fp.createContext)({});function jp(t,e,n,r,o){var i,a;const{visualElement:s}=(0,fp.useContext)(Sp),u=(0,fp.useContext)(xp),c=(0,fp.useContext)(_p),l=(0,fp.useContext)(wp).reducedMotion,f=(0,fp.useRef)();r=r||u.renderer,!f.current&&r&&(f.current=r(t,{visualState:e,parent:s,props:n,presenceContext:c,blockInitialAnimation:!!c&&!1===c.initial,reducedMotionConfig:l}));const p=f.current,h=(0,fp.useContext)(Tp);!p||p.projection||!o||"html"!==p.type&&"svg"!==p.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Pp(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&Ep(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(f.current,n,o,h),(0,fp.useInsertionEffect)((()=>{p&&p.update(n,c)}));const d=n[Xo],y=(0,fp.useRef)(Boolean(d)&&!(null===(i=window.MotionHandoffIsComplete)||void 0===i?void 0:i.call(window,d))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,d)));return kp((()=>{p&&(window.MotionIsMounted=!0,p.updateFeatures(),Ap.render(p.render),y.current&&p.animationState&&p.animationState.animateChanges())})),(0,fp.useEffect)((()=>{p&&(!y.current&&p.animationState&&p.animationState.animateChanges(),y.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,d)})),y.current=!1))})),p}function Pp(t){if(t)return!1!==t.options.allowProjection?t.projection:Pp(t.parent)}function Cp(t,e,n){return(0,fp.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Ep(n)&&(n.current=r))}),[e])}function Ip(t){const{initial:e,animate:n}=function(t,e){if(fi(t)){const{initial:e,animate:n}=t;return{initial:!1===e||ui(e)?e:void 0,animate:ui(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,fp.useContext)(Sp));return(0,fp.useMemo)((()=>({initial:e,animate:n})),[Lp(e),Lp(n)])}function Lp(t){return Array.isArray(t)?t.join(" "):t}function Np(t){for(const e in t)di[e]={...di[e],...t[e]}}const Rp=(0,fp.createContext)({}),Mp=Symbol.for("motionComponentSymbol");function Fp({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&Np(t);const i=(0,fp.forwardRef)((function(t,i){let a;const s={...(0,fp.useContext)(wp),...t,layoutId:Dp(t)},{isStatic:u}=s,c=Ip(t),l=r(t,u);if(!u&&oi){!function(){(0,fp.useContext)(xp).strict;0}();const t=function(t){const{drag:e,layout:n}=di;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:(null==e?void 0:e.isEnabled(t))||(null==n?void 0:n.isEnabled(t))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(s);a=t.MeasureLayout,c.visualElement=jp(o,l,s,e,t.ProjectionNode)}return(0,bp.jsxs)(Sp.Provider,{value:c,children:[a&&c.visualElement?(0,bp.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Cp(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[Mp]=o,i}function Dp({layoutId:t}){const e=(0,fp.useContext)(Rp).id;return e&&void 0!==t?e+"-"+t:t}const Bp=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Vp(t){return"string"==typeof t&&!t.includes("-")&&!!(Bp.indexOf(t)>-1||/[A-Z]/u.test(t))}function Gp(t){const e=Te(t)?t.get():t;return Do(e)?e.toValue():e}function Up(t){return Ye.has(t)?"transform":_o.has(t)?Yo(t):void 0}const Wp=t=>(e,n)=>{const r=(0,fp.useContext)(Sp),o=(0,fp.useContext)(_p),i=()=>function({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:r},o,i,a,s){const u={latestValues:Hp(o,i,a,!s&&t,e),renderState:n()};return r&&(u.mount=t=>r(o,t,u)),u}(t,e,r,o,n);return n?i():function(t){const e=(0,fp.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function zp(t,e,n){const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const o=Ho(t,r[e]);if(o){const{transitionEnd:t,transition:e,...r}=o;n(r,t)}}}function Hp(t,e,n,r,o){var i;const a={},s=new Set,u=r&&void 0===(null===(i=t.style)||void 0===i?void 0:i.willChange),c=o(t,{});for(const t in c)a[t]=Gp(c[t]);let{initial:l,animate:f}=t;const p=fi(t),h=pi(t);e&&h&&!p&&!1!==t.inherit&&(void 0===l&&(l=e.initial),void 0===f&&(f=e.animate));let d=!!n&&!1===n.initial;d=d||!1===l;const y=d?f:l;return y&&"boolean"!=typeof y&&!si(y)&&zp(t,y,((t,e)=>{for(const e in t){let n=t[e];if(Array.isArray(n)){n=n[d?n.length-1:0]}null!==n&&(a[e]=n)}for(const t in e)a[t]=e[t]})),u&&(f&&!1!==l&&!si(f)&&zp(t,f,(t=>{for(const e in t){const t=Up(e);t&&s.add(t)}})),s.size&&(a.willChange=Array.from(s).join(","))),a}const $p=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),qp=()=>({...$p(),attrs:{}}),Yp={useVisualState:Wp({scrapeMotionValuesFromProps:ri,createRenderState:qp,onMount:(t,e,{renderState:n,latestValues:r})=>{un.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),un.render((()=>{Ei(n,r,Ci(e.tagName),t.transformTemplate),Pi(e,n)}))}})},Xp={useVisualState:Wp({applyWillChange:!0,scrapeMotionValuesFromProps:ni,createRenderState:$p})};function Kp(t,e,n){for(const r in e)Te(e[r])||ei(r,n)||(t[r]=e[r])}function Zp(t,e){const n={};return Kp(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,fp.useMemo)((()=>{const n=$p();return ki(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function Qp(t,e){const n={},r=Zp(t,e);return t.drag&&!1!==t.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const Jp=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function th(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Jp.has(t)}let eh=t=>!th(t);try{(nh=require("@emotion/is-prop-valid").default)&&(eh=t=>t.startsWith("on")?!th(t):nh(t))}catch(ba){}var nh;function rh(t,e,n,r){const o=(0,fp.useMemo)((()=>{const n=qp();return Ei(n,e,Ci(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};Kp(e,t.style,t),o.style={...e,...o.style}}return o}function oh(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(Vp(e)?rh:Qp)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||(eh(o)||!0===n&&th(o)||!e&&!th(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==fp.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,fp.useMemo)((()=>Te(c)?c.get():c),[c]);return(0,fp.createElement)(e,{...u,children:l})}}function ih(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Fp({...Vp(n)?Yp:Xp,preloadedFeatures:t,useRender:oh(r),createVisualElement:e,Component:n})}}const ah=gp(ih());function sh(){return sh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},sh.apply(null,arguments)}function uh(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ch(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ch(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ch(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var lh=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};function fh(t){var e=t.children,n=t.border,r=void 0===n?"solid":n,o=t.color,i=void 0===o?"red":o,a=t.tag,s=t.borderWidth,u=void 0===s?1:s,c=t.as,l=void 0===c?"div":c,f=t.Ref,p=lh(t,["children","border","color","tag","borderWidth","as","Ref"]),h=mp().game,d=uh((0,fp.useState)(!1),2),y=d[0],v=d[1];if(!h.config.app.inspector)return pp().createElement(l,sh({},p,{ref:f}),e);var m=Object.assign(Object.assign({},p),{onMouseEnter:function(){return v(!0)},onMouseLeave:function(){return v(!1)},style:Object.assign(Object.assign({},p.style||{}),{outline:"".concat(u,"px ").concat(r," ").concat(i),zIndex:y?1e3:"auto"})});return pp().createElement(l,sh({},m,{ref:f}),a&&y&&pp().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black text-sm"},a),e)}function ph(t){var e=t.border,n=void 0===e?"solid":e,r=t.color,o=void 0===r?"red":r,i=t.tag,a=t.borderWidth,s=void 0===a?1:a,u=t.as,c=void 0===u?"img":u,l=lh(t,["border","color","tag","borderWidth","as"]),f=mp().game,p=uh((0,fp.useState)(!1),2),h=p[0],d=p[1];if(!f.config.app.inspector)return pp().createElement(c,l);var y=Object.assign(Object.assign({},l),{onMouseEnter:function(){return d(!0)},onMouseLeave:function(){return d(!1)},style:Object.assign(Object.assign({},l.style||{}),{outline:"".concat(n," ").concat(s,"px ").concat(o),zIndex:h?1e3:"auto"})});return pp().createElement("div",null,pp().createElement(c,y),i&&h&&pp().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black"},i))}const hh={Div:function(t){return pp().createElement(fh,sh({},t,{as:"div"}))},Span:function(t){return pp().createElement(fh,sh({},t,{as:"span"}))},Button:function(t){return pp().createElement(fh,sh({},t,{as:"button"}))},Img:function(t){return pp().createElement(ph,sh({},t,{as:"img"}))},mDiv:function(t){return pp().createElement(fh,sh({},t,{as:ah.div,Ref:t.Ref}))}};function dh(t){return dh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dh(t)}function yh(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */yh=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==dh(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(dh(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function vh(t){return function(t){if(Array.isArray(t))return bh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||gh(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mh(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||gh(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gh(t,e){if(t){if("string"==typeof t)return bh(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bh(t,e):void 0}}function bh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function wh(t){var e=yh().mark(M),n=t.sentence,r=t.gameState,o=t.useTypeEffect,i=void 0===o||o,a=t.onCompleted,s=t.finished,u=t.count,c=t.className,l=t.words,f=mh((0,fp.useState)(!1),2),p=f[0],h=f[1],d=r.game,y=(0,fp.useMemo)((function(){return l||n.evaluate(Zf.getCtx({gameState:r}))}),[]),v=mh((0,fp.useState)([]),2),m=v[0],g=v[1],b=(0,fp.useRef)(M(y)),w=(0,fp.useRef)(null),S=(0,fp.useRef)(null),_=mh((0,fp.useState)(0),2),k=_[0],x=_[1],A=mh((0,fp.useReducer)((function(t){return t+1}),0),2)[1],E=mh((0,fp.useState)(new Set),2),T=E[0],j=E[1],P=mh((0,fp.useState)(!1),2),C=P[0],I=P[1];function L(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];S.current&&(clearTimeout(S.current),S.current=null);for(var e=!1;!e;){var n=b.current.next(),o=n.done,i=n.value;if(o)h(!0),a&&(r.logger.info("Say","Completed",o,i),a()),e=!0;else if(ku.isPause(i)){if(t)continue;R(ku.from(i)),e=!0}else N(i)}}function N(t){g((function(e){if("\n"!==t&&T.has(t))return e;j((function(e){return new Set(e).add(t)}));var n=e[e.length-1];return n&&"\n"!==n&&"\n"!==t&&n.tag===t.tag?[].concat(vh(e.slice(0,-1)),[{text:n.text+t.text,config:t.config,tag:t.tag,tag2:t.tag2}]):[].concat(vh(e),[t])}))}function R(t){r.logger.info("Say","Paused",t),t.config.duration?w.current=setTimeout((function(){w.current=null,x((function(t){return t+1}))}),t.config.duration):I(!0)}function M(t){var n,r,o,i,a;return yh().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=vh(t),r=0;case 2:if(!(r<n.length)){e.next=24;break}if(o=n[r],!ku.isPause(o.text)){e.next=8;break}return e.next=7,ku.from(o.text);case 7:return e.abrupt("continue",21);case 8:i=0;case 9:if(!(i<o.text.length)){e.next=21;break}if("\n"!==(a=o.text[i])){e.next=16;break}return e.next=14,"\n";case 14:e.next=18;break;case 16:return e.next=18,{text:a,config:o.config,tag:r,tag2:i};case 18:i++,e.next=9;break;case 21:r++,e.next=2;break;case 24:return e.abrupt("return");case 25:case"end":return e.stop()}}),e)}return(0,fp.useEffect)((function(){if(i||L(!0),s&&!p)return w.current&&clearTimeout(w.current),w.current=null,L(!0),void(a&&(r.logger.info("Say","Completed",w.current,s,p),a()));if(p||s||C||w.current)r.logger.debug("Sentence.tsx","locked",p,s,C);else{var t=b.current.next(),e=t.done,n=t.value;if(e)return h(!0),void(a&&(r.logger.info("Say","Completed",e,n),a()));ku.isPause(n)?R(ku.from(n)):(N(n),A(),S.current=setTimeout((function(){x((function(t){return t+1}))}),d.config.elements.say.textInterval))}}),[k,s,C]),(0,fp.useEffect)((function(){if(u&&!w.current){if(C)return I(!1),void x((function(t){return t+1}));L(),x((function(t){return t+1}))}}),[u]),pp().createElement("div",{className:lp("whitespace-pre-wrap",d.config.elementStyles.say.textContainerClassName,{"font-bold":n.config.bold,italic:n.config.italic},c),style:{fontFamily:n.config.fontFamily||d.config.elementStyles.say.fontFamily,fontSize:n.config.fontSize||d.config.elementStyles.say.fontSize}},m.map((function(t,e){return"\n"===t?pp().createElement("br",{key:e}):pp().createElement(hh.Span,{tag:"say.word.".concat(e),key:e,style:Object.assign({color:O(t.config.color||n.config.color||Eu.defaultColor),fontFamily:t.config.fontFamily,fontSize:t.config.fontSize},d.config.app.debug?{outline:"1px dashed red"}:{}),className:lp(d.config.elementStyles.say.textSpanClassName,"whitespace-pre inline-block",{"font-bold":t.config.bold,italic:t.config.italic},t.config.className)},t.config.ruby?pp().createElement("ruby",{className:"align-bottom inline-block"},pp().createElement("rt",{className:"block text-center"},t.config.ruby),t.text):t.text)})))}function Sh(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return _h(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_h(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _h(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function kh(t){return kh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kh(t)}function xh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ah(r.key),r)}}function Ah(t){var e=function(t,e){if("object"!=kh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=kh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==kh(e)?e:e+""}var Oh=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={width:0,height:0,minWidth:800,minHeight:450,paused:!1,scale:0},this.events=new E,this.lockers=[],this.updater=null}return function(t,e,n){return e&&xh(t.prototype,e),n&&xh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"update",value:function(e,n,r){this.state.width=e,this.state.height=n,this.state.scale=r,this.events.emit(t.EventTypes["event:aspectRatio.update"],e,n)}},{key:"updateMin",value:function(t,e){this.state.minWidth=t,this.state.minHeight=e}},{key:"lock",value:function(){var t=Symbol();return this.lockers.push(t),t}},{key:"unlock",value:function(t){if(t&&!this.lockers.includes(t))throw new Error("Locker not found");return this.lockers=this.lockers.filter((function(e){return e!==t})),this.triggerUpdate(),null}},{key:"isLocked",value:function(){return!!this.lockers.length}},{key:"getStyle",value:function(){return{width:"".concat(this.state.width,"px"),height:"".concat(this.state.height,"px")}}},{key:"setUpdate",value:function(t){this.updater=t}},{key:"pause",value:function(){this.state.paused=!0,this.events.emit(t.EventTypes["event:aspectRatio.pause"])}},{key:"resume",value:function(){this.state.paused=!1,this.events.emit(t.EventTypes["event:aspectRatio.resume"])}},{key:"onUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.update"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.update"],e)}}},{key:"requestUpdate",value:function(){this.events.emit(t.EventTypes["event:aspectRatio.requestUpdate"])}},{key:"onRequestedUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.requestUpdate"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.requestUpdate"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])}();Oh.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume","event:aspectRatio.requestUpdate":"event:aspectRatio.requestUpdate"};var Eh=(0,fp.createContext)(null);function Th(t){var e=t.children,n=Sh((0,fp.useState)((function(){return new Oh})),1)[0];return pp().createElement(Eh.Provider,{value:{ratio:n}},e)}function jh(){var t=(0,fp.useContext)(Eh);if(!Eh||!t)throw new Error("useRatio must be used within a RatioProvider");var e=Sh((0,fp.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,fp.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function Ph(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ch(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ch(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ch(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ih(t){var e,n=t.action,r=t.onClick,o=t.useTypeEffect,i=void 0===o||o,a=t.className,s=t.state,u=n.sentence,c=n.words,l=Ph((0,fp.useState)(!1),2),f=l[0],p=l[1],h=s.game,d=Ph((0,fp.useState)(0),2),y=d[0],v=d[1],m=jh().ratio,g=Ph((0,fp.useState)(new M),1)[0];function b(){h.preference.getPreference(pd.Preferences.autoForward)&&g.cancelTask().scheduleTask((function(){r&&r()}),h.config.elements.say.autoForwardDelay)}return(0,fp.useEffect)((function(){if(window){var t=function(t){h.config.elements.say.nextKey.includes(t.key)&&(f?r&&r():v((function(t){return t+1})))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[f]),(0,fp.useEffect)((function(){var t=s.events.onEvents([{type:Zh.EventTypes["event:state.player.skip"],listener:s.events.on(Zh.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),f?r&&r():p(!0)}))}]);return function(){t.cancel()}}),[f]),(0,fp.useEffect)((function(){var t=h.preference.onPreferenceChange(pd.Preferences.autoForward,(function(t){t&&f?b():g.cancelTask()}));return function(){t.cancel()}}),[f]),(0,fp.useEffect)((function(){return function(){g.cancelTask()}}),[]),pp().createElement("div",null,u.state.display&&pp().createElement(hh.Div,{tag:"say.aspectScaleContainer",color:"blue",border:"dashed",className:lp("absolute bottom-0 w-[calc(100%-40px)]",a),onClick:function(){f?(r&&r(),b()):v((function(t){return t+1}))},style:Object.assign({},N(h.config.elements.say.useAspectScale,{width:h.config.elements.text.width,height:h.config.elements.text.height}))},pp().createElement(hh.Div,{tag:"say.containerClassName",className:lp(h.config.elementStyles.say.containerClassName),style:Object.assign({},N(h.config.elements.say.useAspectScale,{transform:"scale(".concat(m.state.scale,")"),transformOrigin:"bottom left",width:"100%",height:"100%"}))},pp().createElement("div",{className:lp("bg-white flex flex-col items-start justify-between",h.config.elementStyles.say.contentContainerClassName,"w-full h-full")},pp().createElement(hh.Div,{tag:"say.nameTextClassName",className:lp("rounded-br-md text-black",h.config.elementStyles.say.nameTextClassName)},null===(e=u.config.character)||void 0===e?void 0:e.state.name),pp().createElement(wh,{sentence:u,gameState:s,finished:f,useTypeEffect:i,onCompleted:function(){p(!0),b()},count:y,words:c}),pp().createElement("div",null)))))}function Lh(){return Lh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Lh.apply(null,arguments)}function Nh(t){var e=t.children,n=t.className,r=t.props,o=t.style,i=t.$ref,a=jh().ratio,s=a.getStyle();return pp().createElement("div",{className:lp("inset-0",n),style:{width:"100%",height:"100%",minWidth:"".concat(a.state.minWidth,"px"),minHeight:"".concat(a.state.minHeight,"px")}},pp().createElement("div",Lh({style:Object.assign(Object.assign(Object.assign(Object.assign({},s),{position:"relative",overflow:"hidden"}),(null==r?void 0:r.style)||{}),o||{})},r||{},{ref:i}),e))}var Rh={say:Ih,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=t.words,a=mp().game,s=jh().ratio,u=a.config.elements.say.use,c=(0,fp.useMemo)((function(){return n.map((function(t){return Object.assign(Object.assign({},t),{words:t.prompt.evaluate(Zf.getCtx({gameState:o}))})}))}),[]);return pp().createElement(pp().Fragment,null,pp().createElement(Nh,{className:"absolute"},e&&pp().createElement(u,{state:o,action:{sentence:e,character:null,words:i},useTypeEffect:!1,className:"z-10"})),pp().createElement(hh.Div,{color:"green",border:"dashed",className:lp("absolute"),style:{width:"".concat(a.config.player.width,"px"),height:"".concat(a.config.player.height,"px")}},pp().createElement(hh.Div,{tag:"menu.aspectScaleContainer",style:{transform:"scale(".concat(s.state.scale,")"),transformOrigin:"left top"},className:lp("w-full h-full")},pp().createElement(hh.Div,{tag:"menu.containerClassName",className:lp("absolute flex flex-col items-center justify-center min-w-full w-full h-full",a.config.elementStyles.menu.containerClassName)},pp().createElement("div",{className:"p-4 rounded-lg w-full z-20"},pp().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},c.map((function(t,e){return pp().createElement(hh.Button,{tag:"menu.choiceButtonClassName."+e,key:e,className:lp("bg-white text-black p-2 mt-2 w-1/2",a.config.elementStyles.menu.choiceButtonClassName),onClick:function(){return function(t){r(t)}(Object.assign(Object.assign({},t),{evaluated:Eu.getText(t.words)}))}},pp().createElement(wh,{sentence:t.prompt,gameState:o,useTypeEffect:!1,className:lp(a.config.elementStyles.menu.choiceButtonTextClassName),words:t.words}))}))))))))}},Mh=o(196);function Fh(t){return Fh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fh(t)}function Dh(t){return function(t){if(Array.isArray(t))return Bh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Bh(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bh(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Vh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Gh(r.key),r)}}function Gh(t){var e=function(t,e){if("object"!=Fh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Fh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Fh(e)?e:e+""}var Uh=function(){return function(t,e,n){return e&&Vh(t.prototype,e),n&&Vh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.game=e,this.prefix=n}),[{key:"log",value:function(t){if(this.game.config.app.logger.log){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,Dh(this.colorLog.apply(this,["gray",t].concat(r))))}}},{key:"info",value:function(t){if(this.game.config.app.logger.info){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).info.apply(e,Dh(this._log.apply(this,[t].concat(r))))}}},{key:"warn",value:function(t){if(this.game.config.app.logger.warn){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).warn.apply(e,Dh(this._log.apply(this,[t].concat(r))))}}},{key:"error",value:function(t){if(this.game.config.app.logger.error){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).error.apply(e,Dh(this._log.apply(this,[t].concat(r))))}}},{key:"debug",value:function(t){if(this.game.config.app.logger.debug){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).debug.apply(e,Dh(this.colorLog.apply(this,["gray",t].concat(r))))}}},{key:"trace",value:function(t){if(this.game.config.app.logger.trace){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console.trace(this._log.apply(this,[t].concat(n)))}}},{key:"weakWarn",value:function(t){if(this.game.config.app.logger.warn){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,Dh(this.colorLog.apply(this,["yellow",t].concat(r))))}}},{key:"group",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this._log(t).join(" ");return this.game.config.app.logger.info&&(n?console.groupCollapsed(r):console.group(r)),{end:function(){e.game.config.app.logger.info&&console.groupEnd()}}}},{key:"_log",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===n.length?[this.prefix||"",t]:["".concat(this.prefix||""," [").concat(t,"]")].concat(n)}},{key:"colorLog",value:function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(0===r.length)return["%c".concat(this.prefix||""," ").concat(e),"color: ".concat(t)];var i=[],a=[],s=[];return this.prefix?(i.push("%c".concat(this.prefix," [").concat(e,"]")),a.push("color: ".concat(t))):(i.push("%c[".concat(e,"]")),a.push("color: ".concat(t))),r.forEach((function(e){"string"==typeof e?(i.push("%c".concat(e)),a.push("color: ".concat(t))):(i.push("%O"),s.push(e),a.push(""))})),[i.join(" ")].concat(a,s)}}])}();function Wh(t){return Wh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wh(t)}function zh(t){return function(t){if(Array.isArray(t))return qh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$h(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hh(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Hh=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==Wh(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Wh(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function $h(t,e){if(t){if("string"==typeof t)return qh(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qh(t,e):void 0}}function qh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Yh(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Xh(r.key),r)}}function Xh(t){var e=function(t,e){if("object"!=Wh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wh(e)?e:e+""}var Kh=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Zh=function(){return function(t,e,n){return e&&Yh(t.prototype,e),n&&Yh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={sounds:[],srcManagers:[],elements:[]},this.currentHandling=null,this.stage=n,this.game=e,this.events=new E,this.logger=new Uh(e,"NarraLeaf-React")}),[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByDisplayable",value:function(t){return this.state.elements.find((function(e){return e.ele.displayable.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"isSceneActive",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=$h(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(this.state.elements);try{for(n.s();!(e=n.n()).done;){if(e.value.scene===t)return!0}}catch(t){n.e(t)}finally{n.f()}return!1}},{key:"moveUpElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,Math.min(n.ele.displayable.indexOf(e)+1,n.ele.displayable.length-1)),this):this}},{key:"moveDownElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,Math.max(n.ele.displayable.indexOf(e)-1,0)),this):this}},{key:"moveTopElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,n.ele.displayable.length-1),this):this}},{key:"moveBottomElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,0),this):this}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this.getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=e.evaluate(Zf.getCtx({gameState:this}));this.game.getLiveGame().events.emit(rd.EventTypes["event:character.prompt"],{character:e.config.character,sentence:e,text:Eu.getText(a)});var s=this.createWaitableAction({character:e.config.character,sentence:e,id:t,words:a},(function(){i.splice(i.indexOf(s),1),n&&n()}));i.push(s)}},{key:"createMenu",value:function(t,e,n){var r,o=this;if(!t.choices.length)throw new Error("Menu must have at least one choice");var i=null===(r=this.findElementByScene(this.getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!i)throw new Error("Scene not found");var a=t.prompt.evaluate(Zf.getCtx({gameState:this})),s=this.createWaitableAction(Object.assign(Object.assign({},t),{words:a}),(function(t){i.splice(i.indexOf(s),1),e&&e(t),o.game.getLiveGame().events.emit(rd.EventTypes["event:character.prompt"],{character:t.prompt.config.character,sentence:t.prompt,text:t.evaluated})}));i.push(s)}},{key:"createImage",value:function(t,e){var n=this.getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.displayable.push(t),this):this}},{key:"createWearable",value:function(t,e){return t.events.any(Ps.EventTypes["event:wearable.create"],e)}},{key:"disposeImage",value:function(t,e){var n,r=this.getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.displayable;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Image not found");return o.splice(i,1),this}},{key:"createDisplayable",value:function(t,e){var n=this.getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.displayable.push(t),this):this}},{key:"disposeDisplayable",value:function(t,e){var n,r=this.getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.displayable;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Displayables not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.sounds.forEach((function(t){var e;return null===(e=t.getPlaying())||void 0===e?void 0:e.stop()})),this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),t.removeScene(n),n.events.clear()})),this.state.elements=[],this.state.srcManagers=[]}},{key:"initSound",value:function(t,e){return t.getPlaying()||t.setPlaying(new(this.getHowl())(t.getHowlOptions(e))),t}},{key:"playSound",value:function(t,e,n){this.initSound(t,n);var r=t.getPlaying().play(),o=[t.getPlaying().once("end",i.bind(this)),t.getPlaying().once("stop",i.bind(this))];function i(){e&&e(),o.forEach((function(t){return t.off()})),this.state.sounds=this.state.sounds.filter((function(e){return e!==t})),this.stage.next()}return this.state.sounds.push(t),t.state.token=r,r}},{key:"stopSound",value:function(t){var e,n;return(null===(e=t.state.playing)||void 0===e?void 0:e.playing(t.getToken()))&&(null===(n=t.state.playing)||void 0===n||n.stop(t.getToken())),t.setPlaying(null).setToken(null),t}},{key:"transitionSound",value:function(t,e,n){return Kh(this,void 0,void 0,Hh().mark((function r(){var o;return Hh().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=5;break}if(!n){r.next=4;break}return r.next=4,this.fadeSound(t,0,n);case 4:this.stopSound(t);case 5:if(!e){r.next=12;break}if(o=e.config.volume,this.playSound(e,void 0,{volume:0}),!n){r.next=11;break}return r.next=11,this.fadeSound(e,o,n);case 11:e.getPlaying().volume(o,e.getToken());case 12:case"end":return r.stop()}}),r,this)})))}},{key:"fadeSound",value:function(t,e,n){var r,o;return Kh(this,void 0,void 0,Hh().mark((function i(){var a;return Hh().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return a=null===(r=t.getPlaying())||void 0===r?void 0:r.volume(t.getToken()),null===(o=t.getPlaying())||void 0===o||o.fade(a,e,n,t.getToken()),i.next=4,j(n);case 4:return i.abrupt("return",void 0);case 5:case"end":return i.stop()}}),i)})))}},{key:"getHowl",value:function(){return Mh.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(zh(n)))}},{key:"animateText",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(zh(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"getSceneByName",value:function(t){var e;return(null===(e=this.game.getLiveGame().story)||void 0===e?void 0:e.getScene(t))||null}},{key:"getStory",value:function(){if(!this.game.getLiveGame().story)throw new fu("Story not loaded");return this.game.getLiveGame().story}},{key:"dispose",value:function(){this.forceReset()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{displayable:t.ele.displayable.map((function(t){return t.getId()}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;if(this.state.elements=[],!this.game.getLiveGame().story)throw new Error("No story loaded");t.scenes.forEach((function(t){var r=t.sceneId,o=t.elements;n.logger.debug("Loading scene: "+r);var i=e.get(r);if(!i)throw new fu("Scene not found, id: "+r+"\nNarraLeaf cannot find the element with the id from the saved game");var a={scene:i,ele:{menus:[],texts:[],displayable:o.displayable.map((function(t){if(!e.has(t))throw new fu("Displayable not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game\nThis may be caused by the damage of the saved game file or the change of the story file");return e.get(t)}))}};n.state.elements.push(a),n.registerSrcManager(i.srcManager),xt.registerEventListeners(i,n)}))}},{key:"getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new fu('Scene not found, please call "scene.activate()" first.');return e}},{key:"getElementMap",value:function(){return{texts:[],menus:[],displayable:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}])}();function Qh(t){return Qh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qh(t)}function Jh(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return td(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?td(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function td(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ed(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nd(r.key),r)}}function nd(t){var e=function(t,e){if("object"!=Qh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Qh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Qh(e)?e:e+""}Zh.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip","event:state.preload.unmount":"event:state.preload.unmount","event:state.preload.loaded":"event:state.preload.loaded","event:state.player.flush":"event:state.player.flush"};var rd=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gameLock=new L,this.events=new E,this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this.gameState=void 0,this._lockedCount=0,this.currentAction=null,this._nextLock=new I,this.game=e,this.storable=new uf,this.initNamespaces()}return function(t,e,n){return e&&ed(t.prototype,e),n&&ed(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"initNamespaces",value:function(){return this.storable.clear().addNamespace(new sf(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this.story&&this.story.initPersistent(this.storable),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t.constructStory(),this}},{key:"serialize",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState,o=this.story;if(!o)throw new Error("No story loaded");var i=this.storable.toData(),a=r.toData(),s=(null===(t=this.getCurrentAction())||void 0===t?void 0:t.getId())||null,u=o.getAllElementStates();return{name:(null===(e=this.currentSavedGame)||void 0===e?void 0:e.name)||"",meta:{created:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.meta.created)||Date.now(),updated:Date.now()},game:{store:i,stage:a,currentAction:s,elementStates:u}}}},{key:"deserialize",value:function(t){var e;if(!this.gameState)throw new Error("No game state");var n=this.gameState,r=this.story;if(!r)throw new Error("No story loaded");this.reset({gameState:n}),n.stage.forceUpdate();var o=new Map,i=new Map,a=t.game,s=a.store,u=a.stage,c=a.elementStates,l=a.currentAction;if(r.forEachChild(r,(null===(e=r.entryScene)||void 0===e?void 0:e.getSceneRoot())||[],(function(t){o.set(t.getId(),t),i.set(t.callee.getId(),t.callee)})),this.storable.clear().load(s),c.forEach((function(t){var e=t.id,r=t.data;n.logger.debug("restore element",e);var o=i.get(e);if(!o)throw new Error("Element not found, id: "+e+"\nNarraLeaf cannot find the element with the id from the saved game");o.reset(),o.fromData(r)})),this.currentSavedGame=t,n.loadData(u,i),l){var f=o.get(l);if(!f)throw new Error("Action not found, id: "+l+"\nNarraLeaf cannot find the action with the id from the saved game");this.currentAction=f}n.stage.forceUpdate(),n.stage.next()}},{key:"onCharacterPrompt",value:function(e){var n=this,r=t.EventTypes["event:character.prompt"],o=this.events.on(r,e);return{cancel:function(){n.events.off(r,o)}}}},{key:"onMenuChoose",value:function(e){var n=this,r=t.EventTypes["event:menu.choose"],o=this.events.on(r,e);return{cancel:function(){n.events.off(r,o)}}}},{key:"newGame",value:function(){var t,e,n,r,o;if(!this.gameState)throw new Error("No game state");var i=this.gameState,a=i.logger.group("LiveGame");this.reset({gameState:i}),this.initNamespaces();var s=this.getNewSavedGame();s.name="NewGame-"+Date.now(),this.currentSavedGame=s,this.currentAction=(null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.getSceneRoot())||null;var u=null===(n=this.story)||void 0===n?void 0:n.getAllElementMap(this.story,(null===(o=null===(r=this.story)||void 0===r?void 0:r.entryScene)||void 0===o?void 0:o.getSceneRoot())||[]);return u?u.forEach((function(t){i.logger.debug("reset element",t),t.reset()})):i.logger.warn("No elements found"),i.stage.forceUpdate(),i.stage.next(),a.end(),this}},{key:"reset",value:function(t){var e=t.gameState;this.lockedAwaiting&&this.lockedAwaiting.abort(),this.currentAction=null,this.lockedAwaiting=null,this.currentSavedGame=null,e.forceReset()}},{key:"getCurrentAction",value:function(){return this.currentAction}},{key:"setCurrentAction",value:function(t){return this.currentAction=t,this}},{key:"next",value:function(t){var e,n;if(this.gameLock.isLocked())return this.gameLock;if(this._nextLock.isLocked())return null;if(this._nextLock.lock(),!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("LiveGame locked: dead cycle detected\nPlease refresh the page");return this._nextLock.unlock(),this.lockedAwaiting}var r=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==r?void 0:r.node)||void 0===e?void 0:e.action)||null,this.lockedAwaiting=null,this.currentAction||t.events.emit(Zh.EventTypes["event:state.end"]),t.logger.debug("next action (lockedAwaiting)",r),this._nextLock.unlock(),r||null}if(!this.currentAction)return t.logger.weakWarn("LiveGame","No current action"),this._nextLock.unlock(),null;var o=this.currentAction.executeAction(t);return x.isAwaitable(o)?(this.lockedAwaiting=o,this._nextLock.unlock(),o):(t.logger.debug("next action",o),this._lockedCount=0,this.currentAction=(null===(n=o.node)||void 0===n?void 0:n.action)||null,this._nextLock.unlock(),o)}},{key:"abortAwaiting",value:function(){var t;if(this.lockedAwaiting){var e=this.lockedAwaiting.abort();this.currentAction=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.action)||null,this.lockedAwaiting=null}}},{key:"executeAction",value:function(t,e){var n,r=e.executeAction(t);return x.isAwaitable(r)?r:(null===(n=null==r?void 0:r.node)||void 0===n?void 0:n.action)||null}},{key:"setGameState",value:function(t){return this.gameState=t,this}},{key:"getGameState",value:function(){return this.gameState}},{key:"getAllPredictableActions",value:function(t,n,r){for(var o,i,s,u=(null==n?void 0:n.contentNode)||null,c=[],l=[],f=new Set;(u||l.length)&&!(r&&c.length>=r);)if(u||(u=l.pop().contentNode),[uc].some((function(t){return(null==u?void 0:u.action)&&u.action instanceof t})))u=null;else if(u.action&&u.action.is(xt,e.jumpTo)){var p=Jh(u.action.contentNode.getContent(),1)[0],h=t.getScene(p);if(!h)throw u.action._sceneNotFoundError(u.action.getSceneName(p));if(f.has(h)){u=null;continue}f.add(h),u=(null===(o=h.getSceneRoot())||void 0===o?void 0:o.contentNode)||null}else{if(u.action&&u.action.is(Sa,a.do)){var d=Jh(u.action.contentNode.getContent(),1)[0];(null===(i=u.getChild())||void 0===i?void 0:i.action)&&l.push(u.getChild().action),u=(null===(s=d[0])||void 0===s?void 0:s.contentNode)||null}u.action&&c.push(u.action),u=u.getChild()}return c}},{key:"getNewSavedGame",value:function(){var t,e;return{name:"",meta:{created:Date.now(),updated:Date.now()},game:{store:{},stage:{scenes:[]},elementStates:[],currentAction:(null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.getSceneRoot().getId())||null}}}}])}();function od(t){return od="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},od(t)}function id(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ad(r.key),r)}}function ad(t){var e=function(t,e){if("object"!=od(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=od(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==od(e)?e:e+""}rd.DefaultNamespaces={game:{}},rd.GameSpacesKey={game:"game"},rd.EventTypes={"event:character.prompt":"event:character.prompt","event:menu.choose":"event:menu.choose"};var sd,ud=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.settings=e,this.events=new E}return function(t,e,n){return e&&id(t.prototype,e),n&&id(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"setPreference",value:function(e,n){this.settings[e]=n,this.events.emit(t.EventTypes["event:game.preference.change"],e,n)}},{key:"getPreference",value:function(t){return this.settings[t]}},{key:"getPreferences",value:function(){return this.settings}},{key:"onPreferenceChange",value:function(e,n){var r=this,o=this.events.on(t.EventTypes["event:game.preference.change"],(function(t,r){"string"==typeof e?e===t&&n&&n(r):e(t,r)}));return{cancel:function(){return r.events.off(t.EventTypes["event:game.preference.change"],o)}}}},{key:"importPreferences",value:function(t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.setPreference(e,t[e])}},{key:"exportPreferences",value:function(){var t={};for(var e in this.settings)Object.prototype.hasOwnProperty.call(this.settings,e)&&(t[e]=this.settings[e]);return t}}])}();function cd(t){return cd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cd(t)}function ld(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,fd(r.key),r)}}function fd(t){var e=function(t,e){if("object"!=cd(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=cd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cd(e)?e:e+""}ud.EventTypes={"event:game.preference.change":"event:game.preference.change"},function(t){t.game="game"}(sd||(sd={}));var pd=function(){return function(t,e,n){return e&&ld(t.prototype,e),n&&ld(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.liveGame=null,this.preference=new ud(t.DefaultPreference),this.config=k(t.DefaultConfig,e)}),[{key:"useComponent",value:function(t,e){if(!Object.keys(Rh).includes(t))throw new Error("Invalid key ".concat(t));if("function"!=typeof e)throw new Error("Invalid component for key ".concat(t));return this.config.elements[t].use=e,this}},{key:"getLiveGame",value:function(){if(!this.liveGame){var t=this.createLiveGame();return this.liveGame=t,t}return this.liveGame}},{key:"createLiveGame",value:function(){return new rd(this)}}])}();pd.defaultSettings={volume:1},pd.ComponentTypes={say:"say",menu:"menu"},pd.DefaultPreference={autoForward:!1,skip:!0},pd.Preferences={autoForward:"autoForward",skip:"skip"},pd.DefaultConfig={player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:1920,height:1080,skipKey:["Control"],skipInterval:100,ratioUpdateInterval:50,preloadDelay:100,preloadConcurrency:5,waitForPreload:!1,preloadAllImages:!0,forceClearCache:!1,maxPreloadActions:10,cursor:null,cursorHeight:30,cursorWidth:30},elements:{say:{nextKey:[" "],textInterval:50,use:Rh.say,useAspectScale:!0,autoForwardDelay:3e3},img:{slowLoadWarning:!0,slowLoadThreshold:2e3,allowSkipTransform:!0,allowSkipTransition:!0},menu:{use:Rh.menu},background:{allowSkipTransform:!0,allowSkipTransition:!1},text:{allowSkipTransform:!0,allowSkipTransition:!0,width:1920,height:216}},elementStyles:{say:{contentContainerClassName:"",containerClassName:"",nameTextClassName:"",textContainerClassName:"",textSpanClassName:"",rubyClassName:""},menu:{containerClassName:"",choiceButtonClassName:"",choiceButtonTextClassName:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1},inspector:!1}},pd.GameSettingsNamespace=sd;var hd=o(72),dd=o.n(hd),yd=o(825),vd=o.n(yd),md=o(659),gd=o.n(md),bd=o(56),wd=o.n(bd),Sd=o(540),_d=o.n(Sd),kd=o(113),xd=o.n(kd),Ad=o(587),Od={};Od.styleTagTransform=xd(),Od.setAttributes=wd(),Od.insert=gd().bind(null,"head"),Od.domAPI=vd(),Od.insertStyleElement=_d();dd()(Ad.A,Od);Ad.A&&Ad.A.locals&&Ad.A.locals;function Ed({children:t,features:e,strict:n=!1}){const[,r]=(0,fp.useState)(!Td(e)),o=(0,fp.useRef)(void 0);if(!Td(e)){const{renderer:t,...n}=e;o.current=t,Np(n)}return(0,fp.useEffect)((()=>{Td(e)&&e().then((({renderer:t,...e})=>{Np(e),o.current=t,r(!0)}))}),[]),(0,bp.jsx)(xp.Provider,{value:{renderer:o.current,strict:n},children:t})}function Td(t){return"function"==typeof t}function jd(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Pd(t,e,n={}){var r;const o=$o(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(i=n.transitionOverride);const a=o?()=>Promise.all(Jo(t,o,n)):()=>Promise.resolve(),s=t.variantChildren&&t.variantChildren.size?(r=0)=>{const{delayChildren:o=0,staggerChildren:a,staggerDirection:s}=i;return function(t,e,n=0,r=0,o=1,i){const a=[],s=(t.variantChildren.size-1)*r,u=1===o?(t=0)=>t*r:(t=0)=>s-t*r;return Array.from(t.variantChildren).sort(Cd).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(Pd(t,e,{...i,delay:n+u(r)}).then((()=>t.notify("AnimationComplete",e))))})),Promise.all(a)}(t,e,o+r,a,s,n)}:()=>Promise.resolve(),{when:u}=i;if(u){const[t,e]="beforeChildren"===u?[a,s]:[s,a];return t().then((()=>e()))}return Promise.all([a(),s(n.delay)])}function Cd(t,e){return t.sortNodePosition(e)}const Id=li.length;function Ld(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&Ld(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<Id;n++){const r=li[n],o=t.props[r];(ui(o)||!1===o)&&(e[r]=o)}return e}const Nd=[...ci].reverse(),Rd=ci.length;function Md(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const o=e.map((e=>Pd(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=Pd(t,e,n);else{const o="function"==typeof e?$o(t,e,n.custom):e;r=Promise.all(Jo(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Fd(t){let e=Md(t),n=Vd(),r=!0;const o=e=>(n,r)=>{var o;const i=$o(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const{props:a}=t,s=Ld(t.parent)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<Rd;e++){const p=Nd[e],h=n[p],d=void 0!==a[p]?a[p]:s[p],y=ui(d),v=p===i?h.isActive:null;!1===v&&(f=e);let m=d===s[p]&&d!==a[p]&&y;if(m&&r&&t.manuallyAnimateOnMount&&(m=!1),h.protectedKeys={...l},!h.isActive&&null===v||!d&&!h.prevProp||si(d)||"boolean"==typeof d)continue;const g=Dd(h.prevProp,d);let b=g||p===i&&h.isActive&&!m&&y||e>f&&y,w=!1;const S=Array.isArray(d)?d:[d];let _=S.reduce(o(p),{});!1===v&&(_={});const{prevResolvedValues:k={}}=h,x={...k,..._},A=e=>{b=!0,c.has(e)&&(w=!0,c.delete(e)),h.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=_[t],n=k[t];if(l.hasOwnProperty(t))continue;let r=!1;r=Fo(e)&&Fo(n)?!jd(e,n):e!==n,r?null!=e?A(t):c.add(t):void 0!==e&&c.has(t)?A(t):h.protectedKeys[t]=!0}h.prevProp=d,h.prevResolvedValues=_,h.isActive&&(l={...l,..._}),r&&t.blockInitialAnimation&&(b=!1);b&&(!(m&&g)||w)&&u.push(...S.map((t=>({animation:t,options:{type:p}}))))}if(c.size){const e={};c.forEach((n=>{const r=t.getBaseTarget(n),o=t.getValue(n);o&&(o.liveStyle=!0),e[n]=null!=r?r:null})),u.push({animation:e})}let p=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(p=!1),r=!1,p?e(u):Promise.resolve()}return{animateChanges:i,setActive:function(e,r){var o;if(n[e].isActive===r)return Promise.resolve();null===(o=t.variantChildren)||void 0===o||o.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const a=i(e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Vd(),r=!0}}}function Dd(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!jd(e,t)}function Bd(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Vd(){return{animate:Bd(!0),whileInView:Bd(),whileHover:Bd(),whileTap:Bd(),whileDrag:Bd(),whileFocus:Bd(),exit:Bd()}}class Gd{constructor(t){this.isMounted=!1,this.node=t}update(){}}let Ud=0;const Wd={animation:{Feature:class extends Gd{constructor(t){super(t),t.animationState||(t.animationState=Fd(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();si(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends Gd{constructor(){super(...arguments),this.id=Ud++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const r=this.node.animationState.setActive("exit",!t);e&&!t&&r.then((()=>e(this.id)))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}};function zd(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Hd(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const $d=t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,Hd(e));function qd(t,e,n,r){return zd(t,e,$d(n),r)}function Yd(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Xd=Yd("dragHorizontal"),Kd=Yd("dragVertical");function Zd(){const t=function(t){let e=!1;if("y"===t)e=Kd();else if("x"===t)e=Xd();else{const t=Xd(),n=Kd();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function Qd(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd";return qd(t.current,n,((n,o)=>{if("touch"===n.pointerType||Zd())return;const i=t.getProps();t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e);const a=i[r];a&&un.postRender((()=>a(n,o)))}),{passive:!t.getProps()[r]})}const Jd=(t,e)=>!!e&&(t===e||Jd(t,e.parentElement));function ty(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Hd(n))}const ey=new WeakMap,ny=new WeakMap,ry=t=>{const e=ey.get(t.target);e&&e(t)},oy=t=>{t.forEach(ry)};function iy(t,e,n){const r=function({root:t,...e}){const n=t||document;ny.has(n)||ny.set(n,{});const r=ny.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(oy,{root:t,...e})),r[o]}(e);return ey.set(t,n),r.observe(t),()=>{ey.delete(t),r.unobserve(t)}}const ay={some:0,all:1};const sy={inView:{Feature:class extends Gd{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:r="some",once:o}=t,i={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:ay[r]};return iy(this.node.current,i,(t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,o&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),i=e?n:r;i&&i(t)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Gd{constructor(){super(...arguments),this.removeStartListeners=ie,this.removeEndListeners=ie,this.removeAccessibleListeners=ie,this.startPointerPress=(t,e)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),r=qd(window,"pointerup",((t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r,globalTapTarget:o}=this.node.getProps(),i=o||Jd(this.node.current,t.target)?n:r;i&&un.update((()=>i(t,e)))}),{passive:!(n.onTap||n.onPointerUp)}),o=qd(window,"pointercancel",((t,e)=>this.cancelPress(t,e)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=eo(r,o),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=zd(this.node.current,"keydown",(t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=zd(this.node.current,"keyup",(t=>{"Enter"===t.key&&this.checkPressEnd()&&ty("up",((t,e)=>{const{onTap:n}=this.node.getProps();n&&un.postRender((()=>n(t,e)))}))})),ty("down",((t,e)=>{this.startPress(t,e)}))})),e=zd(this.node.current,"blur",(()=>{this.isPressing&&ty("cancel",((t,e)=>this.cancelPress(t,e)))}));this.removeAccessibleListeners=eo(t,e)}}startPress(t,e){this.isPressing=!0;const{onTapStart:n,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&un.postRender((()=>n(t,e)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Zd()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&un.postRender((()=>n(t,e)))}mount(){const t=this.node.getProps(),e=qd(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=zd(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=eo(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Gd{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=eo(zd(this.node.current,"focus",(()=>this.onFocus())),zd(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Gd{mount(){this.unmount=eo(Qd(this.node,!0),Qd(this.node,!1))}unmount(){}}}},uy={renderer:(t,e)=>Vp(t)?new Ii(e):new Ni(e,{allowProjection:t!==fp.Fragment}),...Wd,...sy};function cy(t){var e=t.children;return pp().createElement(Ed,{features:uy,strict:!0},e)}function ly(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return fy(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fy(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fy(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function py(t){var e=t.children,n=t.className,r=ly((0,fp.useState)({}),2),o=r[0],i=r[1],a=jh().ratio,s=mp().game,u=ly((0,fp.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,fp.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("NarraLeaf-React: Ratio is locked, skipping update");else{var t=document.getElementById(s.config.player.contentContainerId);if(t){var e,n,r=t.clientWidth,o=t.clientHeight,f=s.config.player.aspectRatio;r/o>f?(e=o*f,n=o):(e=r,n=r/f),e<c&&(e=c),n<l&&(n=l),i({width:"".concat(e,"px"),height:"".concat(n,"px"),margin:"auto",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center"});var p=e/s.config.player.width;a.update(e,n,p),a.updateMin(c,l),u()}}};a.setUpdate(e);var n,r,o,f=(n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)},r=s.config.player.ratioUpdateInterval,o=null,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];o&&clearTimeout(o),o=setTimeout((function(){n.apply(void 0,e)}),r)});f(),window.addEventListener("resize",f);var p=a.onRequestedUpdate(f);return function(){window.removeEventListener("resize",f),clearTimeout(t),p()}}),[a]),pp().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},pp().createElement("div",{className:lp(n),style:o},e))}function hy(t){return hy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hy(t)}function dy(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */dy=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==hy(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(hy(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function yy(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return vy(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vy(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vy(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var my=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function gy(t){var e=this,n=t.state,r=t.displayable,o=t.child,i=r.element,a=r.state,s=void 0===a?i:a,u=(0,fp.useRef)(null),c=yy((0,fp.useState)(null),2),l=c[0],f=c[1],p=yy((0,fp.useState)([]),2)[1],h=yy((0,fp.useState)(null),2),d=h[0],y=h[1],v=yy((0,fp.useState)({}),2),m=v[0],g=v[1];function b(t){if(d&&d.getControl()&&(n.logger.warn("Displayable Animation","processing transform not completed"),d.getControl().complete(),d.setControl(null)),!u.current)throw new Error("scope not ready");t instanceof Ji?Object.assign(u.current.style,t.propToCSS(n,s.state,r.transformOverwrites)):Object.assign(u.current.style,t)}function w(t){return f(t),t?new Promise((function(e){var r=t.events.onEvents([{type:pl.update,listener:t.events.on(pl.update,(function(t){p(t)}))},{type:pl.end,listener:t.events.on(pl.end,(function(){f(null),n.logger.debug("transition end",t)}))},{type:pl.start,listener:t.events.on(pl.start,(function(){n.logger.debug("transition start",t)}))}]);t.start((function(){r.cancel(),e()}))})):(n.logger.warn("transition not set"),Promise.resolve())}function S(t){return my(this,void 0,void 0,dy().mark((function e(){return dy().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(n,s.state,r.transformOverwrites)),y(t),e.next=4,t.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(e){s.state=k(s.state,e),g({style:t.propToCSS(n,s.state,r.transformOverwrites)}),y(null)}));case 4:case"end":return e.stop()}}),e)})))}return(0,fp.useEffect)((function(){var t="event:displayable.applyTransition",o="event:displayable.applyTransform",a="event:displayable.init",c=i.events.onEvents([{type:t,listener:i.events.on(t,w)},{type:o,listener:i.events.on(o,S)},{type:a,listener:i.events.on(a,(function(){return my(e,void 0,void 0,dy().mark((function t(){var e;return dy().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.toDisplayableTransform(),n.logger.debug("init transform",e),t.next=4,e.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(t){s.state=k(s.state,t)}));case 4:case"end":return t.stop()}}),t)})))}))}]);return function(){c.cancel()}}),[]),(0,fp.useEffect)((function(){if(!u.current)throw new Error("Scope not ready. Using element: ".concat(i.constructor.name))}),[]),(0,fp.useEffect)((function(){var t=n.events.onEvents([{type:Zh.EventTypes["event:state.player.skip"],listener:n.events.on(Zh.EventTypes["event:state.player.skip"],(function(){r.skipTransform&&d&&d.getControl()&&(d.getControl().complete(),d.setControl(null),n.logger.debug("transform skip")),r.skipTransition&&l&&l.controller&&(l.controller.complete(),f(null),n.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[l,d]),pp().createElement(pp().Fragment,null,o({transformRef:u,transition:l,transform:d,transformProps:m,state:n}))}function by(t){return by="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},by(t)}function wy(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Sy(r.key),r)}}function Sy(t){var e=function(t,e){if("object"!=by(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=by(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==by(e)?e:e+""}var _y=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.preloaded=[],this.events=new E}return function(t,e,n){return e&&wy(t.prototype,e),n&&wy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"add",value:function(e){return this.has(this.getSrc(e))||(this.preloaded.push(e),this.events.emit(t.EventTypes["event:preloaded.add"],e),this.events.emit(t.EventTypes["event:preloaded.change"])),this}},{key:"get",value:function(t){var e=this;return this.preloaded.find((function(n){return e.getSrc(n)===t}))}},{key:"has",value:function(t){var e=this;return Array.isArray(t)?t.every((function(t){return e.has(t)})):this.preloaded.some((function(n){return e.getSrc(n)===t}))}},{key:"remove",value:function(e){var n=this;if(Array.isArray(e)){var r=e.map((function(t){return n.getSrc(t)}));return this.preloaded=this.preloaded.filter((function(t){return!r.includes(n.getSrc(t))})),this}var o=this.getSrc(e);return this.preloaded=this.preloaded.filter((function(t){return n.getSrc(t)!==o})),this.events.emit(t.EventTypes["event:preloaded.remove"],e),this.events.emit(t.EventTypes["event:preloaded.change"]),this}},{key:"clear",value:function(){return this.preloaded=[],this}},{key:"getSrc",value:function(t){return el.getSrc(t)}}])}();function ky(t){return ky="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ky(t)}function xy(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ay(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ay(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function Ay(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Oy(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ey(r.key),r)}}function Ey(t){var e=function(t,e){if("object"!=ky(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ky(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ky(e)?e:e+""}_y.EventTypes={"event:preloaded.add":"event:preloaded.add","event:preloaded.remove":"event:preloaded.remove","event:preloaded.change":"event:preloaded.change","event:preloaded.mount":"event:preloaded.mount","event:preloaded.ready":"event:preloaded.ready"};var Ty=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.src=new Map,this.preloadTasks=new Map}return function(t,e,n){return e&&Oy(t.prototype,e),n&&Oy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"has",value:function(t){return this.src.has(t)}},{key:"add",value:function(t,e){return this.src.set(t,e),this}},{key:"remove",value:function(t){return this.src.delete(t),this}},{key:"get",value:function(t){return this.src.get(t)}},{key:"clear",value:function(){return this.src.clear(),this}},{key:"size",value:function(){return this.src.size}},{key:"isPreloading",value:function(t){return this.preloadTasks.has(t)}},{key:"preload",value:function(e){var n=this;if(this.src.has(e)||this.preloadTasks.has(e))return{abort:function(){},onFinished:function(){}};var r=new AbortController,o=r.signal,i={promise:t.getImage(e,o),controller:r};return this.preloadTasks.set(e,i),i.promise.then((function(t){n.preloadTasks.delete(e),t&&n.add(e,t)})),{abort:function(){r.abort(),n.preloadTasks.delete(e)},onFinished:function(t){i.promise.then(t)}}}},{key:"abortAll",value:function(){this.preloadTasks.forEach((function(t){t.controller.abort()})),this.preloadTasks.clear()}},{key:"abort",value:function(t){var e=this.preloadTasks.get(t);e&&(e.controller.abort(),this.preloadTasks.delete(t))}},{key:"preloadedSrc",value:function(){return Array.from(this.src.values())}},{key:"filter",value:function(t){var e,n=xy(this.src.keys());try{for(n.s();!(e=n.n()).done;){var r=e.value;t.includes(r)||this.src.delete(r)}}catch(t){n.e(t)}finally{n.f()}return this}}],[{key:"getImage",value:function(t,e){return function(t,e){return S(this,void 0,void 0,l().mark((function n(){var r,o;return l().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,fetch(t,e);case 2:return r=n.sent,n.next=5,r.blob();case 5:return o=n.sent,n.abrupt("return",new Promise((function(t){var e=new FileReader;e.onload=function(){t(e.result)},e.readAsDataURL(o)})));case 7:case"end":return n.stop()}}),n)})))}(t,{signal:e})}}])}();function jy(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Py(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Py(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Py(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var Cy=(0,fp.createContext)(null);function Iy(t){var e=t.children,n=jy((0,fp.useState)(new _y),1)[0],r=jy((0,fp.useState)(new Ty),1)[0];return pp().createElement(pp().Fragment,null,pp().createElement(Cy.Provider,{value:{preloaded:n,cacheManager:r}},e))}function Ly(){if(!Cy)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,fp.useContext)(Cy)}function Ny(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ry(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ry(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ry(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function My(){return My=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},My.apply(null,arguments)}function Fy(t){var e=t.scene,n=t.props,r=t.state;return pp().createElement(gy,{displayable:{element:e,skipTransform:r.game.config.elements.background.allowSkipTransform,skipTransition:r.game.config.elements.background.allowSkipTransition},child:function(t){return pp().createElement(Dy,My({},t,{scene:e,props:n}))},state:r})}function Dy(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.state,i=t.scene,a=t.props,s=jh().ratio,u=Ly().cacheManager,c=Ny(pp().useState(!1),2),l=c[0],f=c[1];function p(){l||(f(!0),i.events.emit(Lf.EventTypes["event:scene.imageLoaded"]),o.logger.debug("BackgroundTransition","Image loaded",i))}var h="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAgAB9sWFXTkAAAAASUVORK5CYII=",d={src:h,style:Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{})};return pp().createElement("div",null,pp().createElement(ah.div,My({layout:!0,ref:e,className:"absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"},k({style:Object.assign({},s.getStyle())},n)),(r?r.toElementProps():[{}]).map((function(t,e){var n,r=k(d,a,t);return pp().createElement("img",My({alt:r.alt},r,{onLoad:p,src:(n=r.src,n?u.has(n)?u.get(n):n:h),className:"absolute",key:e}))}))))}function By(t){return By="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},By(t)}function Vy(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Vy=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:O(t,n,s)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,_=S&&S(S(C([])));_&&_!==n&&r.call(_,a)&&(w=_);var k=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(o,i,a,s){var u=f(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==By(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,n,r){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=y,r.method="throw",r.arg=c.arg)}}}function E(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(By(e)+" is not iterable")}return g.prototype=b,o(k,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,s,(function(){return this})),e.AsyncIterator=A,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function Gy(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Uy(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Uy(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Uy(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var Wy=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function zy(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=jh().ratio,a=Gy((0,fp.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1];return(0,fp.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(Lf.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){return Wy(this,void 0,void 0,Vy().mark((function r(){var o,i;return Vy().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=s,i=t,r.next=4,n.transitionSound(o,i,e);case 4:if(i){r.next=6;break}return r.abrupt("return");case 6:u(i);case 7:case"end":return r.stop()}}),r)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(Lf.EventTypes["event:scene.preUnmount"],(function(){s&&function(t,e){return Wy(this,void 0,void 0,Vy().mark((function r(){return Vy().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.fadeSound(t,0,e);case 2:n.stopSound(t);case 3:case"end":return r.stop()}}),r)})))}(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,fp.useEffect)((function(){return e.events.emit(Lf.EventTypes["event:scene.mount"]),function(){e.events.emit(Lf.EventTypes["event:scene.unmount"])}}),[]),pp().createElement("div",{className:o},pp().createElement(Fy,{scene:e,props:{width:i.state.width,height:i.state.height,src:au.isImageSrc(e.state.background)?au.srcToString(e.state.background):void 0,style:{backgroundColor:au.isImageColor(e.state.background)?au.toHex(e.state.background):void 0}},state:n}),r)}function Hy(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=qy(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function $y(t){return function(t){if(Array.isArray(t))return Yy(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||qy(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qy(t,e){if(t){if("string"==typeof t)return Yy(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yy(t,e):void 0}}function Yy(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Xy(t){var e=t.state,n=Ly(),r=n.preloaded,o=n.cacheManager,i=mp().game,a=(0,fp.useRef)(new Set),s="Preload",u=e.getLastScene(),c=i.getLiveGame().getCurrentAction(),l=i.getLiveGame().story;return(0,fp.useEffect)((function(){var t,n;if("undefined"==typeof fetch)return r.events.emit(_y.EventTypes["event:preloaded.ready"]),void e.logger.warn(s,"Fetch is not supported in this environment, skipping preload");if(!i.config.player.preloadAllImages)return r.events.emit(_y.EventTypes["event:preloaded.ready"]),void e.logger.debug(s,"Preload all images is disabled, skipping preload");if(i.config.player.forceClearCache&&(o.clear(),e.logger.weakWarn(s,"Cache cleared")),l){var a=performance.now(),c=el.catSrc([].concat($y((null===(t=null==u?void 0:u.srcManager)||void 0===t?void 0:t.src)||[]),$y((null===(n=null==u?void 0:u.srcManager)||void 0===n?void 0:n.getFutureSrc())||[]))),f=new D(i.config.player.preloadConcurrency,i.config.player.preloadDelay),p=[],h=e.logger.group(s,!0);e.logger.debug(s,"preloading:",c);var d,y=Hy(c.image);try{var v=function(){var t=d.value,n=el.getSrc(t);if(p.push(n),o.has(n)||o.isPreloading(n))return e.logger.debug(s,"Image already loaded (".concat(c.image.indexOf(t)+1,"/").concat(c.image.length,")"),n),1;f.addTask((function(){return new Promise((function(r){o.preload(n).onFinished((function(){e.logger.debug(s,"Image loaded (".concat(c.image.indexOf(t)+1,"/").concat(c.image.length,")"),n),r()}))}))}))};for(y.s();!(d=y.n()).done;)v()}catch(t){y.e(t)}finally{y.f()}return h.end(),f.start().then((function(){e.logger.info(s,"Image preload","loaded ".concat(o.size()," images in ").concat(performance.now()-a,"ms")),i.config.player.waitForPreload&&r.events.emit(_y.EventTypes["event:preloaded.ready"]),e.events.emit(Zh.EventTypes["event:state.preload.loaded"]),o.filter(p)})),i.config.player.waitForPreload||r.events.emit(_y.EventTypes["event:preloaded.ready"]),r.events.emit(_y.EventTypes["event:preloaded.mount"]),function(){e.events.emit(Zh.EventTypes["event:state.preload.unmount"]),e.logger.debug(s,"Preload unmounted")}}e.logger.weakWarn(s,"Story not found, skipping preload")}),[u,l]),(0,fp.useEffect)((function(){a.current.clear()}),[u]),(0,fp.useEffect)((function(){if("undefined"!=typeof fetch&&!i.config.player.preloadAllImages)if(l){var t=performance.now(),n=i.getLiveGame().getAllPredictableActions(l,c,i.config.player.maxPreloadActions).map((function(t){return el.getPreloadableSrc(l,t)})).filter((function(t){return null!==t}));n.filter((function(t){return"scene"===(null==t?void 0:t.activeType)})).forEach((function(t){a.current.has(t)||a.current.add(t)}));var r=el.catSrc([].concat($y(a.current),$y(n))),u=new D(i.config.player.preloadConcurrency,i.config.player.preloadDelay),f=[],p=e.logger.group(s);e.logger.debug(s,"preloading:",r);var h,d=Hy(r.image);try{var y=function(){var t=h.value,n=el.getSrc(t);if(f.push(n),o.has(n)||o.isPreloading(n))return e.logger.debug(s,"Image already loaded (".concat(r.image.indexOf(t)+1,"/").concat(r.image.length,")"),n),1;u.addTask((function(){return new Promise((function(i){o.preload(n).onFinished((function(){e.logger.debug(s,"Image loaded (".concat(r.image.indexOf(t)+1,"/").concat(r.image.length,")"),n),i()}))}))}))};for(d.s();!(h=d.n()).done;)y()}catch(t){d.e(t)}finally{d.f()}p.end(),u.start().then((function(){e.logger.info(s,"Image preload (quick reload)","loaded ".concat(o.size()," images in ").concat(performance.now()-t,"ms")),o.filter(f)}))}else e.logger.weakWarn(s,"Story not found, skipping preload")}),[c,l]),null}function Ky(t){var e=t.state,n=mp().game;return(0,fp.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&n.preference.getPreference(pd.Preferences.skip)&&e.events.emit(Zh.EventTypes["event:state.player.skip"])},r=n.config.player.skipInterval,o=0,function(){var e=Date.now();if(!(e-o<r))return o=e,t.apply(void 0,arguments)});return window.addEventListener("keydown",i),function(){window.removeEventListener("keydown",i)}}e.logger.warn("NarraLeaf-React: Announcer","Cannot listen to window events\nThis component must be rendered in a browser environment")}),[]),pp().createElement(pp().Fragment,null)}var Zy=o(33);function Qy(){return Qy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Qy.apply(null,arguments)}function Jy(t){var e=t.state,n=t.text,r={scale:function(t){return{width:"fit-content"}},transform:function(t){return{transform:Ji.propToCSSTransform(e,t,{translate:["left"===n.config.alignX?"0%":"right"===n.config.alignX?"-100%":void 0,"top"===n.config.alignY?"100%":"bottom"===n.config.alignY?"0%":void 0]})}}};return pp().createElement(gy,{displayable:{element:n,skipTransform:e.game.config.elements.text.allowSkipTransform,skipTransition:e.game.config.elements.text.allowSkipTransition,transformOverwrites:r},child:function(t){return pp().createElement(tv,Qy({},t,{text:n}))},state:e})}function tv(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.text,i=jh().ratio,a={style:{width:"fit-content",whiteSpace:"nowrap",fontSize:o.state.fontSize}},s=[{}],u=lp(o.config.className);return pp().createElement(hh.Div,null,pp().createElement(hh.mDiv,Qy({tag:"text.container",color:"green",border:"dashed",layout:!0,Ref:e,className:"absolute"},k({style:{opacity:0}},n,{style:{width:"fit-content"}})),r?r.toElementProps().map((function(t,e){var n=k(a,t,{style:{transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}},s[e]||{});return pp().createElement(hh.Span,Qy({tag:"text.transition."+e,key:e},n,{className:u}),pp().createElement("span",null,o.state.text))})):pp().createElement(hh.Div,Qy({tag:"text.transition.last",color:"green",border:"dashed",key:"last"},k(a,{style:{width:"fit-content",transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}})),pp().createElement(hh.Span,{className:u},o.state.text))))}function ev(){return ev=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ev.apply(null,arguments)}function nv(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return rv(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rv(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rv(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ov(t){var e=t.props,n=t.onLoad,r=t.id,o=t.Ref,i=(0,fp.useRef)(null),a=jh().ratio,s=nv(pp().useState(0),2),u=s[0],c=s[1],l=Ly().cacheManager,f=mp().game;function p(){var t=o||i;t.current&&c(t.current.naturalWidth*a.state.scale)}(0,fp.useEffect)((function(){var t;!e.src||l.has(e.src)&&!l.isPreloading(e.src)||null===(t=f.getLiveGame().getGameState())||void 0===t||t.logger.warn("AspectScaleImage",'Image not preloaded: "'.concat(e.src,'". ')+"\nThis may be caused by complicated image action behavior that cannot be predicted. \nTo fix this issue, you can manually register the image using scene.requestImagePreload(YourImageSrc). ")}),[e,e.src,r]),(0,fp.useEffect)((function(){return p(),a.onUpdate(p)}),[e,r]);var h=e.src?l.get(e.src)||e.src:Ps.DefaultImagePlaceholder;return pp().createElement("img",ev({ref:o||i},e,{onLoad:n,width:u,alt:e.alt,src:h}))}function iv(t){return function(t){if(Array.isArray(t))return uv(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||sv(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function av(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||sv(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sv(t,e){if(t){if("string"==typeof t)return uv(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uv(t,e):void 0}}function uv(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function cv(){return cv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},cv.apply(null,arguments)}function lv(t){var e=t.image,n=t.state,r=function(){};return pp().createElement(gy,{displayable:{element:e,skipTransition:n.game.config.elements.img.allowSkipTransition,skipTransform:n.game.config.elements.img.allowSkipTransform,transformOverwrites:{}},child:function(t){return pp().createElement(fv,cv({},t,{image:e,handleLoad:r}))},state:n})}function fv(t){var e=t.transition,n=t.transformProps,r=t.transformRef,o=t.state,i=t.image,a=t.handleLoad,s=jh().ratio,u=(0,fp.useRef)(null),c=av((0,fp.useState)([]),2),l=c[0],f=c[1],p={src:Ps.getSrc(i.state),style:Object.assign(Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{}),{transformOrigin:"center"})},h=[{style:{display:"block",position:"unset"}},{style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxWidth:"none"}}];return(0,fp.useEffect)((function(){var t=i.events.onEvents([{type:Ps.EventTypes["event:wearable.create"],listener:i.events.on(Ps.EventTypes["event:wearable.create"],(function(t){f((function(e){return[].concat(iv(e),[t])}))}))}]);return function(){t.cancel()}}),[]),pp().createElement("div",null,pp().createElement(hh.mDiv,cv({tag:"image.aspectScaleContainer",color:"green",border:"dashed",layout:!0,Ref:r,className:"absolute"},k({style:{opacity:0}},n,{style:{display:"inline-block",width:u.current?"".concat(u.current.naturalWidth*s.state.scale,"px"):"auto",height:u.current?"".concat(u.current.naturalHeight*s.state.scale,"px"):"auto"}})),pp().createElement(pp().Fragment,null,(e?e.toElementProps():[{}]).map((function(t,e){var n=k(p,t,h[e]||{});return pp().createElement(ov,{key:e,props:Object.assign({className:"absolute"},n),id:n.src,onLoad:a,Ref:0===e?u:void 0})}))),pp().createElement("div",{className:lp("w-full h-full top-0 left-0 absolute")},l.map((function(t){return pp().createElement("div",{className:lp("w-full h-full relative"),key:"wearable-"+t.getId()},pp().createElement(lv,{image:t,state:o}))})))))}function pv(t){var e=t.state,n=t.displayable;return pp().createElement(pp().Fragment,null,n.map((function(t){var n;if(t instanceof Gl)return pp().createElement(Jy,{state:e,text:t,key:"text-"+t.getId()});if(t instanceof Ps)return pp().createElement(lv,{state:e,image:t,key:"image-"+t.getId()});throw new Error("Unsupported displayable type: "+((null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)||t))})))}var hv=o(556),dv=o.n(hv);function yv(t){var e=t.error,n=t.errorInfo;return mp().game.config.app.debug?pp().createElement("div",{className:"text-left"},pp().createElement("h1",null,"It is my fault, NarraLeaf-React cannot initialize the player correctly."),pp().createElement("p",{className:"text-red-700"},"Message: ",e.message),pp().createElement("pre",null,"Error Stack: ",null==e?void 0:e.stack),pp().createElement("pre",null,"Component Stack: ",null==n?void 0:n.componentStack),pp().createElement("pre",null,"Digest: ",null==n?void 0:n.digest)):pp().createElement("div",null,pp().createElement("h1",null,"The game cannot initialize the player correctly."),pp().createElement("p",null,"Please contact the game developer for further assistance."))}function vv(t){return vv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vv(t)}function mv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,gv(r.key),r)}}function gv(t){var e=function(t,e){if("object"!=vv(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=vv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vv(e)?e:e+""}function bv(t,e,n){return e=Sv(e),function(t,e){if(e&&("object"==vv(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,wv()?Reflect.construct(e,n||[],Sv(t).constructor):e.apply(t,n))}function wv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(wv=function(){return!!t})()}function Sv(t){return Sv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sv(t)}function _v(t,e){return _v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_v(t,e)}var kv=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=bv(this,e,arguments)).state={hasError:!1,error:null,errorInfo:null},t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_v(t,e)}(e,t),function(t,e,n){return e&&mv(t.prototype,e),n&&mv(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidCatch",value:function(t,e){this.setState({error:t,errorInfo:e}),console.error(t,e)}},{key:"render",value:function(){return this.state.hasError?pp().createElement(yv,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(t){return{hasError:!0,error:t,errorInfo:null}}}])}(pp().Component);function xv(t){var e=t.containerRef,n=jh().ratio;return(0,fp.useEffect)((function(){var t=e.current;if(t){var r=new ResizeObserver((function(){n.requestUpdate()}));return r.observe(t),function(){r.disconnect()}}}),[e.current]),null}function Av(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Ov(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ov(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ov(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ev(t){var e=t.src,n=t.width,r=t.height,o=Av((0,fp.useState)({x:0,y:0}),2),i=o[0],a=o[1],s=Av((0,fp.useState)(!1),2),u=s[0],c=s[1],l=(0,fp.useRef)(null),f=jh().ratio;return(0,fp.useEffect)((function(){var t=function(t){if(l.current){var e=l.current.getBoundingClientRect(),n=t.clientX-e.left,r=t.clientY-e.top;a({x:n,y:r}),u||c(!0)}};return window.addEventListener("mousemove",t),function(){window.removeEventListener("mousemove",t)}}),[u]),pp().createElement(Nh,{$ref:l,className:"overflow-hidden relative"},pp().createElement("img",{src:e,style:{position:"absolute",left:i.x,top:i.y,width:n,height:r,pointerEvents:"none",zIndex:1001,display:u?"block":"none",cursor:"none",transform:"scale(".concat(f.state.scale,")")},alt:""}))}function Tv(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return jv(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jv(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jv(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Pv(t,e){return t.handle(e)}function Cv(t){var e=t.story,n=t.width,r=t.height,o=t.className,i=t.onReady,a=t.onEnd,s=t.children,u=Tv((0,fp.useReducer)((function(t){return t+1}),0),2)[1],c=mp().game,l=Tv((0,fp.useReducer)(Pv,new Zh(c,{update:u,forceUpdate:function(){f.logger.weakWarn("Player","force update"),(0,Zy.flushSync)((function(){u()}))},next:w,dispatch:function(t){return p(t)}})),2),f=l[0],p=l[1],h=pp().createRef(),d=Tv((0,fp.useState)(!1),2),y=d[0],v=d[1],m=pp().useRef(!1),g=c.config.elements.say.use,b=c.config.elements.menu.use;function w(){for(var t=!1;!t;){var e=c.getLiveGame().next(f);if(!e)break;if(x.isAwaitable(e)){t=!0;break}if(e instanceof L){e.nextUnlock().then((function(){w()})),t=!0;break}p(e)}f.stage.update()}(0,fp.useEffect)((function(){return c.getLiveGame().setGameState(f),e&&c.getLiveGame().loadStory(e),function(){c.getLiveGame().setGameState(void 0)}}),[c]),(0,fp.useEffect)((function(){return B((function(){v(!0);var t=f.getLastScene(),e=[];t?e.push({type:"event:scene.mount",listener:t.events.once("event:scene.mount",(function(){f.stage.next()}))}):f.stage.next();var n=f.events.onEvents([{type:Zh.EventTypes["event:state.end"],listener:function(){a&&a({game:c,gameState:f,liveGame:c.getLiveGame(),storable:c.getLiveGame().getStorable()})}}]),r=f.events.onEvents([{type:Zh.EventTypes["event:state.player.skip"],listener:function(){c.getLiveGame().abortAwaiting(),w()}}]);return f.stage.update(),function(){t&&e.forEach((function(e){t.events.off(e.type,e.listener)})),n.cancel(),r.cancel()}}))}),[]),(0,fp.useEffect)((function(){return B((function(){y&&i&&!m.current&&(m.current=!0,i({game:c,gameState:f,liveGame:c.getLiveGame(),storable:c.getLiveGame().getStorable()}))}))}),[y]),f.events.emit(Zh.EventTypes["event:state.player.flush"]);var S=n||c.config.player.width,_=r||c.config.player.height;return pp().createElement(kv,null,pp().createElement(cy,null,pp().createElement("div",{style:{width:"number"==typeof S?"".concat(S,"px"):S,height:"number"==typeof _?"".concat(_,"px"):_},className:lp(o,"__narraleaf_content-player"),ref:h},pp().createElement(py,{className:lp("flex-grow overflow-auto")},pp().createElement(xv,{containerRef:h}),pp().createElement(Nh,{style:{cursor:f.game.config.player.cursor?"none":"auto"}},c.config.player.cursor&&pp().createElement(Ev,{src:c.config.player.cursor,width:c.config.player.cursorWidth,height:c.config.player.cursorHeight}),pp().createElement(Xy,{state:f}),pp().createElement(Iv,{onLoaded:function(){f.stage.update(),e&&w()},state:f},pp().createElement(Ky,{state:f}),f.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return pp().createElement(zy,{key:"scene-"+e.getId(),state:f,scene:e},pp().createElement(pv,{state:f,displayable:n.displayable}),n.texts.map((function(t){var e=t.action,n=t.onClick;return pp().createElement(g,{state:f,key:"say-"+e.id,action:e,onClick:function(){n(),w()}})})),n.menus.map((function(t,e){var n=t.action,r=t.onClick;return pp().createElement("div",{key:"menu-"+e},pp().createElement(b,{state:f,prompt:n.prompt,choices:n.choices,afterChoose:function(t){r(t),w()},words:n.words}))})))}))),s)))))}function Iv(t){var e=t.children,n=t.onLoaded,r=t.state,o=Ly().preloaded,i=Tv((0,fp.useState)(!1),2),a=i[0],s=i[1];return(0,fp.useEffect)((function(){var t=o.events.on(_y.EventTypes["event:preloaded.ready"],(function(){s(!0),n()})),e=r.events.on(Zh.EventTypes["event:state.preload.unmount"],(function(){s(!1)}));return function(){o.events.off(_y.EventTypes["event:preloaded.ready"],t),r.events.off(Zh.EventTypes["event:state.preload.unmount"],e)}}),[a]),pp().createElement(pp().Fragment,null,a?e:null)}function Lv(t){var e=t.children,n=t.game;return pp().createElement(pp().Fragment,null,pp().createElement(Th,null,pp().createElement(vp,{game:n},pp().createElement(Iy,null,e))))}function Nv(){return Nv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Nv.apply(null,arguments)}function Rv(t){var e=t.alignX,n=void 0===e?"center":e,r=t.alignY,o=void 0===r?"center":r,i=t.children,a=t.width,s=t.height,u=t.className,c=jh().ratio,l="left"===n?"justify-start":"right"===n?"justify-end":"justify-center",f="top"===o?"items-start":"bottom"===o?"items-end":"items-center";return pp().createElement(Nh,{className:lp("flex absolute",l,f,u,"pointer-events-none"),style:{width:a,height:s,transform:"scale(".concat(c.state.scale,")"),transformOrigin:"".concat(n," ").concat(o),pointerEvents:"all"}},i)}kv.propTypes={children:dv().node.isRequired};var Mv={Left:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"left",alignY:"top"}))},Center:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"center",alignY:"top"}))},Right:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"right",alignY:"top"}))}},Fv={Left:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"left",alignY:"center"}))},Center:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"center",alignY:"center"}))},Right:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"right",alignY:"center"}))}},Dv={Left:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"left",alignY:"bottom"}))},Center:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"center",alignY:"bottom"}))},Right:function(t){return pp().createElement(Rv,Nv({},t,{alignX:"right",alignY:"bottom"}))}};function Bv(){return Bv=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Bv.apply(null,arguments)}var Vv=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},Gv={className:dv().string},Uv={children:dv().node};function Wv(t,e){var n=(0,fp.forwardRef)((function(t,n){var r=t.children,o=t.className,i=Vv(t,["children","className"]);return e(Object.assign({children:r,className:o,$ref:n},i))}));return n.displayName=t,n.propTypes=Object.assign(Object.assign({},Gv),Uv),n}var zv=Wv("VBox",(function(t){var e=t.children,n=t.className,r=t.$ref,o=Vv(t,["children","className","$ref"]);return pp().createElement("div",Bv({ref:r,className:lp("flex flex-col",n)},o),e)})),Hv=Wv("HBox",(function(t){var e=t.children,n=t.className,r=t.$ref,o=Vv(t,["children","className","$ref"]);return pp().createElement("div",Bv({ref:r,className:lp("flex flex-row",n)},o),e)}));function $v(t){return $v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$v(t)}function qv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Yv(r.key),r)}}function Yv(t){var e=function(t,e){if("object"!=$v(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$v(e)?e:e+""}function Xv(t,e,n){return e=Zv(e),function(t,e){if(e&&("object"==$v(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Kv()?Reflect.construct(e,n||[],Zv(t).constructor):e.apply(t,n))}function Kv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Kv=function(){return!!t})()}function Zv(t){return Zv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zv(t)}function Qv(t,e){return Qv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qv(t,e)}var Jv=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Xv(this,e)).state={opacity:1},t.duration=n,t.easing=r||xl.DefaultEasing,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qv(t,e)}(e,t),function(t,e,n){return e&&qv(t.prototype,e),n&&qv(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){t&&t(),n.state.opacity=e.Frames[1]},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,backgroundColor:au.isImageColor(this.src)?O(this.src):""},src:au.isImageSrc(this.src)?au.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(xl);function tm(t){return tm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tm(t)}function em(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nm(r.key),r)}}function nm(t){var e=function(t,e){if("object"!=tm(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tm(e)?e:e+""}function rm(t,e,n){return e=im(e),function(t,e){if(e&&("object"==tm(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,om()?Reflect.construct(e,n||[],im(t).constructor):e.apply(t,n))}function om(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(om=function(){return!!t})()}function im(t){return im=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},im(t)}function am(t,e){return am=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},am(t,e)}Jv.Frames=[0,1];var sm=function(t){function e(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3?arguments[3]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=rm(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,r.easing=i||xl.DefaultEasing,r.__stack=T(),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&am(t,e)}(e,t),function(t,e,n){return e&&em(t.prototype,e),n&&em(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,transform:this.state.transform,backgroundColor:au.isImageColor(this.src)?O(this.src):""},src:au.isImageSrc(this.src)?au.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.easing).setSrc(this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])}(xl);function um(t){return um="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},um(t)}function cm(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,lm(r.key),r)}}function lm(t){var e=function(t,e){if("object"!=um(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=um(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==um(e)?e:e+""}function fm(t,e,n){return e=hm(e),function(t,e){if(e&&("object"==um(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,pm()?Reflect.construct(e,n||[],hm(t).constructor):e.apply(t,n))}function pm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(pm=function(){return!!t})()}function hm(t){return hm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hm(t)}function dm(t,e){return dm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dm(t,e)}var ym=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,r=arguments.length>1?arguments[1]:void 0;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=fm(this,e)).state={opacity:0},t.duration=n,t.easing=r||xl.DefaultEasing,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&dm(t,e)}(e,t),function(t,e,n){return e&&cm(t.prototype,e),n&&cm(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){n.state.opacity=e.Frames[1],t&&t()},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity,backgroundColor:au.isImageColor(this.src)?O(this.src):""},src:au.isImageSrc(this.src)?au.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])}(xl);ym.Frames=[1,0]})(),i})()));
|
|
31
|
+
*/function r(t,e,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==e.key&&(o=""+e.key),"key"in e)for(var i in r={},e)"key"!==i&&(r[i]=e[i]);else r=e;return e=r.ref,{$$typeof:n,type:t,key:o,ref:void 0!==e?e:null,props:r}}Symbol.for("react.fragment"),e.jsx=r,e.jsxs=r},848:(t,e,n)=>{"use strict";t.exports=n(698)},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),h={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)e[p].references++,e[p].updater(h);else{var d=o(h,r);r.byIndex=s,e.splice(s,0,{identifier:f,updater:d,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},33:t=>{"use strict";t.exports=e}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={id:t,exports:{}};return n[t](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nc=void 0;var i={};return(()=>{"use strict";o.r(i),o.d(i,{AbstractImage:()=>Cp,Align:()=>Jt,BaseImageTransition:()=>Yl,BaseTextTransition:()=>ql,BaseTransition:()=>$l,Bottom:()=>Yg,Center:()=>$g,Character:()=>wc,CommonPosition:()=>Zt,CommonPositionType:()=>Dt,Condition:()=>Hc,Control:()=>bs,Coord2D:()=>Qt,Dissolve:()=>Eb,Fade:()=>fb,FadeIn:()=>bb,Full:()=>zg,Game:()=>rv,GameProviders:()=>Ug,GameState:()=>Gm,HBox:()=>tb,Image:()=>jp,Isolated:()=>Am,Lambda:()=>zc,LiveGame:()=>qm,Menu:()=>ll,Namespace:()=>jf,Pause:()=>$u,Persistent:()=>Gf,Player:()=>Bg,Say:()=>_m,Scene:()=>np,Script:()=>bp,Sentence:()=>nc,Sound:()=>Gu,SoundType:()=>Ou,Storable:()=>Cf,Story:()=>Op,Text:()=>ff,Top:()=>Hg,Transform:()=>Sa,Utils:()=>Pu,VBox:()=>Jg,Word:()=>Ku,useGame:()=>Vp,usePreference:()=>rb});var t={say:"character:say",action:"character:action",setName:"character:setName"},e={action:"scene:action",setBackground:"scene:setBackground",sleep:"scene:sleep",applyTransition:"scene:applyTransition",init:"scene:init",exit:"scene:exit",jumpTo:"scene:jumpTo",setBackgroundMusic:"scene:setBackgroundMusic",preUnmount:"scene:preUnmount",applyTransform:"scene:applyTransform",transitionToScene:"scene:transitionToScene"},n={action:"image:action",setSrc:"image:setSrc",setPosition:"image:setPosition",show:"image:show",hide:"image:hide",applyTransform:"image:applyTransform",init:"image:init",dispose:"image:dispose",setTransition:"image:setTransition",applyTransition:"image:applyTransition",flush:"image:flush",initWearable:"image:initWearable",setAppearance:"image:setAppearance"},r={action:"sound:action",play:"sound:play",stop:"sound:stop",fade:"sound:fade",setVolume:"sound:setVolume",setRate:"sound:setRate",pause:"sound:pause",resume:"sound:resume"},a={action:"control:action",do:"control:do",doAsync:"control:doAsync",any:"control:any",all:"control:all",allAsync:"control:allAsync",repeat:"control:repeat",sleep:"control:sleep"},s={action:"text:action",setText:"text:setText",show:"text:show",hide:"text:hide",applyTransform:"text:applyTransform",init:"text:init",applyTransition:"text:applyTransition",setFontSize:"text:setFontSize"},u={action:"displayable:action",layerMoveUp:"displayable:layerMoveUp",layerMoveDown:"displayable:layerMoveDown",layerMoveTop:"displayable:layerMoveTop",layerMoveBottom:"displayable:layerMoveBottom"},c={action:"persistent:action",set:"persistent:set"};function l(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */l=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),s=new L(r||[]);return o(a,"_invoke",{value:P(t,n,s)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var h="suspendedStart",d="suspendedYield",y="executing",m="completed",v={};function g(){}function w(){}function S(){}var x={};c(x,a,(function(){return this}));var _=Object.getPrototypeOf,k=_&&_(_(I([])));k&&k!==n&&r.call(k,a)&&(x=k);var A=S.prototype=g.prototype=Object.create(x);function T(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(o,i,a,s){var u=p(t[o],t,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==b(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function P(e,n,r){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){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=O(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===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var c=p(e,n,r);if("normal"===c.type){if(o=r.done?m:d,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function O(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,O(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=p(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 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 L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(b(e)+" is not iterable")}return w.prototype=S,o(A,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:w,configurable:!0}),w.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,c(t,u,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},T(E.prototype),c(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new E(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},T(A),c(A,u,"Generator"),c(A,a,(function(){return this})),c(A,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,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),C(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;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}function f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=v(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}function d(t,e,n){return e&&h(t.prototype,e),n&&h(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function y(t){var e=function(t,e){if("object"!=b(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==b(e)?e:e+""}function m(t){return function(t){if(Array.isArray(t))return g(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||v(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){if(t){if("string"==typeof t)return g(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(t,e):void 0}}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function b(t){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(t)}var w,S,x=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())}))};(S=w||(w={}))[S.string=0]="string",S[S.number=1]="number",S[S.boolean=2]="boolean",S[S.object=3]="object",S[S.array=4]="array",S[S.function=5]="function",S[S.symbol=6]="symbol",S[S[void 0]=7]="undefined",S[S.null=8]="null",S[S.date=9]="date",S[S.regexp=10]="regexp",S[S.other=11]="other";var _=function(t){return"string"==typeof t?w.string:"number"==typeof t?w.number:"boolean"==typeof t?w.boolean:"object"===b(t)?Array.isArray(t)?w.array:null===t?w.null:t instanceof Date?w.date:t instanceof RegExp?w.regexp:w.object:"function"==typeof t?w.function:"symbol"===b(t)?w.symbol:void 0===t?w.undefined:w.other};function k(t,e){var n,r,o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i={};for(var a in t)o(t,a)&&(i[a]=(n=t[a],r=e[a],_(n)===w.object&&_(r)===w.object?n.constructor!==Object||r.constructor!==Object?r||n:k(n,r):Array.isArray(n)&&Array.isArray(r)?r&&r.length>0?m(r):m(n):void 0===n&&Array.isArray(r)?m(r):void 0===r?Array.isArray(n)?m(n):n:Array.isArray(r)?m(r):r));for(var s in e)o(e,s)&&!o(i,s)&&("object"===b(e[s])&&null!==e[s]?e[s].constructor===Object?i[s]=k({},e[s]):Array.isArray(e[s])?i[s]=m(e[s]):i[s]=e[s]:i[s]=e[s]);for(var u=arguments.length,c=new Array(u>2?u-2:0),l=2;l<u;l++)c[l-2]=arguments[l];if(c.length){var f=c[0],p=c.slice(1);return k.apply(void 0,[i,f].concat(m(p)))}return i}_.DataTypes=w;var A=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t},n=arguments.length>1?arguments[1]:void 0;p(this,t),this.solved=!1,this.listeners=[],this.receiver=e,this.skipController=n}return d(t,[{key:"registerSkipController",value:function(t){return this.skipController=t,this}},{key:"resolve",value:function(t){if(!this.solved){this.result=this.receiver(t),this.solved=!0,this.skipController&&this.skipController.cancel();var e,n=f(this.listeners);try{for(n.s();!(e=n.n()).done;){(0,e.value)(this.result)}}catch(t){n.e(t)}finally{n.f()}}}},{key:"then",value:function(t){this.result?t(this.result):this.listeners.push(t)}},{key:"abort",value:function(){return this.skipController?this.skipController.abort():this.result}}],[{key:"isAwaitable",value:function(e){return e instanceof t}}])}();function T(t){var e=new WeakSet;return function t(n){if(null===n||"object"!==b(n))return n;if(!e.has(n)){if(e.add(n),Array.isArray(n)){var r,o=[],i=f(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;o.push(t(a))}}catch(t){i.e(t)}finally{i.f()}return o}var s={};for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(s[u]=t(n[u]));return s}}(t)}function E(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"))}A.nothing=function(t){return t};var P=function(){return d((function t(){p(this,t),this.events={}}),[{key:"on",value:function(t,e){return this.events[t]||(this.events[t]=[]),this.events[t].push(e),this.emit("event:EventDispatcher.register",t,e),e}},{key:"onEvents",value:function(t){var e=this,n=t.map((function(t){var n=t.type,r=t.listener;return{type:n,listener:r,cancel:function(){e.off(n,r)}}}));return{tokens:n,cancel:function(){n.forEach((function(t){return t.cancel()}))}}}},{key:"off",value:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter((function(t){return t!==e})))}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.events[t]&&this.events[t].forEach((function(t){t.apply(void 0,n)}))}},{key:"once",value:function(t,e){var n=this,r=function(){e.apply(void 0,arguments),n.off(t,r)};return this.on(t,r)}},{key:"any",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return x(this,void 0,void 0,l().mark((function e(){var r,o,i,a,s,u,c=this;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.events[t]||(this.events[t]=[]),r=[],o=!1,i=f(this.events[t]);try{for(i.s();!(a=i.n()).done;)s=a.value,(u=s.apply(void 0,n))&&"object"===b(u)&&"function"==typeof u.then?r.push(u):o=!0}catch(t){i.e(t)}finally{i.f()}if(!o){e.next=7;break}return e.abrupt("return",void 0);case 7:if(this.events[t]=this.events[t].filter((function(t){return!r.includes(t)})),0!==r.length){e.next=10;break}return e.abrupt("return",new Promise((function(e){var r=c.on("event:EventDispatcher.register",(function(o,i){if(o===t){c.off(o,r);var a=null==i?void 0:i.apply(void 0,n);a&&a.then?a.then(e):e(a)}}))})));case 10:return e.next=12,Promise.all(r);case 12:return e.abrupt("return",void 0);case 13:case"end":return e.stop()}}),e,this)})))}},{key:"clear",value:function(){this.events={}}}])}();function O(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(new Error).stack;return n?n.split("\n").slice(t+1,-e).join("\n").trim():""}function j(t){return new Promise((function(e){return setTimeout(e,t)}))}function C(t,e){if(t===e)return!0;if("object"!==b(t)||"object"!==b(e)||null===t||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0,i=n;o<i.length;o++){var a=i[o];if(!r.includes(a)||!C(t[a],e[a]))return!1}return!0}var L=function(){return d((function t(e){p(this,t),this.abortHandler=e,this.events=new P,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}}])}();L.EventTypes={"event:skipController.abort":"event:skipController.abort"};var I=function(){return d((function t(){p(this,t),this.locked=!1,this.listeners=[],this.unlockListeners=[]}),[{key:"lock",value:function(){return this.locked=!0,this}},{key:"unlock",value:function(){this.locked=!1;var t,e=f(this.listeners);try{for(e.s();!(t=e.n()).done;){(0,t.value)()}}catch(t){e.e(t)}finally{e.f()}var n,r=f(this.unlockListeners);try{for(r.s();!(n=r.n()).done;){(0,n.value)()}}catch(t){r.e(t)}finally{r.f()}return this.listeners=[],this}},{key:"onUnlock",value:function(t){return this.unlockListeners.push(t),t}},{key:"offUnlock",value:function(t){this.unlockListeners=this.unlockListeners.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return x(this,void 0,void 0,l().mark((function t(){var e=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.locked){t.next=2;break}return t.abrupt("return");case 2:return t.abrupt("return",new Promise((function(t){e.listeners.push(t)})));case 3:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locked}}])}(),R=function(){return d((function t(){p(this,t),this.locks=[]}),[{key:"unlock",value:function(t){return t.unlock(),this.off(t),t}},{key:"register",value:function(t){var e=t||new I;return this.locks.push(e),e}},{key:"off",value:function(t){this.locks=this.locks.filter((function(e){return e!==t}))}},{key:"nextUnlock",value:function(){return x(this,void 0,void 0,l().mark((function t(){var e;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.locks.map((function(t){return t.nextUnlock()})),t.abrupt("return",Promise.all(e));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"isLocked",value:function(){return this.locks.some((function(t){return t.isLocked()}))}}])}();function N(t,e){return t?e:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}}function M(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return void 0!==t};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&r in e&&n(t[r],r)&&e[r](t[r],r)}var D=function(){return d((function t(){p(this,t),this.taskToken=null}),[{key:"scheduleTask",value:function(t,e){this.taskToken&&this.taskToken.cancel();var n=!1,r=setTimeout((function(){n||t()}),e);return this.taskToken={cancel:function(){clearTimeout(r),n=!0},isCancelled:function(){return n}},this.taskToken}},{key:"cancelTask",value:function(){return this.taskToken&&(this.taskToken.cancel(),this.taskToken=null),this}}])}();function F(t,e,n){var r=t.indexOf(e);if(-1===r)return t;var o=m(t);return o.splice(r,1),o.splice(n,0,e),o}var B=function(){return d((function t(e,n){p(this,t),this.concurrency=e,this.delay=n,this.tasks=[]}),[{key:"addTask",value:function(t){this.tasks.push(t)}},{key:"start",value:function(){return x(this,void 0,void 0,l().mark((function t(){var e,n=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=function(){return x(n,void 0,void 0,l().mark((function t(){var n;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==this.tasks.length){t.next=2;break}return t.abrupt("return");case 2:return n=this.tasks.splice(0,this.concurrency),t.next=5,Promise.all(n.map((function(t){return t()})));case 5:return t.next=7,j(this.delay);case 7:return t.next=9,e();case 9:case"end":return t.stop()}}),t,this)})))},t.next=3,e();case 3:case"end":return t.stop()}}),t)})))}}])}();function V(t){var e=!1,n=Promise.resolve().then((function(){return e=!0,t()}));return function(){e&&n.then((function(t){t&&t()}))}}function U(t){return U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},U(t)}function G(t,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,W(r.key),r)}}function W(t){var e=function(t,e){if("object"!=U(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=U(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==U(e)?e:e+""}var z=function(){return 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=O(),this._id=""},(e=[{key:"executeAction",value:function(t){return{type:this.type,node:this.contentNode.getChild()}}},{key:"getId",value:function(){return this._id}},{key:"setId",value:function(t){this._id=t}},{key:"setContent",value:function(t){return this.contentNode.setContent(t),this}},{key:"setContentNode",value:function(t){return this.contentNode=t,this}},{key:"getFutureActions",value:function(t){var e=this.contentNode.getChild();return e&&e.action?[e.action]:[]}}])&&G(t.prototype,e),n&&G(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function H(t){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(t)}function $(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */$=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 v?e:v,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",h="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(C([])));x&&x!==n&&r.call(x,a)&&(w=x);var _=b.prototype=v.prototype=Object.create(w);function k(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"==H(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===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===m)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")),m;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(H(e)+" is not iterable")}return g.prototype=b,o(_,"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(_),t},e.awrap=function(t){return{__await:t}},k(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()}))},k(_),c(_,u,"Generator"),c(_,a,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function Y(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,q(r.key),r)}}function q(t){var e=function(t,e){if("object"!=H(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=H(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==H(e)?e:e+""}function X(t,e,n){return e=Z(e),function(t,e){if(e&&("object"==H(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,K()?Reflect.construct(e,n||[],Z(t).constructor):e.apply(t,n))}function K(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(K=function(){return!!t})()}function Z(t){return Z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Z(t)}function Q(t,e){return Q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Q(t,e)}z.ActionTypes={action:"action"};var J=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())}))},tt=function(t){function e(t,n,r){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(o=X(this,e,[t,n,r])).callee=t.getSelf(),o.contentNode.action=o,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Q(t,e)}(e,t),n=e,(r=[{key:"unknownTypeError",value:function(){throw new Error("Unknown action type: "+this.type)}},{key:"resolveAwaitable",value:function(t,e){var n=this,r=e||new A((function(t){return t}));return J(n,void 0,void 0,$().mark((function e(){return $().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t(r.resolve.bind(r),r);case 2:case"end":return e.stop()}}),e)}))),r}},{key:"is",value:function(t,e){return this instanceof t&&this.type===e}}])&&Y(n.prototype,r),o&&Y(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(z);function et(t){return et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},et(t)}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}function ot(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,it(r.key),r)}}function it(t){var e=function(t,e){if("object"!=et(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=et(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==et(e)?e:e+""}function at(t,e,n){return e=lt(e),function(t,e){if(e&&("object"==et(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,st()?Reflect.construct(e,n||[],lt(t).constructor):e.apply(t,n))}function st(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(st=function(){return!!t})()}function ut(t,e,n,r){var o=ct(lt(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function ct(){return ct="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=lt(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}},ct.apply(null,arguments)}function lt(t){return lt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lt(t)}function ft(t,e){return ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ft(t,e)}var pt=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),at(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&&ft(t,e)}(e,t),n=e,i=[{key:"initSound",value:function(t,e){e.getPlaying()||e.setPlaying(new(t.getHowl())(e.getHowlOptions()))}}],(o=[{key:"executeAction",value:function(t){var n=this;if(this.type===r.play){if(e.initSound(t,this.callee),!this.callee.getPlaying())throw new Error("Howl is not initialized");if(this.callee.config.sync&&!this.callee.config.loop){var o=new A((function(t){return t}));return t.playSound(this.callee,(function(){var e;t.stopSound(n.callee),o.resolve({type:n.type,node:null===(e=n.contentNode)||void 0===e?void 0:e.getChild()})})),o}return t.playSound(this.callee,(function(){t.stopSound(n.callee)})),ut(e,"executeAction",this,3)([t])}if(this.type===r.stop)return t.stopSound(this.callee),ut(e,"executeAction",this,3)([t]);if(this.type===r.fade){var i=nt(this.contentNode.getContent(),1)[0],a=i.start,s=i.end,u=i.duration;if(this.callee.getPlaying()){var c=void 0===a?this.callee.getPlaying().volume():a;this.callee.getPlaying().fade(c,s,u,this.callee.getToken())}return ut(e,"executeAction",this,3)([t])}if(this.type===r.setVolume){var l=nt(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().volume(l,this.callee.getToken()),ut(e,"executeAction",this,3)([t])}if(this.type===r.setRate){var f=nt(this.contentNode.getContent(),1)[0];return this.callee.getPlaying()&&this.callee.getPlaying().rate(f,this.callee.getToken()),ut(e,"executeAction",this,3)([t])}if(this.type===r.pause)return this.callee.getPlaying()&&this.callee.getPlaying().pause(this.callee.getToken()),ut(e,"executeAction",this,3)([t]);if(this.type===r.resume)return this.callee.getPlaying()&&this.callee.getPlaying().play(this.callee.getToken()),ut(e,"executeAction",this,3)([t]);throw ut(e,"unknownTypeError",this,3)([])}}])&&ot(n.prototype,o),i&&ot(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,o,i}(tt);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 dt(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 yt(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)?yt(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 yt(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){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,vt(r.key),r)}}function vt(t){var e=function(t,e){if("object"!=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+""}function gt(t,e,n){return e=xt(e),function(t,e){if(e&&("object"==ht(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||[],xt(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,e,n,r){var o=St(xt(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function St(){return St="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=xt(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},St.apply(null,arguments)}function xt(t){return xt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xt(t)}function _t(t,e){return _t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_t(t,e)}pt.ActionTypes=r;var kt,At,Tt=function(t){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),gt(this,n,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_t(t,e)}(n,t),r=n,i=[{key:"handleSceneInit",value:function(t,e,r){var o=dt(t.contentNode.getContent(),1)[0],i="string"==typeof o?e.getSceneByName(o):o;if(!i)throw t._sceneNotFoundError(t.getSceneName(o));return e.isSceneActive(i)?{type:t.type,node:t.contentNode.getChild()}:(e.registerSrcManager(i.srcManager).addScene(i),i.local.init(e.game.getLiveGame().getStorable()),n.registerEventListeners(i,e,(function(){r.resolve({type:t.type,node:t.contentNode.getChild()}),e.stage.next()})),r)}},{key:"registerEventListeners",value:function(t,e,n){t.events.once("event:scene.unmount",(function(){e.offSrcManager(t.srcManager)})),t.events.once("event:scene.mount",(function(){t.state.backgroundMusic&&(pt.initSound(e,t.state.backgroundMusic),t.events.emit("event:scene.setBackgroundMusic",t.state.backgroundMusic,t.config.backgroundMusicFade))})),t.events.any("event:displayable.init").then((function(){n&&n()}))}}],(o=[{key:"applyTransition",value:function(t,e){var n=this,r=(new A).registerSkipController(new L((function(){return t.logger.info("Background Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransition",e).then((function(){r.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),r}},{key:"executeAction",value:function(t){var r=this;if(this.type===e.action)return wt(n,"executeAction",this,3)([t]);if(this.type===e.setBackground)return this.callee.state.background=this.contentNode.getContent()[0],wt(n,"executeAction",this,3)([t]);if(this.type===e.sleep){var o=new A((function(t){return t})),i=this.contentNode.getContent();return new Promise((function(t){"number"==typeof i?setTimeout((function(){t()}),i):A.isAwaitable(i)?i.then(t):null==i||i.then(t)})).then((function(){o.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),o}if(this.type===e.applyTransition){var a=dt(this.contentNode.getContent(),1)[0];return this.applyTransition(t,a)}if(this.is(n,"scene:init")){var s=new A((function(t){return t}));return n.handleSceneInit(this,t,s)}if(this.type===e.exit){t.offSrcManager(this.callee.srcManager).removeScene(this.callee);var u=new A((function(t){return t}));return this.callee.events.once("event:scene.unmount",(function(){u.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),u}if(this.type===e.jumpTo){var c=this.contentNode.getContent()[0],l=this.contentNode,f=t.getStory().getScene(c);if(!f)throw this._sceneNotFoundError(this.getSceneName(c));var p=f.getSceneRoot().contentNode;return p&&l.addChild(p),{type:this.type,node:p}}if(this.type===e.setBackgroundMusic){var h=dt(this.contentNode.getContent(),2),d=h[0],y=h[1];return this.callee.events.emit("event:scene.setBackgroundMusic",d,y||0),wt(n,"executeAction",this,3)([t])}if(this.type===e.preUnmount)return this.callee.events.emit("event:scene.preUnmount"),t.game.getLiveGame().getStorable().removeNamespace(this.callee.local.getNamespaceName()),wt(n,"executeAction",this,3)([t]);if(this.type===e.applyTransform){var m=dt(this.contentNode.getContent(),1)[0],v=new A((function(t){return t})).registerSkipController(new L((function(){return{type:r.type,node:r.contentNode.getChild()}})));return this.callee.events.any("event:displayable.applyTransform",m).then((function(){v.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),v}if(this.type===e.transitionToScene){var g=dt(this.contentNode.getContent(),3),b=g[0],w=g[1],S=g[2];if(w){var x=t.getStory().getScene(w);if(!x)throw this._sceneNotFoundError(this.getSceneName(w));if(!x.config.background)return wt(n,"executeAction",this,3)([t]);b.setSrc(x.config.background)}else S&&b.setSrc(S);return this.applyTransition(t,b)}throw new Error("Unknown scene action type: "+this.type)}},{key:"getFutureActions",value:function(t){var n,r;if(this.type===e.jumpTo){var o=this.contentNode.getContent()[0],i=t.getScene(o,!0);i.isSceneRootConstructed()||i.constructSceneRoot(t);var a=null===(n=t.getScene(o,!0).getSceneRoot())||void 0===n?void 0:n.contentNode;return(null==a?void 0:a.action)?[a.action]:[]}var s=null===(r=this.contentNode.getChild())||void 0===r?void 0:r.action;return s?[s]:[]}},{key:"_sceneNotFoundError",value:function(t){return new Iu("Scene with name ".concat(t," not found")+"\nMake sure you have registered the scene using story.register"+"\nAction: (id: ".concat(this.getId(),") ").concat(this.type)+"\nAt: ".concat(this.__stack))}},{key:"getSceneName",value:function(t){return"string"==typeof t?t:t.name}}])&&mt(r.prototype,o),i&&mt(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,i}(tt);function Et(t){return Et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Et(t)}function Pt(t,e,n){return e=jt(e),function(t,e){if(e&&("object"==Et(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||[],jt(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 jt(t){return jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},jt(t)}function Ct(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Lt(t,e)}function Lt(t,e){return Lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Lt(t,e)}function It(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Rt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mt(r.key),r)}}function Nt(t,e,n){return e&&Rt(t.prototype,e),n&&Rt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Mt(t){var e=function(t,e){if("object"!=Et(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Et(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Et(e)?e:e+""}Tt.ActionTypes=e,(At=kt||(kt={})).TreeNode="TreeNode",At.ContentNode="ContentNode";var Dt,Ft,Bt=function(t){function e(t,n,r){var o;return It(this,e),(o=Pt(this,e,[kt.ContentNode])).child=r||null,o.parent=n||null,o.action=t||null,o}return Ct(e,t),Nt(e,[{key:"setParent",value:function(t){if(t===this)throw new Error("Cannot set parent to itself");return this.parent=t,this}},{key:"setChild",value:function(t){if(t===this)throw new Error("Cannot set child to itself");return this.child=t,t&&t.parent!==this&&t.remove().setParent(this),this}},{key:"getChild",value:function(){return this.child||null}},{key:"getParent",value:function(){return this.parent||null}},{key:"addChild",value:function(t){return this.setChild(t),this}},{key:"removeChild",value:function(t){return t&&this.child===t?(this.child=null,t.setParent(null)):t||(this.child=null),this}},{key:"remove",value:function(){var t;return null===(t=this.parent)||void 0===t||t.removeChild(this),this}},{key:"hasChild",value:function(){return!!this.child}}],[{key:"create",value:function(t){return(new e).setContent(t)}},{key:"forEachParent",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getParent()}},{key:"forEachChild",value:function(t,e){for(var n=new Set,r=t;r&&!n.has(r);)n.add(r),e(r),r=r.getChild()}}])}(function(){return Nt((function t(e){It(this,t),this.type=e,this.content=void 0}),[{key:"setContent",value:function(t){return this.content=t,this}},{key:"getContent",value:function(){return this.content}}])}()),Vt="center",Ut="left",Gt="right";function Wt(t){return Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wt(t)}function zt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ht(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,qt(r.key),r)}}function $t(t,e,n){return e&&Ht(t.prototype,e),n&&Ht(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yt(t,e,n){return(e=qt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qt(t){var e=function(t,e){if("object"!=Wt(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wt(e)?e:e+""}(Ft=Dt||(Dt={})).Left="left",Ft.Center="center",Ft.Right="right";var Xt=Yt(Yt(Yt({},Dt.Left,"33.33%"),Dt.Center,"50%"),Dt.Right,"66.66%"),Kt=function(){function t(){zt(this,t)}return $t(t,null,[{key:"isUnknown",value:function(e){return e===t.Unknown}},{key:"wrap",value:function(t){return Object.assign({left:"auto",top:"auto",right:"auto",bottom:"auto"},t)}},{key:"D2PositionToCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.calc(t.y,t.yoffset),o=this.calc(t.x,t.xoffset),i=n?{bottom:r}:{top:r},a=e?{right:o}:{left:o};return this.wrap(Object.assign(Object.assign({},i),a))}},{key:"calc",value:function(e,n){if(!e||t.isUnknown(e))return"auto";if(void 0===n||t.isUnknown(n))return"calc(".concat(e," + 0px)");var r="number"==typeof e?"".concat(e,"px"):e;return"calc(".concat(r," + (").concat(n,"px))")}},{key:"toCoord2D",value:function(t){if(Zt.isCommonPositionType(t))return Qt.fromCommonPosition(t);if(Qt.isCoord2DPosition(t))return t;if(Jt.isAlignPosition(t))return Qt.fromAlignPosition(t);if("object"===Wt(t)&&["x","y","xoffset","yoffset"].some((function(e){return e in t})))return new Qt(t);throw new Error("Invalid position type")}},{key:"orUnknown",value:function(e){return t.isUnknown(e)||void 0===e?t.Unknown:e}},{key:"mergePosition",value:function(t,e){var n=this.toCoord2D(t),r=this.toCoord2D(e);return Qt.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(Dt).includes(t)}},{key:"isRawCoord2DPosition",value:function(t){return"object"===Wt(t)&&("x"in t||"y"in t||"xoffset"in t||"yoffset"in t)}},{key:"isRawAlignPosition",value:function(t){return"object"===Wt(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 Zt||t instanceof Qt||t instanceof Jt}},{key:"rawPositionToCoord2D",value:function(t){if(this.isRawCommonPositionType(t))return Qt.fromCommonPosition(new Zt(t));if(this.isRawCoord2DPosition(t))return new Qt(t);if(this.isRawAlignPosition(t))return Qt.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")}}])}();Kt.Unknown=Symbol("Unknown");var Zt=function(){function t(e){zt(this,t),this.position=e}return $t(t,[{key:"toCSS",value:function(){return{x:Xt[this.position],y:"50%",xoffset:0,yoffset:0}}}],[{key:"isCommonPositionType",value:function(e){return e instanceof t}}])}();Zt.Positions=Dt;var Qt=function(){function t(e,n){zt(this,t),"object"===Wt(e)?(this.x=Kt.orUnknown(e.x),this.y=Kt.orUnknown(e.y),this.xoffset=Kt.orUnknown(e.xoffset),this.yoffset=Kt.orUnknown(e.yoffset)):(this.x=Kt.orUnknown(e),this.y=Kt.orUnknown(n),this.xoffset=Kt.Unknown,this.yoffset=Kt.Unknown)}return $t(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:Xt[e.position],y:"50%"})}},{key:"fromAlignPosition",value:function(e){return new t({x:Kt.isUnknown(e.xalign)?Kt.Unknown:"".concat(100*e.xalign,"%"),y:Kt.isUnknown(e.yalign)?Kt.Unknown:"".concat(100*e.yalign,"%"),xoffset:e.xoffset,yoffset:e.yoffset})}},{key:"merge",value:function(e,n){return new t({x:Kt.isUnknown(n.x)?e.x:n.x,y:Kt.isUnknown(n.y)?e.y:n.y,xoffset:Kt.isUnknown(n.xoffset)?e.xoffset:n.xoffset,yoffset:Kt.isUnknown(n.yoffset)?e.yoffset:n.yoffset})}}])}(),Jt=function(){function t(e,n){zt(this,t),"object"===Wt(e)?(this.xalign=Kt.orUnknown(e.xalign),this.yalign=Kt.orUnknown(e.yalign),this.xoffset=Kt.orUnknown(e.xoffset),this.yoffset=Kt.orUnknown(e.yoffset)):(this.xalign=Kt.orUnknown(e),this.yalign=Kt.orUnknown(n),this.xoffset=Kt.Unknown,this.yoffset=Kt.Unknown)}return $t(t,[{key:"toCSS",value:function(){return{x:Kt.isUnknown(this.xalign)?this.xalign:"".concat(100*this.xalign,"%"),y:Kt.isUnknown(this.yalign)?this.yalign:"".concat(100*this.yalign,"%"),xoffset:this.xoffset,yoffset:this.yoffset}}}],[{key:"isAlignPosition",value:function(e){return e instanceof t}}])}();function te(t){let e;return()=>(void 0===e&&(e=t()),e)}const ee=te((()=>void 0!==window.ScrollTimeline));class ne{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,e){return Promise.all(this.animations).then(t).catch(e)}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t,e){const n=this.animations.map((n=>ee()&&n.attachTimeline?n.attachTimeline(t):e(n)));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach((e=>e[t]()))}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const re=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},oe=(t,e,n=10)=>{let r="";const o=Math.max(Math.round(e/n),2);for(let e=0;e<o;e++)r+=t(re(0,o-1,e))+", ";return`linear(${r.substring(0,r.length-2)})`},ie=t=>1e3*t,ae=t=>t/1e3;function se(t,e){return e?t*(1e3/e):0}function ue(t,e,n){const r=Math.max(e-5,0);return se(n-t(r),e-r)}const ce=t=>t;let le=ce,fe=ce;const pe=(t,e,n)=>n>e?e:n<t?t:n,he=100,de=10,ye=1,me=0,ve=800,ge=.3,be=.3,we={granular:.01,default:2},Se={granular:.005,default:.5},xe=.01,_e=10,ke=.05,Ae=1,Te=.001;function Ee({duration:t=ve,bounce:e=ge,velocity:n=me,mass:r=ye}){let o,i;le(t<=ie(_e),"Spring duration must be 10 seconds or less");let a=1-e;a=pe(ke,Ae,a),t=pe(xe,_e,ae(t)),a<1?(o=e=>{const r=e*a,o=r*t,i=r-n,s=Oe(e,a),u=Math.exp(-o);return Te-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=Oe(Math.pow(e,2),a);return(-o(e)+Te>0?-1:1)*((i-s)*u)/c}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<Pe;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t=ie(t),isNaN(s))return{stiffness:he,damping:de,duration:t};{const e=Math.pow(s,2)*r;return{stiffness:e,damping:2*a*Math.sqrt(r*e),duration:t}}}const Pe=12;function Oe(t,e){return t*Math.sqrt(1-e*e)}const je=2e4;function Ce(t){let e=0;let n=t.next(e);for(;!n.done&&e<je;)e+=50,n=t.next(e);return e>=je?1/0:e}const Le=["duration","bounce"],Ie=["stiffness","damping","mass"];function Re(t,e){return e.some((e=>void 0!==t[e]))}function Ne(t=be,e=ge){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:o}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],s={done:!1,value:i},{stiffness:u,damping:c,mass:l,duration:f,velocity:p,isResolvedFromDuration:h}=function(t){let e={velocity:me,stiffness:he,damping:de,mass:ye,isResolvedFromDuration:!1,...t};if(!Re(t,Ie)&&Re(t,Le))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(1.2*n),o=r*r,i=2*pe(.05,1,1-t.bounce)*Math.sqrt(o);e={...e,mass:ye,stiffness:o,damping:i}}else{const n=Ee(t);e={...e,...n,mass:ye},e.isResolvedFromDuration=!0}return e}({...n,velocity:-ae(n.velocity||0)}),d=p||0,y=c/(2*Math.sqrt(u*l)),m=a-i,v=ae(Math.sqrt(u/l)),g=Math.abs(m)<5;let b;if(r||(r=g?we.granular:we.default),o||(o=g?Se.granular:Se.default),y<1){const t=Oe(v,y);b=e=>{const n=Math.exp(-y*v*e);return a-n*((d+y*v*m)/t*Math.sin(t*e)+m*Math.cos(t*e))}}else if(1===y)b=t=>a-Math.exp(-v*t)*(m+(d+v*m)*t);else{const t=v*Math.sqrt(y*y-1);b=e=>{const n=Math.exp(-y*v*e),r=Math.min(t*e,300);return a-n*((d+y*v*m)*Math.sinh(r)+t*m*Math.cosh(r))/t}}const w={calculatedDuration:h&&f||null,next:t=>{const e=b(t);if(h)s.done=t>=f;else{let n=0;y<1&&(n=0===t?ie(d):ue(b,t,e));const i=Math.abs(n)<=r,u=Math.abs(a-e)<=o;s.done=i&&u}return s.value=s.done?a:e,s},toString:()=>{const t=Math.min(Ce(w),je),e=oe((e=>w.next(t*e).value),t,30);return t+"ms "+e}};return w}function Me(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(Ce(r),je);return{type:"keyframes",ease:t=>r.next(o*t).value/e,duration:ae(o)}}const De=(t,e,n)=>t+(e-t)*n;function Fe(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=re(0,e,r);t.push(De(n,1,o))}}function Be(t){const e=[0];return Fe(e,t.length-1),e}const Ve=t=>Boolean(t&&t.getVelocity);function Ue(t,e,n){var r;if(t instanceof Element)return[t];if("string"==typeof t){let o=document;e&&(o=e.current);const i=null!==(r=null==n?void 0:n[t])&&void 0!==r?r:o.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}function Ge(t){return"object"==typeof t&&!Array.isArray(t)}function We(t,e,n,r){return"string"==typeof t&&Ge(e)?Ue(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function ze(t){return"function"==typeof t}function He(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 $e=t=>Array.isArray(t)&&"number"!=typeof t[0];function Ye(t,e){return $e(t)?t[((t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t})(0,t.length,e)]:t}function qe(t,e){-1===t.indexOf(e)&&t.push(e)}function Xe(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function Ke(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&&(Xe(t,o),r--)}}(t,o,i);for(let a=0;a<e.length;a++)t.push({value:e[a],at:De(o,i,r[a]),easing:Ye(n,a)})}function Ze(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}function Qe(t,e){for(let n=0;n<t.length;n++)t[n]=t[n]/(e+1)}function Je(t,e,n){return t*(e+1)}function tn(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function en(t,e){return e[t]||(e[t]=[]),e[t]}function nn(t){return Array.isArray(t)?t:[t]}function rn(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const on=t=>"number"==typeof t,an=t=>t.every(on),sn=new WeakMap,un=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],cn=new Set(un),ln={type:"spring",stiffness:500,damping:25,restSpeed:10},fn={type:"keyframes",duration:.8},pn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},hn=(t,{keyframes:e})=>e.length>2?fn:cn.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:ln:pn;function dn(t,e){return t?t[e]||t.default||t:void 0}const yn=!1,mn=!1,vn=!1,gn=t=>null!==t;function bn(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(gn),i=e&&"loop"!==n&&e%2==1?0:o.length-1;return i&&void 0!==r?r:o[i]}const wn=["read","resolveKeyframes","update","preRender","render","postRender"];function Sn(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=wn.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],e.forEach(s),e.clear(),r=!1,o&&(o=!1,u.process(t)))}};return u}(i),t)),{}),{read:s,resolveKeyframes:u,update:c,preRender:l,render:f,postRender:p}=a,h=()=>{const i=mn?o.timestamp:performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(i-o.timestamp,40),1),o.timestamp=i,o.isProcessing=!0,s.process(o),u.process(o),c.process(o),l.process(o),f.process(o),p.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(h))};return{schedule:wn.reduce(((e,i)=>{const s=a[i];return e[i]=(e,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||t(h)),s.schedule(e,i,a)),e}),{}),cancel:t=>{for(let e=0;e<wn.length;e++)a[wn[e]].cancel(t)},state:o,steps:a}}const{schedule:xn,cancel:_n,state:kn,steps:An}=Sn("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:ce,!0),Tn=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function En(t,e,n,r){if(t===e&&n===r)return ce;const o=e=>function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Tn(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>1e-7&&++s<12);return a}(e,0,1,t,n);return t=>0===t||1===t?t:Tn(o(t),e,r)}const Pn=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,On=t=>e=>1-t(1-e),jn=En(.33,1.53,.69,.99),Cn=On(jn),Ln=Pn(Cn),In=t=>(t*=2)<1?.5*Cn(t):.5*(2-Math.pow(2,-10*(t-1))),Rn=t=>1-Math.sin(Math.acos(t)),Nn=On(Rn),Mn=Pn(Rn),Dn=t=>/^0[^.\s]+$/u.test(t);const Fn=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Bn=t=>e=>"string"==typeof e&&e.startsWith(t),Vn=Bn("--"),Un=Bn("var(--"),Gn=t=>!!Un(t)&&Wn.test(t.split("/*")[0].trim()),Wn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,zn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Hn(t,e,n=1){fe(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=zn.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 Fn(t)?parseFloat(t):t}return Gn(o)?Hn(o,e,n+1):o}const $n={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},Yn={...$n,transform:t=>pe(0,1,t)},qn={...$n,default:1},Xn=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Kn=Xn("deg"),Zn=Xn("%"),Qn=Xn("px"),Jn=Xn("vh"),tr=Xn("vw"),er={...Zn,parse:t=>Zn.parse(t)/100,transform:t=>Zn.transform(100*t)},nr=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),rr=t=>t===$n||t===Qn,or=(t,e)=>parseFloat(t.split(", ")[e]),ir=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/u);if(o)return or(o[1],e);{const e=r.match(/^matrix\((.+)\)$/u);return e?or(e[1],t):0}},ar=new Set(["x","y","z"]),sr=un.filter((t=>!ar.has(t)));const ur={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:ir(4,13),y:ir(5,14)};ur.translateX=ur.x,ur.translateY=ur.y;const cr=t=>e=>e.test(t),lr=[$n,Qn,Zn,Kn,tr,Jn,{test:t=>"auto"===t,parse:t=>t}],fr=t=>lr.find(cr(t)),pr=new Set;let hr=!1,dr=!1;function yr(){if(dr){const t=Array.from(pr).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 sr.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)}))}dr=!1,hr=!1,pr.forEach((t=>t.complete())),pr.clear()}function mr(){pr.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(dr=!0)}))}class vr{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?(pr.add(this),hr||(hr=!0,xn.read(mr),xn.resolveKeyframes(yr))):(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),pr.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,pr.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const gr=t=>Math.round(1e5*t)/1e5,br=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const wr=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Sr=(t,e)=>n=>Boolean("string"==typeof n&&wr.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),xr=(t,e,n)=>r=>{if("string"!=typeof r)return r;const[o,i,a,s]=r.match(br);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},_r={...$n,transform:t=>Math.round((t=>pe(0,255,t))(t))},kr={test:Sr("rgb","red"),parse:xr("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+_r.transform(t)+", "+_r.transform(e)+", "+_r.transform(n)+", "+gr(Yn.transform(r))+")"};const Ar={test:Sr("#"),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:kr.transform},Tr={test:Sr("hsl","hue"),parse:xr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Zn.transform(gr(e))+", "+Zn.transform(gr(n))+", "+gr(Yn.transform(r))+")"},Er={test:t=>kr.test(t)||Ar.test(t)||Tr.test(t),parse:t=>kr.test(t)?kr.parse(t):Tr.test(t)?Tr.parse(t):Ar.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?kr.transform(t):Tr.transform(t)},Pr=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Or="number",jr="color",Cr=/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 Lr(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let i=0;const a=e.replace(Cr,(t=>(Er.test(t)?(r.color.push(i),o.push(jr),n.push(Er.parse(t))):t.startsWith("var(")?(r.var.push(i),o.push("var"),n.push(t)):(r.number.push(i),o.push(Or),n.push(parseFloat(t))),++i,"${}"))).split("${}");return{values:n,split:a,indexes:r,types:o}}function Ir(t){return Lr(t).values}function Rr(t){const{split:e,types:n}=Lr(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===Or?gr(t[i]):e===jr?Er.transform(t[i]):t[i]}return o}}const Nr=t=>"number"==typeof t?0:t;const Mr={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(br))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(Pr))||void 0===n?void 0:n.length)||0)>0},parse:Ir,createTransformer:Rr,getAnimatableNone:function(t){const e=Ir(t);return Rr(t)(e.map(Nr))}},Dr=new Set(["brightness","contrast","saturate","opacity"]);function Fr(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(br)||[];if(!r)return t;const o=n.replace(r,"");let i=Dr.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const Br=/\b([a-z-]*)\(.*?\)/gu,Vr={...Mr,getAnimatableNone:t=>{const e=t.match(Br);return e?e.map(Fr).join(" "):t}},Ur={borderWidth:Qn,borderTopWidth:Qn,borderRightWidth:Qn,borderBottomWidth:Qn,borderLeftWidth:Qn,borderRadius:Qn,radius:Qn,borderTopLeftRadius:Qn,borderTopRightRadius:Qn,borderBottomRightRadius:Qn,borderBottomLeftRadius:Qn,width:Qn,maxWidth:Qn,height:Qn,maxHeight:Qn,top:Qn,right:Qn,bottom:Qn,left:Qn,padding:Qn,paddingTop:Qn,paddingRight:Qn,paddingBottom:Qn,paddingLeft:Qn,margin:Qn,marginTop:Qn,marginRight:Qn,marginBottom:Qn,marginLeft:Qn,backgroundPositionX:Qn,backgroundPositionY:Qn},Gr={rotate:Kn,rotateX:Kn,rotateY:Kn,rotateZ:Kn,scale:qn,scaleX:qn,scaleY:qn,scaleZ:qn,skew:Kn,skewX:Kn,skewY:Kn,distance:Qn,translateX:Qn,translateY:Qn,translateZ:Qn,x:Qn,y:Qn,z:Qn,perspective:Qn,transformPerspective:Qn,opacity:Yn,originX:er,originY:er,originZ:Qn},Wr={...$n,transform:Math.round},zr={...Ur,...Gr,zIndex:Wr,size:Qn,fillOpacity:Yn,strokeOpacity:Yn,numOctaves:Wr},Hr={...zr,color:Er,backgroundColor:Er,outlineColor:Er,fill:Er,stroke:Er,borderColor:Er,borderTopColor:Er,borderRightColor:Er,borderBottomColor:Er,borderLeftColor:Er,filter:Vr,WebkitFilter:Vr},$r=t=>Hr[t];function Yr(t,e){let n=$r(t);return n!==Vr&&(n=Mr),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const qr=new Set(["auto","none","0"]);class Xr extends vr{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(),Gn(r))){const o=Hn(r,e.current);void 0!==o&&(t[n]=o),n===t.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!nr.has(n)||2!==t.length)return;const[r,o]=t,i=fr(r),a=fr(o);if(i!==a)if(rr(i)&&rr(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||Dn(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&&!qr.has(e)&&Lr(e).values.length&&(r=t[o]),o++}if(r&&n)for(const o of e)t[o]=Yr(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=ur[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]=ur[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 Kr;function Zr(){Kr=void 0}const Qr={now:()=>(void 0===Kr&&Qr.set(kn.isProcessing||mn?kn.timestamp:performance.now()),Kr),set:t=>{Kr=t,queueMicrotask(Zr)}},Jr=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Mr.test(t)&&"0"!==t||t.startsWith("url(")));class to{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=Qr.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||(mr(),yr()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Qr.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 le(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||ze(n))&&r)}(t,n,r,o)){if(vn||!i)return null==s||s(bn(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)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function eo({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:u,restDelta:c=.5,restSpeed:l}){const f=t[0],p={done:!1,value:f},h=t=>void 0===s?u:void 0===u||Math.abs(s-t)<Math.abs(u-t)?s:u;let d=n*e;const y=f+d,m=void 0===a?y:a(y);m!==y&&(d=m-f);const v=t=>-d*Math.exp(-t/r),g=t=>m+v(t),b=t=>{const e=v(t),n=g(t);p.done=Math.abs(e)<=c,p.value=p.done?m:n};let w,S;const x=t=>{var e;(e=p.value,void 0!==s&&e<s||void 0!==u&&e>u)&&(w=t,S=Ne({keyframes:[p.value,h(p.value)],velocity:ue(g,t,p.value),damping:o,stiffness:i,restDelta:c,restSpeed:l}))};return x(0),{calculatedDuration:null,next:t=>{let e=!1;return S||void 0!==w||(e=!0,b(t),x(t)),void 0!==w&&t>=w?S.next(t-w):(!e&&b(t),p)}}}const no=En(.42,0,1,1),ro=En(0,0,.58,1),oo=En(.42,0,.58,1),io=t=>Array.isArray(t)&&"number"==typeof t[0],ao={linear:ce,easeIn:no,easeInOut:oo,easeOut:ro,circIn:Rn,circInOut:Mn,circOut:Nn,backIn:Cn,backInOut:Ln,backOut:jn,anticipate:In},so=t=>{if(io(t)){fe(4===t.length,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,o]=t;return En(e,n,r,o)}return"string"==typeof t?(fe(void 0!==ao[t],`Invalid easing type '${t}'`),ao[t]):t},uo=(t,e)=>n=>e(t(n)),co=(...t)=>t.reduce(uo);function lo(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 fo(t,e){return n=>n>0?e:t}const po=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},ho=[Ar,kr,Tr];function yo(t){const e=(n=t,ho.find((t=>t.test(n))));var n;if(le(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===Tr&&(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=lo(s,r,t+1/3),i=lo(s,r,t),a=lo(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 mo=(t,e)=>{const n=yo(t),r=yo(e);if(!n||!r)return fo(t,e);const o={...n};return t=>(o.red=po(n.red,r.red,t),o.green=po(n.green,r.green,t),o.blue=po(n.blue,r.blue,t),o.alpha=De(n.alpha,r.alpha,t),kr.transform(o))},vo=new Set(["none","hidden"]);function go(t,e){return n=>De(t,e,n)}function bo(t){return"number"==typeof t?go:"string"==typeof t?Gn(t)?fo:Er.test(t)?mo:xo:Array.isArray(t)?wo:"object"==typeof t?Er.test(t)?mo:So:fo}function wo(t,e){const n=[...t],r=n.length,o=t.map(((t,n)=>bo(t)(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}}function So(t,e){const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=bo(t[o])(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}}const xo=(t,e)=>{const n=Mr.createTransformer(e),r=Lr(t),o=Lr(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?vo.has(t)&&!o.values.length||vo.has(e)&&!r.values.length?function(t,e){return vo.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):co(wo(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):(le(!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.`),fo(t,e))};function _o(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return De(t,e,n);return bo(t)(t,e)}function ko(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;if(fe(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||_o,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]||ce:e;i=co(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=re(t[n],t[n+1],e);return a[n](r)};return n?e=>u(pe(t[0],t[i-1],e)):u}function Ao({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=$e(r)?r.map(so):so(r),i={done:!1,value:e[0]},a=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:Be(e),t),s=ko(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 To=t=>{const e=({timestamp:e})=>t(e);return{start:()=>xn.update(e,!0),stop:()=>_n(e),now:()=>kn.isProcessing?kn.timestamp:Qr.now()}},Eo={decay:eo,inertia:eo,tween:Ao,keyframes:Ao,spring:Ne},Po=t=>t/100;class Oo extends to{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)||vr;this.resolver=new i(o,((t,e)=>this.onKeyframesResolved(t,e)),e,n,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:r=0,repeatType:o,velocity:i=0}=this.options,a=ze(e)?e:Eo[e]||Ao;let s,u;a!==Ao&&"number"!=typeof t[0]&&(s=co(Po,_o(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=Ce(c));const{calculatedDuration:l}=c,f=l+r;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:s,calculatedDuration:l,resolvedDuration:f,totalDuration:f*(n+1)-r}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:r,generator:o,mirroredGenerator:i,mapPercentToKeyframes:a,keyframes:s,calculatedDuration:u,totalDuration:c,resolvedDuration:l}=n;if(null===this.startTime)return o.next(0);const{delay:f,repeat:p,repeatType:h,repeatDelay:d,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-c/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const m=this.currentTime-f*(this.speed>=0?1:-1),v=this.speed>=0?m<0:m>c;this.currentTime=Math.max(m,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let g=this.currentTime,b=o;if(p){const t=Math.min(this.currentTime,c)/l;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,p+1);Boolean(e%2)&&("reverse"===h?(n=1-n,d&&(n-=d/l)):"mirror"===h&&(b=i)),g=pe(0,1,n)*l}const w=v?{done:!1,value:s[0]}:b.next(g);a&&(w.value=a(w.value));let{done:S}=w;v||null===u||(S=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const x=null===this.holdTime&&("finished"===this.state||"running"===this.state&&S);return x&&void 0!==r&&(w.value=bn(s,this.options,r)),y&&y(w.value),x&&this.finish(),w}get duration(){const{resolved:t}=this;return t?ae(t.calculatedDuration):0}get time(){return ae(this.currentTime)}set time(t){t=ie(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=ae(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=To,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 jo=new Set(["opacity","clipPath","filter","transform"]),Co={linearEasing:void 0};function Lo(t,e){const n=te(t);return()=>{var t;return null!==(t=Co[e])&&void 0!==t?t:n()}}const Io=Lo((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function Ro(t){return Boolean("function"==typeof t&&Io()||!t||"string"==typeof t&&(t in Mo||Io())||io(t)||Array.isArray(t)&&t.every(Ro))}const No=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Mo={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:No([0,.65,.55,1]),circOut:No([.55,0,1,.45]),backIn:No([.31,.01,.66,-.59]),backOut:No([.33,1.53,.69,.99])};function Do(t,e){return t?"function"==typeof t&&Io()?oe(t,e):io(t)?No(t):Array.isArray(t)?t.map((t=>Do(t,e)||Mo.easeOut)):Mo[t]:void 0}function Fo(t,e,n,{delay:r=0,duration:o=300,repeat:i=0,repeatType:a="loop",ease:s="easeInOut",times:u}={}){const c={[e]:n};u&&(c.offset=u);const l=Do(s,o);return Array.isArray(l)&&(c.easing=l),t.animate(c,{delay:r,duration:o,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}function Bo(t,e){t.timeline=e,t.onfinish=null}const Vo=te((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const Uo={anticipate:In,backInOut:Ln,circInOut:Mn};class Go extends to{constructor(t){super(t);const{name:e,motionValue:n,element:r,keyframes:o}=this.options;this.resolver=new Xr(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;var l;if("string"==typeof i&&Io()&&i in Uo&&(i=Uo[i]),ze((l=this.options).type)||"spring"===l.type||!Ro(l.ease)){const{onComplete:e,onUpdate:n,motionValue:s,element:u,...c}=this.options,l=function(t,e){const n=new Oo({...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 f=Fo(s.owner.current,u,t,{...this.options,duration:r,times:o,ease:i});return f.startTime=null!=c?c:this.calcStartTime(),this.pendingTimeline?(Bo(f,this.pendingTimeline),this.pendingTimeline=void 0):f.onfinish=()=>{const{onComplete:n}=this.options;s.set(bn(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:f,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 ae(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return ae(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=ie(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 ce;const{animation:n}=e;Bo(n,t)}else this.pendingTimeline=t;return ce}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 Oo({...c,keyframes:n,duration:r,type:o,ease:i,times:a,isGenerator:!0}),f=ie(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 Vo()&&n&&jo.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!r&&"mirror"!==o&&0!==i&&"inertia"!==a}}const Wo=(t,e,n,r={},o,i)=>a=>{const s=dn(r,t)||{},u=s.delay||r.delay||0;let{elapsed:c=0}=r;c-=ie(u);let l={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...s,delay:-c,onUpdate:t=>{e.set(t),s.onUpdate&&s.onUpdate(t)},onComplete:()=>{a(),s.onComplete&&s.onComplete()},name:t,motionValue:e,element:i?void 0:o};(function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:u,elapsed:c,...l}){return!!Object.keys(l).length})(s)||(l={...l,...hn(t,l)}),l.duration&&(l.duration=ie(l.duration)),l.repeatDelay&&(l.repeatDelay=ie(l.repeatDelay)),void 0!==l.from&&(l.keyframes[0]=l.from);let f=!1;if((!1===l.type||0===l.duration&&!l.repeatDelay)&&(l.duration=0,0===l.delay&&(f=!0)),(vn||yn)&&(f=!0,l.duration=0,l.delay=0),f&&!i&&void 0!==e.get()){const t=bn(l.keyframes,s);if(void 0!==t)return xn.update((()=>{l.onUpdate(t),l.onComplete()})),new ne([])}return!i&&Go.supports(l)?new Go(l):new Oo(l)},zo=t=>Array.isArray(t);class Ho{constructor(){this.subscriptions=[]}add(t){return qe(this.subscriptions,t),()=>Xe(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 $o={current:void 0};class Yo{constructor(t,e={}){this.version="11.15.0",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const n=Qr.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=Qr.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 Ho);const n=this.events[t].add(e);return"change"===t?()=>{n(),xn.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 $o.current&&$o.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Qr.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return se(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 qo(t,e){return new Yo(t,e)}function Xo(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Ko(t,e,n,r){if("function"==typeof e){const[o,i]=Xo(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]=Xo(r);e=e(void 0!==n?n:t.custom,o,i)}return e}function Zo(t,e,n){const r=t.getProps();return Ko(r,e,void 0!==n?n:r.custom,t)}function Qo(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,qo(n))}const Jo=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ti="data-"+Jo("framerAppearId");function ei(t){return t.props[ti]}function ni(t,e){const n=t.getValue("willChange");if(r=n,Boolean(Ve(r)&&r.add))return n.add(e);var r}function ri({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}function oi(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&&ri(l,e))continue;const s={delay:n,...dn(a||{},e)};let f=!1;if(window.MotionHandoffAnimation){const n=ei(t);if(n){const t=window.MotionHandoffAnimation(n,e,xn);null!==t&&(s.startTime=t,f=!0)}}ni(t,e),r.start(Wo(e,r,o,t.shouldReduceMotion&&cn.has(e)?{type:!1}:s,t,f));const p=r.animation;p&&c.push(p)}return s&&Promise.all(c).then((()=>{xn.update((()=>{s&&function(t,e){const n=Zo(t,e);let{transitionEnd:r={},transition:o={},...i}=n||{};i={...i,...r};for(const e in i)Qo(t,e,(a=i[e],zo(a)?a[a.length-1]||0:a));var a}(t,s)}))})),c}function ii(t){return t instanceof SVGElement&&"svg"!==t.tagName}const ai={};function si(t,{layout:e,layoutId:n}){return cn.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!ai[t]||"opacity"===t)}function ui(t,e,n){var r;const{style:o}=t,i={};for(const a in o)(Ve(o[a])||e.style&&Ve(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 i}function ci(t,e,n){const r=ui(t,e,n);for(const n in t)if(Ve(t[n])||Ve(e[n])){r[-1!==un.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return r}const li="undefined"!=typeof window,fi={current:null},pi={current:!1};function hi(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function di(t){return"string"==typeof t||Array.isArray(t)}const yi=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],mi=["initial",...yi];function vi(t){return hi(t.animate)||mi.some((e=>di(t[e])))}function gi(t){return Boolean(vi(t)||t.variants)}const bi={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"]},wi={};for(const t in bi)wi[t]={isEnabled:e=>bi[t].some((t=>!!e[t]))};const Si=[...lr,Er,Mr],xi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),_i=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class ki{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:o,visualState:i},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=vr,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=Qr.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,xn.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=vi(e),this.isVariantNode=gi(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]&&Ve(e)&&e.set(s[t],!1)}}mount(t){this.current=t,sn.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))),pi.current||function(){if(pi.current=!0,li)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>fi.current=t.matches;t.addListener(e),e()}else fi.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||fi.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){sn.delete(this.current),this.projection&&this.projection.unmount(),_n(this.notifyUpdate),_n(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=cn.has(t),r=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&&xn.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 wi){const e=wi[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<_i.length;e++){const n=_i[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(Ve(o))t.addValue(r,o);else if(Ve(i))t.addValue(r,qo(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,qo(void 0!==e?e:o,{owner:t}))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=qo(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&&(Fn(r)||Dn(r))?r=parseFloat(r):(o=r,!Si.find(cr(o))&&Mr.test(e)&&(r=Yr(t,e))),this.setBaseTarget(t,Ve(r)?r.get():r)),Ve(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=Ko(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||Ve(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 Ho),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class Ai extends ki{constructor(){super(...arguments),this.KeyframeResolver=Xr}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]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ve(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}const Ti=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Ei={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Pi=un.length;function Oi(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(cn.has(t))a=!0;else if(Vn(t))o[t]=n;else{const e=Ti(n,zr[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<Pi;i++){const a=un[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=Ti(s,zr[a]);u||(o=!1,r+=`${Ei[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 ji(t,e,n){return"string"==typeof t?t:Qn.transform(e+n*t)}const Ci={offset:"stroke-dashoffset",array:"stroke-dasharray"},Li={offset:"strokeDashoffset",array:"strokeDasharray"};function Ii(t,{attrX:e,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:u=0,...c},l,f){if(Oi(t,c,f),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:p,style:h,dimensions:d}=t;p.transform&&(d&&(h.transform=p.transform),delete p.transform),d&&(void 0!==o||void 0!==i||h.transform)&&(h.transformOrigin=function(t,e,n){return`${ji(e,t.x,t.width)} ${ji(n,t.y,t.height)}`}(d,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(p.x=e),void 0!==n&&(p.y=n),void 0!==r&&(p.scale=r),void 0!==a&&function(t,e,n=1,r=0,o=!0){t.pathLength=1;const i=o?Ci:Li;t[i.offset]=Qn.transform(-r);const a=Qn.transform(e),s=Qn.transform(n);t[i.array]=`${a} ${s}`}(p,a,s,u,!1)}const Ri=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 Ni(t,{style:e,vars:n},r,o){Object.assign(t.style,e,o&&o.getProjectionStyles(r));for(const e in n)t.style.setProperty(e,n[e])}function Mi(t,e,n,r){Ni(t,e,void 0,r);for(const n in e.attrs)t.setAttribute(Ri.has(n)?n:Jo(n),e.attrs[n])}const Di=t=>"string"==typeof t&&"svg"===t.toLowerCase();class Fi extends Ai{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=xi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(cn.has(e)){const t=$r(e);return t&&t.default||0}return e=Ri.has(e)?e:Jo(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return ci(t,e,n)}build(t,e,n){Ii(t,e,this.isSVGTag,n.transformTemplate)}renderInstance(t,e,n,r){Mi(t,e,0,r)}mount(t){this.isSVGTag=Di(t.tagName),super.mount(t)}}function Bi({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Vi(t){return void 0===t||1===t}function Ui({scale:t,scaleX:e,scaleY:n}){return!Vi(t)||!Vi(e)||!Vi(n)}function Gi(t){return Ui(t)||Wi(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Wi(t){return zi(t.x)||zi(t.y)}function zi(t){return t&&"0%"!==t}function Hi(t,e,n){return n+e*(t-n)}function $i(t,e,n,r,o){return void 0!==o&&(t=Hi(t,o,r)),Hi(t,n,r)+e}function Yi(t,e=0,n=1,r,o){t.min=$i(t.min,e,n,r,o),t.max=$i(t.max,e,n,r,o)}function qi(t,{x:e,y:n}){Yi(t.x,e.translate,e.scale,e.originPoint),Yi(t.y,n.translate,n.scale,n.originPoint)}const Xi=.999999999999,Ki=1.0000000000001;function Zi(t,e){t.min=t.min+e,t.max=t.max+e}function Qi(t,e,n,r,o=.5){Yi(t,e,n,De(t.min,t.max,o),r)}function Ji(t,e){Qi(t.x,e.x,e.scaleX,e.scale,e.originX),Qi(t.y,e.y,e.scaleY,e.scale,e.originY)}function ta(t,e){return Bi(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 ea extends Ai{constructor(){super(...arguments),this.type="html",this.renderInstance=Ni}readValueFromInstance(t,e){if(cn.has(e)){const t=$r(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(Vn(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return ta(t,e)}build(t,e,n){Oi(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return ui(t,e,n)}}class na extends ki{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function ra(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=ii(t)?new Fi(e):new ea(e);n.mount(t),sn.set(t,n)}function oa(t){const e=new na({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),sn.set(t,e)}function ia(t,e,n){const r=Ve(t)?t:qo(t);return r.start(Wo("",r,e,n)),r.animation}function aa(t,e,n,r){const o=[];if(function(t,e){return Ve(t)||"number"==typeof t||"string"==typeof t&&!Ge(e)}(t,e))o.push(ia(t,Ge(e)&&e.default||e,n&&n.default||n));else{const i=We(t,e,r),a=i.length;fe(Boolean(a),"No valid elements provided.");for(let t=0;t<a;t++){const r=i[t],s=r instanceof Element?ra:oa;sn.has(r)||s(r);const u=sn.get(r),c={...n};"delay"in c&&"function"==typeof c.delay&&(c.delay=c.delay(t,a)),o.push(...oi(u,{...e,transition:c},{}))}}return o}function sa(t,e,n){const r=[],o=function(t,{defaultTransition:e={},...n}={},r,o){const i=e.duration||.3,a=new Map,s=new Map,u={},c=new Map;let l=0,f=0,p=0;for(let n=0;n<t.length;n++){const a=t[n];if("string"==typeof a){c.set(a,f);continue}if(!Array.isArray(a)){c.set(a.name,He(f,a.at,l,c));continue}let[h,d,y={}]=a;void 0!==y.at&&(f=He(f,y.at,l,c));let m=0;const v=(t,n,r,a=0,s=0)=>{const u=nn(t),{delay:c=0,times:l=Be(u),type:h="keyframes",repeat:d,repeatType:y,repeatDelay:v=0,...g}=n;let{ease:b=e.ease||"easeOut",duration:w}=n;const S="function"==typeof c?c(a,s):c,x=u.length,_=ze(h)?h:null==o?void 0:o[h];if(x<=2&&_){let t=100;if(2===x&&an(u)){const e=u[1]-u[0];t=Math.abs(e)}const e={...g};void 0!==w&&(e.duration=ie(w));const n=Me(e,t,_);b=n.ease,w=n.duration}null!=w||(w=i);const k=f+S;1===l.length&&0===l[0]&&(l[1]=1);const A=l.length-u.length;if(A>0&&Fe(l,A),1===u.length&&u.unshift(null),d){fe(d<20,"Repeat count too high, must be less than 20"),w=Je(w,d);const t=[...u],e=[...l];b=Array.isArray(b)?[...b]:[b];const n=[...b];for(let r=0;r<d;r++){u.push(...t);for(let o=0;o<t.length;o++)l.push(e[o]+(r+1)),b.push(0===o?"linear":Ye(n,o-1))}Qe(l,d)}const T=k+w;Ke(r,u,b,l,k,T),m=Math.max(S+w,m),p=Math.max(T,p)};if(Ve(h))v(d,y,en("default",tn(h,s)));else{const t=We(h,d,r,u),e=t.length;for(let n=0;n<e;n++){const r=tn(t[n],s);for(const t in d)v(d[t],rn(y,t),en(t,r),n,e)}}l=f,f+=m}return s.forEach(((t,r)=>{for(const o in t){const i=t[o];i.sort(Ze);const s=[],u=[],c=[];for(let t=0;t<i.length;t++){const{at:e,value:n,easing:r}=i[t];s.push(n),u.push(re(0,p,e)),c.push(r||"easeOut")}0!==u[0]&&(u.unshift(0),s.unshift(s[0]),c.unshift("easeInOut")),1!==u[u.length-1]&&(u.push(1),s.push(null)),a.has(r)||a.set(r,{keyframes:{},transition:{}});const l=a.get(r);l.keyframes[o]=s,l.transition[o]={...e,duration:p,ease:c,times:u,...n}}})),a}(t,e,n,{spring:Ne});return o.forEach((({keyframes:t,transition:e},n)=>{r.push(...aa(n,t,e))})),r}const ua=function(t,e,n){let r=[];var o;o=t,r=Array.isArray(o)&&Array.isArray(o[0])?sa(t,e,ca):aa(t,e,n,ca);const i=new ne(r);return ca&&ca.animations.push(i),i};var ca;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 fa(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */fa=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 v?e:v,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",h="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(C([])));x&&x!==n&&r.call(x,a)&&(w=x);var _=b.prototype=v.prototype=Object.create(w);function k(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"==la(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===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===m)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")),m;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(la(e)+" is not iterable")}return g.prototype=b,o(_,"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(_),t},e.awrap=function(t){return{__await:t}},k(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()}))},k(_),c(_,u,"Generator"),c(_,a,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function pa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=da(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 ha(t){return function(t){if(Array.isArray(t))return ya(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||da(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 da(t,e){if(t){if("string"==typeof t)return ya(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)?ya(t,e):void 0}}function ya(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 ma(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ga(r.key),r)}}function va(t,e,n){return(e=ga(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ga(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+""}var ba=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},wa=va(va(va({},Ut,"25.33%"),Vt,"50%"),Gt,"75.66%"),Sa=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,ha(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 e=t,n=[{key:"animate",value:function(e,n,r){var o=e.scope,i=e.overwrites,a=e.target;return ba(this,void 0,void 0,fa().mark((function e(){var s=this;return fa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){ba(s,void 0,void 0,fa().mark((function s(){var u,c,l,f,p=this;return fa().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:this.sequenceOptions.sync||e(),u=0;case 2:if(!(u<this.sequenceOptions.repeat)){s.next=22;break}c=pa(this.sequences),s.prev=4,f=fa().mark((function e(){var r,s,u,c,f,h;return fa().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.value,s=r.props,u=r.options,c=k({},p.propToCSS(n,a.state)),o.current){e.next=4;break}throw new Error("No scope found when animating.");case 4:if(f=o.current,Object.assign(f.style,c),a.state=t.mergeState(a.state,s),h=ua(f,p.propToCSS(n,a.state,i),p.optionsToFramerMotionOptions(u)||{}),p.setControl(h),n.logger.debug("Animating",p.propToCSS(n,a.state,i)),!1!==(null==u?void 0:u.sync)){e.next=14;break}h.then((function(){Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null)})),e.next=18;break;case 14:return e.next=16,new Promise((function(t){return h.then((function(){return t()}))}));case 16:Object.assign(f.style,p.propToCSS(n,a.state,i)),p.setControl(null);case 18:case"end":return e.stop()}}),e)})),c.s();case 7:if((l=c.n()).done){s.next=11;break}return s.delegateYield(f(),"t0",9);case 9:s.next=7;break;case 11:s.next=16;break;case 13:s.prev=13,s.t1=s.catch(4),c.e(s.t1);case 16:return s.prev=16,c.f(),s.finish(16);case 19:u++,s.next=2;break;case 22:return s.next=24,j(2);case 24:this.setControl(null),e(),r&&r(a.state);case 27:case"end":return s.stop()}}),s,this,[[4,13,16,19]])})))})));case 1:case"end":return e.stop()}}),e)})))}},{key:"repeat",value:function(t){return this.sequenceOptions.repeat*=t,this}},{key:"overwrite",value:function(t,e){return this.transformers[t]=e,this}},{key:"propToCSS",value:function(e,n,r){var o,i=(null===(o=e.getLastScene())||void 0===o?void 0:o.config)||{},a=i.invertY,s=i.invertX,u={position:function(e){return t.positionToCSS(e,a,s)},backgroundColor:function(e){return t.backgroundToCSS(e)},backgroundOpacity:function(t){return{opacity:t}},opacity:function(t){return{opacity:t}},scale:function(){return{}},rotation:function(){return{}},display:function(){return{}},src:function(){return{}},fontColor:function(t){return"string"==typeof t?{color:t}:{color:E(t)}}},c={};for(var l in c.transform=t.propToCSSTransform(e,n),this.transformers.transform&&Object.assign(c,this.transformers.transform(n)),r&&r.transform&&Object.assign(c,r.transform(n)),n)Object.prototype.hasOwnProperty.call(n,l)&&(r&&r[l]?Object.assign(c,r[l](n[l])):this.transformers[l]?Object.assign(c,this.transformers[l](n[l])):u[l]&&Object.assign(c,u[l](n[l])));return c}},{key:"optionsToFramerMotionOptions",value:function(t){if(!t)return t;var e=t.duration;return{duration:e?e/1e3:0,ease:t.ease}}},{key:"setControl",value:function(t){return this.control=t,this}},{key:"getControl",value:function(){return this.control}},{key:"copy",value:function(){return new t(this.sequences,this.sequenceOptions)}}],r=[{key:"isPosition",value:function(t){return Zt.isCommonPositionType(t)||Qt.isCoord2DPosition(t)||Jt.isAlignPosition(t)}},{key:"immediate",value:function(e){return new t(e,{duration:0,ease:"linear"})}},{key:"left",value:function(e,n){return new t({position:Zt.Positions.Left},{duration:e,ease:n})}},{key:"right",value:function(e,n){return new t({position:Zt.Positions.Right},{duration:e,ease:n})}},{key:"center",value:function(e,n){return new t({position:Zt.Positions.Center},{duration:e,ease:n})}},{key:"positionToCSS",value:function(t,e,n){return t?Kt.isRawPosition(t)?Kt.D2PositionToCSS(Kt.rawPositionToCoord2D(t),n,e):Kt.D2PositionToCSS(t.toCSS(),n,e):{}}},{key:"backgroundToCSS",value:function(t){return null==t?{}:Pu.isStaticImageData(t)?{backgroundImage:"url(".concat(t.src,")")}:"string"==typeof t?{backgroundColor:t}:["r","g","b"].every((function(e){return e in t}))?{backgroundColor:E(t)}:{backgroundImage:"url("+t.url+")"}}},{key:"mergePosition",value:function(t,e){if(!t&&!e)throw new Error("No position found.");return t&&e?Kt.mergePosition(Kt.tryParsePosition(t),Kt.tryParsePosition(e)):Kt.toCoord2D(Kt.tryParsePosition(t||e))}},{key:"mergeState",value:function(t,e){var n=this.mergePosition(t.position,e.position);return Object.assign(Object.assign({},k(t,e)),{position:n})}},{key:"propToCSSTransform",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.translate,i=void 0===o?[]:o,a=r.scale,s=void 0===a?1:a;if(!t.getLastScene())throw new Error('No scene found in state, make sure you called "scene.activate()" before this method.');var u=void 0!==e.scale?e.scale:1,c=(null===(n=t.getLastScene())||void 0===n?void 0:n.config)||{},l=c.invertY,f=c.invertX;return["translate(".concat(i[0]||(f?"":"-")+"50%",", ").concat(i[1]||(l?"":"-")+"50%",")"),void 0!==e.rotation&&"rotate(".concat(e.rotation,"deg)"),"scale(".concat(u*s,")")].filter(Boolean).join(" ")}}],n&&ma(e.prototype,n),r&&ma(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function xa(t){return xa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xa(t)}function _a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ka(r.key),r)}}function ka(t){var e=function(t,e){if("object"!=xa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=xa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xa(e)?e:e+""}Sa.defaultSequenceOptions={sync:!0,repeat:1},Sa.defaultOptions={duration:0,ease:"linear"},Sa.CommonImagePositionMap=wa;var Aa=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=""},(e=[{key:"setId",value:function(t){this.id=t}},{key:"getId",value:function(){return this.id}},{key:"reset",value:function(){}},{key:"fromData",value:function(t){return this}},{key:"construct",value:function(t){for(var e,n=0;n<t.length;n++){var r=t[n];0!==n&&(null===(e=t[n-1])||void 0===e||e.contentNode.setChild(r.contentNode))}return t}}])&&_a(t.prototype,e),n&&_a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function Ta(t){return Ta="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ta(t)}function Ea(t){return function(t){if(Array.isArray(t))return Ca(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ja(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 Pa(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=ja(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 Oa(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)||ja(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 ja(t,e){if(t){if("string"==typeof t)return Ca(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ca(t,e):void 0}}function Ca(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function La(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */La=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof v?e:v,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",h="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(C([])));x&&x!==n&&r.call(x,a)&&(w=x);var _=b.prototype=v.prototype=Object.create(w);function k(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"==Ta(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===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===m)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")),m;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Ta(e)+" is not iterable")}return g.prototype=b,o(_,"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(_),t},e.awrap=function(t){return{__await:t}},k(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()}))},k(_),c(_,u,"Generator"),c(_,a,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function Ia(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"!=Ta(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ta(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ta(e)?e:e+""}function Na(t,e,n){return e=Ba(e),function(t,e){if(e&&("object"==Ta(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,Ma()?Reflect.construct(e,n||[],Ba(t).constructor):e.apply(t,n))}function Ma(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ma=function(){return!!t})()}function Da(t,e,n,r){var o=Fa(Ba(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Fa(){return Fa="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Ba(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}},Fa.apply(null,arguments)}function Ba(t){return Ba=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ba(t)}function Va(t,e){return Va=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Va(t,e)}var Ua,Ga=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Wa=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Na(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&&Va(t,e)}(e,t),n=e,(r=[{key:"executeAllActions",value:function(t,e){return Ga(this,void 0,void 0,La().mark((function n(){var r,o,i;return La().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!1,o=e,i=La().mark((function e(){var n,r,i;return La().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.game.getLiveGame().executeAction(t,o),t.logger.debug("Control - Next Action",n),n){e.next=4;break}return e.abrupt("return",0);case 4:if(!A.isAwaitable(n)){e.next=16;break}return e.next=7,new Promise((function(t){n.then((function(e){return t(n.result)}))}));case 7:if(r=e.sent,!(i=r.node)){e.next=13;break}o=i.action,e.next=14;break;case 13:return e.abrupt("return",0);case 14:e.next=17;break;case 16:o=n;case 17:case"end":return e.stop()}}),e)}));case 3:if(r||!o){n.next=10;break}return n.delegateYield(i(),"t0",5);case 5:if(0!==n.t0){n.next=8;break}return n.abrupt("break",10);case 8:n.next=3;break;case 10:case"end":return n.stop()}}),n)})))}},{key:"executeSingleAction",value:function(t,e){var n=t.game.getLiveGame().executeAction(t,e);return A.isAwaitable(n)?new Promise((function(e){n.then((function(r){var o;t.logger.debug("Control - Next Action (single)",n),e((null===(o=n.result)||void 0===o?void 0:o.node)||null)}))})):Promise.resolve((null==n?void 0:n.contentNode)||null)}},{key:"execute",value:function(t,n,r){var o=this;return r.length>0?(this.executeAllActions(t,r[0]).then((function(){n.resolve({type:o.type,node:o.contentNode.getChild()}),t.stage.next()})),n):Da(e,"executeAction",this,3)([t])}},{key:"executeAction",value:function(t){var n=this,r=Oa(this.contentNode.getContent(),1)[0];if(this.type===a.do){var o=new A((function(t){return t}));return this.execute(t,o,r)}if(this.type===a.doAsync)return Ga(n,void 0,void 0,La().mark((function e(){return La().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length>0)){e.next=3;break}return e.next=3,this.executeAllActions(t,r[0]);case 3:case"end":return e.stop()}}),e,this)}))),Da(e,"executeAction",this,3)([t]);if(this.type===a.any){var i=new A((function(t){return t})),s=r.map((function(e){return n.executeSingleAction(t,e)}));return Promise.any(s).then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if(this.type===a.all){var u=new A((function(t){return t}));return Promise.all(r.map((function(e){return n.executeSingleAction(t,e)}))).then((function(){u.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),u}if(this.type===a.allAsync)return Ga(n,void 0,void 0,La().mark((function e(){var n,o,i;return La().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Pa(r);try{for(n.s();!(o=n.n()).done;)i=o.value,this.executeSingleAction(t,i).then((function(t){}))}catch(t){n.e(t)}finally{n.f()}case 2:case"end":return e.stop()}}),e,this)}))),Da(e,"executeAction",this,3)([t]);if(this.type===a.repeat){var c=Oa(this.contentNode.getContent(),2),l=c[0],f=c[1],p=new A((function(t){return t}));return Ga(n,void 0,void 0,La().mark((function e(){var n;return La().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!(n<f)){e.next=8;break}if(!(l.length>0)){e.next=5;break}return e.next=5,this.executeAllActions(t,l[0]);case 5:n++,e.next=1;break;case 8:p.resolve({type:this.type,node:this.contentNode.getChild()}),t.stage.next();case 10:case"end":return e.stop()}}),e,this)}))),p}if(this.type===a.sleep){var h=new A((function(t){return t})),d=Oa(this.contentNode.getContent(),2)[1];return new Promise((function(t){"number"==typeof d?setTimeout((function(){t()}),d):A.isAwaitable(d)?d.then(t):null==d||d.then(t)})).then((function(){h.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),h}throw new Error("Unknown control action type: "+this.type)}},{key:"getFutureActions",value:function(t){var n=this.contentNode.getContent()[0],r=Da(e,"getFutureActions",this,3)([t]);return[].concat(Ea(n),Ea(r))}}])&&Ia(n.prototype,r),o&&Ia(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(tt);function za(t){return za="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},za(t)}function Ha(t){return function(t){if(Array.isArray(t))return $a(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 $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)||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 $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 Ya(t,e,n){return e=Xa(e),function(t,e){if(e&&("object"==za(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,qa()?Reflect.construct(e,n||[],Xa(t).constructor):e.apply(t,n))}function qa(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(qa=function(){return!!t})()}function Xa(t){return Xa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xa(t)}function Ka(t,e){return Ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ka(t,e)}function Za(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ts(r.key),r)}}function Ja(t,e,n){return e&&Qa(t.prototype,e),n&&Qa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function ts(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+""}Wa.ActionTypes=a;var es=Symbol("_Chained"),ns=function(){function t(e){Za(this,t),this[Ua]=!0,this.__actions=[],this.__self=e}return Ja(t,[{key:"push",value:function(){var t;(t=this.__actions).push.apply(t,arguments)}},{key:"getActions",value:function(){return this.__actions}},{key:"getSelf",value:function(){return this.__self}},{key:"newChain",value:function(){return this.getSelf().chain()}}],[{key:"isChained",value:function(t){return t&&t[es]}},{key:"toActions",value:function(e){return e.flat(2).map((function(e){return t.isChained(e)?e.fromChained(e):e})).flat(3)}}])}();Ua=es;var rs=function(t){function e(){return Za(this,e),Ya(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&&Ka(t,e)}(e,t),Ja(e,[{key:"chain",value:function(t){var e=ns.isChained(this)?this:this.proxy(this,new ns(this));if(!t)return e;var n=Array.isArray(t)?t:[t];return e.push.apply(e,Ha(n)),e}},{key:"proxy",value:function(t,e){var n=new Proxy(t,{get:function(t,r){if(r in e)return e[r];var o=t[r];return"function"==typeof o?o.bind(n):o},set:function(t,e,n){return t[e]=n,!0}});return n}},{key:"combineActions",value:function(t,e){var n=e(this.chain().newChain()),r=new Wa(t.chain(),Wa.ActionTypes.do,(new Bt).setContent([this.construct(ns.toActions([n]))]));return this.chain(r)}}])}(Aa);function os(t){return os="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},os(t)}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,as(r.key),r)}}function as(t){var e=function(t,e){if("object"!=os(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=os(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==os(e)?e:e+""}function ss(t,e,n){return e=cs(e),function(t,e){if(e&&("object"==os(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,us()?Reflect.construct(e,n||[],cs(t).constructor):e.apply(t,n))}function us(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(us=function(){return!!t})()}function cs(t){return cs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cs(t)}function ls(t,e){return ls=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ls(t,e)}var fs=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ss(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&&ls(t,e)}(e,t),n=e,(r=[{key:"toData",value:function(){return null}},{key:"fromChained",value:function(t){return t.getActions()}}])&&is(n.prototype,r),o&&is(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(rs);function ps(t){return ps="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ps(t)}function hs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ds(r.key),r)}}function ds(t){var e=function(t,e){if("object"!=ps(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ps(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ps(e)?e:e+""}function ys(t,e,n){return e=vs(e),function(t,e){if(e&&("object"==ps(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,ms()?Reflect.construct(e,n||[],vs(t).constructor):e.apply(t,n))}function ms(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ms=function(){return!!t})()}function vs(t){return vs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vs(t)}function gs(t,e){return gs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gs(t,e)}var bs=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ys(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&&gs(t,e)}(e,t),n=e,r=[{key:"do",value:function(t){return this.push(Wa.ActionTypes.do,t)}},{key:"doAsync",value:function(t){return this.push(Wa.ActionTypes.doAsync,t)}},{key:"any",value:function(t){return this.push(Wa.ActionTypes.any,t)}},{key:"all",value:function(t){return this.push(Wa.ActionTypes.all,t)}},{key:"allAsync",value:function(t){return this.push(Wa.ActionTypes.allAsync,t)}},{key:"repeat",value:function(t,e){return this.push(Wa.ActionTypes.repeat,e,t)}},{key:"sleep",value:function(t){return this.push(Wa.ActionTypes.sleep,[],t)}},{key:"push",value:function(t,e){for(var n=ns.toActions(e),r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=new Wa(this.chain(),t,(new Bt).setContent([this.construct(n)].concat(o)));return this.chain(a)}}],o=[{key:"do",value:function(t){return(new e).do(t)}},{key:"doAsync",value:function(t){return(new e).doAsync(t)}},{key:"any",value:function(t){return(new e).any(t)}},{key:"all",value:function(t){return(new e).all(t)}},{key:"allAsync",value:function(t){return(new e).allAsync(t)}},{key:"repeat",value:function(t,n){return(new e).repeat(t,n)}},{key:"sleep",value:function(t){return(new e).sleep(t)}}],r&&hs(n.prototype,r),o&&hs(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(fs);function ws(t){return ws="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ws(t)}function Ss(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,xs(r.key),r)}}function xs(t){var e=function(t,e){if("object"!=ws(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ws(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ws(e)?e:e+""}function _s(t,e,n){return e=Es(e),function(t,e){if(e&&("object"==ws(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ks()?Reflect.construct(e,n||[],Es(t).constructor):e.apply(t,n))}function ks(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ks=function(){return!!t})()}function As(t,e,n,r){var o=Ts(Es(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=Es(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){return Es=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Es(t)}function Ps(t,e){return Ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ps(t,e)}var Os=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),_s(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&&Ps(t,e)}(e,t),n=e,(r=[{key:"executeAction",value:function(t){var n=t.getLastSceneIfNot();if(this.type===u.layerMoveUp)return t.moveUpElement(n,this.callee),t.stage.update(),As(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveDown)return t.moveDownElement(n,this.callee),t.stage.update(),As(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveTop)return t.moveTopElement(n,this.callee),t.stage.update(),As(e,"executeAction",this,3)([t]);if(this.type===u.layerMoveBottom)return t.moveBottomElement(n,this.callee),t.stage.update(),As(e,"executeAction",this,3)([t]);throw this.unknownTypeError()}}])&&Ss(n.prototype,r),o&&Ss(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(tt);function js(t){return js="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},js(t)}function Cs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ls(r.key),r)}}function Ls(t){var e=function(t,e){if("object"!=js(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=js(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==js(e)?e:e+""}function Is(t,e,n){return e=Ns(e),function(t,e){if(e&&("object"==js(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Rs()?Reflect.construct(e,n||[],Ns(t).constructor):e.apply(t,n))}function Rs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Rs=function(){return!!t})()}function Ns(t){return Ns=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ns(t)}function Ms(t,e){return Ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ms(t,e)}Os.ActionTypes=u;var Ds=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Is(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&&Ms(t,e)}(e,t),n=e,(r=[{key:"layerMoveUp",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveUp))}},{key:"layerMoveDown",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveDown))}},{key:"layerMoveTop",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveTop))}},{key:"layerMoveBottom",value:function(){var t=this.chain();return this.chain(this.constructLayerAction(t,u.layerMoveBottom))}},{key:"constructLayerAction",value:function(t,e){return new Os(t,e,new Bt)}}])&&Cs(n.prototype,r),o&&Cs(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(fs);function Fs(t){return Fs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fs(t)}function Bs(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Us(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 Vs(t){return function(t){if(Array.isArray(t))return Gs(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Us(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 Us(t,e){if(t){if("string"==typeof t)return Gs(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)?Gs(t,e):void 0}}function Gs(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ws(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zs(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 Hs(t,e,n){return e&&zs(t.prototype,e),n&&zs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function $s(t){var e=function(t,e){if("object"!=Fs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Fs(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Fs(e)?e:e+""}function Ys(t,e,n){return e=Xs(e),function(t,e){if(e&&("object"==Fs(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,qs()?Reflect.construct(e,n||[],Xs(t).constructor):e.apply(t,n))}function qs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(qs=function(){return!!t})()}function Xs(t){return Xs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xs(t)}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&&Zs(t,e)}function Zs(t,e){return Zs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zs(t,e)}Ds.EventTypes={"event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"};var Qs=function(t){function e(){var t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;return Ws(this,e),(t=Ys(this,e)).events=new P,t.ref=void 0,t.name=r.name||"(anonymous)",t.config=k(e.defaultConfig,r,{tag:o||r.tag,position:r.position?Kt.tryParsePosition(r.position):new Zt(Dt.Center),currentTags:(null===(n=r.tag)||void 0===n?void 0:n.defaults)?Vs(r.tag.defaults):null}),t.state=k({},t.config),t.checkConfig(t.config),t}return Ks(e,t),Hs(e,[{key:"dispose",value:function(){return this._dispose()}},{key:"init",value:function(){return this.chain(this._init())}},{key:"checkConfig",value:function(t){var e;if(!Sa.isPosition(t.position))throw new Error("Invalid position\nPosition must be one of CommonImagePosition, Align, Coord2D");if(_(t.src)===_.DataTypes.string&&t.tag)throw this._mixedSrcError();if(!t.src&&!t.tag)throw this._srcNotSpecifiedError();var n,r=Bs(t.wearables);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(!o.config.isWearable)throw this._invalidWearableError(JSON.stringify(o.config))}}catch(t){r.e(t)}finally{r.f()}if(t.tag){var i,a=new Set,s=Bs(t.tag.groups);try{for(s.s();!(i=s.n()).done;){var u,c=Bs(i.value);try{for(c.s();!(u=c.n()).done;){var l=u.value;if(a.has(l))throw this._invalidTagGroupDefinitionError();a.add(l)}}catch(t){c.e(t)}finally{c.f()}}}catch(t){s.e(t)}finally{s.f()}}if(t.tag){var f,p=this.constructTagMap(t.tag.groups),h=new Set,d=Bs(t.tag.defaults);try{for(d.s();!(f=d.n()).done;){var y=f.value;if(h.has(y))throw new Error('Tag conflict\nTag "'.concat(y,'" is conflicting with another tag\nError found in config.tag.defaults'));if(!p.has(y))throw new Error('Tag not found\nTag "'.concat(y,'" is not defined in tagDefinitions\nError found in config.tag.defaults'));null===(e=p.get(y))||void 0===e||e.forEach((function(t){return h.add(t)}))}}catch(t){d.e(t)}finally{d.f()}}return this}},{key:"setSrc",value:function(t,e){var n=this;return this.combineActions(new bs,(function(r){return n._setSrc(r,t,e)}))}},{key:"setAppearance",value:function(t,e){var n=this;return this.combineActions(new bs,(function(r){var o=new hu(r,hu.ActionTypes.setAppearance,(new Bt).setContent([t,null==e?void 0:e.copy()]));return r.chain(o).chain(n._flush())}))}},{key:"applyTransform",value:function(t){var e=this.chain();return e.chain(new hu(e,hu.ActionTypes.applyTransform,(new Bt).setContent([void 0,t.copy(),O()])))}},{key:"show",value:function(t){var e=this,n=t instanceof Sa?t.copy():new Sa([{props:{opacity:1},options:t||{}}]);return this.combineActions(new bs,(function(t){var r=new hu(t,hu.ActionTypes.show,(new Bt).setContent([void 0,n]));return t.chain(r).chain(e._flush())}))}},{key:"hide",value:function(t){var e=this;return this.combineActions(new bs,(function(n){var r=new hu(n,hu.ActionTypes.hide,(new Bt).setContent([void 0,t instanceof Sa?t.copy():new Sa([{props:{opacity:0},options:t||{}}])]));return n.chain(r).chain(e._flush())}))}},{key:"setTags",value:function(t,e){return this.setAppearance(t,e)}},{key:"setPosition",value:function(t,e,n){return this.applyTransform(new Sa({position:t},{duration:e,ease:n}))}},{key:"addWearable",value:function(t){var e,n=Bs(Array.isArray(t)?t:[t]);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.config.wearables.push(r),r.config.isWearable=!0}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"bindWearable",value:function(t){return t.addWearable([this]),this}},{key:"toTransform",value:function(){return new Sa(this.state,{duration:0})}},{key:"setScope",value:function(t){return this.ref=t,this}},{key:"getScope",value:function(){return this.ref}},{key:"copy",value:function(){return new e(this.config)}},{key:"toData",value:function(){return this.state.disposed||C(this.state,this.config)?null:{state:k({},e.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=k(this.state,e.deserializeImageState(t.state)),this}},{key:"_$setDispose",value:function(){return this.state.disposed=!0,this}},{key:"_applyTransition",value:function(t){return this.chain(new hu(this.chain(),"image:applyTransition",(new Bt).setContent([t])))}},{key:"_init",value:function(t){return new hu(this.chain(),hu.ActionTypes.init,(new Bt).setContent([t]))}},{key:"_initWearable",value:function(t){return new hu(this.chain(),hu.ActionTypes.initWearable,(new Bt).setContent([t]))}},{key:"_flush",value:function(){return new hu(this.chain(),hu.ActionTypes.flush,new Bt)}},{key:"reset",value:function(){this.state=k({},this.config)}},{key:"toDisplayableTransform",value:function(){return new Sa(this.state,{duration:0})}},{key:"getTransformState",value:function(){return{position:this.state.position,scale:this.state.scale,rotation:this.state.rotation,opacity:this.state.opacity,display:this.state.display}}},{key:"resolveTags",value:function(t,e){if(!this.state.tag)throw new Error("Tag not defined\nTag must be defined in the image config");var n=this.constructTagMap(this.state.tag.groups),r=new Set,o=function(t){var e,o=Bs(t);try{for(o.s();!(e=o.n()).done;){var i=e.value,a=n.get(i);if(a){var s,u=Bs(a);try{for(u.s();!(s=u.n()).done;){var c=s.value;r.delete(c)}}catch(t){u.e(t)}finally{u.f()}r.add(i)}}}catch(t){o.e(t)}finally{o.f()}};return o(t),o(e),Array.from(r)}},{key:"_mixedSrcError",value:function(){throw new TypeError("To better understand the behavior of the image, you cannot mix src and tags in the same image. If you are using tags, remove the src from the image config and do not use setSrc method. If you are using src, remove the tags from the image config and do not use setAppearance method.")}},{key:"_invalidSrcHandlerError",value:function(){throw new Error("Invalid src handler, If you are using tags, config.src must be a function that resolves the src from the tags. If you are using src, config.src must be a string or StaticImageData")}},{key:"_srcNotSpecifiedError",value:function(){throw new TypeError("Src not specified\nPlease provide a src or tags in the image config")}},{key:"_invalidWearableError",value:function(t){throw new Error("Invalid wearable\nWearable must be an Image with isWearable set to true\nIt seems like you are trying to add a non-wearable image to wearables\nImage below violates the rule:\n"+t)}},{key:"_invalidTagGroupDefinitionError",value:function(){throw new Error("Invalid tag group definition. Tags in groups must be unique and not conflicting with each other.")}},{key:"constructTagMap",value:function(t){var e,n=new Map,r=Bs(t);try{for(r.s();!(e=r.n()).done;){var o,i=e.value,a=Bs(i);try{for(a.s();!(o=a.n()).done;){var s=o.value;n.set(s,i)}}catch(t){a.e(t)}finally{a.f()}}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"_setSrc",value:function(t,e,n){if(n){var r=n.copy();r.setSrc(Pu.srcToString(e)),t._transitionSrc(r)}var o=new hu(t,hu.ActionTypes.setSrc,(new Bt).setContent(["string"==typeof e?e:Pu.staticImageDataToSrc(e)]));return t.chain(o).chain(this._flush())}},{key:"_transitionSrc",value:function(t){var e=t.copy();return this._applyTransition(e),this}},{key:"_dispose",value:function(){return this.chain(new hu(this.chain(),hu.ActionTypes.dispose,new Bt))}}],[{key:"serializeImageState",value:function(t){var e={position:function(t){return Kt.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 Kt.toCoord2D(t)}},n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e[r]?e[r](t[r]):t[r]);return n}},{key:"getSrc",value:function(t){if("string"==typeof t.src||Pu.isStaticImageData(t.src)){var n=t.src;return Pu.isStaticImageData(n)?Pu.staticImageDataToSrc(n):n}var r=t.src,o=t.currentTags;if(!o)throw new Error("Tags not resolved\nTags must be resolved before getting the src");return e.getSrcFromTags(o,r)}},{key:"getSrcFromTags",value:function(t,e){return e.apply(void 0,Vs(t))}},{key:"fromSrc",value:function(t){return new e({src:t})}}])}(Ds);Qs.EventTypes=Object.assign(Object.assign({},Ds.EventTypes),{"event:wearable.create":"event:wearable.create"}),Qs.DefaultImagePlaceholder="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",Qs.defaultConfig={display:!1,position:new Zt(Dt.Center),scale:1,rotation:0,opacity:0,isWearable:!1,wearables:[],src:Qs.DefaultImagePlaceholder,currentTags:null,autoInit:!0};var Js=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ws(this,e),(t=Ys(this,e)).name=n.name||"(anonymous [virtual image proxy])",t.config.opacity=1,t.state.opacity=1,t}return Ks(e,t),Hs(e,[{key:"checkConfig",value:function(t){return this}}])}(Qs);function tu(t){return tu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tu(t)}function eu(t,e){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 nu(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)?nu(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 nu(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 ru(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ru=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 v?e:v,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",h="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(C([])));x&&x!==n&&r.call(x,a)&&(w=x);var _=b.prototype=v.prototype=Object.create(w);function k(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"==tu(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===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===m)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")),m;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(tu(e)+" is not iterable")}return g.prototype=b,o(_,"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(_),t},e.awrap=function(t){return{__await:t}},k(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()}))},k(_),c(_,u,"Generator"),c(_,a,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}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"!=tu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tu(e)?e:e+""}function au(t,e,n){return e=lu(e),function(t,e){if(e&&("object"==tu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,su()?Reflect.construct(e,n||[],lu(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,e,n,r){var o=cu(lu(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function cu(){return cu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=lu(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}},cu.apply(null,arguments)}function lu(t){return lu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lu(t)}function fu(t,e){return fu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fu(t,e)}var pu=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())}))},hu=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),au(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&&fu(t,e)}(e,t),r=e,(o=[{key:"executeAction",value:function(t){var r=this,o=Object.create(null,{executeAction:{get:function(){return uu(e,"executeAction",r,1)}},unknownTypeError:{get:function(){return uu(e,"unknownTypeError",r,1)}}});if(this.type===n.init){if(this.callee.config.isWearable)throw new Error("Cannot init wearable image with init action\nIt seems like you are trying to init a wearable image with an init action, or use this wearable image without parent.");var i=t.findElementByDisplayable(this.callee);i&&t.disposeImage(this.callee,i.scene);var a=this.contentNode.getContent()[0];return t.createImage(this.callee,a),this.resolveAwaitable((function(e){return pu(r,void 0,void 0,ru().mark((function n(){return ru().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:displayable.init");case 2:e(o.executeAction.call(this,t)),t.stage.next();case 4:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.initWearable){var s=eu(this.contentNode.getContent(),1)[0];return this.resolveAwaitable((function(e){return pu(r,void 0,void 0,ru().mark((function n(){return ru().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.callee.events.any("event:wearable.create",s);case 2:return n.next=4,s.events.any("event:displayable.init");case 4:e(o.executeAction.call(this,t)),t.stage.next();case 6:case"end":return n.stop()}}),n,this)})))}))}if(this.type===n.setSrc){if(this.callee.state.tag)throw this.callee._mixedSrcError();return this.callee.state.src=this.contentNode.getContent()[0],t.logger.debug("Image - Set Src",this.callee.state.src),t.stage.update(),o.executeAction.call(this,t)}if([n.show,n.hide,n.applyTransform].includes(this.type)){var u=new A((function(t){return t})).registerSkipController(new L((function(){return r.type===n.hide&&(r.callee.state.display=!1),o.executeAction.call(r,t)}))),c=this.contentNode.getContent()[1];return this.type===n.show&&(this.callee.state.display=!0,t.stage.update()),t.animateImage(Qs.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){var t;r.type===n.hide&&(r.callee.state.display=!1),u.resolve({type:r.type,node:null===(t=r.contentNode)||void 0===t?void 0:t.getChild()})})),u}if(this.type===n.dispose)return t.disposeImage(this.callee),this.callee._$setDispose(),o.executeAction.call(this,t);if(this.type===n.applyTransition){var l=new A((function(t){return t})).registerSkipController(new L((function(){return{type:r.type,node:r.contentNode.getChild()}}))),f=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",f).then((function(){l.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()})),l}if(this.type===n.flush)return o.executeAction.call(this,t);if(this.type===n.setAppearance){var p=eu(this.contentNode.getContent(),2),h=p[0],d=p[1];if(!this.callee.state.tag||!this.callee.state.currentTags)throw this.callee._srcNotSpecifiedError();var y=this.callee.resolveTags(this.callee.state.currentTags,h),m=Qs.getSrcFromTags(y,this.callee.state.src);if(t.logger.debug("Image - Set Appearance",y,m),d){var v=new A((function(t){return t})).registerSkipController(new L((function(){return{type:r.type,node:r.contentNode.getChild()}})));d.setSrc(m),this.callee.events.any("event:displayable.applyTransition",d).then((function(){r.callee.state.currentTags=y,v.resolve({type:r.type,node:r.contentNode.getChild()}),t.stage.next()}))}return this.callee.state.currentTags=y,o.executeAction.call(this,t)}throw o.unknownTypeError.call(this)}}])&&ou(r.prototype,o),i&&ou(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,i}(tt);function du(t){return function(t){if(Array.isArray(t))return yu(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 yu(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)?yu(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 yu(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,n){return e=Su(e),function(t,e){if(e&&("object"==xu(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||[],Su(t).constructor):e.apply(t,n))}function vu(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)}function gu(t){var e="function"==typeof Map?new Map:void 0;return gu=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(bu())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var o=new(t.bind.apply(t,r));return n&&wu(o,n.prototype),o}(t,arguments,Su(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),wu(n,t)},gu(t)}function bu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(bu=function(){return!!t})()}function wu(t,e){return wu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},wu(t,e)}function Su(t){return Su=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Su(t)}function xu(t){return xu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xu(t)}function _u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,Tu(r.key),r)}}function Au(t,e,n){return e&&ku(t.prototype,e),n&&ku(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Tu(t){var e=function(t,e){if("object"!=xu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=xu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xu(e)?e:e+""}hu.ActionTypes=n;var Eu=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;_u(this,t),this.r=e,this.g=n,this.b=r,this.a=o}return Au(t,[{key:"toString",value:function(){return"rgba(".concat(this.r,", ").concat(this.g,", ").concat(this.b,", ").concat(this.a,")")}},{key:"toHex",value:function(){return"#"+this.r.toString(16)+this.g.toString(16)+this.b.toString(16)}},{key:"toImageColor",value:function(){return{r:this.r,g:this.g,b:this.b,a:this.a}}}],[{key:"isHexString",value:function(t){return"string"==typeof t&&/^#[0-9A-F]{6}$/i.test(t)}},{key:"fromHex",value:function(e){var n=e.slice(1);return new t(parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16),8===n.length?parseInt(n.slice(6,8),16)/255:1)}}])}(),Pu=function(){function t(){_u(this,t)}return Au(t,null,[{key:"srcToString",value:function(t){return"string"==typeof t?t:t.src}},{key:"staticImageDataToSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"isStaticImageData",value:function(t){return void 0!==(null==t?void 0:t.src)&&"string"==typeof t.src}},{key:"backgroundToSrc",value:function(e){return t.isStaticImageData(e)?e.src:(null==e?void 0:e.url)||null}},{key:"isExternalSrc",value:function(t){return t.startsWith("http://")||t.startsWith("https://")}},{key:"isImageSrc",value:function(e){return"string"==typeof e&&!this.isHexString(e)||t.isStaticImageData(e)}},{key:"isImageColor",value:function(e){return t.isHexString(e)||t.isPlainColor(e)}},{key:"isPlainColor",value:function(t){return t&&("string"==typeof t||"object"===xu(t)&&"r"in t&&"g"in t&&"b"in t)}},{key:"isHexString",value:function(t){return"string"==typeof t&&/^#([0-9A-F]{6}|[0-9A-F]{3})$/i.test(t)}},{key:"toBackgroundSrc",value:function(t){return"string"==typeof t?t:t.src}},{key:"toHex",value:function(t){return E(t)}}])}();Pu.RGBColor=Eu;var Ou,ju,Cu=function(t){function e(t,n){return _u(this,e),mu(this,e,[t,{info:n},"StaticScriptWarning"])}return vu(e,t),Au(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 _u(this,e),(r=mu(this,e,[t])).props=n,r.name=o,r}return vu(e,t),Au(e,null,[{key:"isUseError",value:function(t){return t instanceof e}}])}(gu(Error))),Lu=function(){return Au((function t(e){_u(this,t),this.scene=e}),[{key:"run",value:function(t){var e=new Map,n=new Map,r=[],o=new Set,i=this.scene.getAllChildren(t,this.scene.getSceneRoot());if(!i.length)return null;for(r.push(i[0]);r.length;){var a=r.shift();this.checkAction(t,a,{imageStates:e,scenes:n},o);var s=a.contentNode.getChild();s&&s.action&&r.push(s.action)}return e}},{key:"checkAction",value:function(t,n,r,o){var i=r.imageStates,a=r.scenes;if(n instanceof hu)i.has(n.callee)||i.set(n.callee,{isDisposed:!1,usedExternalSrc:!1}),this.checkImage(i.get(n.callee),n);else if(n instanceof Tt){var s=n.callee;if(a.has(s.name)){if(a.get(s.name)!==s){var u="Scene with name: ".concat(s.name," is duplicated\nScene: ").concat(s.name,"\n\nAt: ").concat(n.__stack);throw new Cu(u)}}else a.set(s.name,s);if(n.type===e.jumpTo){var c=n.contentNode.getContent()[0],l=t.getScene(c,!0);if(o.has(l))return;o.add(l)}}}},{key:"checkImage",value:function(t,e){if(e.type===n.dispose){if(t.isDisposed){var r="Image is disposed multiple times before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Cu(r)}t.isDisposed=!0}else if([n.init,n.show,n.hide,n.applyTransform,n.applyTransition].includes(e.type)){if(t.isDisposed){var o="Image is disposed before action: ".concat(e.type,"\nImage: ").concat(e.callee.name,"\nAction: ").concat(e.type,"\n\nAt: ").concat(e.__stack);throw new Cu(o)}}else if(e.type===n.setSrc){var i=e.contentNode.getContent()[0];Pu.isExternalSrc(i)&&(t.usedExternalSrc=!0)}}}])}(),Iu=function(t){function e(t,n){var r;return _u(this,e),(r=mu(this,e,[e.toMessage(t,n)])).name="RuntimeScriptError",r}return vu(e,t),Au(e,null,[{key:"toMessage",value:function(t,n){var r=[];return r.push.apply(r,du(Array.isArray(t)?t:[t])),n&&r.push.apply(r,du(Array.isArray(n)?n.map(e.getActionTrace):[e.getActionTrace(n)])),r.join("")}},{key:"getActionTrace",value:function(t){return"\nUsing action (id: ".concat(t.getId(),")")+"\n at: ".concat(t.__stack)}}])}(gu(Error)),Ru=function(t){function e(t){var n;return _u(this,e),(n=mu(this,e,[t])).name="RuntimeGameError",n}return vu(e,t),Au(e)}(gu(Error));function Nu(t){return Nu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nu(t)}function 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,Du(r.key),r)}}function Du(t){var e=function(t,e){if("object"!=Nu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Nu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nu(e)?e:e+""}function Fu(t,e,n){return e=Vu(e),function(t,e){if(e&&("object"==Nu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Bu()?Reflect.construct(e,n||[],Vu(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 Vu(t){return Vu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vu(t)}function Uu(t,e){return Uu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Uu(t,e)}(ju=Ou||(Ou={})).soundEffect="soundEffect",ju.music="music",ju.voice="voice",ju.backgroundMusic="backgroundMusic";var Gu=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=Fu(this,e)).state={playing:null,token:null},t.config=k(e.defaultConfig,"string"==typeof n?{src:n}:n),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Uu(t,e)}(e,t),n=e,o=[{key:"toSoundSrc",value:function(t){return null==t?null:"string"==typeof t?t:t.getSrc()}},{key:"toSound",value:function(t){return null==t?null:"string"==typeof t?new e({src:t}):t}}],(r=[{key:"play",value:function(){if(this.config.type===Ou.backgroundMusic)throw new Error("Background music cannot be played directly");return this.pushAction(pt.ActionTypes.play,[void 0])}},{key:"stop",value:function(){if(this.config.type===Ou.backgroundMusic)throw new Error("Background music cannot be stopped directly");return this.pushAction(pt.ActionTypes.stop,[void 0])}},{key:"fade",value:function(t,e,n){if(this.config.type===Ou.backgroundMusic)throw new Error("Background music cannot be faded directly");return this.pushAction(pt.ActionTypes.fade,[{start:t,end:e,duration:n}])}},{key:"setVolume",value:function(t){return this.pushAction(pt.ActionTypes.setVolume,[t])}},{key:"setRate",value:function(t){return this.pushAction(pt.ActionTypes.setRate,[t])}},{key:"pause",value:function(t){return void 0!==t?this.fade(void 0,0,t):this.pushAction(pt.ActionTypes.pause,[void 0])}},{key:"resume",value:function(t){return void 0!==t?this.fade(0,this.config.volume,t):this.pushAction(pt.ActionTypes.resume,[void 0])}},{key:"getHowlOptions",value:function(t){return Object.assign({src:this.config.src,loop:this.config.loop,volume:this.config.volume,html5:this.config.streaming,autoplay:!1},t||{})}},{key:"getSrc",value:function(){return this.config.src}},{key:"getToken",value:function(){return this.state.token||void 0}},{key:"getPlaying",value:function(){return this.state.playing}},{key:"setToken",value:function(t){this.state.token=void 0===t?null:t}},{key:"setPlaying",value:function(t){return this.state.playing=t,this}},{key:"toData",value:function(){return C(this.config,e.defaultConfig)?null:{config:T(this.config)}}},{key:"fromData",value:function(t){return this.config=k(this.config,t.config),this}},{key:"reset",value:function(){var t;null===(t=this.state.playing)||void 0===t||t.stop(),this.state.playing=null,this.state.token=null}},{key:"pushAction",value:function(t,e){return this.chain(new pt(this.chain(),t,(new Bt).setContent(e)))}}])&&Mu(n.prototype,r),o&&Mu(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(fs);function Wu(t){return Wu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wu(t)}function zu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hu(r.key),r)}}function Hu(t){var e=function(t,e){if("object"!=Wu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wu(e)?e:e+""}Gu.defaultConfig={src:"",sync:!1,loop:!1,volume:1};var $u=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e}return e=t,r=[{key:"from",value:function(e){return t.isPauseConstructor(e)?new t:e}},{key:"wait",value:function(e){return new t({duration:e})}},{key:"isPause",value:function(e){return this.isPauseConstructor(e)||e instanceof t}},{key:"isPauseConstructor",value:function(e){return e===t}}],(n=null)&&zu(e.prototype,n),r&&zu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();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 qu(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"!=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+""}var Ku=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=e,this.config=k(t.defaultConfig,n)}return e=t,r=[{key:"isWord",value:function(e){return e instanceof t}},{key:"color",value:function(e,n){return t.isWord(e)?e.copy().inherit({color:n}):new t(e,{color:n})}},{key:"bold",value:function(e){return t.isWord(e)?e.copy().inherit({bold:!0}):new t(e,{bold:!0})}},{key:"italic",value:function(e){return t.isWord(e)?e.copy().inherit({italic:!0}):new t(e,{italic:!0})}},{key:"getText",value:function(t){return t.filter((function(t){return!t.isPause()})).map((function(t){return t.toString()})).join("")}}],(n=[{key:"evaluate",value:function(e){var n=this;if($u.isPause(this.text))return[this];if("function"==typeof this.text){var r=this.text(e);return Array.isArray(r)?r.map((function(r){return t.isWord(r)?r.inherit(n.config).evaluate(e):new t(r,n.config)})).flat():t.isWord(r)?r.inherit(this.config).evaluate(e):[new t(r,this.config)]}return[this]}},{key:"inherit",value:function(t){return this.config.color=this.config.color||t.color,this.config.italic=this.config.italic||t.italic,this.config.bold=this.config.bold||t.bold,this}},{key:"copy",value:function(){return new t(this.text,this.config)}},{key:"isPause",value:function(){return $u.isPause(this.text)}},{key:"toString",value:function(){return"string"==typeof this.text?this.text:""}}])&&qu(e.prototype,n),r&&qu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function Zu(t){return Zu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zu(t)}function Qu(t){return function(t){if(Array.isArray(t))return Ju(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ju(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ju(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ju(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function tc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ec(r.key),r)}}function ec(t){var e=function(t,e){if("object"!=Zu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Zu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Zu(e)?e:e+""}Ku.defaultConfig={},Ku.defaultColor="#000";var nc=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.text=t.format(e),this.config=k(t.defaultConfig,Object.assign(Object.assign({},n),{voice:Gu.toSound(n.voice)})),this.state=T(t.defaultState)}return e=t,r=[{key:"isSentence",value:function(e){return e instanceof t}},{key:"toSentence",value:function(e){return t.isSentence(e)?e:new t(e)}},{key:"format",value:function(t){var e=[];if(Array.isArray(t))for(var n=0;n<t.length;n++)e.push(this.formatWord(t[n]));else e.push(this.formatWord(t));return e}},{key:"formatWord",value:function(t){return Ku.isWord(t)?t:new Ku(t)}},{key:"formatStaticWord",value:function(t,e){var n=this;return Array.isArray(t)?t.map((function(t){return n.formatStaticWord(t,e)})).flat(2):[Ku.isWord(t)?t:new Ku(t,e)]}},{key:"isSentencePrompt",value:function(e){return Array.isArray(e)?e.every(t.isSingleWord):t.isSingleWord(e)}},{key:"isSingleWord",value:function(t){return"string"==typeof t||Ku.isWord(t)||$u.isPause(t)||"function"==typeof t}}],(n=[{key:"toData",value:function(){return C(this.state,t.defaultState)?null:{state:T(this.state)}}},{key:"fromData",value:function(t){return this.state=k(this.state,t),this}},{key:"toString",value:function(){return this.text.map((function(t){return t.text})).join("")}},{key:"setCharacter",value:function(t){return this.config.character=t,this}},{key:"evaluate",value:function(e){for(var n=[],r=0;r<this.text.length;r++){var o=this.text[r].evaluate(e);n.push.apply(n,Qu(t.formatStaticWord(o)))}return n}},{key:"copy",value:function(){return new t(Qu(this.text),this.config)}}])&&tc(e.prototype,n),r&&tc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();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=lc(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||[],lc(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,e,n,r){var o=cc(lc(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function cc(){return cc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=lc(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}},cc.apply(null,arguments)}function lc(t){return lc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lc(t)}function fc(t,e){return fc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fc(t,e)}nc.defaultConfig={color:"#000",pause:!0,voice:null,character:null,voiceId:null},nc.defaultState={display:!0};var pc=function(e){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),ac(this,n,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fc(t,e)}(n,e),r=n,i=[{key:"getVoice",value:function(t,e){var n=t.getLastScene();if(!n)throw new Error("No scene found when trying to play voice");var r=e.config,o=r.voiceId,i=r.voice;return o||i?Gu.toSound(n.getVoice(o)||i):null}}],(o=[{key:"executeAction",value:function(e){var r=this;if(this.type===t.say){var o=new A((function(t){return t})).registerSkipController(new L((function(){return{type:r.type,node:r.contentNode.getChild()}}))),i=this.contentNode.getContent(),a=n.getVoice(e,i);return a&&(pt.initSound(e,a),e.playSound(a,(function(){e.stopSound(a)}))),e.createText(this.getId(),i,(function(){a&&e.stopSound(a),o.resolve({type:r.type,node:r.contentNode.getChild()})})),o}if(this.type===t.setName)return this.callee.state.name=this.contentNode.getContent()[0],uc(n,"executeAction",this,3)([e]);throw uc(n,"unknownTypeError",this,3)([])}}])&&oc(r.prototype,o),i&&oc(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,i}(tt);function hc(t){return hc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hc(t)}function dc(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,yc(r.key),r)}}function yc(t){var e=function(t,e){if("object"!=hc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=hc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==hc(e)?e:e+""}function mc(t,e,n){return e=gc(e),function(t,e){if(e&&("object"==hc(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,vc()?Reflect.construct(e,n||[],gc(t).constructor):e.apply(t,n))}function vc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vc=function(){return!!t})()}function gc(t){return gc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gc(t)}function bc(t,e){return bc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bc(t,e)}pc.ActionTypes=t;var wc=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=mc(this,e)).config=k(e.defaultConfig,r),n.state={name:t||""},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&bc(t,e)}(e,t),n=e,r=[{key:"say",value:function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(Array.isArray(t)&&t.every((function(t){return"string"==typeof t}))&&[e].concat(r).length>0&&[e].concat(r).every((function(t){return nc.isSingleWord(t)}))){var i=t,a=nc.format([e].concat(r)),s=new nc(function(t,e){for(var n=[],r=0;r<Math.max(t.length,e.length);r++)r<t.length&&n.push(t[r]),r<e.length&&n.push(e[r]);return n}(i,a),{character:this}),u=new pc(this.chain(),pc.ActionTypes.say,(new Bt).setContent(s));return this.chain(u)}var c=e||{},l=t,f=Array.isArray(l)?new nc(l,Object.assign(Object.assign({},c),{character:this})):(nc.isSentence(l)?l:new nc(l,Object.assign(Object.assign({},c),{character:this}))).copy();f.setCharacter(this);var p=new pc(this.chain(),pc.ActionTypes.say,(new Bt).setContent(f));return this.chain(p)}},{key:"setName",value:function(t){var e=new pc(this.chain(),pc.ActionTypes.setName,(new Bt).setContent([t]));return this.chain(e)}}],r&&dc(n.prototype,r),o&&dc(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(fs);function Sc(t){return Sc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sc(t)}function xc(t){return function(t){if(Array.isArray(t))return _c(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 _c(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_c(t,e):void 0}}(t)||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){(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 kc(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,Ac(r.key),r)}}function Ac(t){var e=function(t,e){if("object"!=Sc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Sc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sc(e)?e:e+""}function Tc(t,e,n){return e=Oc(e),function(t,e){if(e&&("object"==Sc(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,Ec()?Reflect.construct(e,n||[],Oc(t).constructor):e.apply(t,n))}function Ec(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ec=function(){return!!t})()}function Pc(){return Pc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Oc(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Pc.apply(null,arguments)}function Oc(t){return Oc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oc(t)}function jc(t,e){return jc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jc(t,e)}wc.defaultConfig={color:"#000"};var Cc=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Tc(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jc(t,e)}(e,t),n=e,r=[{key:"executeAction",value:function(t){var e,n,r=this.callee.evaluate(this.contentNode.getContent(),{gameState:t});return null===(e=null==r?void 0:r[r.length-1])||void 0===e||e.contentNode.addChild(this.contentNode.getChild()),this.contentNode.addChild((null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.contentNode)||null),{type:this.type,node:this.contentNode.getChild()}}},{key:"getFutureActions",value:function(t){return[].concat(xc(this.callee._getFutureActions()),xc((n=e,r="getFutureActions",o=this,a=Pc(Oc(1&(i=3)?n.prototype:n),r,o),2&i&&"function"==typeof a?function(t){return a.apply(o,t)}:a)([t])));var n,r,o,i,a}}],r&&kc(n.prototype,r),o&&kc(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(tt);function Lc(t){return Lc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lc(t)}function Ic(t){return function(t){if(Array.isArray(t))return Nc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Rc(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 Rc(t,e){if(t){if("string"==typeof t)return Nc(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)?Nc(t,e):void 0}}function Nc(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 Mc(t,e,n){return e=Fc(e),function(t,e){if(e&&("object"==Lc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Dc()?Reflect.construct(e,n||[],Fc(t).constructor):e.apply(t,n))}function Dc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Dc=function(){return!!t})()}function Fc(t){return Fc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fc(t)}function Bc(t,e){return Bc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bc(t,e)}function Vc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Uc(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Wc(r.key),r)}}function Gc(t,e,n){return e&&Uc(t.prototype,e),n&&Uc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wc(t){var e=function(t,e){if("object"!=Lc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Lc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Lc(e)?e:e+""}Cc.ActionTypes={action:"condition:action"};var zc=function(){function t(e){Vc(this,t),this.handler=e}return Gc(t,[{key:"evaluate",value:function(t){var e=t.gameState;return{value:this.handler(this.getCtx({gameState:e}))}}},{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}],[{key:"isLambda",value:function(e){return e instanceof t&&"handler"in e}},{key:"from",value:function(e){return t.isLambda(e)?e:new t(e)}}])}(),Hc=function(t){function e(){var t;return Vc(this,e),(t=Mc(this,e)).conditions={If:{condition:null,action:null},ElseIf:[],Else:{action:null}},t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Bc(t,e)}(e,t),Gc(e,[{key:"ElseIf",value:function(t,e){if(this.conditions.Else.action)throw new Cu("ELSE condition already set\nYou are trying to set an ELSE-IF condition after an ELSE condition");return this.conditions.ElseIf.push({condition:zc.isLambda(t)?t:new zc(t),action:this.construct(Array.isArray(e)?e:[e])}),this.chain()}},{key:"Else",value:function(t){if(this.conditions.Else.action)throw new Cu("ELSE condition already set\nYou are trying to set multiple ELSE conditions for the same condition");return this.conditions.Else.action=this.construct(Array.isArray(t)?t:[t]),this.chain()}},{key:"evaluate",value:function(t,e){var n,r,o={gameState:e.gameState},i=null===(n=t.If.condition)||void 0===n?void 0:n.evaluate(o);if(null==i?void 0:i.value)return t.If.action||null;var a,s=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Rc(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(Cc,[this,Cc.ActionTypes.action,(new Bt).setContent(t.conditions)])]}},{key:"construct",value:function(t,e,n){for(var r,o=ns.toActions(t),i=0;i<o.length;i++){var a=o[i].contentNode,s=null===(r=o[i+1])||void 0===r?void 0:r.contentNode;s&&a.setChild(s),i===o.length-1&&e&&a.setChild(e),0===i&&n&&n.setChild(a)}return o}},{key:"_getFutureActions",value:function(){var t,e;return ns.toActions([(null===(t=this.conditions.If.action)||void 0===t?void 0:t[0])||[]].concat(Ic(this.conditions.ElseIf.flatMap((function(t){var e;return(null===(e=t.action)||void 0===e?void 0:e[0])||[]}))),[(null===(e=this.conditions.Else.action)||void 0===e?void 0:e[0])||[]]))}},{key:"createIfCondition",value:function(t,e){return this.conditions.If.condition=t instanceof zc?t:new zc(t),this.conditions.If.action=this.construct(Array.isArray(e)?e:[e]),this.chain()}}],[{key:"getInitialState",value:function(){return{If:{condition:null,action:null},ElseIf:[],Else:{action:null}}}},{key:"If",value:function(t,n){return(new e).createIfCondition(t,n)}}])}(fs);function $c(t){return $c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$c(t)}function Yc(t){return function(t){if(Array.isArray(t))return qc(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 qc(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)?qc(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 qc(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 Xc(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,Kc(r.key),r)}}function Kc(t){var e=function(t,e){if("object"!=$c(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$c(e)?e:e+""}function Zc(t,e,n){return e=tl(e),function(t,e){if(e&&("object"==$c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Qc()?Reflect.construct(e,n||[],tl(t).constructor):e.apply(t,n))}function Qc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Qc=function(){return!!t})()}function Jc(){return Jc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=tl(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Jc.apply(null,arguments)}function tl(t){return tl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tl(t)}function el(t,e){return el=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},el(t,e)}var nl=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Zc(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&&el(t,e)}(e,t),n=e,r=[{key:"executeAction",value:function(t){var e=this,n=new A((function(t){return t})),r=this.contentNode.getContent();return t.createMenu(r,(function(r){var o,i,a=(null===(o=t.game.getLiveGame().getCurrentAction())||void 0===o?void 0:o.contentNode.getChild())||null;a&&(null===(i=r.action[r.action.length-1])||void 0===i||i.contentNode.addChild(a)),n.resolve({type:e.type,node:r.action[0].contentNode})})),n}},{key:"getFutureActions",value:function(t){var n,r,o,i,a,s=this.contentNode.getContent();return[].concat(Yc(this.callee._getFutureActions(s.choices)),Yc((n=e,r="getFutureActions",o=this,a=Jc(tl(1&(i=3)?n.prototype:n),r,o),2&i&&"function"==typeof a?function(t){return a.apply(o,t)}:a)([t])))}}],r&&Xc(n.prototype,r),o&&Xc(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(tt);function rl(t){return rl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rl(t)}function ol(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,il(r.key),r)}}function il(t){var e=function(t,e){if("object"!=rl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=rl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==rl(e)?e:e+""}function al(t,e,n){return e=ul(e),function(t,e){if(e&&("object"==rl(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,sl()?Reflect.construct(e,n||[],ul(t).constructor):e.apply(t,n))}function sl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(sl=function(){return!!t})()}function ul(t){return ul=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ul(t)}function cl(t,e){return cl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cl(t,e)}nl.ActionTypes={action:"menu:action"};var ll=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=al(this,e)).choices=[],n.prompt=nc.isSentence(t)?t:new nc(t),n.config=k(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cl(t,e)}(e,t),n=e,(r=[{key:"choose",value:function(t,e){var n=this.chain();return nc.isSentence(t)&&e||(Ku.isWord(t)||Array.isArray(t)||"string"==typeof t)&&e?n.choices.push({prompt:nc.toSentence(t),action:ns.toActions(e)}):"object"===rl(t)&&"prompt"in t&&"action"in t?n.choices.push({prompt:nc.toSentence(t.prompt),action:ns.toActions(t.action)}):console.warn("No valid choice added to menu, ",{arg0:t,arg1:e}),n}},{key:"fromChained",value:function(t){return[new nl(this.chain(),nl.ActionTypes.action,(new Bt).setContent({prompt:this.prompt,choices:t.constructChoices()}))]}},{key:"_getFutureActions",value:function(t){return t.map((function(t){return t.action[0]||null})).filter((function(t){return null!==t}))}},{key:"constructNodes",value:function(t,e,n){for(var r,o=0;o<t.length;o++){var i=t[o].contentNode,a=null===(r=t[o+1])||void 0===r?void 0:r.contentNode;a&&i.setChild(a),o===this.choices.length-1&&e&&i.setChild(e),0===o&&n&&n.setChild(i)}return t}},{key:"constructChoices",value:function(){var t=this;return this.choices.map((function(e){return{action:t.constructNodes(e.action),prompt:e.prompt}}))}}])&&ol(n.prototype,r),o&&ol(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(fs);function fl(t){return fl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fl(t)}function pl(t){return function(t){if(Array.isArray(t))return hl(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 hl(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)?hl(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 hl(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 dl(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,yl(r.key),r)}}function yl(t){var e=function(t,e){if("object"!=fl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fl(e)?e:e+""}function ml(t,e,n){return e=gl(e),function(t,e){if(e&&("object"==fl(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,vl()?Reflect.construct(e,n||[],gl(t).constructor):e.apply(t,n))}function vl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(vl=function(){return!!t})()}function gl(t){return gl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gl(t)}function bl(t,e){return bl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bl(t,e)}ll.defaultConfig={},ll.targetAction=nl;var wl=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ml(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&&bl(t,e)}(e,t),n=e,(r=[{key:"fromChained",value:function(t){return t.getActions()}},{key:"forEachChild",value:function(t,e,n){var r=new Set,o=[];for(Array.isArray(e)?o.push.apply(o,pl(e)):o.push(e);o.length;){var i=o.shift();if(!r.has(i)){r.add(i),n(i);var a=i.getFutureActions(t).filter((function(t){return!r.has(t)}));o.push.apply(o,pl(a))}}}},{key:"getAllChildren",value:function(t,e){var n=[];return this.forEachChild(t,e,(function(t){return n.push(t)})),n}},{key:"getAllChildrenMap",value:function(t,e){var n=new Map;return this.forEachChild(t,e,(function(t){return n.set(t.getId(),t)})),n}},{key:"getAllElementMap",value:function(t,e){var n=new Map;return this.forEachChild(t,e,(function(t){return n.set(t.callee.getId(),t.callee)})),n}},{key:"getAllChildrenElements",value:function(t,e){return Array.from(new Set(this.getAllChildren(t,e).map((function(t){return t.callee}))))}},{key:"toData",value:function(){return null}},{key:"constructNodes",value:function(t,e){for(var n,r=0;r<t.length;r++){var o=t[r];0===r&&e?e.setChild(o.contentNode):r>0&&(null===(n=t[r-1].contentNode)||void 0===n||n.setChild(o.contentNode))}return t.length?t[0].contentNode:null}}])&&dl(n.prototype,r),o&&dl(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(rs);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 xl(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"!=Sl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Sl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sl(e)?e:e+""}var kl=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 r=t,i=[{key:"catSrc",value:function(e){var n=new Set,r=new Set,o=new Set;return e.forEach((function(e){var i=e.type,a=e.src;i===t.SrcTypes.image?n.add(a):i===t.SrcTypes.video?r.add(a):o.add(a)})),{image:Array.from(n),video:Array.from(r),audio:Array.from(o)}}},{key:"getSrc",value:function(t){return"string"==typeof t?t:t instanceof Qs?Qs.getSrc(t.state):"image"===t.type?Qs.getSrc(t.src.state):"video"===t.type?t.src:"audio"===t.type?t.src.getSrc():""}},{key:"getPreloadableSrc",value:function(t,r){var o;if(r.is(Tt,e.setBackground)){var i=r.contentNode.getContent()[0],a=Pu.backgroundToSrc(i);if(a)return{type:"image",src:new Qs({src:a}),activeType:"scene"}}else if(r.is(Tt,e.jumpTo)){var s=r.contentNode.getContent()[0],u=t.getScene(s,!0).config.background;if(Pu.isStaticImageData(u)||"string"==typeof u)return{type:"image",src:new Qs({src:u}),activeType:"once"}}else if(r instanceof hu){var c=r;if(c.callee.config.tag)return{type:"image",src:new Qs({src:Qs.getSrcFromTags(c.callee.config.tag.defaults,c.callee.config.src)}),activeType:"scene"};if(r.is(hu,n.setSrc)){var l=r.contentNode.getContent()[0];return{type:"image",src:new Qs({src:l}),activeType:"scene"}}if(r.type===n.initWearable)return{type:"image",src:r.contentNode.getContent()[0],activeType:"scene"};if(r.type===n.setAppearance){var f=r.contentNode.getContent()[0];if("function"!=typeof c.callee.config.src)throw c.callee._invalidSrcHandlerError();if(f.length===(null===(o=c.callee.state.tag)||void 0===o?void 0:o.groups.length))return{type:"image",src:Qs.fromSrc(Qs.getSrcFromTags(f,c.callee.config.src)),activeType:"scene"}}else if(r.type===n.init){var p=r.callee.config.src;if("string"==typeof p||Pu.isStaticImageData(p))return{type:"image",src:new Qs({src:p}),activeType:"scene"}}}return null}}],(o=[{key:"register",value:function(t,e){var n=this;if(Array.isArray(t))t.forEach((function(t){return n.register(t)}));else if(t instanceof Gu){if(this.isSrcRegistered(t.getSrc()))return this;this.src.push({type:"audio",src:t})}else if(t instanceof Qs||Pu.isStaticImageData(t)){if(t instanceof Qs){if(this.isSrcRegistered(Qs.getSrc(t.state)))return this}else if(this.isSrcRegistered(Pu.srcToString(t.src)))return this;this.src.push({type:"image",src:new Qs(t instanceof Qs?{src:Qs.getSrc(t.state)}:{src:Pu.staticImageDataToSrc(t)})})}else if("object"===Sl(t)){if(this.isSrcRegistered(t.src||""))return this;this.src.push(t)}else if("audio"===t){if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e instanceof Gu?e:new Gu({src:e})})}else{if(this.isSrcRegistered(e||""))return this;this.src.push({type:t,src:e})}return this}},{key:"isSrcRegistered",value:function(e){var n=e instanceof Gu?e.getSrc():e;return this.src.some((function(e){return e.type===t.SrcTypes.audio?n===e.src.getSrc():e.type===t.SrcTypes.image?n===Qs.getSrc(e.src.state):n===e.src}))}},{key:"getSrc",value:function(){return this.src}},{key:"getSrcByType",value:function(t){return this.src.filter((function(e){return e.type===t}))}},{key:"registerFuture",value:function(t){return this.future.includes(t)||this.hasFuture(t)||this.future.push(t),this}},{key:"hasFuture",value:function(t){return this.future.includes(t)}},{key:"getFutureSrc",value:function(){return this.future.map((function(t){return t.getSrc()})).flat(2)}}])&&xl(r.prototype,o),i&&xl(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,i}();function Al(t){return Al="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Al(t)}function Tl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,El(r.key),r)}}function El(t){var e=function(t,e){if("object"!=Al(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Al(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Al(e)?e:e+""}function Pl(t,e,n){return e=Ll(e),function(t,e){if(e&&("object"==Al(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ol()?Reflect.construct(e,n||[],Ll(t).constructor):e.apply(t,n))}function Ol(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ol=function(){return!!t})()}function jl(t,e,n,r){var o=Cl(Ll(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function Cl(){return Cl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Ll(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}},Cl.apply(null,arguments)}function Ll(t){return Ll=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ll(t)}function Il(t,e){return Il=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Il(t,e)}kl.SrcTypes={image:"image",video:"video",audio:"audio"};var Rl=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Pl(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&&Il(t,e)}(e,t),n=e,(r=[{key:"executeAction",value:function(t){var n=this;if(this.type===s.init){var r=t.findElementByDisplayable(this.callee);r&&t.disposeDisplayable(this.callee,r.scene);var o=this.contentNode.getContent()[0];t.createDisplayable(this.callee,o);var i=new A((function(t){return t}));return this.callee.events.any("event:displayable.init").then((function(){i.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),i}if([s.show,s.hide,s.applyTransform].includes(this.type)){var a=new A((function(t){return t})).registerSkipController(new L((function(){return n.type===s.hide&&(n.callee.state.display=!1),jl(e,"executeAction",n,3)([t])}))),u=this.contentNode.getContent()[0];return this.type===s.show&&(this.callee.state.display=!0,t.stage.update()),t.animateText(ff.EventTypes["event:displayable.applyTransform"],this.callee,[u],(function(){n.type===s.hide&&(n.callee.state.display=!1),a.resolve(jl(e,"executeAction",n,3)([t]))})),a}if(this.type===s.setText)return this.callee.state.text=this.contentNode.getContent()[0],jl(e,"executeAction",this,3)([t]);if(this.type===s.setFontSize){this.callee.state.fontSize=this.contentNode.getContent()[0];var c=new Sa([],{duration:0}),l=new A;return t.animateText(ff.EventTypes["event:displayable.applyTransform"],this.callee,[c],(function(){l.resolve(jl(e,"executeAction",n,3)([t]))})),l}if(this.type===s.applyTransition){var f=(new A).registerSkipController(new L((function(){return t.logger.info("NarraLeaf-React: Text Transition","Skipped"),{type:n.type,node:n.contentNode.getChild()}}))),p=this.contentNode.getContent()[0];return this.callee.events.any("event:displayable.applyTransition",p).then((function(){f.resolve({type:n.type,node:n.contentNode.getChild()}),t.stage.next()})),f}throw jl(e,"unknownTypeError",this,3)([])}}])&&Tl(n.prototype,r),o&&Tl(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(tt);Rl.ActionTypes=s;var Nl={start:"start",update:"update",end:"end"};function Ml(t){return Ml="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ml(t)}function Dl(t,e,n){return e=Bl(e),function(t,e){if(e&&("object"==Ml(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Fl()?Reflect.construct(e,n||[],Bl(t).constructor):e.apply(t,n))}function Fl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Fl=function(){return!!t})()}function Bl(t){return Bl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bl(t)}function Vl(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ul(t,e)}function Ul(t,e){return Ul=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ul(t,e)}function Gl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Wl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hl(r.key),r)}}function zl(t,e,n){return e&&Wl(t.prototype,e),n&&Wl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Hl(t){var e=function(t,e){if("object"!=Ml(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ml(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ml(e)?e:e+""}var $l=function(){return zl((function t(){Gl(this,t),this.events=new P}),[{key:"start",value:function(t){throw new Error("Method not implemented.")}},{key:"toElementProps",value:function(){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}},{key:"requestAnimation",value:function(t,e,n){var r=this,o=t.start,i=t.end,a=t.duration,s=e.onComplete,u=e.onUpdate;return this.events.emit(Nl.start,null),this.controller=ua(o,i,Object.assign({duration:a/1e3,onUpdate:function(t){u&&u(t),r.events.emit(Nl.update,r.toElementProps())},onComplete:function(){r.controller=void 0,r.events.emit(Nl.end,null),s&&s()}},n)),this.controller}}])}(),Yl=function(t){function e(){return Gl(this,e),Dl(this,e,arguments)}return Vl(e,t),zl(e,[{key:"setSrc",value:function(t){throw new Error("Method not implemented.")}},{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}($l);Yl.DefaultEasing="linear";var ql=function(t){function e(){return Gl(this,e),Dl(this,e,arguments)}return Vl(e,t),zl(e,[{key:"copy",value:function(){throw new Error("Method not implemented.")}}])}($l);function Xl(t){return Xl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xl(t)}function Kl(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,Zl(r.key),r)}}function Zl(t){var e=function(t,e){if("object"!=Xl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Xl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xl(e)?e:e+""}function Ql(t,e,n){return e=tf(e),function(t,e){if(e&&("object"==Xl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Jl()?Reflect.construct(e,n||[],tf(t).constructor):e.apply(t,n))}function Jl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Jl=function(){return!!t})()}function tf(t){return tf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tf(t)}function ef(t,e){return ef=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ef(t,e)}var nf=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=Ql(this,e)).state={fontSize:0},r.startValue=t,r.endValue=n,r.duration=o,r.easing=i,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ef(t,e)}(e,t),n=e,(r=[{key:"start",value:function(t){var e=this;this.state.fontSize=this.startValue,this.requestAnimation({start:this.startValue,end:this.endValue,duration:this.duration},{onComplete:function(){e.state.fontSize=e.endValue,t&&t()},onUpdate:function(t){e.state.fontSize=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{fontSize:this.state.fontSize}}]}},{key:"copy",value:function(){return new e(this.startValue,this.endValue,this.duration,this.easing)}}])&&Kl(n.prototype,r),o&&Kl(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(ql);function rf(t){return rf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rf(t)}function of(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,af(r.key),r)}}function af(t){var e=function(t,e){if("object"!=rf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=rf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==rf(e)?e:e+""}function sf(t,e,n){return e=cf(e),function(t,e){if(e&&("object"==rf(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,uf()?Reflect.construct(e,n||[],cf(t).constructor):e.apply(t,n))}function uf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(uf=function(){return!!t})()}function cf(t){return cf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cf(t)}function lf(t,e){return lf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},lf(t,e)}nf.Frames=[1,0];var ff=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=sf(this,e)).events=new P,n.config="string"==typeof t?k({},e.defaultConfig,r,{text:t}):k({},e.defaultConfig,t),n.state=k({},n.config),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&lf(t,e)}(e,t),n=e,r=[{key:"applyTransform",value:function(t){var e=this.chain(),n=new Rl(e,Rl.ActionTypes.applyTransform,(new Bt).setContent([t.copy()]));return e.chain(n)}},{key:"applyTransition",value:function(t){var e=this.chain(),n=this._applyTransition(e,t);return e.chain(n)}},{key:"show",value:function(t){var e=this.chain(),n=t instanceof Sa?t.copy():new Sa([{props:{opacity:1},options:t||{}}]),r=new Rl(e,Rl.ActionTypes.show,(new Bt).setContent([n]));return e.chain(r)}},{key:"hide",value:function(t){var e=this.chain(),n=t instanceof Sa?t.copy():new Sa([{props:{opacity:1},options:t||{}}]),r=new Rl(e,Rl.ActionTypes.hide,(new Bt).setContent([n]));return e.chain(r)}},{key:"setText",value:function(t){var e=this.chain(),n=new Rl(e,Rl.ActionTypes.setText,(new Bt).setContent([t]));return e.chain(n)}},{key:"setFontSize",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return this.combineActions(new bs,(function(o){if(n){var i=new nf(e.state.fontSize,t,n,r);o.chain(e._applyTransition(o,i))}var a=new Rl(o,Rl.ActionTypes.setFontSize,(new Bt).setContent([t]));return o.chain(a)}))}},{key:"toData",value:function(){return{state:k({},Qs.serializeImageState(this.state))}}},{key:"fromData",value:function(t){return this.state=k({},Qs.deserializeImageState(t.state)),this}},{key:"toTransform",value:function(){return new Sa(this.state,{duration:0})}},{key:"toDisplayableTransform",value:function(){return new Sa(this.state,{duration:0})}},{key:"_init",value:function(t){return new Rl(this.chain(),Rl.ActionTypes.init,(new Bt).setContent([t]))}},{key:"_applyTransition",value:function(t,e){return new Rl(t,Rl.ActionTypes.applyTransition,(new Bt).setContent([e]))}}],r&&of(n.prototype,r),o&&of(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(fs);function pf(t){return pf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pf(t)}function hf(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 df(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)?df(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 df(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function yf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mf(r.key),r)}}function mf(t){var e=function(t,e){if("object"!=pf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pf(e)?e:e+""}function vf(t,e,n){return e=wf(e),function(t,e){if(e&&("object"==pf(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,gf()?Reflect.construct(e,n||[],wf(t).constructor):e.apply(t,n))}function gf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(gf=function(){return!!t})()}function bf(){return bf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=wf(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},bf.apply(null,arguments)}function wf(t){return wf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wf(t)}function Sf(t,e){return Sf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sf(t,e)}ff.EventTypes=Object.assign(Object.assign({},Ds.EventTypes),{"event:text.show":"event:text.show","event:text.hide":"event:text.hide"}),ff.defaultConfig={position:new Zt(Zt.Positions.Center),scale:1,rotation:0,opacity:0,alignX:"center",alignY:"center",fontSize:16,fontColor:"#000000",display:!1,text:""};var xf=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),vf(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&&Sf(t,e)}(e,t),n=e,r=[{key:"executeAction",value:function(t){var n,r,o,i,a,s=this;if(s.is(e,"persistent:set")){var u=hf(s.contentNode.getContent(),2),c=u[0],l=u[1],f=t.getStorable().getNamespace(s.callee.getNamespaceName());if("function"==typeof l){var p=f.get(c);f.set(c,l(p))}else f.set(c,l);return(n=e,r="executeAction",o=this,a=bf(wf(1&(i=3)?n.prototype:n),r,o),2&i&&"function"==typeof a?function(t){return a.apply(o,t)}:a)([t])}throw this.unknownTypeError()}}],r&&yf(n.prototype,r),o&&yf(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(tt);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 kf(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 Af(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)?Af(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 Af(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 Tf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ef(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Of(r.key),r)}}function Pf(t,e,n){return e&&Ef(t.prototype,e),n&&Ef(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Of(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+""}xf.ActionTypes=c;var jf=function(){function t(e,n,r){Tf(this,t),this.name=e,this.key=r||e,this.content=k({},n)}return Pf(t,[{key:"set",value:function(e,n){return t.isSerializable(n)?(this.content[e]=n,this):(console.warn('Value "'.concat(n,'" in key "').concat(String(e),'" is not serializable, and will not be set\n at namespace "').concat(this.name,'"')),this.content[e]=n,this)}},{key:"get",value:function(t){return this.content[t]}},{key:"equals",value:function(t,e){return this.content[t]===e}},{key:"assign",value:function(t){var e=this;return Object.entries(t).forEach((function(t){var n=kf(t,2),r=n[0],o=n[1];e.set(r,o)})),this}},{key:"toData",value:function(){return this.serialize()}},{key:"load",value:function(t){t?this.content=t:console.warn("No data to load")}},{key:"serialize",value:function(){var t=this,e={};return Object.entries(this.content).forEach((function(n){var r=kf(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=kf(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(_f(e))||(e instanceof Date||(null==e||(Array.isArray(e)?e.every(t.isSerializable):"object"===_f(e)&&(Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(t.isSerializable)))))}}])}(),Cf=function(){return Pf((function t(){Tf(this,t),this.namespaces={}}),[{key:"addNamespace",value:function(t){if(!this.namespaces[t.key])return this.namespaces[t.key]=t,this}},{key:"getNamespace",value:function(t){if(!this.namespaces[t])throw new Ru("Namespace ".concat(t," is not initialized, did you forget to register it?")+"\nUse `story.registerPersistent` to register a persistent namespace");return this.namespaces[t]}},{key:"setNamespace",value:function(t,e){return this.namespaces[t]=e,this}},{key:"hasNamespace",value:function(t){return!!this.namespaces[t]}},{key:"removeNamespace",value:function(t){return delete this.namespaces[t],this}},{key:"getNamespaces",value:function(){return this.namespaces}},{key:"keys",value:function(){return Object.keys(this.namespaces)}},{key:"values",value:function(){return Object.values(this.namespaces)}},{key:"entries",value:function(){return Object.entries(this.namespaces)}},{key:"toData",value:function(){return this.entries().reduce((function(t,e){var n=kf(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=kf(t,2),r=n[0],o=n[1];e.namespaces[r]?e.namespaces[r].load(o):e.namespaces[r]=new jf(r,o)})):console.warn("No data to load")}},{key:"clear",value:function(){return this.namespaces={},this}}])}();function Lf(t){return Lf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lf(t)}function If(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Rf(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Mf(r.key),r)}}function Nf(t,e,n){return e&&Rf(t.prototype,e),n&&Rf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Mf(t){var e=function(t,e){if("object"!=Lf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Lf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Lf(e)?e:e+""}function Df(t,e,n){return e=Bf(e),function(t,e){if(e&&("object"==Lf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ff()?Reflect.construct(e,n||[],Bf(t).constructor):e.apply(t,n))}function Ff(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ff=function(){return!!t})()}function Bf(t){return Bf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bf(t)}function Vf(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Uf(t,e)}function Uf(t,e){return Uf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Uf(t,e)}var Gf=function(t){function e(t,n){var r;return If(this,e),(r=Df(this,e)).namespace=r.prefix(t),r.defaultContent=n,r}return Vf(e,t),Nf(e,[{key:"init",value:function(t){t.hasNamespace(this.namespace)||t.addNamespace(new jf(this.namespace,this.defaultContent))}},{key:"set",value:function(t,e){return this.chain(this.createAction(c.set,[t,e]))}},{key:"equals",value:function(t,e){var n=this;return new zc((function(r){return r.storable.getNamespace(n.namespace).equals(t,e)}))}},{key:"notEquals",value:function(t,e){var n=this;return new zc((function(r){return!r.storable.getNamespace(n.namespace).equals(t,e)}))}},{key:"isTrue",value:function(t){var e=this;return new zc((function(n){return n.storable.getNamespace(e.namespace).equals(t,!0)}))}},{key:"isFalse",value:function(t){var e=this;return new zc((function(n){return n.storable.getNamespace(e.namespace).equals(t,!1)}))}},{key:"isNotNull",value:function(t){var e=this;return new zc((function(n){var r=n.storable.getNamespace(e.namespace).get(t);return null!=r}))}},{key:"toWord",value:function(t){var e=this;return new Ku((function(n){var r=n.storable;return[String(r.getNamespace(e.namespace).get(t))]}))}},{key:"get",value:function(t){return this.toWord(t)}},{key:"conditional",value:function(t,e,n){return new Ku((function(r){return zc.from(t).evaluate(r).value?e:n}))}},{key:"evaluate",value:function(t,e){var n=this;return new zc((function(r){var o=r.storable;return e(o.getNamespace(n.namespace).get(t))}))}},{key:"getNamespaceName",value:function(){return this.namespace}},{key:"prefix",value:function(t){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NamespacePrefix)+":"+String(t)}},{key:"createAction",value:function(t,e){return new xf(this.chain(),t,Bt.create(e))}}])}(fs);Gf.NamespacePrefix="persistent";var Wf=function(t){function e(t){var n;return If(this,e),(n=Df(this,e,[t,{}])).namespace=n.prefix(t,e.LocalNamespacePrefix),n}return Vf(e,t),Nf(e,[{key:"init",value:function(t){t.removeNamespace(this.namespace).addNamespace(new jf(this.namespace,this.defaultContent))}}])}(Gf);function zf(t){return zf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zf(t)}function Hf(t){return function(t){if(Array.isArray(t))return Yf(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$f(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $f(t,e){if(t){if("string"==typeof t)return Yf(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)?Yf(t,e):void 0}}function Yf(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 qf(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"!=zf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=zf(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==zf(e)?e:e+""}function Kf(t,e,n){return e=Jf(e),function(t,e){if(e&&("object"==zf(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||[],Jf(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(){return Qf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Jf(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}},Qf.apply(null,arguments)}function Jf(t){return Jf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jf(t)}function tp(t,e){return tp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},tp(t,e)}Wf.LocalNamespacePrefix="local";var ep=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},np=function(t){function n(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=Kf(this,n)).srcManager=new kl,r.events=new P,r.actions=[],r._userConfig={},r.name=t,r._userConfig=e||{};var o=k(n.defaultConfig,e||{}),i=o.background,a=o.voices,s=ep(o,["background","voices"]);return r.config=Object.assign(Object.assign({},s),{voices:a||null,background:i||null}),r.state=k(r.config,{backgroundImageProxy:r._createImageProxy()}),r.local=new Wf(t),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&tp(t,e)}(n,t),r=n,o=[{key:"toBackground",value:function(t){if(Pu.isImageSrc(t)||Pu.isImageColor(t))return t;if(t instanceof Eu)return t.toImageColor();throw new Error("Invalid background type")}},{key:"activate",value:function(){return this.chain(this._init(this))}},{key:"deactivate",value:function(){return this.chain(this._exit())}},{key:"setBackground",value:function(t,e){var n=this;return this.combineActions(new bs,(function(r){if(e){var o=e.copy();o.setSrc(n.toBackground(t)),r._transitionToScene(o,void 0,n.toBackground(t))}return r.chain(new Tt(r,"scene:setBackground",(new Bt).setContent([t])))}))}},{key:"applyTransform",value:function(t){return this.chain(new Tt(this.chain(),"scene:applyTransform",(new Bt).setContent([t.copy()])))}},{key:"jumpTo",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.combineActions(new bs,(function(r){var o=k({unloadScene:!0},n);return r.chain(new Tt(r,"scene:preUnmount",(new Bt).setContent([])))._transitionToScene(o.transition,t).chain(e._init(t)),o.unloadScene&&r.chain(e._exit()),r}))._jumpTo(t)}},{key:"sleep",value:function(t){return this.chain(new Tt(this.chain(),"scene:sleep",(new Bt).setContent(t)))}},{key:"setBackgroundMusic",value:function(t,n){return this.chain(new Tt(this.chain(),e.setBackgroundMusic,(new Bt).setContent([t,n])))}},{key:"toData",value:function(){var t;return{state:Object.assign(Object.assign({},T(this.state)),{backgroundMusic:null===(t=this.state.backgroundMusic)||void 0===t?void 0:t.toData(),background:this.state.background}),backgroundImageState:this.state.backgroundImageProxy.toData()}}},{key:"fromData",value:function(t){var e=this;return M(t,{state:function(t){M(t,{backgroundMusic:function(t){t&&(e.state.backgroundMusic=(new Gu).fromData(t))},background:function(t){t&&(e.state.background=t)}})},backgroundImageState:function(t){t&&(e.state.backgroundImageProxy=(new Qs).fromData(t))}}),this}},{key:"getInitTransform",value:function(){return new Sa([{props:Object.assign(Object.assign({},this.state.backgroundImageProxy.state),{opacity:1}),options:{duration:0}}])}},{key:"action",value:function(t){return this.actions=t,this}},{key:"constructSceneRoot",value:function(t){var e;this.sceneRoot=new Tt(this.chain(),"scene:action",new Bt);var r=this.actions,o=(Array.isArray(r)?r.flat(2):r(this).flat(2)).map((function(t){return ns.isChained(t)?t.fromChained(t):t})).flat(2),i=[],a=[];this.getAllChildrenElements(t,o).forEach((function(t){ns.isChained(t)||(t instanceof Qs?i.push(t):t instanceof ff&&a.push(t))}));var s=[],u=[],c=new Map;i.forEach((function(t){var e;t.config.isWearable?u.push(t):s.push(t);var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=$f(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(t.config.wearables);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(c.get(o)&&c.get(o)!==t)throw new Error("Wearable image cannot be used multiple times\nYou may bind the same wearable image to multiple parent images\nParent Conflict: "+(null===(e=c.get(o))||void 0===e?void 0:e.getId())+"\nCurrent Parent: "+t.getId());c.set(o,t)}}catch(t){r.e(t)}finally{r.f()}}));var l,f,p,h,d,y=[this._init(this)].concat(Hf(s.filter((function(t){return t.config.autoInit})).map((function(t){return t._init()}))),Hf(u.map((function(t){if(!c.has(t))throw new Error("Wearable image must have a parent image");return c.get(t)._initWearable(t)}))),Hf(a.map((function(t){return t._init()}))),Hf(o)),m=(l=n,f="constructNodes",p=this,d=Qf(Jf(1&(h=3)?l.prototype:l),f,p),2&h&&"function"==typeof d?function(t){return d.apply(p,t)}:d)([y]),v=new Bt(this.sceneRoot,void 0,m||void 0).setContent(this);return null==m||m.setParent(v),null===(e=this.sceneRoot)||void 0===e||e.setContentNode(v),this}},{key:"isSceneRootConstructed",value:function(){return!!this.sceneRoot}},{key:"inherit",value:function(t){var e=k(n.defaultConfig,t.config,this._userConfig),r=e.background,o=ep(e,["background"]);return this.config=Object.assign(Object.assign({},o),{background:r||null}),this.state=k(this.config,{backgroundImageProxy:this._createImageProxy()}),this}},{key:"registerSrc",value:function(t){var r=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Set;if(this.sceneRoot){var i=new Set,a=new Set,s=[this.sceneRoot],u=new Set;for(Pu.isImageSrc(this.config.background)&&this.srcManager.register(new Qs({src:Pu.toBackgroundSrc(this.config.background)}));s.length;){var c=s.shift();if(!i.has(c)){if(i.add(c),c instanceof Tt){if(c.type===e.jumpTo){var l=c,f=n.getScene(t,l.contentNode.getContent()[0]);if(!f)throw c._sceneNotFoundError(c.getSceneName(l.contentNode.getContent()[0]));var p=kl.getPreloadableSrc(t,c);if(p&&this.srcManager.register(p),a.has(l)||o.has(f))continue;a.add(l),u.add(f),o.add(f)}else if(c.type===e.setBackground){var h=kl.getPreloadableSrc(t,c);h&&this.srcManager.register(h)}}else if(c instanceof hu){var d=kl.getPreloadableSrc(t,c);d&&this.srcManager.register(d)}else if(c instanceof pt)this.srcManager.register(c.callee);else if(c instanceof Wa){var y=c.getFutureActions(t);s.push.apply(s,Hf(y))}s.push.apply(s,Hf(c.getFutureActions(t)))}}u.forEach((function(e){e.registerSrc(t,o),r.srcManager.registerFuture(e.srcManager)}))}}},{key:"assignActionId",value:function(t){this.getAllChildren(t,this.sceneRoot||[]).forEach((function(t,e){t.setId("action-".concat(e))}))}},{key:"assignElementId",value:function(t){this.getAllChildrenElements(t,this.sceneRoot||[]).forEach((function(t,e){t.setId("element-".concat(e))}))}},{key:"getVoice",value:function(t){if(!t)return null;var e=this.config.voices;return e?"function"==typeof e?e(t):e[t]||null:null}},{key:"getSceneRoot",value:function(){if(!this.sceneRoot)throw new Error("Scene root is not constructed");return this.sceneRoot}},{key:"reset",value:function(){this.state=k(n.defaultState,this.config),this.state.backgroundImageProxy.reset()}},{key:"toDisplayableTransform",value:function(){return this.state.backgroundImageProxy.toDisplayableTransform()}},{key:"requestImagePreload",value:function(t){this.srcManager.register({type:"image",src:new Qs({src:t})})}},{key:"_createImageProxy",value:function(){return new Js({opacity:1,src:Qs.DefaultImagePlaceholder})}},{key:"_jumpTo",value:function(t){return this.chain(new Tt(this.chain(),"scene:jumpTo",(new Bt).setContent([t])))}},{key:"_exit",value:function(){return new Tt(this.chain(),"scene:exit",(new Bt).setContent([]))}},{key:"_transitionToScene",value:function(t,n,r){var o=this.chain();if(t){var i=t.copy(),a=new Tt(o,e.transitionToScene,(new Bt).setContent([i,n,r]));o.chain(a)}return o}},{key:"_init",value:function(t){return new Tt(this.chain(),"scene:init",(new Bt).setContent([t]))}}],i=[{key:"isScene",value:function(t){return t instanceof n}},{key:"getScene",value:function(t,e){return"string"==typeof e?t.getScene(e):e}}],o&&qf(r.prototype,o),i&&qf(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o,i}(wl);function rp(t){return rp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rp(t)}function op(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,ip(r.key),r)}}function ip(t){var e=function(t,e){if("object"!=rp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=rp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==rp(e)?e:e+""}function ap(t,e,n){return e=cp(e),function(t,e){if(e&&("object"==rp(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,sp()?Reflect.construct(e,n||[],cp(t).constructor):e.apply(t,n))}function sp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(sp=function(){return!!t})()}function up(){return up="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=cp(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}},up.apply(null,arguments)}function cp(t){return cp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cp(t)}function lp(t,e){return lp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},lp(t,e)}np.EventTypes={"event:scene.remove":"event:scene.remove","event:scene.load":"event:scene.load","event:scene.unload":"event:scene.unload","event:scene.mount":"event:scene.mount","event:scene.unmount":"event:scene.unmount","event:scene.preUnmount":"event:scene.preUnmount","event:scene.imageLoaded":"event:scene.imageLoaded","event:scene.setBackgroundMusic":"event:scene.setBackgroundMusic","event:displayable.applyTransition":"event:displayable.applyTransition","event:displayable.applyTransform":"event:displayable.applyTransform","event:displayable.init":"event:displayable.init"},np.defaultConfig={invertY:!0,invertX:!1,backgroundMusic:null,backgroundMusicFade:0},np.defaultState={backgroundImageProxy:new Js};var fp=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),ap(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&&lp(t,e)}(e,t),n=e,r=[{key:"executeAction",value:function(t){return this.contentNode.getContent().execute({gameState:t}),(n=e,r="executeAction",o=this,a=up(cp(1&(i=3)?n.prototype:n),r,o),2&i&&"function"==typeof a?function(t){return a.apply(o,t)}:a)([t]);var n,r,o,i,a}}],r&&op(n.prototype,r),o&&op(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(tt);function pp(t){return pp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pp(t)}function hp(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,dp(r.key),r)}}function dp(t){var e=function(t,e){if("object"!=pp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pp(e)?e:e+""}function yp(t,e){if(e&&("object"==pp(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 mp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(mp=function(){return!!t})()}function vp(t){return vp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vp(t)}function gp(t,e){return gp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gp(t,e)}fp.ActionTypes={action:"script:action"};var bp=function(t){function e(t){var n,r,o,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),r=this,o=vp(o=e),(n=yp(r,mp()?Reflect.construct(o,i||[],vp(r).constructor):o.apply(r,i))).handler=t,yp(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&&gp(t,e)}(e,t),n=e,o=[{key:"getCtx",value:function(t){var e=t.gameState;return{gameState:e,game:e.game,liveGame:e.game.getLiveGame(),storable:e.game.getLiveGame().getStorable()}}}],(r=[{key:"execute",value:function(t){var n=t.gameState;this.handler(e.getCtx({gameState:n}))}},{key:"fromChained",value:function(t){return[new fp(this.chain(),fp.ActionTypes.action,(new Bt).setContent(t))]}}])&&hp(n.prototype,r),o&&hp(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(fs);function wp(t){return wp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wp(t)}function Sp(t){return function(t){if(Array.isArray(t))return xp(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 xp(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)?xp(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 xp(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 _p(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,kp(r.key),r)}}function kp(t){var e=function(t,e){if("object"!=wp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=wp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==wp(e)?e:e+""}function Ap(t,e,n){return e=Ep(e),function(t,e){if(e&&("object"==wp(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,Tp()?Reflect.construct(e,n||[],Ep(t).constructor):e.apply(t,n))}function Tp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Tp=function(){return!!t})()}function Ep(t){return Ep=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ep(t)}function Pp(t,e){return Pp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pp(t,e)}var Op=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=Ap(this,e)).entryScene=null,n.scenes=new Map,n.persistent=[],n.name=t,n.config=k(e.defaultConfig,r),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pp(t,e)}(e,t),n=e,r=[{key:"entry",value:function(t){return this.entryScene=t,this}},{key:"registerScene",value:function(t,e){var n="string"==typeof t?t:t.name,r="string"==typeof t?e:t;if(this.scenes.has(n)&&this.scenes.get(n)!==r)throw new Error("Scene with name ".concat(n," already exists when registering scene"));return this.scenes.set(n,r),this}},{key:"registerPersistent",value:function(t){return this.persistent.push(t),this}},{key:"getScene",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;if(np.isScene(t))return t;var r=this.scenes.get(t)||null;if(!r&&e){var o=n||Iu;throw Reflect.construct(o,["Scene with name ".concat(t," not found")])}return r}},{key:"constructStory",value:function(){var t=this.entryScene;if(!t)throw new Error("Story must have an entry scene");return this.constructSceneRoots(t),t.registerSrc(this),t.assignActionId(this),t.assignElementId(this),this.runStaticCheck(t),this}},{key:"getAllElementStates",value:function(){var t;return this.getAllChildrenElements(this,(null===(t=this.entryScene)||void 0===t?void 0:t.getSceneRoot())||[]).map((function(t){return{id:t.getId(),data:t.toData()}})).filter((function(t){return!!t.data}))}},{key:"constructSceneRoots",value:function(t){var n=new Set,r=[],o=0;for(t.constructSceneRoot(this),r.push(t.getSceneRoot());r.length;){if(++o>e.MAX_DEPTH)throw new Error("Max depth reached while constructing scene roots (max depth: ".concat(e.MAX_DEPTH,")"));var i=r.shift();if(np.isScene(i.callee)){if(n.has(i.callee))continue;i.callee.isSceneRootConstructed()||i.callee.constructSceneRoot(this),n.add(i.callee)}var a=i.getFutureActions(this);r.push.apply(r,Sp(a))}return this}},{key:"initPersistent",value:function(t){return this.persistent.forEach((function(e){e.init(t)})),this}},{key:"runStaticCheck",value:function(t){return new Lu(t).run(this)}}],o=[{key:"empty",value:function(){return new e("empty").entry(new np("empty"))}}],r&&_p(n.prototype,r),o&&_p(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(wl);Op.defaultConfig={},Op.MAX_DEPTH=1e4;var jp=function t(e){if(!(this instanceof t?this.constructor:void 0))throw new Error("Image is a constructor and should be called with new keyword");return new Qs(e,e.tag)},Cp=Qs;function Lp(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=Lp(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}const Ip=function(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=Lp(t))&&(r&&(r+=" "),r+=e);return r};var Rp=o(12),Np=o.n(Rp);function Mp(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Dp(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dp(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dp(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var Fp=Np().createContext(null);function Bp(t){var e=t.children,n=t.game,r=new rv({}),o=Mp((0,Rp.useState)(n||r),2),i=o[0],a=o[1];return Np().createElement(Fp.Provider,{value:{game:i,setGame:a}},e)}function Vp(){var t=(0,Rp.useContext)(Fp);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function Up(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))})}function Gp(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 Wp(t,e,n={}){var r;const o=Zo(t,e,"exit"===n.type?null===(r=t.presenceContext)||void 0===r?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(i=n.transitionOverride);const a=o?()=>Promise.all(oi(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(zp).forEach(((t,r)=>{t.notify("AnimationStart",e),a.push(Wp(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 zp(t,e){return t.sortNodePosition(e)}const Hp=mi.length;function $p(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&$p(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<Hp;n++){const r=mi[n],o=t.props[r];(di(o)||!1===o)&&(e[r]=o)}return e}const Yp=[...yi].reverse(),qp=yi.length;function Xp(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=>Wp(t,e,n)));r=Promise.all(o)}else if("string"==typeof e)r=Wp(t,e,n);else{const o="function"==typeof e?Zo(t,e,n.custom):e;r=Promise.all(oi(t,o,n))}return r.then((()=>{t.notify("AnimationComplete",e)}))}(t,e,n))))}function Kp(t){let e=Xp(t),n=Jp(),r=!0;const o=e=>(n,r)=>{var o;const i=Zo(t,r,"exit"===e?null===(o=t.presenceContext)||void 0===o?void 0:o.custom:void 0);if(i){const{transition:t,transitionEnd:e,...r}=i;n={...n,...r,...e}}return n};function i(i){const{props:a}=t,s=$p(t.parent)||{},u=[],c=new Set;let l={},f=1/0;for(let e=0;e<qp;e++){const p=Yp[e],h=n[p],d=void 0!==a[p]?a[p]:s[p],y=di(d),m=p===i?h.isActive:null;!1===m&&(f=e);let v=d===s[p]&&d!==a[p]&&y;if(v&&r&&t.manuallyAnimateOnMount&&(v=!1),h.protectedKeys={...l},!h.isActive&&null===m||!d&&!h.prevProp||hi(d)||"boolean"==typeof d)continue;const g=Zp(h.prevProp,d);let b=g||p===i&&h.isActive&&!v&&y||e>f&&y,w=!1;const S=Array.isArray(d)?d:[d];let x=S.reduce(o(p),{});!1===m&&(x={});const{prevResolvedValues:_={}}=h,k={..._,...x},A=e=>{b=!0,c.has(e)&&(w=!0,c.delete(e)),h.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in k){const e=x[t],n=_[t];if(l.hasOwnProperty(t))continue;let r=!1;r=zo(e)&&zo(n)?!Gp(e,n):e!==n,r?null!=e?A(t):c.add(t):void 0!==e&&c.has(t)?A(t):h.protectedKeys[t]=!0}h.prevProp=d,h.prevResolvedValues=x,h.isActive&&(l={...l,...x}),r&&t.blockInitialAnimation&&(b=!1);b&&(!(v&&g)||w)&&u.push(...S.map((t=>({animation:t,options:{type:p}}))))}if(c.size){const e={};c.forEach((n=>{const r=t.getBaseTarget(n),o=t.getValue(n);o&&(o.liveStyle=!0),e[n]=null!=r?r:null})),u.push({animation:e})}let p=Boolean(u.length);return!r||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(p=!1),r=!1,p?e(u):Promise.resolve()}return{animateChanges:i,setActive:function(e,r){var o;if(n[e].isActive===r)return Promise.resolve();null===(o=t.variantChildren)||void 0===o||o.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const a=i(e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Jp(),r=!0}}}function Zp(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Gp(e,t)}function Qp(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Jp(){return{animate:Qp(!0),whileInView:Qp(),whileHover:Qp(),whileTap:Qp(),whileDrag:Qp(),whileFocus:Qp(),exit:Qp()}}class th{constructor(t){this.isMounted=!1,this.node=t}update(){}}let eh=0;const nh={animation:{Feature:class extends th{constructor(t){super(t),t.animationState||(t.animationState=Kp(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();hi(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 th{constructor(){super(...arguments),this.id=eh++}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(){}}}},rh={x:!1,y:!1};function oh(){return rh.x||rh.y}const ih=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary;function ah(t){return{point:{x:t.pageX,y:t.pageY}}}function sh(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function uh(t,e,n,r){return sh(t,e,(t=>e=>ih(e)&&t(e,ah(e)))(n),r)}const ch=(t,e)=>Math.abs(t-e);class lh{constructor(t,e,{transformPagePoint:n,contextWindow:r,dragSnapToOrigin:o=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=hh(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=ch(t.x,e.x),r=ch(t.y,e.y);return Math.sqrt(n**2+r**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!n)return;const{point:r}=t,{timestamp:o}=kn;this.history.push({...r,timestamp:o});const{onStart:i,onMove:a}=this.handlers;e||(i&&i(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),a&&a(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=fh(e,this.transformPagePoint),xn.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:n,onSessionEnd:r,resumeAnimation:o}=this.handlers;if(this.dragSnapToOrigin&&o&&o(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const i=hh("pointercancel"===t.type?this.lastMoveEventInfo:fh(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,i),r&&r(t,i)},!ih(t))return;this.dragSnapToOrigin=o,this.handlers=e,this.transformPagePoint=n,this.contextWindow=r||window;const i=fh(ah(t),this.transformPagePoint),{point:a}=i,{timestamp:s}=kn;this.history=[{...a,timestamp:s}];const{onSessionStart:u}=e;u&&u(t,hh(i,this.history)),this.removeListeners=co(uh(this.contextWindow,"pointermove",this.handlePointerMove),uh(this.contextWindow,"pointerup",this.handlePointerUp),uh(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),_n(this.updatePoint)}}function fh(t,e){return e?{point:e(t.point)}:t}function ph(t,e){return{x:t.x-e.x,y:t.y-e.y}}function hh({point:t},e){return{point:t,delta:ph(t,yh(e)),offset:ph(t,dh(e)),velocity:mh(e,.1)}}function dh(t){return t[0]}function yh(t){return t[t.length-1]}function mh(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const o=yh(t);for(;n>=0&&(r=t[n],!(o.timestamp-r.timestamp>ie(e)));)n--;if(!r)return{x:0,y:0};const i=ae(o.timestamp-r.timestamp);if(0===i)return{x:0,y:0};const a={x:(o.x-r.x)/i,y:(o.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function vh(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function gh(t){return t.max-t.min}function bh(t,e,n,r=.5){t.origin=r,t.originPoint=De(e.min,e.max,t.origin),t.scale=gh(n)/gh(e),t.translate=De(n.min,n.max,t.origin)-t.originPoint,(t.scale>=.9999&&t.scale<=1.0001||isNaN(t.scale))&&(t.scale=1),(t.translate>=-.01&&t.translate<=.01||isNaN(t.translate))&&(t.translate=0)}function wh(t,e,n,r){bh(t.x,e.x,n.x,r?r.originX:void 0),bh(t.y,e.y,n.y,r?r.originY:void 0)}function Sh(t,e,n){t.min=n.min+e.min,t.max=t.min+gh(e)}function xh(t,e,n){t.min=e.min-n.min,t.max=t.min+gh(e)}function _h(t,e,n){xh(t.x,e.x,n.x),xh(t.y,e.y,n.y)}function kh(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function Ah(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}const Th=.35;function Eh(t,e,n){return{min:Ph(t,e),max:Ph(t,n)}}function Ph(t,e){return"number"==typeof t?t:t[e]||0}function Oh(t){return[t("x"),t("y")]}const jh=({current:t})=>t?t.ownerDocument.defaultView:null,Ch=new WeakMap;class Lh{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=t}start(t,{snapToCursor:e=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:r}=this.getProps();this.panSession=new lh(t,{onSessionStart:t=>{const{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(ah(t).point)},onStart:(t,e)=>{const{drag:n,dragPropagation:r,onDragStart:o}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(i=n)||"y"===i?rh[i]?null:(rh[i]=!0,()=>{rh[i]=!1}):rh.x||rh.y?null:(rh.x=rh.y=!0,()=>{rh.x=rh.y=!1}),!this.openDragLock))return;var i;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Oh((t=>{let e=this.getAxisMotionValue(t).get()||0;if(Zn.test(e)){const{projection:n}=this.visualElement;if(n&&n.layout){const r=n.layout.layoutBox[t];if(r){e=gh(r)*(parseFloat(e)/100)}}}this.originPoint[t]=e})),o&&xn.postRender((()=>o(t,e))),ni(this.visualElement,"transform");const{animationState:a}=this.visualElement;a&&a.setActive("whileDrag",!0)},onMove:(t,e)=>{const{dragPropagation:n,dragDirectionLock:r,onDirectionLock:o,onDrag:i}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:a}=e;if(r&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let n=null;Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x");return n}(a),void(null!==this.currentDirection&&o&&o(this.currentDirection));this.updateAxis("x",e.point,a),this.updateAxis("y",e.point,a),this.visualElement.render(),i&&i(t,e)},onSessionEnd:(t,e)=>this.stop(t,e),resumeAnimation:()=>Oh((t=>{var e;return"paused"===this.getAnimationState(t)&&(null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.play())}))},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:r,contextWindow:jh(this.visualElement)})}stop(t,e){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:r}=e;this.startAnimation(r);const{onDragEnd:o}=this.getProps();o&&xn.postRender((()=>o(t,e)))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(t,e,n){const{drag:r}=this.getProps();if(!n||!Ih(t,r,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(i=function(t,{min:e,max:n},r){return void 0!==e&&t<e?t=r?De(e,t,r.min):Math.max(t,e):void 0!==n&&t>n&&(t=r?De(n,t,r.max):Math.min(t,n)),t}(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){var t;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(t=this.visualElement.projection)||void 0===t?void 0:t.layout,o=this.constraints;e&&vh(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!r)&&function(t,{top:e,left:n,bottom:r,right:o}){return{x:kh(t.x,n,o),y:kh(t.y,e,r)}}(r.layoutBox,e),this.elastic=function(t=Th){return!1===t?t=0:!0===t&&(t=Th),{x:Eh(t,"left","right"),y:Eh(t,"top","bottom")}}(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Oh((t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const n={};return void 0!==e.min&&(n.min=e.min-t.min),void 0!==e.max&&(n.max=e.max-t.min),n}(r.layoutBox[t],this.constraints[t]))}))}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!vh(t))return!1;const n=t.current;fe(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const o=function(t,e,n){const r=ta(t,n),{scroll:o}=e;return o&&(Zi(r.x,o.offset.x),Zi(r.y,o.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let i=function(t,e){return{x:Ah(t.x,e.x),y:Ah(t.y,e.y)}}(r.layout.layoutBox,o);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(i));this.hasMutatedConstraints=!!t,t&&(i=Bi(t))}return i}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:r,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),s=this.constraints||{},u=Oh((a=>{if(!Ih(a,e,this.currentDirection))return;let u=s&&s[a]||{};i&&(u={min:0,max:0});const c=r?200:1e6,l=r?40:1e7,f={type:"inertia",velocity:n?t[a]:0,bounceStiffness:c,bounceDamping:l,timeConstant:750,restDelta:1,restSpeed:10,...o,...u};return this.startAxisValueAnimation(a,f)}));return Promise.all(u).then(a)}startAxisValueAnimation(t,e){const n=this.getAxisMotionValue(t);return ni(this.visualElement,t),n.start(Wo(t,n,0,e,this.visualElement,!1))}stopAnimation(){Oh((t=>this.getAxisMotionValue(t).stop()))}pauseAnimation(){Oh((t=>{var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.pause()}))}getAnimationState(t){var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.state}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),r=n[e];return r||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){Oh((e=>{const{drag:n}=this.getProps();if(!Ih(e,n,this.currentDirection))return;const{projection:r}=this.visualElement,o=this.getAxisMotionValue(e);if(r&&r.layout){const{min:n,max:i}=r.layout.layoutBox[e];o.set(t[e]-De(n,i,.5))}}))}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:n}=this.visualElement;if(!vh(e)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Oh((t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const n=e.get();r[t]=function(t,e){let n=.5;const r=gh(t),o=gh(e);return o>r?n=re(e.min,e.max-r,t.min):r>o&&(n=re(t.min,t.max-o,e.min)),pe(0,1,n)}({min:n,max:n},this.constraints[t])}}));const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),Oh((e=>{if(!Ih(e,t,null))return;const n=this.getAxisMotionValue(e),{min:o,max:i}=this.constraints[e];n.set(De(o,i,r[e]))}))}addListeners(){if(!this.visualElement.current)return;Ch.set(this.visualElement,this);const t=uh(this.visualElement.current,"pointerdown",(t=>{const{drag:e,dragListener:n=!0}=this.getProps();e&&n&&this.start(t)})),e=()=>{const{dragConstraints:t}=this.getProps();vh(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,r=n.addEventListener("measure",e);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),xn.read(e);const o=sh(window,"resize",(()=>this.scalePositionWithinConstraints())),i=n.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(Oh((e=>{const n=this.getAxisMotionValue(e);n&&(this.originPoint[e]+=t[e].translate,n.set(n.get()+t[e].translate))})),this.visualElement.render())}));return()=>{o(),t(),r(),i&&i()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:o=!1,dragElastic:i=Th,dragMomentum:a=!0}=t;return{...t,drag:e,dragDirectionLock:n,dragPropagation:r,dragConstraints:o,dragElastic:i,dragMomentum:a}}}function Ih(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}const Rh=t=>(e,n)=>{t&&xn.postRender((()=>t(e,n)))};var Nh=o(848);const Mh=(0,Rp.createContext)(null);const Dh=(0,Rp.createContext)({}),Fh=(0,Rp.createContext)({}),Bh={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Vh(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Uh={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!Qn.test(t))return t;t=parseFloat(t)}return`${Vh(t,e.target.x)}% ${Vh(t,e.target.y)}%`}},Gh={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,o=Mr.parse(t);if(o.length>5)return r;const i=Mr.createTransformer(t),a="number"!=typeof o[0]?1:0,s=n.x.scale*e.x,u=n.y.scale*e.y;o[0+a]/=s,o[1+a]/=u;const c=De(s,u,.5);return"number"==typeof o[2+a]&&(o[2+a]/=c),"number"==typeof o[3+a]&&(o[3+a]/=c),i(o)}},{schedule:Wh,cancel:zh}=Sn(queueMicrotask,!1);class Hh extends Rp.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n,layoutId:r}=this.props,{projection:o}=t;var i;i=Yh,Object.assign(ai,i),o&&(e.group&&e.group.add(o),n&&n.register&&r&&n.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",(()=>{this.safeToRemove()})),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),Bh.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:n,drag:r,isPresent:o}=this.props,i=n.projection;return i?(i.isPresent=o,r||t.layoutDependency!==e||void 0===e?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||xn.postRender((()=>{const t=i.getStack();t&&t.members.length||this.safeToRemove()}))),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Wh.postRender((()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()})))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n}=this.props,{projection:r}=t;r&&(r.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function $h(t){const[e,n]=function(){const t=(0,Rp.useContext)(Mh);if(null===t)return[!0,null];const{isPresent:e,onExitComplete:n,register:r}=t,o=(0,Rp.useId)();(0,Rp.useEffect)((()=>r(o)),[]);const i=(0,Rp.useCallback)((()=>n&&n(o)),[o,n]);return!e&&n?[!1,i]:[!0]}(),r=(0,Rp.useContext)(Dh);return(0,Nh.jsx)(Hh,{...t,layoutGroup:r,switchLayoutGroup:(0,Rp.useContext)(Fh),isPresent:e,safeToRemove:n})}const Yh={borderRadius:{...Uh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Uh,borderTopRightRadius:Uh,borderBottomLeftRadius:Uh,borderBottomRightRadius:Uh,boxShadow:Gh},qh=["TopLeft","TopRight","BottomLeft","BottomRight"],Xh=qh.length,Kh=t=>"string"==typeof t?parseFloat(t):t,Zh=t=>"number"==typeof t||Qn.test(t);function Qh(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const Jh=ed(0,.5,Nn),td=ed(.5,.95,ce);function ed(t,e,n){return r=>r<t?0:r>e?1:n(re(t,e,r))}function nd(t,e){t.min=e.min,t.max=e.max}function rd(t,e){nd(t.x,e.x),nd(t.y,e.y)}function od(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function id(t,e,n,r,o){return t=Hi(t-=e,1/n,r),void 0!==o&&(t=Hi(t,1/o,r)),t}function ad(t,e,[n,r,o],i,a){!function(t,e=0,n=1,r=.5,o,i=t,a=t){Zn.test(e)&&(e=parseFloat(e),e=De(a.min,a.max,e/100)-a.min);if("number"!=typeof e)return;let s=De(i.min,i.max,r);t===i&&(s-=e),t.min=id(t.min,e,n,s,o),t.max=id(t.max,e,n,s,o)}(t,e[n],e[r],e[o],e.scale,i,a)}const sd=["x","scaleX","originX"],ud=["y","scaleY","originY"];function cd(t,e,n,r){ad(t.x,e,sd,n?n.x:void 0,r?r.x:void 0),ad(t.y,e,ud,n?n.y:void 0,r?r.y:void 0)}function ld(t){return 0===t.translate&&1===t.scale}function fd(t){return ld(t.x)&&ld(t.y)}function pd(t,e){return t.min===e.min&&t.max===e.max}function hd(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function dd(t,e){return hd(t.x,e.x)&&hd(t.y,e.y)}function yd(t){return gh(t.x)/gh(t.y)}function md(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class vd{constructor(){this.members=[]}add(t){qe(this.members,t),t.scheduleRender()}remove(t){if(Xe(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){const e=this.members.findIndex((e=>t===e));if(0===e)return!1;let n;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){n=e;break}}return!!n&&(this.promote(n),!0)}promote(t,e){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,e&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:r}=t.options;!1===r&&n.hide()}}exitAnimationComplete(){this.members.forEach((t=>{const{options:e,resumingFrom:n}=t;e.onExitComplete&&e.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()}))}scheduleRender(){this.members.forEach((t=>{t.instance&&t.scheduleRender(!1)}))}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const gd=(t,e)=>t.depth-e.depth;class bd{constructor(){this.children=[],this.isDirty=!1}add(t){qe(this.children,t),this.isDirty=!0}remove(t){Xe(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(gd),this.isDirty=!1,this.children.forEach(t)}}function wd(t){const e=Ve(t)?t.get():t;return n=e,Boolean(n&&"object"==typeof n&&n.mix&&n.toValue)?e.toValue():e;var n}function Sd(t,e){const n=Qr.now(),r=({timestamp:o})=>{const i=o-n;i>=e&&(_n(r),t(i-e))};return xn.read(r,!0),()=>_n(r)}const xd={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},_d="undefined"!=typeof window&&void 0!==window.MotionDebug,kd=["","X","Y","Z"],Ad={visibility:"hidden"};let Td=0;function Ed(t,e,n,r){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Pd(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=ei(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",xn,!(e||r))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&Pd(r)}function Od({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(t={},n=(null==e?void 0:e())){this.id=Td++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,_d&&(xd.totalNodes=xd.resolvedTargetDeltas=xd.recalculatedProjection=0),this.nodes.forEach(Ld),this.nodes.forEach(Bd),this.nodes.forEach(Vd),this.nodes.forEach(Id),_d&&window.MotionDebug.record(xd)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new bd)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new Ho),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const n=this.eventHandlers.get(t);n&&n.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e,n=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=ii(e),this.instance=e;const{layoutId:r,layout:o,visualElement:i}=this.options;if(i&&!i.current&&i.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(o||r)&&(this.isLayoutDirty=!0),t){let n;const r=()=>this.root.updateBlockedByResize=!1;t(e,(()=>{this.root.updateBlockedByResize=!0,n&&n(),n=Sd(r,250),Bh.hasAnimatedSinceResize&&(Bh.hasAnimatedSinceResize=!1,this.nodes.forEach(Fd))}))}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&i&&(r||o)&&this.addEventListener("didUpdate",(({delta:t,hasLayoutChanged:e,hasRelativeTargetChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const o=this.options.transition||i.getDefaultTransition()||$d,{onLayoutAnimationStart:a,onLayoutAnimationComplete:s}=i.getProps(),u=!this.targetLayout||!dd(this.targetLayout,r)||n,c=!e&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||c||e&&(u||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,c);const e={...dn(o,"layout"),onPlay:a,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else e||Fd(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,_n(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Ud),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Pd(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:n}=this.options;if(void 0===e&&!n)return;const r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(Nd);this.isUpdating||this.nodes.forEach(Md),this.isUpdating=!1,this.nodes.forEach(Dd),this.nodes.forEach(jd),this.nodes.forEach(Cd),this.clearAllSnapshots();const t=Qr.now();kn.delta=pe(0,1e3/60,t-kn.timestamp),kn.timestamp=t,kn.isProcessing=!0,An.update.process(kn),An.preRender.process(kn),An.render.process(kn),kn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Wh.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Rd),this.sharedNodes.forEach(Gd)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,xn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){xn.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}},this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(t="measure"){let e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e){const e=r(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!o)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!fd(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,i=r!==this.prevTransformTemplateValue;t&&(e||Gi(this.latestValues)||i)&&(o(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let n=this.removeElementScroll(e);var r;return t&&(n=this.removeTransform(n)),Xd((r=n).x),Xd(r.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){var t;const{visualElement:e}=this.options;if(!e)return{x:{min:0,max:0},y:{min:0,max:0}};const n=e.measureViewportBox();if(!((null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)||this.path.some(Zd))){const{scroll:t}=this.root;t&&(Zi(n.x,t.offset.x),Zi(n.y,t.offset.y))}return n}removeElementScroll(t){var e;const n={x:{min:0,max:0},y:{min:0,max:0}};if(rd(n,t),null===(e=this.scroll)||void 0===e?void 0:e.wasRoot)return n;for(let e=0;e<this.path.length;e++){const r=this.path[e],{scroll:o,options:i}=r;r!==this.root&&o&&i.layoutScroll&&(o.wasRoot&&rd(n,t),Zi(n.x,o.offset.x),Zi(n.y,o.offset.y))}return n}applyTransform(t,e=!1){const n={x:{min:0,max:0},y:{min:0,max:0}};rd(n,t);for(let t=0;t<this.path.length;t++){const r=this.path[t];!e&&r.options.layoutScroll&&r.scroll&&r!==r.root&&Ji(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),Gi(r.latestValues)&&Ji(n,r.latestValues)}return Gi(this.latestValues)&&Ji(n,this.latestValues),n}removeTransform(t){const e={x:{min:0,max:0},y:{min:0,max:0}};rd(e,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];if(!n.instance)continue;if(!Gi(n.latestValues))continue;Ui(n.latestValues)&&n.updateSnapshot();const r={x:{min:0,max:0},y:{min:0,max:0}};rd(r,n.measurePageBox()),cd(e,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return Gi(this.latestValues)&&cd(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==kn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(t=!1){var e;const n=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=n.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=n.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=n.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==n;if(!(t||r&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:o,layoutId:i}=this.options;if(this.layout&&(o||i)){if(this.resolvedRelativeTargetAt=kn.timestamp,!this.targetDelta&&!this.relativeTarget){const t=this.getClosestProjectingParent();t&&t.layout&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},_h(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),rd(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var a,s,u;if(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),a=this.target,s=this.relativeTarget,u=this.relativeParent.target,Sh(a.x,s.x,u.x),Sh(a.y,s.y,u.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):rd(this.target,this.layout.layoutBox),qi(this.target,this.targetDelta)):rd(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const t=this.getClosestProjectingParent();t&&Boolean(t.resumingFrom)===Boolean(this.resumingFrom)&&!t.options.layoutScroll&&t.target&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},_h(this.relativeTargetOrigin,this.target,t.target),rd(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}_d&&xd.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(this.parent&&!Ui(this.parent.latestValues)&&!Wi(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var t;const e=this.getLead(),n=Boolean(this.resumingFrom)||this!==e;let r=!0;if((this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty))&&(r=!1),n&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===kn.timestamp&&(r=!1),r)return;const{layout:o,layoutId:i}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!o&&!i)return;rd(this.layoutCorrected,this.layout.layoutBox);const a=this.treeScale.x,s=this.treeScale.y;!function(t,e,n,r=!1){const o=n.length;if(!o)return;let i,a;e.x=e.y=1;for(let s=0;s<o;s++){i=n[s],a=i.projectionDelta;const{visualElement:o}=i.options;o&&o.props.style&&"contents"===o.props.style.display||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Ji(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),a&&(e.x*=a.x.scale,e.y*=a.y.scale,qi(t,a)),r&&Gi(i.latestValues)&&Ji(t,i.latestValues))}e.x<Ki&&e.x>Xi&&(e.x=1),e.y<Ki&&e.y>Xi&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:u}=e;u?(this.projectionDelta&&this.prevProjectionDelta?(od(this.prevProjectionDelta.x,this.projectionDelta.x),od(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),wh(this.projectionDelta,this.layoutCorrected,u,this.latestValues),this.treeScale.x===a&&this.treeScale.y===s&&md(this.projectionDelta.x,this.prevProjectionDelta.x)&&md(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",u)),_d&&xd.recalculatedProjection++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){var e;if(null===(e=this.options.visualElement)||void 0===e||e.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(t,e=!1){const n=this.snapshot,r=n?n.latestValues:{},o={...this.latestValues},i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const a={x:{min:0,max:0},y:{min:0,max:0}},s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),u=this.getStack(),c=!u||u.members.length<=1,l=Boolean(s&&!c&&!0===this.options.crossfade&&!this.path.some(Hd));let f;this.animationProgress=0,this.mixTargetDelta=e=>{const n=e/1e3;var u,p,h,d,y,m;Wd(i.x,t.x,n),Wd(i.y,t.y,n),this.setTargetDelta(i),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(_h(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox),h=this.relativeTarget,d=this.relativeTargetOrigin,y=a,m=n,zd(h.x,d.x,y.x,m),zd(h.y,d.y,y.y,m),f&&(u=this.relativeTarget,p=f,pd(u.x,p.x)&&pd(u.y,p.y))&&(this.isProjectionDirty=!1),f||(f={x:{min:0,max:0},y:{min:0,max:0}}),rd(f,this.relativeTarget)),s&&(this.animationValues=o,function(t,e,n,r,o,i){o?(t.opacity=De(0,void 0!==n.opacity?n.opacity:1,Jh(r)),t.opacityExit=De(void 0!==e.opacity?e.opacity:1,0,td(r))):i&&(t.opacity=De(void 0!==e.opacity?e.opacity:1,void 0!==n.opacity?n.opacity:1,r));for(let o=0;o<Xh;o++){const i=`border${qh[o]}Radius`;let a=Qh(e,i),s=Qh(n,i);void 0===a&&void 0===s||(a||(a=0),s||(s=0),0===a||0===s||Zh(a)===Zh(s)?(t[i]=Math.max(De(Kh(a),Kh(s),r),0),(Zn.test(s)||Zn.test(a))&&(t[i]+="%")):t[i]=s)}(e.rotate||n.rotate)&&(t.rotate=De(e.rotate||0,n.rotate||0,r))}(o,r,this.latestValues,n,l,c)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(_n(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=xn.update((()=>{Bh.hasAnimatedSinceResize=!0,this.currentAnimation=ia(0,1e3,{...t,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:n,layout:r,latestValues:o}=t;if(e&&n&&r){if(this!==t&&this.layout&&r&&Kd(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const e=gh(this.layout.layoutBox.x);n.x.min=t.target.x.min,n.x.max=n.x.min+e;const r=gh(this.layout.layoutBox.y);n.y.min=t.target.y.min,n.y.max=n.y.min+r}rd(e,n),Ji(e,o),wh(this.projectionDeltaWithTransform,this.layoutCorrected,e,o)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new vd);this.sharedNodes.get(t).add(e);const n=e.options.initialPromotionConfig;e.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){var t;const{layoutId:e}=this.options;return e&&(null===(t=this.getStack())||void 0===t?void 0:t.lead)||this}getPrevLead(){var t;const{layoutId:e}=this.options;return e?null===(t=this.getStack())||void 0===t?void 0:t.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:n}={}){const r=this.getStack();r&&r.promote(this,n),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:n}=t;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(e=!0),!e)return;const r={};n.z&&Ed("z",t,r,this.animationValues);for(let e=0;e<kd.length;e++)Ed(`rotate${kd[e]}`,t,r,this.animationValues),Ed(`skew${kd[e]}`,t,r,this.animationValues);t.render();for(const e in r)t.setStaticValue(e,r[e]),this.animationValues&&(this.animationValues[e]=r[e]);t.scheduleRender()}getProjectionStyles(t){var e,n;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Ad;const r={visibility:""},o=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,r.opacity="",r.pointerEvents=wd(null==t?void 0:t.pointerEvents)||"",r.transform=o?o(this.latestValues,""):"none",r;const i=this.getLead();if(!this.projectionDelta||!this.layout||!i.target){const e={};return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=wd(null==t?void 0:t.pointerEvents)||""),this.hasProjected&&!Gi(this.latestValues)&&(e.transform=o?o({},""):"none",this.hasProjected=!1),e}const a=i.animationValues||i.latestValues;this.applyTransformsToTarget(),r.transform=function(t,e,n){let r="";const o=t.x.translate/e.x,i=t.y.translate/e.y,a=(null==n?void 0:n.z)||0;if((o||i||a)&&(r=`translate3d(${o}px, ${i}px, ${a}px) `),1===e.x&&1===e.y||(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:t,rotate:e,rotateX:o,rotateY:i,skewX:a,skewY:s}=n;t&&(r=`perspective(${t}px) ${r}`),e&&(r+=`rotate(${e}deg) `),o&&(r+=`rotateX(${o}deg) `),i&&(r+=`rotateY(${i}deg) `),a&&(r+=`skewX(${a}deg) `),s&&(r+=`skewY(${s}deg) `)}const s=t.x.scale*e.x,u=t.y.scale*e.y;return 1===s&&1===u||(r+=`scale(${s}, ${u})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,a),o&&(r.transform=o(a,r.transform));const{x:s,y:u}=this.projectionDelta;r.transformOrigin=`${100*s.origin}% ${100*u.origin}% 0`,i.animationValues?r.opacity=i===this?null!==(n=null!==(e=a.opacity)&&void 0!==e?e:this.latestValues.opacity)&&void 0!==n?n:1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:r.opacity=i===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0;for(const t in ai){if(void 0===a[t])continue;const{correct:e,applyTo:n}=ai[t],o="none"===r.transform?a[t]:e(a[t],i);if(n){const t=n.length;for(let e=0;e<t;e++)r[n[e]]=o}else r[t]=o}return this.options.layoutId&&(r.pointerEvents=i===this?wd(null==t?void 0:t.pointerEvents)||"":"none"),r}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((t=>{var e;return null===(e=t.currentAnimation)||void 0===e?void 0:e.stop()})),this.root.nodes.forEach(Nd),this.root.sharedNodes.clear()}}}function jd(t){t.updateLayout()}function Cd(t){var e;const n=(null===(e=t.resumeFrom)||void 0===e?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:r}=t.layout,{animationType:o}=t.options,i=n.source!==t.layout.source;"size"===o?Oh((t=>{const r=i?n.measuredBox[t]:n.layoutBox[t],o=gh(r);r.min=e[t].min,r.max=r.min+o})):Kd(o,n.layoutBox,e)&&Oh((r=>{const o=i?n.measuredBox[r]:n.layoutBox[r],a=gh(e[r]);o.max=o.min+a,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[r].max=t.relativeTarget[r].min+a)}));const a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};wh(a,e,n.layoutBox);const s={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};i?wh(s,t.applyTransform(r,!0),n.measuredBox):wh(s,e,n.layoutBox);const u=!fd(a);let c=!1;if(!t.resumeFrom){const r=t.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:o,layout:i}=r;if(o&&i){const a={x:{min:0,max:0},y:{min:0,max:0}};_h(a,n.layoutBox,o.layoutBox);const s={x:{min:0,max:0},y:{min:0,max:0}};_h(s,e,i.layoutBox),dd(a,s)||(c=!0),r.options.layoutRoot&&(t.relativeTarget=s,t.relativeTargetOrigin=a,t.relativeParent=r)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:n,delta:s,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function Ld(t){_d&&xd.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Id(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Rd(t){t.clearSnapshot()}function Nd(t){t.clearMeasurements()}function Md(t){t.isLayoutDirty=!1}function Dd(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Fd(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Bd(t){t.resolveTargetDelta()}function Vd(t){t.calcProjection()}function Ud(t){t.resetSkewAndRotation()}function Gd(t){t.removeLeadSnapshot()}function Wd(t,e,n){t.translate=De(e.translate,0,n),t.scale=De(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function zd(t,e,n,r){t.min=De(e.min,n.min,r),t.max=De(e.max,n.max,r)}function Hd(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const $d={duration:.45,ease:[.4,0,.1,1]},Yd=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),qd=Yd("applewebkit/")&&!Yd("chrome/")?Math.round:ce;function Xd(t){t.min=qd(t.min),t.max=qd(t.max)}function Kd(t,e,n){return"position"===t||"preserve-aspect"===t&&(r=yd(e),o=yd(n),i=.2,!(Math.abs(r-o)<=i));var r,o,i}function Zd(t){var e;return t!==t.root&&(null===(e=t.scroll)||void 0===e?void 0:e.wasRoot)}const Qd=Od({attachResizeListener:(t,e)=>sh(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Jd={current:void 0},ty=Od({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Jd.current){const t=new Qd({});t.mount(window),t.setOptions({layoutScroll:!0}),Jd.current=t}return Jd.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)}),ey={pan:{Feature:class extends th{constructor(){super(...arguments),this.removePointerDownListener=ce}onPointerDown(t){this.session=new lh(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:jh(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Rh(t),onStart:Rh(e),onMove:n,onEnd:(t,e)=>{delete this.session,r&&xn.postRender((()=>r(t,e)))}}}mount(){this.removePointerDownListener=uh(this.node.current,"pointerdown",(t=>this.onPointerDown(t)))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends th{constructor(t){super(t),this.removeGroupControls=ce,this.removeListeners=ce,this.controls=new Lh(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ce}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:ty,MeasureLayout:$h}};function ny(t,e){const n=Ue(t),r=new AbortController;return[n,{passive:!0,...e,signal:r.signal},()=>r.abort()]}function ry(t){return e=>{"touch"===e.pointerType||oh()||t(e)}}function oy(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover","Start"===n);const o=r["onHover"+n];o&&xn.postRender((()=>o(e,ah(e))))}const iy=new WeakSet;function ay(t){return e=>{"Enter"===e.key&&t(e)}}function sy(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const uy=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const cy=(t,e)=>!!e&&(t===e||cy(t,e.parentElement));function ly(t){return ih(t)&&!oh()}function fy(t,e,n={}){const[r,o,i]=ny(t,n),a=t=>{const r=t.currentTarget;if(!ly(t)||iy.has(r))return;iy.add(r);const i=e(t),a=(t,e)=>{window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",u),ly(t)&&iy.has(r)&&(iy.delete(r),i&&i(t,{success:e}))},s=t=>{a(t,n.useGlobalTarget||cy(r,t.target))},u=t=>{a(t,!1)};window.addEventListener("pointerup",s,o),window.addEventListener("pointercancel",u,o)};return r.forEach((t=>{(function(t){return uy.has(t.tagName)||-1!==t.tabIndex})(t)||(t.tabIndex=0);(n.useGlobalTarget?window:t).addEventListener("pointerdown",a,o),t.addEventListener("focus",(t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const r=ay((()=>{if(iy.has(n))return;sy(n,"down");const t=ay((()=>{sy(n,"up")}));n.addEventListener("keyup",t,e),n.addEventListener("blur",(()=>sy(n,"cancel")),e)}));n.addEventListener("keydown",r,e),n.addEventListener("blur",(()=>n.removeEventListener("keydown",r)),e)})(t,o)),o)})),i}function py(t,e,n){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap","Start"===n);const o=r["onTap"+("End"===n?"":n)];o&&xn.postRender((()=>o(e,ah(e))))}const hy=new WeakMap,dy=new WeakMap,yy=t=>{const e=hy.get(t.target);e&&e(t)},my=t=>{t.forEach(yy)};function vy(t,e,n){const r=function({root:t,...e}){const n=t||document;dy.has(n)||dy.set(n,{});const r=dy.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(my,{root:t,...e})),r[o]}(e);return hy.set(t,n),r.observe(t),()=>{hy.delete(t),r.unobserve(t)}}const gy={some:0,all:1};const by={inView:{Feature:class extends th{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:gy[r]};return vy(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 th{mount(){const{current:t}=this.node;t&&(this.unmount=fy(t,(t=>(py(this.node,t,"Start"),(t,{success:e})=>py(this.node,t,e?"End":"Cancel"))),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends th{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=co(sh(this.node.current,"focus",(()=>this.onFocus())),sh(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends th{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[r,o,i]=ny(t,n),a=ry((t=>{const{target:n}=t,r=e(t);if(!r||!n)return;const i=ry((t=>{r(t),n.removeEventListener("pointerleave",i)}));n.addEventListener("pointerleave",i,o)}));return r.forEach((t=>{t.addEventListener("pointerenter",a,o)})),i}(t,(t=>(oy(this.node,t,"Start"),t=>oy(this.node,t,"End")))))}unmount(){}}}},wy={layout:{ProjectionNode:ty,MeasureLayout:$h}},Sy=(0,Rp.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),xy=(0,Rp.createContext)({}),_y=li?Rp.useLayoutEffect:Rp.useEffect,ky=(0,Rp.createContext)({strict:!1});function Ay(t,e,n,r,o){var i,a;const{visualElement:s}=(0,Rp.useContext)(xy),u=(0,Rp.useContext)(ky),c=(0,Rp.useContext)(Mh),l=(0,Rp.useContext)(Sy).reducedMotion,f=(0,Rp.useRef)(null);r=r||u.renderer,!f.current&&r&&(f.current=r(t,{visualState:e,parent:s,props:n,presenceContext:c,blockInitialAnimation:!!c&&!1===c.initial,reducedMotionConfig:l}));const p=f.current,h=(0,Rp.useContext)(Fh);!p||p.projection||!o||"html"!==p.type&&"svg"!==p.type||function(t,e,n,r){const{layoutId:o,layout:i,drag:a,dragConstraints:s,layoutScroll:u,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Ty(t.parent)),t.projection.setOptions({layoutId:o,layout:i,alwaysMeasureLayout:Boolean(a)||s&&vh(s),visualElement:t,animationType:"string"==typeof i?i:"both",initialPromotionConfig:r,layoutScroll:u,layoutRoot:c})}(f.current,n,o,h);const d=(0,Rp.useRef)(!1);(0,Rp.useInsertionEffect)((()=>{p&&d.current&&p.update(n,c)}));const y=n[ti],m=(0,Rp.useRef)(Boolean(y)&&!(null===(i=window.MotionHandoffIsComplete)||void 0===i?void 0:i.call(window,y))&&(null===(a=window.MotionHasOptimisedAnimation)||void 0===a?void 0:a.call(window,y)));return _y((()=>{p&&(d.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),Wh.render(p.render),m.current&&p.animationState&&p.animationState.animateChanges())})),(0,Rp.useEffect)((()=>{p&&(!m.current&&p.animationState&&p.animationState.animateChanges(),m.current&&(queueMicrotask((()=>{var t;null===(t=window.MotionHandoffMarkAsComplete)||void 0===t||t.call(window,y)})),m.current=!1))})),p}function Ty(t){if(t)return!1!==t.options.allowProjection?t.projection:Ty(t.parent)}function Ey(t,e,n){return(0,Rp.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):vh(n)&&(n.current=r))}),[e])}function Py(t){const{initial:e,animate:n}=function(t,e){if(vi(t)){const{initial:e,animate:n}=t;return{initial:!1===e||di(e)?e:void 0,animate:di(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,Rp.useContext)(xy));return(0,Rp.useMemo)((()=>({initial:e,animate:n})),[Oy(e),Oy(n)])}function Oy(t){return Array.isArray(t)?t.join(" "):t}const jy=Symbol.for("motionComponentSymbol");function Cy({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:o}){t&&function(t){for(const e in t)wi[e]={...wi[e],...t[e]}}(t);const i=(0,Rp.forwardRef)((function(t,i){let a;const s={...(0,Rp.useContext)(Sy),...t,layoutId:Ly(t)},{isStatic:u}=s,c=Py(t),l=r(t,u);if(!u&&li){!function(){(0,Rp.useContext)(ky).strict;0}();const t=function(t){const{drag:e,layout:n}=wi;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=Ay(o,l,s,e,t.ProjectionNode)}return(0,Nh.jsxs)(xy.Provider,{value:c,children:[a&&c.visualElement?(0,Nh.jsx)(a,{visualElement:c.visualElement,...s}):null,n(o,t,Ey(l,c.visualElement,i),l,u,c.visualElement)]})}));return i[jy]=o,i}function Ly({layoutId:t}){const e=(0,Rp.useContext)(Dh).id;return e&&void 0!==t?e+"-"+t:t}const Iy=["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 Ry(t){return"string"==typeof t&&!t.includes("-")&&!!(Iy.indexOf(t)>-1||/[A-Z]/u.test(t))}const Ny=t=>(e,n)=>{const r=(0,Rp.useContext)(xy),o=(0,Rp.useContext)(Mh),i=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,o,i){const a={latestValues:My(r,o,i,t),renderState:e()};return n&&(a.mount=t=>n(r,t,a)),a}(t,e,r,o);return n?i():function(t){const e=(0,Rp.useRef)(null);return null===e.current&&(e.current=t()),e.current}(i)};function My(t,e,n,r){const o={},i=r(t,{});for(const t in i)o[t]=wd(i[t]);let{initial:a,animate:s}=t;const u=vi(t),c=gi(t);e&&c&&!u&&!1!==t.inherit&&(void 0===a&&(a=e.initial),void 0===s&&(s=e.animate));let l=!!n&&!1===n.initial;l=l||!1===a;const f=l?s:a;if(f&&"boolean"!=typeof f&&!hi(f)){const e=Array.isArray(f)?f:[f];for(let n=0;n<e.length;n++){const r=Ko(t,e[n]);if(r){const{transitionEnd:t,transition:e,...n}=r;for(const t in n){let e=n[t];if(Array.isArray(e)){e=e[l?e.length-1:0]}null!==e&&(o[t]=e)}for(const e in t)o[e]=t[e]}}}return o}const Dy=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Fy=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}}),By={useVisualState:Ny({scrapeMotionValuesFromProps:ci,createRenderState:Fy,onMount:(t,e,{renderState:n,latestValues:r})=>{xn.read((()=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}})),xn.render((()=>{Ii(n,r,Di(e.tagName),t.transformTemplate),Mi(e,n)}))}})},Vy={useVisualState:Ny({scrapeMotionValuesFromProps:ui,createRenderState:Dy})};function Uy(t,e,n){for(const r in e)Ve(e[r])||si(r,n)||(t[r]=e[r])}function Gy(t,e){const n={};return Uy(n,t.style||{},t),Object.assign(n,function({transformTemplate:t},e){return(0,Rp.useMemo)((()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return Oi(n,e,t),Object.assign({},n.vars,n.style)}),[e])}(t,e)),n}function Wy(t,e){const n={},r=Gy(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 zy=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 Hy(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||zy.has(t)}let $y=t=>!Hy(t);try{(Yy=require("@emotion/is-prop-valid").default)&&($y=t=>t.startsWith("on")?!Hy(t):Yy(t))}catch(t){}var Yy;function qy(t,e,n,r){const o=(0,Rp.useMemo)((()=>{const n={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return Ii(n,e,Di(r),t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};Uy(e,t.style,t),o.style={...e,...o.style}}return o}function Xy(t=!1){return(e,n,r,{latestValues:o},i)=>{const a=(Ry(e)?qy:Wy)(n,o,i,e),s=function(t,e,n){const r={};for(const o in t)"values"===o&&"object"==typeof t.values||($y(o)||!0===n&&Hy(o)||!e&&!Hy(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}(n,"string"==typeof e,t),u=e!==Rp.Fragment?{...s,...a,ref:r}:{},{children:c}=n,l=(0,Rp.useMemo)((()=>Ve(c)?c.get():c),[c]);return(0,Rp.createElement)(e,{...u,children:l})}}function Ky(t,e){return function(n,{forwardMotionProps:r}={forwardMotionProps:!1}){return Cy({...Ry(n)?By:Vy,preloadedFeatures:t,useRender:Xy(r),createVisualElement:e,Component:n})}}const Zy=Up(Ky({...nh,...by,...ey,...wy},((t,e)=>Ry(t)?new Fi(e):new ea(e,{allowProjection:t!==Rp.Fragment}))));function Qy(){return Qy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Qy.apply(null,arguments)}function Jy(t,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 tm(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)?tm(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 tm(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 em=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};function nm(t){var e=t.children,n=t.border,r=void 0===n?"solid":n,o=t.color,i=void 0===o?"red":o,a=t.tag,s=t.borderWidth,u=void 0===s?1:s,c=t.as,l=void 0===c?"div":c,f=t.Ref,p=em(t,["children","border","color","tag","borderWidth","as","Ref"]),h=Vp().game,d=Jy((0,Rp.useState)(!1),2),y=d[0],m=d[1];if(!h.config.app.inspector)return Np().createElement(l,Qy({},p,{ref:f}),e);var v=Object.assign(Object.assign({},p),{onMouseEnter:function(){return m(!0)},onMouseLeave:function(){return m(!1)},style:Object.assign(Object.assign({},p.style||{}),{outline:"".concat(u,"px ").concat(r," ").concat(i),zIndex:y?1e3:"auto"})});return Np().createElement(l,Qy({},v,{ref:f}),a&&y&&Np().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black text-sm"},a),e)}function rm(t){var e=t.border,n=void 0===e?"solid":e,r=t.color,o=void 0===r?"red":r,i=t.tag,a=t.borderWidth,s=void 0===a?1:a,u=t.as,c=void 0===u?"img":u,l=em(t,["border","color","tag","borderWidth","as"]),f=Vp().game,p=Jy((0,Rp.useState)(!1),2),h=p[0],d=p[1];if(!f.config.app.inspector)return Np().createElement(c,l);var y=Object.assign(Object.assign({},l),{onMouseEnter:function(){return d(!0)},onMouseLeave:function(){return d(!1)},style:Object.assign(Object.assign({},l.style||{}),{outline:"".concat(n," ").concat(s,"px ").concat(o),zIndex:h?1e3:"auto"})});return Np().createElement("div",null,Np().createElement(c,y),i&&h&&Np().createElement("span",{className:"absolute top-0 left-0 bg-white text-black border-2 border-black"},i))}const om={Div:function(t){return Np().createElement(nm,Qy({},t,{as:"div"}))},Span:function(t){return Np().createElement(nm,Qy({},t,{as:"span"}))},Button:function(t){return Np().createElement(nm,Qy({},t,{as:"button"}))},Img:function(t){return Np().createElement(rm,Qy({},t,{as:"img"}))},mDiv:function(t){return Np().createElement(nm,Qy({},t,{as:Zy.div,Ref:t.Ref}))}};function im(t){return im="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},im(t)}function am(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */am=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 v?e:v,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",h="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(C([])));x&&x!==n&&r.call(x,a)&&(w=x);var _=b.prototype=v.prototype=Object.create(w);function k(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"==im(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===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===m)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")),m;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(im(e)+" is not iterable")}return g.prototype=b,o(_,"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(_),t},e.awrap=function(t){return{__await:t}},k(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()}))},k(_),c(_,u,"Generator"),c(_,a,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function sm(t){return function(t){if(Array.isArray(t))return lm(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||cm(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 um(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)||cm(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 cm(t,e){if(t){if("string"==typeof t)return lm(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)?lm(t,e):void 0}}function lm(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 fm(t){var e=am().mark(M),n=t.sentence,r=t.gameState,o=t.useTypeEffect,i=void 0===o||o,a=t.onCompleted,s=t.finished,u=t.count,c=t.className,l=t.words,f=um((0,Rp.useState)(!1),2),p=f[0],h=f[1],d=r.game,y=(0,Rp.useMemo)((function(){return l||n.evaluate(bp.getCtx({gameState:r}))}),[]),m=um((0,Rp.useState)([]),2),v=m[0],g=m[1],b=(0,Rp.useRef)(M(y)),w=(0,Rp.useRef)(null),S=(0,Rp.useRef)(null),x=um((0,Rp.useState)(0),2),_=x[0],k=x[1],A=um((0,Rp.useReducer)((function(t){return t+1}),0),2)[1],T=um((0,Rp.useState)(new Set),2),P=T[0],O=T[1],j=um((0,Rp.useState)(!1),2),C=j[0],L=j[1];function I(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];S.current&&(clearTimeout(S.current),S.current=null);for(var e=!1;!e;){var n=b.current.next(),o=n.done,i=n.value;if(o)h(!0),a&&(r.logger.info("Say","Completed",o,i),a()),e=!0;else if($u.isPause(i)){if(t)continue;N($u.from(i)),e=!0}else R(i)}}function R(t){g((function(e){if("\n"!==t&&P.has(t))return e;O((function(e){return new Set(e).add(t)}));var n=e[e.length-1];return n&&"\n"!==n&&"\n"!==t&&n.tag===t.tag?[].concat(sm(e.slice(0,-1)),[{text:n.text+t.text,config:t.config,tag:t.tag,tag2:t.tag2}]):[].concat(sm(e),[t])}))}function N(t){r.logger.info("Say","Paused",t),t.config.duration?w.current=setTimeout((function(){w.current=null,k((function(t){return t+1}))}),t.config.duration):L(!0)}function M(t){var n,r,o,i,a;return am().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=sm(t),r=0;case 2:if(!(r<n.length)){e.next=24;break}if(o=n[r],!$u.isPause(o.text)){e.next=8;break}return e.next=7,$u.from(o.text);case 7:return e.abrupt("continue",21);case 8:i=0;case 9:if(!(i<o.text.length)){e.next=21;break}if("\n"!==(a=o.text[i])){e.next=16;break}return e.next=14,"\n";case 14:e.next=18;break;case 16:return e.next=18,{text:a,config:o.config,tag:r,tag2:i};case 18:i++,e.next=9;break;case 21:r++,e.next=2;break;case 24:return e.abrupt("return");case 25:case"end":return e.stop()}}),e)}return(0,Rp.useEffect)((function(){if(i||I(!0),s&&!p)return w.current&&clearTimeout(w.current),w.current=null,I(!0),void(a&&(r.logger.info("Say","Completed",w.current,s,p),a()));if(p||s||C||w.current)r.logger.debug("Sentence.tsx","locked",p,s,C);else{var t=b.current.next(),e=t.done,n=t.value;if(e)return h(!0),void(a&&(r.logger.info("Say","Completed",e,n),a()));$u.isPause(n)?N($u.from(n)):(R(n),A(),S.current=setTimeout((function(){k((function(t){return t+1}))}),d.config.elements.say.textInterval))}}),[_,s,C]),(0,Rp.useEffect)((function(){if(u&&!w.current){if(C)return L(!1),void k((function(t){return t+1}));I(),k((function(t){return t+1}))}}),[u]),Np().createElement("div",{className:Ip("whitespace-pre-wrap",d.config.elementStyles.say.textContainerClassName,{"font-bold":n.config.bold,italic:n.config.italic},c),style:{fontFamily:n.config.fontFamily||d.config.elementStyles.say.fontFamily,fontSize:n.config.fontSize||d.config.elementStyles.say.fontSize}},v.map((function(t,e){return"\n"===t?Np().createElement("br",{key:e}):Np().createElement(om.Span,{tag:"say.word.".concat(e),key:e,style:Object.assign({color:E(t.config.color||n.config.color||Ku.defaultColor),fontFamily:t.config.fontFamily,fontSize:t.config.fontSize},d.config.app.debug?{outline:"1px dashed red"}:{}),className:Ip(d.config.elementStyles.say.textSpanClassName,"whitespace-pre inline-block",{"font-bold":t.config.bold,italic:t.config.italic},t.config.className)},t.config.ruby?Np().createElement("ruby",{className:"align-bottom inline-block"},Np().createElement("rt",{className:"block text-center"},t.config.ruby),t.text):t.text)})))}function pm(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 hm(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)?hm(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 hm(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 dm(t){return dm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dm(t)}function ym(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,mm(r.key),r)}}function mm(t){var e=function(t,e){if("object"!=dm(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=dm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==dm(e)?e:e+""}var vm=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={width:0,height:0,minWidth:800,minHeight:450,paused:!1,scale:0},this.events=new P,this.lockers=[],this.updater=null}return e=t,(n=[{key:"update",value:function(e,n,r){this.state.width=e,this.state.height=n,this.state.scale=r,this.events.emit(t.EventTypes["event:aspectRatio.update"],e,n)}},{key:"updateMin",value:function(t,e){this.state.minWidth=t,this.state.minHeight=e}},{key:"lock",value:function(){var t=Symbol();return this.lockers.push(t),t}},{key:"unlock",value:function(t){if(t&&!this.lockers.includes(t))throw new Error("Locker not found");return this.lockers=this.lockers.filter((function(e){return e!==t})),this.triggerUpdate(),null}},{key:"isLocked",value:function(){return!!this.lockers.length}},{key:"getStyle",value:function(){return{width:"".concat(this.state.width,"px"),height:"".concat(this.state.height,"px")}}},{key:"setUpdate",value:function(t){this.updater=t}},{key:"pause",value:function(){this.state.paused=!0,this.events.emit(t.EventTypes["event:aspectRatio.pause"])}},{key:"resume",value:function(){this.state.paused=!1,this.events.emit(t.EventTypes["event:aspectRatio.resume"])}},{key:"onUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.update"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.update"],e)}}},{key:"requestUpdate",value:function(){this.events.emit(t.EventTypes["event:aspectRatio.requestUpdate"])}},{key:"onRequestedUpdate",value:function(e){var n=this;return this.events.on(t.EventTypes["event:aspectRatio.requestUpdate"],e),function(){n.events.off(t.EventTypes["event:aspectRatio.requestUpdate"],e)}}},{key:"triggerUpdate",value:function(){this.updater&&this.updater()}}])&&ym(e.prototype,n),r&&ym(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();vm.EventTypes={"event:aspectRatio.update":"event:aspectRatio.update","event:aspectRatio.pause":"event:aspectRatio.pause","event:aspectRatio.resume":"event:aspectRatio.resume","event:aspectRatio.requestUpdate":"event:aspectRatio.requestUpdate"};var gm=(0,Rp.createContext)(null);function bm(t){var e=t.children,n=pm((0,Rp.useState)((function(){return new vm})),1)[0];return Np().createElement(gm.Provider,{value:{ratio:n}},e)}function wm(){var t=(0,Rp.useContext)(gm);if(!gm||!t)throw new Error("useRatio must be used within a RatioProvider");var e=pm((0,Rp.useReducer)((function(t){return t+1}),0),2)[1],n=t.ratio;return(0,Rp.useEffect)((function(){return n.onUpdate((function(){e()}))}),[]),t}function Sm(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 xm(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)?xm(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 xm(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 _m(t){var e,n=t.action,r=t.onClick,o=t.useTypeEffect,i=void 0===o||o,a=t.className,s=t.state,u=n.sentence,c=n.words,l=Sm((0,Rp.useState)(!1),2),f=l[0],p=l[1],h=s.game,d=Sm((0,Rp.useState)(0),2),y=d[0],m=d[1],v=wm().ratio,g=Sm((0,Rp.useState)(new D),1)[0];function b(){h.preference.getPreference(rv.Preferences.autoForward)&&g.cancelTask().scheduleTask((function(){r&&r()}),h.config.elements.say.autoForwardDelay)}return(0,Rp.useEffect)((function(){if(window){var t=function(t){h.config.elements.say.nextKey.includes(t.key)&&(f?r&&r():m((function(t){return t+1})))};return window.addEventListener("keyup",t),function(){window.removeEventListener("keyup",t)}}console.warn("Failed to add event listener, window is not available\nat Say.tsx: onElementClick")}),[f]),(0,Rp.useEffect)((function(){var t=s.events.onEvents([{type:Gm.EventTypes["event:state.player.skip"],listener:s.events.on(Gm.EventTypes["event:state.player.skip"],(function(){s.logger.log("NarraLeaf-React: Say","Skipped"),f?r&&r():p(!0)}))}]);return function(){t.cancel()}}),[f]),(0,Rp.useEffect)((function(){var t=h.preference.onPreferenceChange(rv.Preferences.autoForward,(function(t){t&&f?b():g.cancelTask()}));return function(){t.cancel()}}),[f]),(0,Rp.useEffect)((function(){return function(){g.cancelTask()}}),[]),Np().createElement("div",null,u.state.display&&Np().createElement(om.Div,{tag:"say.aspectScaleContainer",color:"blue",border:"dashed",className:Ip("absolute bottom-0 w-[calc(100%-40px)]",a),onClick:function(){f?(r&&r(),b()):m((function(t){return t+1}))},style:Object.assign({},N(h.config.elements.say.useAspectScale,{width:h.config.elements.text.width,height:h.config.elements.text.height}))},Np().createElement(om.Div,{tag:"say.containerClassName",className:Ip(h.config.elementStyles.say.containerClassName),style:Object.assign({},N(h.config.elements.say.useAspectScale,{transform:"scale(".concat(v.state.scale,")"),transformOrigin:"bottom left",width:"100%",height:"100%"}))},Np().createElement("div",{className:Ip("bg-white flex flex-col items-start justify-between",h.config.elementStyles.say.contentContainerClassName,"w-full h-full")},Np().createElement(om.Div,{tag:"say.nameTextClassName",className:Ip("rounded-br-md text-black",h.config.elementStyles.say.nameTextClassName)},null===(e=u.config.character)||void 0===e?void 0:e.state.name),Np().createElement(fm,{sentence:u,gameState:s,finished:f,useTypeEffect:i,onCompleted:function(){p(!0),b()},count:y,words:c}),Np().createElement("div",null)))))}function km(){return km=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},km.apply(null,arguments)}function Am(t){var e=t.children,n=t.className,r=t.props,o=t.style,i=t.$ref,a=wm().ratio,s=a.getStyle();return Np().createElement("div",{className:Ip("inset-0",n),style:{width:"100%",height:"100%",minWidth:"".concat(a.state.minWidth,"px"),minHeight:"".concat(a.state.minHeight,"px")}},Np().createElement("div",km({style:Object.assign(Object.assign(Object.assign(Object.assign({},s),{position:"relative"}),(null==r?void 0:r.style)||{}),o||{})},r||{},{ref:i}),e))}var Tm={say:_m,menu:function(t){var e=t.prompt,n=t.choices,r=t.afterChoose,o=t.state,i=t.words,a=Vp().game,s=wm().ratio,u=a.config.elements.say.use,c=(0,Rp.useMemo)((function(){return n.map((function(t){return Object.assign(Object.assign({},t),{words:t.prompt.evaluate(bp.getCtx({gameState:o}))})}))}),[]);return Np().createElement(Np().Fragment,null,Np().createElement(Am,{className:"absolute"},e&&Np().createElement(u,{state:o,action:{sentence:e,character:null,words:i},useTypeEffect:!1,className:"z-10"})),Np().createElement(om.Div,{color:"green",border:"dashed",className:Ip("absolute"),style:{width:"".concat(a.config.player.width,"px"),height:"".concat(a.config.player.height,"px")}},Np().createElement(om.Div,{tag:"menu.aspectScaleContainer",style:{transform:"scale(".concat(s.state.scale,")"),transformOrigin:"left top"},className:Ip("w-full h-full")},Np().createElement(om.Div,{tag:"menu.containerClassName",className:Ip("absolute flex flex-col items-center justify-center min-w-full w-full h-full",a.config.elementStyles.menu.containerClassName)},Np().createElement("div",{className:"p-4 rounded-lg w-full z-20"},Np().createElement("div",{className:"flex flex-col items-center mt-4 w-full"},c.map((function(t,e){return Np().createElement(om.Button,{tag:"menu.choiceButtonClassName."+e,key:e,className:Ip("bg-white text-black p-2 mt-2 w-1/2",a.config.elementStyles.menu.choiceButtonClassName),onClick:function(){return function(t){r(t)}(Object.assign(Object.assign({},t),{evaluated:Ku.getText(t.words)}))}},Np().createElement(fm,{sentence:t.prompt,gameState:o,useTypeEffect:!1,className:Ip(a.config.elementStyles.menu.choiceButtonTextClassName),words:t.words}))}))))))))}},Em=o(196);function Pm(t){return Pm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pm(t)}function Om(t){return function(t){if(Array.isArray(t))return jm(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 jm(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)?jm(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 jm(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 Cm(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Lm(r.key),r)}}function Lm(t){var e=function(t,e){if("object"!=Pm(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Pm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pm(e)?e:e+""}var Im=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.game=e,this.prefix=n},e=[{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,Om(this.colorLog.apply(this,["gray",t].concat(r))))}}},{key:"info",value:function(t){if(this.game.config.app.logger.info){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).info.apply(e,Om(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,Om(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,Om(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,Om(this.colorLog.apply(this,["gray",t].concat(r))))}}},{key:"trace",value:function(t){if(this.game.config.app.logger.trace){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];console.trace(this._log.apply(this,[t].concat(n)))}}},{key:"weakWarn",value:function(t){if(this.game.config.app.logger.warn){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];(e=console).log.apply(e,Om(this.colorLog.apply(this,["yellow",t].concat(r))))}}},{key:"group",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this._log(t).join(" ");return this.game.config.app.logger.info&&(n?console.groupCollapsed(r):console.group(r)),{end:function(){e.game.config.app.logger.info&&console.groupEnd()}}}},{key:"_log",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return 0===n.length?[this.prefix||"",t]:["".concat(this.prefix||""," [").concat(t,"]")].concat(n)}},{key:"colorLog",value:function(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(0===r.length)return["%c".concat(this.prefix||""," ").concat(e),"color: ".concat(t)];var i=[],a=[],s=[];return this.prefix?(i.push("%c".concat(this.prefix," [").concat(e,"]")),a.push("color: ".concat(t))):(i.push("%c[".concat(e,"]")),a.push("color: ".concat(t))),r.forEach((function(e){"string"==typeof e?(i.push("%c".concat(e)),a.push("color: ".concat(t))):(i.push("%O"),s.push(e),a.push(""))})),[i.join(" ")].concat(a,s)}}],e&&Cm(t.prototype,e),n&&Cm(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function Rm(t){return Rm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rm(t)}function Nm(t){return function(t){if(Array.isArray(t))return Fm(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Dm(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 Mm(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Mm=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 v?e:v,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",h="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(C([])));x&&x!==n&&r.call(x,a)&&(w=x);var _=b.prototype=v.prototype=Object.create(w);function k(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"==Rm(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===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===m)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")),m;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Rm(e)+" is not iterable")}return g.prototype=b,o(_,"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(_),t},e.awrap=function(t){return{__await:t}},k(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()}))},k(_),c(_,u,"Generator"),c(_,a,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function Dm(t,e){if(t){if("string"==typeof t)return Fm(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)?Fm(t,e):void 0}}function Fm(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 Bm(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,Vm(r.key),r)}}function Vm(t){var e=function(t,e){if("object"!=Rm(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Rm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Rm(e)?e:e+""}var Um=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())}))},Gm=function(){return 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 P,this.logger=new Im(e,"NarraLeaf-React")},e=[{key:"findElementByScene",value:function(t){return this.state.elements.find((function(e){return e.scene===t}))||null}},{key:"findElementByDisplayable",value:function(t){return this.state.elements.find((function(e){return e.ele.displayable.includes(t)}))||null}},{key:"addScene",value:function(t){return this.sceneExists(t)||this.state.elements.push({scene:t,ele:this.getElementMap()}),this}},{key:"popScene",value:function(){var t=this.state.elements.pop();return t?(this.removeElements(t.scene),this):this}},{key:"removeScene",value:function(t){return this.removeElements(t),this}},{key:"getSceneElements",value:function(){return this.state.elements}},{key:"getLastScene",value:function(){var t;return(null===(t=this.state.elements[this.state.elements.length-1])||void 0===t?void 0:t.scene)||null}},{key:"sceneExists",value:function(t){return t?this.state.elements.some((function(e){return e.scene===t})):!!this.getLastScene()}},{key:"isSceneActive",value:function(t){var e,n=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Dm(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(this.state.elements);try{for(n.s();!(e=n.n()).done;)if(e.value.scene===t)return!0}catch(t){n.e(t)}finally{n.f()}return!1}},{key:"moveUpElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,Math.min(n.ele.displayable.indexOf(e)+1,n.ele.displayable.length-1)),this):this}},{key:"moveDownElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,Math.max(n.ele.displayable.indexOf(e)-1,0)),this):this}},{key:"moveTopElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,n.ele.displayable.length-1),this):this}},{key:"moveBottomElement",value:function(t,e){var n=this.findElementByScene(t);return n?(n.ele.displayable=F(n.ele.displayable,e,0),this):this}},{key:"handle",value:function(t){return this.currentHandling===t||(this.currentHandling=t,t.type),this}},{key:"createText",value:function(t,e,n,r){var o,i=null===(o=this.findElementByScene(this.getLastSceneIfNot(r)))||void 0===o?void 0:o.ele.texts;if(!i)throw new Error("Scene not found");var a=e.evaluate(bp.getCtx({gameState:this}));this.game.getLiveGame().events.emit(qm.EventTypes["event:character.prompt"],{character:e.config.character,sentence:e,text:Ku.getText(a)});var s=this.createWaitableAction({character:e.config.character,sentence:e,id:t,words:a},(function(){i.splice(i.indexOf(s),1),n&&n()}));i.push(s)}},{key:"createMenu",value:function(t,e,n){var r,o=this;if(!t.choices.length)throw new Error("Menu must have at least one choice");var i=null===(r=this.findElementByScene(this.getLastSceneIfNot(n)))||void 0===r?void 0:r.ele.menus;if(!i)throw new Error("Scene not found");var a=t.prompt.evaluate(bp.getCtx({gameState:this})),s=this.createWaitableAction(Object.assign(Object.assign({},t),{words:a}),(function(t){i.splice(i.indexOf(s),1),e&&e(t),o.game.getLiveGame().events.emit(qm.EventTypes["event:character.prompt"],{character:t.prompt.config.character,sentence:t.prompt,text:t.evaluated})}));i.push(s)}},{key:"createImage",value:function(t,e){var n=this.getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.displayable.push(t),this):this}},{key:"createWearable",value:function(t,e){return t.events.any(Qs.EventTypes["event:wearable.create"],e)}},{key:"disposeImage",value:function(t,e){var n,r=this.getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.displayable;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Image not found");return o.splice(i,1),this}},{key:"createDisplayable",value:function(t,e){var n=this.getLastSceneIfNot(e),r=this.findElementByScene(n);return r?(r.ele.displayable.push(t),this):this}},{key:"disposeDisplayable",value:function(t,e){var n,r=this.getLastSceneIfNot(e),o=null===(n=this.findElementByScene(r))||void 0===n?void 0:n.ele.displayable;if(!o)throw new Error("Scene not found");var i=o.indexOf(t);if(-1===i)throw new Error("Displayables not found");return o.splice(i,1),this}},{key:"forceReset",value:function(){var t=this;this.state.sounds.forEach((function(t){var e;return null===(e=t.getPlaying())||void 0===e?void 0:e.stop()})),this.state.elements.forEach((function(e){var n=e.scene;t.offSrcManager(n.srcManager),t.removeScene(n),n.events.clear()})),this.state.elements=[],this.state.srcManagers=[]}},{key:"initSound",value:function(t,e){return t.getPlaying()||t.setPlaying(new(this.getHowl())(t.getHowlOptions(e))),t}},{key:"playSound",value:function(t,e,n){this.initSound(t,n);var r=t.getPlaying().play(),o=[t.getPlaying().once("end",i.bind(this)),t.getPlaying().once("stop",i.bind(this))];function i(){e&&e(),o.forEach((function(t){return t.off()})),this.state.sounds=this.state.sounds.filter((function(e){return e!==t})),this.stage.next()}return this.state.sounds.push(t),t.state.token=r,r}},{key:"stopSound",value:function(t){var e,n;return(null===(e=t.state.playing)||void 0===e?void 0:e.playing(t.getToken()))&&(null===(n=t.state.playing)||void 0===n||n.stop(t.getToken())),t.setPlaying(null).setToken(null),t}},{key:"transitionSound",value:function(t,e,n){return Um(this,void 0,void 0,Mm().mark((function r(){var o;return Mm().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=5;break}if(!n){r.next=4;break}return r.next=4,this.fadeSound(t,0,n);case 4:this.stopSound(t);case 5:if(!e){r.next=12;break}if(o=e.config.volume,this.playSound(e,void 0,{volume:0}),!n){r.next=11;break}return r.next=11,this.fadeSound(e,o,n);case 11:e.getPlaying().volume(o,e.getToken());case 12:case"end":return r.stop()}}),r,this)})))}},{key:"fadeSound",value:function(t,e,n){var r,o;return Um(this,void 0,void 0,Mm().mark((function i(){var a;return Mm().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return a=null===(r=t.getPlaying())||void 0===r?void 0:r.volume(t.getToken()),null===(o=t.getPlaying())||void 0===o||o.fade(a,e,n,t.getToken()),i.next=4,j(n);case 4:return i.abrupt("return",void 0);case 5:case"end":return i.stop()}}),i)})))}},{key:"getHowl",value:function(){return Em.Howl}},{key:"animateImage",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(Nm(n)))}},{key:"animateText",value:function(t,e,n,r){return this.anyEvent.apply(this,[t,e,r].concat(Nm(n)))}},{key:"registerSrcManager",value:function(t){return this.state.srcManagers.push(t),this}},{key:"offSrcManager",value:function(t){return this.state.srcManagers=this.state.srcManagers.filter((function(e){return e!==t})),this}},{key:"getStorable",value:function(){return this.game.getLiveGame().getStorable()}},{key:"getSceneByName",value:function(t){var e;return(null===(e=this.game.getLiveGame().story)||void 0===e?void 0:e.getScene(t))||null}},{key:"getStory",value:function(){if(!this.game.getLiveGame().story)throw new Ru("Story not loaded");return this.game.getLiveGame().story}},{key:"dispose",value:function(){this.forceReset()}},{key:"toData",value:function(){return{scenes:this.state.elements.map((function(t){return{sceneId:t.scene.getId(),elements:{displayable:t.ele.displayable.map((function(t){return t.getId()}))}}}))}}},{key:"loadData",value:function(t,e){var n=this;if(this.state.elements=[],!this.game.getLiveGame().story)throw new Error("No story loaded");t.scenes.forEach((function(t){var r=t.sceneId,o=t.elements;n.logger.debug("Loading scene: "+r);var i=e.get(r);if(!i)throw new Ru("Scene not found, id: "+r+"\nNarraLeaf cannot find the element with the id from the saved game");var a={scene:i,ele:{menus:[],texts:[],displayable:o.displayable.map((function(t){if(!e.has(t))throw new Ru("Displayable not found, id: "+t+"\nNarraLeaf cannot find the element with the id from the saved game\nThis may be caused by the damage of the saved game file or the change of the story file");return e.get(t)}))}};n.state.elements.push(a),n.registerSrcManager(i.srcManager),Tt.registerEventListeners(i,n)}))}},{key:"getLastSceneIfNot",value:function(t){var e=t||this.getLastScene();if(!e||!this.sceneExists(e))throw new Ru('Scene not found, please call "scene.activate()" first.');return e}},{key:"getElementMap",value:function(){return{texts:[],menus:[],displayable:[]}}},{key:"removeElements",value:function(t){var e=this.state.elements.findIndex((function(e){return e.scene===t}));return-1===e||this.state.elements.splice(e,1),this}},{key:"anyEvent",value:function(t,e,n){for(var r,o=this,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];(r=e.events).any.apply(r,[t].concat(a)).then(n).then((function(){o.stage.next()}))}},{key:"createWaitableAction",value:function(t,e){return{action:t,onClick:function(t){e&&e(t)}}}}],e&&Bm(t.prototype,e),n&&Bm(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function Wm(t){return Wm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wm(t)}function zm(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 Hm(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)?Hm(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 Hm(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 $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,Ym(r.key),r)}}function Ym(t){var e=function(t,e){if("object"!=Wm(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Wm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wm(e)?e:e+""}Gm.EventTypes={"event:state.ready":"event:state.ready","event:state.end":"event:state.end","event:state.player.skip":"event:state.player.skip","event:state.preload.unmount":"event:state.preload.unmount","event:state.preload.loaded":"event:state.preload.loaded","event:state.player.flush":"event:state.player.flush"};var qm=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gameLock=new R,this.events=new P,this.currentSavedGame=null,this.story=null,this.lockedAwaiting=null,this.gameState=void 0,this._lockedCount=0,this.currentAction=null,this._nextLock=new I,this.game=e,this.storable=new Cf,this.initNamespaces()}return n=t,(r=[{key:"initNamespaces",value:function(){return this.storable.clear().addNamespace(new jf(t.GameSpacesKey.game,t.DefaultNamespaces.game)),this.story&&this.story.initPersistent(this.storable),this}},{key:"getStorable",value:function(){return this.storable}},{key:"loadStory",value:function(t){return this.story=t.constructStory(),this}},{key:"serialize",value:function(){var t,e,n;if(!this.gameState)throw new Error("No game state");var r=this.gameState,o=this.story;if(!o)throw new Error("No story loaded");var i=this.storable.toData(),a=r.toData(),s=(null===(t=this.getCurrentAction())||void 0===t?void 0:t.getId())||null,u=o.getAllElementStates();return{name:(null===(e=this.currentSavedGame)||void 0===e?void 0:e.name)||"",meta:{created:(null===(n=this.currentSavedGame)||void 0===n?void 0:n.meta.created)||Date.now(),updated:Date.now()},game:{store:i,stage:a,currentAction:s,elementStates:u}}}},{key:"deserialize",value:function(t){var e;if(!this.gameState)throw new Error("No game state");var n=this.gameState,r=this.story;if(!r)throw new Error("No story loaded");this.reset({gameState:n}),n.stage.forceUpdate();var o=new Map,i=new Map,a=t.game,s=a.store,u=a.stage,c=a.elementStates,l=a.currentAction;if(r.forEachChild(r,(null===(e=r.entryScene)||void 0===e?void 0:e.getSceneRoot())||[],(function(t){o.set(t.getId(),t),i.set(t.callee.getId(),t.callee)})),this.storable.clear().load(s),c.forEach((function(t){var e=t.id,r=t.data;n.logger.debug("restore element",e);var o=i.get(e);if(!o)throw new Error("Element not found, id: "+e+"\nNarraLeaf cannot find the element with the id from the saved game");o.reset(),o.fromData(r)})),this.currentSavedGame=t,n.loadData(u,i),l){var f=o.get(l);if(!f)throw new Error("Action not found, id: "+l+"\nNarraLeaf cannot find the action with the id from the saved game");this.currentAction=f}n.stage.forceUpdate(),n.stage.next()}},{key:"onCharacterPrompt",value:function(e){var n=this,r=t.EventTypes["event:character.prompt"],o=this.events.on(r,e);return{cancel:function(){n.events.off(r,o)}}}},{key:"onMenuChoose",value:function(e){var n=this,r=t.EventTypes["event:menu.choose"],o=this.events.on(r,e);return{cancel:function(){n.events.off(r,o)}}}},{key:"newGame",value:function(){var t,e,n,r,o;if(!this.gameState)throw new Error("No game state");var i=this.gameState,a=i.logger.group("LiveGame");this.reset({gameState:i}),this.initNamespaces();var s=this.getNewSavedGame();s.name="NewGame-"+Date.now(),this.currentSavedGame=s,this.currentAction=(null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.getSceneRoot())||null;var u=null===(n=this.story)||void 0===n?void 0:n.getAllElementMap(this.story,(null===(o=null===(r=this.story)||void 0===r?void 0:r.entryScene)||void 0===o?void 0:o.getSceneRoot())||[]);return u?u.forEach((function(t){i.logger.debug("reset element",t),t.reset()})):i.logger.warn("No elements found"),i.stage.forceUpdate(),i.stage.next(),a.end(),this}},{key:"reset",value:function(t){var e=t.gameState;this.lockedAwaiting&&this.lockedAwaiting.abort(),this.currentAction=null,this.lockedAwaiting=null,this.currentSavedGame=null,e.forceReset()}},{key:"getCurrentAction",value:function(){return this.currentAction}},{key:"setCurrentAction",value:function(t){return this.currentAction=t,this}},{key:"next",value:function(t){var e,n;if(this.gameLock.isLocked())return this.gameLock;if(this._nextLock.isLocked())return null;if(this._nextLock.lock(),!this.story)throw new Error("No story loaded");if(this.lockedAwaiting){if(!this.lockedAwaiting.solved){if(this._lockedCount++,this._lockedCount>1e3)throw new Error("LiveGame locked: dead cycle detected\nPlease refresh the page");return this._nextLock.unlock(),this.lockedAwaiting}var r=this.lockedAwaiting.result;return this.currentAction=(null===(e=null==r?void 0:r.node)||void 0===e?void 0:e.action)||null,this.lockedAwaiting=null,this.currentAction||t.events.emit(Gm.EventTypes["event:state.end"]),t.logger.debug("next action (lockedAwaiting)",r),this._nextLock.unlock(),r||null}if(!this.currentAction)return t.logger.weakWarn("LiveGame","No current action"),this._nextLock.unlock(),null;var o=this.currentAction.executeAction(t);return A.isAwaitable(o)?(this.lockedAwaiting=o,this._nextLock.unlock(),o):(t.logger.debug("next action",o),this._lockedCount=0,this.currentAction=(null===(n=o.node)||void 0===n?void 0:n.action)||null,this._nextLock.unlock(),o)}},{key:"isPlaying",value:function(){return!!this.currentAction}},{key:"abortAwaiting",value:function(){var t;if(this.lockedAwaiting){var e=this.lockedAwaiting.abort();this.currentAction=(null===(t=null==e?void 0:e.node)||void 0===t?void 0:t.action)||null,this.lockedAwaiting=null}}},{key:"executeAction",value:function(t,e){var n,r=e.executeAction(t);return A.isAwaitable(r)?r:(null===(n=null==r?void 0:r.node)||void 0===n?void 0:n.action)||null}},{key:"setGameState",value:function(t){return this.gameState=t,this}},{key:"getGameState",value:function(){return this.gameState}},{key:"getAllPredictableActions",value:function(t,n,r){for(var o,i,s,u=(null==n?void 0:n.contentNode)||null,c=[],l=[],f=new Set;(u||l.length)&&!(r&&c.length>=r);)if(u||(u=l.pop().contentNode),[Cc].some((function(t){return(null==u?void 0:u.action)&&u.action instanceof t})))u=null;else if(u.action&&u.action.is(Tt,e.jumpTo)){var p=zm(u.action.contentNode.getContent(),1)[0],h=t.getScene(p);if(!h)throw u.action._sceneNotFoundError(u.action.getSceneName(p));if(f.has(h)){u=null;continue}f.add(h),u=(null===(o=h.getSceneRoot())||void 0===o?void 0:o.contentNode)||null}else{if(u.action&&u.action.is(Wa,a.do)){var d=zm(u.action.contentNode.getContent(),1)[0];(null===(i=u.getChild())||void 0===i?void 0:i.action)&&l.push(u.getChild().action),u=(null===(s=d[0])||void 0===s?void 0:s.contentNode)||null}u.action&&c.push(u.action),u=u.getChild()}return c}},{key:"getNewSavedGame",value:function(){var t,e;return{name:"",meta:{created:Date.now(),updated:Date.now()},game:{store:{},stage:{scenes:[]},elementStates:[],currentAction:(null===(e=null===(t=this.story)||void 0===t?void 0:t.entryScene)||void 0===e?void 0:e.getSceneRoot().getId())||null}}}}])&&$m(n.prototype,r),o&&$m(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}();function Xm(t){return Xm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xm(t)}function Km(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,Zm(r.key),r)}}function Zm(t){var e=function(t,e){if("object"!=Xm(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Xm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xm(e)?e:e+""}qm.DefaultNamespaces={game:{}},qm.GameSpacesKey={game:"game"},qm.EventTypes={"event:character.prompt":"event:character.prompt","event:menu.choose":"event:menu.choose"};var Qm,Jm=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.settings=e,this.events=new P}return e=t,(n=[{key:"setPreference",value:function(e,n){this.settings[e]=n,this.events.emit(t.EventTypes["event:game.preference.change"],e,n)}},{key:"getPreference",value:function(t){return this.settings[t]}},{key:"getPreferences",value:function(){return this.settings}},{key:"onPreferenceChange",value:function(e,n){var r=this,o=this.events.on(t.EventTypes["event:game.preference.change"],(function(t,r){"string"==typeof e?e===t&&n&&n(r):e(t,r)}));return{cancel:function(){return r.events.off(t.EventTypes["event:game.preference.change"],o)}}}},{key:"importPreferences",value:function(t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&this.setPreference(e,t[e])}},{key:"exportPreferences",value:function(){var t={};for(var e in this.settings)Object.prototype.hasOwnProperty.call(this.settings,e)&&(t[e]=this.settings[e]);return t}},{key:"togglePreference",value:function(t){this.setPreference(t,!this.getPreference(t))}}])&&Km(e.prototype,n),r&&Km(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function tv(t){return tv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tv(t)}function ev(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,nv(r.key),r)}}function nv(t){var e=function(t,e){if("object"!=tv(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=tv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tv(e)?e:e+""}Jm.EventTypes={"event:game.preference.change":"event:game.preference.change"},(Qm||(Qm={})).game="game";var rv=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.liveGame=null,this.preference=new Jm(t.DefaultPreference),this.config=k(t.DefaultConfig,e)},(e=[{key:"useComponent",value:function(t,e){if(!Object.keys(Tm).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 qm(this)}}])&&ev(t.prototype,e),n&&ev(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();rv.defaultSettings={volume:1},rv.ComponentTypes={say:"say",menu:"menu"},rv.DefaultPreference={autoForward:!1,skip:!0},rv.Preferences={autoForward:"autoForward",skip:"skip"},rv.DefaultConfig={player:{contentContainerId:"__narraleaf_content",aspectRatio:16/9,minWidth:800,minHeight:450,width:1920,height:1080,skipKey:["Control"],skipInterval:100,ratioUpdateInterval:50,preloadDelay:100,preloadConcurrency:5,waitForPreload:!1,preloadAllImages:!0,forceClearCache:!1,maxPreloadActions:10,cursor:null,cursorHeight:30,cursorWidth:30,showOverflow:!1},elements:{say:{nextKey:[" "],textInterval:50,use:Tm.say,useAspectScale:!0,autoForwardDelay:3e3},img:{slowLoadWarning:!0,slowLoadThreshold:2e3,allowSkipTransform:!0,allowSkipTransition:!0},menu:{use:Tm.menu},background:{allowSkipTransform:!0,allowSkipTransition:!1},text:{allowSkipTransform:!0,allowSkipTransition:!0,width:1920,height:216}},elementStyles:{say:{contentContainerClassName:"",containerClassName:"",nameTextClassName:"",textContainerClassName:"",textSpanClassName:"",rubyClassName:""},menu:{containerClassName:"",choiceButtonClassName:"",choiceButtonTextClassName:""}},app:{debug:!1,logger:{log:!1,info:!1,warn:!0,error:!0,debug:!1,trace:!1},inspector:!1}},rv.GameSettingsNamespace=Qm;var ov=o(72),iv=o.n(ov),av=o(825),sv=o.n(av),uv=o(659),cv=o.n(uv),lv=o(56),fv=o.n(lv),pv=o(540),hv=o.n(pv),dv=o(113),yv=o.n(dv),mv=o(587),vv={};vv.styleTagTransform=yv(),vv.setAttributes=fv(),vv.insert=cv().bind(null,"head"),vv.domAPI=sv(),vv.insertStyleElement=hv();iv()(mv.A,vv);mv.A&&mv.A.locals&&mv.A.locals;function gv(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 bv(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)?bv(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 bv(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 wv(t){var e=t.children,n=t.className,r=gv((0,Rp.useState)({}),2),o=r[0],i=r[1],a=wm().ratio,s=Vp().game,u=gv((0,Rp.useReducer)((function(t){return t+1}),0),2)[1],c=s.config.player.minWidth,l=s.config.player.minHeight;return(0,Rp.useEffect)((function(){var t,e=function(){if(a.isLocked())console.warn("NarraLeaf-React: Ratio is locked, skipping update");else{var t=document.getElementById(s.config.player.contentContainerId);if(t){var e,n,r=t.clientWidth,o=t.clientHeight,f=s.config.player.aspectRatio;r/o>f?(e=o*f,n=o):(e=r,n=r/f),e<c&&(e=c),n<l&&(n=l),i({width:"".concat(e,"px"),height:"".concat(n,"px"),margin:"auto",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center"});var p=e/s.config.player.width;a.update(e,n,p),a.updateMin(c,l),u()}}};a.setUpdate(e);var n,r,o,f=(n=function(){e(),clearTimeout(t),a.pause(),t=setTimeout((function(){a.resume()}),100)},r=s.config.player.ratioUpdateInterval,o=null,function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];o&&clearTimeout(o),o=setTimeout((function(){n.apply(void 0,e)}),r)});f(),window.addEventListener("resize",f);var p=a.onRequestedUpdate(f);return function(){window.removeEventListener("resize",f),clearTimeout(t),p()}}),[a]),Np().createElement("div",{id:s.config.player.contentContainerId,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},Np().createElement("div",{className:Ip(n),style:o},e))}function Sv(t){return Sv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sv(t)}function xv(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */xv=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 v?e:v,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",h="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(C([])));x&&x!==n&&r.call(x,a)&&(w=x);var _=b.prototype=v.prototype=Object.create(w);function k(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"==Sv(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===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===m)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")),m;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Sv(e)+" is not iterable")}return g.prototype=b,o(_,"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(_),t},e.awrap=function(t){return{__await:t}},k(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()}))},k(_),c(_,u,"Generator"),c(_,a,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function _v(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 kv(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)?kv(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 kv(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 Av=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 Tv(t){var e=this,n=t.state,r=t.displayable,o=t.child,i=r.element,a=r.state,s=void 0===a?i:a,u=(0,Rp.useRef)(null),c=_v((0,Rp.useState)(null),2),l=c[0],f=c[1],p=_v((0,Rp.useState)([]),2)[1],h=_v((0,Rp.useState)(null),2),d=h[0],y=h[1],m=_v((0,Rp.useState)({}),2),v=m[0],g=m[1];function b(t){if(d&&d.getControl()&&(n.logger.warn("Displayable Animation","processing transform not completed"),d.getControl().complete(),d.setControl(null)),!u.current)throw new Error("scope not ready");t instanceof Sa?Object.assign(u.current.style,t.propToCSS(n,s.state,r.transformOverwrites)):Object.assign(u.current.style,t)}function w(t){return f(t),t?new Promise((function(e){var r=t.events.onEvents([{type:Nl.update,listener:t.events.on(Nl.update,(function(t){p(t)}))},{type:Nl.end,listener:t.events.on(Nl.end,(function(){f(null),n.logger.debug("transition end",t)}))},{type:Nl.start,listener:t.events.on(Nl.start,(function(){n.logger.debug("transition start",t)}))}]);t.start((function(){r.cancel(),e()}))})):(n.logger.warn("transition not set"),Promise.resolve())}function S(t){return Av(this,void 0,void 0,xv().mark((function e(){return xv().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(t.propToCSS(n,s.state,r.transformOverwrites)),y(t),e.next=4,t.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(e){s.state=k(s.state,e),g({style:t.propToCSS(n,s.state,r.transformOverwrites)}),y(null)}));case 4:case"end":return e.stop()}}),e)})))}return(0,Rp.useEffect)((function(){var t="event:displayable.applyTransition",o="event:displayable.applyTransform",a="event:displayable.init",c=i.events.onEvents([{type:t,listener:i.events.on(t,w)},{type:o,listener:i.events.on(o,S)},{type:a,listener:i.events.on(a,(function(){return Av(e,void 0,void 0,xv().mark((function t(){var e;return xv().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.toDisplayableTransform(),n.logger.debug("init transform",e),t.next=4,e.animate({scope:u,target:s,overwrites:r.transformOverwrites},n,(function(t){s.state=k(s.state,t)}));case 4:case"end":return t.stop()}}),t)})))}))}]);return function(){c.cancel()}}),[]),(0,Rp.useEffect)((function(){if(!u.current)throw new Error("Scope not ready. Using element: ".concat(i.constructor.name))}),[]),(0,Rp.useEffect)((function(){var t=n.events.onEvents([{type:Gm.EventTypes["event:state.player.skip"],listener:n.events.on(Gm.EventTypes["event:state.player.skip"],(function(){r.skipTransform&&d&&d.getControl()&&(d.getControl().complete(),d.setControl(null),n.logger.debug("transform skip")),r.skipTransition&&l&&l.controller&&(l.controller.complete(),f(null),n.logger.debug("transition skip"))}))}]);return function(){t.cancel()}}),[l,d]),Np().createElement(Np().Fragment,null,o({transformRef:u,transition:l,transform:d,transformProps:v,state:n}))}function Ev(t){return Ev="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ev(t)}function Pv(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ov(r.key),r)}}function Ov(t){var e=function(t,e){if("object"!=Ev(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Ev(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ev(e)?e:e+""}var jv=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 P}return e=t,(n=[{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 kl.getSrc(t)}}])&&Pv(e.prototype,n),r&&Pv(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function Cv(t){return Cv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cv(t)}function Lv(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Iv(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)?Iv(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function Iv(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 Rv(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,Nv(r.key),r)}}function Nv(t){var e=function(t,e){if("object"!=Cv(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Cv(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Cv(e)?e:e+""}jv.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 Mv=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.src=new Map,this.preloadTasks=new Map}return e=t,r=[{key:"getImage",value:function(t,e){return function(t,e){return x(this,void 0,void 0,l().mark((function n(){var r,o;return l().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,fetch(t,e);case 2:return r=n.sent,n.next=5,r.blob();case 5:return o=n.sent,n.abrupt("return",new Promise((function(t){var e=new FileReader;e.onload=function(){t(e.result)},e.readAsDataURL(o)})));case 7:case"end":return n.stop()}}),n)})))}(t,{signal:e})}}],(n=[{key:"has",value:function(t){return this.src.has(t)}},{key:"add",value:function(t,e){return this.src.set(t,e),this}},{key:"remove",value:function(t){return this.src.delete(t),this}},{key:"get",value:function(t){return this.src.get(t)}},{key:"clear",value:function(){return this.src.clear(),this}},{key:"size",value:function(){return this.src.size}},{key:"isPreloading",value:function(t){return this.preloadTasks.has(t)}},{key:"preload",value:function(e){var n=this;if(this.src.has(e)||this.preloadTasks.has(e))return{abort:function(){},onFinished:function(){}};var r=new AbortController,o=r.signal,i={promise:t.getImage(e,o),controller:r};return this.preloadTasks.set(e,i),i.promise.then((function(t){n.preloadTasks.delete(e),t&&n.add(e,t)})),{abort:function(){r.abort(),n.preloadTasks.delete(e)},onFinished:function(t){i.promise.then(t)}}}},{key:"abortAll",value:function(){this.preloadTasks.forEach((function(t){t.controller.abort()})),this.preloadTasks.clear()}},{key:"abort",value:function(t){var e=this.preloadTasks.get(t);e&&(e.controller.abort(),this.preloadTasks.delete(t))}},{key:"preloadedSrc",value:function(){return Array.from(this.src.values())}},{key:"filter",value:function(t){var e,n=Lv(this.src.keys());try{for(n.s();!(e=n.n()).done;){var r=e.value;t.includes(r)||this.src.delete(r)}}catch(t){n.e(t)}finally{n.f()}return this}}])&&Rv(e.prototype,n),r&&Rv(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function Dv(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 Fv(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)?Fv(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 Fv(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 Bv=(0,Rp.createContext)(null);function Vv(t){var e=t.children,n=Dv((0,Rp.useState)(new jv),1)[0],r=Dv((0,Rp.useState)(new Mv),1)[0];return Np().createElement(Np().Fragment,null,Np().createElement(Bv.Provider,{value:{preloaded:n,cacheManager:r}},e))}function Uv(){if(!Bv)throw new Error("usePreloaded must be used within a PreloadedProvider");return(0,Rp.useContext)(Bv)}function Gv(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 Wv(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)?Wv(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 Wv(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 zv(){return zv=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},zv.apply(null,arguments)}function Hv(t){var e=t.scene,n=t.props,r=t.state;return Np().createElement(Tv,{displayable:{element:e,skipTransform:r.game.config.elements.background.allowSkipTransform,skipTransition:r.game.config.elements.background.allowSkipTransition},child:function(t){return Np().createElement($v,zv({},t,{scene:e,props:n}))},state:r})}function $v(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.state,i=t.scene,a=t.props,s=wm().ratio,u=Uv().cacheManager,c=Gv(Np().useState(!1),2),l=c[0],f=c[1];function p(){l||(f(!0),i.events.emit(np.EventTypes["event:scene.imageLoaded"]),o.logger.debug("BackgroundTransition","Image loaded",i))}var h="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAgAB9sWFXTkAAAAASUVORK5CYII=",d={src:h,style:Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{})};return Np().createElement("div",null,Np().createElement(Zy.div,zv({layout:!0,ref:e,className:"absolute inset-0 flex items-center justify-center bg-cover bg-center overflow-hidden"},k({style:Object.assign({},s.getStyle())},n)),(r?r.toElementProps():[{}]).map((function(t,e){var n,r=k(d,a,t);return Np().createElement("img",zv({alt:r.alt},r,{onLoad:p,src:(n=r.src,n?u.has(n)?u.get(n):n:h),className:"absolute",key:e}))}))))}function Yv(t){return Yv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yv(t)}function qv(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */qv=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 v?e:v,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",h="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var w={};c(w,a,(function(){return this}));var S=Object.getPrototypeOf,x=S&&S(S(C([])));x&&x!==n&&r.call(x,a)&&(w=x);var _=b.prototype=v.prototype=Object.create(w);function k(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"==Yv(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===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var c=f(e,n,r);if("normal"===c.type){if(o=r.done?y:h,c.arg===m)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")),m;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(Yv(e)+" is not iterable")}return g.prototype=b,o(_,"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(_),t},e.awrap=function(t){return{__await:t}},k(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()}))},k(_),c(_,u,"Generator"),c(_,a,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:C(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function Xv(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 Kv(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)?Kv(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 Kv(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 Zv=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 Qv(t){var e=t.scene,n=t.state,r=t.children,o=t.className,i=wm().ratio,a=Xv((0,Rp.useState)((function(){return e.state.backgroundMusic})),2),s=a[0],u=a[1];return(0,Rp.useEffect)((function(){var t=[{type:"event:scene.setBackgroundMusic",listener:e.events.on(np.EventTypes["event:scene.setBackgroundMusic"],(function(t,e){(function(t,e){return Zv(this,void 0,void 0,qv().mark((function r(){var o,i;return qv().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=s,i=t,r.next=4,n.transitionSound(o,i,e);case 4:if(i){r.next=6;break}return r.abrupt("return");case 6:u(i);case 7:case"end":return r.stop()}}),r)})))})(t,e).then()}))},{type:"event:scene.preUnmount",listener:e.events.on(np.EventTypes["event:scene.preUnmount"],(function(){s&&function(t,e){return Zv(this,void 0,void 0,qv().mark((function r(){return qv().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.fadeSound(t,0,e);case 2:n.stopSound(t);case 3:case"end":return r.stop()}}),r)})))}(s,e.state.backgroundMusicFade).then()}))}];return function(){t.forEach((function(t){var n=t.type,r=t.listener;e.events.off(n,r)}))}}),[]),(0,Rp.useEffect)((function(){return e.events.emit(np.EventTypes["event:scene.mount"]),function(){e.events.emit(np.EventTypes["event:scene.unmount"])}}),[]),Np().createElement("div",{className:o},Np().createElement(Hv,{scene:e,props:{width:i.state.width,height:i.state.height,src:Pu.isImageSrc(e.state.background)?Pu.srcToString(e.state.background):void 0,style:{backgroundColor:Pu.isImageColor(e.state.background)?Pu.toHex(e.state.background):void 0}},state:n}),r)}function Jv(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=eg(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 tg(t){return function(t){if(Array.isArray(t))return ng(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||eg(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 eg(t,e){if(t){if("string"==typeof t)return ng(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)?ng(t,e):void 0}}function ng(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 rg(t){var e=t.state,n=Uv(),r=n.preloaded,o=n.cacheManager,i=Vp().game,a=(0,Rp.useRef)(new Set),s="Preload",u=e.getLastScene(),c=i.getLiveGame().getCurrentAction(),l=i.getLiveGame().story;return(0,Rp.useEffect)((function(){var t,n;if("undefined"==typeof fetch)return r.events.emit(jv.EventTypes["event:preloaded.ready"]),void e.logger.warn(s,"Fetch is not supported in this environment, skipping preload");if(!i.config.player.preloadAllImages)return r.events.emit(jv.EventTypes["event:preloaded.ready"]),void e.logger.debug(s,"Preload all images is disabled, skipping preload");if(i.config.player.forceClearCache&&(o.clear(),e.logger.weakWarn(s,"Cache cleared")),l){var a=performance.now(),c=kl.catSrc([].concat(tg((null===(t=null==u?void 0:u.srcManager)||void 0===t?void 0:t.src)||[]),tg((null===(n=null==u?void 0:u.srcManager)||void 0===n?void 0:n.getFutureSrc())||[]))),f=new B(i.config.player.preloadConcurrency,i.config.player.preloadDelay),p=[],h=e.logger.group(s,!0);e.logger.debug(s,"preloading:",c);var d,y=Jv(c.image);try{var m=function(){var t=d.value,n=kl.getSrc(t);if(p.push(n),o.has(n)||o.isPreloading(n))return e.logger.debug(s,"Image already loaded (".concat(c.image.indexOf(t)+1,"/").concat(c.image.length,")"),n),1;f.addTask((function(){return new Promise((function(r){o.preload(n).onFinished((function(){e.logger.debug(s,"Image loaded (".concat(c.image.indexOf(t)+1,"/").concat(c.image.length,")"),n),r()}))}))}))};for(y.s();!(d=y.n()).done;)m()}catch(t){y.e(t)}finally{y.f()}return h.end(),f.start().then((function(){e.logger.info(s,"Image preload","loaded ".concat(o.size()," images in ").concat(performance.now()-a,"ms")),i.config.player.waitForPreload&&r.events.emit(jv.EventTypes["event:preloaded.ready"]),e.events.emit(Gm.EventTypes["event:state.preload.loaded"]),o.filter(p)})),i.config.player.waitForPreload||r.events.emit(jv.EventTypes["event:preloaded.ready"]),r.events.emit(jv.EventTypes["event:preloaded.mount"]),function(){e.events.emit(Gm.EventTypes["event:state.preload.unmount"]),e.logger.debug(s,"Preload unmounted")}}e.logger.weakWarn(s,"Story not found, skipping preload")}),[u,l]),(0,Rp.useEffect)((function(){a.current.clear()}),[u]),(0,Rp.useEffect)((function(){if("undefined"!=typeof fetch&&!i.config.player.preloadAllImages)if(l){var t=performance.now(),n=i.getLiveGame().getAllPredictableActions(l,c,i.config.player.maxPreloadActions).map((function(t){return kl.getPreloadableSrc(l,t)})).filter((function(t){return null!==t}));n.filter((function(t){return"scene"===(null==t?void 0:t.activeType)})).forEach((function(t){a.current.has(t)||a.current.add(t)}));var r=kl.catSrc([].concat(tg(a.current),tg(n))),u=new B(i.config.player.preloadConcurrency,i.config.player.preloadDelay),f=[],p=e.logger.group(s);e.logger.debug(s,"preloading:",r);var h,d=Jv(r.image);try{var y=function(){var t=h.value,n=kl.getSrc(t);if(f.push(n),o.has(n)||o.isPreloading(n))return e.logger.debug(s,"Image already loaded (".concat(r.image.indexOf(t)+1,"/").concat(r.image.length,")"),n),1;u.addTask((function(){return new Promise((function(i){o.preload(n).onFinished((function(){e.logger.debug(s,"Image loaded (".concat(r.image.indexOf(t)+1,"/").concat(r.image.length,")"),n),i()}))}))}))};for(d.s();!(h=d.n()).done;)y()}catch(t){d.e(t)}finally{d.f()}p.end(),u.start().then((function(){e.logger.info(s,"Image preload (quick reload)","loaded ".concat(o.size()," images in ").concat(performance.now()-t,"ms")),o.filter(f)}))}else e.logger.weakWarn(s,"Story not found, skipping preload")}),[c,l]),null}function og(t){var e=t.state,n=Vp().game;return(0,Rp.useEffect)((function(){if(window){var t,r,o,i=(t=function(t){n.config.player.skipKey.includes(t.key)&&n.preference.getPreference(rv.Preferences.skip)&&e.events.emit(Gm.EventTypes["event:state.player.skip"])},r=n.config.player.skipInterval,o=0,function(){var e=Date.now();if(!(e-o<r))return o=e,t.apply(void 0,arguments)});return window.addEventListener("keydown",i),function(){window.removeEventListener("keydown",i)}}e.logger.warn("NarraLeaf-React: Announcer","Cannot listen to window events\nThis component must be rendered in a browser environment")}),[]),Np().createElement(Np().Fragment,null)}var ig=o(33);function ag(){return ag=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},ag.apply(null,arguments)}function sg(t){var e=t.state,n=t.text,r={scale:function(t){return{width:"fit-content"}},transform:function(t){return{transform:Sa.propToCSSTransform(e,t,{translate:["left"===n.config.alignX?"0%":"right"===n.config.alignX?"-100%":void 0,"top"===n.config.alignY?"100%":"bottom"===n.config.alignY?"0%":void 0]})}}};return Np().createElement(Tv,{displayable:{element:n,skipTransform:e.game.config.elements.text.allowSkipTransform,skipTransition:e.game.config.elements.text.allowSkipTransition,transformOverwrites:r},child:function(t){return Np().createElement(ug,ag({},t,{text:n}))},state:e})}function ug(t){var e=t.transformRef,n=t.transformProps,r=t.transition,o=t.text,i=wm().ratio,a={style:{width:"fit-content",whiteSpace:"nowrap",fontSize:o.state.fontSize}},s=[{}],u=Ip(o.config.className);return Np().createElement(om.Div,null,Np().createElement(om.mDiv,ag({tag:"text.container",color:"green",border:"dashed",layout:!0,Ref:e,className:"absolute"},k({style:{opacity:0}},n,{style:{width:"fit-content"}})),r?r.toElementProps().map((function(t,e){var n=k(a,t,{style:{transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}},s[e]||{});return Np().createElement(om.Span,ag({tag:"text.transition."+e,key:e},n,{className:u}),Np().createElement("span",null,o.state.text))})):Np().createElement(om.Div,ag({tag:"text.transition.last",color:"green",border:"dashed",key:"last"},k(a,{style:{width:"fit-content",transform:"scale(".concat(i.state.scale,")"),transformOrigin:"".concat(o.config.alignX," ").concat(o.config.alignY)}})),Np().createElement(om.Span,{className:u},o.state.text))))}function cg(){return cg=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},cg.apply(null,arguments)}function lg(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 fg(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)?fg(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 fg(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 pg(t){var e=t.props,n=t.onLoad,r=t.id,o=t.Ref,i=(0,Rp.useRef)(null),a=wm().ratio,s=lg(Np().useState(0),2),u=s[0],c=s[1],l=Uv().cacheManager,f=Vp().game;function p(){var t=o||i;t.current&&c(t.current.naturalWidth*a.state.scale)}(0,Rp.useEffect)((function(){var t;!e.src||l.has(e.src)&&!l.isPreloading(e.src)||null===(t=f.getLiveGame().getGameState())||void 0===t||t.logger.warn("AspectScaleImage",'Image not preloaded: "'.concat(e.src,'". ')+"\nThis may be caused by complicated image action behavior that cannot be predicted. \nTo fix this issue, you can manually register the image using scene.requestImagePreload(YourImageSrc). ")}),[e,e.src,r]),(0,Rp.useEffect)((function(){return p(),a.onUpdate(p)}),[e,r]);var h=e.src?l.get(e.src)||e.src:Qs.DefaultImagePlaceholder;return Np().createElement("img",cg({ref:o||i},e,{onLoad:n,width:u,alt:e.alt,src:h}))}function hg(t){return function(t){if(Array.isArray(t))return mg(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||yg(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 dg(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)||yg(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 yg(t,e){if(t){if("string"==typeof t)return mg(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)?mg(t,e):void 0}}function mg(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 vg(){return vg=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},vg.apply(null,arguments)}function gg(t){var e=t.image,n=t.state,r=function(){};return Np().createElement(Tv,{displayable:{element:e,skipTransition:n.game.config.elements.img.allowSkipTransition,skipTransform:n.game.config.elements.img.allowSkipTransform,transformOverwrites:{}},child:function(t){return Np().createElement(bg,vg({},t,{image:e,handleLoad:r}))},state:n})}function bg(t){var e=t.transition,n=t.transformProps,r=t.transformRef,o=t.state,i=t.image,a=t.handleLoad,s=wm().ratio,u=(0,Rp.useRef)(null),c=dg((0,Rp.useState)([]),2),l=c[0],f=c[1],p={src:Qs.getSrc(i.state),style:Object.assign(Object.assign({},o.game.config.app.debug?{outline:"1px solid red"}:{}),{transformOrigin:"center"})},h=[{style:{display:"block",position:"unset"}},{style:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxWidth:"none"}}];return(0,Rp.useEffect)((function(){var t=i.events.onEvents([{type:Qs.EventTypes["event:wearable.create"],listener:i.events.on(Qs.EventTypes["event:wearable.create"],(function(t){f((function(e){return[].concat(hg(e),[t])}))}))}]);return function(){t.cancel()}}),[]),Np().createElement("div",null,Np().createElement(om.mDiv,vg({tag:"image.aspectScaleContainer",color:"green",border:"dashed",layout:!0,Ref:r,className:"absolute"},k({style:{opacity:0}},n,{style:{display:"inline-block",width:u.current?"".concat(u.current.naturalWidth*s.state.scale,"px"):"auto",height:u.current?"".concat(u.current.naturalHeight*s.state.scale,"px"):"auto"}})),Np().createElement(Np().Fragment,null,(e?e.toElementProps():[{}]).map((function(t,e){var n=k(p,t,h[e]||{});return Np().createElement(pg,{key:e,props:Object.assign({className:"absolute"},n),id:n.src,onLoad:a,Ref:0===e?u:void 0})}))),Np().createElement("div",{className:Ip("w-full h-full top-0 left-0 absolute")},l.map((function(t){return Np().createElement("div",{className:Ip("w-full h-full relative"),key:"wearable-"+t.getId()},Np().createElement(gg,{image:t,state:o}))})))))}function wg(t){var e=t.state,n=t.displayable;return Np().createElement(Np().Fragment,null,n.map((function(t){var n;if(t instanceof ff)return Np().createElement(sg,{state:e,text:t,key:"text-"+t.getId()});if(t instanceof Qs)return Np().createElement(gg,{state:e,image:t,key:"image-"+t.getId()});throw new Error("Unsupported displayable type: "+((null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)||t))})))}var Sg=o(556),xg=o.n(Sg);function _g(t){var e=t.error,n=t.errorInfo;return Vp().game.config.app.debug?Np().createElement("div",{className:"text-left"},Np().createElement("h1",null,"It is my fault, NarraLeaf-React cannot initialize the player correctly."),Np().createElement("p",{className:"text-red-700"},"Message: ",e.message),Np().createElement("pre",null,"Error Stack: ",null==e?void 0:e.stack),Np().createElement("pre",null,"Component Stack: ",null==n?void 0:n.componentStack),Np().createElement("pre",null,"Digest: ",null==n?void 0:n.digest)):Np().createElement("div",null,Np().createElement("h1",null,"The game cannot initialize the player correctly."),Np().createElement("p",null,"Please contact the game developer for further assistance."))}function kg(t){return kg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kg(t)}function Ag(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,Tg(r.key),r)}}function Tg(t){var e=function(t,e){if("object"!=kg(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=kg(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==kg(e)?e:e+""}function Eg(t,e,n){return e=Og(e),function(t,e){if(e&&("object"==kg(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,Pg()?Reflect.construct(e,n||[],Og(t).constructor):e.apply(t,n))}function Pg(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Pg=function(){return!!t})()}function Og(t){return Og=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Og(t)}function jg(t,e){return jg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jg(t,e)}var Cg=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=Eg(this,e,arguments)).state={hasError:!1,error:null,errorInfo:null},t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jg(t,e)}(e,t),n=e,o=[{key:"getDerivedStateFromError",value:function(t){return{hasError:!0,error:t,errorInfo:null}}}],(r=[{key:"componentDidCatch",value:function(t,e){this.setState({error:t,errorInfo:e}),console.error(t,e)}},{key:"render",value:function(){return this.state.hasError?Np().createElement(_g,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}])&&Ag(n.prototype,r),o&&Ag(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Np().Component);function Lg(t){var e=t.containerRef,n=wm().ratio;return(0,Rp.useEffect)((function(){var t=e.current;if(t){var r=new ResizeObserver((function(){n.requestUpdate()}));return r.observe(t),function(){r.disconnect()}}}),[e.current]),null}function Ig(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 Rg(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)?Rg(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 Rg(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 Ng(t){var e=t.src,n=t.width,r=t.height,o=Ig((0,Rp.useState)({x:0,y:0}),2),i=o[0],a=o[1],s=Ig((0,Rp.useState)(!1),2),u=s[0],c=s[1],l=(0,Rp.useRef)(null),f=wm().ratio;return(0,Rp.useEffect)((function(){var t=function(t){if(l.current){var e=l.current.getBoundingClientRect(),n=t.clientX-e.left,r=t.clientY-e.top;a({x:n,y:r}),u||c(!0)}};return window.addEventListener("mousemove",t),function(){window.removeEventListener("mousemove",t)}}),[u]),Np().createElement(Am,{$ref:l,className:"overflow-hidden relative"},Np().createElement("img",{src:e,style:{position:"absolute",left:i.x,top:i.y,width:n,height:r,pointerEvents:"none",zIndex:1001,display:u?"block":"none",cursor:"none",transform:"scale(".concat(f.state.scale,")")},alt:""}))}function Mg(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 Dg(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)?Dg(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 Dg(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 Fg(t,e){return t.handle(e)}function Bg(t){var e=t.story,n=void 0===e?Op.empty():e,r=t.width,o=t.height,i=t.className,a=t.onReady,s=t.onEnd,u=t.children,c=Mg((0,Rp.useReducer)((function(t){return t+1}),0),2)[1],l=Vp().game,f=Mg((0,Rp.useReducer)(Fg,new Gm(l,{update:c,forceUpdate:function(){p.logger.weakWarn("Player","force update"),(0,ig.flushSync)((function(){c()}))},next:S,dispatch:function(t){return h(t)}})),2),p=f[0],h=f[1],d=Np().createRef(),y=Mg((0,Rp.useState)(!1),2),m=y[0],v=y[1],g=Np().useRef(!1),b=l.config.elements.say.use,w=l.config.elements.menu.use;function S(){for(var t=!1;!t;){var e=l.getLiveGame().next(p);if(!e)break;if(A.isAwaitable(e)){t=!0;break}if(e instanceof R){e.nextUnlock().then((function(){S()})),t=!0;break}h(e)}p.stage.update()}(0,Rp.useEffect)((function(){return l.getLiveGame().setGameState(p),n&&!l.getLiveGame().isPlaying()&&l.getLiveGame().loadStory(n),function(){l.getLiveGame().setGameState(void 0)}}),[l,n]),(0,Rp.useEffect)((function(){return V((function(){v(!0);var t=p.getLastScene(),e=[];t?e.push({type:"event:scene.mount",listener:t.events.once("event:scene.mount",(function(){p.stage.next()}))}):p.stage.next();var n=p.events.onEvents([{type:Gm.EventTypes["event:state.end"],listener:function(){s&&s({game:l,gameState:p,liveGame:l.getLiveGame(),storable:l.getLiveGame().getStorable()})}}]),r=p.events.onEvents([{type:Gm.EventTypes["event:state.player.skip"],listener:function(){l.getLiveGame().abortAwaiting(),S()}}]);return p.stage.update(),function(){t&&e.forEach((function(e){t.events.off(e.type,e.listener)})),n.cancel(),r.cancel()}}))}),[]),(0,Rp.useEffect)((function(){return V((function(){m&&a&&!g.current&&(g.current=!0,a({game:l,gameState:p,liveGame:l.getLiveGame(),storable:l.getLiveGame().getStorable()}))}))}),[m]),p.events.emit(Gm.EventTypes["event:state.player.flush"]);var x=r||l.config.player.width,_=o||l.config.player.height;return Np().createElement(Cg,null,Np().createElement("div",{style:{width:"number"==typeof x?"".concat(x,"px"):x,height:"number"==typeof _?"".concat(_,"px"):_},className:Ip(i,"__narraleaf_content-player"),ref:d},Np().createElement(wv,{className:Ip("flex-grow overflow-auto")},Np().createElement(Lg,{containerRef:d}),Np().createElement(Am,{style:{cursor:p.game.config.player.cursor?"none":"auto",overflow:p.game.config.player.showOverflow?"visible":"hidden"}},l.config.player.cursor&&Np().createElement(Ng,{src:l.config.player.cursor,width:l.config.player.cursorWidth,height:l.config.player.cursorHeight}),Np().createElement(rg,{state:p}),Np().createElement(Vg,{onLoaded:function(){p.stage.update(),n&&S()},state:p},Np().createElement(og,{state:p}),p.getSceneElements().map((function(t){var e=t.scene,n=t.ele;return Np().createElement(Qv,{key:"scene-"+e.getId(),state:p,scene:e},Np().createElement(wg,{state:p,displayable:n.displayable}),n.texts.map((function(t){var e=t.action,n=t.onClick;return Np().createElement(b,{state:p,key:"say-"+e.id,action:e,onClick:function(){n(),S()}})})),n.menus.map((function(t,e){var n=t.action,r=t.onClick;return Np().createElement("div",{key:"menu-"+e},Np().createElement(w,{state:p,prompt:n.prompt,choices:n.choices,afterChoose:function(t){r(t),S()},words:n.words}))})))}))),u))))}function Vg(t){var e=t.children,n=t.onLoaded,r=t.state,o=Uv().preloaded,i=Mg((0,Rp.useState)(!1),2),a=i[0],s=i[1];return(0,Rp.useEffect)((function(){var t=o.events.on(jv.EventTypes["event:preloaded.ready"],(function(){s(!0),n()})),e=r.events.on(Gm.EventTypes["event:state.preload.unmount"],(function(){s(!1)}));return function(){o.events.off(jv.EventTypes["event:preloaded.ready"],t),r.events.off(Gm.EventTypes["event:state.preload.unmount"],e)}}),[a]),Np().createElement(Np().Fragment,null,a?e:null)}function Ug(t){var e=t.children,n=t.game;return Np().createElement(Np().Fragment,null,Np().createElement(bm,null,Np().createElement(Bp,{game:n},Np().createElement(Vv,null,e))))}function Gg(){return Gg=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},Gg.apply(null,arguments)}function Wg(t){var e=t.alignX,n=void 0===e?"center":e,r=t.alignY,o=void 0===r?"center":r,i=t.children,a=t.width,s=t.height,u=t.className,c=wm().ratio,l="left"===n?"justify-start":"right"===n?"justify-end":"justify-center",f="top"===o?"items-start":"bottom"===o?"items-end":"items-center";return Np().createElement(Am,{className:Ip("flex absolute",l,f,u,"pointer-events-none"),style:{width:a,height:s,transform:"scale(".concat(c.state.scale,")"),transformOrigin:"".concat(n," ").concat(o),pointerEvents:"all"}},i)}Cg.propTypes={children:xg().node.isRequired};function zg(t){var e=t.children,n=t.className,r=wm().ratio,o=Vp().game;return Np().createElement(Am,{className:Ip("absolute pointer-events-none w-full h-full"),style:{transform:"scale(".concat(r.state.scale,")"),transformOrigin:"left top",width:o.config.player.width,height:o.config.player.height,pointerEvents:"none"}},Np().createElement("div",{style:{pointerEvents:"all"}},Np().createElement("div",{className:Ip("absolute",n)},e)))}var Hg={Left:function(t){return Np().createElement(Wg,Gg({},t,{alignX:"left",alignY:"top"}))},Center:function(t){return Np().createElement(Wg,Gg({},t,{alignX:"center",alignY:"top"}))},Right:function(t){return Np().createElement(Wg,Gg({},t,{alignX:"right",alignY:"top"}))}},$g={Left:function(t){return Np().createElement(Wg,Gg({},t,{alignX:"left",alignY:"center"}))},Center:function(t){return Np().createElement(Wg,Gg({},t,{alignX:"center",alignY:"center"}))},Right:function(t){return Np().createElement(Wg,Gg({},t,{alignX:"right",alignY:"center"}))}},Yg={Left:function(t){return Np().createElement(Wg,Gg({},t,{alignX:"left",alignY:"bottom"}))},Center:function(t){return Np().createElement(Wg,Gg({},t,{alignX:"center",alignY:"bottom"}))},Right:function(t){return Np().createElement(Wg,Gg({},t,{alignX:"right",alignY:"bottom"}))}};function qg(){return qg=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},qg.apply(null,arguments)}var Xg=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},Kg={className:xg().string},Zg={children:xg().element};function Qg(t,e){var n=(0,Rp.forwardRef)((function(t,n){var r=t.children,o=t.className,i=Xg(t,["children","className"]);return e(Object.assign({children:r,className:o,$ref:n},i))}));return n.displayName=t,n.propTypes=Object.assign(Object.assign({},Kg),Zg),n}var Jg=Qg("VBox",(function(t){var e=t.children,n=t.className,r=t.$ref,o=Xg(t,["children","className","$ref"]);return Np().createElement("div",qg({ref:r,className:Ip("flex flex-col",n)},o),e)})),tb=Qg("HBox",(function(t){var e=t.children,n=t.className,r=t.$ref,o=Xg(t,["children","className","$ref"]);return Np().createElement("div",qg({ref:r,className:Ip("flex flex-row",n)},o),e)}));function eb(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 nb(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)?nb(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 nb(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 rb(t){var e=Vp().game,n=eb(Np().useState(e.preference.getPreference(t)),2),r=n[0],o=n[1];return(0,Rp.useEffect)((function(){return e.preference.onPreferenceChange(t,o).cancel}),[]),[r,function(n){e.preference.setPreference(t,n),o(n)}]}function ob(t){return ob="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ob(t)}function ib(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,ab(r.key),r)}}function ab(t){var e=function(t,e){if("object"!=ob(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=ob(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ob(e)?e:e+""}function sb(t,e,n){return e=cb(e),function(t,e){if(e&&("object"==ob(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,ub()?Reflect.construct(e,n||[],cb(t).constructor):e.apply(t,n))}function ub(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ub=function(){return!!t})()}function cb(t){return cb=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cb(t)}function lb(t,e){return lb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},lb(t,e)}var fb=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=sb(this,e)).state={opacity:1},t.duration=n,t.easing=r||Yl.DefaultEasing,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&lb(t,e)}(e,t),n=e,(r=[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){t&&t(),n.state.opacity=e.Frames[1]},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,backgroundColor:Pu.isImageColor(this.src)?E(this.src):""},src:Pu.isImageSrc(this.src)?Pu.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])&&ib(n.prototype,r),o&&ib(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Yl);function pb(t){return pb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pb(t)}function hb(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,db(r.key),r)}}function db(t){var e=function(t,e){if("object"!=pb(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=pb(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pb(e)?e:e+""}function yb(t,e,n){return e=vb(e),function(t,e){if(e&&("object"==pb(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,mb()?Reflect.construct(e,n||[],vb(t).constructor):e.apply(t,n))}function mb(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(mb=function(){return!!t})()}function vb(t){return vb=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vb(t)}function gb(t,e){return gb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gb(t,e)}fb.Frames=[0,1];var bb=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=yb(this,e)).state={opacity:0,transform:""},r.duration=o,r.direction=t,r.offset=n,r.easing=i||Yl.DefaultEasing,r.__stack=O(),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&&gb(t,e)}(e,t),n=e,(r=[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var e=this;if(!this.src)throw new Error("src is required, but not provided\nat:\n"+this.__stack);this.state.opacity=0,this.state.transform=this.getInitialTransform(),this.requestAnimation({start:0,end:1,duration:this.duration},{onComplete:t,onUpdate:function(t){e.state.opacity=t,e.state.transform=e.getTransform(t)}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:1}},{style:{opacity:this.state.opacity,transform:this.state.transform,backgroundColor:Pu.isImageColor(this.src)?E(this.src):""},src:Pu.isImageSrc(this.src)?Pu.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.direction,this.offset,this.duration,this.easing).setSrc(this.src)}},{key:"getInitialTransform",value:function(){switch(this.direction){case"left":return"translateX(-".concat(this.offset,"px)");case"right":return"translateX(".concat(this.offset,"px)");case"top":return"translateY(-".concat(this.offset,"px)");case"bottom":return"translateY(".concat(this.offset,"px)");default:return""}}},{key:"getTransform",value:function(t){switch(this.direction){case"left":return"translateX(".concat((1-t)*-this.offset,"px)");case"right":return"translateX(".concat((1-t)*this.offset,"px)");case"top":return"translateY(".concat((1-t)*-this.offset,"px)");case"bottom":return"translateY(".concat((1-t)*this.offset,"px)");default:return""}}}])&&hb(n.prototype,r),o&&hb(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Yl);function wb(t){return wb="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wb(t)}function Sb(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,xb(r.key),r)}}function xb(t){var e=function(t,e){if("object"!=wb(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=wb(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==wb(e)?e:e+""}function _b(t,e,n){return e=Ab(e),function(t,e){if(e&&("object"==wb(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,kb()?Reflect.construct(e,n||[],Ab(t).constructor):e.apply(t,n))}function kb(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(kb=function(){return!!t})()}function Ab(t){return Ab=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ab(t)}function Tb(t,e){return Tb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tb(t,e)}var Eb=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=_b(this,e)).state={opacity:0},t.duration=n,t.easing=r||Yl.DefaultEasing,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tb(t,e)}(e,t),n=e,(r=[{key:"setSrc",value:function(t){return this.src=t,this}},{key:"start",value:function(t){var n=this;this.state.opacity=e.Frames[0],this.requestAnimation({start:e.Frames[0],end:e.Frames[1],duration:this.duration},{onComplete:function(){n.state.opacity=e.Frames[1],t&&t()},onUpdate:function(t){n.state.opacity=t}},{ease:this.easing})}},{key:"toElementProps",value:function(){return[{style:{opacity:this.state.opacity}},{style:{opacity:1-this.state.opacity,backgroundColor:Pu.isImageColor(this.src)?E(this.src):""},src:Pu.isImageSrc(this.src)?Pu.srcToString(this.src):""}]}},{key:"copy",value:function(){return new e(this.duration,this.easing).setSrc(this.src)}}])&&Sb(n.prototype,r),o&&Sb(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(Yl);Eb.Frames=[1,0]})(),i})()));
|