{"version":3,"file":"module.js","sources":["src/constants.js","src/canvas-effects/ease.js","src/lib/lib.js","node_modules/svelte/internal/index.mjs","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/util/index.js","node_modules/svelte/store/index.mjs","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/store/index.js","node_modules/svelte/easing/index.mjs","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/math/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationControl.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationManager.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/constants.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/convertRelative.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationAPI.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationGroupControl.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/animation/AnimationGroupAPI.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/initial/Centered.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/initial/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/PositionChangeSet.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/PositionData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/PositionStateAPI.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/StyleCache.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/transform/TransformData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/AdapterValidators.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/BasicBounds.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/TransformBounds.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/validators/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/transform/Transforms.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/update/UpdateElementData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/animate/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/update/UpdateElementManager.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/position/Position.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/ApplicationState.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/GetSvelteData.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/loadSvelteConfig.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/internal/SvelteReactive.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/SvelteApplication.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/cssVariables.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/action/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/transition/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/AppShellContextInternal.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/helper/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/TJSHeaderButton.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/TJSApplicationHeader.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/TJSFocusWrap.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/ResizableHandle.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/application/ApplicationShell.svelte","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/component/core/index.js","node_modules/@typhonjs-fvtt/runtime/_dist/svelte/application/index.js","src/utils/loadingBar.js","src/modules/sequencer-file-cache.js","src/modules/sequencer-file.js","src/modules/sequencer-database.js","src/formapplications/database/TreeViewEntry.svelte","src/formapplications/database/TreeViewSeparator.svelte","src/formapplications/database/DatabaseStore.js","src/formapplications/database/DatabaseEntry.svelte","node_modules/svelte-virtual-scroll-list/src/virtual.js","node_modules/svelte-virtual-scroll-list/src/Item.svelte","node_modules/svelte-virtual-scroll-list/src/VirtualScroll.svelte","src/formapplications/database/database-shell.svelte","src/formapplications/database/database-viewer-app.js","src/formapplications/effects-ui/HowTo.svelte","src/formapplications/effects-ui/Tabs.svelte","src/modules/sequence-manager.js","src/lib/filters/color-matrix-filter.js","src/lib/filters/blur-filter.js","src/lib/filters/noise-filter.js","src/lib/filters/glow-filter.js","src/lib/filters/clip-filter.js","src/lib/filters.js","src/modules/sequencer-animation-engine.js","src/modules/sequencer-audio-helper.js","src/modules/sequencer-foundry-replicator.js","src/sockets.js","src/utils/flag-manager.js","src/modules/sequencer-effect-manager.js","src/canvas-effects/effects-layer.js","src/lib/filters/vision-mask-filter.js","src/canvas-effects/canvas-effect.js","src/lib/canvas-lib.js","src/formapplications/effects-ui/effect-player-store.js","src/modules/sequencer-interaction-manager.js","src/formapplications/effects-ui/components/EffectEntry.svelte","src/formapplications/effects-ui/components/SoundEntry.svelte","src/formapplications/effects-ui/Manager.svelte","src/formapplications/effects-ui/components/SliderInput.svelte","src/formapplications/effects-ui/components/Checkbox.svelte","src/formapplications/effects-ui/components/NumberInput.svelte","src/formapplications/effects-ui/components/SwitchToggle.svelte","src/formapplications/effects-ui/Player.svelte","src/formapplications/effects-ui/components/SequenceStatus.svelte","src/formapplications/effects-ui/components/SequenceSection.svelte","src/formapplications/effects-ui/components/Sequence.svelte","src/formapplications/effects-ui/Sequences.svelte","src/formapplications/effects-ui/effects-ui-shell.svelte","src/formapplications/effects-ui/effects-ui-app.js","src/settings.js","src/layers.js","src/hotkeys.js","typings/typings.js","src/modules/sequencer-presets.js","src/sections/section.js","src/sections/func.js","src/sections/traits/animation.js","src/sections/traits/audio.js","src/sections/traits/files.js","src/sections/traits/moves.js","src/sections/traits/opacity.js","src/sections/traits/rotation.js","src/sections/traits/scale.js","src/sections/traits/time.js","src/sections/traits/users.js","src/sections/traits/filter.js","src/sections/traits/tint.js","src/sections/traits/location.js","src/sections/traits/offset.js","src/sections/traits/text.js","src/sections/traits/_traits.js","src/sections/effect.js","src/sections/sound.js","src/sections/animation.js","src/sections/scrollingText.js","src/sections/canvasPan.js","src/sections/wait.js","src/modules/sequencer.js","src/modules/sequencer-preloader.js","src/modules/sequencer-section-manager.js","src/lib/libWrapper/shim.js","src/libwrapper.js","src/migrations.js","src/module.js"],"sourcesContent":["const CONSTANTS = {\n MODULE_NAME: \"sequencer\",\n FLAG_NAME: \"effects\",\n COLOR: {\n PRIMARY: 0xee442f,\n SECONDARY: 0x601a4a,\n TERTIARY: 0x601a4a,\n },\n SHAPES: {\n POLY: \"polygon\",\n RECT: \"rectangle\",\n CIRC: \"circle\",\n ELIP: \"ellipse\",\n RREC: \"roundedRect\",\n },\n FEET_REGEX: new RegExp(/\\.[0-9]+ft\\.*/g),\n ARRAY_REGEX: new RegExp(/\\.[0-9]$/g),\n STATUS: {\n READY: 0,\n RUNNING: 1,\n COMPLETE: 2,\n SKIPPED: 3,\n ABORTED: 4,\n },\n};\n\nCONSTANTS.INTEGRATIONS = {};\nCONSTANTS.INTEGRATIONS.ISOMETRIC = {};\nCONSTANTS.INTEGRATIONS.ISOMETRIC.ACTIVE = false;\nCONSTANTS.INTEGRATIONS.ISOMETRIC.MODULE_NAME = \"grape_juice-isometrics\";\nCONSTANTS.INTEGRATIONS.ISOMETRIC.SCENE_ENABLED = `flags.${CONSTANTS.INTEGRATIONS.ISOMETRIC.MODULE_NAME}.is_isometric`;\nCONSTANTS.INTEGRATIONS.ISOMETRIC.PROJECTION_FLAG = `flags.${CONSTANTS.INTEGRATIONS.ISOMETRIC.MODULE_NAME}.original_image_projection_type`;\nCONSTANTS.INTEGRATIONS.ISOMETRIC.PROJECTION_TYPES = {\n TOPDOWN: \"topdown\",\n TRUE: \"true_isometric\",\n DIAMETRIC: \"diametric\",\n};\nCONSTANTS.INTEGRATIONS.ISOMETRIC.ISOMETRIC_CONVERSION = Math.sqrt(3);\nCONSTANTS.INTEGRATIONS.ISOMETRIC.DIMETRIC_CONVERSION =\n 2 / CONSTANTS.INTEGRATIONS.ISOMETRIC.ISOMETRIC_CONVERSION;\nCONSTANTS.INTEGRATIONS.ISOMETRIC.DUNGEON_BUILDER_CONVERSION =\n 278 / 154 / CONSTANTS.INTEGRATIONS.ISOMETRIC.ISOMETRIC_CONVERSION;\n\nCONSTANTS.EFFECTS_FLAG = `flags.${CONSTANTS.MODULE_NAME}.${CONSTANTS.FLAG_NAME}`;\n\nexport default CONSTANTS;\n","import * as lib from \"../lib/lib.js\";\n\nexport function registerEase(easeName, easeFunction, overwrite = false) {\n if (typeof easeName !== \"string\")\n throw lib.custom_error(\"registerEase\", \"easeName must be of type string\");\n if (!lib.is_function(easeFunction))\n throw lib.custom_error(\n \"registerEase\",\n \"easeFunction must be of type function\"\n );\n if (easeFunctions[easeName] !== undefined && !overwrite) return;\n lib.debug(`registerEase | Registered ease function: ${easeName}`);\n easeFunctions[easeName] = easeFunction;\n}\n\nexport const easeFunctions = {\n linear: linear,\n easeInSine: easeInSine,\n easeOutSine: easeOutSine,\n easeInOutSine: easeInOutSine,\n easeInQuad: easeInQuad,\n easeOutQuad: easeOutQuad,\n easeInOutQuad: easeInOutQuad,\n easeInCubic: easeInCubic,\n easeOutCubic: easeOutCubic,\n easeInOutCubic: easeInOutCubic,\n easeInQuart: easeInQuart,\n easeOutQuart: easeOutQuart,\n easeInOutQuart: easeInOutQuart,\n easeInQuint: easeInQuint,\n easeOutQuint: easeOutQuint,\n easeInOutQuint: easeInOutQuint,\n easeInExpo: easeInExpo,\n easeOutExpo: easeOutExpo,\n easeInOutExpo: easeInOutExpo,\n easeInCirc: easeInCirc,\n easeOutCirc: easeOutCirc,\n easeInOutCirc: easeInOutCirc,\n easeInBack: easeInBack,\n easeOutBack: easeOutBack,\n easeInOutBack: easeInOutBack,\n easeInElastic: easeInElastic,\n easeOutElastic: easeOutElastic,\n easeInOutElastic: easeInOutElastic,\n easeInBounce: easeInBounce,\n easeOutBounce: easeOutBounce,\n easeInOutBounce: easeInOutBounce,\n};\n\nexport const EASE = {\n LINEAR: \"linear\",\n SINE_IN: \"easeInSine\",\n SINE_OUT: \"easeOutSine\",\n SINE_IN_OUT: \"easeInOutSine\",\n QUAD_IN: \"easeInQuad\",\n QUAD_OUT: \"easeOutQuad\",\n QUAD_IN_OUT: \"easeInOutQuad\",\n CUBIC_IN: \"easeInCubic\",\n CUBIC_OUT: \"easeOutCubic\",\n CUBIC_IN_OUT: \"easeInOutCubic\",\n QUART_IN: \"easeInQuart\",\n QUART_OUT: \"easeOutQuart\",\n QUART_IN_OUT: \"easeInOutQuart\",\n QUINT_IN: \"easeInQuint\",\n QUINT_OUT: \"easeOutQuint\",\n QUINT_IN_OUT: \"easeInOutQuint\",\n EXPO_IN: \"easeInExpo\",\n EXPO_OUT: \"easeOutExpo\",\n EXPO_IN_OUT: \"easeInOutExpo\",\n CIRC_IN: \"easeInCirc\",\n CIRC_OUT: \"easeOutCirc\",\n CIRC_IN_OUT: \"easeInOutCirc\",\n BACK_IN: \"easeInBack\",\n BACK_OUT: \"easeOutBack\",\n BACK_IN_OUT: \"easeInOutBack\",\n ELASTIC_IN: \"easeInElastic\",\n ELASTIC_OUT: \"easeOutElastic\",\n ELASTIC_IN_OUT: \"easeInOutElastic\",\n BOUNCE_IN: \"easeInBounce\",\n BOUNCE_OUT: \"easeOutBounce\",\n BOUNCE_IN_OUT: \"easeInOutBounce\",\n};\n\nfunction linear(x) {\n return x;\n}\n\nfunction easeInSine(x) {\n return 1 - Math.cos((x * Math.PI) / 2);\n}\n\nfunction easeOutSine(x) {\n return Math.sin((x * Math.PI) / 2);\n}\n\nfunction easeInOutSine(x) {\n return -(Math.cos(Math.PI * x) - 1) / 2;\n}\n\nfunction easeInQuad(x) {\n return x * x;\n}\n\nfunction easeOutQuad(x) {\n return 1 - (1 - x) * (1 - x);\n}\n\nfunction easeInOutQuad(x) {\n return x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2;\n}\n\nfunction easeInCubic(x) {\n return x * x * x;\n}\n\nfunction easeOutCubic(x) {\n return 1 - Math.pow(1 - x, 3);\n}\n\nfunction easeInOutCubic(x) {\n return x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;\n}\n\nfunction easeInQuart(x) {\n return x * x * x * x;\n}\n\nfunction easeOutQuart(x) {\n return 1 - Math.pow(1 - x, 4);\n}\n\nfunction easeInOutQuart(x) {\n return x < 0.5 ? 8 * x * x * x * x : 1 - Math.pow(-2 * x + 2, 4) / 2;\n}\n\nfunction easeInQuint(x) {\n return x * x * x * x * x;\n}\n\nfunction easeOutQuint(x) {\n return 1 - Math.pow(1 - x, 5);\n}\n\nfunction easeInOutQuint(x) {\n return x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2;\n}\n\nfunction easeInExpo(x) {\n return x === 0 ? 0 : Math.pow(2, 10 * x - 10);\n}\n\nfunction easeOutExpo(x) {\n return x === 1 ? 1 : 1 - Math.pow(2, -10 * x);\n}\n\nfunction easeInOutExpo(x) {\n return x === 0\n ? 0\n : x === 1\n ? 1\n : x < 0.5\n ? Math.pow(2, 20 * x - 10) / 2\n : (2 - Math.pow(2, -20 * x + 10)) / 2;\n}\n\nfunction easeInCirc(x) {\n return 1 - Math.sqrt(1 - Math.pow(x, 2));\n}\n\nfunction easeOutCirc(x) {\n return Math.sqrt(1 - Math.pow(x - 1, 2));\n}\n\nfunction easeInOutCirc(x) {\n return x < 0.5\n ? (1 - Math.sqrt(1 - Math.pow(2 * x, 2))) / 2\n : (Math.sqrt(1 - Math.pow(-2 * x + 2, 2)) + 1) / 2;\n}\n\nfunction easeInBack(x) {\n const c1 = 1.70158;\n const c3 = c1 + 1;\n\n return c3 * x * x * x - c1 * x * x;\n}\n\nfunction easeOutBack(x) {\n const c1 = 1.70158;\n const c3 = c1 + 1;\n\n return 1 + c3 * Math.pow(x - 1, 3) + c1 * Math.pow(x - 1, 2);\n}\n\nfunction easeInOutBack(x) {\n const c1 = 1.70158;\n const c2 = c1 * 1.525;\n\n return x < 0.5\n ? (Math.pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2)) / 2\n : (Math.pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;\n}\n\nfunction easeInElastic(x) {\n const c4 = (2 * Math.PI) / 3;\n\n return x === 0\n ? 0\n : x === 1\n ? 1\n : -Math.pow(2, 10 * x - 10) * Math.sin((x * 10 - 10.75) * c4);\n}\n\nfunction easeOutElastic(x) {\n const c4 = (2 * Math.PI) / 3;\n\n return x === 0\n ? 0\n : x === 1\n ? 1\n : Math.pow(2, -10 * x) * Math.sin((x * 10 - 0.75) * c4) + 1;\n}\n\nfunction easeInOutElastic(x) {\n const c5 = (2 * Math.PI) / 4.5;\n\n return x === 0\n ? 0\n : x === 1\n ? 1\n : x < 0.5\n ? -(Math.pow(2, 20 * x - 10) * Math.sin((20 * x - 11.125) * c5)) / 2\n : (Math.pow(2, -20 * x + 10) * Math.sin((20 * x - 11.125) * c5)) / 2 + 1;\n}\n\nfunction easeInBounce(x) {\n return 1 - easeOutBounce(1 - x);\n}\n\nfunction easeOutBounce(x) {\n const n1 = 7.5625;\n const d1 = 2.75;\n\n if (x < 1 / d1) {\n return n1 * x * x;\n } else if (x < 2 / d1) {\n return n1 * (x -= 1.5 / d1) * x + 0.75;\n } else if (x < 2.5 / d1) {\n return n1 * (x -= 2.25 / d1) * x + 0.9375;\n } else {\n return n1 * (x -= 2.625 / d1) * x + 0.984375;\n }\n}\n\nfunction easeInOutBounce(x) {\n return x < 0.5\n ? (1 - easeOutBounce(1 - 2 * x)) / 2\n : (1 + easeOutBounce(2 * x - 1)) / 2;\n}\n","import CONSTANTS from \"../constants.js\";\nimport { easeFunctions } from \"../canvas-effects/ease.js\";\n\n/**\n * This function linearly interpolates between p1 and p2 based on a normalized value of t\n *\n * @param {string} inFile The start value\n * @param {object} inOptions The end value\n * @return {array|boolean} Interpolated value\n */\nexport async function getFiles(\n inFile,\n { applyWildCard = false, softFail = false } = {}\n) {\n let source = \"data\";\n const browseOptions = { wildcard: applyWildCard };\n\n if (/\\.s3\\./.test(inFile)) {\n source = \"s3\";\n const { bucket, keyPrefix } = FilePicker.parseS3URL(inFile);\n if (bucket) {\n browseOptions.bucket = bucket;\n inFile = keyPrefix;\n }\n }\n\n try {\n return (await FilePicker.browse(source, inFile, browseOptions)).files;\n } catch (err) {\n if (softFail) return false;\n throw custom_error(\"Sequencer\", `getFiles | ${err}`);\n }\n}\n\n/**\n * This function interpolates between p1 and p2 based on a normalized value of t, determined by the ease provided (string or function)\n *\n * @param {number} p1 The start value\n * @param {number} p2 The end value\n * @param {number} t The normalized percentage\n * @param {string|function} ease Type of ease to interpolate\n * @return {number} Interpolated value\n */\nexport function interpolate(p1, p2, t, ease = \"linear\") {\n const easeFunction = is_function(ease) ? ease : easeFunctions[ease];\n return p1 + (p2 - p1) * easeFunction(t);\n}\n\n/**\n * Returns a floating point number between a minimum and maximum value\n *\n * @param {number} min The minimum value\n * @param {number} max The maximum value\n * @param {boolean|MersenneTwister} twister The twister to generate the random results from\n * @return {number} A random value between the range given\n */\nexport function random_float_between(min, max, twister = false) {\n const random = twister ? twister.random() : Math.random();\n const _max = Math.max(max, min);\n const _min = Math.min(max, min);\n return random * (_max - _min) + _min;\n}\n\n/**\n * Returns an integer between a minimum and maximum value\n *\n * @param {number} min The minimum value\n * @param {number} max The maximum value\n * @param {boolean|MersenneTwister} twister The twister to generate the random results from\n * @return {int} A random integer between the range given\n */\nexport function random_int_between(min, max, twister = false) {\n return Math.floor(random_float_between(min, max, twister));\n}\n\n/**\n * Returns a shuffled copy of the original array.\n *\n * @param {array} inArray\n * @param {boolean|MersenneTwister} twister The twister to generate the random results from\n * @return {array}\n */\nexport function shuffle_array(inArray, twister = false) {\n let shuffled = [...inArray];\n const randomMethod = twister?.random ?? Math.random;\n for (let i = shuffled.length - 1; i > 0; i--) {\n let j = Math.floor(randomMethod() * (i + 1));\n let temp = shuffled[i];\n shuffled[i] = shuffled[j];\n shuffled[j] = temp;\n }\n return shuffled;\n}\n\n/**\n * This function determines if the given parameter is a callable function\n *\n * @param {function} inFunc The function object to be tested\n * @return {boolean} A boolean whether the function is actually a function\n */\nexport function is_function(inFunc) {\n return (\n inFunc &&\n ({}.toString.call(inFunc) === \"[object Function]\" ||\n {}.toString.call(inFunc) === \"[object AsyncFunction]\")\n );\n}\n\n/**\n * Returns a random element in the given array\n *\n * @param {array} inArray An array\n * @param {boolean} recurse Whether to recurse if the randomly chosen element is also an array\n * @param {boolean|MersenneTwister} twister The twister to generate the random results from\n * @param {boolean} index Whether to return the chosen index instead\n * @return {object} A random element from the array\n */\nexport function random_array_element(\n inArray,\n { recurse = false, twister = false, index = false } = {}\n) {\n const chosenIndex = random_int_between(0, inArray.length, twister);\n let choice = inArray[chosenIndex];\n if (recurse && Array.isArray(choice)) {\n return random_array_element(choice, { recurse, twister, index });\n }\n if (index) {\n return chosenIndex;\n }\n return choice;\n}\n\n/**\n * Returns a random element in the given object\n *\n * @param {object} inObject An object\n * @param {boolean} recurse Whether to recurse if the randomly chosen element is also an object\n * @param {boolean|MersenneTwister} twister The twister to generate the random results from\n * @return {object} A random element from the object\n */\nexport function random_object_element(\n inObject,\n { recurse = false, twister = false } = {}\n) {\n let keys = Object.keys(inObject).filter((k) => !k.startsWith(\"_\"));\n let choice = inObject[random_array_element(keys, { twister })];\n if (typeof choice === \"object\" && recurse) {\n return random_object_element(choice, { recurse: true });\n }\n return choice;\n}\n\n/**\n * Tests a parameter whether it is a real number\n *\n * @param {any} inNumber The parameter to test\n * @return {boolean} Whether it is of type number, not infinite, and not NaN\n */\nexport function is_real_number(inNumber) {\n return !isNaN(inNumber) && typeof inNumber === \"number\" && isFinite(inNumber);\n}\n\n/**\n * Gets a property in an object based on a path in dot-notated string\n *\n * @param {object} obj The object to be queried\n * @param {array|string} path The path in the object to the property in a dot-notated string\n * @returns {any} Property value, if found\n */\nexport function deep_get(obj, path) {\n if (!Array.isArray(path)) path = path.split(\".\");\n try {\n let i;\n for (i = 0; i < path.length - 1; i++) {\n obj = obj[path[i]];\n }\n return obj[path[i]];\n } catch (err) {}\n}\n\n/**\n * Sets a property in an object based on a path in dot-notated string, example:\n * let obj = { first: { second: { third: \"value\" } } }\n * deep_set(obj, \"newValue\", \"first.second.third\")\n * let obj = { first: { second: { third: \"newValue\" } } }\n *\n * @param {object} obj The object to be modified\n * @param {array|string} path The path in the object to the property in a dot-notated string\n * @param {any} value The value to set\n */\nexport function deep_set(obj, path, value) {\n if (!Array.isArray(path)) path = path.split(\".\");\n try {\n let i;\n for (i = 0; i < path.length - 1; i++) {\n obj = obj[path[i]];\n }\n if (is_function(obj[path[i]])) {\n obj[path[i]](value);\n } else {\n obj[path[i]] = value;\n }\n } catch (err) {}\n}\n\n/**\n * Flattens an object in a dot-notated format, like:\n * { data: { entry: { thing: \"stuff\" } } }\n * Becomes:\n * [{ \"data.entry.thing\": \"stuff\" }]\n *\n * @param {object} obj The object to be flattened\n * @return {object} The flattened object\n */\nexport function flatten_object(obj) {\n let toReturn = [];\n for (let i in obj) {\n if (i.startsWith(\"_\")) continue;\n if (!obj.hasOwnProperty(i)) continue;\n if (typeof obj[i] == \"object\") {\n let flatObject = flatten_object(obj[i]);\n for (let x in flatObject) {\n if (!flatObject.hasOwnProperty(x)) continue;\n toReturn[i + \".\" + x] = flatObject[x];\n }\n } else {\n toReturn[i] = obj[i];\n }\n }\n return toReturn;\n}\n\n/**\n * Wait for a duration.\n *\n * @param {number} ms Milliseconds to wait\n * @return {Promise} A promise that resolves after a given amount of milliseconds\n */\nexport function wait(ms) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Clamps a value between two numbers\n *\n * @param {number} num Number to clamp\n * @param {number} min The minimum the number can be\n * @param {number} max The maximum the number can be\n * @return {number} The clamped number\n */\nexport function clamp(num, min, max) {\n const _max = Math.max(min, max);\n const _min = Math.min(min, max);\n return Math.max(_min, Math.min(_max, num));\n}\n\n/**\n * Checks whether a given string is a valid UUID or not\n *\n * @param {string} inId\n * @returns {boolean}\n */\nexport function is_UUID(inId) {\n return (\n typeof inId === \"string\" &&\n (inId.startsWith(\"Scene\") ||\n inId.startsWith(\"Actor\") ||\n inId.startsWith(\"Item\")) &&\n (inId.match(/\\./g) || []).length &&\n !inId.endsWith(\".\")\n );\n}\n\n/**\n * Gets an object by an unique identifier, such as an ID, name, tag, label\n *\n * @param {String} inObjectId The object identifier to search for\n * @param {String} inSceneId The scene ID to search within\n * @return {any} Object if found, else undefined\n */\nexport function get_object_from_scene(\n inObjectId,\n inSceneId = game.user.viewedScene\n) {\n let tryUUID = is_UUID(inObjectId);\n if (tryUUID) {\n const obj = from_uuid_fast(inObjectId);\n if (obj) return obj;\n tryUUID = false;\n }\n return get_all_documents_from_scene(inSceneId).find((obj) => {\n return get_object_identifier(obj, tryUUID) === inObjectId;\n });\n}\n\n/**\n * Retrieves an object from the scene using its UUID, avoiding compendiums as they would have to be async'd\n *\n * @param uuid\n * @returns {null}\n */\nexport function from_uuid_fast(uuid) {\n let parts = uuid.split(\".\");\n let doc;\n\n const [docName, docId] = parts.slice(0, 2);\n parts = parts.slice(2);\n const collection = CONFIG[docName].collection.instance;\n doc = collection.get(docId);\n\n // Embedded Documents\n while (doc && parts.length > 1) {\n const [embeddedName, embeddedId] = parts.slice(0, 2);\n if (embeddedName === \"SequencerEffect\") {\n if (game.user.viewedScene !== docId) {\n let effects = doc.getFlag(CONSTANTS.MODULE_NAME, CONSTANTS.FLAG_NAME);\n doc = new Map(effects).get(embeddedId);\n } else {\n doc = Sequencer.EffectManager.getEffects({ effect: docId })?.[0];\n }\n } else {\n doc = doc.getEmbeddedDocument(embeddedName, embeddedId);\n }\n parts = parts.slice(2);\n }\n return doc || null;\n}\n\n/**\n * Gets all documents from the given scene\n *\n * @param inSceneId [inSceneId]\n * @returns {Array}\n */\nexport function get_all_documents_from_scene(inSceneId = false) {\n const scene = inSceneId\n ? game.scenes.get(inSceneId)\n : game.scenes.get(game.user?.viewedScene);\n if (!scene) return [];\n return [\n ...(canvas.templates?.preview?.children ?? []),\n ...Array.from(scene?.tokens ?? []),\n ...Array.from(scene?.lights ?? []),\n ...Array.from(scene?.sounds ?? []),\n ...Array.from(scene?.templates ?? []),\n ...Array.from(scene?.tiles ?? []),\n ...Array.from(scene?.walls ?? []),\n ...Array.from(scene?.drawings ?? []),\n ]\n .deepFlatten()\n .filter(Boolean);\n}\n\n/**\n * Gets the document from an object, if it has one\n *\n * @param inObject\n * @returns {Document|{document}|*}\n */\nexport function validate_document(inObject) {\n const document = inObject?.document ?? inObject;\n return is_UUID(document?.uuid) ? document : inObject;\n}\n\n/**\n * Get the unique identifier from an object\n *\n * @param {Object} inObject The object to get the unique identifier from\n * @param {Boolean} tryUUID The object to get the unique identifier from\n * @return {String} The identifier\n */\nexport function get_object_identifier(inObject, tryUUID = true) {\n const uuid = tryUUID && is_UUID(inObject?.uuid) ? inObject?.uuid : undefined;\n return (\n uuid ??\n inObject?.id ??\n inObject?.document?.name ??\n inObject?.name ??\n (inObject?.tag !== \"\" ? inObject?.tag : undefined) ??\n (inObject?.label !== \"\" ? inObject?.label : undefined)\n );\n}\n\n/**\n * Turns an array containing multiples of the same string, objects, etc, and removes duplications, and returns a fresh array\n *\n * @param {Array} inArray An array of multiple duplicate collections to be made unique\n * @return {Array} An array containing only unique objects\n */\nexport function make_array_unique(inArray) {\n return Array.from(new Set(inArray));\n}\n\nexport function debug(msg, args = \"\") {\n if (game.settings.get(CONSTANTS.MODULE_NAME, \"debug\"))\n console.log(`DEBUG | Sequencer | ${msg}`, args);\n}\n\nexport function debug_error(msg, args) {\n if (game.settings.get(CONSTANTS.MODULE_NAME, \"debug\"))\n console.error(`DEBUG | Sequencer | ${msg}`, args);\n}\n\nexport function custom_warning(inClassName, warning, notify = false) {\n inClassName =\n inClassName !== \"Sequencer\"\n ? \"Sequencer | Module: \" + inClassName\n : inClassName;\n warning = `${inClassName} | ${warning}`;\n if (notify) ui.notifications.warn(warning, { console: false });\n console.warn(warning.replace(\"
\", \"\\n\"));\n}\n\nconst throttledWarnings = {};\nexport function throttled_custom_warning(\n inClassName,\n warning,\n delay = 10000,\n notify = false\n) {\n inClassName =\n inClassName !== \"Sequencer\"\n ? \"Sequencer | Module: \" + inClassName\n : inClassName;\n warning = `${inClassName} | ${warning}`;\n if (throttledWarnings[warning]) return;\n throttledWarnings[warning] = true;\n if (notify) ui.notifications.warn(warning, { console: false });\n console.warn(warning.replace(\"
\", \"\\n\"));\n setTimeout(() => {\n delete throttledWarnings[warning];\n }, delay);\n}\n\nexport function custom_error(inClassName, error, notify = true) {\n inClassName =\n inClassName !== \"Sequencer\"\n ? \"Sequencer | Module: \" + inClassName\n : inClassName;\n error = `${inClassName} | ${error}`;\n if (notify) ui.notifications.error(error, { console: false });\n return new Error(error.replace(\"
\", \"\\n\"));\n}\n\nexport function user_can_do(inSetting) {\n return game.user.role > game.settings.get(CONSTANTS.MODULE_NAME, inSetting);\n}\n\nexport function group_by(xs, key) {\n return xs.reduce(function (acc, obj) {\n let property = getProperty(obj, key);\n acc[property] = acc[property] || [];\n acc[property].push(obj);\n return acc;\n }, {});\n}\n\nfunction objHasProperty(obj, prop) {\n return obj.constructor.prototype.hasOwnProperty(prop);\n}\n\nexport function sequence_proxy_wrap(inSequence) {\n return new Proxy(inSequence, {\n get: function (target, prop) {\n if (!objHasProperty(target, prop)) {\n if (Sequencer.SectionManager.externalSections[prop] === undefined) {\n const section = target.sections[target.sections.length - 1];\n if (section && objHasProperty(section, prop)) {\n const targetProperty = Reflect.get(section, prop);\n return is_function(targetProperty)\n ? targetProperty.bind(section)\n : targetProperty;\n }\n return Reflect.get(target, prop);\n }\n target.sectionToCreate =\n Sequencer.SectionManager.externalSections[prop];\n return Reflect.get(target, \"_createCustomSection\");\n }\n return Reflect.get(target, prop);\n },\n });\n}\n\nexport function section_proxy_wrap(inClass) {\n return new Proxy(inClass, {\n get: function (target, prop) {\n if (\n !objHasProperty(target, prop) &&\n objHasProperty(target.sequence, prop)\n ) {\n const targetProperty = Reflect.get(target.sequence, prop);\n return is_function(targetProperty)\n ? targetProperty.bind(target.sequence)\n : targetProperty;\n }\n return Reflect.get(target, prop);\n },\n });\n}\n\nexport function str_to_search_regex_str(str) {\n return str\n .trim()\n .replace(/[^A-Za-z0-9 .*_-]/g, \"\")\n .replace(/\\*+/g, \".*?\");\n}\n\nexport function safe_str(str) {\n return str.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\");\n}\n\nexport function scroll_to_element(\n scrollElement,\n scrollToElement,\n duration = 500\n) {\n if (!duration) {\n scrollElement.scrollTop(\n scrollElement.scrollTop() -\n scrollElement.offset().top +\n scrollToElement.offset().top\n );\n return;\n }\n\n scrollElement.animate(\n {\n scrollTop:\n scrollElement.scrollTop() -\n scrollElement.offset().top +\n scrollToElement.offset().top,\n },\n duration\n );\n\n return wait(duration);\n}\n\nexport async function highlight_element(\n element,\n { duration = false, color = \"#FF0000\", size = \"3px\" } = {}\n) {\n element.prop(\n \"style\",\n `-webkit-box-shadow: inset 0px 0px ${size} ${size} ${color}; box-shadow: inset 0px 0px ${size} ${size} ${color};`\n );\n if (!duration) return;\n await wait(duration);\n element.prop(\"style\", \"\");\n}\n\nexport function get_hash(input) {\n let hash = 0;\n const len = input.length;\n for (let i = 0; i < len; i++) {\n hash = (hash << 5) - hash + input.charCodeAt(i);\n hash |= 0; // to 32bit integer\n }\n return hash;\n}\n\nexport function parseColor(inColor) {\n return {\n hexadecimal: is_real_number(inColor) ? inColor.toString(16) : inColor,\n decimal:\n typeof inColor === \"string\" && inColor.startsWith(\"#\")\n ? parseInt(inColor.slice(1), 16)\n : inColor,\n };\n}\n","function noop() { }\nconst identity = x => x;\nfunction assign(tar, src) {\n // @ts-ignore\n for (const k in src)\n tar[k] = src[k];\n return tar;\n}\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\nfunction is_promise(value) {\n return !!value && (typeof value === 'object' || typeof value === 'function') && typeof value.then === 'function';\n}\nfunction add_location(element, file, line, column, char) {\n element.__svelte_meta = {\n loc: { file, line, column, char }\n };\n}\nfunction run(fn) {\n return fn();\n}\nfunction blank_object() {\n return Object.create(null);\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === 'function';\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');\n}\nlet src_url_equal_anchor;\nfunction src_url_equal(element_src, url) {\n if (!src_url_equal_anchor) {\n src_url_equal_anchor = document.createElement('a');\n }\n src_url_equal_anchor.href = url;\n return element_src === src_url_equal_anchor.href;\n}\nfunction not_equal(a, b) {\n return a != a ? b == b : a !== b;\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nfunction validate_store(store, name) {\n if (store != null && typeof store.subscribe !== 'function') {\n throw new Error(`'${name}' is not a store with a 'subscribe' method`);\n }\n}\nfunction subscribe(store, ...callbacks) {\n if (store == null) {\n return noop;\n }\n const unsub = store.subscribe(...callbacks);\n return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\nfunction get_store_value(store) {\n let value;\n subscribe(store, _ => value = _)();\n return value;\n}\nfunction component_subscribe(component, store, callback) {\n component.$$.on_destroy.push(subscribe(store, callback));\n}\nfunction create_slot(definition, ctx, $$scope, fn) {\n if (definition) {\n const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n return definition[0](slot_ctx);\n }\n}\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n return definition[1] && fn\n ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))\n : $$scope.ctx;\n}\nfunction get_slot_changes(definition, $$scope, dirty, fn) {\n if (definition[2] && fn) {\n const lets = definition[2](fn(dirty));\n if ($$scope.dirty === undefined) {\n return lets;\n }\n if (typeof lets === 'object') {\n const merged = [];\n const len = Math.max($$scope.dirty.length, lets.length);\n for (let i = 0; i < len; i += 1) {\n merged[i] = $$scope.dirty[i] | lets[i];\n }\n return merged;\n }\n return $$scope.dirty | lets;\n }\n return $$scope.dirty;\n}\nfunction update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {\n if (slot_changes) {\n const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n slot.p(slot_context, slot_changes);\n }\n}\nfunction update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) {\n const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn);\n}\nfunction get_all_dirty_from_scope($$scope) {\n if ($$scope.ctx.length > 32) {\n const dirty = [];\n const length = $$scope.ctx.length / 32;\n for (let i = 0; i < length; i++) {\n dirty[i] = -1;\n }\n return dirty;\n }\n return -1;\n}\nfunction exclude_internal_props(props) {\n const result = {};\n for (const k in props)\n if (k[0] !== '$')\n result[k] = props[k];\n return result;\n}\nfunction compute_rest_props(props, keys) {\n const rest = {};\n keys = new Set(keys);\n for (const k in props)\n if (!keys.has(k) && k[0] !== '$')\n rest[k] = props[k];\n return rest;\n}\nfunction compute_slots(slots) {\n const result = {};\n for (const key in slots) {\n result[key] = true;\n }\n return result;\n}\nfunction once(fn) {\n let ran = false;\n return function (...args) {\n if (ran)\n return;\n ran = true;\n fn.call(this, ...args);\n };\n}\nfunction null_to_empty(value) {\n return value == null ? '' : value;\n}\nfunction set_store_value(store, ret, value) {\n store.set(value);\n return ret;\n}\nconst has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\nfunction action_destroyer(action_result) {\n return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\n\nconst is_client = typeof window !== 'undefined';\nlet now = is_client\n ? () => window.performance.now()\n : () => Date.now();\nlet raf = is_client ? cb => requestAnimationFrame(cb) : noop;\n// used internally for testing\nfunction set_now(fn) {\n now = fn;\n}\nfunction set_raf(fn) {\n raf = fn;\n}\n\nconst tasks = new Set();\nfunction run_tasks(now) {\n tasks.forEach(task => {\n if (!task.c(now)) {\n tasks.delete(task);\n task.f();\n }\n });\n if (tasks.size !== 0)\n raf(run_tasks);\n}\n/**\n * For testing purposes only!\n */\nfunction clear_loops() {\n tasks.clear();\n}\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n */\nfunction loop(callback) {\n let task;\n if (tasks.size === 0)\n raf(run_tasks);\n return {\n promise: new Promise(fulfill => {\n tasks.add(task = { c: callback, f: fulfill });\n }),\n abort() {\n tasks.delete(task);\n }\n };\n}\n\n// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM\n// at the end of hydration without touching the remaining nodes.\nlet is_hydrating = false;\nfunction start_hydrating() {\n is_hydrating = true;\n}\nfunction end_hydrating() {\n is_hydrating = false;\n}\nfunction upper_bound(low, high, key, value) {\n // Return first index of value larger than input value in the range [low, high)\n while (low < high) {\n const mid = low + ((high - low) >> 1);\n if (key(mid) <= value) {\n low = mid + 1;\n }\n else {\n high = mid;\n }\n }\n return low;\n}\nfunction init_hydrate(target) {\n if (target.hydrate_init)\n return;\n target.hydrate_init = true;\n // We know that all children have claim_order values since the unclaimed have been detached if target is not \n let children = target.childNodes;\n // If target is , there may be children without claim_order\n if (target.nodeName === 'HEAD') {\n const myChildren = [];\n for (let i = 0; i < children.length; i++) {\n const node = children[i];\n if (node.claim_order !== undefined) {\n myChildren.push(node);\n }\n }\n children = myChildren;\n }\n /*\n * Reorder claimed children optimally.\n * We can reorder claimed children optimally by finding the longest subsequence of\n * nodes that are already claimed in order and only moving the rest. The longest\n * subsequence of nodes that are claimed in order can be found by\n * computing the longest increasing subsequence of .claim_order values.\n *\n * This algorithm is optimal in generating the least amount of reorder operations\n * possible.\n *\n * Proof:\n * We know that, given a set of reordering operations, the nodes that do not move\n * always form an increasing subsequence, since they do not move among each other\n * meaning that they must be already ordered among each other. Thus, the maximal\n * set of nodes that do not move form a longest increasing subsequence.\n */\n // Compute longest increasing subsequence\n // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j\n const m = new Int32Array(children.length + 1);\n // Predecessor indices + 1\n const p = new Int32Array(children.length);\n m[0] = -1;\n let longest = 0;\n for (let i = 0; i < children.length; i++) {\n const current = children[i].claim_order;\n // Find the largest subsequence length such that it ends in a value less than our current value\n // upper_bound returns first greater value, so we subtract one\n // with fast path for when we are on the current longest subsequence\n const seqLen = ((longest > 0 && children[m[longest]].claim_order <= current) ? longest + 1 : upper_bound(1, longest, idx => children[m[idx]].claim_order, current)) - 1;\n p[i] = m[seqLen] + 1;\n const newLen = seqLen + 1;\n // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.\n m[newLen] = i;\n longest = Math.max(newLen, longest);\n }\n // The longest increasing subsequence of nodes (initially reversed)\n const lis = [];\n // The rest of the nodes, nodes that will be moved\n const toMove = [];\n let last = children.length - 1;\n for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {\n lis.push(children[cur - 1]);\n for (; last >= cur; last--) {\n toMove.push(children[last]);\n }\n last--;\n }\n for (; last >= 0; last--) {\n toMove.push(children[last]);\n }\n lis.reverse();\n // We sort the nodes being moved to guarantee that their insertion order matches the claim order\n toMove.sort((a, b) => a.claim_order - b.claim_order);\n // Finally, we move the nodes\n for (let i = 0, j = 0; i < toMove.length; i++) {\n while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {\n j++;\n }\n const anchor = j < lis.length ? lis[j] : null;\n target.insertBefore(toMove[i], anchor);\n }\n}\nfunction append(target, node) {\n target.appendChild(node);\n}\nfunction append_styles(target, style_sheet_id, styles) {\n const append_styles_to = get_root_for_style(target);\n if (!append_styles_to.getElementById(style_sheet_id)) {\n const style = element('style');\n style.id = style_sheet_id;\n style.textContent = styles;\n append_stylesheet(append_styles_to, style);\n }\n}\nfunction get_root_for_style(node) {\n if (!node)\n return document;\n const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;\n if (root && root.host) {\n return root;\n }\n return node.ownerDocument;\n}\nfunction append_empty_stylesheet(node) {\n const style_element = element('style');\n append_stylesheet(get_root_for_style(node), style_element);\n return style_element.sheet;\n}\nfunction append_stylesheet(node, style) {\n append(node.head || node, style);\n return style.sheet;\n}\nfunction append_hydration(target, node) {\n if (is_hydrating) {\n init_hydrate(target);\n if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentNode !== target))) {\n target.actual_end_child = target.firstChild;\n }\n // Skip nodes of undefined ordering\n while ((target.actual_end_child !== null) && (target.actual_end_child.claim_order === undefined)) {\n target.actual_end_child = target.actual_end_child.nextSibling;\n }\n if (node !== target.actual_end_child) {\n // We only insert if the ordering of this node should be modified or the parent node is not target\n if (node.claim_order !== undefined || node.parentNode !== target) {\n target.insertBefore(node, target.actual_end_child);\n }\n }\n else {\n target.actual_end_child = node.nextSibling;\n }\n }\n else if (node.parentNode !== target || node.nextSibling !== null) {\n target.appendChild(node);\n }\n}\nfunction insert(target, node, anchor) {\n target.insertBefore(node, anchor || null);\n}\nfunction insert_hydration(target, node, anchor) {\n if (is_hydrating && !anchor) {\n append_hydration(target, node);\n }\n else if (node.parentNode !== target || node.nextSibling != anchor) {\n target.insertBefore(node, anchor || null);\n }\n}\nfunction detach(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\nfunction destroy_each(iterations, detaching) {\n for (let i = 0; i < iterations.length; i += 1) {\n if (iterations[i])\n iterations[i].d(detaching);\n }\n}\nfunction element(name) {\n return document.createElement(name);\n}\nfunction element_is(name, is) {\n return document.createElement(name, { is });\n}\nfunction object_without_properties(obj, exclude) {\n const target = {};\n for (const k in obj) {\n if (has_prop(obj, k)\n // @ts-ignore\n && exclude.indexOf(k) === -1) {\n // @ts-ignore\n target[k] = obj[k];\n }\n }\n return target;\n}\nfunction svg_element(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n}\nfunction text(data) {\n return document.createTextNode(data);\n}\nfunction space() {\n return text(' ');\n}\nfunction empty() {\n return text('');\n}\nfunction listen(node, event, handler, options) {\n node.addEventListener(event, handler, options);\n return () => node.removeEventListener(event, handler, options);\n}\nfunction prevent_default(fn) {\n return function (event) {\n event.preventDefault();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_propagation(fn) {\n return function (event) {\n event.stopPropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction self(fn) {\n return function (event) {\n // @ts-ignore\n if (event.target === this)\n fn.call(this, event);\n };\n}\nfunction trusted(fn) {\n return function (event) {\n // @ts-ignore\n if (event.isTrusted)\n fn.call(this, event);\n };\n}\nfunction attr(node, attribute, value) {\n if (value == null)\n node.removeAttribute(attribute);\n else if (node.getAttribute(attribute) !== value)\n node.setAttribute(attribute, value);\n}\nfunction set_attributes(node, attributes) {\n // @ts-ignore\n const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n for (const key in attributes) {\n if (attributes[key] == null) {\n node.removeAttribute(key);\n }\n else if (key === 'style') {\n node.style.cssText = attributes[key];\n }\n else if (key === '__value') {\n node.value = node[key] = attributes[key];\n }\n else if (descriptors[key] && descriptors[key].set) {\n node[key] = attributes[key];\n }\n else {\n attr(node, key, attributes[key]);\n }\n }\n}\nfunction set_svg_attributes(node, attributes) {\n for (const key in attributes) {\n attr(node, key, attributes[key]);\n }\n}\nfunction set_custom_element_data_map(node, data_map) {\n Object.keys(data_map).forEach((key) => {\n set_custom_element_data(node, key, data_map[key]);\n });\n}\nfunction set_custom_element_data(node, prop, value) {\n if (prop in node) {\n node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;\n }\n else {\n attr(node, prop, value);\n }\n}\nfunction xlink_attr(node, attribute, value) {\n node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\nfunction get_binding_group_value(group, __value, checked) {\n const value = new Set();\n for (let i = 0; i < group.length; i += 1) {\n if (group[i].checked)\n value.add(group[i].__value);\n }\n if (!checked) {\n value.delete(__value);\n }\n return Array.from(value);\n}\nfunction to_number(value) {\n return value === '' ? null : +value;\n}\nfunction time_ranges_to_array(ranges) {\n const array = [];\n for (let i = 0; i < ranges.length; i += 1) {\n array.push({ start: ranges.start(i), end: ranges.end(i) });\n }\n return array;\n}\nfunction children(element) {\n return Array.from(element.childNodes);\n}\nfunction init_claim_info(nodes) {\n if (nodes.claim_info === undefined) {\n nodes.claim_info = { last_index: 0, total_claimed: 0 };\n }\n}\nfunction claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {\n // Try to find nodes in an order such that we lengthen the longest increasing subsequence\n init_claim_info(nodes);\n const resultNode = (() => {\n // We first try to find an element after the previous one\n for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n return node;\n }\n }\n // Otherwise, we try to find one before\n // We iterate in reverse so that we don't go too far back\n for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n else if (replacement === undefined) {\n // Since we spliced before the last_index, we decrease it\n nodes.claim_info.last_index--;\n }\n return node;\n }\n }\n // If we can't find any matching node, we create a new one\n return createNode();\n })();\n resultNode.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n return resultNode;\n}\nfunction claim_element_base(nodes, name, attributes, create_element) {\n return claim_node(nodes, (node) => node.nodeName === name, (node) => {\n const remove = [];\n for (let j = 0; j < node.attributes.length; j++) {\n const attribute = node.attributes[j];\n if (!attributes[attribute.name]) {\n remove.push(attribute.name);\n }\n }\n remove.forEach(v => node.removeAttribute(v));\n return undefined;\n }, () => create_element(name));\n}\nfunction claim_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, element);\n}\nfunction claim_svg_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, svg_element);\n}\nfunction claim_text(nodes, data) {\n return claim_node(nodes, (node) => node.nodeType === 3, (node) => {\n const dataStr = '' + data;\n if (node.data.startsWith(dataStr)) {\n if (node.data.length !== dataStr.length) {\n return node.splitText(dataStr.length);\n }\n }\n else {\n node.data = dataStr;\n }\n }, () => text(data), true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements\n );\n}\nfunction claim_space(nodes) {\n return claim_text(nodes, ' ');\n}\nfunction find_comment(nodes, text, start) {\n for (let i = start; i < nodes.length; i += 1) {\n const node = nodes[i];\n if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {\n return i;\n }\n }\n return nodes.length;\n}\nfunction claim_html_tag(nodes, is_svg) {\n // find html opening tag\n const start_index = find_comment(nodes, 'HTML_TAG_START', 0);\n const end_index = find_comment(nodes, 'HTML_TAG_END', start_index);\n if (start_index === end_index) {\n return new HtmlTagHydration(undefined, is_svg);\n }\n init_claim_info(nodes);\n const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);\n detach(html_tag_nodes[0]);\n detach(html_tag_nodes[html_tag_nodes.length - 1]);\n const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);\n for (const n of claimed_nodes) {\n n.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n }\n return new HtmlTagHydration(claimed_nodes, is_svg);\n}\nfunction set_data(text, data) {\n data = '' + data;\n if (text.wholeText !== data)\n text.data = data;\n}\nfunction set_input_value(input, value) {\n input.value = value == null ? '' : value;\n}\nfunction set_input_type(input, type) {\n try {\n input.type = type;\n }\n catch (e) {\n // do nothing\n }\n}\nfunction set_style(node, key, value, important) {\n if (value === null) {\n node.style.removeProperty(key);\n }\n else {\n node.style.setProperty(key, value, important ? 'important' : '');\n }\n}\nfunction select_option(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n if (option.__value === value) {\n option.selected = true;\n return;\n }\n }\n select.selectedIndex = -1; // no option should be selected\n}\nfunction select_options(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n option.selected = ~value.indexOf(option.__value);\n }\n}\nfunction select_value(select) {\n const selected_option = select.querySelector(':checked') || select.options[0];\n return selected_option && selected_option.__value;\n}\nfunction select_multiple_value(select) {\n return [].map.call(select.querySelectorAll(':checked'), option => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\nlet crossorigin;\nfunction is_crossorigin() {\n if (crossorigin === undefined) {\n crossorigin = false;\n try {\n if (typeof window !== 'undefined' && window.parent) {\n void window.parent.document;\n }\n }\n catch (error) {\n crossorigin = true;\n }\n }\n return crossorigin;\n}\nfunction add_resize_listener(node, fn) {\n const computed_style = getComputedStyle(node);\n if (computed_style.position === 'static') {\n node.style.position = 'relative';\n }\n const iframe = element('iframe');\n iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;');\n iframe.setAttribute('aria-hidden', 'true');\n iframe.tabIndex = -1;\n const crossorigin = is_crossorigin();\n let unsubscribe;\n if (crossorigin) {\n iframe.src = \"data:text/html,\";\n unsubscribe = listen(window, 'message', (event) => {\n if (event.source === iframe.contentWindow)\n fn();\n });\n }\n else {\n iframe.src = 'about:blank';\n iframe.onload = () => {\n unsubscribe = listen(iframe.contentWindow, 'resize', fn);\n };\n }\n append(node, iframe);\n return () => {\n if (crossorigin) {\n unsubscribe();\n }\n else if (unsubscribe && iframe.contentWindow) {\n unsubscribe();\n }\n detach(iframe);\n };\n}\nfunction toggle_class(element, name, toggle) {\n element.classList[toggle ? 'add' : 'remove'](name);\n}\nfunction custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n const e = document.createEvent('CustomEvent');\n e.initCustomEvent(type, bubbles, cancelable, detail);\n return e;\n}\nfunction query_selector_all(selector, parent = document.body) {\n return Array.from(parent.querySelectorAll(selector));\n}\nfunction head_selector(nodeId, head) {\n const result = [];\n let started = 0;\n for (const node of head.childNodes) {\n if (node.nodeType === 8 /* comment node */) {\n const comment = node.textContent.trim();\n if (comment === `HEAD_${nodeId}_END`) {\n started -= 1;\n result.push(node);\n }\n else if (comment === `HEAD_${nodeId}_START`) {\n started += 1;\n result.push(node);\n }\n }\n else if (started > 0) {\n result.push(node);\n }\n }\n return result;\n}\nclass HtmlTag {\n constructor(is_svg = false) {\n this.is_svg = false;\n this.is_svg = is_svg;\n this.e = this.n = null;\n }\n c(html) {\n this.h(html);\n }\n m(html, target, anchor = null) {\n if (!this.e) {\n if (this.is_svg)\n this.e = svg_element(target.nodeName);\n else\n this.e = element(target.nodeName);\n this.t = target;\n this.c(html);\n }\n this.i(anchor);\n }\n h(html) {\n this.e.innerHTML = html;\n this.n = Array.from(this.e.childNodes);\n }\n i(anchor) {\n for (let i = 0; i < this.n.length; i += 1) {\n insert(this.t, this.n[i], anchor);\n }\n }\n p(html) {\n this.d();\n this.h(html);\n this.i(this.a);\n }\n d() {\n this.n.forEach(detach);\n }\n}\nclass HtmlTagHydration extends HtmlTag {\n constructor(claimed_nodes, is_svg = false) {\n super(is_svg);\n this.e = this.n = null;\n this.l = claimed_nodes;\n }\n c(html) {\n if (this.l) {\n this.n = this.l;\n }\n else {\n super.c(html);\n }\n }\n i(anchor) {\n for (let i = 0; i < this.n.length; i += 1) {\n insert_hydration(this.t, this.n[i], anchor);\n }\n }\n}\nfunction attribute_to_object(attributes) {\n const result = {};\n for (const attribute of attributes) {\n result[attribute.name] = attribute.value;\n }\n return result;\n}\nfunction get_custom_elements_slots(element) {\n const result = {};\n element.childNodes.forEach((node) => {\n result[node.slot || 'default'] = true;\n });\n return result;\n}\nfunction construct_svelte_component(component, props) {\n return new component(props);\n}\n\n// we need to store the information for multiple documents because a Svelte application could also contain iframes\n// https://github.com/sveltejs/svelte/issues/3624\nconst managed_styles = new Map();\nlet active = 0;\n// https://github.com/darkskyapp/string-hash/blob/master/index.js\nfunction hash(str) {\n let hash = 5381;\n let i = str.length;\n while (i--)\n hash = ((hash << 5) - hash) ^ str.charCodeAt(i);\n return hash >>> 0;\n}\nfunction create_style_information(doc, node) {\n const info = { stylesheet: append_empty_stylesheet(node), rules: {} };\n managed_styles.set(doc, info);\n return info;\n}\nfunction create_rule(node, a, b, duration, delay, ease, fn, uid = 0) {\n const step = 16.666 / duration;\n let keyframes = '{\\n';\n for (let p = 0; p <= 1; p += step) {\n const t = a + (b - a) * ease(p);\n keyframes += p * 100 + `%{${fn(t, 1 - t)}}\\n`;\n }\n const rule = keyframes + `100% {${fn(b, 1 - b)}}\\n}`;\n const name = `__svelte_${hash(rule)}_${uid}`;\n const doc = get_root_for_style(node);\n const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc, node);\n if (!rules[name]) {\n rules[name] = true;\n stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length);\n }\n const animation = node.style.animation || '';\n node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`;\n active += 1;\n return name;\n}\nfunction delete_rule(node, name) {\n const previous = (node.style.animation || '').split(', ');\n const next = previous.filter(name\n ? anim => anim.indexOf(name) < 0 // remove specific animation\n : anim => anim.indexOf('__svelte') === -1 // remove all Svelte animations\n );\n const deleted = previous.length - next.length;\n if (deleted) {\n node.style.animation = next.join(', ');\n active -= deleted;\n if (!active)\n clear_rules();\n }\n}\nfunction clear_rules() {\n raf(() => {\n if (active)\n return;\n managed_styles.forEach(info => {\n const { ownerNode } = info.stylesheet;\n // there is no ownerNode if it runs on jsdom.\n if (ownerNode)\n detach(ownerNode);\n });\n managed_styles.clear();\n });\n}\n\nfunction create_animation(node, from, fn, params) {\n if (!from)\n return noop;\n const to = node.getBoundingClientRect();\n if (from.left === to.left && from.right === to.right && from.top === to.top && from.bottom === to.bottom)\n return noop;\n const { delay = 0, duration = 300, easing = identity, \n // @ts-ignore todo: should this be separated from destructuring? Or start/end added to public api and documentation?\n start: start_time = now() + delay, \n // @ts-ignore todo:\n end = start_time + duration, tick = noop, css } = fn(node, { from, to }, params);\n let running = true;\n let started = false;\n let name;\n function start() {\n if (css) {\n name = create_rule(node, 0, 1, duration, delay, easing, css);\n }\n if (!delay) {\n started = true;\n }\n }\n function stop() {\n if (css)\n delete_rule(node, name);\n running = false;\n }\n loop(now => {\n if (!started && now >= start_time) {\n started = true;\n }\n if (started && now >= end) {\n tick(1, 0);\n stop();\n }\n if (!running) {\n return false;\n }\n if (started) {\n const p = now - start_time;\n const t = 0 + 1 * easing(p / duration);\n tick(t, 1 - t);\n }\n return true;\n });\n start();\n tick(0, 1);\n return stop;\n}\nfunction fix_position(node) {\n const style = getComputedStyle(node);\n if (style.position !== 'absolute' && style.position !== 'fixed') {\n const { width, height } = style;\n const a = node.getBoundingClientRect();\n node.style.position = 'absolute';\n node.style.width = width;\n node.style.height = height;\n add_transform(node, a);\n }\n}\nfunction add_transform(node, a) {\n const b = node.getBoundingClientRect();\n if (a.left !== b.left || a.top !== b.top) {\n const style = getComputedStyle(node);\n const transform = style.transform === 'none' ? '' : style.transform;\n node.style.transform = `${transform} translate(${a.left - b.left}px, ${a.top - b.top}px)`;\n }\n}\n\nlet current_component;\nfunction set_current_component(component) {\n current_component = component;\n}\nfunction get_current_component() {\n if (!current_component)\n throw new Error('Function called outside component initialization');\n return current_component;\n}\n/**\n * Schedules a callback to run immediately before the component is updated after any state change.\n *\n * The first time the callback runs will be before the initial `onMount`\n *\n * https://svelte.dev/docs#run-time-svelte-beforeupdate\n */\nfunction beforeUpdate(fn) {\n get_current_component().$$.before_update.push(fn);\n}\n/**\n * The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.\n * It must be called during the component's initialisation (but doesn't need to live *inside* the component;\n * it can be called from an external module).\n *\n * `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api).\n *\n * https://svelte.dev/docs#run-time-svelte-onmount\n */\nfunction onMount(fn) {\n get_current_component().$$.on_mount.push(fn);\n}\n/**\n * Schedules a callback to run immediately after the component has been updated.\n *\n * The first time the callback runs will be after the initial `onMount`\n */\nfunction afterUpdate(fn) {\n get_current_component().$$.after_update.push(fn);\n}\n/**\n * Schedules a callback to run immediately before the component is unmounted.\n *\n * Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the\n * only one that runs inside a server-side component.\n *\n * https://svelte.dev/docs#run-time-svelte-ondestroy\n */\nfunction onDestroy(fn) {\n get_current_component().$$.on_destroy.push(fn);\n}\n/**\n * Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname).\n * Event dispatchers are functions that can take two arguments: `name` and `detail`.\n *\n * Component events created with `createEventDispatcher` create a\n * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).\n * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).\n * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)\n * property and can contain any type of data.\n *\n * https://svelte.dev/docs#run-time-svelte-createeventdispatcher\n */\nfunction createEventDispatcher() {\n const component = get_current_component();\n return (type, detail, { cancelable = false } = {}) => {\n const callbacks = component.$$.callbacks[type];\n if (callbacks) {\n // TODO are there situations where events could be dispatched\n // in a server (non-DOM) environment?\n const event = custom_event(type, detail, { cancelable });\n callbacks.slice().forEach(fn => {\n fn.call(component, event);\n });\n return !event.defaultPrevented;\n }\n return true;\n };\n}\n/**\n * Associates an arbitrary `context` object with the current component and the specified `key`\n * and returns that object. The context is then available to children of the component\n * (including slotted content) with `getContext`.\n *\n * Like lifecycle functions, this must be called during component initialisation.\n *\n * https://svelte.dev/docs#run-time-svelte-setcontext\n */\nfunction setContext(key, context) {\n get_current_component().$$.context.set(key, context);\n return context;\n}\n/**\n * Retrieves the context that belongs to the closest parent component with the specified `key`.\n * Must be called during component initialisation.\n *\n * https://svelte.dev/docs#run-time-svelte-getcontext\n */\nfunction getContext(key) {\n return get_current_component().$$.context.get(key);\n}\n/**\n * Retrieves the whole context map that belongs to the closest parent component.\n * Must be called during component initialisation. Useful, for example, if you\n * programmatically create a component and want to pass the existing context to it.\n *\n * https://svelte.dev/docs#run-time-svelte-getallcontexts\n */\nfunction getAllContexts() {\n return get_current_component().$$.context;\n}\n/**\n * Checks whether a given `key` has been set in the context of a parent component.\n * Must be called during component initialisation.\n *\n * https://svelte.dev/docs#run-time-svelte-hascontext\n */\nfunction hasContext(key) {\n return get_current_component().$$.context.has(key);\n}\n// TODO figure out if we still want to support\n// shorthand events, or if we want to implement\n// a real bubbling mechanism\nfunction bubble(component, event) {\n const callbacks = component.$$.callbacks[event.type];\n if (callbacks) {\n // @ts-ignore\n callbacks.slice().forEach(fn => fn.call(this, event));\n }\n}\n\nconst dirty_components = [];\nconst intros = { enabled: false };\nconst binding_callbacks = [];\nconst render_callbacks = [];\nconst flush_callbacks = [];\nconst resolved_promise = Promise.resolve();\nlet update_scheduled = false;\nfunction schedule_update() {\n if (!update_scheduled) {\n update_scheduled = true;\n resolved_promise.then(flush);\n }\n}\nfunction tick() {\n schedule_update();\n return resolved_promise;\n}\nfunction add_render_callback(fn) {\n render_callbacks.push(fn);\n}\nfunction add_flush_callback(fn) {\n flush_callbacks.push(fn);\n}\n// flush() calls callbacks in this order:\n// 1. All beforeUpdate callbacks, in order: parents before children\n// 2. All bind:this callbacks, in reverse order: children before parents.\n// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT\n// for afterUpdates called during the initial onMount, which are called in\n// reverse order: children before parents.\n// Since callbacks might update component values, which could trigger another\n// call to flush(), the following steps guard against this:\n// 1. During beforeUpdate, any updated components will be added to the\n// dirty_components array and will cause a reentrant call to flush(). Because\n// the flush index is kept outside the function, the reentrant call will pick\n// up where the earlier call left off and go through all dirty components. The\n// current_component value is saved and restored so that the reentrant call will\n// not interfere with the \"parent\" flush() call.\n// 2. bind:this callbacks cannot trigger new flush() calls.\n// 3. During afterUpdate, any updated components will NOT have their afterUpdate\n// callback called a second time; the seen_callbacks set, outside the flush()\n// function, guarantees this behavior.\nconst seen_callbacks = new Set();\nlet flushidx = 0; // Do *not* move this inside the flush() function\nfunction flush() {\n // Do not reenter flush while dirty components are updated, as this can\n // result in an infinite loop. Instead, let the inner flush handle it.\n // Reentrancy is ok afterwards for bindings etc.\n if (flushidx !== 0) {\n return;\n }\n const saved_component = current_component;\n do {\n // first, call beforeUpdate functions\n // and update components\n try {\n while (flushidx < dirty_components.length) {\n const component = dirty_components[flushidx];\n flushidx++;\n set_current_component(component);\n update(component.$$);\n }\n }\n catch (e) {\n // reset dirty state to not end up in a deadlocked state and then rethrow\n dirty_components.length = 0;\n flushidx = 0;\n throw e;\n }\n set_current_component(null);\n dirty_components.length = 0;\n flushidx = 0;\n while (binding_callbacks.length)\n binding_callbacks.pop()();\n // then, once components are updated, call\n // afterUpdate functions. This may cause\n // subsequent updates...\n for (let i = 0; i < render_callbacks.length; i += 1) {\n const callback = render_callbacks[i];\n if (!seen_callbacks.has(callback)) {\n // ...so guard against infinite loops\n seen_callbacks.add(callback);\n callback();\n }\n }\n render_callbacks.length = 0;\n } while (dirty_components.length);\n while (flush_callbacks.length) {\n flush_callbacks.pop()();\n }\n update_scheduled = false;\n seen_callbacks.clear();\n set_current_component(saved_component);\n}\nfunction update($$) {\n if ($$.fragment !== null) {\n $$.update();\n run_all($$.before_update);\n const dirty = $$.dirty;\n $$.dirty = [-1];\n $$.fragment && $$.fragment.p($$.ctx, dirty);\n $$.after_update.forEach(add_render_callback);\n }\n}\n\nlet promise;\nfunction wait() {\n if (!promise) {\n promise = Promise.resolve();\n promise.then(() => {\n promise = null;\n });\n }\n return promise;\n}\nfunction dispatch(node, direction, kind) {\n node.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`));\n}\nconst outroing = new Set();\nlet outros;\nfunction group_outros() {\n outros = {\n r: 0,\n c: [],\n p: outros // parent group\n };\n}\nfunction check_outros() {\n if (!outros.r) {\n run_all(outros.c);\n }\n outros = outros.p;\n}\nfunction transition_in(block, local) {\n if (block && block.i) {\n outroing.delete(block);\n block.i(local);\n }\n}\nfunction transition_out(block, local, detach, callback) {\n if (block && block.o) {\n if (outroing.has(block))\n return;\n outroing.add(block);\n outros.c.push(() => {\n outroing.delete(block);\n if (callback) {\n if (detach)\n block.d(1);\n callback();\n }\n });\n block.o(local);\n }\n else if (callback) {\n callback();\n }\n}\nconst null_transition = { duration: 0 };\nfunction create_in_transition(node, fn, params) {\n const options = { direction: 'in' };\n let config = fn(node, params, options);\n let running = false;\n let animation_name;\n let task;\n let uid = 0;\n function cleanup() {\n if (animation_name)\n delete_rule(node, animation_name);\n }\n function go() {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n if (css)\n animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++);\n tick(0, 1);\n const start_time = now() + delay;\n const end_time = start_time + duration;\n if (task)\n task.abort();\n running = true;\n add_render_callback(() => dispatch(node, true, 'start'));\n task = loop(now => {\n if (running) {\n if (now >= end_time) {\n tick(1, 0);\n dispatch(node, true, 'end');\n cleanup();\n return running = false;\n }\n if (now >= start_time) {\n const t = easing((now - start_time) / duration);\n tick(t, 1 - t);\n }\n }\n return running;\n });\n }\n let started = false;\n return {\n start() {\n if (started)\n return;\n started = true;\n delete_rule(node);\n if (is_function(config)) {\n config = config(options);\n wait().then(go);\n }\n else {\n go();\n }\n },\n invalidate() {\n started = false;\n },\n end() {\n if (running) {\n cleanup();\n running = false;\n }\n }\n };\n}\nfunction create_out_transition(node, fn, params) {\n const options = { direction: 'out' };\n let config = fn(node, params, options);\n let running = true;\n let animation_name;\n const group = outros;\n group.r += 1;\n function go() {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n if (css)\n animation_name = create_rule(node, 1, 0, duration, delay, easing, css);\n const start_time = now() + delay;\n const end_time = start_time + duration;\n add_render_callback(() => dispatch(node, false, 'start'));\n loop(now => {\n if (running) {\n if (now >= end_time) {\n tick(0, 1);\n dispatch(node, false, 'end');\n if (!--group.r) {\n // this will result in `end()` being called,\n // so we don't need to clean up here\n run_all(group.c);\n }\n return false;\n }\n if (now >= start_time) {\n const t = easing((now - start_time) / duration);\n tick(1 - t, t);\n }\n }\n return running;\n });\n }\n if (is_function(config)) {\n wait().then(() => {\n // @ts-ignore\n config = config(options);\n go();\n });\n }\n else {\n go();\n }\n return {\n end(reset) {\n if (reset && config.tick) {\n config.tick(1, 0);\n }\n if (running) {\n if (animation_name)\n delete_rule(node, animation_name);\n running = false;\n }\n }\n };\n}\nfunction create_bidirectional_transition(node, fn, params, intro) {\n const options = { direction: 'both' };\n let config = fn(node, params, options);\n let t = intro ? 0 : 1;\n let running_program = null;\n let pending_program = null;\n let animation_name = null;\n function clear_animation() {\n if (animation_name)\n delete_rule(node, animation_name);\n }\n function init(program, duration) {\n const d = (program.b - t);\n duration *= Math.abs(d);\n return {\n a: t,\n b: program.b,\n d,\n duration,\n start: program.start,\n end: program.start + duration,\n group: program.group\n };\n }\n function go(b) {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n const program = {\n start: now() + delay,\n b\n };\n if (!b) {\n // @ts-ignore todo: improve typings\n program.group = outros;\n outros.r += 1;\n }\n if (running_program || pending_program) {\n pending_program = program;\n }\n else {\n // if this is an intro, and there's a delay, we need to do\n // an initial tick and/or apply CSS animation immediately\n if (css) {\n clear_animation();\n animation_name = create_rule(node, t, b, duration, delay, easing, css);\n }\n if (b)\n tick(0, 1);\n running_program = init(program, duration);\n add_render_callback(() => dispatch(node, b, 'start'));\n loop(now => {\n if (pending_program && now > pending_program.start) {\n running_program = init(pending_program, duration);\n pending_program = null;\n dispatch(node, running_program.b, 'start');\n if (css) {\n clear_animation();\n animation_name = create_rule(node, t, running_program.b, running_program.duration, 0, easing, config.css);\n }\n }\n if (running_program) {\n if (now >= running_program.end) {\n tick(t = running_program.b, 1 - t);\n dispatch(node, running_program.b, 'end');\n if (!pending_program) {\n // we're done\n if (running_program.b) {\n // intro — we can tidy up immediately\n clear_animation();\n }\n else {\n // outro — needs to be coordinated\n if (!--running_program.group.r)\n run_all(running_program.group.c);\n }\n }\n running_program = null;\n }\n else if (now >= running_program.start) {\n const p = now - running_program.start;\n t = running_program.a + running_program.d * easing(p / running_program.duration);\n tick(t, 1 - t);\n }\n }\n return !!(running_program || pending_program);\n });\n }\n }\n return {\n run(b) {\n if (is_function(config)) {\n wait().then(() => {\n // @ts-ignore\n config = config(options);\n go(b);\n });\n }\n else {\n go(b);\n }\n },\n end() {\n clear_animation();\n running_program = pending_program = null;\n }\n };\n}\n\nfunction handle_promise(promise, info) {\n const token = info.token = {};\n function update(type, index, key, value) {\n if (info.token !== token)\n return;\n info.resolved = value;\n let child_ctx = info.ctx;\n if (key !== undefined) {\n child_ctx = child_ctx.slice();\n child_ctx[key] = value;\n }\n const block = type && (info.current = type)(child_ctx);\n let needs_flush = false;\n if (info.block) {\n if (info.blocks) {\n info.blocks.forEach((block, i) => {\n if (i !== index && block) {\n group_outros();\n transition_out(block, 1, 1, () => {\n if (info.blocks[i] === block) {\n info.blocks[i] = null;\n }\n });\n check_outros();\n }\n });\n }\n else {\n info.block.d(1);\n }\n block.c();\n transition_in(block, 1);\n block.m(info.mount(), info.anchor);\n needs_flush = true;\n }\n info.block = block;\n if (info.blocks)\n info.blocks[index] = block;\n if (needs_flush) {\n flush();\n }\n }\n if (is_promise(promise)) {\n const current_component = get_current_component();\n promise.then(value => {\n set_current_component(current_component);\n update(info.then, 1, info.value, value);\n set_current_component(null);\n }, error => {\n set_current_component(current_component);\n update(info.catch, 2, info.error, error);\n set_current_component(null);\n if (!info.hasCatch) {\n throw error;\n }\n });\n // if we previously had a then/catch block, destroy it\n if (info.current !== info.pending) {\n update(info.pending, 0);\n return true;\n }\n }\n else {\n if (info.current !== info.then) {\n update(info.then, 1, info.value, promise);\n return true;\n }\n info.resolved = promise;\n }\n}\nfunction update_await_block_branch(info, ctx, dirty) {\n const child_ctx = ctx.slice();\n const { resolved } = info;\n if (info.current === info.then) {\n child_ctx[info.value] = resolved;\n }\n if (info.current === info.catch) {\n child_ctx[info.error] = resolved;\n }\n info.block.p(child_ctx, dirty);\n}\n\nconst globals = (typeof window !== 'undefined'\n ? window\n : typeof globalThis !== 'undefined'\n ? globalThis\n : global);\n\nfunction destroy_block(block, lookup) {\n block.d(1);\n lookup.delete(block.key);\n}\nfunction outro_and_destroy_block(block, lookup) {\n transition_out(block, 1, 1, () => {\n lookup.delete(block.key);\n });\n}\nfunction fix_and_destroy_block(block, lookup) {\n block.f();\n destroy_block(block, lookup);\n}\nfunction fix_and_outro_and_destroy_block(block, lookup) {\n block.f();\n outro_and_destroy_block(block, lookup);\n}\nfunction update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) {\n let o = old_blocks.length;\n let n = list.length;\n let i = o;\n const old_indexes = {};\n while (i--)\n old_indexes[old_blocks[i].key] = i;\n const new_blocks = [];\n const new_lookup = new Map();\n const deltas = new Map();\n i = n;\n while (i--) {\n const child_ctx = get_context(ctx, list, i);\n const key = get_key(child_ctx);\n let block = lookup.get(key);\n if (!block) {\n block = create_each_block(key, child_ctx);\n block.c();\n }\n else if (dynamic) {\n block.p(child_ctx, dirty);\n }\n new_lookup.set(key, new_blocks[i] = block);\n if (key in old_indexes)\n deltas.set(key, Math.abs(i - old_indexes[key]));\n }\n const will_move = new Set();\n const did_move = new Set();\n function insert(block) {\n transition_in(block, 1);\n block.m(node, next);\n lookup.set(block.key, block);\n next = block.first;\n n--;\n }\n while (o && n) {\n const new_block = new_blocks[n - 1];\n const old_block = old_blocks[o - 1];\n const new_key = new_block.key;\n const old_key = old_block.key;\n if (new_block === old_block) {\n // do nothing\n next = new_block.first;\n o--;\n n--;\n }\n else if (!new_lookup.has(old_key)) {\n // remove old block\n destroy(old_block, lookup);\n o--;\n }\n else if (!lookup.has(new_key) || will_move.has(new_key)) {\n insert(new_block);\n }\n else if (did_move.has(old_key)) {\n o--;\n }\n else if (deltas.get(new_key) > deltas.get(old_key)) {\n did_move.add(new_key);\n insert(new_block);\n }\n else {\n will_move.add(old_key);\n o--;\n }\n }\n while (o--) {\n const old_block = old_blocks[o];\n if (!new_lookup.has(old_block.key))\n destroy(old_block, lookup);\n }\n while (n)\n insert(new_blocks[n - 1]);\n return new_blocks;\n}\nfunction validate_each_keys(ctx, list, get_context, get_key) {\n const keys = new Set();\n for (let i = 0; i < list.length; i++) {\n const key = get_key(get_context(ctx, list, i));\n if (keys.has(key)) {\n throw new Error('Cannot have duplicate keys in a keyed each');\n }\n keys.add(key);\n }\n}\n\nfunction get_spread_update(levels, updates) {\n const update = {};\n const to_null_out = {};\n const accounted_for = { $$scope: 1 };\n let i = levels.length;\n while (i--) {\n const o = levels[i];\n const n = updates[i];\n if (n) {\n for (const key in o) {\n if (!(key in n))\n to_null_out[key] = 1;\n }\n for (const key in n) {\n if (!accounted_for[key]) {\n update[key] = n[key];\n accounted_for[key] = 1;\n }\n }\n levels[i] = n;\n }\n else {\n for (const key in o) {\n accounted_for[key] = 1;\n }\n }\n }\n for (const key in to_null_out) {\n if (!(key in update))\n update[key] = undefined;\n }\n return update;\n}\nfunction get_spread_object(spread_props) {\n return typeof spread_props === 'object' && spread_props !== null ? spread_props : {};\n}\n\n// source: https://html.spec.whatwg.org/multipage/indices.html\nconst boolean_attributes = new Set([\n 'allowfullscreen',\n 'allowpaymentrequest',\n 'async',\n 'autofocus',\n 'autoplay',\n 'checked',\n 'controls',\n 'default',\n 'defer',\n 'disabled',\n 'formnovalidate',\n 'hidden',\n 'inert',\n 'ismap',\n 'itemscope',\n 'loop',\n 'multiple',\n 'muted',\n 'nomodule',\n 'novalidate',\n 'open',\n 'playsinline',\n 'readonly',\n 'required',\n 'reversed',\n 'selected'\n]);\n\n/** regex of all html void element names */\nconst void_element_names = /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;\nfunction is_void(name) {\n return void_element_names.test(name) || name.toLowerCase() === '!doctype';\n}\n\nconst invalid_attribute_name_character = /[\\s'\">/=\\u{FDD0}-\\u{FDEF}\\u{FFFE}\\u{FFFF}\\u{1FFFE}\\u{1FFFF}\\u{2FFFE}\\u{2FFFF}\\u{3FFFE}\\u{3FFFF}\\u{4FFFE}\\u{4FFFF}\\u{5FFFE}\\u{5FFFF}\\u{6FFFE}\\u{6FFFF}\\u{7FFFE}\\u{7FFFF}\\u{8FFFE}\\u{8FFFF}\\u{9FFFE}\\u{9FFFF}\\u{AFFFE}\\u{AFFFF}\\u{BFFFE}\\u{BFFFF}\\u{CFFFE}\\u{CFFFF}\\u{DFFFE}\\u{DFFFF}\\u{EFFFE}\\u{EFFFF}\\u{FFFFE}\\u{FFFFF}\\u{10FFFE}\\u{10FFFF}]/u;\n// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n// https://infra.spec.whatwg.org/#noncharacter\nfunction spread(args, attrs_to_add) {\n const attributes = Object.assign({}, ...args);\n if (attrs_to_add) {\n const classes_to_add = attrs_to_add.classes;\n const styles_to_add = attrs_to_add.styles;\n if (classes_to_add) {\n if (attributes.class == null) {\n attributes.class = classes_to_add;\n }\n else {\n attributes.class += ' ' + classes_to_add;\n }\n }\n if (styles_to_add) {\n if (attributes.style == null) {\n attributes.style = style_object_to_string(styles_to_add);\n }\n else {\n attributes.style = style_object_to_string(merge_ssr_styles(attributes.style, styles_to_add));\n }\n }\n }\n let str = '';\n Object.keys(attributes).forEach(name => {\n if (invalid_attribute_name_character.test(name))\n return;\n const value = attributes[name];\n if (value === true)\n str += ' ' + name;\n else if (boolean_attributes.has(name.toLowerCase())) {\n if (value)\n str += ' ' + name;\n }\n else if (value != null) {\n str += ` ${name}=\"${value}\"`;\n }\n });\n return str;\n}\nfunction merge_ssr_styles(style_attribute, style_directive) {\n const style_object = {};\n for (const individual_style of style_attribute.split(';')) {\n const colon_index = individual_style.indexOf(':');\n const name = individual_style.slice(0, colon_index).trim();\n const value = individual_style.slice(colon_index + 1).trim();\n if (!name)\n continue;\n style_object[name] = value;\n }\n for (const name in style_directive) {\n const value = style_directive[name];\n if (value) {\n style_object[name] = value;\n }\n else {\n delete style_object[name];\n }\n }\n return style_object;\n}\nconst ATTR_REGEX = /[&\"]/g;\nconst CONTENT_REGEX = /[&<]/g;\n/**\n * Note: this method is performance sensitive and has been optimized\n * https://github.com/sveltejs/svelte/pull/5701\n */\nfunction escape(value, is_attr = false) {\n const str = String(value);\n const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;\n pattern.lastIndex = 0;\n let escaped = '';\n let last = 0;\n while (pattern.test(str)) {\n const i = pattern.lastIndex - 1;\n const ch = str[i];\n escaped += str.substring(last, i) + (ch === '&' ? '&' : (ch === '\"' ? '"' : '<'));\n last = i + 1;\n }\n return escaped + str.substring(last);\n}\nfunction escape_attribute_value(value) {\n // keep booleans, null, and undefined for the sake of `spread`\n const should_escape = typeof value === 'string' || (value && typeof value === 'object');\n return should_escape ? escape(value, true) : value;\n}\nfunction escape_object(obj) {\n const result = {};\n for (const key in obj) {\n result[key] = escape_attribute_value(obj[key]);\n }\n return result;\n}\nfunction each(items, fn) {\n let str = '';\n for (let i = 0; i < items.length; i += 1) {\n str += fn(items[i], i);\n }\n return str;\n}\nconst missing_component = {\n $$render: () => ''\n};\nfunction validate_component(component, name) {\n if (!component || !component.$$render) {\n if (name === 'svelte:component')\n name += ' this={...}';\n throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${name}>.`);\n }\n return component;\n}\nfunction debug(file, line, column, values) {\n console.log(`{@debug} ${file ? file + ' ' : ''}(${line}:${column})`); // eslint-disable-line no-console\n console.log(values); // eslint-disable-line no-console\n return '';\n}\nlet on_destroy;\nfunction create_ssr_component(fn) {\n function $$render(result, props, bindings, slots, context) {\n const parent_component = current_component;\n const $$ = {\n on_destroy,\n context: new Map(context || (parent_component ? parent_component.$$.context : [])),\n // these will be immediately discarded\n on_mount: [],\n before_update: [],\n after_update: [],\n callbacks: blank_object()\n };\n set_current_component({ $$ });\n const html = fn(result, props, bindings, slots);\n set_current_component(parent_component);\n return html;\n }\n return {\n render: (props = {}, { $$slots = {}, context = new Map() } = {}) => {\n on_destroy = [];\n const result = { title: '', head: '', css: new Set() };\n const html = $$render(result, props, {}, $$slots, context);\n run_all(on_destroy);\n return {\n html,\n css: {\n code: Array.from(result.css).map(css => css.code).join('\\n'),\n map: null // TODO\n },\n head: result.title + result.head\n };\n },\n $$render\n };\n}\nfunction add_attribute(name, value, boolean) {\n if (value == null || (boolean && !value))\n return '';\n const assignment = (boolean && value === true) ? '' : `=\"${escape(value, true)}\"`;\n return ` ${name}${assignment}`;\n}\nfunction add_classes(classes) {\n return classes ? ` class=\"${classes}\"` : '';\n}\nfunction style_object_to_string(style_object) {\n return Object.keys(style_object)\n .filter(key => style_object[key])\n .map(key => `${key}: ${escape_attribute_value(style_object[key])};`)\n .join(' ');\n}\nfunction add_styles(style_object) {\n const styles = style_object_to_string(style_object);\n return styles ? ` style=\"${styles}\"` : '';\n}\n\nfunction bind(component, name, callback) {\n const index = component.$$.props[name];\n if (index !== undefined) {\n component.$$.bound[index] = callback;\n callback(component.$$.ctx[index]);\n }\n}\nfunction create_component(block) {\n block && block.c();\n}\nfunction claim_component(block, parent_nodes) {\n block && block.l(parent_nodes);\n}\nfunction mount_component(component, target, anchor, customElement) {\n const { fragment, after_update } = component.$$;\n fragment && fragment.m(target, anchor);\n if (!customElement) {\n // onMount happens before the initial afterUpdate\n add_render_callback(() => {\n const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);\n // if the component was destroyed immediately\n // it will update the `$$.on_destroy` reference to `null`.\n // the destructured on_destroy may still reference to the old array\n if (component.$$.on_destroy) {\n component.$$.on_destroy.push(...new_on_destroy);\n }\n else {\n // Edge case - component was destroyed immediately,\n // most likely as a result of a binding initialising\n run_all(new_on_destroy);\n }\n component.$$.on_mount = [];\n });\n }\n after_update.forEach(add_render_callback);\n}\nfunction destroy_component(component, detaching) {\n const $$ = component.$$;\n if ($$.fragment !== null) {\n run_all($$.on_destroy);\n $$.fragment && $$.fragment.d(detaching);\n // TODO null out other refs, including component.$$ (but need to\n // preserve final state?)\n $$.on_destroy = $$.fragment = null;\n $$.ctx = [];\n }\n}\nfunction make_dirty(component, i) {\n if (component.$$.dirty[0] === -1) {\n dirty_components.push(component);\n schedule_update();\n component.$$.dirty.fill(0);\n }\n component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));\n}\nfunction init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {\n const parent_component = current_component;\n set_current_component(component);\n const $$ = component.$$ = {\n fragment: null,\n ctx: [],\n // state\n props,\n update: noop,\n not_equal,\n bound: blank_object(),\n // lifecycle\n on_mount: [],\n on_destroy: [],\n on_disconnect: [],\n before_update: [],\n after_update: [],\n context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),\n // everything else\n callbacks: blank_object(),\n dirty,\n skip_bound: false,\n root: options.target || parent_component.$$.root\n };\n append_styles && append_styles($$.root);\n let ready = false;\n $$.ctx = instance\n ? instance(component, options.props || {}, (i, ret, ...rest) => {\n const value = rest.length ? rest[0] : ret;\n if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {\n if (!$$.skip_bound && $$.bound[i])\n $$.bound[i](value);\n if (ready)\n make_dirty(component, i);\n }\n return ret;\n })\n : [];\n $$.update();\n ready = true;\n run_all($$.before_update);\n // `false` as a special case of no DOM component\n $$.fragment = create_fragment ? create_fragment($$.ctx) : false;\n if (options.target) {\n if (options.hydrate) {\n start_hydrating();\n const nodes = children(options.target);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n $$.fragment && $$.fragment.l(nodes);\n nodes.forEach(detach);\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n $$.fragment && $$.fragment.c();\n }\n if (options.intro)\n transition_in(component.$$.fragment);\n mount_component(component, options.target, options.anchor, options.customElement);\n end_hydrating();\n flush();\n }\n set_current_component(parent_component);\n}\nlet SvelteElement;\nif (typeof HTMLElement === 'function') {\n SvelteElement = class extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n }\n connectedCallback() {\n const { on_mount } = this.$$;\n this.$$.on_disconnect = on_mount.map(run).filter(is_function);\n // @ts-ignore todo: improve typings\n for (const key in this.$$.slotted) {\n // @ts-ignore todo: improve typings\n this.appendChild(this.$$.slotted[key]);\n }\n }\n attributeChangedCallback(attr, _oldValue, newValue) {\n this[attr] = newValue;\n }\n disconnectedCallback() {\n run_all(this.$$.on_disconnect);\n }\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n // TODO should this delegate to addEventListener?\n if (!is_function(callback)) {\n return noop;\n }\n const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n };\n}\n/**\n * Base class for Svelte components. Used when dev=false.\n */\nclass SvelteComponent {\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n if (!is_function(callback)) {\n return noop;\n }\n const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n}\n\nfunction dispatch_dev(type, detail) {\n document.dispatchEvent(custom_event(type, Object.assign({ version: '3.55.1' }, detail), { bubbles: true }));\n}\nfunction append_dev(target, node) {\n dispatch_dev('SvelteDOMInsert', { target, node });\n append(target, node);\n}\nfunction append_hydration_dev(target, node) {\n dispatch_dev('SvelteDOMInsert', { target, node });\n append_hydration(target, node);\n}\nfunction insert_dev(target, node, anchor) {\n dispatch_dev('SvelteDOMInsert', { target, node, anchor });\n insert(target, node, anchor);\n}\nfunction insert_hydration_dev(target, node, anchor) {\n dispatch_dev('SvelteDOMInsert', { target, node, anchor });\n insert_hydration(target, node, anchor);\n}\nfunction detach_dev(node) {\n dispatch_dev('SvelteDOMRemove', { node });\n detach(node);\n}\nfunction detach_between_dev(before, after) {\n while (before.nextSibling && before.nextSibling !== after) {\n detach_dev(before.nextSibling);\n }\n}\nfunction detach_before_dev(after) {\n while (after.previousSibling) {\n detach_dev(after.previousSibling);\n }\n}\nfunction detach_after_dev(before) {\n while (before.nextSibling) {\n detach_dev(before.nextSibling);\n }\n}\nfunction listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) {\n const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];\n if (has_prevent_default)\n modifiers.push('preventDefault');\n if (has_stop_propagation)\n modifiers.push('stopPropagation');\n dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });\n const dispose = listen(node, event, handler, options);\n return () => {\n dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });\n dispose();\n };\n}\nfunction attr_dev(node, attribute, value) {\n attr(node, attribute, value);\n if (value == null)\n dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });\n else\n dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });\n}\nfunction prop_dev(node, property, value) {\n node[property] = value;\n dispatch_dev('SvelteDOMSetProperty', { node, property, value });\n}\nfunction dataset_dev(node, property, value) {\n node.dataset[property] = value;\n dispatch_dev('SvelteDOMSetDataset', { node, property, value });\n}\nfunction set_data_dev(text, data) {\n data = '' + data;\n if (text.wholeText === data)\n return;\n dispatch_dev('SvelteDOMSetData', { node: text, data });\n text.data = data;\n}\nfunction validate_each_argument(arg) {\n if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {\n let msg = '{#each} only iterates over array-like objects.';\n if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {\n msg += ' You can use a spread to convert this iterable into an array.';\n }\n throw new Error(msg);\n }\n}\nfunction validate_slots(name, slot, keys) {\n for (const slot_key of Object.keys(slot)) {\n if (!~keys.indexOf(slot_key)) {\n console.warn(`<${name}> received an unexpected slot \"${slot_key}\".`);\n }\n }\n}\nfunction validate_dynamic_element(tag) {\n const is_string = typeof tag === 'string';\n if (tag && !is_string) {\n throw new Error(' expects \"this\" attribute to be a string.');\n }\n}\nfunction validate_void_dynamic_element(tag) {\n if (tag && is_void(tag)) {\n console.warn(` is self-closing and cannot have content.`);\n }\n}\nfunction construct_svelte_component_dev(component, props) {\n const error_message = 'this={...} of should specify a Svelte component.';\n try {\n const instance = new component(props);\n if (!instance.$$ || !instance.$set || !instance.$on || !instance.$destroy) {\n throw new Error(error_message);\n }\n return instance;\n }\n catch (err) {\n const { message } = err;\n if (typeof message === 'string' && message.indexOf('is not a constructor') !== -1) {\n throw new Error(error_message);\n }\n else {\n throw err;\n }\n }\n}\n/**\n * Base class for Svelte components with some minor dev-enhancements. Used when dev=true.\n */\nclass SvelteComponentDev extends SvelteComponent {\n constructor(options) {\n if (!options || (!options.target && !options.$$inline)) {\n throw new Error(\"'target' is a required option\");\n }\n super();\n }\n $destroy() {\n super.$destroy();\n this.$destroy = () => {\n console.warn('Component was already destroyed'); // eslint-disable-line no-console\n };\n }\n $capture_state() { }\n $inject_state() { }\n}\n/**\n * Base class to create strongly typed Svelte components.\n * This only exists for typing purposes and should be used in `.d.ts` files.\n *\n * ### Example:\n *\n * You have component library on npm called `component-library`, from which\n * you export a component called `MyComponent`. For Svelte+TypeScript users,\n * you want to provide typings. Therefore you create a `index.d.ts`:\n * ```ts\n * import { SvelteComponentTyped } from \"svelte\";\n * export class MyComponent extends SvelteComponentTyped<{foo: string}> {}\n * ```\n * Typing this makes it possible for IDEs like VS Code with the Svelte extension\n * to provide intellisense and to use the component like this in a Svelte file\n * with TypeScript:\n * ```svelte\n * \n * \n * ```\n *\n * #### Why not make this part of `SvelteComponent(Dev)`?\n * Because\n * ```ts\n * class ASubclassOfSvelteComponent extends SvelteComponent<{foo: string}> {}\n * const component: typeof SvelteComponent = ASubclassOfSvelteComponent;\n * ```\n * will throw a type error, so we need to separate the more strictly typed class.\n */\nclass SvelteComponentTyped extends SvelteComponentDev {\n constructor(options) {\n super(options);\n }\n}\nfunction loop_guard(timeout) {\n const start = Date.now();\n return () => {\n if (Date.now() - start > timeout) {\n throw new Error('Infinite loop detected');\n }\n };\n}\n\nexport { HtmlTag, HtmlTagHydration, SvelteComponent, SvelteComponentDev, SvelteComponentTyped, SvelteElement, action_destroyer, add_attribute, add_classes, add_flush_callback, add_location, add_render_callback, add_resize_listener, add_styles, add_transform, afterUpdate, append, append_dev, append_empty_stylesheet, append_hydration, append_hydration_dev, append_styles, assign, attr, attr_dev, attribute_to_object, beforeUpdate, bind, binding_callbacks, blank_object, bubble, check_outros, children, claim_component, claim_element, claim_html_tag, claim_space, claim_svg_element, claim_text, clear_loops, component_subscribe, compute_rest_props, compute_slots, construct_svelte_component, construct_svelte_component_dev, createEventDispatcher, create_animation, create_bidirectional_transition, create_component, create_in_transition, create_out_transition, create_slot, create_ssr_component, current_component, custom_event, dataset_dev, debug, destroy_block, destroy_component, destroy_each, detach, detach_after_dev, detach_before_dev, detach_between_dev, detach_dev, dirty_components, dispatch_dev, each, element, element_is, empty, end_hydrating, escape, escape_attribute_value, escape_object, exclude_internal_props, fix_and_destroy_block, fix_and_outro_and_destroy_block, fix_position, flush, getAllContexts, getContext, get_all_dirty_from_scope, get_binding_group_value, get_current_component, get_custom_elements_slots, get_root_for_style, get_slot_changes, get_spread_object, get_spread_update, get_store_value, globals, group_outros, handle_promise, hasContext, has_prop, head_selector, identity, init, insert, insert_dev, insert_hydration, insert_hydration_dev, intros, invalid_attribute_name_character, is_client, is_crossorigin, is_empty, is_function, is_promise, is_void, listen, listen_dev, loop, loop_guard, merge_ssr_styles, missing_component, mount_component, noop, not_equal, now, null_to_empty, object_without_properties, onDestroy, onMount, once, outro_and_destroy_block, prevent_default, prop_dev, query_selector_all, raf, run, run_all, safe_not_equal, schedule_update, select_multiple_value, select_option, select_options, select_value, self, setContext, set_attributes, set_current_component, set_custom_element_data, set_custom_element_data_map, set_data, set_data_dev, set_input_type, set_input_value, set_now, set_raf, set_store_value, set_style, set_svg_attributes, space, spread, src_url_equal, start_hydrating, stop_propagation, subscribe, svg_element, text, tick, time_ranges_to_array, to_number, toggle_class, transition_in, transition_out, trusted, update_await_block_branch, update_keyed_each, update_slot, update_slot_base, validate_component, validate_dynamic_element, validate_each_argument, validate_each_keys, validate_slots, validate_store, validate_void_dynamic_element, xlink_attr };\n","import { group_outros, transition_out, check_outros } from 'svelte/internal';\n\n/**\n * Provides common object manipulation utilities including depth traversal, obtaining accessors, safely setting values /\n * equality tests, and validation.\n */\n\nconst s_TAG_OBJECT = '[object Object]';\n\n/**\n * Recursively deep merges all source objects into the target object in place. Like `Object.assign` if you provide `{}`\n * as the target a copy is produced. If the target and source property are object literals they are merged.\n * Deleting keys is supported by specifying a property starting with `-=`.\n *\n * @param {object} target - Target object.\n *\n * @param {...object} sourceObj - One or more source objects.\n *\n * @returns {object} Target object.\n */\nfunction deepMerge(target = {}, ...sourceObj)\n{\n if (Object.prototype.toString.call(target) !== s_TAG_OBJECT)\n {\n throw new TypeError(`deepMerge error: 'target' is not an 'object'.`);\n }\n\n for (let cntr = 0; cntr < sourceObj.length; cntr++)\n {\n if (Object.prototype.toString.call(sourceObj[cntr]) !== s_TAG_OBJECT)\n {\n throw new TypeError(`deepMerge error: 'sourceObj[${cntr}]' is not an 'object'.`);\n }\n }\n\n return _deepMerge(target, ...sourceObj);\n}\n\n/**\n * Tests for whether an object is iterable.\n *\n * @param {*} value - Any value.\n *\n * @returns {boolean} Whether object is iterable.\n */\nfunction isIterable(value)\n{\n if (value === null || value === void 0 || typeof value !== 'object') { return false; }\n\n return typeof value[Symbol.iterator] === 'function';\n}\n\n/**\n * Tests for whether an object is async iterable.\n *\n * @param {*} value - Any value.\n *\n * @returns {boolean} Whether value is async iterable.\n */\nfunction isIterableAsync(value)\n{\n if (value === null || value === void 0 || typeof value !== 'object') { return false; }\n\n return typeof value[Symbol.asyncIterator] === 'function';\n}\n\n/**\n * Tests for whether object is not null and a typeof object.\n *\n * @param {*} value - Any value.\n *\n * @returns {boolean} Is it an object.\n */\nfunction isObject(value)\n{\n return value !== null && typeof value === 'object';\n}\n\n/**\n * Tests for whether the given value is a plain object.\n *\n * An object is plain if it is created by either: {}, new Object() or Object.create(null).\n *\n * @param {*} value - Any value\n *\n * @returns {boolean} Is it a plain object.\n */\nfunction isPlainObject(value)\n{\n if (Object.prototype.toString.call(value) !== s_TAG_OBJECT) { return false; }\n\n const prototype = Object.getPrototypeOf(value);\n return prototype === null || prototype === Object.prototype;\n}\n\n/**\n * Provides a way to safely access an objects data / entries given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * @param {object} data - An object to access entry data.\n *\n * @param {string} accessor - A string describing the entries to access.\n *\n * @param {*} defaultValue - (Optional) A default value to return if an entry for accessor is not found.\n *\n * @returns {object} The data object.\n */\nfunction safeAccess(data, accessor, defaultValue = void 0)\n{\n if (typeof data !== 'object') { return defaultValue; }\n if (typeof accessor !== 'string') { return defaultValue; }\n\n const access = accessor.split('.');\n\n // Walk through the given object by the accessor indexes.\n for (let cntr = 0; cntr < access.length; cntr++)\n {\n // If the next level of object access is undefined or null then return the empty string.\n if (typeof data[access[cntr]] === 'undefined' || data[access[cntr]] === null) { return defaultValue; }\n\n data = data[access[cntr]];\n }\n\n return data;\n}\n\n/**\n * Provides a way to safely set an objects data / entries given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * @param {object} data - An object to access entry data.\n *\n * @param {string} accessor - A string describing the entries to access.\n *\n * @param {*} value - A new value to set if an entry for accessor is found.\n *\n * @param {string} [operation='set'] - Operation to perform including: 'add', 'div', 'mult', 'set',\n * 'set-undefined', 'sub'.\n *\n * @param {boolean} [createMissing=true] - If true missing accessor entries will be created as objects\n * automatically.\n *\n * @returns {boolean} True if successful.\n */\nfunction safeSet(data, accessor, value, operation = 'set', createMissing = true)\n{\n if (typeof data !== 'object') { throw new TypeError(`safeSet Error: 'data' is not an 'object'.`); }\n if (typeof accessor !== 'string') { throw new TypeError(`safeSet Error: 'accessor' is not a 'string'.`); }\n\n const access = accessor.split('.');\n\n // Walk through the given object by the accessor indexes.\n for (let cntr = 0; cntr < access.length; cntr++)\n {\n // If data is an array perform validation that the accessor is a positive integer otherwise quit.\n if (Array.isArray(data))\n {\n const number = (+access[cntr]);\n\n if (!Number.isInteger(number) || number < 0) { return false; }\n }\n\n if (cntr === access.length - 1)\n {\n switch (operation)\n {\n case 'add':\n data[access[cntr]] += value;\n break;\n\n case 'div':\n data[access[cntr]] /= value;\n break;\n\n case 'mult':\n data[access[cntr]] *= value;\n break;\n\n case 'set':\n data[access[cntr]] = value;\n break;\n\n case 'set-undefined':\n if (typeof data[access[cntr]] === 'undefined') { data[access[cntr]] = value; }\n break;\n\n case 'sub':\n data[access[cntr]] -= value;\n break;\n }\n }\n else\n {\n // If createMissing is true and the next level of object access is undefined then create a new object entry.\n if (createMissing && typeof data[access[cntr]] === 'undefined') { data[access[cntr]] = {}; }\n\n // Abort if the next level is null or not an object and containing a value.\n if (data[access[cntr]] === null || typeof data[access[cntr]] !== 'object') { return false; }\n\n data = data[access[cntr]];\n }\n }\n\n return true;\n}\n\n/**\n * Internal implementation for `deepMerge`.\n *\n * @param {object} target - Target object.\n *\n * @param {...object} sourceObj - One or more source objects.\n *\n * @returns {object} Target object.\n */\nfunction _deepMerge(target = {}, ...sourceObj)\n{\n // Iterate and merge all source objects into target.\n for (let cntr = 0; cntr < sourceObj.length; cntr++)\n {\n const obj = sourceObj[cntr];\n\n for (const prop in obj)\n {\n if (Object.prototype.hasOwnProperty.call(obj, prop))\n {\n // Handle the special property starting with '-=' to delete keys.\n if (prop.startsWith('-='))\n {\n delete target[prop.slice(2)];\n continue;\n }\n\n // If target already has prop and both target[prop] and obj[prop] are object literals then merge them\n // otherwise assign obj[prop] to target[prop].\n target[prop] = Object.prototype.hasOwnProperty.call(target, prop) && target[prop]?.constructor === Object &&\n obj[prop]?.constructor === Object ? _deepMerge({}, target[prop], obj[prop]) : obj[prop];\n }\n }\n }\n\n return target;\n}\n\n/**\n * Provides several helpful utility methods for accessibility and keyboard navigation.\n */\nclass A11yHelper\n{\n /**\n * Apply focus to the HTMLElement targets in a given A11yFocusSource data object. An iterable list `options.focusEl`\n * can contain HTMLElements or selector strings. If multiple focus targets are provided in a list then the first\n * valid target found will be focused. If focus target is a string then a lookup via `document.querySelector` is\n * performed. In this case you should provide a unique selector for the desired focus target.\n *\n * Note: The body of this method is postponed to the next clock tick to allow any changes in the DOM to occur that\n * might alter focus targets before applying.\n *\n * @param {A11yFocusSource|{ focusSource: A11yFocusSource }} options - The focus options instance to apply.\n */\n static applyFocusSource(options)\n {\n if (!isObject(options)) { return; }\n\n // Handle the case of receiving an object with embedded `focusSource`.\n const focusOpts = isObject(options?.focusSource) ? options.focusSource : options;\n\n setTimeout(() =>\n {\n const debug = typeof focusOpts.debug === 'boolean' ? focusOpts.debug : false;\n\n if (isIterable(focusOpts.focusEl))\n {\n if (debug)\n {\n console.debug(`A11yHelper.applyFocusSource debug - Attempting to apply focus target: `, focusOpts.focusEl);\n }\n\n for (const target of focusOpts.focusEl)\n {\n if (target instanceof HTMLElement && target.isConnected)\n {\n target.focus();\n if (debug)\n {\n console.debug(`A11yHelper.applyFocusSource debug - Applied focus to target: `, target);\n }\n break;\n }\n else if (typeof target === 'string')\n {\n const element = document.querySelector(target);\n if (element instanceof HTMLElement && element.isConnected)\n {\n element.focus();\n if (debug)\n {\n console.debug(`A11yHelper.applyFocusSource debug - Applied focus to target: `, element);\n }\n break;\n }\n else if (debug)\n {\n console.debug(`A11yHelper.applyFocusSource debug - Could not query selector: `, target);\n }\n }\n }\n }\n else if (debug)\n {\n console.debug(`A11yHelper.applyFocusSource debug - No focus targets defined.`);\n }\n }, 0);\n }\n\n /**\n * Returns first focusable element within a specified element.\n *\n * @param {HTMLElement|Document} [element=document] - Optional element to start query.\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {Iterable} [options.ignoreClasses] - Iterable list of classes to ignore elements.\n *\n * @param {Set} [options.ignoreElements] - Set of elements to ignore.\n *\n * @returns {HTMLElement} First focusable child element\n */\n static getFirstFocusableElement(element = document, options)\n {\n const focusableElements = this.getFocusableElements(element, options);\n\n return focusableElements.length > 0 ? focusableElements[0] : void 0;\n }\n\n /**\n * Returns all focusable elements within a specified element.\n *\n * @param {HTMLElement|Document} [element=document] Optional element to start query.\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {boolean} [options.anchorHref=true] - When true anchors must have an HREF.\n *\n * @param {Iterable} [options.ignoreClasses] - Iterable list of classes to ignore elements.\n *\n * @param {Set} [options.ignoreElements] - Set of elements to ignore.\n *\n * @param {string} [options.selectors] - Custom list of focusable selectors for `querySelectorAll`.\n *\n * @returns {Array} Child keyboard focusable\n */\n static getFocusableElements(element = document, { anchorHref = true, ignoreClasses, ignoreElements, selectors } = {})\n {\n if (!(element instanceof HTMLElement) && !(element instanceof Document))\n {\n throw new TypeError(`'element' is not a HTMLElement or Document instance.`);\n }\n\n if (typeof anchorHref !== 'boolean')\n {\n throw new TypeError(`'anchorHref' is not a boolean.`);\n }\n\n if (ignoreClasses !== void 0 && !isIterable(ignoreClasses))\n {\n throw new TypeError(`'ignoreClasses' is not an iterable list.`);\n }\n\n if (ignoreElements !== void 0 && !(ignoreElements instanceof Set))\n {\n throw new TypeError(`'ignoreElements' is not a Set.`);\n }\n\n if (selectors !== void 0 && typeof selectors !== 'string')\n {\n throw new TypeError(`'selectors' is not a string.`);\n }\n\n const selectorQuery = selectors ?? this.#getFocusableSelectors(anchorHref);\n\n const allElements = [...element.querySelectorAll(selectorQuery)];\n\n if (ignoreElements && ignoreClasses)\n {\n return allElements.filter((el) =>\n {\n let hasIgnoreClass = false;\n for (const ignoreClass of ignoreClasses)\n {\n if (el.classList.contains(ignoreClass))\n {\n hasIgnoreClass = true;\n break;\n }\n }\n\n return !hasIgnoreClass && !ignoreElements.has(el) && el.style.display !== 'none' &&\n el.style.visibility !== 'hidden' && !el.hasAttribute('disabled') && !el.hasAttribute('inert') &&\n el.getAttribute('aria-hidden') !== 'true';\n });\n }\n else if (ignoreClasses)\n {\n return allElements.filter((el) =>\n {\n let hasIgnoreClass = false;\n for (const ignoreClass of ignoreClasses)\n {\n if (el.classList.contains(ignoreClass))\n {\n hasIgnoreClass = true;\n break;\n }\n }\n\n return !hasIgnoreClass && el.style.display !== 'none' && el.style.visibility !== 'hidden' &&\n !el.hasAttribute('disabled') && !el.hasAttribute('inert') && el.getAttribute('aria-hidden') !== 'true';\n });\n }\n else if (ignoreElements)\n {\n return allElements.filter((el) =>\n {\n return !ignoreElements.has(el) && el.style.display !== 'none' && el.style.visibility !== 'hidden' &&\n !el.hasAttribute('disabled') && !el.hasAttribute('inert') && el.getAttribute('aria-hidden') !== 'true';\n });\n }\n else\n {\n return allElements.filter((el) =>\n {\n return el.style.display !== 'none' && el.style.visibility !== 'hidden' && !el.hasAttribute('disabled') &&\n !el.hasAttribute('inert') && el.getAttribute('aria-hidden') !== 'true';\n });\n }\n }\n\n /**\n * Returns the default focusable selectors query.\n *\n * @param {boolean} [anchorHref=true] - When true anchors must have an HREF.\n *\n * @returns {string} Focusable selectors for `querySelectorAll`.\n */\n static #getFocusableSelectors(anchorHref = true)\n {\n return `button, [contenteditable=\"\"], [contenteditable=\"true\"], details summary:not([tabindex=\"-1\"]), embed, a${\n anchorHref ? '[href]' : ''}, iframe, object, input:not([type=hidden]), select, textarea, ` +\n `[tabindex]:not([tabindex=\"-1\"])`;\n }\n\n /**\n * Gets a A11yFocusSource object from the given DOM event allowing for optional X / Y screen space overrides.\n * Browsers (Firefox / Chrome) forwards a mouse event for the context menu keyboard button. Provides detection of\n * when the context menu event is from the keyboard. Firefox as of (1/23) does not provide the correct screen space\n * coordinates, so for keyboard context menu presses coordinates are generated from the centroid point of the\n * element.\n *\n * A default fallback element or selector string may be provided to provide the focus target. If the event comes from\n * the keyboard however the source focused element is inserted as the target with the fallback value appended to the\n * list of focus targets. When A11yFocusSource is applied by {@link A11yHelper.applyFocusSource} the target focus\n * list is iterated through until a connected target is found and focus applied.\n *\n * @param {object} options - Options\n *\n * @param {KeyboardEvent|MouseEvent} [options.event] - The source DOM event.\n *\n * @param {boolean} [options.debug] - When true {@link A11yHelper.applyFocusSource} logs focus target data.\n *\n * @param {HTMLElement|string} [options.focusEl] - A specific HTMLElement or selector string as the focus target.\n *\n * @param {number} [options.x] - Used when an event isn't provided; integer of event source in screen space.\n *\n * @param {number} [options.y] - Used when an event isn't provided; integer of event source in screen space.\n *\n * @returns {A11yFocusSource} A A11yFocusSource object.\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1426671\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=314314\n *\n * TODO: Evaluate / test against touch input devices.\n */\n static getFocusSource({ event, x, y, focusEl, debug = false })\n {\n if (focusEl !== void 0 && !(focusEl instanceof HTMLElement) && typeof focusEl !== 'string')\n {\n throw new TypeError(\n `A11yHelper.getFocusSource error: 'focusEl' is not a HTMLElement or string.`);\n }\n\n if (debug !== void 0 && typeof debug !== 'boolean')\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'debug' is not a boolean.`);\n }\n\n // Handle the case when no event is provided and x, y, or focusEl is explicitly defined.\n if (event === void 0)\n {\n if (typeof x !== 'number')\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'event' not defined and 'x' is not a number.`);\n }\n\n if (typeof y !== 'number')\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'event' not defined and 'y' is not a number.`);\n }\n\n return {\n debug,\n focusEl: focusEl !== void 0 ? [focusEl] : void 0,\n x,\n y,\n };\n }\n\n if (!(event instanceof KeyboardEvent) && !(event instanceof MouseEvent))\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'event' is not a KeyboardEvent or MouseEvent.`);\n }\n\n if (x !== void 0 && !Number.isInteger(x))\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'x' is not a number.`);\n }\n\n if (y !== void 0 && !Number.isInteger(y))\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'y' is not a number.`);\n }\n\n /** @type {HTMLElement} */\n const targetEl = event.target;\n\n if (!(targetEl instanceof HTMLElement))\n {\n throw new TypeError(`A11yHelper.getFocusSource error: 'event.target' is not an HTMLElement.`);\n }\n\n const result = { debug };\n\n if (event instanceof MouseEvent)\n {\n // Firefox currently (1/23) does not correctly determine the location of a keyboard originated\n // context menu location, so calculate position from middle of the event target.\n // Firefox fires a mouse event for the context menu key.\n if (event?.button !== 2 && event.type === 'contextmenu')\n {\n const rect = targetEl.getBoundingClientRect();\n result.x = x ?? rect.left + (rect.width / 2);\n result.y = y ?? rect.top + (rect.height / 2);\n result.focusEl = focusEl !== void 0 ? [targetEl, focusEl] : [targetEl];\n result.source = 'keyboard';\n }\n else\n {\n result.x = x ?? event.pageX;\n result.y = y ?? event.pageY;\n result.focusEl = focusEl !== void 0 ? [focusEl] : void 0;\n }\n }\n else\n {\n const rect = targetEl.getBoundingClientRect();\n result.x = x ?? rect.left + (rect.width / 2);\n result.y = y ?? rect.top + (rect.height / 2);\n result.focusEl = focusEl !== void 0 ? [targetEl, focusEl] : [targetEl];\n result.source = 'keyboard';\n }\n\n return result;\n }\n\n /**\n * Returns first focusable element within a specified element.\n *\n * @param {HTMLElement|Document} [element=document] - Optional element to start query.\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {Iterable} [options.ignoreClasses] - Iterable list of classes to ignore elements.\n *\n * @param {Set} [options.ignoreElements] - Set of elements to ignore.\n *\n * @returns {HTMLElement} First focusable child element\n */\n static getLastFocusableElement(element = document, options)\n {\n const focusableElements = this.getFocusableElements(element, options);\n\n return focusableElements.length > 0 ? focusableElements[focusableElements.length - 1] : void 0;\n }\n\n /**\n * Tests if the given element is focusable.\n *\n * @param {HTMLElement} [el] - Element to test.\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {boolean} [options.anchorHref=true] - When true anchors must have an HREF.\n *\n * @param {Iterable} [options.ignoreClasses] - Iterable list of classes to ignore elements.\n *\n * @returns {boolean} Element is focusable.\n */\n static isFocusable(el, { anchorHref = true, ignoreClasses } = {})\n {\n if (el === void 0 || el === null || !(el instanceof HTMLElement) || el?.hidden || !el?.isConnected)\n {\n return false;\n }\n\n if (typeof anchorHref !== 'boolean')\n {\n throw new TypeError(`'anchorHref' is not a boolean.`);\n }\n\n if (ignoreClasses !== void 0 && !isIterable(ignoreClasses))\n {\n throw new TypeError(`'ignoreClasses' is not an iterable list.`);\n }\n\n const contenteditableAttr = el.getAttribute('contenteditable');\n const contenteditableFocusable = typeof contenteditableAttr === 'string' &&\n (contenteditableAttr === '' || contenteditableAttr === 'true');\n\n const tabindexAttr = el.getAttribute('tabindex');\n const tabindexFocusable = typeof tabindexAttr === 'string' && tabindexAttr !== '-1';\n\n const isAnchor = el instanceof HTMLAnchorElement;\n\n if (contenteditableFocusable || tabindexFocusable || isAnchor || el instanceof HTMLButtonElement ||\n el instanceof HTMLDetailsElement || el instanceof HTMLEmbedElement || el instanceof HTMLIFrameElement ||\n el instanceof HTMLInputElement || el instanceof HTMLObjectElement || el instanceof HTMLSelectElement ||\n el instanceof HTMLTextAreaElement)\n {\n if (isAnchor && anchorHref && typeof el.getAttribute('href') !== 'string')\n {\n return false;\n }\n\n return el.style.display !== 'none' && el.style.visibility !== 'hidden' && !el.hasAttribute('disabled') &&\n !el.hasAttribute('inert') && el.getAttribute('aria-hidden') !== 'true';\n }\n\n return false;\n }\n\n /**\n * Convenience method to check if the given data is a valid focus source.\n *\n * @param {HTMLElement|string} data - Either an HTMLElement or selector string.\n *\n * @returns {boolean} Is valid focus source.\n */\n static isFocusSource(data)\n {\n return data instanceof HTMLElement || typeof data === 'string';\n }\n}\n\n/**\n * @typedef {object} A11yFocusSource - Provides essential data to return focus to an HTMLElement after a series of UI\n * actions like working with context menus and modal dialogs.\n *\n * @property {boolean} [debug] - When true logs to console the actions taken in {@link A11yHelper.applyFocusSource}.\n *\n * @property {Iterable} [focusEl] - List of targets to attempt to focus.\n *\n * @property {string} [source] - The source of the event: 'keyboard' for instance.\n *\n * @property {number} [x] - Potential X coordinate of initial event.\n *\n * @property {number} [y] - Potential Y coordinate of initial event.\n */\n\n/**\n * Provides management of a single Promise that can be shared and accessed across JS & Svelte components. This allows a\n * Promise to be created and managed as part of the TRL application lifecycle and accessed safely in various control\n * flow scenarios. When resolution of the current managed Promise starts further interaction is prevented.\n *\n * Note: to enable debugging / log statements set the static `logging` variable to true.\n */\nclass ManagedPromise\n{\n /** @type {boolean} */\n static #logging = false;\n\n /** @type {{ isProcessing?: boolean, promise?: Promise, reject: Function, resolve: Function }} */\n #current;\n\n /**\n * @returns {boolean} Whether global logging is enabled.\n */\n static get logging()\n {\n return this.#logging;\n }\n\n /**\n * @returns {boolean} Whether there is an active managed Promise.\n */\n get isActive()\n {\n return this.#current !== void 0;\n }\n\n /**\n * @returns {boolean} Whether there is an active managed Promise and resolution is currently being processed.\n */\n get isProcessing()\n {\n return this.#current !== void 0 ? this.#current.isProcessing : false;\n }\n\n /**\n * Sets global logging enabled state.\n *\n * @param {boolean} logging - New logging enabled state.\n */\n static set logging(logging)\n {\n if (typeof logging !== 'boolean')\n {\n throw new TypeError(`[TRL] ManagedPromise.logging error: 'logging' is not a boolean.`);\n }\n\n this.#logging = logging;\n }\n\n // ----------------------------------------------------------------------------------------------------------------\n\n /**\n * Resolves any current Promise with undefined and creates a new current Promise.\n *\n * @template T\n *\n * @param {object} opts - Options.\n *\n * @param {boolean} [opts.reuse=false] - When true if there is an existing live Promise it is returned immediately.\n *\n * @returns {Promise} The new current managed Promise.\n */\n create({ reuse = false } = {})\n {\n if (typeof reuse !== 'boolean')\n {\n throw new TypeError(`[TRL] ManagedPromise.create error: 'reuse' is not a boolean.`);\n }\n\n if (reuse && this.#current !== void 0 && this.#current.promise instanceof Promise)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.create info: Reusing / returning existing managed Promise.`);\n }\n\n return this.#current.promise;\n }\n\n if (this.#current !== void 0)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(\n `[TRL] ManagedPromise.create info: Creating a new Promise and resolving existing immediately.`);\n }\n\n this.#current.resolve(void 0);\n this.#current = void 0;\n }\n\n const promise = new Promise((resolve, reject) =>\n {\n this.#current = {\n isProcessing: false,\n reject,\n resolve\n };\n });\n\n this.#current.promise = promise;\n\n return promise;\n }\n\n /**\n * Gets the current Promise if any.\n *\n * @returns {Promise} Current Promise.\n */\n get()\n {\n return this.#current ? this.#current.promise : void 0;\n }\n\n /**\n * Rejects the current Promise if applicable.\n *\n * @param {*} [result] - Result to reject.\n *\n * @returns {boolean} Was the promise rejected.\n */\n reject(result = void 0)\n {\n // Early out as Promise resolution is currently processing.\n if (this.#current !== void 0 && this.#current.isProcessing)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.reject info: Currently processing promise.`);\n }\n\n return true;\n }\n\n if (this.#current !== void 0)\n {\n this.#current.isProcessing = true;\n\n if (result instanceof Promise)\n {\n result.then((value) =>\n {\n this.#current.reject(value);\n this.#current = void 0;\n }).catch((err) =>\n {\n this.#current.reject(err);\n this.#current = void 0;\n });\n }\n else\n {\n this.#current.reject(result);\n this.#current = void 0;\n }\n\n return true;\n }\n else\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.reject warning: No current managed Promise to reject.`);\n }\n\n return false;\n }\n }\n\n /**\n * Resolves the current Promise if applicable.\n *\n * @param {*} [result] - Result to resolve.\n *\n * @returns {boolean} Was the promise resolved.\n */\n resolve(result = void 0)\n {\n // Early out as Promise resolution is currently processing.\n if (this.#current !== void 0 && this.#current.isProcessing)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.resolve info: Currently processing promise.`);\n }\n\n return true;\n }\n\n if (this.#current !== void 0)\n {\n if (result instanceof Promise)\n {\n this.#current.isProcessing = true;\n\n result.then((value) =>\n {\n this.#current.resolve(value);\n this.#current = void 0;\n }).catch((err) =>\n {\n this.#current.reject(err);\n this.#current = void 0;\n });\n }\n else\n {\n this.#current.resolve(result);\n this.#current = void 0;\n }\n\n return true;\n }\n else\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.resolve warning: No current managed Promise to resolve.`);\n }\n\n return false;\n }\n }\n}\n\n/**\n * Provides access to the Clipboard API for reading / writing text strings. This requires a secure context.\n *\n * Note: `writeText` will attempt to use the older `execCommand` if available when `navigator.clipboard` is not\n * available.\n */\nclass ClipboardAccess\n{\n /**\n * Uses `navigator.clipboard` if available to read text from the clipboard.\n *\n * Note: Always returns `undefined` when `navigator.clipboard` is not available or the clipboard contains the\n * empty string.\n *\n * @returns {Promise} The current clipboard text or undefined.\n */\n static async readText()\n {\n let result;\n\n if (globalThis?.navigator?.clipboard)\n {\n try\n {\n result = await globalThis.navigator.clipboard.readText();\n }\n catch (err) { /**/ }\n }\n\n return result === '' ? void 0 : result;\n }\n\n /**\n * Uses `navigator.clipboard` if available then falls back to `document.execCommand('copy')` if available to copy\n * the given text to the clipboard.\n *\n * @param {string} text - Text to copy to the browser clipboard.\n *\n * @returns {Promise} Copy successful.\n */\n static async writeText(text)\n {\n if (typeof text !== 'string')\n {\n throw new TypeError(`ClipboardAccess.writeText error: 'text' is not a string.`);\n }\n\n let success = false;\n\n if (globalThis?.navigator?.clipboard)\n {\n try\n {\n await globalThis.navigator.clipboard.writeText(text);\n success = true;\n }\n catch (err) { /**/ }\n }\n else if (globalThis?.document?.execCommand instanceof Function)\n {\n const textArea = globalThis.document.createElement('textarea');\n\n // Place in the top-left corner of screen regardless of scroll position.\n textArea.style.position = 'fixed';\n textArea.style.top = '0';\n textArea.style.left = '0';\n\n // Ensure it has a small width and height. Setting to 1px / 1em\n // doesn't work as this gives a negative w/h on some browsers.\n textArea.style.width = '2em';\n textArea.style.height = '2em';\n\n // We don't need padding, reducing the size if it does flash render.\n textArea.style.padding = '0';\n\n // Clean up any borders.\n textArea.style.border = 'none';\n textArea.style.outline = 'none';\n textArea.style.boxShadow = 'none';\n\n // Avoid flash of the white box if rendered for any reason.\n textArea.style.background = 'transparent';\n\n textArea.value = text;\n\n globalThis.document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n\n try\n {\n success = document.execCommand('copy');\n }\n catch (err) { /**/ }\n\n document.body.removeChild(textArea);\n }\n\n return success;\n }\n}\n\n/**\n * Provides a solid string hashing algorithm.\n *\n * Sourced from: https://stackoverflow.com/a/52171480\n *\n * @param {string} str - String to hash.\n *\n * @param {number} seed - A seed value altering the hash.\n *\n * @returns {number} Hash code.\n */\nfunction hashCode(str, seed = 0)\n{\n if (typeof str !== 'string') { return 0; }\n\n let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\n\n for (let ch, i = 0; i < str.length; i++)\n {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n}\n\nconst s_UUIDV4_REGEX = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;\n\n/**\n * Generates a UUID v4 compliant ID. Please use a complete UUID generation package for guaranteed compliance.\n *\n * This code is an evolution of the following Gist.\n * https://gist.github.com/jed/982883\n *\n * There is a public domain / free copy license attached to it that is not a standard OSS license...\n * https://gist.github.com/jed/982883#file-license-txt\n *\n * @returns {string} UUIDv4\n */\nfunction uuidv4()\n{\n return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>\n (c ^ (globalThis.crypto || globalThis.msCrypto).getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));\n}\n\n/**\n * Validates that the given string is formatted as a UUIDv4 string.\n *\n * @param {string} uuid - UUID string to test.\n *\n * @returns {boolean} Is UUIDv4 string.\n */\nuuidv4.isValid = (uuid) => s_UUIDV4_REGEX.test(uuid);\n\n/**\n * Normalizes a string.\n *\n * @param {string} query - A string to normalize for comparisons.\n *\n * @returns {string} Cleaned string.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize\n */\nfunction normalizeString(query)\n{\n return query.trim().normalize('NFD').replace(/[\\x00-\\x1F]/gm, ''); // eslint-disable-line no-control-regex\n}\n\n/**\n * Recursive function that finds the closest parent stacking context.\n * See also https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n *\n * Original author: Kerry Liu / https://github.com/gwwar\n *\n * @see https://github.com/gwwar/z-context/blob/master/content-script.js\n * @see https://github.com/gwwar/z-context/blob/master/LICENSE\n *\n * @param {Element} node -\n *\n * @returns {StackingContext} The closest parent stacking context\n */\nfunction getStackingContext(node)\n{\n // the root element (HTML).\n if (!node || node.nodeName === 'HTML')\n {\n return { node: document.documentElement, reason: 'root' };\n }\n\n // handle shadow root elements.\n if (node.nodeName === '#document-fragment')\n {\n return getStackingContext(node.host);\n }\n\n const computedStyle = globalThis.getComputedStyle(node);\n\n // position: fixed or sticky.\n if (computedStyle.position === 'fixed' || computedStyle.position === 'sticky')\n {\n return { node, reason: `position: ${computedStyle.position}` };\n }\n\n // positioned (absolutely or relatively) with a z-index value other than \"auto\".\n if (computedStyle.zIndex !== 'auto' && computedStyle.position !== 'static')\n {\n return { node, reason: `position: ${computedStyle.position}; z-index: ${computedStyle.zIndex}` };\n }\n\n // elements with an opacity value less than 1.\n if (computedStyle.opacity !== '1')\n {\n return { node, reason: `opacity: ${computedStyle.opacity}` };\n }\n\n // elements with a transform value other than \"none\".\n if (computedStyle.transform !== 'none')\n {\n return { node, reason: `transform: ${computedStyle.transform}` };\n }\n\n // elements with a mix-blend-mode value other than \"normal\".\n if (computedStyle.mixBlendMode !== 'normal')\n {\n return { node, reason: `mixBlendMode: ${computedStyle.mixBlendMode}` };\n }\n\n // elements with a filter value other than \"none\".\n if (computedStyle.filter !== 'none')\n {\n return { node, reason: `filter: ${computedStyle.filter}` };\n }\n\n // elements with a perspective value other than \"none\".\n if (computedStyle.perspective !== 'none')\n {\n return { node, reason: `perspective: ${computedStyle.perspective}` };\n }\n\n // elements with a clip-path value other than \"none\".\n if (computedStyle.clipPath !== 'none')\n {\n return { node, reason: `clip-path: ${computedStyle.clipPath} ` };\n }\n\n // elements with a mask value other than \"none\".\n const mask = computedStyle.mask || computedStyle.webkitMask;\n if (mask !== 'none' && mask !== undefined)\n {\n return { node, reason: `mask: ${mask}` };\n }\n\n // elements with a mask-image value other than \"none\".\n const maskImage = computedStyle.maskImage || computedStyle.webkitMaskImage;\n if (maskImage !== 'none' && maskImage !== undefined)\n {\n return { node, reason: `mask-image: ${maskImage}` };\n }\n\n // elements with a mask-border value other than \"none\".\n const maskBorder = computedStyle.maskBorder || computedStyle.webkitMaskBorder;\n if (maskBorder !== 'none' && maskBorder !== undefined)\n {\n return { node, reason: `mask-border: ${maskBorder}` };\n }\n\n // elements with isolation set to \"isolate\".\n if (computedStyle.isolation === 'isolate')\n {\n return { node, reason: `isolation: ${computedStyle.isolation}` };\n }\n\n // transform or opacity in will-change even if you don't specify values for these attributes directly.\n if (computedStyle.willChange === 'transform' || computedStyle.willChange === 'opacity')\n {\n return { node, reason: `willChange: ${computedStyle.willChange}` };\n }\n\n // elements with -webkit-overflow-scrolling set to \"touch\".\n if (computedStyle.webkitOverflowScrolling === 'touch')\n {\n return { node, reason: '-webkit-overflow-scrolling: touch' };\n }\n\n // an item with a z-index value other than \"auto\".\n if (computedStyle.zIndex !== 'auto')\n {\n const parentStyle = globalThis.getComputedStyle(node.parentNode);\n // with a flex|inline-flex parent.\n if (parentStyle.display === 'flex' || parentStyle.display === 'inline-flex')\n {\n return { node, reason: `flex-item; z-index: ${computedStyle.zIndex}` };\n // with a grid parent.\n }\n else if (parentStyle.grid !== 'none / none / none / row / auto / auto')\n {\n return { node, reason: `child of grid container; z-index: ${computedStyle.zIndex}` };\n }\n }\n\n // contain with a value of layout, or paint, or a composite value that includes either of them\n const contain = computedStyle.contain;\n if (['layout', 'paint', 'strict', 'content'].indexOf(contain) > -1 ||\n contain.indexOf('paint') > -1 ||\n contain.indexOf('layout') > -1\n )\n {\n return { node, reason: `contain: ${contain}` };\n }\n\n return getStackingContext(node.parentNode);\n}\n\n/**\n * @typedef {object} StackingContext\n *\n * @property {Element} node - A DOM Element.\n *\n * @property {string} reason - Reason for why a stacking context was created.\n */\n\n/**\n * Provides a managed dynamic style sheet / element useful in configuring global CSS variables. When creating an\n * instance of StyleManager you must provide a \"document key\" / string for the style element added. The style element\n * can be accessed via `document[docKey]`.\n *\n * Instances of StyleManager can also be versioned by supplying a positive integer greater than or equal to `1` via the\n * 'version' option. This version number is assigned to the associated style element. When a StyleManager instance is\n * created and there is an existing instance with a version that is lower than the current instance all CSS rules are\n * removed letting the higher version to take precedence. This isn't a perfect system and requires thoughtful\n * construction of CSS variables exposed, but allows multiple independently compiled TRL packages to load the latest\n * CSS variables. It is recommended to always set `overwrite` option of {@link StyleManager.setProperty} and\n * {@link StyleManager.setProperties} to `false` when loading initial values.\n */\nclass StyleManager\n{\n /** @type {CSSStyleRule} */\n #cssRule;\n\n /** @type {string} */\n #docKey;\n\n /** @type {string} */\n #selector;\n\n /** @type {HTMLStyleElement} */\n #styleElement;\n\n /** @type {number} */\n #version;\n\n /**\n *\n * @param {object} opts - Options.\n *\n * @param {string} opts.docKey - Required key providing a link to a specific style sheet element.\n *\n * @param {string} [opts.selector=:root] - Selector element.\n *\n * @param {Document} [opts.document] - Target document to load styles into.\n *\n * @param {number} [opts.version] - An integer representing the version / level of styles being managed.\n *\n */\n constructor({ docKey, selector = ':root', document = globalThis.document, version } = {})\n {\n if (typeof docKey !== 'string') { throw new TypeError(`StyleManager error: 'docKey' is not a string.`); }\n\n // TODO: Verify 'document' type from Popout FVTT module. For some reason the popout document trips this\n // unintentionally.\n // if (!(document instanceof Document))\n // {\n // throw new TypeError(`StyleManager error: 'document' is not an instance of Document.`);\n // }\n\n if (typeof selector !== 'string') { throw new TypeError(`StyleManager error: 'selector' is not a string.`); }\n\n if (version !== void 0 && !Number.isSafeInteger(version) && version < 1)\n {\n throw new TypeError(`StyleManager error: 'version' is defined and is not a positive integer >= 1.`);\n }\n\n this.#selector = selector;\n this.#docKey = docKey;\n this.#version = version;\n\n if (document[this.#docKey] === void 0)\n {\n this.#styleElement = document.createElement('style');\n\n document.head.append(this.#styleElement);\n\n // Set initial style manager version if any supplied.\n this.#styleElement._STYLE_MANAGER_VERSION = version;\n\n this.#styleElement.sheet.insertRule(`${selector} {}`, 0);\n\n this.#cssRule = this.#styleElement.sheet.cssRules[0];\n\n document[docKey] = this.#styleElement;\n }\n else\n {\n this.#styleElement = document[docKey];\n this.#cssRule = this.#styleElement.sheet.cssRules[0];\n\n if (version)\n {\n const existingVersion = this.#styleElement._STYLE_MANAGER_VERSION ?? 0;\n\n // Remove all existing CSS rules / text if version is greater than existing version.\n if (version > existingVersion)\n {\n this.#cssRule.style.cssText = '';\n }\n }\n }\n }\n\n /**\n * @returns {string} Provides an accessor to get the `cssText` for the style sheet.\n */\n get cssText()\n {\n return this.#cssRule.style.cssText;\n }\n\n /**\n * @returns {number} Returns the version of this instance.\n */\n get version()\n {\n return this.#version;\n }\n\n /**\n * Provides a copy constructor to duplicate an existing StyleManager instance into a new document.\n *\n * Note: This is used to support the `PopOut` module.\n *\n * @param {Document} [document] Target browser document to clone into.\n *\n * @returns {StyleManager} New style manager instance.\n */\n clone(document = globalThis.document)\n {\n const newStyleManager = new StyleManager({\n selector: this.#selector,\n docKey: this.#docKey,\n document,\n version: this.#version\n });\n\n newStyleManager.#cssRule.style.cssText = this.#cssRule.style.cssText;\n\n return newStyleManager;\n }\n\n get()\n {\n const cssText = this.#cssRule.style.cssText;\n\n const result = {};\n\n if (cssText !== '')\n {\n for (const entry of cssText.split(';'))\n {\n if (entry !== '')\n {\n const values = entry.split(':');\n result[values[0].trim()] = values[1];\n }\n }\n }\n\n return result;\n }\n\n /**\n * Gets a particular CSS variable.\n *\n * @param {string} key - CSS variable property key.\n *\n * @returns {string} Returns CSS variable value.\n */\n getProperty(key)\n {\n if (typeof key !== 'string') { throw new TypeError(`StyleManager error: 'key' is not a string.`); }\n\n return this.#cssRule.style.getPropertyValue(key);\n }\n\n /**\n * Set rules by property / value; useful for CSS variables.\n *\n * @param {Object} rules - An object with property / value string pairs to load.\n *\n * @param {boolean} [overwrite=true] - When true overwrites any existing values.\n */\n setProperties(rules, overwrite = true)\n {\n if (!isObject(rules)) { throw new TypeError(`StyleManager error: 'rules' is not an object.`); }\n\n if (typeof overwrite !== 'boolean') { throw new TypeError(`StyleManager error: 'overwrite' is not a boolean.`); }\n\n if (overwrite)\n {\n for (const [key, value] of Object.entries(rules))\n {\n this.#cssRule.style.setProperty(key, value);\n }\n }\n else\n {\n // Only set property keys for entries that don't have an existing rule set.\n for (const [key, value] of Object.entries(rules))\n {\n if (this.#cssRule.style.getPropertyValue(key) === '')\n {\n this.#cssRule.style.setProperty(key, value);\n }\n }\n }\n }\n\n /**\n * Sets a particular property.\n *\n * @param {string} key - CSS variable property key.\n *\n * @param {string} value - CSS variable value.\n *\n * @param {boolean} [overwrite=true] - Overwrite any existing value.\n */\n setProperty(key, value, overwrite = true)\n {\n if (typeof key !== 'string') { throw new TypeError(`StyleManager error: 'key' is not a string.`); }\n\n if (typeof value !== 'string') { throw new TypeError(`StyleManager error: 'value' is not a string.`); }\n\n if (typeof overwrite !== 'boolean') { throw new TypeError(`StyleManager error: 'overwrite' is not a boolean.`); }\n\n if (overwrite)\n {\n this.#cssRule.style.setProperty(key, value);\n }\n else\n {\n if (this.#cssRule.style.getPropertyValue(key) === '')\n {\n this.#cssRule.style.setProperty(key, value);\n }\n }\n }\n\n /**\n * Removes the property keys specified. If `keys` is an iterable list then all property keys in the list are removed.\n *\n * @param {Iterable} keys - The property keys to remove.\n */\n removeProperties(keys)\n {\n if (!isIterable(keys)) { throw new TypeError(`StyleManager error: 'keys' is not an iterable list.`); }\n\n for (const key of keys)\n {\n if (typeof key === 'string') { this.#cssRule.style.removeProperty(key); }\n }\n }\n\n /**\n * Removes a particular CSS variable.\n *\n * @param {string} key - CSS variable property key.\n *\n * @returns {string} CSS variable value when removed.\n */\n removeProperty(key)\n {\n if (typeof key !== 'string') { throw new TypeError(`StyleManager error: 'key' is not a string.`); }\n\n return this.#cssRule.style.removeProperty(key);\n }\n}\n\nconst s_REGEX = /(\\d+)\\s*px/;\n\n/**\n * Parses a pixel string / computed styles. Ex. `100px` returns `100`.\n *\n * @param {string} value - Value to parse.\n *\n * @returns {number|undefined} The integer component of a pixel string.\n */\nfunction styleParsePixels(value)\n{\n if (typeof value !== 'string') { return void 0; }\n\n const isPixels = s_REGEX.test(value);\n const number = parseInt(value);\n\n return isPixels && Number.isFinite(number) ? number : void 0;\n}\n\n/**\n * Defines the application shell contract. If Svelte components export getter / setters for the following properties\n * then that component is considered an application shell.\n *\n * @type {string[]}\n */\nconst applicationShellContract = ['elementRoot'];\n\nObject.freeze(applicationShellContract);\n\n/**\n * Provides a method to determine if the passed in object / Svelte component follows the application shell contract.\n * This involves ensuring that the accessors defined in `applicationShellContract`.\n *\n * Note: A caveat is that when using Vite in a developer build components are wrapped in a proxy / ProxyComponent that\n * defines instance accessors versus on the prototype, so the check below ensures that all accessors in the contract are\n * either available on the prototype or directly on the instance.\n *\n * @param {*} component - Object / component to test.\n *\n * @returns {boolean} Whether the component is a ApplicationShell or TJSApplicationShell.\n */\nfunction isApplicationShell(component)\n{\n if (component === null || component === void 0) { return false; }\n\n let compHasContract = true;\n let protoHasContract = true;\n\n // Check for accessors on the instance.\n for (const accessor of applicationShellContract)\n {\n const descriptor = Object.getOwnPropertyDescriptor(component, accessor);\n if (descriptor === void 0 || descriptor.get === void 0 || descriptor.set === void 0) { compHasContract = false; }\n }\n\n // Get the prototype which is the parent SvelteComponent that has any getter / setters.\n const prototype = Object.getPrototypeOf(component);\n\n // Verify the application shell contract. If the accessors (getters / setters) are defined for\n // `applicationShellContract`.\n for (const accessor of applicationShellContract)\n {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, accessor);\n if (descriptor === void 0 || descriptor.get === void 0 || descriptor.set === void 0) { protoHasContract = false; }\n }\n\n return compHasContract || protoHasContract;\n}\n\n/**\n * Provides basic duck typing to determine if the provided object is a HMR ProxyComponent instance or class.\n *\n * @param {*} comp - Data to check as a HMR proxy component.\n *\n * @returns {boolean} Whether basic duck typing succeeds.\n */\nfunction isHMRProxy(comp)\n{\n const instanceName = comp?.constructor?.name;\n if (typeof instanceName === 'string' && (instanceName.startsWith('Proxy<') || instanceName === 'ProxyComponent'))\n {\n return true;\n }\n\n const prototypeName = comp?.prototype?.constructor?.name;\n return typeof prototypeName === 'string' && (prototypeName.startsWith('Proxy<') ||\n prototypeName === 'ProxyComponent');\n}\n\n/**\n * Provides basic duck typing to determine if the provided function is a constructor function for a Svelte component.\n *\n * @param {*} comp - Data to check as a Svelte component.\n *\n * @returns {boolean} Whether basic duck typing succeeds.\n */\nfunction isSvelteComponent(comp)\n{\n if (comp === null || comp === void 0 || typeof comp !== 'function') { return false; }\n\n // When using Vite in a developer build the SvelteComponent is wrapped in a ProxyComponent class.\n // This class doesn't define methods on the prototype, so we must check if the constructor name\n // starts with `Proxy<` as it provides the wrapped component as `Proxy<_wrapped component name_>`.\n const prototypeName = comp?.prototype?.constructor?.name;\n if (typeof prototypeName === 'string' && (prototypeName.startsWith('Proxy<') || prototypeName === 'ProxyComponent'))\n {\n return true;\n }\n\n return typeof window !== void 0 ?\n typeof comp.prototype.$destroy === 'function' && typeof comp.prototype.$on === 'function' : // client-side\n typeof comp.render === 'function'; // server-side\n}\n\n/**\n * Runs outro transition then destroys Svelte component.\n *\n * Workaround for https://github.com/sveltejs/svelte/issues/4056\n *\n * @param {*} instance - A Svelte component.\n */\nasync function outroAndDestroy(instance)\n{\n return new Promise((resolve) =>\n {\n if (instance.$$.fragment && instance.$$.fragment.o)\n {\n group_outros();\n transition_out(instance.$$.fragment, 0, 0, () =>\n {\n instance.$destroy();\n resolve();\n });\n check_outros();\n }\n else\n {\n instance.$destroy();\n resolve();\n }\n });\n}\n\n/**\n * Parses a TyphonJS Svelte config object ensuring that classes specified are Svelte components and props are set\n * correctly.\n *\n * @param {object} config - Svelte config object.\n *\n * @param {*} [thisArg] - `This` reference to set for invoking any props function.\n *\n * @returns {object} The processed Svelte config object.\n */\nfunction parseSvelteConfig(config, thisArg = void 0)\n{\n if (typeof config !== 'object')\n {\n throw new TypeError(`parseSvelteConfig - 'config' is not an object:\\n${JSON.stringify(config)}.`);\n }\n\n if (!isSvelteComponent(config.class))\n {\n throw new TypeError(\n `parseSvelteConfig - 'class' is not a Svelte component constructor for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.hydrate !== void 0 && typeof config.hydrate !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'hydrate' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.intro !== void 0 && typeof config.intro !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'intro' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.target !== void 0 && typeof config.target !== 'string' && !(config.target instanceof HTMLElement) &&\n !(config.target instanceof ShadowRoot) && !(config.target instanceof DocumentFragment))\n {\n throw new TypeError(\n `parseSvelteConfig - 'target' is not a string, HTMLElement, ShadowRoot, or DocumentFragment for config:\\n${\n JSON.stringify(config)}.`);\n }\n\n if (config.anchor !== void 0 && typeof config.anchor !== 'string' && !(config.anchor instanceof HTMLElement) &&\n !(config.anchor instanceof ShadowRoot) && !(config.anchor instanceof DocumentFragment))\n {\n throw new TypeError(\n `parseSvelteConfig - 'anchor' is not a string, HTMLElement, ShadowRoot, or DocumentFragment for config:\\n${\n JSON.stringify(config)}.`);\n }\n\n if (config.context !== void 0 && typeof config.context !== 'function' && !(config.context instanceof Map) &&\n typeof config.context !== 'object')\n {\n throw new TypeError(\n `parseSvelteConfig - 'context' is not a Map, function or object for config:\\n${JSON.stringify(config)}.`);\n }\n\n // Validate extra TyphonJS options --------------------------------------------------------------------------------\n\n // `selectorTarget` optionally stores a target element found in main element.\n if (config.selectorTarget !== void 0 && typeof config.selectorTarget !== 'string')\n {\n throw new TypeError(\n `parseSvelteConfig - 'selectorTarget' is not a string for config:\\n${JSON.stringify(config)}.`);\n }\n\n // `options` stores `injectApp`, `injectEventbus`, and `selectorElement`.\n if (config.options !== void 0 && typeof config.options !== 'object')\n {\n throw new TypeError(\n `parseSvelteConfig - 'options' is not an object for config:\\n${JSON.stringify(config)}.`);\n }\n\n // Validate TyphonJS standard options.\n if (config.options !== void 0)\n {\n if (config.options.injectApp !== void 0 && typeof config.options.injectApp !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'options.injectApp' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.options.injectEventbus !== void 0 && typeof config.options.injectEventbus !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'options.injectEventbus' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n // `selectorElement` optionally stores a main element selector to be found in a HTMLElement target.\n if (config.options.selectorElement !== void 0 && typeof config.options.selectorElement !== 'string')\n {\n throw new TypeError(\n `parseSvelteConfig - 'selectorElement' is not a string for config:\\n${JSON.stringify(config)}.`);\n }\n }\n\n const svelteConfig = { ...config };\n\n // Delete extra Svelte options.\n delete svelteConfig.options;\n\n let externalContext = {};\n\n // If a context callback function is provided then invoke it with `this` being the Foundry app.\n // If an object is returned it adds the entries to external context.\n if (typeof svelteConfig.context === 'function')\n {\n const contextFunc = svelteConfig.context;\n delete svelteConfig.context;\n\n const result = contextFunc.call(thisArg);\n if (isObject(result))\n {\n externalContext = { ...result };\n }\n else\n {\n throw new Error(`parseSvelteConfig - 'context' is a function that did not return an object for config:\\n${\n JSON.stringify(config)}`);\n }\n }\n else if (svelteConfig.context instanceof Map)\n {\n externalContext = Object.fromEntries(svelteConfig.context);\n delete svelteConfig.context;\n }\n else if (isObject(svelteConfig.context))\n {\n externalContext = svelteConfig.context;\n delete svelteConfig.context;\n }\n\n // If a props is a function then invoke it with `this` being the Foundry app.\n // If an object is returned set it as the props.\n svelteConfig.props = s_PROCESS_PROPS(svelteConfig.props, thisArg, config);\n\n // Process children components attaching to external context.\n if (Array.isArray(svelteConfig.children))\n {\n const children = [];\n\n for (let cntr = 0; cntr < svelteConfig.children.length; cntr++)\n {\n const child = svelteConfig.children[cntr];\n\n if (!isSvelteComponent(child.class))\n {\n throw new Error(`parseSvelteConfig - 'class' is not a Svelte component for child[${cntr}] for config:\\n${\n JSON.stringify(config)}`);\n }\n\n child.props = s_PROCESS_PROPS(child.props, thisArg, config);\n\n children.push(child);\n }\n\n if (children.length > 0)\n {\n externalContext.children = children;\n }\n\n delete svelteConfig.children;\n }\n else if (isObject(svelteConfig.children))\n {\n if (!isSvelteComponent(svelteConfig.children.class))\n {\n throw new Error(`parseSvelteConfig - 'class' is not a Svelte component for children object for config:\\n${\n JSON.stringify(config)}`);\n }\n\n svelteConfig.children.props = s_PROCESS_PROPS(svelteConfig.children.props, thisArg, config);\n\n externalContext.children = [svelteConfig.children];\n delete svelteConfig.children;\n }\n\n if (!(svelteConfig.context instanceof Map))\n {\n svelteConfig.context = new Map();\n }\n\n svelteConfig.context.set('#external', externalContext);\n\n return svelteConfig;\n}\n\n/**\n * Processes Svelte props. Potentially props can be a function to invoke with `thisArg`.\n *\n * @param {object|Function} props - Svelte props.\n *\n * @param {*} thisArg - `This` reference to set for invoking any props function.\n *\n * @param {object} config - Svelte config\n *\n * @returns {object|void} Svelte props.\n */\nfunction s_PROCESS_PROPS(props, thisArg, config)\n{\n // If a props is a function then invoke it with `this` being the Foundry app.\n // If an object is returned set it as the props.\n if (typeof props === 'function')\n {\n const result = props.call(thisArg);\n if (isObject(result))\n {\n return result;\n }\n else\n {\n throw new Error(`parseSvelteConfig - 'props' is a function that did not return an object for config:\\n${\n JSON.stringify(config)}`);\n }\n }\n else if (isObject(props))\n {\n return props;\n }\n else if (props !== void 0)\n {\n throw new Error(\n `parseSvelteConfig - 'props' is not a function or an object for config:\\n${JSON.stringify(config)}`);\n }\n\n return {};\n}\n\n/**\n * Wraps a callback in a debounced timeout.\n *\n * Delay execution of the callback function until the function has not been called for the given delay in milliseconds.\n *\n * @param {Function} callback - A function to execute once the debounced threshold has been passed.\n *\n * @param {number} delay - An amount of time in milliseconds to delay.\n *\n * @returns {Function} A wrapped function that can be called to debounce execution.\n */\nfunction debounce(callback, delay)\n{\n let timeoutId;\n\n return function(...args)\n {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => { callback.apply(this, args); }, delay);\n };\n}\n\n/**\n * Provides a method to determine if the passed in Svelte component has a getter accessor.\n *\n * @param {*} object - An object.\n *\n * @param {string} accessor - Accessor to test.\n *\n * @returns {boolean} Whether the component has the getter for accessor.\n */\nfunction hasGetter(object, accessor)\n{\n if (object === null || object === void 0) { return false; }\n\n // Check for instance accessor.\n const iDescriptor = Object.getOwnPropertyDescriptor(object, accessor);\n if (iDescriptor !== void 0 && iDescriptor.get !== void 0) { return true; }\n\n // Walk parent prototype chain. Check for descriptor at each prototype level.\n for (let o = Object.getPrototypeOf(object); o; o = Object.getPrototypeOf(o))\n {\n const descriptor = Object.getOwnPropertyDescriptor(o, accessor);\n if (descriptor !== void 0 && descriptor.get !== void 0) { return true; }\n }\n\n return false;\n}\n\n/**\n * Provides a method to determine if the passed in Svelte component has a getter & setter accessor.\n *\n * @param {*} object - An object.\n *\n * @param {string} accessor - Accessor to test.\n *\n * @returns {boolean} Whether the component has the getter and setter for accessor.\n */\nfunction hasAccessor(object, accessor)\n{\n if (object === null || object === void 0) { return false; }\n\n // Check for instance accessor.\n const iDescriptor = Object.getOwnPropertyDescriptor(object, accessor);\n if (iDescriptor !== void 0 && iDescriptor.get !== void 0 && iDescriptor.set !== void 0) { return true; }\n\n // Walk parent prototype chain. Check for descriptor at each prototype level.\n for (let o = Object.getPrototypeOf(object); o; o = Object.getPrototypeOf(o))\n {\n const descriptor = Object.getOwnPropertyDescriptor(o, accessor);\n if (descriptor !== void 0 && descriptor.get !== void 0 && descriptor.set !== void 0) { return true; }\n }\n\n return false;\n}\n\n/**\n * Provides a method to determine if the passed in Svelte component has a setter accessor.\n *\n * @param {*} object - An object.\n *\n * @param {string} accessor - Accessor to test.\n *\n * @returns {boolean} Whether the component has the setter for accessor.\n */\nfunction hasSetter(object, accessor)\n{\n if (object === null || object === void 0) { return false; }\n\n // Check for instance accessor.\n const iDescriptor = Object.getOwnPropertyDescriptor(object, accessor);\n if (iDescriptor !== void 0 && iDescriptor.set !== void 0) { return true; }\n\n // Walk parent prototype chain. Check for descriptor at each prototype level.\n for (let o = Object.getPrototypeOf(object); o; o = Object.getPrototypeOf(o))\n {\n const descriptor = Object.getOwnPropertyDescriptor(o, accessor);\n if (descriptor !== void 0 && descriptor.set !== void 0) { return true; }\n }\n\n return false;\n}\n\n/**\n * Returns whether the target is or has the given prototype walking up the prototype chain.\n *\n * @param {*} target - Any target to test.\n *\n * @param {Function} Prototype - Prototype function / class constructor to find.\n *\n * @returns {boolean} Target matches prototype.\n */\nfunction hasPrototype(target, Prototype)\n{\n /* c8 ignore next */\n if (typeof target !== 'function') { return false; }\n\n if (target === Prototype) { return true; }\n\n // Walk parent prototype chain. Check for descriptor at each prototype level.\n for (let proto = Object.getPrototypeOf(target); proto; proto = Object.getPrototypeOf(proto))\n {\n if (proto === Prototype) { return true; }\n }\n\n return false;\n}\n\nfunction set(obj, key, val) {\n\tif (typeof val.value === 'object') val.value = klona(val.value);\n\tif (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === '__proto__') {\n\t\tObject.defineProperty(obj, key, val);\n\t} else obj[key] = val.value;\n}\n\nfunction klona(x) {\n\tif (typeof x !== 'object') return x;\n\n\tvar i=0, k, list, tmp, str=Object.prototype.toString.call(x);\n\n\tif (str === '[object Object]') {\n\t\ttmp = Object.create(x.__proto__ || null);\n\t} else if (str === '[object Array]') {\n\t\ttmp = Array(x.length);\n\t} else if (str === '[object Set]') {\n\t\ttmp = new Set;\n\t\tx.forEach(function (val) {\n\t\t\ttmp.add(klona(val));\n\t\t});\n\t} else if (str === '[object Map]') {\n\t\ttmp = new Map;\n\t\tx.forEach(function (val, key) {\n\t\t\ttmp.set(klona(key), klona(val));\n\t\t});\n\t} else if (str === '[object Date]') {\n\t\ttmp = new Date(+x);\n\t} else if (str === '[object RegExp]') {\n\t\ttmp = new RegExp(x.source, x.flags);\n\t} else if (str === '[object DataView]') {\n\t\ttmp = new x.constructor( klona(x.buffer) );\n\t} else if (str === '[object ArrayBuffer]') {\n\t\ttmp = x.slice(0);\n\t} else if (str.slice(-6) === 'Array]') {\n\t\t// ArrayBuffer.isView(x)\n\t\t// ~> `new` bcuz `Buffer.slice` => ref\n\t\ttmp = new x.constructor(x);\n\t}\n\n\tif (tmp) {\n\t\tfor (list=Object.getOwnPropertySymbols(x); i < list.length; i++) {\n\t\t\tset(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));\n\t\t}\n\n\t\tfor (i=0, list=Object.getOwnPropertyNames(x); i < list.length; i++) {\n\t\t\tif (Object.hasOwnProperty.call(tmp, k=list[i]) && tmp[k] === x[k]) continue;\n\t\t\tset(tmp, k, Object.getOwnPropertyDescriptor(x, k));\n\t\t}\n\t}\n\n\treturn tmp || x;\n}\n\nfunction isSpace(character) {\n return character == \" \" || character == \"\\n\" || character == \"\\r\" || character == \"\\t\";\n}\nfunction isQuote(character) {\n return character == '\"' || character == \"'\";\n}\nconst TAG_START = \"<\";\nconst TAG_END = \">\";\nconst ENCODED_TAG_START = \"<\";\nconst ENCODED_TAG_END = \">\";\nclass InPlaintextState {\n constructor(options) {\n this.options = options;\n }\n consume(character, transition) {\n if (character == TAG_START) {\n transition(new InTagNameState(this.options));\n return \"\";\n }\n else if (character == TAG_END && this.options.encodePlaintextTagDelimiters) {\n return ENCODED_TAG_END;\n }\n return character;\n }\n}\nclass InTagNameState {\n constructor(options) {\n this.options = options;\n this.nameBuffer = \"\";\n this.isClosingTag = false;\n }\n consume(character, transition) {\n if (this.nameBuffer.length == 0) {\n if (isSpace(character)) {\n transition(new InPlaintextState(this.options));\n return ((this.options.encodePlaintextTagDelimiters ? ENCODED_TAG_START : \"<\") +\n character);\n }\n if (character == \"/\") {\n this.isClosingTag = true;\n return \"\";\n }\n }\n if (isSpace(character)) {\n if (this.isNameBufferAnAllowedTag()) {\n transition(new InTagState(0 /* TagMode.Allowed */, this.options));\n return TAG_START + (this.isClosingTag ? \"/\" : \"\") + this.nameBuffer + character;\n }\n else {\n transition(new InTagState(1 /* TagMode.Disallowed */, this.options));\n return this.options.tagReplacementText;\n }\n }\n if (character == TAG_START) {\n this.nameBuffer += ENCODED_TAG_START;\n return \"\";\n }\n if (character == TAG_END) {\n transition(new InPlaintextState(this.options));\n if (this.isNameBufferAnAllowedTag()) {\n return TAG_START + (this.isClosingTag ? \"/\" : \"\") + this.nameBuffer + character;\n }\n else {\n return this.options.tagReplacementText;\n }\n }\n if (character == \"-\" && this.nameBuffer == \"!-\") {\n transition(new InCommentState(this.options));\n return \"\";\n }\n this.nameBuffer += character;\n return \"\";\n }\n isNameBufferAnAllowedTag() {\n const tagName = this.nameBuffer.toLowerCase();\n if (this.options.allowedTags) {\n return this.options.allowedTags.has(tagName);\n }\n else if (this.options.disallowedTags) {\n return !this.options.disallowedTags.has(tagName);\n }\n else {\n return false;\n }\n }\n}\nclass InTagState {\n constructor(mode, options) {\n this.mode = mode;\n this.options = options;\n }\n consume(character, transition) {\n if (character == TAG_END) {\n transition(new InPlaintextState(this.options));\n }\n else if (isQuote(character)) {\n transition(new InQuotedStringInTagState(this.mode, character, this.options));\n }\n if (this.mode == 1 /* TagMode.Disallowed */) {\n return \"\";\n }\n if (character == TAG_START) {\n return ENCODED_TAG_START;\n }\n else {\n return character;\n }\n }\n}\nclass InQuotedStringInTagState {\n constructor(mode, quoteCharacter, options) {\n this.mode = mode;\n this.quoteCharacter = quoteCharacter;\n this.options = options;\n }\n consume(character, transition) {\n if (character == this.quoteCharacter) {\n transition(new InTagState(this.mode, this.options));\n }\n if (this.mode == 1 /* TagMode.Disallowed */) {\n return \"\";\n }\n if (character == TAG_START) {\n return ENCODED_TAG_START;\n }\n else if (character == TAG_END) {\n return ENCODED_TAG_END;\n }\n else {\n return character;\n }\n }\n}\nclass InCommentState {\n constructor(options) {\n this.options = options;\n this.consecutiveHyphens = 0;\n }\n consume(character, transition) {\n if (character == \">\" && this.consecutiveHyphens >= 2) {\n transition(new InPlaintextState(this.options));\n }\n else if (character == \"-\") {\n this.consecutiveHyphens++;\n }\n else {\n this.consecutiveHyphens = 0;\n }\n return \"\";\n }\n}\n\nconst DefaultStateMachineOptions = {\n tagReplacementText: \"\",\n encodePlaintextTagDelimiters: true,\n};\nclass StateMachine {\n constructor(partialOptions = {}) {\n this.state = new InPlaintextState(Object.assign(Object.assign({}, DefaultStateMachineOptions), partialOptions));\n this.transitionFunction = ((next) => {\n this.state = next;\n }).bind(this);\n }\n consume(text) {\n let outputBuffer = \"\";\n for (const character of text) {\n outputBuffer += this.state.consume(character, this.transitionFunction);\n }\n return outputBuffer;\n }\n}\nfunction striptags(text, options = {}) {\n return new StateMachine(options).consume(text);\n}\n\n/**\n * Attempts to create a Foundry UUID from standard drop data. This may not work for all systems.\n *\n * @param {object} data - Drop transfer data.\n *\n * @param {ParseDataTransferOptions} opts - Optional parameters.\n *\n * @returns {string|undefined} Foundry UUID for drop data.\n */\nfunction getUUIDFromDataTransfer(data, { actor = true, compendium = true, world = true, types = void 0 } = {})\n{\n if (typeof data !== 'object') { return void 0; }\n if (Array.isArray(types) && !types.includes(data.type)) { return void 0; }\n\n let uuid = void 0;\n\n if (typeof data.uuid === 'string') // v10 and above provides a full UUID.\n {\n const isCompendium = data.uuid.startsWith('Compendium');\n\n if (isCompendium && compendium)\n {\n uuid = data.uuid;\n }\n else if (world)\n {\n uuid = data.uuid;\n }\n }\n else // v9 and below parsing.\n {\n if (actor && world && data.actorId && data.type)\n {\n uuid = `Actor.${data.actorId}.${data.type}.${data.data._id}`;\n }\n else if (typeof data.id === 'string') // v9 and below uses `id`\n {\n if (compendium && typeof data.pack === 'string')\n {\n uuid = `Compendium.${data.pack}.${data.id}`;\n }\n else if (world)\n {\n uuid = `${data.type}.${data.id}`;\n }\n }\n }\n\n return uuid;\n}\n\nexport { A11yHelper, ClipboardAccess, ManagedPromise, StyleManager, debounce, deepMerge, getStackingContext, getUUIDFromDataTransfer, hasAccessor, hasGetter, hasPrototype, hasSetter, hashCode, isApplicationShell, isHMRProxy, isIterable, isIterableAsync, isObject, isPlainObject, isSvelteComponent, klona, normalizeString, outroAndDestroy, parseSvelteConfig, safeAccess, safeSet, striptags, styleParsePixels, uuidv4 };\n//# sourceMappingURL=index.js.map\n","import { noop, safe_not_equal, subscribe, run_all, is_function } from '../internal/index.mjs';\nexport { get_store_value as get } from '../internal/index.mjs';\n\nconst subscriber_queue = [];\n/**\n * Creates a `Readable` store that allows reading by subscription.\n * @param value initial value\n * @param {StartStopNotifier}start start and stop notifications for subscriptions\n */\nfunction readable(value, start) {\n return {\n subscribe: writable(value, start).subscribe\n };\n}\n/**\n * Create a `Writable` store that allows both updating and reading by subscription.\n * @param {*=}value initial value\n * @param {StartStopNotifier=}start start and stop notifications for subscriptions\n */\nfunction writable(value, start = noop) {\n let stop;\n const subscribers = new Set();\n function set(new_value) {\n if (safe_not_equal(value, new_value)) {\n value = new_value;\n if (stop) { // store is ready\n const run_queue = !subscriber_queue.length;\n for (const subscriber of subscribers) {\n subscriber[1]();\n subscriber_queue.push(subscriber, value);\n }\n if (run_queue) {\n for (let i = 0; i < subscriber_queue.length; i += 2) {\n subscriber_queue[i][0](subscriber_queue[i + 1]);\n }\n subscriber_queue.length = 0;\n }\n }\n }\n }\n function update(fn) {\n set(fn(value));\n }\n function subscribe(run, invalidate = noop) {\n const subscriber = [run, invalidate];\n subscribers.add(subscriber);\n if (subscribers.size === 1) {\n stop = start(set) || noop;\n }\n run(value);\n return () => {\n subscribers.delete(subscriber);\n if (subscribers.size === 0) {\n stop();\n stop = null;\n }\n };\n }\n return { set, update, subscribe };\n}\nfunction derived(stores, fn, initial_value) {\n const single = !Array.isArray(stores);\n const stores_array = single\n ? [stores]\n : stores;\n const auto = fn.length < 2;\n return readable(initial_value, (set) => {\n let inited = false;\n const values = [];\n let pending = 0;\n let cleanup = noop;\n const sync = () => {\n if (pending) {\n return;\n }\n cleanup();\n const result = fn(single ? values[0] : values, set);\n if (auto) {\n set(result);\n }\n else {\n cleanup = is_function(result) ? result : noop;\n }\n };\n const unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => {\n values[i] = value;\n pending &= ~(1 << i);\n if (inited) {\n sync();\n }\n }, () => {\n pending |= (1 << i);\n }));\n inited = true;\n sync();\n return function stop() {\n run_all(unsubscribers);\n cleanup();\n };\n });\n}\n\nexport { derived, readable, writable };\n","import { isIterable, uuidv4, isPlainObject, getUUIDFromDataTransfer, isObject, hasPrototype } from '@typhonjs-fvtt/runtime/svelte/util';\nimport { writable as writable$2, derived, get } from 'svelte/store';\nimport { noop, run_all, is_function } from 'svelte/internal';\n\nclass DynReducerUtils {\n /**\n * Checks for array equality between two arrays of numbers.\n *\n * @param a - Array A\n *\n * @param b - Array B\n *\n * @returns Arrays are equal.\n */\n static arrayEquals(a, b) {\n if (a === b) {\n return true;\n }\n if (a === null || b === null) {\n return false;\n }\n /* c8 ignore next */\n if (a.length !== b.length) {\n return false;\n }\n for (let cntr = a.length; --cntr >= 0;) {\n /* c8 ignore next */\n if (a[cntr] !== b[cntr]) {\n return false;\n }\n }\n return true;\n }\n /**\n * Provides a solid string hashing algorithm.\n *\n * Sourced from: https://stackoverflow.com/a/52171480\n *\n * @param str - String to hash.\n *\n * @param seed - A seed value altering the hash.\n *\n * @returns Hash code.\n */\n static hashString(str, seed = 0) {\n let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\n for (let ch, i = 0; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n }\n /**\n * Converts an unknown value for hashing purposes in {@link AdapterIndexer.calcHashUpdate}.\n *\n * Currently objects / Map w/ object keys is not supported. Potentially can include `object-hash` to handle this\n * case, but it is not common to use objects as keys in Maps.\n *\n * @param value - An unknown value to convert to a number.\n */\n static hashUnknown(value) {\n if (value === null || value === void 0) {\n return 0;\n }\n let result = 0;\n switch (typeof value) {\n case 'boolean':\n result = value ? 1 : 0;\n break;\n case 'bigint':\n result = Number(BigInt.asIntN(64, value));\n break;\n case 'function':\n result = this.hashString(value.name);\n break;\n case 'number':\n result = Number.isFinite(value) ? value : 0;\n break;\n case 'object':\n // TODO: consider hashing an object IE `object-hash` and convert to number.\n break;\n case 'string':\n result = this.hashString(value);\n break;\n case 'symbol':\n result = this.hashString(Symbol.keyFor(value));\n break;\n }\n return result;\n }\n /**\n * @param target -\n *\n * @param Prototype -\n *\n * @returns target constructor function has Prototype.\n */\n static hasPrototype(target, Prototype) {\n /* c8 ignore next */\n if (typeof target !== 'function') {\n return false;\n }\n if (target === Prototype) {\n return true;\n }\n // Walk parent prototype chain. Check for descriptor at each prototype level.\n for (let proto = Object.getPrototypeOf(target); proto; proto = Object.getPrototypeOf(proto)) {\n if (proto === Prototype) {\n return true;\n }\n }\n return false;\n }\n /**\n * Provides a utility method to determine if the given data is iterable / implements iterator protocol.\n *\n * @param data - Data to verify as iterable.\n *\n * @returns Is data iterable.\n */\n static isIterable(data) {\n return data !== null && data !== void 0 && typeof data === 'object' &&\n typeof data[Symbol.iterator] === 'function';\n }\n}\n\n/**\n * Provides the `derived` API for all dynamic reducers.\n */\nclass AdapterDerived {\n #hostData;\n #DerivedReducerCtor;\n #parentIndex;\n #derived = new Map();\n #destroyed = false;\n /**\n * @param hostData - Hosted data structure.\n *\n * @param parentIndex - Any associated parent index API.\n *\n * @param DerivedReducerCtor - The default derived reducer constructor function.\n */\n constructor(hostData, parentIndex, DerivedReducerCtor) {\n this.#hostData = hostData;\n this.#parentIndex = parentIndex;\n this.#DerivedReducerCtor = DerivedReducerCtor;\n Object.freeze(this);\n }\n /**\n * Creates a new derived reducer.\n *\n * @param options - Options defining the new derived reducer.\n *\n * @returns Newly created derived reducer.\n */\n create(options) {\n if (this.#destroyed) {\n throw Error(`AdapterDerived.create error: this instance has been destroyed.`);\n }\n let name;\n let rest = {};\n let ctor;\n const DerivedReducerCtor = this.#DerivedReducerCtor;\n if (typeof options === 'string') {\n name = options;\n ctor = DerivedReducerCtor;\n }\n else if (typeof options === 'function' && DynReducerUtils.hasPrototype(options, DerivedReducerCtor)) {\n ctor = options;\n }\n else if (typeof options === 'object' && options !== null) {\n ({ name, ctor = DerivedReducerCtor, ...rest } = options);\n }\n else {\n throw new TypeError(`AdapterDerived.create error: 'options' does not conform to allowed parameters.`);\n }\n if (!DynReducerUtils.hasPrototype(ctor, DerivedReducerCtor)) {\n throw new TypeError(`AdapterDerived.create error: 'ctor' is not a '${DerivedReducerCtor?.name}'.`);\n }\n name = name ?? ctor?.name;\n if (typeof name !== 'string') {\n throw new TypeError(`AdapterDerived.create error: 'name' is not a string.`);\n }\n const derivedReducer = new ctor(this.#hostData, this.#parentIndex, rest);\n this.#derived.set(name, derivedReducer);\n return derivedReducer;\n }\n /**\n * Removes all derived reducers and associated subscriptions.\n */\n clear() {\n if (this.#destroyed) {\n return;\n }\n for (const reducer of this.#derived.values()) {\n reducer.destroy();\n }\n this.#derived.clear();\n }\n /**\n * Deletes and destroys a derived reducer by name.\n *\n * @param name - Name of the derived reducer.\n */\n delete(name) {\n if (this.#destroyed) {\n throw Error(`AdapterDerived.delete error: this instance has been destroyed.`);\n }\n const reducer = this.#derived.get(name);\n if (reducer) {\n reducer.destroy();\n }\n return this.#derived.delete(name);\n }\n /**\n * Removes all derived reducers, subscriptions, and cleans up all resources.\n */\n destroy() {\n if (this.#destroyed) {\n return;\n }\n this.clear();\n this.#hostData = [null];\n this.#parentIndex = null;\n this.#destroyed = true;\n }\n /**\n * Returns an existing derived reducer.\n *\n * @param name - Name of derived reducer.\n */\n get(name) {\n if (this.#destroyed) {\n throw Error(`AdapterDerived.get error: this instance has been destroyed.`);\n }\n return this.#derived.get(name);\n }\n /**\n * Updates all managed derived reducer indexes.\n *\n * @param [force] - Force an update to subscribers.\n */\n update(force = false) {\n if (this.#destroyed) {\n return;\n }\n for (const reducer of this.#derived.values()) {\n reducer.index.update(force);\n }\n }\n}\n\n/**\n * Provides the storage and sequencing of managed filters. Each filter added may be a bespoke function or a\n * {@link DataFilter} object containing an `id`, `filter`, and `weight` attributes; `filter` is the only required\n * attribute.\n *\n * The `id` attribute can be anything that creates a unique ID for the filter; recommended strings or numbers. This\n * allows filters to be removed by ID easily.\n *\n * The `weight` attribute is a number between 0 and 1 inclusive that allows filters to be added in a\n * predictable order which is especially handy if they are manipulated at runtime. A lower weighted filter always runs\n * before a higher weighted filter. For speed and efficiency always set the heavier / more inclusive filter with a\n * lower weight; an example of this is a keyword / name that will filter out many entries making any further filtering\n * faster. If no weight is specified the default of '1' is assigned and it is appended to the end of the filters list.\n *\n * This class forms the public API which is accessible from the `.filters` getter in the main reducer implementation.\n * ```\n * const dynArray = new DynArrayReducer([...]);\n * dynArray.filters.add(...);\n * dynArray.filters.clear();\n * dynArray.filters.length;\n * dynArray.filters.remove(...);\n * dynArray.filters.removeBy(...);\n * dynArray.filters.removeById(...);\n * ```\n */\nclass AdapterFilters {\n #filtersData;\n #indexUpdate;\n #mapUnsubscribe = new Map();\n /**\n * @param indexUpdate - update function for the indexer.\n *\n * @param filtersAdapter - Stores the filter function data.\n */\n constructor(indexUpdate, filtersAdapter) {\n this.#indexUpdate = indexUpdate;\n this.#filtersData = filtersAdapter;\n Object.freeze(this);\n }\n /**\n * @returns Returns the length of the filter data.\n */\n get length() { return this.#filtersData.filters.length; }\n /**\n * Provides an iterator for filters.\n *\n * @returns Generator / iterator of filters.\n * @yields {DataFilter}\n */\n *[Symbol.iterator]() {\n if (this.#filtersData.filters.length === 0) {\n return;\n }\n for (const entry of this.#filtersData.filters) {\n yield { ...entry };\n }\n }\n /**\n * @param filters -\n */\n add(...filters) {\n /**\n * Tracks the number of filters added that have subscriber functionality.\n */\n let subscribeCount = 0;\n for (const filter of filters) {\n const filterType = typeof filter;\n if (filterType !== 'function' && (filterType !== 'object' || filter === null)) {\n throw new TypeError(`AdapterFilters error: 'filter' is not a function or object.`);\n }\n let data = void 0;\n let subscribeFn = void 0;\n if (filterType === 'function') {\n data = {\n id: void 0,\n filter,\n weight: 1\n };\n subscribeFn = filter.subscribe;\n }\n else if (filterType === 'object') {\n if ('filter' in filter) {\n if (typeof filter.filter !== 'function') {\n throw new TypeError(`AdapterFilters error: 'filter' attribute is not a function.`);\n }\n if (filter.weight !== void 0 && typeof filter.weight !== 'number' ||\n (filter.weight < 0 || filter.weight > 1)) {\n throw new TypeError(`AdapterFilters error: 'weight' attribute is not a number between '0 - 1' inclusive.`);\n }\n data = {\n id: filter.id !== void 0 ? filter.id : void 0,\n filter: filter.filter,\n weight: filter.weight || 1\n };\n subscribeFn = filter.filter.subscribe ?? filter.subscribe;\n }\n else {\n throw new TypeError(`AdapterFilters error: 'filter' attribute is not a function.`);\n }\n }\n // Find the index to insert where data.weight is less than existing values weight.\n const index = this.#filtersData.filters.findIndex((value) => {\n return data.weight < value.weight;\n });\n // If an index was found insert at that location.\n if (index >= 0) {\n this.#filtersData.filters.splice(index, 0, data);\n }\n else // push to end of filters.\n {\n this.#filtersData.filters.push(data);\n }\n if (typeof subscribeFn === 'function') {\n const unsubscribe = subscribeFn(this.#indexUpdate);\n // Ensure that unsubscribe is a function.\n if (typeof unsubscribe !== 'function') {\n throw new TypeError('AdapterFilters error: Filter has subscribe function, but no unsubscribe function is returned.');\n }\n // Ensure that the same filter is not subscribed to multiple times.\n if (this.#mapUnsubscribe.has(data.filter)) {\n throw new Error('AdapterFilters error: Filter added already has an unsubscribe function registered.');\n }\n this.#mapUnsubscribe.set(data.filter, unsubscribe);\n subscribeCount++;\n }\n }\n // Filters with subscriber functionality are assumed to immediately invoke the `subscribe` callback. If the\n // subscriber count is less than the amount of filters added then automatically trigger an index update manually.\n if (subscribeCount < filters.length) {\n this.#indexUpdate();\n }\n }\n /**\n * Clears and removes all filters.\n */\n clear() {\n this.#filtersData.filters.length = 0;\n // Unsubscribe from all filters with subscription support.\n for (const unsubscribe of this.#mapUnsubscribe.values()) {\n unsubscribe();\n }\n this.#mapUnsubscribe.clear();\n this.#indexUpdate();\n }\n /**\n * @param filters -\n */\n remove(...filters) {\n const length = this.#filtersData.filters.length;\n if (length === 0) {\n return;\n }\n for (const data of filters) {\n // Handle the case that the filter may either be a function or a filter entry / object.\n const actualFilter = typeof data === 'function' ? data : data !== null && typeof data === 'object' ?\n data.filter : void 0;\n if (!actualFilter) {\n continue;\n }\n for (let cntr = this.#filtersData.filters.length; --cntr >= 0;) {\n if (this.#filtersData.filters[cntr].filter === actualFilter) {\n this.#filtersData.filters.splice(cntr, 1);\n // Invoke any unsubscribe function for given filter then remove from tracking.\n let unsubscribe = void 0;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(actualFilter)) === 'function') {\n unsubscribe();\n this.#mapUnsubscribe.delete(actualFilter);\n }\n }\n }\n }\n // Update the index a filter was removed.\n if (length !== this.#filtersData.filters.length) {\n this.#indexUpdate();\n }\n }\n /**\n * Remove filters by the provided callback. The callback takes 3 parameters: `id`, `filter`, and `weight`.\n * Any truthy value returned will remove that filter.\n *\n * @param callback - Callback function to evaluate each filter entry.\n */\n removeBy(callback) {\n const length = this.#filtersData.filters.length;\n if (length === 0) {\n return;\n }\n if (typeof callback !== 'function') {\n throw new TypeError(`AdapterFilters error: 'callback' is not a function.`);\n }\n this.#filtersData.filters = this.#filtersData.filters.filter((data) => {\n const remove = callback.call(callback, { ...data });\n if (remove) {\n let unsubscribe;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.filter)) === 'function') {\n unsubscribe();\n this.#mapUnsubscribe.delete(data.filter);\n }\n }\n // Reverse remove boolean to properly filter / remove this filter.\n return !remove;\n });\n if (length !== this.#filtersData.filters.length) {\n this.#indexUpdate();\n }\n }\n /**\n * @param ids - Removes filters by ID.\n */\n removeById(...ids) {\n const length = this.#filtersData.filters.length;\n if (length === 0) {\n return;\n }\n this.#filtersData.filters = this.#filtersData.filters.filter((data) => {\n let remove = 0;\n for (const id of ids) {\n remove |= (data.id === id ? 1 : 0);\n }\n // If not keeping invoke any unsubscribe function for given filter then remove from tracking.\n if (!!remove) {\n let unsubscribe;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.filter)) === 'function') {\n unsubscribe();\n this.#mapUnsubscribe.delete(data.filter);\n }\n }\n return !remove; // Swap here to actually remove the item via array filter method.\n });\n if (length !== this.#filtersData.filters.length) {\n this.#indexUpdate();\n }\n }\n}\n\n/**\n * Provides construction and management of indexed data when there are parent indexes or filter / sort functions\n * applied.\n */\nclass AdapterIndexer {\n derivedAdapter;\n filtersData;\n hostData;\n hostUpdate;\n indexData;\n sortData;\n sortFn;\n destroyed = false;\n /**\n * @param hostData - Hosted data structure.\n *\n * @param hostUpdate - Host update function invoked on index updates.\n *\n * @param [parentIndexer] - Any associated parent index API.\n *\n * @returns Indexer adapter instance.\n */\n constructor(hostData, hostUpdate, parentIndexer) {\n this.hostData = hostData;\n this.hostUpdate = hostUpdate;\n this.indexData = { index: null, hash: null, reversed: false, parent: parentIndexer };\n }\n /**\n * @returns Returns whether the index is active.\n */\n get active() {\n return this.filtersData.filters.length > 0 || this.sortData.compareFn !== null ||\n this.indexData.parent?.active === true;\n }\n /**\n * @returns Returns length of reduced index.\n */\n get length() {\n return this.indexData.index ? this.indexData.index.length : 0;\n }\n /* c8 ignore start */\n /**\n * @returns Returns reversed state.\n */\n get reversed() { return this.indexData.reversed; }\n /* c8 ignore end */\n /**\n * @param reversed - New reversed state.\n */\n set reversed(reversed) { this.indexData.reversed = reversed; }\n // -------------------------------------------------------------------------------------------------------------------\n /**\n * Calculates a new hash value for the new index array if any. If the new index array is null then the hash value\n * is set to null. Set calculated new hash value to the index adapter hash value.\n *\n * After hash generation compare old and new hash values and perform an update if they are different. If they are\n * equal check for array equality between the old and new index array and perform an update if they are not equal.\n *\n * @param oldIndex - Old index array.\n *\n * @param oldHash - Old index hash value.\n *\n * @param [force=false] - When true forces an update to subscribers.\n */\n calcHashUpdate(oldIndex, oldHash, force = false) {\n // Use force if a boolean otherwise default to false.\n const actualForce = typeof force === 'boolean' ? force : /* c8 ignore next */ false;\n let newHash = null;\n const newIndex = this.indexData.index;\n if (newIndex) {\n for (let cntr = newIndex.length; --cntr >= 0;) {\n newHash ^= DynReducerUtils.hashUnknown(newIndex[cntr]) + 0x9e3779b9 + (newHash << 6) + (newHash >> 2);\n }\n }\n this.indexData.hash = newHash;\n if (actualForce || (oldHash === newHash ? !DynReducerUtils.arrayEquals(oldIndex, newIndex) : true)) {\n this.hostUpdate();\n }\n }\n /**\n * Destroys all resources.\n */\n destroy() {\n if (this.destroyed) {\n return;\n }\n this.indexData.index = null;\n this.indexData.hash = null;\n this.indexData.reversed = null;\n this.indexData.parent = null;\n this.destroyed = true;\n }\n /**\n * Store associated filter and sort data that are constructed after the indexer.\n *\n * @param filtersData - Associated AdapterFilters instance.\n *\n * @param sortData - Associated AdapterSort instance.\n *\n * @param derivedAdapter - Associated AdapterDerived instance.\n */\n initAdapters(filtersData, sortData, derivedAdapter) {\n this.filtersData = filtersData;\n this.sortData = sortData;\n this.derivedAdapter = derivedAdapter;\n this.sortFn = this.createSortFn();\n }\n}\n\n/**\n * Provides the storage and sequencing of a managed sort function. The sort function set may be a bespoke function or a\n * {@link DataSort} object containing an `compare`, and `subscribe` attributes; `compare` is the only required\n * attribute.\n *\n * Note: You can set a compare function that also has a subscribe function attached as the `subscribe` attribute.\n * If a subscribe function is provided the sort function can notify any updates that may change sort order and this\n * triggers an index update.\n *\n * This class forms the public API which is accessible from the `.sort` getter in the main reducer implementation.\n * ```\n * const dynArray = new DynArrayReducer([...]);\n * dynArray.sort.clear();\n * dynArray.sort.set(...);\n * ```\n */\nclass AdapterSort {\n #sortData;\n #indexUpdate;\n #unsubscribe;\n /**\n * @param indexUpdate - Function to update indexer.\n *\n * @param sortData - Storage for compare function.\n */\n constructor(indexUpdate, sortData) {\n this.#indexUpdate = indexUpdate;\n this.#sortData = sortData;\n Object.freeze(this);\n }\n /**\n * Clears & removes any assigned sort function and triggers an index update.\n */\n clear() {\n const oldCompareFn = this.#sortData.compareFn;\n this.#sortData.compareFn = null;\n if (typeof this.#unsubscribe === 'function') {\n this.#unsubscribe();\n this.#unsubscribe = void 0;\n }\n // Only update index if an old compare function is set.\n if (typeof oldCompareFn === 'function') {\n this.#indexUpdate();\n }\n }\n /**\n * @param data - A callback function that compares two values. Return > 0 to sort b before a;\n * < 0 to sort a before b; or 0 to keep original order of a & b.\n *\n * Note: You can set a compare function that also has a subscribe function attached as the `subscribe` attribute.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#parameters\n */\n set(data) {\n if (typeof this.#unsubscribe === 'function') {\n this.#unsubscribe();\n this.#unsubscribe = void 0;\n }\n let compareFn = void 0;\n let subscribeFn = void 0;\n switch (typeof data) {\n case 'function':\n compareFn = data;\n subscribeFn = data.subscribe;\n break;\n case 'object':\n // Early out if data is null / noop.\n if (data === null) {\n break;\n }\n if (typeof data.compare !== 'function') {\n throw new TypeError(`AdapterSort error: 'compare' attribute is not a function.`);\n }\n compareFn = data.compare;\n subscribeFn = data.compare.subscribe ?? data.subscribe;\n break;\n }\n if (typeof compareFn === 'function') {\n this.#sortData.compareFn = compareFn;\n }\n else {\n const oldCompareFn = this.#sortData.compareFn;\n this.#sortData.compareFn = null;\n // Update index if the old compare function exists.\n if (typeof oldCompareFn === 'function') {\n this.#indexUpdate();\n }\n return;\n }\n if (typeof subscribeFn === 'function') {\n this.#unsubscribe = subscribeFn(this.#indexUpdate);\n // Ensure that unsubscribe is a function.\n if (typeof this.#unsubscribe !== 'function') {\n throw new Error(`AdapterSort error: sort has 'subscribe' function, but no 'unsubscribe' function is returned.`);\n }\n }\n else {\n // A sort function with subscriber functionality are assumed to immediately invoke the `subscribe` callback.\n // Only manually update the index if there is no subscriber functionality.\n this.#indexUpdate();\n }\n }\n}\n\n/**\n * Provides the public API for accessing the index API.\n *\n * This class forms the public API which is accessible from the `.index` getter in the main reducer implementation.\n * ```\n * const dynArray = new DynArrayReducer([...]);\n * dynArray.index.active;\n * dynArray.index.hash;\n * dynArray.index.length;\n * dynArray.index.update(...);\n * ```\n */\nclass IndexerAPI {\n #indexData;\n /**\n * Provides a getter to determine if the index is active.\n */\n active;\n /**\n * Provides length of reduced / indexed elements.\n */\n length;\n /**\n * Manually invoke an update of the index.\n *\n * @param force - Force update to any subscribers.\n */\n update;\n constructor(adapterIndexer) {\n this.#indexData = adapterIndexer.indexData;\n this.update = adapterIndexer.update.bind(adapterIndexer);\n // Defines getters on the public API to get the index hash, active state, and index length.\n Object.defineProperties(this, {\n active: { get: () => adapterIndexer.active },\n length: { get: () => adapterIndexer.length }\n });\n Object.freeze(this);\n }\n /**\n * - Current hash value of the index.\n */\n get hash() {\n return this.#indexData.hash;\n }\n /**\n * Provides an iterator over the index array.\n *\n * @returns Iterator / generator\n * @yields {K}\n */\n *[Symbol.iterator]() {\n const indexData = this.#indexData;\n if (!indexData.index) {\n return;\n }\n const reversed = indexData.reversed;\n const length = indexData.index.length;\n if (reversed) {\n for (let cntr = length; --cntr >= 0;) {\n yield indexData.index[cntr];\n }\n }\n else {\n for (let cntr = 0; cntr < length; cntr++) {\n yield indexData.index[cntr];\n }\n }\n }\n}\n\n/**\n * Provides the public API for derived reducers. There are several ways to create a derived reducer from utilizing the\n * default implementation or passing in a constructor function / class for a custom derived reducer.\n *\n * This class forms the public API which is accessible from the `.derived` getter in the main reducer implementation.\n * ```\n * const dynArray = new DynArrayReducer([...]);\n * dynArray.derived.clear();\n * dynArray.derived.create(...);\n * dynArray.derived.delete(...);\n * dynArray.derived.destroy();\n * dynArray.derived.get(...);\n * ```\n */\nclass DerivedAPI {\n /**\n * Removes all derived reducers and associated subscriptions.\n */\n clear;\n /**\n * @param options - Options for creating a reducer.\n *\n * @returns Newly created derived reducer.\n */\n create;\n /**\n * Deletes and destroys a derived reducer.\n *\n * @param name - Name of the derived reducer\n */\n delete;\n /**\n * Removes all derived reducers, associated subscriptions, and cleans up all resources.\n */\n destroy;\n /**\n * Returns an existing derived reducer.\n *\n * @param name - Name of derived reducer.\n */\n get;\n constructor(adapterDerived) {\n this.clear = adapterDerived.clear.bind(adapterDerived);\n this.create = adapterDerived.create.bind(adapterDerived);\n this.delete = adapterDerived.delete.bind(adapterDerived);\n this.destroy = adapterDerived.destroy.bind(adapterDerived);\n this.get = adapterDerived.get.bind(adapterDerived);\n Object.freeze(this);\n }\n}\n\n/**\n */\nclass Indexer$1 extends AdapterIndexer {\n /**\n * @inheritDoc\n */\n createSortFn() {\n return (a, b) => this.sortData.compareFn(this.hostData[0][a], this.hostData[0][b]);\n }\n /**\n * Provides the custom filter / reduce step that is ~25-40% faster than implementing with `Array.reduce`.\n *\n * Note: Other loop unrolling techniques like Duff's Device gave a slight faster lower bound on large data sets,\n * but the maintenance factor is not worth the extra complication.\n *\n * @returns New filtered index array.\n */\n reduceImpl() {\n const data = [];\n const array = this.hostData[0];\n if (!array) {\n return data;\n }\n const filters = this.filtersData.filters;\n let include = true;\n const parentIndex = this.indexData.parent;\n // Source index data is coming from an active parent index.\n if (DynReducerUtils.isIterable(parentIndex) && parentIndex.active) {\n for (const adjustedIndex of parentIndex) {\n const value = array[adjustedIndex];\n include = true;\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\n if (!filters[filCntr].filter(value)) {\n include = false;\n break;\n }\n }\n if (include) {\n data.push(adjustedIndex);\n }\n }\n }\n else {\n for (let cntr = 0, length = array.length; cntr < length; cntr++) {\n include = true;\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\n if (!filters[filCntr].filter(array[cntr])) {\n include = false;\n break;\n }\n }\n if (include) {\n data.push(cntr);\n }\n }\n }\n return data;\n }\n /**\n * Update the reducer indexes. If there are changes subscribers are notified. If data order is changed externally\n * pass in true to force an update to subscribers.\n *\n * @param [force=false] - When true forces an update to subscribers.\n */\n update(force = false) {\n if (this.destroyed) {\n return;\n }\n const oldIndex = this.indexData.index;\n const oldHash = this.indexData.hash;\n const array = this.hostData[0];\n const parentIndex = this.indexData.parent;\n // Clear index if there are no filters and no sort function or the index length doesn't match the item length.\n if ((this.filtersData.filters.length === 0 && !this.sortData.compareFn) ||\n (this.indexData.index && array?.length !== this.indexData.index.length)) {\n this.indexData.index = null;\n }\n // If there are filters build new index.\n if (this.filtersData.filters.length > 0) {\n this.indexData.index = this.reduceImpl();\n }\n // If the index isn't built yet and there is an active parent index then create it from the parent.\n if (!this.indexData.index && parentIndex?.active) {\n this.indexData.index = [...parentIndex];\n }\n if (this.sortData.compareFn && Array.isArray(array)) {\n // If there is no index then create one with keys matching host item length.\n if (!this.indexData.index) {\n this.indexData.index = [...Array(array.length).keys()];\n }\n this.indexData.index.sort(this.sortFn);\n }\n this.calcHashUpdate(oldIndex, oldHash, force);\n // Update all derived reducers.\n this.derivedAdapter?.update(force);\n }\n}\n\n/**\n * Provides the base implementation derived reducer for arrays / DynArrayReducer.\n */\nclass DerivedArrayReducer {\n #array;\n #derived;\n #derivedPublicAPI;\n #filters;\n #filtersData = { filters: [] };\n #index;\n #indexPublicAPI;\n #reversed = false;\n #sort;\n #sortData = { compareFn: null };\n #subscriptions = [];\n #destroyed = false;\n /**\n * @param array - Data host array.\n *\n * @param parentIndex - Parent indexer.\n *\n * @param options - Any filters and sort functions to apply.\n */\n constructor(array, parentIndex, options) {\n this.#array = array;\n this.#index = new Indexer$1(this.#array, this.#updateSubscribers.bind(this), parentIndex);\n this.#indexPublicAPI = new IndexerAPI(this.#index);\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\n this.#derived = new AdapterDerived(this.#array, this.#indexPublicAPI, DerivedArrayReducer);\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\n let filters = void 0;\n let sort = void 0;\n if (options !== void 0 && ('filters' in options || 'sort' in options)) {\n if (options.filters !== void 0) {\n if (DynReducerUtils.isIterable(options.filters)) {\n filters = options.filters;\n }\n else {\n throw new TypeError(`DerivedArrayReducer error (DataDerivedOptions): 'filters' attribute is not iterable.`);\n }\n }\n if (options.sort !== void 0) {\n if (typeof options.sort === 'function') {\n sort = options.sort;\n }\n else if (typeof options.sort === 'object' && options.sort !== null) {\n sort = options.sort;\n }\n else {\n throw new TypeError(`DerivedArrayReducer error (DataDerivedOptions): 'sort' attribute is not a function or object.`);\n }\n }\n }\n // Add any filters and sort function defined by DataDynArray.\n if (filters) {\n this.filters.add(...filters);\n }\n if (sort) {\n this.sort.set(sort);\n }\n // Invoke an custom initialization for child classes.\n this.initialize();\n }\n /**\n * Returns the internal data of this instance. Be careful!\n *\n * Note: if an array is set as initial data then that array is used as the internal data. If any changes are\n * performed to the data externally do invoke {@link IndexerAPI.update} with `true` to recalculate the index and\n * notify all subscribers.\n *\n * @returns The internal data.\n */\n get data() { return this.#array[0]; }\n /**\n * @returns Derived public API.\n */\n get derived() { return this.#derivedPublicAPI; }\n /**\n * @returns The filters adapter.\n */\n get filters() { return this.#filters; }\n /**\n * Returns the Indexer public API.\n *\n * @returns Indexer API - is also iterable.\n */\n get index() { return this.#indexPublicAPI; }\n /**\n * Returns whether this derived reducer is destroyed.\n */\n get destroyed() { return this.#destroyed; }\n /**\n * @returns Main data / items length or indexed length.\n */\n get length() {\n const array = this.#array[0];\n return this.#index.active ? this.index.length :\n array ? array.length : 0;\n }\n /**\n * @returns Gets current reversed state.\n */\n get reversed() { return this.#reversed; }\n /**\n * @returns The sort adapter.\n */\n get sort() { return this.#sort; }\n /**\n * Sets reversed state and notifies subscribers.\n *\n * @param reversed - New reversed state.\n */\n set reversed(reversed) {\n if (typeof reversed !== 'boolean') {\n throw new TypeError(`DerivedArrayReducer.reversed error: 'reversed' is not a boolean.`);\n }\n this.#reversed = reversed;\n this.#index.reversed = reversed;\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Removes all derived reducers, subscriptions, and cleans up all resources.\n */\n destroy() {\n this.#destroyed = true;\n // Remove any external data reference and perform a final update.\n this.#array = [null];\n this.#index.update(true);\n // Remove all subscriptions.\n this.#subscriptions.length = 0;\n this.#derived.destroy();\n this.#index.destroy();\n this.#filters.clear();\n this.#sort.clear();\n }\n /**\n * Provides a callback for custom derived reducers to initialize any data / custom configuration. This allows\n * child classes to avoid implementing the constructor.\n *\n * @protected\n */\n initialize() { }\n /**\n * Provides an iterator for data stored in DerivedArrayReducer.\n *\n * @returns Generator / iterator of all data.\n */\n *[Symbol.iterator]() {\n const array = this.#array[0];\n if (this.#destroyed || array === null || array?.length === 0) {\n return;\n }\n if (this.#index.active) {\n for (const entry of this.index) {\n yield array[entry];\n }\n }\n else {\n if (this.reversed) {\n for (let cntr = array.length; --cntr >= 0;) {\n yield array[cntr];\n }\n }\n else {\n for (let cntr = 0; cntr < array.length; cntr++) {\n yield array[cntr];\n }\n }\n }\n }\n // -------------------------------------------------------------------------------------------------------------------\n /**\n * Subscribe to this DerivedArrayReducer.\n *\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\n *\n * @returns Unsubscribe function.\n */\n subscribe(handler) {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n handler(this); // call handler with current value\n // Return unsubscribe function.\n return () => {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) {\n this.#subscriptions.splice(index, 1);\n }\n };\n }\n /**\n * Updates subscribers on changes.\n */\n #updateSubscribers() {\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\n this.#subscriptions[cntr](this);\n }\n }\n}\n\n/**\n * Provides a managed array with non-destructive reducing / filtering / sorting capabilities with subscription /\n * Svelte store support.\n */\nclass DynArrayReducer {\n #array = [null];\n #derived;\n #derivedPublicAPI;\n #filters;\n #filtersData = { filters: [] };\n #index;\n #indexPublicAPI;\n #reversed = false;\n #sort;\n #sortData = { compareFn: null };\n #subscriptions = [];\n #destroyed = false;\n /**\n * Initializes DynArrayReducer. Any iterable is supported for initial data. Take note that if `data` is an array it\n * will be used as the host array and not copied. All non-array iterables otherwise create a new array / copy.\n *\n * @param [data] - Data iterable to store if array or copy otherwise.\n */\n constructor(data) {\n let dataIterable = void 0;\n let filters = void 0;\n let sort = void 0;\n if (data === null) {\n throw new TypeError(`DynArrayReducer error: 'data' is not iterable.`);\n }\n if (data !== void 0 && typeof data !== 'object' && !DynReducerUtils.isIterable(data)) {\n throw new TypeError(`DynArrayReducer error: 'data' is not iterable.`);\n }\n if (data !== void 0 && Symbol.iterator in data) {\n dataIterable = data;\n }\n else if (data !== void 0 && ('data' in data || 'filters' in data || 'sort' in data)) {\n if (data.data !== void 0 && !DynReducerUtils.isIterable(data.data)) {\n throw new TypeError(`DynArrayReducer error (DataDynArray): 'data' attribute is not iterable.`);\n }\n dataIterable = data.data;\n if (data.filters !== void 0) {\n if (DynReducerUtils.isIterable(data.filters)) {\n filters = data.filters;\n }\n else {\n throw new TypeError(`DynArrayReducer error (DataDynArray): 'filters' attribute is not iterable.`);\n }\n }\n if (data.sort !== void 0) {\n if (typeof data.sort === 'function') {\n sort = data.sort;\n }\n else if (typeof data.sort === 'object' && data.sort !== null) {\n sort = data.sort;\n }\n else {\n throw new TypeError(`DynArrayReducer error (DataDynArray): 'sort' attribute is not a function or object.`);\n }\n }\n }\n // In the case of the main data being an array directly use the array otherwise create a copy.\n if (dataIterable) {\n this.#array[0] = Array.isArray(dataIterable) ? dataIterable : [...dataIterable];\n }\n this.#index = new Indexer$1(this.#array, this.#updateSubscribers.bind(this));\n this.#indexPublicAPI = new IndexerAPI(this.#index);\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\n this.#derived = new AdapterDerived(this.#array, this.#indexPublicAPI, DerivedArrayReducer);\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\n // Add any filters and sort function defined by DataDynArray.\n if (filters) {\n this.filters.add(...filters);\n }\n if (sort) {\n this.sort.set(sort);\n }\n // Invoke an custom initialization for child classes.\n this.initialize();\n }\n /**\n * Returns the internal data of this instance. Be careful!\n *\n * Note: if an array is set as initial data then that array is used as the internal data. If any changes are\n * performed to the data externally do invoke {@link AdapterIndexer.index.update} with `true` to recalculate the\n * index and notify all subscribers.\n *\n * @returns The internal data.\n */\n get data() { return this.#array[0]; }\n /**\n * @returns Derived public API.\n */\n get derived() { return this.#derivedPublicAPI; }\n /**\n * @returns The filters adapter.\n */\n get filters() { return this.#filters; }\n /**\n * @returns Returns the Indexer public API.\n */\n get index() { return this.#indexPublicAPI; }\n /**\n * Returns whether this instance is destroyed.\n */\n get destroyed() { return this.#destroyed; }\n /**\n * Gets the main data / items length.\n *\n * @returns {number} Main data / items length.\n */\n get length() {\n const array = this.#array[0];\n return this.#index.active ? this.#indexPublicAPI.length :\n array ? array.length : 0;\n }\n /**\n * Gets current reversed state.\n *\n * @returns {boolean} Reversed state.\n */\n get reversed() { return this.#reversed; }\n /**\n * @returns The sort adapter.\n */\n get sort() { return this.#sort; }\n /**\n * Sets reversed state and notifies subscribers.\n *\n * @param reversed - New reversed state.\n */\n set reversed(reversed) {\n if (typeof reversed !== 'boolean') {\n throw new TypeError(`DynArrayReducer.reversed error: 'reversed' is not a boolean.`);\n }\n this.#reversed = reversed;\n this.#index.reversed = reversed;\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Removes all derived reducers, subscriptions, and cleans up all resources.\n */\n destroy() {\n if (this.#destroyed) {\n return;\n }\n this.#destroyed = true;\n this.#derived.destroy();\n // Set the backing data to null and provide a final update.\n this.#array = [null];\n this.index.update(true);\n // Remove all subscriptions.\n this.#subscriptions.length = 0;\n this.#index.destroy();\n this.#filters.clear();\n this.#sort.clear();\n }\n /**\n * Provides a callback for custom reducers to initialize any data / custom configuration. This allows\n * child classes to avoid implementing the constructor.\n *\n * @protected\n */\n initialize() { }\n /**\n * Removes internal data and pushes new data. This does not destroy any initial array set to internal data unless\n * `replace` is set to true.\n *\n * @param data - New data to set to internal data.\n *\n * @param replace=false - New data to set to internal data.\n */\n setData(data, replace = false) {\n if (data !== null && !DynReducerUtils.isIterable(data)) {\n throw new TypeError(`DynArrayReducer.setData error: 'data' is not iterable.`);\n }\n if (typeof replace !== 'boolean') {\n throw new TypeError(`DynArrayReducer.setData error: 'replace' is not a boolean.`);\n }\n const array = this.#array[0];\n // If the array isn't defined or 'replace' is true then replace internal data with new array or create an array\n // from an iterable.\n if (!Array.isArray(array) || replace) {\n if (data) {\n this.#array[0] = Array.isArray(data) ? data : [...data];\n }\n }\n else {\n if (data) {\n // Remove all entries in internal data. This will not replace any initially set array.\n array.length = 0;\n // Add all new data.\n array.push(...data);\n }\n else {\n this.#array[0] = null;\n }\n }\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Add a subscriber to this DynArrayReducer instance.\n *\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\n *\n * @returns Unsubscribe function.\n */\n subscribe(handler) {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n handler(this); // call handler with current value\n // Return unsubscribe function.\n return () => {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) {\n this.#subscriptions.splice(index, 1);\n }\n };\n }\n /**\n * Updates subscribers on changes.\n */\n #updateSubscribers() {\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\n this.#subscriptions[cntr](this);\n }\n }\n /**\n * Provides an iterator for data stored in DynArrayReducer.\n *\n * @returns Generator / iterator of all data.\n * @yields {T}\n */\n *[Symbol.iterator]() {\n const array = this.#array[0];\n if (this.#destroyed || array === null || array?.length === 0) {\n return;\n }\n if (this.#index.active) {\n for (const entry of this.index) {\n yield array[entry];\n }\n }\n else {\n if (this.reversed) {\n for (let cntr = array.length; --cntr >= 0;) {\n yield array[cntr];\n }\n }\n else {\n for (let cntr = 0; cntr < array.length; cntr++) {\n yield array[cntr];\n }\n }\n }\n }\n}\n\n/**\n */\nclass Indexer extends AdapterIndexer {\n /**\n * @inheritDoc\n */\n createSortFn() {\n return (a, b) => this.sortData.compareFn(this.hostData[0].get(a), this.hostData[0].get(b));\n }\n /**\n * Provides the custom filter / reduce step that is ~25-40% faster than implementing with `Array.reduce`.\n *\n * Note: Other loop unrolling techniques like Duff's Device gave a slight faster lower bound on large data sets,\n * but the maintenance factor is not worth the extra complication.\n *\n * @returns New filtered index array.\n */\n reduceImpl() {\n const data = [];\n const map = this.hostData[0];\n if (!map) {\n return data;\n }\n const filters = this.filtersData.filters;\n let include = true;\n const parentIndex = this.indexData.parent;\n // Source index data is coming from an active parent index.\n if (DynReducerUtils.isIterable(parentIndex) && parentIndex.active) {\n for (const key of parentIndex) {\n const value = map.get(key);\n include = true;\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\n if (!filters[filCntr].filter(value)) {\n include = false;\n break;\n }\n }\n if (include) {\n data.push(key);\n }\n }\n }\n else {\n for (const key of map.keys()) {\n include = true;\n const value = map.get(key);\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\n if (!filters[filCntr].filter(value)) {\n include = false;\n break;\n }\n }\n if (include) {\n data.push(key);\n }\n }\n }\n return data;\n }\n /**\n * Update the reducer indexes. If there are changes subscribers are notified. If data order is changed externally\n * pass in true to force an update to subscribers.\n *\n * @param [force=false] - When true forces an update to subscribers.\n */\n update(force = false) {\n if (this.destroyed) {\n return;\n }\n const oldIndex = this.indexData.index;\n const oldHash = this.indexData.hash;\n const map = this.hostData[0];\n const parentIndex = this.indexData.parent;\n // Clear index if there are no filters and no sort function or the index length doesn't match the item length.\n if ((this.filtersData.filters.length === 0 && !this.sortData.compareFn) ||\n (this.indexData.index && map?.size !== this.indexData.index.length)) {\n this.indexData.index = null;\n }\n // If there are filters build new index.\n if (this.filtersData.filters.length > 0) {\n this.indexData.index = this.reduceImpl();\n }\n // If the index isn't built yet and there is an active parent index then create it from the parent.\n if (!this.indexData.index && parentIndex?.active) {\n this.indexData.index = [...parentIndex];\n }\n if (this.sortData.compareFn && map instanceof Map) {\n // If there is no index then create one with keys matching host item length.\n if (!this.indexData.index) {\n this.indexData.index = this.indexData.index = [...map.keys()];\n }\n this.indexData.index.sort(this.sortFn);\n }\n this.calcHashUpdate(oldIndex, oldHash, force);\n // Update all derived reducers.\n this.derivedAdapter?.update(force);\n }\n}\n\n/**\n * Provides the base implementation derived reducer for arrays / DynArrayReducer.\n */\nclass DerivedMapReducer {\n #map;\n #derived;\n #derivedPublicAPI;\n #filters;\n #filtersData = { filters: [] };\n #index;\n #indexPublicAPI;\n #reversed = false;\n #sort;\n #sortData = { compareFn: null };\n #subscriptions = [];\n #destroyed = false;\n /**\n * @param map - Data host Map.\n *\n * @param parentIndex - Parent indexer.\n *\n * @param options - Any filters and sort functions to apply.\n */\n constructor(map, parentIndex, options) {\n this.#map = map;\n this.#index = new Indexer(this.#map, this.#updateSubscribers.bind(this), parentIndex);\n this.#indexPublicAPI = new IndexerAPI(this.#index);\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\n this.#derived = new AdapterDerived(this.#map, this.#indexPublicAPI, DerivedMapReducer);\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\n let filters = void 0;\n let sort = void 0;\n if (options !== void 0 && ('filters' in options || 'sort' in options)) {\n if (options.filters !== void 0) {\n if (DynReducerUtils.isIterable(options.filters)) {\n filters = options.filters;\n }\n else {\n throw new TypeError(`DerivedMapReducer error (DataDerivedOptions): 'filters' attribute is not iterable.`);\n }\n }\n if (options.sort !== void 0) {\n if (typeof options.sort === 'function') {\n sort = options.sort;\n }\n else if (typeof options.sort === 'object' && options.sort !== null) {\n sort = options.sort;\n }\n else {\n throw new TypeError(`DerivedMapReducer error (DataDerivedOptions): 'sort' attribute is not a function or object.`);\n }\n }\n }\n // Add any filters and sort function defined by DataDynArray.\n if (filters) {\n this.filters.add(...filters);\n }\n if (sort) {\n this.sort.set(sort);\n }\n // Invoke an custom initialization for child classes.\n this.initialize();\n }\n /**\n * Returns the internal data of this instance. Be careful!\n *\n * Note: The returned map is the same map set by the main reducer. If any changes are performed to the data\n * externally do invoke {@link IndexerAPI.update} with `true` to recalculate the index and notify all subscribers.\n *\n * @returns The internal data.\n */\n get data() { return this.#map[0]; }\n /**\n * @returns Derived public API.\n */\n get derived() { return this.#derivedPublicAPI; }\n /**\n * @returns The filters adapter.\n */\n get filters() { return this.#filters; }\n /**\n * Returns the Indexer public API.\n *\n * @returns Indexer API - is also iterable.\n */\n get index() { return this.#indexPublicAPI; }\n /**\n * Returns whether this derived reducer is destroyed.\n */\n get destroyed() { return this.#destroyed; }\n /**\n * @returns Main data / items length or indexed length.\n */\n get length() {\n const map = this.#map[0];\n return this.#index.active ? this.index.length :\n map ? map.size : 0;\n }\n /**\n * @returns Gets current reversed state.\n */\n get reversed() { return this.#reversed; }\n /**\n * @returns The sort adapter.\n */\n get sort() { return this.#sort; }\n /**\n * Sets reversed state and notifies subscribers.\n *\n * @param reversed - New reversed state.\n */\n set reversed(reversed) {\n if (typeof reversed !== 'boolean') {\n throw new TypeError(`DerivedMapReducer.reversed error: 'reversed' is not a boolean.`);\n }\n this.#reversed = reversed;\n this.#index.reversed = reversed;\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Removes all derived reducers, subscriptions, and cleans up all resources.\n */\n destroy() {\n this.#destroyed = true;\n // Remove any external data reference and perform a final update.\n this.#map = [null];\n this.#index.update(true);\n // Remove all subscriptions.\n this.#subscriptions.length = 0;\n this.#derived.destroy();\n this.#index.destroy();\n this.#filters.clear();\n this.#sort.clear();\n }\n /**\n * Provides a callback for custom derived reducers to initialize any data / custom configuration. This allows\n * child classes to avoid implementing the constructor.\n *\n * @protected\n */\n initialize() { }\n /**\n * Provides an iterator for data stored in DerivedMapReducer.\n *\n * @returns Generator / iterator of all data.\n */\n *[Symbol.iterator]() {\n const map = this.#map[0];\n if (this.#destroyed || map === null || map?.size === 0) {\n return;\n }\n if (this.#index.active) {\n for (const key of this.index) {\n yield map.get(key);\n }\n }\n else {\n if (this.reversed) {\n // TODO: Not efficient due to creating temporary values array.\n const values = [...map.values()];\n for (let cntr = values.length; --cntr >= 0;) {\n yield values[cntr];\n }\n }\n else {\n for (const value of map.values()) {\n yield value;\n }\n }\n }\n }\n // -------------------------------------------------------------------------------------------------------------------\n /**\n * Subscribe to this DerivedMapReducer.\n *\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\n *\n * @returns Unsubscribe function.\n */\n subscribe(handler) {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n handler(this); // call handler with current value\n // Return unsubscribe function.\n return () => {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) {\n this.#subscriptions.splice(index, 1);\n }\n };\n }\n /**\n * Updates subscribers on changes.\n */\n #updateSubscribers() {\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\n this.#subscriptions[cntr](this);\n }\n }\n}\n\n/**\n * Provides a managed Map with non-destructive reducing / filtering / sorting capabilities with subscription /\n * Svelte store support.\n */\nclass DynMapReducer {\n #map = [null];\n #derived;\n #derivedPublicAPI;\n #filters;\n #filtersData = { filters: [] };\n #index;\n #indexPublicAPI;\n #reversed = false;\n #sort;\n #sortData = { compareFn: null };\n #subscriptions = [];\n #destroyed = false;\n /**\n * Initializes DynMapReducer. Any iterable is supported for initial data. Take note that if `data` is an array it\n * will be used as the host array and not copied. All non-array iterables otherwise create a new array / copy.\n *\n * @param [data] - Data iterable to store if array or copy otherwise.\n */\n constructor(data) {\n let dataMap = void 0;\n let filters = void 0;\n let sort = void 0;\n if (data === null) {\n throw new TypeError(`DynMapReducer error: 'data' is not an object or Map.`);\n }\n if (data !== void 0 && typeof data !== 'object' && !(data instanceof Map)) {\n throw new TypeError(`DynMapReducer error: 'data' is not an object or Map.`);\n }\n if (data !== void 0 && data instanceof Map) {\n dataMap = data;\n }\n else if (data !== void 0 && ('data' in data || 'filters' in data || 'sort' in data)) {\n if (data.data !== void 0 && !(data.data instanceof Map)) {\n throw new TypeError(`DynMapReducer error (DataDynMap): 'data' attribute is not a Map.`);\n }\n dataMap = data.data;\n if (data.filters !== void 0) {\n if (DynReducerUtils.isIterable(data.filters)) {\n filters = data.filters;\n }\n else {\n throw new TypeError(`DynMapReducer error (DataDynMap): 'filters' attribute is not iterable.`);\n }\n }\n if (data.sort !== void 0) {\n if (typeof data.sort === 'function') {\n sort = data.sort;\n }\n else if (typeof data.sort === 'object' && data.sort !== null) {\n sort = data.sort;\n }\n else {\n throw new TypeError(`DynMapReducer error (DataDynMap): 'sort' attribute is not a function or object.`);\n }\n }\n }\n // In the case of the main data being an array directly use the array otherwise create a copy.\n if (dataMap) {\n this.#map[0] = dataMap;\n }\n this.#index = new Indexer(this.#map, this.#updateSubscribers.bind(this));\n this.#indexPublicAPI = new IndexerAPI(this.#index);\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\n this.#derived = new AdapterDerived(this.#map, this.#indexPublicAPI, DerivedMapReducer);\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\n // Add any filters and sort function defined by DataDynMap.\n if (filters) {\n this.filters.add(...filters);\n }\n if (sort) {\n this.sort.set(sort);\n }\n // Invoke an custom initialization for child classes.\n this.initialize();\n }\n /**\n * Returns the internal data of this instance. Be careful!\n *\n * Note: When a map is set as data then that map is used as the internal data. If any changes are\n * performed to the data externally do invoke {@link AdapterIndexer.index.update} with `true` to recalculate the\n * index and notify all subscribers.\n *\n * @returns The internal data.\n */\n get data() { return this.#map[0]; }\n /**\n * @returns Derived public API.\n */\n get derived() { return this.#derivedPublicAPI; }\n /**\n * @returns The filters adapter.\n */\n get filters() { return this.#filters; }\n /**\n * @returns Returns the Indexer public API.\n */\n get index() { return this.#indexPublicAPI; }\n /**\n * Returns whether this instance is destroyed.\n */\n get destroyed() { return this.#destroyed; }\n /**\n * Gets the main data / items length.\n *\n * @returns {number} Main data / items length.\n */\n get length() {\n const map = this.#map[0];\n return this.#index.active ? this.#indexPublicAPI.length :\n map ? map.size : 0;\n }\n /**\n * Gets current reversed state.\n *\n * @returns {boolean} Reversed state.\n */\n get reversed() { return this.#reversed; }\n /**\n * @returns The sort adapter.\n */\n get sort() { return this.#sort; }\n /**\n * Sets reversed state and notifies subscribers.\n *\n * @param reversed - New reversed state.\n */\n set reversed(reversed) {\n if (typeof reversed !== 'boolean') {\n throw new TypeError(`DynMapReducer.reversed error: 'reversed' is not a boolean.`);\n }\n this.#reversed = reversed;\n this.#index.reversed = reversed;\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Removes all derived reducers, subscriptions, and cleans up all resources.\n */\n destroy() {\n if (this.#destroyed) {\n return;\n }\n this.#destroyed = true;\n this.#derived.destroy();\n // Set the backing data to null and provide a final update.\n this.#map = [null];\n this.index.update(true);\n // Remove all subscriptions.\n this.#subscriptions.length = 0;\n this.#index.destroy();\n this.#filters.clear();\n this.#sort.clear();\n }\n /**\n * Provides a callback for custom reducers to initialize any data / custom configuration. This allows\n * child classes to avoid implementing the constructor.\n *\n * @protected\n */\n initialize() { }\n /**\n * Removes internal data and pushes new data. This does not destroy any initial array set to internal data unless\n * `replace` is set to true.\n *\n * @param data - New data to set to internal data.\n *\n * @param replace=false - New data to set to internal data.\n */\n setData(data, replace = false) {\n if (data !== null && !(data instanceof Map)) {\n throw new TypeError(`DynMapReducer.setData error: 'data' is not iterable.`);\n }\n if (typeof replace !== 'boolean') {\n throw new TypeError(`DynMapReducer.setData error: 'replace' is not a boolean.`);\n }\n const map = this.#map[0];\n // If the array isn't defined or 'replace' is true then replace internal data with new array or create an array\n // from an iterable.\n if (!(map instanceof Map) || replace) {\n this.#map[0] = data instanceof Map ? data : null;\n }\n else if (data instanceof Map && map instanceof Map) {\n // Create a set of all current entry IDs.\n const removeKeySet = new Set(map.keys());\n for (const key of data.keys()) {\n map.set(key, data.get(key));\n if (removeKeySet.has(key)) {\n removeKeySet.delete(key);\n }\n }\n // Remove entries that are no longer in data.\n for (const key of removeKeySet) {\n map.delete(key);\n }\n }\n else if (data === null) {\n this.#map[0] = null;\n }\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Add a subscriber to this DynMapReducer instance.\n *\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\n *\n * @returns Unsubscribe function.\n */\n subscribe(handler) {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n handler(this); // call handler with current value\n // Return unsubscribe function.\n return () => {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) {\n this.#subscriptions.splice(index, 1);\n }\n };\n }\n /**\n * Updates subscribers on changes.\n */\n #updateSubscribers() {\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\n this.#subscriptions[cntr](this);\n }\n }\n /**\n * Provides an iterator for data stored in DynMapReducer.\n *\n * @returns Generator / iterator of all data.\n * @yields {T}\n */\n *[Symbol.iterator]() {\n const map = this.#map[0];\n if (this.#destroyed || map === null || map?.size === 0) {\n return;\n }\n if (this.#index.active) {\n for (const key of this.index) {\n yield map.get(key);\n }\n }\n else {\n if (this.reversed) {\n // TODO: Not efficient due to creating temporary values array.\n const values = [...map.values()];\n for (let cntr = values.length; --cntr >= 0;) {\n yield values[cntr];\n }\n }\n else {\n for (const value of map.values()) {\n yield value;\n }\n }\n }\n }\n}\n\n/**\n * Provides a readable store to track keys actively pressed. KeyStore is designed to be used with the {@link keyforward}\n * action.\n */\nclass KeyStore\n{\n #keySet;\n\n /**\n * @type {Map}\n */\n #keyMap = new Map();\n\n /**\n * @type {KeyStoreOptions}\n */\n #options = { preventDefault: true, useCode: true, stopPropagation: true };\n\n /**\n * Stores the subscribers.\n *\n * @type {(function(KeyStore): void)[]}\n */\n #subscriptions = [];\n\n /**\n * @param {Iterable} [keyNames] -\n *\n * @param {KeyStoreOptions} [options] - Optional parameters\n */\n constructor(keyNames, options)\n {\n if (!isIterable(keyNames))\n {\n throw new TypeError(`'keyNames' is not an iterable list.`);\n }\n\n this.setOptions(options);\n\n this.#keySet = new Set(keyNames);\n }\n\n /**\n * Add given key to the tracking key set.\n *\n * @param {string} key - Key to add.\n */\n addKey(key)\n {\n if (typeof key !== 'string') { throw new TypeError(`'key' is not a string.`); }\n\n this.#keySet.add(key);\n }\n\n /**\n * @returns {boolean} True if any keys in the key set are pressed.\n */\n\n /**\n * Returns true if any of given keys are pressed. If `keys` is undefined then the result is true if any keys being\n * tracked are pressed.\n *\n * @param {string|Iterable|undefined} keys - Zero or more key strings or list to verify if any pressed.\n *\n * @returns {boolean} True if any keys set are pressed.\n */\n anyPressed(keys)\n {\n // When no keys given then check if any key is pressed.\n if (keys === void 0) { return this.#keyMap.size > 0; }\n\n const isList = isIterable(keys);\n\n if (typeof keys !== 'string' && !isList)\n {\n throw new TypeError(`'keys' is not a string or iterable list of strings.`);\n }\n\n let result = false;\n\n if (isList)\n {\n for (const key of keys)\n {\n if (this.#keyMap.has(key))\n {\n result = true;\n break;\n }\n }\n }\n else\n {\n if (this.#keyMap.has(keys)) { result = true; }\n }\n\n return result;\n }\n\n /**\n * Is the given key in the tracking key set.\n *\n * @param {string} key - Key to check.\n */\n hasKey(key)\n {\n if (typeof key !== 'string') { throw new TypeError(`'key' is not a string.`); }\n\n this.#keySet.has(key);\n }\n\n /**\n * Returns true if all given keys are pressed.\n *\n * @param {string|Iterable} keys - One or more key strings to verify if pressed.\n *\n * @returns {boolean} Are all keys pressed.\n */\n isPressed(keys)\n {\n const isList = isIterable(keys);\n\n if (typeof keys !== 'string' && !isList)\n {\n throw new TypeError(`'keys' is not a string or iterable list of strings.`);\n }\n\n let result = true;\n\n if (isList)\n {\n for (const key of keys)\n {\n if (!this.#keyMap.has(key))\n {\n result = false;\n break;\n }\n }\n }\n else\n {\n if (!this.#keyMap.has(keys)) { result = false; }\n }\n\n return result;\n }\n\n /**\n * Handle keydown event adding any key from the tracked key set.\n *\n * @param {KeyboardEvent} event - KeyboardEvent.\n */\n keydown(event)\n {\n const key = this.#options.useCode ? event.code : event.key;\n\n if (this.#keySet.has(key))\n {\n if (!this.#keyMap.has(key))\n {\n this.#keyMap.set(key, 1);\n this._updateSubscribers();\n }\n\n if (this.#options.preventDefault) { event.preventDefault(); }\n if (this.#options.stopPropagation) { event.stopPropagation(); }\n }\n }\n\n /**\n * @returns {IterableIterator} Returns current pressed keys iterator.\n */\n keysPressed()\n {\n return this.#keyMap.keys();\n }\n\n /**\n * @returns {IterableIterator} Returns currently tracked keys iterator.\n */\n keysTracked()\n {\n return this.#keySet.keys();\n }\n\n /**\n * Handle keyup event removing any key from the tracked key set.\n *\n * @param {KeyboardEvent} event - KeyboardEvent.\n */\n keyup(event)\n {\n const key = this.#options.useCode ? event.code : event.key;\n\n if (this.#keySet.has(key))\n {\n if (this.#keyMap.has(key))\n {\n this.#keyMap.delete(key);\n this._updateSubscribers();\n }\n\n if (this.#options.preventDefault) { event.preventDefault(); }\n if (this.#options.stopPropagation) { event.stopPropagation(); }\n }\n }\n\n /**\n * Remove the given key from the tracking key set.\n *\n * @param {string} key - Key to remove.\n */\n removeKey(key)\n {\n if (typeof key !== 'string') { throw new TypeError(`'key' is not a string.`); }\n\n if (this.#keySet.has(key))\n {\n this.#keySet.delete(key);\n\n if (this.#keyMap.has(key))\n {\n this.#keyMap.delete(key);\n this._updateSubscribers();\n }\n }\n }\n\n /**\n * Update options.\n *\n * @param {KeyStoreOptions} options - Options to set.\n */\n setOptions(options)\n {\n if (typeof options?.preventDefault === 'boolean') { this.#options.preventDefault = options.preventDefault; }\n if (typeof options?.useCode === 'boolean') { this.#options.useCode = options.useCode; }\n if (typeof options?.stopPropagation === 'boolean') { this.#options.stopPropagation = options.stopPropagation; }\n }\n\n /**\n * @param {string} key - key or key code to lookup.\n *\n * @returns {number} 1 if currently pressed and 0 if not pressed.\n */\n value(key)\n {\n return this.#keyMap.has(key) ? 1 : 0;\n }\n\n // Store subscriber implementation --------------------------------------------------------------------------------\n\n /**\n * @param {function(KeyStore): void} handler - Callback function that is invoked on update / changes.\n *\n * @returns {(function(): void)} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n\n handler(this); // call handler with current value\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n\n /**\n * Updates subscribers.\n *\n * @protected\n */\n _updateSubscribers()\n {\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) { this.#subscriptions[cntr](this); }\n }\n}\n\n/**\n * @typedef {object} KeyStoreOptions\n *\n * @property {boolean} [preventDefault=true] - Invoke `preventDefault` on key events.\n *\n * @property {boolean} [useCode=true] - When true use `event.code` otherwise use `event.key` to get active key.\n *\n * @property {boolean} [stopPropagation=true] - Invoke `stopPropagation` on key events.\n */\n\n// src/generator.ts\nfunction isSimpleDeriver(deriver) {\n return deriver.length < 2;\n}\nfunction generator(storage) {\n function readable(key, value, start) {\n return {\n subscribe: writable(key, value, start).subscribe\n };\n }\n function writable(key, value, start = noop) {\n function wrap_start(ogSet) {\n return start(function wrap_set(new_value) {\n if (storage) {\n storage.setItem(key, JSON.stringify(new_value));\n }\n return ogSet(new_value);\n });\n }\n if (storage) {\n const storageValue = storage.getItem(key);\n try {\n if (storageValue) {\n value = JSON.parse(storageValue);\n }\n } catch (err) {\n }\n storage.setItem(key, JSON.stringify(value));\n }\n const ogStore = writable$2(value, start ? wrap_start : void 0);\n function set(new_value) {\n if (storage) {\n storage.setItem(key, JSON.stringify(new_value));\n }\n ogStore.set(new_value);\n }\n function update(fn) {\n set(fn(get(ogStore)));\n }\n function subscribe(run, invalidate = noop) {\n return ogStore.subscribe(run, invalidate);\n }\n return {set, update, subscribe};\n }\n function derived(key, stores, fn, initial_value) {\n const single = !Array.isArray(stores);\n const stores_array = single ? [stores] : stores;\n if (storage && storage.getItem(key)) {\n try {\n initial_value = JSON.parse(storage.getItem(key));\n } catch (err) {\n }\n }\n return readable(key, initial_value, (set) => {\n let inited = false;\n const values = [];\n let pending = 0;\n let cleanup = noop;\n const sync = () => {\n if (pending) {\n return;\n }\n cleanup();\n const input = single ? values[0] : values;\n if (isSimpleDeriver(fn)) {\n set(fn(input));\n } else {\n const result = fn(input, set);\n cleanup = is_function(result) ? result : noop;\n }\n };\n const unsubscribers = stores_array.map((store, i) => store.subscribe((value) => {\n values[i] = value;\n pending &= ~(1 << i);\n if (inited) {\n sync();\n }\n }, () => {\n pending |= 1 << i;\n }));\n inited = true;\n sync();\n return function stop() {\n run_all(unsubscribers);\n cleanup();\n };\n });\n }\n return {\n readable,\n writable,\n derived,\n get: get\n };\n}\n\n// src/local.ts\nvar storage$1 = typeof window !== \"undefined\" ? window.localStorage : void 0;\nvar g$1 = generator(storage$1);\nvar writable$1 = g$1.writable;\n\nclass TJSLocalStorage\n{\n /**\n * @type {Map}\n */\n #stores = new Map();\n\n /**\n * Creates a new writable store for the given key.\n *\n * @param {string} key - Key to lookup in stores map.\n *\n * @param {boolean} [defaultValue] - A default value to set for the store.\n *\n * @returns {import('svelte/store').Writable} The new store.\n */\n static #createStore(key, defaultValue = void 0)\n {\n try\n {\n const value = localStorage.getItem(key);\n if (value !== null) { defaultValue = value === 'undefined' ? void 0 : JSON.parse(value); }\n }\n catch (err) { /**/ }\n\n return writable$1(key, defaultValue);\n }\n\n /**\n * Gets a store from the stores Map or creates a new store for the key and a given default value.\n *\n * @param {string} key - Key to lookup in stores map.\n *\n * @param {boolean} [defaultValue] - A default value to set for the store.\n *\n * @returns {import('svelte/store').Writable} The store for the given key.\n */\n #getStore(key, defaultValue = void 0)\n {\n let store = this.#stores.get(key);\n if (store === void 0)\n {\n store = TJSLocalStorage.#createStore(key, defaultValue);\n this.#stores.set(key, store);\n }\n\n return store;\n }\n\n /**\n * Get value from the localStorage.\n *\n * @param {string} key - Key to lookup in localStorage.\n *\n * @param {*} [defaultValue] - A default value to return if key not present in session storage.\n *\n * @returns {*} Value from session storage or if not defined any default value provided.\n */\n getItem(key, defaultValue)\n {\n let value = defaultValue;\n\n const storageValue = localStorage.getItem(key);\n\n if (storageValue !== null)\n {\n try\n {\n value = storageValue === 'undefined' ? void 0 : JSON.parse(storageValue);\n }\n catch (err)\n {\n value = defaultValue;\n }\n }\n else if (defaultValue !== void 0)\n {\n try\n {\n const newValue = JSON.stringify(defaultValue);\n\n // If there is no existing storage value and defaultValue is defined the storage value needs to be set.\n localStorage.setItem(key, newValue === 'undefined' ? void 0 : newValue);\n }\n catch (err) { /* */ }\n }\n\n return value;\n }\n\n /**\n * Returns the backing Svelte store for the given key; potentially sets a default value if the key\n * is not already set.\n *\n * @param {string} key - Key to lookup in localStorage.\n *\n * @param {*} [defaultValue] - A default value to return if key not present in session storage.\n *\n * @returns {import('svelte/store').Writable} The Svelte store for this key.\n */\n getStore(key, defaultValue)\n {\n return this.#getStore(key, defaultValue);\n }\n\n /**\n * Sets the value for the given key in localStorage.\n *\n * @param {string} key - Key to lookup in localStorage.\n *\n * @param {*} value - A value to set for this key.\n */\n setItem(key, value)\n {\n const store = this.#getStore(key);\n store.set(value);\n }\n\n /**\n * Convenience method to swap a boolean value stored in session storage.\n *\n * @param {string} key - Key to lookup in localStorage.\n *\n * @param {boolean} [defaultValue] - A default value to return if key not present in session storage.\n *\n * @returns {boolean} The boolean swap for the given key.\n */\n swapItemBoolean(key, defaultValue)\n {\n const store = this.#getStore(key, defaultValue);\n\n let currentValue = false;\n\n try\n {\n currentValue = !!JSON.parse(localStorage.getItem(key));\n }\n catch (err) { /**/ }\n\n const newValue = typeof currentValue === 'boolean' ? !currentValue : false;\n\n store.set(newValue);\n return newValue;\n }\n}\n\n// src/session.ts\nvar storage = typeof window !== \"undefined\" ? window.sessionStorage : void 0;\nvar g = generator(storage);\nvar writable = g.writable;\n\nclass TJSSessionStorage\n{\n /**\n * @type {Map}\n */\n #stores = new Map();\n\n /**\n * Creates a new store for the given key.\n *\n * @param {string} key - Key to lookup in stores map.\n *\n * @param {boolean} [defaultValue] - A default value to set for the store.\n *\n * @returns {import('svelte/store').Writable} The new store.\n */\n static #createStore(key, defaultValue = void 0)\n {\n try\n {\n const value = sessionStorage.getItem(key);\n if (value !== null) { defaultValue = value === 'undefined' ? void 0 : JSON.parse(value); }\n }\n catch (err) { /**/ }\n\n return writable(key, defaultValue);\n }\n\n /**\n * Gets a store from the `stores` Map or creates a new store for the key and a given default value.\n *\n * @param {string} key - Key to lookup in stores map.\n *\n * @param {boolean} [defaultValue] - A default value to set for the store.\n *\n * @returns {import('svelte/store').Writable} The store for the given key.\n */\n #getStore(key, defaultValue = void 0)\n {\n let store = this.#stores.get(key);\n if (store === void 0)\n {\n store = TJSSessionStorage.#createStore(key, defaultValue);\n this.#stores.set(key, store);\n }\n\n return store;\n }\n\n /**\n * Get value from the sessionStorage.\n *\n * @param {string} key - Key to lookup in sessionStorage.\n *\n * @param {*} [defaultValue] - A default value to return if key not present in session storage.\n *\n * @returns {*} Value from session storage or if not defined any default value provided.\n */\n getItem(key, defaultValue)\n {\n let value = defaultValue;\n\n const storageValue = sessionStorage.getItem(key);\n\n if (storageValue !== null)\n {\n try\n {\n value = storageValue === 'undefined' ? void 0 : JSON.parse(storageValue);\n }\n catch (err)\n {\n value = defaultValue;\n }\n }\n else if (defaultValue !== void 0)\n {\n try\n {\n const newValue = JSON.stringify(defaultValue);\n\n // If there is no existing storage value and defaultValue is defined the storage value needs to be set.\n sessionStorage.setItem(key, newValue === 'undefined' ? void 0 : newValue);\n }\n catch (err) { /* */ }\n }\n\n return value;\n }\n\n /**\n * Returns the backing Svelte store for the given key; potentially sets a default value if the key\n * is not already set.\n *\n * @param {string} key - Key to lookup in sessionStorage.\n *\n * @param {*} [defaultValue] - A default value to return if key not present in session storage.\n *\n * @returns {import('svelte/store').Writable} The Svelte store for this key.\n */\n getStore(key, defaultValue)\n {\n return this.#getStore(key, defaultValue);\n }\n\n /**\n * Sets the value for the given key in sessionStorage.\n *\n * @param {string} key - Key to lookup in sessionStorage.\n *\n * @param {*} value - A value to set for this key.\n */\n setItem(key, value)\n {\n const store = this.#getStore(key);\n store.set(value);\n }\n\n /**\n * Convenience method to swap a boolean value stored in session storage.\n *\n * @param {string} key - Key to lookup in sessionStorage.\n *\n * @param {boolean} [defaultValue] - A default value to return if key not present in session storage.\n *\n * @returns {boolean} The boolean swap for the given key.\n */\n swapItemBoolean(key, defaultValue)\n {\n const store = this.#getStore(key, defaultValue);\n\n let currentValue = false;\n\n try\n {\n currentValue = !!JSON.parse(sessionStorage.getItem(key));\n }\n catch (err) { /**/ }\n\n const newValue = typeof currentValue === 'boolean' ? !currentValue : false;\n\n store.set(newValue);\n return newValue;\n }\n}\n\n/**\n * Provides a basic test for a given variable to test if it has the shape of a readable store by having a `subscribe`\n * function.\n *\n * Note: functions are also objects, so test that the variable might be a function w/ a `subscribe` function.\n *\n * @param {*} store - variable to test that might be a store.\n *\n * @returns {boolean} Whether the variable tested has the shape of a store.\n */\nfunction isReadableStore(store)\n{\n if (store === null || store === void 0) { return false; }\n\n switch (typeof store)\n {\n case 'function':\n case 'object':\n return typeof store.subscribe === 'function';\n }\n\n return false;\n}\n\n/**\n * Provides a basic test for a given variable to test if it has the shape of a writable store by having a `subscribe`\n * function and an `update` function.\n *\n * Note: functions are also objects, so test that the variable might be a function w/ a `subscribe` function.\n *\n * @param {*} store - variable to test that might be a store.\n *\n * @returns {boolean} Whether the variable tested has the shape of a store.\n */\nfunction isUpdatableStore(store)\n{\n if (store === null || store === void 0) { return false; }\n\n switch (typeof store)\n {\n case 'function':\n case 'object':\n return typeof store.subscribe === 'function' && typeof store.update === 'function';\n }\n\n return false;\n}\n\n/**\n * Provides a basic test for a given variable to test if it has the shape of a writable store by having a `subscribe`\n * `set`, and `update` functions.\n *\n * Note: functions are also objects, so test that the variable might be a function w/ `subscribe` & `set` functions.\n *\n * @param {*} store - variable to test that might be a store.\n *\n * @returns {boolean} Whether the variable tested has the shape of a store.\n */\nfunction isWritableStore(store)\n{\n if (store === null || store === void 0) { return false; }\n\n switch (typeof store)\n {\n case 'function':\n case 'object':\n return typeof store.subscribe === 'function' && typeof store.set === 'function';\n }\n\n return false;\n}\n\n/**\n * Subscribes to the given store with the update function provided and ignores the first automatic\n * update. All future updates are dispatched to the update function.\n *\n * @param {import('svelte/store').Readable | import('svelte/store').Writable} store -\n * Store to subscribe to...\n *\n * @param {import('svelte/store').Updater} update - function to receive future updates.\n *\n * @returns {import('svelte/store').Unsubscriber} Store unsubscribe function.\n */\nfunction subscribeIgnoreFirst(store, update)\n{\n let firedFirst = false;\n\n return store.subscribe((value) =>\n {\n if (!firedFirst)\n {\n firedFirst = true;\n }\n else\n {\n update(value);\n }\n });\n}\n\n/**\n * Subscribes to the given store with two update functions provided. The first function is invoked on the initial\n * subscription. All future updates are dispatched to the update function.\n *\n * @param {import('svelte/store').Readable | import('svelte/store').Writable} store -\n * Store to subscribe to...\n *\n * @param {import('svelte/store').Updater} first - Function to receive first update.\n *\n * @param {import('svelte/store').Updater} update - Function to receive future updates.\n *\n * @returns {import('svelte/store').Unsubscriber} Store unsubscribe function.\n */\nfunction subscribeFirstRest(store, first, update)\n{\n let firedFirst = false;\n\n return store.subscribe((value) =>\n {\n if (!firedFirst)\n {\n firedFirst = true;\n first(value);\n }\n else\n {\n update(value);\n }\n });\n}\n\n/**\n * @external Store\n * @see [Svelte stores](https://svelte.dev/docs#component-format-script-4-prefix-stores-with-$-to-access-their-values-store-contract)\n */\n\n/**\n * Create a store similar to [Svelte's `derived`](https://svelte.dev/docs#run-time-svelte-store-writable),\n * but which has its own `set` and `update` methods and can send values back to the origin stores.\n * [Read more...](https://github.com/PixievoltNo1/svelte-writable-derived#default-export-writablederived)\n * \n * @param {Store|Store[]} origins One or more stores to derive from. Same as\n * [`derived`](https://svelte.dev/docs#run-time-svelte-store-writable)'s 1st parameter.\n * @param {!Function} derive The callback to determine the derived value. Same as\n * [`derived`](https://svelte.dev/docs#run-time-svelte-store-writable)'s 2nd parameter.\n * @param {!Function} reflect Called when the derived store gets a new value via its `set` or\n * `update` methods, and determines new values for the origin stores.\n * [Read more...](https://github.com/PixievoltNo1/svelte-writable-derived#new-parameter-reflect)\n * @param [initial] The new store's initial value. Same as\n * [`derived`](https://svelte.dev/docs#run-time-svelte-store-writable)'s 3rd parameter.\n * \n * @returns {Store} A writable store.\n */\nfunction writableDerived(origins, derive, reflect, initial) {\n\tvar childDerivedSetter, originValues, blockNextDerive = false;\n\tvar reflectOldValues = reflect.length >= 2;\n\tvar wrappedDerive = (got, set) => {\n\t\tchildDerivedSetter = set;\n\t\tif (reflectOldValues) {\n\t\t\toriginValues = got;\n\t\t}\n\t\tif (!blockNextDerive) {\n\t\t\tlet returned = derive(got, set);\n\t\t\tif (derive.length < 2) {\n\t\t\t\tset(returned);\n\t\t\t} else {\n\t\t\t\treturn returned;\n\t\t\t}\n\t\t}\n\t\tblockNextDerive = false;\n\t};\n\tvar childDerived = derived(origins, wrappedDerive, initial);\n\t\n\tvar singleOrigin = !Array.isArray(origins);\n\tfunction doReflect(reflecting) {\n\t\tvar setWith = reflect(reflecting, originValues);\n\t\tif (singleOrigin) {\n\t\t\tblockNextDerive = true;\n\t\t\torigins.set(setWith);\n\t\t} else {\n\t\t\tsetWith.forEach( (value, i) => {\n\t\t\t\tblockNextDerive = true;\n\t\t\t\torigins[i].set(value);\n\t\t\t} );\n\t\t}\n\t\tblockNextDerive = false;\n\t}\n\t\n\tvar tryingSet = false;\n\tfunction update(fn) {\n\t\tvar isUpdated, mutatedBySubscriptions, oldValue, newValue;\n\t\tif (tryingSet) {\n\t\t\tnewValue = fn( get(childDerived) );\n\t\t\tchildDerivedSetter(newValue);\n\t\t\treturn;\n\t\t}\n\t\tvar unsubscribe = childDerived.subscribe( (value) => {\n\t\t\tif (!tryingSet) {\n\t\t\t\toldValue = value;\n\t\t\t} else if (!isUpdated) {\n\t\t\t\tisUpdated = true;\n\t\t\t} else {\n\t\t\t\tmutatedBySubscriptions = true;\n\t\t\t}\n\t\t} );\n\t\tnewValue = fn(oldValue);\n\t\ttryingSet = true;\n\t\tchildDerivedSetter(newValue);\n\t\tunsubscribe();\n\t\ttryingSet = false;\n\t\tif (mutatedBySubscriptions) {\n\t\t\tnewValue = get(childDerived);\n\t\t}\n\t\tif (isUpdated) {\n\t\t\tdoReflect(newValue);\n\t\t}\n\t}\n\treturn {\n\t\tsubscribe: childDerived.subscribe,\n\t\tset(value) { update( () => value ); },\n\t\tupdate,\n\t};\n}\n\n/**\n * Create a store for a property value in an object contained in another store.\n * [Read more...](https://github.com/PixievoltNo1/svelte-writable-derived#named-export-propertystore)\n * \n * @param {Store} origin The store containing the object to get/set from.\n * @param {string|number|symbol|Array} propName The property to get/set, or a path of\n * properties in nested objects.\n *\n * @returns {Store} A writable store.\n */\nfunction propertyStore(origin, propName) {\n\tif (!Array.isArray(propName)) {\n\t\treturn writableDerived(\n\t\t\torigin,\n\t\t\t(object) => object[propName],\n\t\t\t(reflecting, object) => {\n\t\t\t\tobject[propName] = reflecting;\n\t\t\t\treturn object;\n\t\t\t},\n\t\t);\n\t} else {\n\t\tlet props = propName.concat();\n\t\treturn writableDerived(\n\t\t\torigin,\n\t\t\t(value) => {\n\t\t\t\tfor (let i = 0; i < props.length; ++i) {\n\t\t\t\t\tvalue = value[ props[i] ];\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\t(reflecting, object) => {\n\t\t\t\tlet target = object;\n\t\t\t\tfor (let i = 0; i < props.length - 1; ++i) {\n\t\t\t\t\ttarget = target[ props[i] ];\n\t\t\t\t}\n\t\t\t\ttarget[ props[props.length - 1] ] = reflecting;\n\t\t\t\treturn object;\n\t\t\t},\n\t\t);\n\t}\n}\n\n/**\n * Provides management of reactive embedded collections.\n *\n * TODO: Consider subscribing to TJSDocument rather than exposing {@link EmbeddedStoreManager.handleDocChange} and\n * {@link EmbeddedStoreManager.handleUpdate}\n */\nclass EmbeddedStoreManager\n{\n /**\n * RegExp for detecting CRUD updates for renderContext.\n *\n * @type {RegExp}\n */\n static #renderContextRegex = /(create|delete|update)(\\w+)/;\n\n /**\n * @type {Map}\n */\n #name = new Map();\n\n /**\n * @type {foundry.abstract.Document[]}\n */\n #document;\n\n /**\n * @type {Set}\n */\n #embeddedNames = new Set();\n\n /**\n * @param {foundry.abstract.Document[]} document - The associated document holder.\n */\n constructor(document)\n {\n this.#document = document;\n\n this.handleDocChange();\n\n Object.seal(this);\n }\n\n /**\n * @template T\n *\n * @param {string} embeddedName -\n *\n * @param {import('@typhonjs-fvtt/svelte/store').OptionsDynMapCreate} options -\n *\n * @returns {import('@typhonjs-fvtt/svelte/store').DynMapReducer} DynMapReducer instance\n */\n create(embeddedName, options)\n {\n /** @type {foundry.abstract.Document} */\n const doc = this.#document[0];\n\n let collection = null;\n\n if (doc)\n {\n try\n {\n collection = doc.getEmbeddedCollection(embeddedName);\n }\n catch (err)\n {\n console.warn(`EmbeddedStoreManager.create error: No valid embedded collection for: ${embeddedName}`);\n }\n }\n\n let embeddedData;\n\n if (!this.#name.has(embeddedName))\n {\n embeddedData = {\n collection,\n stores: new Map()\n };\n\n this.#name.set(embeddedName, embeddedData);\n }\n else\n {\n embeddedData = this.#name.get(embeddedName);\n }\n\n /** @type {string} */\n let name;\n\n /** @type {import('@typhonjs-fvtt/svelte/store').DataOptions} */\n let rest = {};\n\n /** @type {import('@typhonjs-fvtt/svelte/store').IDynMapReducerCtor} */\n let ctor;\n\n if (typeof options === 'string')\n {\n name = options;\n ctor = DynMapReducer;\n }\n else if (typeof options === 'function' && hasPrototype(options, DynMapReducer))\n {\n ctor = options;\n }\n else if (isObject(options))\n {\n ({ name, ctor = DynMapReducer, ...rest } = options);\n }\n else\n {\n throw new TypeError(`EmbeddedStoreManager.create error: 'options' does not conform to allowed parameters.`);\n }\n\n if (!hasPrototype(ctor, DynMapReducer))\n {\n throw new TypeError(`EmbeddedStoreManager.create error: 'ctor' is not a 'DynMapReducer'.`);\n }\n\n name = name ?? ctor?.name;\n\n if (typeof name !== 'string') { throw new TypeError(`EmbeddedStoreManager.create error: 'name' is not a string.`); }\n\n if (embeddedData.stores.has(name))\n {\n return embeddedData.stores.get(name);\n }\n else\n {\n const storeOptions = collection ? { data: collection, ...rest } : { ...rest };\n const store = new ctor(storeOptions);\n embeddedData.stores.set(name, store);\n return store;\n }\n }\n\n /**\n * Destroys and removes embedded collection stores. Invoking this method with no parameters destroys all stores.\n * Invoking with an embedded name destroys all stores for that particular collection. If you provide an embedded and\n * store name just that particular store is destroyed and removed.\n *\n * @param {string} [embeddedName] - Specific embedded collection name.\n *\n * @param {string} [storeName] - Specific store name.\n *\n * @returns {boolean} One or more stores destroyed?\n */\n destroy(embeddedName, storeName)\n {\n let count = 0;\n\n // Destroy all embedded stores\n if (embeddedName === void 0)\n {\n for (const embeddedData of this.#name.values())\n {\n embeddedData.collection = null;\n for (const store of embeddedData.stores.values())\n {\n store.destroy();\n count++;\n }\n }\n\n this.#name.clear();\n }\n else if (typeof embeddedName === 'string' && storeName === void 0)\n {\n const embeddedData = this.#name.get(embeddedName);\n if (embeddedData)\n {\n embeddedData.collection = null;\n for (const store of embeddedData.stores.values())\n {\n store.destroy();\n count++;\n }\n }\n\n this.#name.delete(embeddedName);\n }\n else if (typeof embeddedName === 'string' && storeName === 'string')\n {\n const embeddedData = this.#name.get(embeddedName);\n if (embeddedData)\n {\n const store = embeddedData.stores.get(storeName);\n if (store)\n {\n store.destroy();\n count++;\n }\n }\n }\n\n return count > 0;\n }\n\n /**\n * @template T\n *\n * @param {string} embeddedName -\n *\n * @param {string} storeName -\n *\n * @returns {import('@typhonjs-fvtt/svelte/store').DynMapReducer} DynMapReducer instance.\n */\n get(embeddedName, storeName)\n {\n if (!this.#name.has(embeddedName)) { return void 0; }\n\n return this.#name.get(embeddedName).stores.get(storeName);\n }\n\n /**\n * Updates all existing embedded collection stores with the associated embedded collection\n */\n handleDocChange()\n {\n const doc = this.#document[0];\n\n if (doc instanceof globalThis.foundry.abstract.Document)\n {\n const existingEmbeddedNames = new Set(this.#name.keys());\n\n /** @type {string[]} */\n const embeddedNames = Object.keys(doc.constructor?.metadata?.embedded ?? []);\n\n // Remove all previously stored embedded name CRUD keys.\n this.#embeddedNames.clear();\n\n for (const embeddedName of embeddedNames)\n {\n // Remove processed embedded name from existingEmbeddedNames set.\n existingEmbeddedNames.delete(embeddedName);\n\n // Update CRUD keys.\n this.#embeddedNames.add(`create${embeddedName}`);\n this.#embeddedNames.add(`delete${embeddedName}`);\n this.#embeddedNames.add(`update${embeddedName}`);\n\n let collection = null;\n\n try\n {\n // Update any existing stores with the actual collection.\n collection = doc.getEmbeddedCollection(embeddedName);\n }\n catch (err)\n {\n console.warn(`EmbeddedStoreManager.handleDocUpdate error: No valid embedded collection for: ${\n embeddedName}`);\n }\n\n // Update EmbeddedData for new collection.\n const embeddedData = this.#name.get(embeddedName);\n if (embeddedData)\n {\n embeddedData.collection = collection;\n\n // Update all existing stores.\n for (const store of embeddedData.stores.values()) { store.setData(collection, true); }\n }\n }\n\n // Update all existing embedded collections with null data that aren't processed above.\n for (const embeddedName of existingEmbeddedNames)\n {\n const embeddedData = this.#name.get(embeddedName);\n if (embeddedData)\n {\n embeddedData.collection = null;\n\n for (const store of embeddedData.stores.values()) { store.setData(null, true); }\n }\n }\n }\n else // Reset all embedded reducer stores to null data.\n {\n this.#embeddedNames.clear();\n\n for (const embeddedData of this.#name.values())\n {\n embeddedData.collection = null;\n\n for (const store of embeddedData.stores.values()) { store.setData(null, true); }\n }\n }\n }\n\n /**\n * Handles updates to embedded stores parsing the render context for valid embedded store types.\n *\n * On create, delete, update parse the type being modified then force index updates for the embedded type.\n *\n * @param {string} renderContext - render context update from document.\n */\n handleUpdate(renderContext)\n {\n if (!this.#embeddedNames.has(renderContext)) { return; }\n\n const match = EmbeddedStoreManager.#renderContextRegex.exec(renderContext);\n\n if (match)\n {\n const embeddedName = match[2];\n if (!this.#name.has(embeddedName)) { return; }\n\n for (const store of this.#name.get(embeddedName).stores.values())\n {\n store.index.update(true);\n }\n }\n }\n}\n\n/**\n * @typedef {object} EmbeddedCollectionData\n *\n * @property {foundry.abstract.Collection} collection -\n *\n * @property {Map>} stores -\n */\n\n/**\n * Provides a wrapper implementing the Svelte store / subscriber protocol around any Document / ClientMixinDocument.\n * This makes documents reactive in a Svelte component, but otherwise provides subscriber functionality external to\n * Svelte.\n */\nclass TJSDocument\n{\n /**\n * @type {foundry.abstract.Document[]}\n */\n #document = [void 0];\n\n /**\n * @type {EmbeddedStoreManager}\n */\n #embeddedStoreManager;\n #embeddedAPI;\n\n /**\n * @type {string}\n */\n #uuidv4;\n\n /**\n * @type {TJSDocumentOptions}\n */\n #options = { delete: void 0, preDelete: void 0 };\n\n #subscriptions = [];\n #updateOptions;\n\n /**\n * @param {foundry.abstract.Document | TJSDocumentOptions} [document] - Document to wrap or TJSDocumentOptions.\n *\n * @param {TJSDocumentOptions} [options] - TJSDocument options.\n */\n constructor(document, options = {})\n {\n this.#uuidv4 = `tjs-document-${uuidv4()}`;\n\n if (isPlainObject(document)) // Handle case when only options are passed into ctor.\n {\n this.setOptions(document);\n }\n else\n {\n this.setOptions(options);\n this.set(document);\n }\n }\n\n /**\n * @returns {EmbeddedAPI} Embedded store manager.\n */\n get embedded()\n {\n if (!this.#embeddedAPI)\n {\n this.#embeddedStoreManager = new EmbeddedStoreManager(this.#document);\n this.#embeddedAPI = {\n create: (embeddedName, options) => this.#embeddedStoreManager.create(embeddedName, options),\n destroy: (embeddedName, storeName) => this.#embeddedStoreManager.destroy(embeddedName, storeName),\n get: (embeddedName, storeName) => this.#embeddedStoreManager.get(embeddedName, storeName)\n };\n }\n\n return this.#embeddedAPI;\n }\n\n /**\n * Returns the options passed on last update.\n *\n * @returns {object} Last update options.\n */\n get updateOptions() { return this.#updateOptions ?? {}; }\n\n /**\n * Returns the UUID assigned to this store.\n *\n * @returns {string} UUID\n */\n get uuidv4() { return this.#uuidv4; }\n\n /**\n * Handles cleanup when the document is deleted. Invoking any optional delete function set in the constructor.\n *\n * @returns {Promise}\n */\n async #deleted()\n {\n const doc = this.#document[0];\n\n // Check to see if the document is still in the associated collection to determine if actually deleted.\n if (doc instanceof globalThis.foundry.abstract.Document && !doc?.collection?.has(doc.id))\n {\n delete doc?.apps[this.#uuidv4];\n this.#setDocument(void 0);\n\n if (typeof this.#options.preDelete === 'function')\n {\n await this.#options.preDelete(doc);\n }\n\n this.#updateSubscribers(false, { action: 'delete', data: void 0 });\n\n if (typeof this.#options.delete === 'function')\n {\n await this.#options.delete(doc);\n }\n\n this.#updateOptions = void 0;\n }\n }\n\n /**\n * Completely removes all internal subscribers, any optional delete callback, and unregisters from the\n * ClientDocumentMixin `apps` tracking object.\n */\n destroy()\n {\n const doc = this.#document[0];\n\n if (this.#embeddedStoreManager)\n {\n this.#embeddedStoreManager.destroy();\n this.#embeddedStoreManager = void 0;\n this.#embeddedAPI = void 0;\n }\n\n if (doc instanceof globalThis.foundry.abstract.Document)\n {\n delete doc?.apps[this.#uuidv4];\n this.#setDocument(void 0);\n }\n\n this.#options.delete = void 0;\n this.#subscriptions.length = 0;\n }\n\n /**\n * @param {boolean} [force] - unused - signature from Foundry render function.\n *\n * @param {object} [options] - Options from render call; will have document update context.\n */\n #updateSubscribers(force = false, options = {}) // eslint-disable-line no-unused-vars\n {\n this.#updateOptions = options;\n\n const doc = this.#document[0];\n\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) { this.#subscriptions[cntr](doc, options); }\n\n if (this.#embeddedStoreManager)\n {\n this.#embeddedStoreManager.handleUpdate(options.renderContext);\n }\n }\n\n /**\n * @returns {foundry.abstract.Document | undefined} Current document\n */\n get() { return this.#document[0]; }\n\n /**\n * @param {foundry.abstract.Document | undefined} document - New document to set.\n *\n * @param {object} [options] - New document update options to set.\n */\n set(document, options = {})\n {\n if (this.#document[0])\n {\n delete this.#document[0].apps[this.#uuidv4];\n }\n\n if (document !== void 0 && !(document instanceof globalThis.foundry.abstract.Document))\n {\n throw new TypeError(`TJSDocument set error: 'document' is not a valid Document or undefined.`);\n }\n\n if (options === null || typeof options !== 'object')\n {\n throw new TypeError(`TJSDocument set error: 'options' is not an object.`);\n }\n\n if (document instanceof globalThis.foundry.abstract.Document)\n {\n document.apps[this.#uuidv4] = {\n close: this.#deleted.bind(this),\n render: this.#updateSubscribers.bind(this)\n };\n }\n\n this.#setDocument(document);\n this.#updateOptions = options;\n this.#updateSubscribers();\n }\n\n /**\n *\n * @param {foundry.abstract.Document | undefined} doc -\n */\n #setDocument(doc)\n {\n this.#document[0] = doc;\n\n if (this.#embeddedStoreManager) { this.#embeddedStoreManager.handleDocChange(); }\n }\n\n /**\n * Potentially sets new document from data transfer object.\n *\n * @param {object} data - Document transfer data.\n *\n * @param {ParseDataTransferOptions & TJSDocumentOptions} [options] - Optional parameters.\n *\n * @returns {Promise} Returns true if new document set from data transfer blob.\n */\n async setFromDataTransfer(data, options)\n {\n return this.setFromUUID(getUUIDFromDataTransfer(data, options), options);\n }\n\n /**\n * Sets the document by Foundry UUID performing a lookup and setting the document if found.\n *\n * @param {string} uuid - A Foundry UUID to lookup.\n *\n * @param {TJSDocumentOptions} [options] - New document update options to set.\n *\n * @returns {Promise} True if successfully set document from UUID.\n */\n async setFromUUID(uuid, options = {})\n {\n if (typeof uuid !== 'string' || uuid.length === 0) { return false; }\n\n try\n {\n const doc = await globalThis.fromUuid(uuid);\n\n if (doc)\n {\n this.set(doc, options);\n return true;\n }\n }\n catch (err) { /**/ }\n\n return false;\n }\n\n /**\n * Sets options for this document wrapper / store.\n *\n * @param {TJSDocumentOptions} options - Options for TJSDocument.\n */\n setOptions(options)\n {\n if (!isObject(options))\n {\n throw new TypeError(`TJSDocument error: 'options' is not a plain object.`);\n }\n\n // Verify valid values -------------\n\n if (options.delete !== void 0 && typeof options.delete !== 'function')\n {\n throw new TypeError(`TJSDocument error: 'delete' attribute in options is not a function.`);\n }\n\n if (options.preDelete !== void 0 && typeof options.preDelete !== 'function')\n {\n throw new TypeError(`TJSDocument error: 'preDelete' attribute in options is not a function.`);\n }\n\n // Set any valid values -------------\n\n if (options.delete === void 0 || typeof options.delete === 'function')\n {\n this.#options.delete = options.delete;\n }\n\n if (options.preDelete === void 0 || typeof options.preDelete === 'function')\n {\n this.#options.preDelete = options.preDelete;\n }\n }\n\n /**\n * @param {function(foundry.abstract.Document, object): void} handler - Callback function that is invoked on update / changes.\n *\n * @returns {(function(): void)} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // Add handler to the array of subscribers.\n\n const updateOptions = { action: 'subscribe', data: void 0 };\n\n handler(this.#document[0], updateOptions); // Call handler with current value and update options.\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n}\n\n/**\n * @typedef {object} TJSDocumentOptions\n *\n * @property {(doc: foundry.abstract.Document) => void} [delete] - Optional post delete function to invoke when\n * document is deleted _after_ subscribers have been notified.\n *\n * @property {(doc: foundry.abstract.Document) => void} [preDelete] - Optional pre delete function to invoke when\n * document is deleted _before_ subscribers are notified.\n */\n\n/**\n * @typedef {object} EmbeddedAPI\n *\n * @property {(embeddedName: string, options: import('@typhonjs-fvtt/runtime/svelte/store').OptionsDynMapCreate) => import('@typhonjs-fvtt/runtime/svelte/store').DynMapReducer} create - Creates an embedded collection store.\n *\n * @property {(embeddedName?: string, storeName?: string) => boolean} destroy - Destroys one or more embedded collection stores.\n *\n * @property {(embeddedName: string, storeName: string) => import('@typhonjs-fvtt/runtime/svelte/store').DynMapReducer} get - Returns a specific existing embedded collection store.\n */\n\n/**\n * Provides a wrapper implementing the Svelte store / subscriber protocol around any DocumentCollection. This makes\n * document collections reactive in a Svelte component, but otherwise provides subscriber functionality external to\n * Svelte.\n *\n * @template {DocumentCollection} T\n */\nclass TJSDocumentCollection\n{\n #collection;\n #collectionCallback;\n #uuid;\n\n /**\n * @type {TJSDocumentCollectionOptions}\n */\n #options = { delete: void 0, preDelete: void 0 };\n\n #subscriptions = [];\n #updateOptions;\n\n /**\n * @param {T|TJSDocumentCollectionOptions} [collection] - Collection to wrap or TJSDocumentCollectionOptions.\n *\n * @param {TJSDocumentCollectionOptions} [options] - TJSDocumentCollection options.\n */\n constructor(collection, options = {})\n {\n this.#uuid = `tjs-collection-${uuidv4()}`;\n\n if (isPlainObject(collection)) // Handle case when only options are passed into ctor.\n {\n this.setOptions(collection);\n }\n else\n {\n this.setOptions(options);\n this.set(collection);\n }\n }\n\n /**\n * Returns the options passed on last update.\n *\n * @returns {object} Last update options.\n */\n get updateOptions() { return this.#updateOptions ?? {}; }\n\n /**\n * Returns the UUID assigned to this store.\n *\n * @returns {*} UUID\n */\n get uuid() { return this.#uuid; }\n\n /**\n * Handles cleanup when the collection is deleted. Invoking any optional delete function set in the constructor.\n *\n * @returns {Promise}\n */\n async #deleted()\n {\n const collection = this.#collection;\n\n if (collection instanceof DocumentCollection)\n {\n const index = collection?.apps?.findIndex((sub) => sub === this.#collectionCallback);\n if (index >= 0) { collection?.apps?.splice(index, 1); }\n\n this.#collection = void 0;\n }\n\n if (typeof this.#options.preDelete === 'function')\n {\n await this.#options.preDelete(collection);\n }\n\n this.#notify(false, { action: 'delete', documentType: collection.documentName, documents: [], data: [] });\n\n if (typeof this.#options.delete === 'function')\n {\n await this.#options.delete(collection);\n }\n\n this.#updateOptions = void 0;\n }\n\n /**\n * Completely removes all internal subscribers, any optional delete callback, and unregisters from the\n * DocumentCollection `apps` tracking array.\n */\n destroy()\n {\n const collection = this.#collection;\n\n if (collection instanceof DocumentCollection)\n {\n const index = collection?.apps?.findIndex((sub) => sub === this.#collectionCallback);\n if (index >= 0) { collection?.apps?.splice(index, 1); }\n\n this.#collection = void 0;\n }\n\n this.#options.delete = void 0;\n this.#subscriptions.length = 0;\n }\n\n /**\n * @param {boolean} [force] - unused - signature from Foundry render function.\n *\n * @param {object} [options] - Options from render call; will have collection update context.\n */\n #notify(force = false, options = {}) // eslint-disable-line no-unused-vars\n {\n this.#updateOptions = options;\n\n // Subscriptions are stored locally as on the browser Babel is still used for private class fields / Babel\n // support until 2023. IE not doing this will require several extra method calls otherwise.\n const subscriptions = this.#subscriptions;\n const collection = this.#collection;\n\n for (let cntr = 0; cntr < subscriptions.length; cntr++) { subscriptions[cntr](collection, options); }\n }\n\n /**\n * @returns {T | undefined} Current collection\n */\n get() { return this.#collection; }\n\n /**\n * @param {T | undefined} collection - New collection to set.\n *\n * @param {object} [options] - New collection update options to set.\n */\n set(collection, options = {})\n {\n if (this.#collection)\n {\n const index = this.#collection.apps.findIndex((sub) => sub === this.#collectionCallback);\n if (index >= 0) { this.#collection.apps.splice(index, 1); }\n\n this.#collectionCallback = void 0;\n }\n\n if (collection !== void 0 && !(collection instanceof DocumentCollection))\n {\n throw new TypeError(\n `TJSDocumentCollection set error: 'collection' is not a valid DocumentCollection or undefined.`);\n }\n\n if (!isObject(options))\n {\n throw new TypeError(`TJSDocument set error: 'options' is not an object.`);\n }\n\n if (collection instanceof DocumentCollection)\n {\n this.#collectionCallback = {\n close: this.#deleted.bind(this),\n render: this.#notify.bind(this)\n };\n\n collection?.apps?.push(this.#collectionCallback);\n }\n\n this.#collection = collection;\n this.#updateOptions = options;\n this.#notify();\n }\n\n /**\n * Sets options for this collection wrapper / store.\n *\n * @param {TJSDocumentCollectionOptions} options - Options for TJSDocumentCollection.\n */\n setOptions(options)\n {\n if (!isObject(options))\n {\n throw new TypeError(`TJSDocumentCollection error: 'options' is not an object.`);\n }\n\n // Verify valid values -------------\n\n if (options.delete !== void 0 && typeof options.delete !== 'function')\n {\n throw new TypeError(`TJSDocumentCollection error: 'delete' attribute in options is not a function.`);\n }\n\n if (options.preDelete !== void 0 && typeof options.preDelete !== 'function')\n {\n throw new TypeError(`TJSDocumentCollection error: 'preDelete' attribute in options is not a function.`);\n }\n\n // Set any valid values -------------\n\n if (options.delete === void 0 || typeof options.delete === 'function')\n {\n this.#options.delete = options.delete;\n }\n\n if (options.preDelete === void 0 || typeof options.preDelete === 'function')\n {\n this.#options.preDelete = options.preDelete;\n }\n }\n\n /**\n * @param {function(T, object): void} handler - Callback function that is invoked on update / changes.\n *\n * @returns {(function(): void)} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // Add handler to the array of subscribers.\n\n const collection = this.#collection;\n\n const documentType = collection?.documentName ?? void 0;\n\n const updateOptions = { action: 'subscribe', documentType, documents: [], data: [] };\n\n handler(collection, updateOptions); // Call handler with current value and update options.\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n}\n\n/**\n * @typedef TJSDocumentCollectionOptions\n *\n * @property {(collection: foundry.abstract.DocumentCollection) => void} [delete] - Optional post delete function\n * to invoke when document is deleted _after_ subscribers have been notified.\n *\n * @property {(collection: foundry.abstract.DocumentCollection) => void} [preDelete] - Optional pre delete function to\n * invoke when document is deleted _before_ subscribers are notified.\n */\n\nconst storeState = writable$2(void 0);\n\n/**\n * @type {GameState} Provides a Svelte store wrapping the Foundry runtime / global game state.\n */\nconst gameState = {\n subscribe: storeState.subscribe,\n get: () => game\n};\n\nObject.freeze(gameState);\n\nHooks.once('ready', () => storeState.set(game));\n\nexport { DerivedArrayReducer, DerivedMapReducer, DynArrayReducer, DynMapReducer, KeyStore, TJSDocument, TJSDocumentCollection, TJSLocalStorage, TJSSessionStorage, gameState, isReadableStore, isUpdatableStore, isWritableStore, propertyStore, subscribeFirstRest, subscribeIgnoreFirst, writableDerived };\n//# sourceMappingURL=index.js.map\n","export { identity as linear } from '../internal/index.mjs';\n\n/*\nAdapted from https://github.com/mattdesl\nDistributed under MIT License https://github.com/mattdesl/eases/blob/master/LICENSE.md\n*/\nfunction backInOut(t) {\n const s = 1.70158 * 1.525;\n if ((t *= 2) < 1)\n return 0.5 * (t * t * ((s + 1) * t - s));\n return 0.5 * ((t -= 2) * t * ((s + 1) * t + s) + 2);\n}\nfunction backIn(t) {\n const s = 1.70158;\n return t * t * ((s + 1) * t - s);\n}\nfunction backOut(t) {\n const s = 1.70158;\n return --t * t * ((s + 1) * t + s) + 1;\n}\nfunction bounceOut(t) {\n const a = 4.0 / 11.0;\n const b = 8.0 / 11.0;\n const c = 9.0 / 10.0;\n const ca = 4356.0 / 361.0;\n const cb = 35442.0 / 1805.0;\n const cc = 16061.0 / 1805.0;\n const t2 = t * t;\n return t < a\n ? 7.5625 * t2\n : t < b\n ? 9.075 * t2 - 9.9 * t + 3.4\n : t < c\n ? ca * t2 - cb * t + cc\n : 10.8 * t * t - 20.52 * t + 10.72;\n}\nfunction bounceInOut(t) {\n return t < 0.5\n ? 0.5 * (1.0 - bounceOut(1.0 - t * 2.0))\n : 0.5 * bounceOut(t * 2.0 - 1.0) + 0.5;\n}\nfunction bounceIn(t) {\n return 1.0 - bounceOut(1.0 - t);\n}\nfunction circInOut(t) {\n if ((t *= 2) < 1)\n return -0.5 * (Math.sqrt(1 - t * t) - 1);\n return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);\n}\nfunction circIn(t) {\n return 1.0 - Math.sqrt(1.0 - t * t);\n}\nfunction circOut(t) {\n return Math.sqrt(1 - --t * t);\n}\nfunction cubicInOut(t) {\n return t < 0.5 ? 4.0 * t * t * t : 0.5 * Math.pow(2.0 * t - 2.0, 3.0) + 1.0;\n}\nfunction cubicIn(t) {\n return t * t * t;\n}\nfunction cubicOut(t) {\n const f = t - 1.0;\n return f * f * f + 1.0;\n}\nfunction elasticInOut(t) {\n return t < 0.5\n ? 0.5 *\n Math.sin(((+13.0 * Math.PI) / 2) * 2.0 * t) *\n Math.pow(2.0, 10.0 * (2.0 * t - 1.0))\n : 0.5 *\n Math.sin(((-13.0 * Math.PI) / 2) * (2.0 * t - 1.0 + 1.0)) *\n Math.pow(2.0, -10.0 * (2.0 * t - 1.0)) +\n 1.0;\n}\nfunction elasticIn(t) {\n return Math.sin((13.0 * t * Math.PI) / 2) * Math.pow(2.0, 10.0 * (t - 1.0));\n}\nfunction elasticOut(t) {\n return (Math.sin((-13.0 * (t + 1.0) * Math.PI) / 2) * Math.pow(2.0, -10.0 * t) + 1.0);\n}\nfunction expoInOut(t) {\n return t === 0.0 || t === 1.0\n ? t\n : t < 0.5\n ? +0.5 * Math.pow(2.0, 20.0 * t - 10.0)\n : -0.5 * Math.pow(2.0, 10.0 - t * 20.0) + 1.0;\n}\nfunction expoIn(t) {\n return t === 0.0 ? t : Math.pow(2.0, 10.0 * (t - 1.0));\n}\nfunction expoOut(t) {\n return t === 1.0 ? t : 1.0 - Math.pow(2.0, -10.0 * t);\n}\nfunction quadInOut(t) {\n t /= 0.5;\n if (t < 1)\n return 0.5 * t * t;\n t--;\n return -0.5 * (t * (t - 2) - 1);\n}\nfunction quadIn(t) {\n return t * t;\n}\nfunction quadOut(t) {\n return -t * (t - 2.0);\n}\nfunction quartInOut(t) {\n return t < 0.5\n ? +8.0 * Math.pow(t, 4.0)\n : -8.0 * Math.pow(t - 1.0, 4.0) + 1.0;\n}\nfunction quartIn(t) {\n return Math.pow(t, 4.0);\n}\nfunction quartOut(t) {\n return Math.pow(t - 1.0, 3.0) * (1.0 - t) + 1.0;\n}\nfunction quintInOut(t) {\n if ((t *= 2) < 1)\n return 0.5 * t * t * t * t * t;\n return 0.5 * ((t -= 2) * t * t * t * t + 2);\n}\nfunction quintIn(t) {\n return t * t * t * t * t;\n}\nfunction quintOut(t) {\n return --t * t * t * t * t + 1;\n}\nfunction sineInOut(t) {\n return -0.5 * (Math.cos(Math.PI * t) - 1);\n}\nfunction sineIn(t) {\n const v = Math.cos(t * Math.PI * 0.5);\n if (Math.abs(v) < 1e-14)\n return 1;\n else\n return 1 - v;\n}\nfunction sineOut(t) {\n return Math.sin((t * Math.PI) / 2);\n}\n\nexport { backIn, backInOut, backOut, bounceIn, bounceInOut, bounceOut, circIn, circInOut, circOut, cubicIn, cubicInOut, cubicOut, elasticIn, elasticInOut, elasticOut, expoIn, expoInOut, expoOut, quadIn, quadInOut, quadOut, quartIn, quartInOut, quartOut, quintIn, quintInOut, quintOut, sineIn, sineInOut, sineOut };\n","/**\n * Performs linear interpolation between a start & end value by given amount between 0 - 1 inclusive.\n *\n * @param {number} start - Start value.\n *\n * @param {number} end - End value.\n *\n * @param {number} amount - Current amount between 0 - 1 inclusive.\n *\n * @returns {number} Linear interpolated value between start & end.\n */\nfunction lerp$5(start, end, amount)\n{\n return (1 - amount) * start + amount * end;\n}\n\n/**\n * Converts the given number from degrees to radians.\n *\n * @param {number} deg - Degree number to convert\n *\n * @returns {number} Degree as radians.\n */\nfunction degToRad(deg)\n{\n return deg * (Math.PI / 180.0);\n}\n\n/**\n * Converts the given number from radians to degrees.\n *\n * @param {number} rad - Radian number to convert.\n *\n * @returns {number} Degree as radians.\n */\nfunction radToDeg(rad)\n{\n return rad * (180.0 / Math.PI);\n}\n\n/**\n * Common utilities\n * @module glMatrix\n */\n// Configuration Constants\nvar EPSILON = 0.000001;\nvar ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;\nvar RANDOM = Math.random;\n/**\n * Sets the type of array used when creating new vectors and matrices\n *\n * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array\n */\n\nfunction setMatrixArrayType(type) {\n ARRAY_TYPE = type;\n}\nvar degree = Math.PI / 180;\n/**\n * Convert Degree To Radian\n *\n * @param {Number} a Angle in Degrees\n */\n\nfunction toRadian(a) {\n return a * degree;\n}\n/**\n * Tests whether or not the arguments have approximately the same value, within an absolute\n * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less\n * than or equal to 1.0, and a relative tolerance is used for larger values)\n *\n * @param {Number} a The first number to test.\n * @param {Number} b The second number to test.\n * @returns {Boolean} True if the numbers are approximately equal, false otherwise.\n */\n\nfunction equals$9(a, b) {\n return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));\n}\nif (!Math.hypot) Math.hypot = function () {\n var y = 0,\n i = arguments.length;\n\n while (i--) {\n y += arguments[i] * arguments[i];\n }\n\n return Math.sqrt(y);\n};\n\nconst common = /*#__PURE__*/Object.freeze({\n __proto__: null,\n get ARRAY_TYPE () { return ARRAY_TYPE; },\n EPSILON: EPSILON,\n RANDOM: RANDOM,\n equals: equals$9,\n setMatrixArrayType: setMatrixArrayType,\n toRadian: toRadian\n});\n\n/**\n * 2x2 Matrix\n * @module mat2\n */\n\n/**\n * Creates a new identity mat2\n *\n * @returns {mat2} a new 2x2 matrix\n */\n\nfunction create$8() {\n var out = new ARRAY_TYPE(4);\n\n if (ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n }\n\n out[0] = 1;\n out[3] = 1;\n return out;\n}\n/**\n * Creates a new mat2 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat2} a matrix to clone\n * @returns {mat2} a new 2x2 matrix\n */\n\nfunction clone$8(a) {\n var out = new ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Copy the values from one mat2 to another\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the source matrix\n * @returns {mat2} out\n */\n\nfunction copy$8(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Set a mat2 to the identity matrix\n *\n * @param {mat2} out the receiving matrix\n * @returns {mat2} out\n */\n\nfunction identity$5(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n/**\n * Create a new mat2 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m10 Component in column 1, row 0 position (index 2)\n * @param {Number} m11 Component in column 1, row 1 position (index 3)\n * @returns {mat2} out A new 2x2 matrix\n */\n\nfunction fromValues$8(m00, m01, m10, m11) {\n var out = new ARRAY_TYPE(4);\n out[0] = m00;\n out[1] = m01;\n out[2] = m10;\n out[3] = m11;\n return out;\n}\n/**\n * Set the components of a mat2 to the given values\n *\n * @param {mat2} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m10 Component in column 1, row 0 position (index 2)\n * @param {Number} m11 Component in column 1, row 1 position (index 3)\n * @returns {mat2} out\n */\n\nfunction set$8(out, m00, m01, m10, m11) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m10;\n out[3] = m11;\n return out;\n}\n/**\n * Transpose the values of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the source matrix\n * @returns {mat2} out\n */\n\nfunction transpose$2(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache\n // some values\n if (out === a) {\n var a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n } else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n\n return out;\n}\n/**\n * Inverts a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the source matrix\n * @returns {mat2} out\n */\n\nfunction invert$5(out, a) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3]; // Calculate the determinant\n\n var det = a0 * a3 - a2 * a1;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n return out;\n}\n/**\n * Calculates the adjugate of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the source matrix\n * @returns {mat2} out\n */\n\nfunction adjoint$2(out, a) {\n // Caching this value is nessecary if out == a\n var a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n return out;\n}\n/**\n * Calculates the determinant of a mat2\n *\n * @param {ReadonlyMat2} a the source matrix\n * @returns {Number} determinant of a\n */\n\nfunction determinant$3(a) {\n return a[0] * a[3] - a[2] * a[1];\n}\n/**\n * Multiplies two mat2's\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the first operand\n * @param {ReadonlyMat2} b the second operand\n * @returns {mat2} out\n */\n\nfunction multiply$8(out, a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n}\n/**\n * Rotates a mat2 by the given angle\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\n\nfunction rotate$4(out, a, rad) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n}\n/**\n * Scales the mat2 by the dimensions in the given vec2\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the matrix to rotate\n * @param {ReadonlyVec2} v the vec2 to scale the matrix by\n * @returns {mat2} out\n **/\n\nfunction scale$8(out, a, v) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var v0 = v[0],\n v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n}\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.rotate(dest, dest, rad);\n *\n * @param {mat2} out mat2 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\n\nfunction fromRotation$4(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.scale(dest, dest, vec);\n *\n * @param {mat2} out mat2 receiving operation result\n * @param {ReadonlyVec2} v Scaling vector\n * @returns {mat2} out\n */\n\nfunction fromScaling$3(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n return out;\n}\n/**\n * Returns a string representation of a mat2\n *\n * @param {ReadonlyMat2} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\n\nfunction str$8(a) {\n return \"mat2(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \")\";\n}\n/**\n * Returns Frobenius norm of a mat2\n *\n * @param {ReadonlyMat2} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\n\nfunction frob$3(a) {\n return Math.hypot(a[0], a[1], a[2], a[3]);\n}\n/**\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\n * @param {ReadonlyMat2} L the lower triangular matrix\n * @param {ReadonlyMat2} D the diagonal matrix\n * @param {ReadonlyMat2} U the upper triangular matrix\n * @param {ReadonlyMat2} a the input matrix to factorize\n */\n\nfunction LDU(L, D, U, a) {\n L[2] = a[2] / a[0];\n U[0] = a[0];\n U[1] = a[1];\n U[3] = a[3] - L[2] * U[1];\n return [L, D, U];\n}\n/**\n * Adds two mat2's\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the first operand\n * @param {ReadonlyMat2} b the second operand\n * @returns {mat2} out\n */\n\nfunction add$8(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the first operand\n * @param {ReadonlyMat2} b the second operand\n * @returns {mat2} out\n */\n\nfunction subtract$6(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat2} a The first matrix.\n * @param {ReadonlyMat2} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction exactEquals$8(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat2} a The first matrix.\n * @param {ReadonlyMat2} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction equals$8(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat2} out the receiving matrix\n * @param {ReadonlyMat2} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat2} out\n */\n\nfunction multiplyScalar$3(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\n * Adds two mat2's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat2} out the receiving vector\n * @param {ReadonlyMat2} a the first operand\n * @param {ReadonlyMat2} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat2} out\n */\n\nfunction multiplyScalarAndAdd$3(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\n * Alias for {@link mat2.multiply}\n * @function\n */\n\nvar mul$8 = multiply$8;\n/**\n * Alias for {@link mat2.subtract}\n * @function\n */\n\nvar sub$6 = subtract$6;\n\nconst mat2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n LDU: LDU,\n add: add$8,\n adjoint: adjoint$2,\n clone: clone$8,\n copy: copy$8,\n create: create$8,\n determinant: determinant$3,\n equals: equals$8,\n exactEquals: exactEquals$8,\n frob: frob$3,\n fromRotation: fromRotation$4,\n fromScaling: fromScaling$3,\n fromValues: fromValues$8,\n identity: identity$5,\n invert: invert$5,\n mul: mul$8,\n multiply: multiply$8,\n multiplyScalar: multiplyScalar$3,\n multiplyScalarAndAdd: multiplyScalarAndAdd$3,\n rotate: rotate$4,\n scale: scale$8,\n set: set$8,\n str: str$8,\n sub: sub$6,\n subtract: subtract$6,\n transpose: transpose$2\n});\n\n/**\n * 2x3 Matrix\n * @module mat2d\n * @description\n * A mat2d contains six elements defined as:\n *
\n * [a, b,\n *  c, d,\n *  tx, ty]\n * 
\n * This is a short form for the 3x3 matrix:\n *
\n * [a, b, 0,\n *  c, d, 0,\n *  tx, ty, 1]\n * 
\n * The last column is ignored so the array is shorter and operations are faster.\n */\n\n/**\n * Creates a new identity mat2d\n *\n * @returns {mat2d} a new 2x3 matrix\n */\n\nfunction create$7() {\n var out = new ARRAY_TYPE(6);\n\n if (ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[4] = 0;\n out[5] = 0;\n }\n\n out[0] = 1;\n out[3] = 1;\n return out;\n}\n/**\n * Creates a new mat2d initialized with values from an existing matrix\n *\n * @param {ReadonlyMat2d} a matrix to clone\n * @returns {mat2d} a new 2x3 matrix\n */\n\nfunction clone$7(a) {\n var out = new ARRAY_TYPE(6);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n}\n/**\n * Copy the values from one mat2d to another\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the source matrix\n * @returns {mat2d} out\n */\n\nfunction copy$7(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n}\n/**\n * Set a mat2d to the identity matrix\n *\n * @param {mat2d} out the receiving matrix\n * @returns {mat2d} out\n */\n\nfunction identity$4(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n/**\n * Create a new mat2d with the given values\n *\n * @param {Number} a Component A (index 0)\n * @param {Number} b Component B (index 1)\n * @param {Number} c Component C (index 2)\n * @param {Number} d Component D (index 3)\n * @param {Number} tx Component TX (index 4)\n * @param {Number} ty Component TY (index 5)\n * @returns {mat2d} A new mat2d\n */\n\nfunction fromValues$7(a, b, c, d, tx, ty) {\n var out = new ARRAY_TYPE(6);\n out[0] = a;\n out[1] = b;\n out[2] = c;\n out[3] = d;\n out[4] = tx;\n out[5] = ty;\n return out;\n}\n/**\n * Set the components of a mat2d to the given values\n *\n * @param {mat2d} out the receiving matrix\n * @param {Number} a Component A (index 0)\n * @param {Number} b Component B (index 1)\n * @param {Number} c Component C (index 2)\n * @param {Number} d Component D (index 3)\n * @param {Number} tx Component TX (index 4)\n * @param {Number} ty Component TY (index 5)\n * @returns {mat2d} out\n */\n\nfunction set$7(out, a, b, c, d, tx, ty) {\n out[0] = a;\n out[1] = b;\n out[2] = c;\n out[3] = d;\n out[4] = tx;\n out[5] = ty;\n return out;\n}\n/**\n * Inverts a mat2d\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the source matrix\n * @returns {mat2d} out\n */\n\nfunction invert$4(out, a) {\n var aa = a[0],\n ab = a[1],\n ac = a[2],\n ad = a[3];\n var atx = a[4],\n aty = a[5];\n var det = aa * ad - ab * ac;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n}\n/**\n * Calculates the determinant of a mat2d\n *\n * @param {ReadonlyMat2d} a the source matrix\n * @returns {Number} determinant of a\n */\n\nfunction determinant$2(a) {\n return a[0] * a[3] - a[1] * a[2];\n}\n/**\n * Multiplies two mat2d's\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the first operand\n * @param {ReadonlyMat2d} b the second operand\n * @returns {mat2d} out\n */\n\nfunction multiply$7(out, a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n out[4] = a0 * b4 + a2 * b5 + a4;\n out[5] = a1 * b4 + a3 * b5 + a5;\n return out;\n}\n/**\n * Rotates a mat2d by the given angle\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\n\nfunction rotate$3(out, a, rad) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5];\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n out[4] = a4;\n out[5] = a5;\n return out;\n}\n/**\n * Scales the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to translate\n * @param {ReadonlyVec2} v the vec2 to scale the matrix by\n * @returns {mat2d} out\n **/\n\nfunction scale$7(out, a, v) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5];\n var v0 = v[0],\n v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n out[4] = a4;\n out[5] = a5;\n return out;\n}\n/**\n * Translates the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to translate\n * @param {ReadonlyVec2} v the vec2 to translate the matrix by\n * @returns {mat2d} out\n **/\n\nfunction translate$3(out, a, v) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5];\n var v0 = v[0],\n v1 = v[1];\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = a0 * v0 + a2 * v1 + a4;\n out[5] = a1 * v0 + a3 * v1 + a5;\n return out;\n}\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.rotate(dest, dest, rad);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\n\nfunction fromRotation$3(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.scale(dest, dest, vec);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {ReadonlyVec2} v Scaling vector\n * @returns {mat2d} out\n */\n\nfunction fromScaling$2(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.translate(dest, dest, vec);\n *\n * @param {mat2d} out mat2d receiving operation result\n * @param {ReadonlyVec2} v Translation vector\n * @returns {mat2d} out\n */\n\nfunction fromTranslation$3(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = v[0];\n out[5] = v[1];\n return out;\n}\n/**\n * Returns a string representation of a mat2d\n *\n * @param {ReadonlyMat2d} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\n\nfunction str$7(a) {\n return \"mat2d(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \")\";\n}\n/**\n * Returns Frobenius norm of a mat2d\n *\n * @param {ReadonlyMat2d} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\n\nfunction frob$2(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], 1);\n}\n/**\n * Adds two mat2d's\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the first operand\n * @param {ReadonlyMat2d} b the second operand\n * @returns {mat2d} out\n */\n\nfunction add$7(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the first operand\n * @param {ReadonlyMat2d} b the second operand\n * @returns {mat2d} out\n */\n\nfunction subtract$5(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n return out;\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat2d} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat2d} out\n */\n\nfunction multiplyScalar$2(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n return out;\n}\n/**\n * Adds two mat2d's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat2d} out the receiving vector\n * @param {ReadonlyMat2d} a the first operand\n * @param {ReadonlyMat2d} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat2d} out\n */\n\nfunction multiplyScalarAndAdd$2(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat2d} a The first matrix.\n * @param {ReadonlyMat2d} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction exactEquals$7(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5];\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat2d} a The first matrix.\n * @param {ReadonlyMat2d} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction equals$7(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5));\n}\n/**\n * Alias for {@link mat2d.multiply}\n * @function\n */\n\nvar mul$7 = multiply$7;\n/**\n * Alias for {@link mat2d.subtract}\n * @function\n */\n\nvar sub$5 = subtract$5;\n\nconst mat2d = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$7,\n clone: clone$7,\n copy: copy$7,\n create: create$7,\n determinant: determinant$2,\n equals: equals$7,\n exactEquals: exactEquals$7,\n frob: frob$2,\n fromRotation: fromRotation$3,\n fromScaling: fromScaling$2,\n fromTranslation: fromTranslation$3,\n fromValues: fromValues$7,\n identity: identity$4,\n invert: invert$4,\n mul: mul$7,\n multiply: multiply$7,\n multiplyScalar: multiplyScalar$2,\n multiplyScalarAndAdd: multiplyScalarAndAdd$2,\n rotate: rotate$3,\n scale: scale$7,\n set: set$7,\n str: str$7,\n sub: sub$5,\n subtract: subtract$5,\n translate: translate$3\n});\n\n/**\n * 3x3 Matrix\n * @module mat3\n */\n\n/**\n * Creates a new identity mat3\n *\n * @returns {mat3} a new 3x3 matrix\n */\n\nfunction create$6() {\n var out = new ARRAY_TYPE(9);\n\n if (ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n }\n\n out[0] = 1;\n out[4] = 1;\n out[8] = 1;\n return out;\n}\n/**\n * Copies the upper-left 3x3 values into the given mat3.\n *\n * @param {mat3} out the receiving 3x3 matrix\n * @param {ReadonlyMat4} a the source 4x4 matrix\n * @returns {mat3} out\n */\n\nfunction fromMat4$1(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n}\n/**\n * Creates a new mat3 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat3} a matrix to clone\n * @returns {mat3} a new 3x3 matrix\n */\n\nfunction clone$6(a) {\n var out = new ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Copy the values from one mat3 to another\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\n\nfunction copy$6(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Create a new mat3 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\n * @returns {mat3} A new mat3\n */\n\nfunction fromValues$6(m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n var out = new ARRAY_TYPE(9);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\n * Set the components of a mat3 to the given values\n *\n * @param {mat3} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\n * @returns {mat3} out\n */\n\nfunction set$6(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\n * Set a mat3 to the identity matrix\n *\n * @param {mat3} out the receiving matrix\n * @returns {mat3} out\n */\n\nfunction identity$3(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Transpose the values of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\n\nfunction transpose$1(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n\n return out;\n}\n/**\n * Inverts a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\n\nfunction invert$3(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b01 = a22 * a11 - a12 * a21;\n var b11 = -a22 * a10 + a12 * a20;\n var b21 = a21 * a10 - a11 * a20; // Calculate the determinant\n\n var det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n}\n/**\n * Calculates the adjugate of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\n\nfunction adjoint$1(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n}\n/**\n * Calculates the determinant of a mat3\n *\n * @param {ReadonlyMat3} a the source matrix\n * @returns {Number} determinant of a\n */\n\nfunction determinant$1(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n}\n/**\n * Multiplies two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\n\nfunction multiply$6(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b00 = b[0],\n b01 = b[1],\n b02 = b[2];\n var b10 = b[3],\n b11 = b[4],\n b12 = b[5];\n var b20 = b[6],\n b21 = b[7],\n b22 = b[8];\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n}\n/**\n * Translate a mat3 by the given vector\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to translate\n * @param {ReadonlyVec2} v vector to translate by\n * @returns {mat3} out\n */\n\nfunction translate$2(out, a, v) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n x = v[0],\n y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n}\n/**\n * Rotates a mat3 by the given angle\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\n\nfunction rotate$2(out, a, rad) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n}\n/**\n * Scales the mat3 by the dimensions in the given vec2\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to rotate\n * @param {ReadonlyVec2} v the vec2 to scale the matrix by\n * @returns {mat3} out\n **/\n\nfunction scale$6(out, a, v) {\n var x = v[0],\n y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.translate(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyVec2} v Translation vector\n * @returns {mat3} out\n */\n\nfunction fromTranslation$2(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.rotate(dest, dest, rad);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\n\nfunction fromRotation$2(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.scale(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyVec2} v Scaling vector\n * @returns {mat3} out\n */\n\nfunction fromScaling$1(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Copies the values from a mat2d into a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to copy\n * @returns {mat3} out\n **/\n\nfunction fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n}\n/**\n * Calculates a 3x3 matrix from the given quaternion\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyQuat} q Quaternion to create matrix from\n *\n * @returns {mat3} out\n */\n\nfunction fromQuat$1(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n}\n/**\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\n *\n * @returns {mat3} out\n */\n\nfunction normalFromMat4(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n}\n/**\n * Generates a 2D projection matrix with the given bounds\n *\n * @param {mat3} out mat3 frustum matrix will be written into\n * @param {number} width Width of your gl context\n * @param {number} height Height of gl context\n * @returns {mat3} out\n */\n\nfunction projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n}\n/**\n * Returns a string representation of a mat3\n *\n * @param {ReadonlyMat3} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\n\nfunction str$6(a) {\n return \"mat3(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \", \" + a[8] + \")\";\n}\n/**\n * Returns Frobenius norm of a mat3\n *\n * @param {ReadonlyMat3} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\n\nfunction frob$1(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);\n}\n/**\n * Adds two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\n\nfunction add$6(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\n\nfunction subtract$4(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat3} out\n */\n\nfunction multiplyScalar$1(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n}\n/**\n * Adds two mat3's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat3} out the receiving vector\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat3} out\n */\n\nfunction multiplyScalarAndAdd$1(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat3} a The first matrix.\n * @param {ReadonlyMat3} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction exactEquals$6(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat3} a The first matrix.\n * @param {ReadonlyMat3} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction equals$6(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7],\n a8 = a[8];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7],\n b8 = b[8];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8));\n}\n/**\n * Alias for {@link mat3.multiply}\n * @function\n */\n\nvar mul$6 = multiply$6;\n/**\n * Alias for {@link mat3.subtract}\n * @function\n */\n\nvar sub$4 = subtract$4;\n\nconst mat3 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$6,\n adjoint: adjoint$1,\n clone: clone$6,\n copy: copy$6,\n create: create$6,\n determinant: determinant$1,\n equals: equals$6,\n exactEquals: exactEquals$6,\n frob: frob$1,\n fromMat2d: fromMat2d,\n fromMat4: fromMat4$1,\n fromQuat: fromQuat$1,\n fromRotation: fromRotation$2,\n fromScaling: fromScaling$1,\n fromTranslation: fromTranslation$2,\n fromValues: fromValues$6,\n identity: identity$3,\n invert: invert$3,\n mul: mul$6,\n multiply: multiply$6,\n multiplyScalar: multiplyScalar$1,\n multiplyScalarAndAdd: multiplyScalarAndAdd$1,\n normalFromMat4: normalFromMat4,\n projection: projection,\n rotate: rotate$2,\n scale: scale$6,\n set: set$6,\n str: str$6,\n sub: sub$4,\n subtract: subtract$4,\n translate: translate$2,\n transpose: transpose$1\n});\n\n/**\n * 4x4 Matrix
Format: column-major, when typed out it looks like row-major
The matrices are being post multiplied.\n * @module mat4\n */\n\n/**\n * Creates a new identity mat4\n *\n * @returns {mat4} a new 4x4 matrix\n */\n\nfunction create$5() {\n var out = new ARRAY_TYPE(16);\n\n if (ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a new mat4 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat4} a matrix to clone\n * @returns {mat4} a new 4x4 matrix\n */\n\nfunction clone$5(a) {\n var out = new ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Copy the values from one mat4 to another\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nfunction copy$5(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Create a new mat4 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} A new mat4\n */\n\nfunction fromValues$5(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n var out = new ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\n * Set the components of a mat4 to the given values\n *\n * @param {mat4} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} out\n */\n\nfunction set$5(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\n * Set a mat4 to the identity matrix\n *\n * @param {mat4} out the receiving matrix\n * @returns {mat4} out\n */\n\nfunction identity$2(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Transpose the values of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nfunction transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a12 = a[6],\n a13 = a[7];\n var a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\n * Inverts a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nfunction invert$2(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n/**\n * Calculates the adjugate of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nfunction adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);\n out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);\n return out;\n}\n/**\n * Calculates the determinant of a mat4\n *\n * @param {ReadonlyMat4} a the source matrix\n * @returns {Number} determinant of a\n */\n\nfunction determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n}\n/**\n * Multiplies two mat4s\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nfunction multiply$5(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15]; // Cache only the current line of the second matrix\n\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n/**\n * Translate a mat4 by the given vector\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to translate\n * @param {ReadonlyVec3} v vector to translate by\n * @returns {mat4} out\n */\n\nfunction translate$1(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n}\n/**\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {ReadonlyVec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\n\nfunction scale$5(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Rotates a mat4 by the given angle around the given axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\n\nfunction rotate$1(out, a, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n var b00, b01, b02;\n var b10, b11, b12;\n var b20, b21, b22;\n\n if (len < EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11]; // Construct the elements of the rotation matrix\n\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c; // Perform rotation-specific matrix multiplication\n\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction rotateX$3(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction rotateY$3(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction rotateZ$3(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\n\nfunction fromTranslation$1(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Scaling vector\n * @returns {mat4} out\n */\n\nfunction fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\n\nfunction fromRotation$1(out, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n\n if (len < EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c; // Perform rotation-specific matrix multiplication\n\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction fromXRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction fromYRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nfunction fromZRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\n\nfunction fromRotationTranslation$1(out, q, v) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a new mat4 from a dual quat.\n *\n * @param {mat4} out Matrix\n * @param {ReadonlyQuat2} a Dual Quaternion\n * @returns {mat4} mat4 receiving operation result\n */\n\nfunction fromQuat2(out, a) {\n var translation = new ARRAY_TYPE(3);\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense\n\n if (magnitude > 0) {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n\n fromRotationTranslation$1(out, a, translation);\n return out;\n}\n/**\n * Returns the translation vector component of a transformation\n * matrix. If a matrix is built with fromRotationTranslation,\n * the returned vector will be the same as the translation vector\n * originally supplied.\n * @param {vec3} out Vector to receive translation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n\nfunction getTranslation$1(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n/**\n * Returns the scaling factor component of a transformation\n * matrix. If a matrix is built with fromRotationTranslationScale\n * with a normalized Quaternion paramter, the returned vector will be\n * the same as the scaling vector\n * originally supplied.\n * @param {vec3} out Vector to receive scaling factor component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n\nfunction getScaling(out, mat) {\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out[0] = Math.hypot(m11, m12, m13);\n out[1] = Math.hypot(m21, m22, m23);\n out[2] = Math.hypot(m31, m32, m33);\n return out;\n}\n/**\n * Returns a quaternion representing the rotational component\n * of a transformation matrix. If a matrix is built with\n * fromRotationTranslation, the returned quaternion will be the\n * same as the quaternion originally supplied.\n * @param {quat} out Quaternion to receive the rotation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {quat} out\n */\n\nfunction getRotation(out, mat) {\n var scaling = new ARRAY_TYPE(3);\n getScaling(scaling, mat);\n var is1 = 1 / scaling[0];\n var is2 = 1 / scaling[1];\n var is3 = 1 / scaling[2];\n var sm11 = mat[0] * is1;\n var sm12 = mat[1] * is2;\n var sm13 = mat[2] * is3;\n var sm21 = mat[4] * is1;\n var sm22 = mat[5] * is2;\n var sm23 = mat[6] * is3;\n var sm31 = mat[8] * is1;\n var sm32 = mat[9] * is2;\n var sm33 = mat[10] * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @returns {mat4} out\n */\n\nfunction fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * mat4.translate(dest, origin);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n * mat4.translate(dest, negativeOrigin);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @param {ReadonlyVec3} o The origin vector around which to scale and rotate\n * @returns {mat4} out\n */\n\nfunction fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n var ox = o[0];\n var oy = o[1];\n var oz = o[2];\n var out0 = (1 - (yy + zz)) * sx;\n var out1 = (xy + wz) * sx;\n var out2 = (xz - wy) * sx;\n var out4 = (xy - wz) * sy;\n var out5 = (1 - (xx + zz)) * sy;\n var out6 = (yz + wx) * sy;\n var out8 = (xz + wy) * sz;\n var out9 = (yz - wx) * sz;\n var out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n/**\n * Calculates a 4x4 matrix from the given quaternion\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyQuat} q Quaternion to create matrix from\n *\n * @returns {mat4} out\n */\n\nfunction fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Generates a frustum matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Number} left Left bound of the frustum\n * @param {Number} right Right bound of the frustum\n * @param {Number} bottom Bottom bound of the frustum\n * @param {Number} top Top bound of the frustum\n * @param {Number} near Near bound of the frustum\n * @param {Number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nfunction frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left);\n var tb = 1 / (top - bottom);\n var nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n/**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\n\nfunction perspectiveNO(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n\n return out;\n}\n/**\n * Alias for {@link mat4.perspectiveNO}\n * @function\n */\n\nvar perspective = perspectiveNO;\n/**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\n\nfunction perspectiveZO(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = far * nf;\n out[14] = far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -near;\n }\n\n return out;\n}\n/**\n * Generates a perspective projection matrix with the given field of view.\n * This is primarily useful for generating projection matrices to be used\n * with the still experiemental WebVR API.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nfunction perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\n var xScale = 2.0 / (leftTan + rightTan);\n var yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = far * near / (near - far);\n out[15] = 0.0;\n return out;\n}\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nfunction orthoNO(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\n * Alias for {@link mat4.orthoNO}\n * @function\n */\n\nvar ortho = orthoNO;\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nfunction orthoZO(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = near * nf;\n out[15] = 1;\n return out;\n}\n/**\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} center Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\n\nfunction lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;\n var eyex = eye[0];\n var eyey = eye[1];\n var eyez = eye[2];\n var upx = up[0];\n var upy = up[1];\n var upz = up[2];\n var centerx = center[0];\n var centery = center[1];\n var centerz = center[2];\n\n if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) {\n return identity$2(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n/**\n * Generates a matrix that makes something look at something else.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} center Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\n\nfunction targetTo(out, eye, target, up) {\n var eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2];\n var z0 = eyex - target[0],\n z1 = eyey - target[1],\n z2 = eyez - target[2];\n var len = z0 * z0 + z1 * z1 + z2 * z2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n\n var x0 = upy * z2 - upz * z1,\n x1 = upz * z0 - upx * z2,\n x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n/**\n * Returns a string representation of a mat4\n *\n * @param {ReadonlyMat4} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\n\nfunction str$5(a) {\n return \"mat4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \", \" + a[8] + \", \" + a[9] + \", \" + a[10] + \", \" + a[11] + \", \" + a[12] + \", \" + a[13] + \", \" + a[14] + \", \" + a[15] + \")\";\n}\n/**\n * Returns Frobenius norm of a mat4\n *\n * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\n\nfunction frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);\n}\n/**\n * Adds two mat4's\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nfunction add$5(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nfunction subtract$3(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat4} out\n */\n\nfunction multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n/**\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat4} out the receiving vector\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat4} out\n */\n\nfunction multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction exactEquals$5(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nfunction equals$5(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var a8 = a[8],\n a9 = a[9],\n a10 = a[10],\n a11 = a[11];\n var a12 = a[12],\n a13 = a[13],\n a14 = a[14],\n a15 = a[15];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n var b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n var b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11];\n var b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));\n}\n/**\n * Alias for {@link mat4.multiply}\n * @function\n */\n\nvar mul$5 = multiply$5;\n/**\n * Alias for {@link mat4.subtract}\n * @function\n */\n\nvar sub$3 = subtract$3;\n\nconst mat4 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$5,\n adjoint: adjoint,\n clone: clone$5,\n copy: copy$5,\n create: create$5,\n determinant: determinant,\n equals: equals$5,\n exactEquals: exactEquals$5,\n frob: frob,\n fromQuat: fromQuat,\n fromQuat2: fromQuat2,\n fromRotation: fromRotation$1,\n fromRotationTranslation: fromRotationTranslation$1,\n fromRotationTranslationScale: fromRotationTranslationScale,\n fromRotationTranslationScaleOrigin: fromRotationTranslationScaleOrigin,\n fromScaling: fromScaling,\n fromTranslation: fromTranslation$1,\n fromValues: fromValues$5,\n fromXRotation: fromXRotation,\n fromYRotation: fromYRotation,\n fromZRotation: fromZRotation,\n frustum: frustum,\n getRotation: getRotation,\n getScaling: getScaling,\n getTranslation: getTranslation$1,\n identity: identity$2,\n invert: invert$2,\n lookAt: lookAt,\n mul: mul$5,\n multiply: multiply$5,\n multiplyScalar: multiplyScalar,\n multiplyScalarAndAdd: multiplyScalarAndAdd,\n ortho: ortho,\n orthoNO: orthoNO,\n orthoZO: orthoZO,\n perspective: perspective,\n perspectiveFromFieldOfView: perspectiveFromFieldOfView,\n perspectiveNO: perspectiveNO,\n perspectiveZO: perspectiveZO,\n rotate: rotate$1,\n rotateX: rotateX$3,\n rotateY: rotateY$3,\n rotateZ: rotateZ$3,\n scale: scale$5,\n set: set$5,\n str: str$5,\n sub: sub$3,\n subtract: subtract$3,\n targetTo: targetTo,\n translate: translate$1,\n transpose: transpose\n});\n\n/**\n * 3 Dimensional Vector\n * @module vec3\n */\n\n/**\n * Creates a new, empty vec3\n *\n * @returns {vec3} a new 3D vector\n */\n\nfunction create$4() {\n var out = new ARRAY_TYPE(3);\n\n if (ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n return out;\n}\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param {ReadonlyVec3} a vector to clone\n * @returns {vec3} a new 3D vector\n */\n\nfunction clone$4(a) {\n var out = new ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\n * Calculates the length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate length of\n * @returns {Number} length of a\n */\n\nfunction length$4(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return Math.hypot(x, y, z);\n}\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} a new 3D vector\n */\n\nfunction fromValues$4(x, y, z) {\n var out = new ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\n * Copy the values from one vec3 to another\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the source vector\n * @returns {vec3} out\n */\n\nfunction copy$4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\n * Set the components of a vec3 to the given values\n *\n * @param {vec3} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} out\n */\n\nfunction set$4(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\n * Adds two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction add$4(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction subtract$2(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n/**\n * Multiplies two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction multiply$4(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n/**\n * Divides two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction divide$2(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n/**\n * Math.ceil the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to ceil\n * @returns {vec3} out\n */\n\nfunction ceil$2(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n/**\n * Math.floor the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to floor\n * @returns {vec3} out\n */\n\nfunction floor$2(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n/**\n * Returns the minimum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction min$2(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n/**\n * Returns the maximum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction max$2(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n/**\n * Math.round the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to round\n * @returns {vec3} out\n */\n\nfunction round$2(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n return out;\n}\n/**\n * Scales a vec3 by a scalar number\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec3} out\n */\n\nfunction scale$4(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec3} out\n */\n\nfunction scaleAndAdd$2(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} distance between a and b\n */\n\nfunction distance$2(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return Math.hypot(x, y, z);\n}\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} squared distance between a and b\n */\n\nfunction squaredDistance$2(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n/**\n * Calculates the squared length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\n\nfunction squaredLength$4(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return x * x + y * y + z * z;\n}\n/**\n * Negates the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to negate\n * @returns {vec3} out\n */\n\nfunction negate$2(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to invert\n * @returns {vec3} out\n */\n\nfunction inverse$2(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to normalize\n * @returns {vec3} out\n */\n\nfunction normalize$4(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} dot product of a and b\n */\n\nfunction dot$4(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nfunction cross$2(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n var bx = b[0],\n by = b[1],\n bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nfunction lerp$4(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n/**\n * Performs a hermite interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nfunction hermite(out, a, b, c, d, t) {\n var factorTimes2 = t * t;\n var factor1 = factorTimes2 * (2 * t - 3) + 1;\n var factor2 = factorTimes2 * (t - 2) + t;\n var factor3 = factorTimes2 * (t - 1);\n var factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\n * Performs a bezier interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nfunction bezier(out, a, b, c, d, t) {\n var inverseFactor = 1 - t;\n var inverseFactorTimesTwo = inverseFactor * inverseFactor;\n var factorTimes2 = t * t;\n var factor1 = inverseFactorTimesTwo * inverseFactor;\n var factor2 = 3 * t * inverseFactorTimesTwo;\n var factor3 = 3 * factorTimes2 * inverseFactor;\n var factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec3} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec3} out\n */\n\nfunction random$3(out, scale) {\n scale = scale || 1.0;\n var r = RANDOM() * 2.0 * Math.PI;\n var z = RANDOM() * 2.0 - 1.0;\n var zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec3} out\n */\n\nfunction transformMat4$2(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat3} m the 3x3 matrix to transform with\n * @returns {vec3} out\n */\n\nfunction transformMat3$1(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n/**\n * Transforms the vec3 with a quat\n * Can also be used for dual quaternions. (Multiply it with the real part)\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyQuat} q quaternion to transform with\n * @returns {vec3} out\n */\n\nfunction transformQuat$1(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3];\n var x = a[0],\n y = a[1],\n z = a[2]; // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n\n var uvx = qy * z - qz * y,\n uvy = qz * x - qx * z,\n uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);\n\n var uuvx = qy * uvz - qz * uvy,\n uuvy = qz * uvx - qx * uvz,\n uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);\n\n var w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2; // vec3.scale(uuv, uuv, 2);\n\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));\n\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n/**\n * Rotate a 3D vector around the x-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nfunction rotateX$2(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Rotate a 3D vector around the y-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nfunction rotateY$2(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Rotate a 3D vector around the z-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nfunction rotateZ$2(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2]; //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Get the angle between two 3D vectors\n * @param {ReadonlyVec3} a The first operand\n * @param {ReadonlyVec3} b The second operand\n * @returns {Number} The angle in radians\n */\n\nfunction angle$1(a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n bx = b[0],\n by = b[1],\n bz = b[2],\n mag1 = Math.sqrt(ax * ax + ay * ay + az * az),\n mag2 = Math.sqrt(bx * bx + by * by + bz * bz),\n mag = mag1 * mag2,\n cosine = mag && dot$4(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n/**\n * Set the components of a vec3 to zero\n *\n * @param {vec3} out the receiving vector\n * @returns {vec3} out\n */\n\nfunction zero$2(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec3} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\n\nfunction str$4(a) {\n return \"vec3(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";\n}\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction exactEquals$4(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction equals$4(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));\n}\n/**\n * Alias for {@link vec3.subtract}\n * @function\n */\n\nvar sub$2 = subtract$2;\n/**\n * Alias for {@link vec3.multiply}\n * @function\n */\n\nvar mul$4 = multiply$4;\n/**\n * Alias for {@link vec3.divide}\n * @function\n */\n\nvar div$2 = divide$2;\n/**\n * Alias for {@link vec3.distance}\n * @function\n */\n\nvar dist$2 = distance$2;\n/**\n * Alias for {@link vec3.squaredDistance}\n * @function\n */\n\nvar sqrDist$2 = squaredDistance$2;\n/**\n * Alias for {@link vec3.length}\n * @function\n */\n\nvar len$4 = length$4;\n/**\n * Alias for {@link vec3.squaredLength}\n * @function\n */\n\nvar sqrLen$4 = squaredLength$4;\n/**\n * Perform some operation over an array of vec3s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\n\nvar forEach$2 = function () {\n var vec = create$4();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 3;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n\n return a;\n };\n}();\n\nconst vec3 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$4,\n angle: angle$1,\n bezier: bezier,\n ceil: ceil$2,\n clone: clone$4,\n copy: copy$4,\n create: create$4,\n cross: cross$2,\n dist: dist$2,\n distance: distance$2,\n div: div$2,\n divide: divide$2,\n dot: dot$4,\n equals: equals$4,\n exactEquals: exactEquals$4,\n floor: floor$2,\n forEach: forEach$2,\n fromValues: fromValues$4,\n hermite: hermite,\n inverse: inverse$2,\n len: len$4,\n length: length$4,\n lerp: lerp$4,\n max: max$2,\n min: min$2,\n mul: mul$4,\n multiply: multiply$4,\n negate: negate$2,\n normalize: normalize$4,\n random: random$3,\n rotateX: rotateX$2,\n rotateY: rotateY$2,\n rotateZ: rotateZ$2,\n round: round$2,\n scale: scale$4,\n scaleAndAdd: scaleAndAdd$2,\n set: set$4,\n sqrDist: sqrDist$2,\n sqrLen: sqrLen$4,\n squaredDistance: squaredDistance$2,\n squaredLength: squaredLength$4,\n str: str$4,\n sub: sub$2,\n subtract: subtract$2,\n transformMat3: transformMat3$1,\n transformMat4: transformMat4$2,\n transformQuat: transformQuat$1,\n zero: zero$2\n});\n\n/**\n * 4 Dimensional Vector\n * @module vec4\n */\n\n/**\n * Creates a new, empty vec4\n *\n * @returns {vec4} a new 4D vector\n */\n\nfunction create$3() {\n var out = new ARRAY_TYPE(4);\n\n if (ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n }\n\n return out;\n}\n/**\n * Creates a new vec4 initialized with values from an existing vector\n *\n * @param {ReadonlyVec4} a vector to clone\n * @returns {vec4} a new 4D vector\n */\n\nfunction clone$3(a) {\n var out = new ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Creates a new vec4 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} a new 4D vector\n */\n\nfunction fromValues$3(x, y, z, w) {\n var out = new ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\n * Copy the values from one vec4 to another\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the source vector\n * @returns {vec4} out\n */\n\nfunction copy$3(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Set the components of a vec4 to the given values\n *\n * @param {vec4} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} out\n */\n\nfunction set$3(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\n * Adds two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction add$3(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction subtract$1(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\n * Multiplies two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction multiply$3(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n}\n/**\n * Divides two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction divide$1(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n}\n/**\n * Math.ceil the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to ceil\n * @returns {vec4} out\n */\n\nfunction ceil$1(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n}\n/**\n * Math.floor the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to floor\n * @returns {vec4} out\n */\n\nfunction floor$1(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n}\n/**\n * Returns the minimum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction min$1(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n}\n/**\n * Returns the maximum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nfunction max$1(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n}\n/**\n * Math.round the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to round\n * @returns {vec4} out\n */\n\nfunction round$1(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n}\n/**\n * Scales a vec4 by a scalar number\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec4} out\n */\n\nfunction scale$3(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\n * Adds two vec4's after scaling the second operand by a scalar value\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec4} out\n */\n\nfunction scaleAndAdd$1(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} distance between a and b\n */\n\nfunction distance$1(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\n * Calculates the squared euclidian distance between two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} squared distance between a and b\n */\n\nfunction squaredDistance$1(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\n * Calculates the length of a vec4\n *\n * @param {ReadonlyVec4} a vector to calculate length of\n * @returns {Number} length of a\n */\n\nfunction length$3(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\n * Calculates the squared length of a vec4\n *\n * @param {ReadonlyVec4} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\n\nfunction squaredLength$3(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\n * Negates the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to negate\n * @returns {vec4} out\n */\n\nfunction negate$1(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to invert\n * @returns {vec4} out\n */\n\nfunction inverse$1(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n}\n/**\n * Normalize a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to normalize\n * @returns {vec4} out\n */\n\nfunction normalize$3(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n var len = x * x + y * y + z * z + w * w;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} dot product of a and b\n */\n\nfunction dot$3(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n/**\n * Returns the cross-product of three vectors in a 4-dimensional space\n *\n * @param {ReadonlyVec4} result the receiving vector\n * @param {ReadonlyVec4} U the first vector\n * @param {ReadonlyVec4} V the second vector\n * @param {ReadonlyVec4} W the third vector\n * @returns {vec4} result\n */\n\nfunction cross$1(out, u, v, w) {\n var A = v[0] * w[1] - v[1] * w[0],\n B = v[0] * w[2] - v[2] * w[0],\n C = v[0] * w[3] - v[3] * w[0],\n D = v[1] * w[2] - v[2] * w[1],\n E = v[1] * w[3] - v[3] * w[1],\n F = v[2] * w[3] - v[3] * w[2];\n var G = u[0];\n var H = u[1];\n var I = u[2];\n var J = u[3];\n out[0] = H * F - I * E + J * D;\n out[1] = -(G * F) + I * C - J * B;\n out[2] = G * E - H * C + J * A;\n out[3] = -(G * D) + H * B - I * A;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec4} out\n */\n\nfunction lerp$3(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec4} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec4} out\n */\n\nfunction random$2(out, scale) {\n scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n\n var v1, v2, v3, v4;\n var s1, s2;\n\n do {\n v1 = RANDOM() * 2 - 1;\n v2 = RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n\n do {\n v3 = RANDOM() * 2 - 1;\n v4 = RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n\n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n}\n/**\n * Transforms the vec4 with a mat4.\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec4} out\n */\n\nfunction transformMat4$1(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n/**\n * Transforms the vec4 with a quat\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to transform\n * @param {ReadonlyQuat} q quaternion to transform with\n * @returns {vec4} out\n */\n\nfunction transformQuat(out, a, q) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3]; // calculate quat * vec\n\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat\n\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n}\n/**\n * Set the components of a vec4 to zero\n *\n * @param {vec4} out the receiving vector\n * @returns {vec4} out\n */\n\nfunction zero$1(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec4} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\n\nfunction str$3(a) {\n return \"vec4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \")\";\n}\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec4} a The first vector.\n * @param {ReadonlyVec4} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction exactEquals$3(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec4} a The first vector.\n * @param {ReadonlyVec4} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction equals$3(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\n * Alias for {@link vec4.subtract}\n * @function\n */\n\nvar sub$1 = subtract$1;\n/**\n * Alias for {@link vec4.multiply}\n * @function\n */\n\nvar mul$3 = multiply$3;\n/**\n * Alias for {@link vec4.divide}\n * @function\n */\n\nvar div$1 = divide$1;\n/**\n * Alias for {@link vec4.distance}\n * @function\n */\n\nvar dist$1 = distance$1;\n/**\n * Alias for {@link vec4.squaredDistance}\n * @function\n */\n\nvar sqrDist$1 = squaredDistance$1;\n/**\n * Alias for {@link vec4.length}\n * @function\n */\n\nvar len$3 = length$3;\n/**\n * Alias for {@link vec4.squaredLength}\n * @function\n */\n\nvar sqrLen$3 = squaredLength$3;\n/**\n * Perform some operation over an array of vec4s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\n\nvar forEach$1 = function () {\n var vec = create$3();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 4;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n vec[3] = a[i + 3];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n a[i + 3] = vec[3];\n }\n\n return a;\n };\n}();\n\nconst vec4 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$3,\n ceil: ceil$1,\n clone: clone$3,\n copy: copy$3,\n create: create$3,\n cross: cross$1,\n dist: dist$1,\n distance: distance$1,\n div: div$1,\n divide: divide$1,\n dot: dot$3,\n equals: equals$3,\n exactEquals: exactEquals$3,\n floor: floor$1,\n forEach: forEach$1,\n fromValues: fromValues$3,\n inverse: inverse$1,\n len: len$3,\n length: length$3,\n lerp: lerp$3,\n max: max$1,\n min: min$1,\n mul: mul$3,\n multiply: multiply$3,\n negate: negate$1,\n normalize: normalize$3,\n random: random$2,\n round: round$1,\n scale: scale$3,\n scaleAndAdd: scaleAndAdd$1,\n set: set$3,\n sqrDist: sqrDist$1,\n sqrLen: sqrLen$3,\n squaredDistance: squaredDistance$1,\n squaredLength: squaredLength$3,\n str: str$3,\n sub: sub$1,\n subtract: subtract$1,\n transformMat4: transformMat4$1,\n transformQuat: transformQuat,\n zero: zero$1\n});\n\n/**\n * Quaternion\n * @module quat\n */\n\n/**\n * Creates a new identity quat\n *\n * @returns {quat} a new quaternion\n */\n\nfunction create$2() {\n var out = new ARRAY_TYPE(4);\n\n if (ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n out[3] = 1;\n return out;\n}\n/**\n * Set a quat to the identity quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\n\nfunction identity$1(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n/**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyVec3} axis the axis around which to rotate\n * @param {Number} rad the angle in radians\n * @returns {quat} out\n **/\n\nfunction setAxisAngle(out, axis, rad) {\n rad = rad * 0.5;\n var s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n}\n/**\n * Gets the rotation axis and angle for a given\n * quaternion. If a quaternion is created with\n * setAxisAngle, this method will return the same\n * values as providied in the original parameter list\n * OR functionally equivalent values.\n * Example: The quaternion formed by axis [0, 0, 1] and\n * angle -90 is the same as the quaternion formed by\n * [0, 0, 1] and 270. This method favors the latter.\n * @param {vec3} out_axis Vector receiving the axis of rotation\n * @param {ReadonlyQuat} q Quaternion to be decomposed\n * @return {Number} Angle, in radians, of the rotation\n */\n\nfunction getAxisAngle(out_axis, q) {\n var rad = Math.acos(q[3]) * 2.0;\n var s = Math.sin(rad / 2.0);\n\n if (s > EPSILON) {\n out_axis[0] = q[0] / s;\n out_axis[1] = q[1] / s;\n out_axis[2] = q[2] / s;\n } else {\n // If s is zero, return any axis (no rotation - axis does not matter)\n out_axis[0] = 1;\n out_axis[1] = 0;\n out_axis[2] = 0;\n }\n\n return rad;\n}\n/**\n * Gets the angular distance between two unit quaternions\n *\n * @param {ReadonlyQuat} a Origin unit quaternion\n * @param {ReadonlyQuat} b Destination unit quaternion\n * @return {Number} Angle, in radians, between the two quaternions\n */\n\nfunction getAngle(a, b) {\n var dotproduct = dot$2(a, b);\n return Math.acos(2 * dotproduct * dotproduct - 1);\n}\n/**\n * Multiplies two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {quat} out\n */\n\nfunction multiply$2(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the X axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\n\nfunction rotateX$1(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the Y axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\n\nfunction rotateY$1(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var by = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the Z axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\n\nfunction rotateZ$1(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bz = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n}\n/**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate W component of\n * @returns {quat} out\n */\n\nfunction calculateW(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n}\n/**\n * Calculate the exponential of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @returns {quat} out\n */\n\nfunction exp(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var et = Math.exp(w);\n var s = r > 0 ? et * Math.sin(r) / r : 0;\n out[0] = x * s;\n out[1] = y * s;\n out[2] = z * s;\n out[3] = et * Math.cos(r);\n return out;\n}\n/**\n * Calculate the natural logarithm of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @returns {quat} out\n */\n\nfunction ln(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var t = r > 0 ? Math.atan2(r, w) / r : 0;\n out[0] = x * t;\n out[1] = y * t;\n out[2] = z * t;\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\n return out;\n}\n/**\n * Calculate the scalar power of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @param {Number} b amount to scale the quaternion by\n * @returns {quat} out\n */\n\nfunction pow(out, a, b) {\n ln(out, a);\n scale$2(out, out, b);\n exp(out, out);\n return out;\n}\n/**\n * Performs a spherical linear interpolation between two quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n */\n\nfunction slerp(out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n var omega, cosom, sinom, scale0, scale1; // calc cosine\n\n cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)\n\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n } // calculate coefficients\n\n\n if (1.0 - cosom > EPSILON) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n } // calculate final values\n\n\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n}\n/**\n * Generates a random unit quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\n\nfunction random$1(out) {\n // Implementation of http://planning.cs.uiuc.edu/node198.html\n // TODO: Calling random 3 times is probably not the fastest solution\n var u1 = RANDOM();\n var u2 = RANDOM();\n var u3 = RANDOM();\n var sqrt1MinusU1 = Math.sqrt(1 - u1);\n var sqrtU1 = Math.sqrt(u1);\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\n return out;\n}\n/**\n * Calculates the inverse of a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate inverse of\n * @returns {quat} out\n */\n\nfunction invert$1(out, a) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\n out[0] = -a0 * invDot;\n out[1] = -a1 * invDot;\n out[2] = -a2 * invDot;\n out[3] = a3 * invDot;\n return out;\n}\n/**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate conjugate of\n * @returns {quat} out\n */\n\nfunction conjugate$1(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to renormalize the quaternion yourself where necessary.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyMat3} m rotation matrix\n * @returns {quat} out\n * @function\n */\n\nfunction fromMat3(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n var fTrace = m[0] + m[4] + m[8];\n var fRoot;\n\n if (fTrace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n\n out[3] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot; // 1/(4w)\n\n out[0] = (m[5] - m[7]) * fRoot;\n out[1] = (m[6] - m[2]) * fRoot;\n out[2] = (m[1] - m[3]) * fRoot;\n } else {\n // |w| <= 1/2\n var i = 0;\n if (m[4] > m[0]) i = 1;\n if (m[8] > m[i * 3 + i]) i = 2;\n var j = (i + 1) % 3;\n var k = (i + 2) % 3;\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\n }\n\n return out;\n}\n/**\n * Creates a quaternion from the given euler angle x, y, z.\n *\n * @param {quat} out the receiving quaternion\n * @param {x} Angle to rotate around X axis in degrees.\n * @param {y} Angle to rotate around Y axis in degrees.\n * @param {z} Angle to rotate around Z axis in degrees.\n * @returns {quat} out\n * @function\n */\n\nfunction fromEuler(out, x, y, z) {\n var halfToRad = 0.5 * Math.PI / 180.0;\n x *= halfToRad;\n y *= halfToRad;\n z *= halfToRad;\n var sx = Math.sin(x);\n var cx = Math.cos(x);\n var sy = Math.sin(y);\n var cy = Math.cos(y);\n var sz = Math.sin(z);\n var cz = Math.cos(z);\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n return out;\n}\n/**\n * Returns a string representation of a quatenion\n *\n * @param {ReadonlyQuat} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\n\nfunction str$2(a) {\n return \"quat(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \")\";\n}\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param {ReadonlyQuat} a quaternion to clone\n * @returns {quat} a new quaternion\n * @function\n */\n\nvar clone$2 = clone$3;\n/**\n * Creates a new quat initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} a new quaternion\n * @function\n */\n\nvar fromValues$2 = fromValues$3;\n/**\n * Copy the values from one quat to another\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the source quaternion\n * @returns {quat} out\n * @function\n */\n\nvar copy$2 = copy$3;\n/**\n * Set the components of a quat to the given values\n *\n * @param {quat} out the receiving quaternion\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} out\n * @function\n */\n\nvar set$2 = set$3;\n/**\n * Adds two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {quat} out\n * @function\n */\n\nvar add$2 = add$3;\n/**\n * Alias for {@link quat.multiply}\n * @function\n */\n\nvar mul$2 = multiply$2;\n/**\n * Scales a quat by a scalar number\n *\n * @param {quat} out the receiving vector\n * @param {ReadonlyQuat} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {quat} out\n * @function\n */\n\nvar scale$2 = scale$3;\n/**\n * Calculates the dot product of two quat's\n *\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {Number} dot product of a and b\n * @function\n */\n\nvar dot$2 = dot$3;\n/**\n * Performs a linear interpolation between two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n * @function\n */\n\nvar lerp$2 = lerp$3;\n/**\n * Calculates the length of a quat\n *\n * @param {ReadonlyQuat} a vector to calculate length of\n * @returns {Number} length of a\n */\n\nvar length$2 = length$3;\n/**\n * Alias for {@link quat.length}\n * @function\n */\n\nvar len$2 = length$2;\n/**\n * Calculates the squared length of a quat\n *\n * @param {ReadonlyQuat} a vector to calculate squared length of\n * @returns {Number} squared length of a\n * @function\n */\n\nvar squaredLength$2 = squaredLength$3;\n/**\n * Alias for {@link quat.squaredLength}\n * @function\n */\n\nvar sqrLen$2 = squaredLength$2;\n/**\n * Normalize a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quaternion to normalize\n * @returns {quat} out\n * @function\n */\n\nvar normalize$2 = normalize$3;\n/**\n * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyQuat} a The first quaternion.\n * @param {ReadonlyQuat} b The second quaternion.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nvar exactEquals$2 = exactEquals$3;\n/**\n * Returns whether or not the quaternions have approximately the same elements in the same position.\n *\n * @param {ReadonlyQuat} a The first vector.\n * @param {ReadonlyQuat} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nvar equals$2 = equals$3;\n/**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n *\n * @param {quat} out the receiving quaternion.\n * @param {ReadonlyVec3} a the initial vector\n * @param {ReadonlyVec3} b the destination vector\n * @returns {quat} out\n */\n\nvar rotationTo = function () {\n var tmpvec3 = create$4();\n var xUnitVec3 = fromValues$4(1, 0, 0);\n var yUnitVec3 = fromValues$4(0, 1, 0);\n return function (out, a, b) {\n var dot = dot$4(a, b);\n\n if (dot < -0.999999) {\n cross$2(tmpvec3, xUnitVec3, a);\n if (len$4(tmpvec3) < 0.000001) cross$2(tmpvec3, yUnitVec3, a);\n normalize$4(tmpvec3, tmpvec3);\n setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n cross$2(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return normalize$2(out, out);\n }\n };\n}();\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {ReadonlyQuat} c the third operand\n * @param {ReadonlyQuat} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n */\n\nvar sqlerp = function () {\n var temp1 = create$2();\n var temp2 = create$2();\n return function (out, a, b, c, d, t) {\n slerp(temp1, a, d, t);\n slerp(temp2, b, c, t);\n slerp(out, temp1, temp2, 2 * t * (1 - t));\n return out;\n };\n}();\n/**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n *\n * @param {ReadonlyVec3} view the vector representing the viewing direction\n * @param {ReadonlyVec3} right the vector representing the local \"right\" direction\n * @param {ReadonlyVec3} up the vector representing the local \"up\" direction\n * @returns {quat} out\n */\n\nvar setAxes = function () {\n var matr = create$6();\n return function (out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n return normalize$2(out, fromMat3(out, matr));\n };\n}();\n\nconst quat = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$2,\n calculateW: calculateW,\n clone: clone$2,\n conjugate: conjugate$1,\n copy: copy$2,\n create: create$2,\n dot: dot$2,\n equals: equals$2,\n exactEquals: exactEquals$2,\n exp: exp,\n fromEuler: fromEuler,\n fromMat3: fromMat3,\n fromValues: fromValues$2,\n getAngle: getAngle,\n getAxisAngle: getAxisAngle,\n identity: identity$1,\n invert: invert$1,\n len: len$2,\n length: length$2,\n lerp: lerp$2,\n ln: ln,\n mul: mul$2,\n multiply: multiply$2,\n normalize: normalize$2,\n pow: pow,\n random: random$1,\n rotateX: rotateX$1,\n rotateY: rotateY$1,\n rotateZ: rotateZ$1,\n rotationTo: rotationTo,\n scale: scale$2,\n set: set$2,\n setAxes: setAxes,\n setAxisAngle: setAxisAngle,\n slerp: slerp,\n sqlerp: sqlerp,\n sqrLen: sqrLen$2,\n squaredLength: squaredLength$2,\n str: str$2\n});\n\n/**\n * Dual Quaternion
\n * Format: [real, dual]
\n * Quaternion format: XYZW
\n * Make sure to have normalized dual quaternions, otherwise the functions may not work as intended.
\n * @module quat2\n */\n\n/**\n * Creates a new identity dual quat\n *\n * @returns {quat2} a new dual quaternion [real -> rotation, dual -> translation]\n */\n\nfunction create$1() {\n var dq = new ARRAY_TYPE(8);\n\n if (ARRAY_TYPE != Float32Array) {\n dq[0] = 0;\n dq[1] = 0;\n dq[2] = 0;\n dq[4] = 0;\n dq[5] = 0;\n dq[6] = 0;\n dq[7] = 0;\n }\n\n dq[3] = 1;\n return dq;\n}\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param {ReadonlyQuat2} a dual quaternion to clone\n * @returns {quat2} new dual quaternion\n * @function\n */\n\nfunction clone$1(a) {\n var dq = new ARRAY_TYPE(8);\n dq[0] = a[0];\n dq[1] = a[1];\n dq[2] = a[2];\n dq[3] = a[3];\n dq[4] = a[4];\n dq[5] = a[5];\n dq[6] = a[6];\n dq[7] = a[7];\n return dq;\n}\n/**\n * Creates a new dual quat initialized with the given values\n *\n * @param {Number} x1 X component\n * @param {Number} y1 Y component\n * @param {Number} z1 Z component\n * @param {Number} w1 W component\n * @param {Number} x2 X component\n * @param {Number} y2 Y component\n * @param {Number} z2 Z component\n * @param {Number} w2 W component\n * @returns {quat2} new dual quaternion\n * @function\n */\n\nfunction fromValues$1(x1, y1, z1, w1, x2, y2, z2, w2) {\n var dq = new ARRAY_TYPE(8);\n dq[0] = x1;\n dq[1] = y1;\n dq[2] = z1;\n dq[3] = w1;\n dq[4] = x2;\n dq[5] = y2;\n dq[6] = z2;\n dq[7] = w2;\n return dq;\n}\n/**\n * Creates a new dual quat from the given values (quat and translation)\n *\n * @param {Number} x1 X component\n * @param {Number} y1 Y component\n * @param {Number} z1 Z component\n * @param {Number} w1 W component\n * @param {Number} x2 X component (translation)\n * @param {Number} y2 Y component (translation)\n * @param {Number} z2 Z component (translation)\n * @returns {quat2} new dual quaternion\n * @function\n */\n\nfunction fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) {\n var dq = new ARRAY_TYPE(8);\n dq[0] = x1;\n dq[1] = y1;\n dq[2] = z1;\n dq[3] = w1;\n var ax = x2 * 0.5,\n ay = y2 * 0.5,\n az = z2 * 0.5;\n dq[4] = ax * w1 + ay * z1 - az * y1;\n dq[5] = ay * w1 + az * x1 - ax * z1;\n dq[6] = az * w1 + ax * y1 - ay * x1;\n dq[7] = -ax * x1 - ay * y1 - az * z1;\n return dq;\n}\n/**\n * Creates a dual quat from a quaternion and a translation\n *\n * @param {ReadonlyQuat2} dual quaternion receiving operation result\n * @param {ReadonlyQuat} q a normalized quaternion\n * @param {ReadonlyVec3} t tranlation vector\n * @returns {quat2} dual quaternion receiving operation result\n * @function\n */\n\nfunction fromRotationTranslation(out, q, t) {\n var ax = t[0] * 0.5,\n ay = t[1] * 0.5,\n az = t[2] * 0.5,\n bx = q[0],\n by = q[1],\n bz = q[2],\n bw = q[3];\n out[0] = bx;\n out[1] = by;\n out[2] = bz;\n out[3] = bw;\n out[4] = ax * bw + ay * bz - az * by;\n out[5] = ay * bw + az * bx - ax * bz;\n out[6] = az * bw + ax * by - ay * bx;\n out[7] = -ax * bx - ay * by - az * bz;\n return out;\n}\n/**\n * Creates a dual quat from a translation\n *\n * @param {ReadonlyQuat2} dual quaternion receiving operation result\n * @param {ReadonlyVec3} t translation vector\n * @returns {quat2} dual quaternion receiving operation result\n * @function\n */\n\nfunction fromTranslation(out, t) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = t[0] * 0.5;\n out[5] = t[1] * 0.5;\n out[6] = t[2] * 0.5;\n out[7] = 0;\n return out;\n}\n/**\n * Creates a dual quat from a quaternion\n *\n * @param {ReadonlyQuat2} dual quaternion receiving operation result\n * @param {ReadonlyQuat} q the quaternion\n * @returns {quat2} dual quaternion receiving operation result\n * @function\n */\n\nfunction fromRotation(out, q) {\n out[0] = q[0];\n out[1] = q[1];\n out[2] = q[2];\n out[3] = q[3];\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n}\n/**\n * Creates a new dual quat from a matrix (4x4)\n *\n * @param {quat2} out the dual quaternion\n * @param {ReadonlyMat4} a the matrix\n * @returns {quat2} dual quat receiving operation result\n * @function\n */\n\nfunction fromMat4(out, a) {\n //TODO Optimize this\n var outer = create$2();\n getRotation(outer, a);\n var t = new ARRAY_TYPE(3);\n getTranslation$1(t, a);\n fromRotationTranslation(out, outer, t);\n return out;\n}\n/**\n * Copy the values from one dual quat to another\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the source dual quaternion\n * @returns {quat2} out\n * @function\n */\n\nfunction copy$1(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n return out;\n}\n/**\n * Set a dual quat to the identity dual quaternion\n *\n * @param {quat2} out the receiving quaternion\n * @returns {quat2} out\n */\n\nfunction identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n}\n/**\n * Set the components of a dual quat to the given values\n *\n * @param {quat2} out the receiving quaternion\n * @param {Number} x1 X component\n * @param {Number} y1 Y component\n * @param {Number} z1 Z component\n * @param {Number} w1 W component\n * @param {Number} x2 X component\n * @param {Number} y2 Y component\n * @param {Number} z2 Z component\n * @param {Number} w2 W component\n * @returns {quat2} out\n * @function\n */\n\nfunction set$1(out, x1, y1, z1, w1, x2, y2, z2, w2) {\n out[0] = x1;\n out[1] = y1;\n out[2] = z1;\n out[3] = w1;\n out[4] = x2;\n out[5] = y2;\n out[6] = z2;\n out[7] = w2;\n return out;\n}\n/**\n * Gets the real part of a dual quat\n * @param {quat} out real part\n * @param {ReadonlyQuat2} a Dual Quaternion\n * @return {quat} real part\n */\n\nvar getReal = copy$2;\n/**\n * Gets the dual part of a dual quat\n * @param {quat} out dual part\n * @param {ReadonlyQuat2} a Dual Quaternion\n * @return {quat} dual part\n */\n\nfunction getDual(out, a) {\n out[0] = a[4];\n out[1] = a[5];\n out[2] = a[6];\n out[3] = a[7];\n return out;\n}\n/**\n * Set the real component of a dual quat to the given quaternion\n *\n * @param {quat2} out the receiving quaternion\n * @param {ReadonlyQuat} q a quaternion representing the real part\n * @returns {quat2} out\n * @function\n */\n\nvar setReal = copy$2;\n/**\n * Set the dual component of a dual quat to the given quaternion\n *\n * @param {quat2} out the receiving quaternion\n * @param {ReadonlyQuat} q a quaternion representing the dual part\n * @returns {quat2} out\n * @function\n */\n\nfunction setDual(out, q) {\n out[4] = q[0];\n out[5] = q[1];\n out[6] = q[2];\n out[7] = q[3];\n return out;\n}\n/**\n * Gets the translation of a normalized dual quat\n * @param {vec3} out translation\n * @param {ReadonlyQuat2} a Dual Quaternion to be decomposed\n * @return {vec3} translation\n */\n\nfunction getTranslation(out, a) {\n var ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7],\n bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3];\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n return out;\n}\n/**\n * Translates a dual quat by the given vector\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to translate\n * @param {ReadonlyVec3} v vector to translate by\n * @returns {quat2} out\n */\n\nfunction translate(out, a, v) {\n var ax1 = a[0],\n ay1 = a[1],\n az1 = a[2],\n aw1 = a[3],\n bx1 = v[0] * 0.5,\n by1 = v[1] * 0.5,\n bz1 = v[2] * 0.5,\n ax2 = a[4],\n ay2 = a[5],\n az2 = a[6],\n aw2 = a[7];\n out[0] = ax1;\n out[1] = ay1;\n out[2] = az1;\n out[3] = aw1;\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\n return out;\n}\n/**\n * Rotates a dual quat around the X axis\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @param {number} rad how far should the rotation be\n * @returns {quat2} out\n */\n\nfunction rotateX(out, a, rad) {\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7],\n ax1 = ax * bw + aw * bx + ay * bz - az * by,\n ay1 = ay * bw + aw * by + az * bx - ax * bz,\n az1 = az * bw + aw * bz + ax * by - ay * bx,\n aw1 = aw * bw - ax * bx - ay * by - az * bz;\n rotateX$1(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n}\n/**\n * Rotates a dual quat around the Y axis\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @param {number} rad how far should the rotation be\n * @returns {quat2} out\n */\n\nfunction rotateY(out, a, rad) {\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7],\n ax1 = ax * bw + aw * bx + ay * bz - az * by,\n ay1 = ay * bw + aw * by + az * bx - ax * bz,\n az1 = az * bw + aw * bz + ax * by - ay * bx,\n aw1 = aw * bw - ax * bx - ay * by - az * bz;\n rotateY$1(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n}\n/**\n * Rotates a dual quat around the Z axis\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @param {number} rad how far should the rotation be\n * @returns {quat2} out\n */\n\nfunction rotateZ(out, a, rad) {\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7],\n ax1 = ax * bw + aw * bx + ay * bz - az * by,\n ay1 = ay * bw + aw * by + az * bx - ax * bz,\n az1 = az * bw + aw * bz + ax * by - ay * bx,\n aw1 = aw * bw - ax * bx - ay * by - az * bz;\n rotateZ$1(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n}\n/**\n * Rotates a dual quat by a given quaternion (a * q)\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @param {ReadonlyQuat} q quaternion to rotate by\n * @returns {quat2} out\n */\n\nfunction rotateByQuatAppend(out, a, q) {\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3],\n ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\n ax = a[4];\n ay = a[5];\n az = a[6];\n aw = a[7];\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\n return out;\n}\n/**\n * Rotates a dual quat by a given quaternion (q * a)\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat} q quaternion to rotate by\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @returns {quat2} out\n */\n\nfunction rotateByQuatPrepend(out, q, a) {\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3],\n bx = a[0],\n by = a[1],\n bz = a[2],\n bw = a[3];\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\n bx = a[4];\n by = a[5];\n bz = a[6];\n bw = a[7];\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\n return out;\n}\n/**\n * Rotates a dual quat around a given axis. Does the normalisation automatically\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the dual quaternion to rotate\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @param {Number} rad how far the rotation should be\n * @returns {quat2} out\n */\n\nfunction rotateAroundAxis(out, a, axis, rad) {\n //Special case for rad = 0\n if (Math.abs(rad) < EPSILON) {\n return copy$1(out, a);\n }\n\n var axisLength = Math.hypot(axis[0], axis[1], axis[2]);\n rad = rad * 0.5;\n var s = Math.sin(rad);\n var bx = s * axis[0] / axisLength;\n var by = s * axis[1] / axisLength;\n var bz = s * axis[2] / axisLength;\n var bw = Math.cos(rad);\n var ax1 = a[0],\n ay1 = a[1],\n az1 = a[2],\n aw1 = a[3];\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n var ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n}\n/**\n * Adds two dual quat's\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the first operand\n * @param {ReadonlyQuat2} b the second operand\n * @returns {quat2} out\n * @function\n */\n\nfunction add$1(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n return out;\n}\n/**\n * Multiplies two dual quat's\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a the first operand\n * @param {ReadonlyQuat2} b the second operand\n * @returns {quat2} out\n */\n\nfunction multiply$1(out, a, b) {\n var ax0 = a[0],\n ay0 = a[1],\n az0 = a[2],\n aw0 = a[3],\n bx1 = b[4],\n by1 = b[5],\n bz1 = b[6],\n bw1 = b[7],\n ax1 = a[4],\n ay1 = a[5],\n az1 = a[6],\n aw1 = a[7],\n bx0 = b[0],\n by0 = b[1],\n bz0 = b[2],\n bw0 = b[3];\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\n out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0;\n out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0;\n out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0;\n out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0;\n return out;\n}\n/**\n * Alias for {@link quat2.multiply}\n * @function\n */\n\nvar mul$1 = multiply$1;\n/**\n * Scales a dual quat by a scalar number\n *\n * @param {quat2} out the receiving dual quat\n * @param {ReadonlyQuat2} a the dual quat to scale\n * @param {Number} b amount to scale the dual quat by\n * @returns {quat2} out\n * @function\n */\n\nfunction scale$1(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n return out;\n}\n/**\n * Calculates the dot product of two dual quat's (The dot product of the real parts)\n *\n * @param {ReadonlyQuat2} a the first operand\n * @param {ReadonlyQuat2} b the second operand\n * @returns {Number} dot product of a and b\n * @function\n */\n\nvar dot$1 = dot$2;\n/**\n * Performs a linear interpolation between two dual quats's\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when t = 0.5)\n *\n * @param {quat2} out the receiving dual quat\n * @param {ReadonlyQuat2} a the first operand\n * @param {ReadonlyQuat2} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat2} out\n */\n\nfunction lerp$1(out, a, b, t) {\n var mt = 1 - t;\n if (dot$1(a, b) < 0) t = -t;\n out[0] = a[0] * mt + b[0] * t;\n out[1] = a[1] * mt + b[1] * t;\n out[2] = a[2] * mt + b[2] * t;\n out[3] = a[3] * mt + b[3] * t;\n out[4] = a[4] * mt + b[4] * t;\n out[5] = a[5] * mt + b[5] * t;\n out[6] = a[6] * mt + b[6] * t;\n out[7] = a[7] * mt + b[7] * t;\n return out;\n}\n/**\n * Calculates the inverse of a dual quat. If they are normalized, conjugate is cheaper\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a dual quat to calculate inverse of\n * @returns {quat2} out\n */\n\nfunction invert(out, a) {\n var sqlen = squaredLength$1(a);\n out[0] = -a[0] / sqlen;\n out[1] = -a[1] / sqlen;\n out[2] = -a[2] / sqlen;\n out[3] = a[3] / sqlen;\n out[4] = -a[4] / sqlen;\n out[5] = -a[5] / sqlen;\n out[6] = -a[6] / sqlen;\n out[7] = a[7] / sqlen;\n return out;\n}\n/**\n * Calculates the conjugate of a dual quat\n * If the dual quaternion is normalized, this function is faster than quat2.inverse and produces the same result.\n *\n * @param {quat2} out the receiving quaternion\n * @param {ReadonlyQuat2} a quat to calculate conjugate of\n * @returns {quat2} out\n */\n\nfunction conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n out[4] = -a[4];\n out[5] = -a[5];\n out[6] = -a[6];\n out[7] = a[7];\n return out;\n}\n/**\n * Calculates the length of a dual quat\n *\n * @param {ReadonlyQuat2} a dual quat to calculate length of\n * @returns {Number} length of a\n * @function\n */\n\nvar length$1 = length$2;\n/**\n * Alias for {@link quat2.length}\n * @function\n */\n\nvar len$1 = length$1;\n/**\n * Calculates the squared length of a dual quat\n *\n * @param {ReadonlyQuat2} a dual quat to calculate squared length of\n * @returns {Number} squared length of a\n * @function\n */\n\nvar squaredLength$1 = squaredLength$2;\n/**\n * Alias for {@link quat2.squaredLength}\n * @function\n */\n\nvar sqrLen$1 = squaredLength$1;\n/**\n * Normalize a dual quat\n *\n * @param {quat2} out the receiving dual quaternion\n * @param {ReadonlyQuat2} a dual quaternion to normalize\n * @returns {quat2} out\n * @function\n */\n\nfunction normalize$1(out, a) {\n var magnitude = squaredLength$1(a);\n\n if (magnitude > 0) {\n magnitude = Math.sqrt(magnitude);\n var a0 = a[0] / magnitude;\n var a1 = a[1] / magnitude;\n var a2 = a[2] / magnitude;\n var a3 = a[3] / magnitude;\n var b0 = a[4];\n var b1 = a[5];\n var b2 = a[6];\n var b3 = a[7];\n var a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\n }\n\n return out;\n}\n/**\n * Returns a string representation of a dual quatenion\n *\n * @param {ReadonlyQuat2} a dual quaternion to represent as a string\n * @returns {String} string representation of the dual quat\n */\n\nfunction str$1(a) {\n return \"quat2(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \")\";\n}\n/**\n * Returns whether or not the dual quaternions have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyQuat2} a the first dual quaternion.\n * @param {ReadonlyQuat2} b the second dual quaternion.\n * @returns {Boolean} true if the dual quaternions are equal, false otherwise.\n */\n\nfunction exactEquals$1(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7];\n}\n/**\n * Returns whether or not the dual quaternions have approximately the same elements in the same position.\n *\n * @param {ReadonlyQuat2} a the first dual quat.\n * @param {ReadonlyQuat2} b the second dual quat.\n * @returns {Boolean} true if the dual quats are equal, false otherwise.\n */\n\nfunction equals$1(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7));\n}\n\nconst quat2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add$1,\n clone: clone$1,\n conjugate: conjugate,\n copy: copy$1,\n create: create$1,\n dot: dot$1,\n equals: equals$1,\n exactEquals: exactEquals$1,\n fromMat4: fromMat4,\n fromRotation: fromRotation,\n fromRotationTranslation: fromRotationTranslation,\n fromRotationTranslationValues: fromRotationTranslationValues,\n fromTranslation: fromTranslation,\n fromValues: fromValues$1,\n getDual: getDual,\n getReal: getReal,\n getTranslation: getTranslation,\n identity: identity,\n invert: invert,\n len: len$1,\n length: length$1,\n lerp: lerp$1,\n mul: mul$1,\n multiply: multiply$1,\n normalize: normalize$1,\n rotateAroundAxis: rotateAroundAxis,\n rotateByQuatAppend: rotateByQuatAppend,\n rotateByQuatPrepend: rotateByQuatPrepend,\n rotateX: rotateX,\n rotateY: rotateY,\n rotateZ: rotateZ,\n scale: scale$1,\n set: set$1,\n setDual: setDual,\n setReal: setReal,\n sqrLen: sqrLen$1,\n squaredLength: squaredLength$1,\n str: str$1,\n translate: translate\n});\n\n/**\n * 2 Dimensional Vector\n * @module vec2\n */\n\n/**\n * Creates a new, empty vec2\n *\n * @returns {vec2} a new 2D vector\n */\n\nfunction create() {\n var out = new ARRAY_TYPE(2);\n\n if (ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n }\n\n return out;\n}\n/**\n * Creates a new vec2 initialized with values from an existing vector\n *\n * @param {ReadonlyVec2} a vector to clone\n * @returns {vec2} a new 2D vector\n */\n\nfunction clone(a) {\n var out = new ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\n * Creates a new vec2 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} a new 2D vector\n */\n\nfunction fromValues(x, y) {\n var out = new ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\n * Copy the values from one vec2 to another\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the source vector\n * @returns {vec2} out\n */\n\nfunction copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\n * Set the components of a vec2 to the given values\n *\n * @param {vec2} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} out\n */\n\nfunction set(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\n * Adds two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n}\n/**\n * Multiplies two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n}\n/**\n * Divides two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n}\n/**\n * Math.ceil the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to ceil\n * @returns {vec2} out\n */\n\nfunction ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n}\n/**\n * Math.floor the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to floor\n * @returns {vec2} out\n */\n\nfunction floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n}\n/**\n * Returns the minimum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n}\n/**\n * Returns the maximum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec2} out\n */\n\nfunction max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n}\n/**\n * Math.round the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to round\n * @returns {vec2} out\n */\n\nfunction round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n return out;\n}\n/**\n * Scales a vec2 by a scalar number\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec2} out\n */\n\nfunction scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n}\n/**\n * Adds two vec2's after scaling the second operand by a scalar value\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec2} out\n */\n\nfunction scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec2's\n *\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {Number} distance between a and b\n */\n\nfunction distance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.hypot(x, y);\n}\n/**\n * Calculates the squared euclidian distance between two vec2's\n *\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {Number} squared distance between a and b\n */\n\nfunction squaredDistance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x * x + y * y;\n}\n/**\n * Calculates the length of a vec2\n *\n * @param {ReadonlyVec2} a vector to calculate length of\n * @returns {Number} length of a\n */\n\nfunction length(a) {\n var x = a[0],\n y = a[1];\n return Math.hypot(x, y);\n}\n/**\n * Calculates the squared length of a vec2\n *\n * @param {ReadonlyVec2} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\n\nfunction squaredLength(a) {\n var x = a[0],\n y = a[1];\n return x * x + y * y;\n}\n/**\n * Negates the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to negate\n * @returns {vec2} out\n */\n\nfunction negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to invert\n * @returns {vec2} out\n */\n\nfunction inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n}\n/**\n * Normalize a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a vector to normalize\n * @returns {vec2} out\n */\n\nfunction normalize(out, a) {\n var x = a[0],\n y = a[1];\n var len = x * x + y * y;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec2's\n *\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {Number} dot product of a and b\n */\n\nfunction dot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n}\n/**\n * Computes the cross product of two vec2's\n * Note that the cross product must by definition produce a 3D vector\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @returns {vec3} out\n */\n\nfunction cross(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the first operand\n * @param {ReadonlyVec2} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec2} out\n */\n\nfunction lerp(out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec2} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec2} out\n */\n\nfunction random(out, scale) {\n scale = scale || 1.0;\n var r = RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n}\n/**\n * Transforms the vec2 with a mat2\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the vector to transform\n * @param {ReadonlyMat2} m matrix to transform with\n * @returns {vec2} out\n */\n\nfunction transformMat2(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n}\n/**\n * Transforms the vec2 with a mat2d\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the vector to transform\n * @param {ReadonlyMat2d} m matrix to transform with\n * @returns {vec2} out\n */\n\nfunction transformMat2d(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n}\n/**\n * Transforms the vec2 with a mat3\n * 3rd vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the vector to transform\n * @param {ReadonlyMat3} m matrix to transform with\n * @returns {vec2} out\n */\n\nfunction transformMat3(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n}\n/**\n * Transforms the vec2 with a mat4\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {ReadonlyVec2} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec2} out\n */\n\nfunction transformMat4(out, a, m) {\n var x = a[0];\n var y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n}\n/**\n * Rotate a 2D vector\n * @param {vec2} out The receiving vec2\n * @param {ReadonlyVec2} a The vec2 point to rotate\n * @param {ReadonlyVec2} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec2} out\n */\n\nfunction rotate(out, a, b, rad) {\n //Translate point to the origin\n var p0 = a[0] - b[0],\n p1 = a[1] - b[1],\n sinC = Math.sin(rad),\n cosC = Math.cos(rad); //perform rotation and translate to correct position\n\n out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n return out;\n}\n/**\n * Get the angle between two 2D vectors\n * @param {ReadonlyVec2} a The first operand\n * @param {ReadonlyVec2} b The second operand\n * @returns {Number} The angle in radians\n */\n\nfunction angle(a, b) {\n var x1 = a[0],\n y1 = a[1],\n x2 = b[0],\n y2 = b[1],\n // mag is the product of the magnitudes of a and b\n mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2),\n // mag &&.. short circuits if mag == 0\n cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\n\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n/**\n * Set the components of a vec2 to zero\n *\n * @param {vec2} out the receiving vector\n * @returns {vec2} out\n */\n\nfunction zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec2} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\n\nfunction str(a) {\n return \"vec2(\" + a[0] + \", \" + a[1] + \")\";\n}\n/**\n * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec2} a The first vector.\n * @param {ReadonlyVec2} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec2} a The first vector.\n * @param {ReadonlyVec2} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nfunction equals(a, b) {\n var a0 = a[0],\n a1 = a[1];\n var b0 = b[0],\n b1 = b[1];\n return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1));\n}\n/**\n * Alias for {@link vec2.length}\n * @function\n */\n\nvar len = length;\n/**\n * Alias for {@link vec2.subtract}\n * @function\n */\n\nvar sub = subtract;\n/**\n * Alias for {@link vec2.multiply}\n * @function\n */\n\nvar mul = multiply;\n/**\n * Alias for {@link vec2.divide}\n * @function\n */\n\nvar div = divide;\n/**\n * Alias for {@link vec2.distance}\n * @function\n */\n\nvar dist = distance;\n/**\n * Alias for {@link vec2.squaredDistance}\n * @function\n */\n\nvar sqrDist = squaredDistance;\n/**\n * Alias for {@link vec2.squaredLength}\n * @function\n */\n\nvar sqrLen = squaredLength;\n/**\n * Perform some operation over an array of vec2s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\n\nvar forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 2;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n }\n\n return a;\n };\n}();\n\nconst vec2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n add: add,\n angle: angle,\n ceil: ceil,\n clone: clone,\n copy: copy,\n create: create,\n cross: cross,\n dist: dist,\n distance: distance,\n div: div,\n divide: divide,\n dot: dot,\n equals: equals,\n exactEquals: exactEquals,\n floor: floor,\n forEach: forEach,\n fromValues: fromValues,\n inverse: inverse,\n len: len,\n length: length,\n lerp: lerp,\n max: max,\n min: min,\n mul: mul,\n multiply: multiply,\n negate: negate,\n normalize: normalize,\n random: random,\n rotate: rotate,\n round: round,\n scale: scale,\n scaleAndAdd: scaleAndAdd,\n set: set,\n sqrDist: sqrDist,\n sqrLen: sqrLen,\n squaredDistance: squaredDistance,\n squaredLength: squaredLength,\n str: str,\n sub: sub,\n subtract: subtract,\n transformMat2: transformMat2,\n transformMat2d: transformMat2d,\n transformMat3: transformMat3,\n transformMat4: transformMat4,\n zero: zero\n});\n\n/**\n * Provides a way to calculate velocity via effectively creating a \"complementary filter\".\n *\n * `velQuick` and `velSmooth` separately accumulate over time. `velInstant` and `velUsed` do not accumulate and are\n * discarded each update. `velQuick` is responsive, but noisy. `velSmooth` is laggy but eventually more accurate. By\n * tracking them separately the used result can be responsive in the short term and accurate in the long term.\n *\n * TODO: This class will be moved to a final location in the @typhonjs-svelte/lib/math package.\n */\nclass TJSVelocityTrack\n{\n /** @type {number} */\n #lastSampleTime;\n\n /**\n * Tracks the last sample point.\n *\n * @type {{x: number, y: number, z: number}}\n */\n #lastSamplePoint = { x: 0, y: 0, z: 0 };\n\n /**\n * Defines the settle time in milliseconds that resets any tracked velocity state.\n *\n * @type {number}\n */\n #resetDeltaTime;\n\n /**\n * Stores the scaling conversion for used velocity calculation. By default, this is 1000 which converts the velocity\n * calculation to velocity per second. Set to `1` for instance for velocity per millisecond.\n *\n * @type {number}\n */\n #scaleTime;\n\n /**\n * Stores the instant velocity between current and last sample point.\n *\n * @type {{x: number, y: number, z: number}}\n */\n #velInstant = { x: 0, y: 0, z: 0 };\n\n /**\n * Stores the `quick` running calculated velocity.\n *\n * @type {{x: number, y: number, z: number}}\n */\n #velQuick = { x: 0, y: 0, z: 0 };\n\n /**\n * Stores the `smooth` running calculated velocity.\n *\n * @type {{x: number, y: number, z: number}}\n */\n #velSmooth = { x: 0, y: 0, z: 0 };\n\n /**\n * Stores the mix between `quick` and `smooth` running velocity.\n *\n * @type {{x: number, y: number, z: number}}\n */\n #velUsed = { x: 0, y: 0, z: 0 };\n\n /**\n * Creates a velocity tracker instance.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.resetDeltaTime=50] - Delta time in milliseconds that resets velocity tracking.\n *\n * @param {number} [opts.scaleTime=1000] - Scales velocity calculation to new time frame. 1000 is velocity per\n * second.\n */\n constructor({ resetDeltaTime = 50, scaleTime = 1000 } = {})\n {\n this.resetDeltaTime = resetDeltaTime;\n this.scaleTime = scaleTime;\n\n Object.seal(this.#velUsed);\n }\n\n /**\n * @returns {number} Gets `resetDeltaTime`.\n */\n get resetDeltaTime() { return this.#resetDeltaTime; }\n\n /**\n * @returns {number} Gets `scaleTime`.\n */\n get scaleTime() { return this.#scaleTime; }\n\n /**\n * Sets `resetDeltaTime`.\n *\n * @param {number} resetDeltaTime - Delta time in milliseconds that resets velocity tracking.\n */\n set resetDeltaTime(resetDeltaTime)\n {\n if (!Number.isFinite(resetDeltaTime) || resetDeltaTime < 0)\n {\n throw new TypeError(`'resetDeltaTime' is not a positive finite number.`);\n }\n\n this.#resetDeltaTime = resetDeltaTime;\n }\n\n /**\n * Sets `scaleTime`.\n *\n * @param {number} scaleTime - Scales velocity calculation to new time frame. 1000 is velocity per second.\n */\n set scaleTime(scaleTime)\n {\n if (!Number.isFinite(scaleTime) || scaleTime < 0)\n {\n throw new TypeError(`'scaleTime' is not a positive finite number.`);\n }\n\n this.#scaleTime = scaleTime;\n }\n\n /**\n * Resets velocity tracking data.\n *\n * @param {number} [x=0] - 'X' value to set to last sample point.\n *\n * @param {number} [y=0] - 'Y' value to set to last sample point.\n *\n * @param {number} [z=0] - 'Z' value to set to last sample point.\n *\n * @param {number} [sampleTime=performance.now()] - A sample time in milliseconds resolution.\n */\n reset(x = 0, y = 0, z = 0, sampleTime = performance.now())\n {\n if (!Number.isFinite(x)) { throw new TypeError(`'x' is not a finite number.`); }\n if (!Number.isFinite(y)) { throw new TypeError(`'y' is not a finite number.`); }\n if (!Number.isFinite(z)) { throw new TypeError(`'z' is not a finite number.`); }\n if (!Number.isFinite(sampleTime)) { throw new TypeError(`'sampleTime' is not a finite number.`); }\n\n // Reset velocity tracking variables.\n this.#lastSampleTime = sampleTime;\n\n this.#lastSamplePoint.x = x;\n this.#lastSamplePoint.y = y;\n this.#lastSamplePoint.z = z;\n\n this.#velInstant.x = this.#velQuick.x = this.#velSmooth.x = this.#velUsed.x = 0;\n this.#velInstant.y = this.#velQuick.y = this.#velSmooth.y = this.#velUsed.y = 0;\n this.#velInstant.z = this.#velQuick.z = this.#velSmooth.z = this.#velUsed.z = 0;\n }\n\n /**\n * Runs ongoing velocity calculation of x / y / z given a sample time.\n *\n * @param {number|undefined} x - New sample X\n *\n * @param {number|undefined} y - New sample Y\n *\n * @param {number|undefined} z - New sample Z\n *\n * @param {number} [sampleTime=performance.now()] - An optional specific time w/ millisecond resolution.\n *\n * @returns {{x: number, y: number, z: number}} current velocity.\n */\n update(x = void 0, y = void 0, z = void 0, sampleTime = performance.now())\n {\n if (!Number.isFinite(sampleTime)) { throw new TypeError(`'sampleTime' is not a finite number.`); }\n\n const deltaTime = sampleTime - this.#lastSampleTime + Number.EPSILON;\n this.#lastSampleTime = sampleTime;\n\n // Reset velocity tracking if the delta time is greater than `resetDeltaTime`.\n if (deltaTime > this.#resetDeltaTime)\n {\n this.reset(x, y, z, sampleTime);\n return this.#velUsed;\n }\n\n if (Number.isFinite(x))\n {\n this.#velInstant.x = (x - this.#lastSamplePoint.x) / deltaTime;\n\n this.#lastSamplePoint.x = x;\n\n this.#velQuick.x = lerp$5(this.#velQuick.x, this.#velInstant.x, 0.1);\n this.#velSmooth.x = lerp$5(this.#velSmooth.x, this.#velInstant.x, 0.01);\n this.#velUsed.x = lerp$5(this.#velSmooth.x, this.#velQuick.x, 0.5) * this.#scaleTime;\n }\n\n if (Number.isFinite(y))\n {\n this.#velInstant.y = (y - this.#lastSamplePoint.y) / deltaTime;\n\n this.#lastSamplePoint.y = y;\n\n this.#velQuick.y = lerp$5(this.#velQuick.y, this.#velInstant.y, 0.1);\n this.#velSmooth.y = lerp$5(this.#velSmooth.y, this.#velInstant.y, 0.01);\n\n this.#velUsed.y = lerp$5(this.#velSmooth.y, this.#velQuick.y, 0.5) * this.#scaleTime;\n }\n\n if (Number.isFinite(z))\n {\n this.#velInstant.z = (z - this.#lastSamplePoint.z) / deltaTime;\n\n this.#lastSamplePoint.z = z;\n\n this.#velQuick.z = lerp$5(this.#velQuick.z, this.#velInstant.z, 0.1);\n this.#velSmooth.z = lerp$5(this.#velSmooth.z, this.#velInstant.z, 0.01);\n this.#velUsed.z = lerp$5(this.#velSmooth.z, this.#velQuick.z, 0.5) * this.#scaleTime;\n }\n\n return this.#velUsed;\n }\n\n /**\n * Gets the current velocity tracking data.\n *\n * @returns {{x: number, y: number, z: number}} Velocity tracking data.\n */\n get()\n {\n this.#velUsed.x = lerp$5(this.#velSmooth.x, this.#velQuick.x, 0.5) * this.#scaleTime;\n this.#velUsed.y = lerp$5(this.#velSmooth.y, this.#velQuick.y, 0.5) * this.#scaleTime;\n this.#velUsed.z = lerp$5(this.#velSmooth.z, this.#velQuick.z, 0.5) * this.#scaleTime;\n\n return this.#velUsed;\n }\n}\n\nexport { TJSVelocityTrack, degToRad, common as glMatrix, lerp$5 as lerp, mat2, mat2d, mat3, mat4, quat, quat2, radToDeg, vec2, vec3, vec4 };\n//# sourceMappingURL=index.js.map\n","import { isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Provides a basic {@link TJSBasicAnimation} implementation for Position animation.\n */\nexport class AnimationControl\n{\n /** @type {object} */\n #animationData;\n\n /** @type {Promise} */\n #finishedPromise;\n\n #willFinish;\n\n /**\n * Defines a static empty / void animation control.\n *\n * @type {AnimationControl}\n */\n static #voidControl = new AnimationControl(null);\n\n /**\n * Provides a static void / undefined AnimationControl that is automatically resolved.\n *\n * @returns {AnimationControl} Void AnimationControl\n */\n static get voidControl() { return this.#voidControl; }\n\n /**\n * @param {object|null} [animationData] - Animation data from {@link AnimationAPI}.\n *\n * @param {boolean} [willFinish] - Promise that tracks animation finished state.\n */\n constructor(animationData, willFinish = false)\n {\n this.#animationData = animationData;\n this.#willFinish = willFinish;\n\n // Set this control to animation data.\n if (isObject(animationData)) { animationData.control = this; }\n }\n\n /**\n * Get a promise that resolves when animation is finished.\n *\n * @returns {Promise}\n */\n get finished()\n {\n if (!(this.#finishedPromise instanceof Promise))\n {\n this.#finishedPromise = this.#willFinish ? new Promise((resolve) => this.#animationData.resolve = resolve) :\n Promise.resolve();\n }\n\n return this.#finishedPromise;\n }\n\n /**\n * Returns whether this animation is currently active / animating.\n *\n * Note: a delayed animation may not be started / active yet. Use {@link AnimationControl.isFinished} to determine\n * if an animation is actually finished.\n *\n * @returns {boolean} Animation active state.\n */\n get isActive() { return this.#animationData.active; }\n\n /**\n * Returns whether this animation is completely finished.\n *\n * @returns {boolean} Animation finished state.\n */\n get isFinished() { return this.#animationData.finished; }\n\n /**\n * Cancels the animation.\n */\n cancel()\n {\n const animationData = this.#animationData;\n\n if (animationData === null || animationData === void 0) { return; }\n\n // Set cancelled state to true and this animation data instance will be removed from AnimationManager on next\n // update.\n animationData.cancelled = true;\n }\n}\n","/**\n * Provides animation management and scheduling allowing all Position instances to utilize one micro-task.\n */\nexport class AnimationManager\n{\n /**\n * @type {object[]}\n */\n static activeList = [];\n\n /**\n * @type {object[]}\n */\n static newList = [];\n\n /**\n * @type {number}\n */\n static current;\n\n /**\n * Add animation data.\n *\n * @param {object} data -\n */\n static add(data)\n {\n const now = performance.now();\n\n // Offset start time by delta between last rAF time. This allows continuous tween cycles to appear naturally as\n // starting from the instant they are added to the AnimationManager. This is what makes `draggable` smooth when\n // easing is enabled.\n data.start = now + (AnimationManager.current - now);\n\n AnimationManager.newList.push(data);\n }\n\n /**\n * Manage all animation\n */\n static animate()\n {\n const current = AnimationManager.current = performance.now();\n\n // Early out of the rAF callback when there are no current animations.\n if (AnimationManager.activeList.length === 0 && AnimationManager.newList.length === 0)\n {\n globalThis.requestAnimationFrame(AnimationManager.animate);\n return;\n }\n\n if (AnimationManager.newList.length)\n {\n // Process new data\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n\n // If animation instance has been cancelled before start then remove it from new list and cleanup.\n if (data.cancelled)\n {\n AnimationManager.newList.splice(cntr, 1);\n data.cleanup(data);\n }\n\n // If data is active then process it now. Delayed animations start with `active` false.\n if (data.active)\n {\n // Remove from new list and add to active list.\n AnimationManager.newList.splice(cntr, 1);\n AnimationManager.activeList.push(data);\n }\n }\n }\n\n // Process active animations.\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n\n // Remove any animations that have been canceled.\n // Ensure that the element is still connected otherwise remove it from active list and continue.\n if (data.cancelled || (data.el !== void 0 && !data.el.isConnected))\n {\n AnimationManager.activeList.splice(cntr, 1);\n data.cleanup(data);\n continue;\n }\n\n data.current = current - data.start;\n\n // Remove this animation instance if current animating time exceeds duration.\n if (data.current >= data.duration)\n {\n // Prepare final update with end position data.\n for (let dataCntr = data.keys.length; --dataCntr >= 0;)\n {\n const key = data.keys[dataCntr];\n data.newData[key] = data.destination[key];\n }\n\n data.position.set(data.newData);\n\n AnimationManager.activeList.splice(cntr, 1);\n data.cleanup(data);\n\n continue;\n }\n\n // Apply easing to create an eased time.\n const easedTime = data.ease(data.current / data.duration);\n\n for (let dataCntr = data.keys.length; --dataCntr >= 0;)\n {\n const key = data.keys[dataCntr];\n data.newData[key] = data.interpolate(data.initial[key], data.destination[key], easedTime);\n }\n\n data.position.set(data.newData);\n }\n\n globalThis.requestAnimationFrame(AnimationManager.animate);\n }\n\n /**\n * Cancels all animations for given Position instance.\n *\n * @param {Position} position - Position instance.\n */\n static cancel(position)\n {\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n if (data.position === position)\n {\n AnimationManager.activeList.splice(cntr, 1);\n data.cancelled = true;\n data.cleanup(data);\n }\n }\n\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n if (data.position === position)\n {\n AnimationManager.newList.splice(cntr, 1);\n data.cancelled = true;\n data.cleanup(data);\n }\n }\n }\n\n /**\n * Cancels all active and delayed animations.\n */\n static cancelAll()\n {\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n data.cancelled = true;\n data.cleanup(data);\n }\n\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n data.cancelled = true;\n data.cleanup(data);\n }\n\n AnimationManager.activeList.length = 0;\n AnimationManager.newList.length = 0;\n }\n\n /**\n * Gets all {@link AnimationControl} instances for a given Position instance.\n *\n * @param {Position} position - Position instance.\n *\n * @returns {AnimationControl[]} All scheduled AnimationControl instances for the given Position instance.\n */\n static getScheduled(position)\n {\n const results = [];\n\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n if (data.position === position)\n {\n results.push(data.control);\n }\n }\n\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n if (data.position === position)\n {\n results.push(data.control);\n }\n }\n\n return results;\n }\n}\n\n// Start animation manager immediately. It constantly is running in background.\nAnimationManager.animate();\n","/**\n * Stores the PositionData properties that can be animated.\n *\n * @type {Set}\n */\nconst animateKeys = new Set([\n // Main keys\n 'left', 'top', 'maxWidth', 'maxHeight', 'minWidth', 'minHeight', 'width', 'height',\n 'rotateX', 'rotateY', 'rotateZ', 'scale', 'translateX', 'translateY', 'translateZ', 'zIndex',\n\n // Aliases\n 'rotation'\n]);\n\n/**\n * Defines the keys of PositionData that are transform keys.\n *\n * @type {string[]}\n */\nconst transformKeys = ['rotateX', 'rotateY', 'rotateZ', 'scale', 'translateX', 'translateY', 'translateZ'];\n\nObject.freeze(transformKeys);\n\n/**\n * Parses a relative value string in the form of '+=', '-=', or '*=' and float / numeric value. IE '+=0.2'.\n *\n * @type {RegExp}\n */\nconst relativeRegex = /^([-+*])=(-?[\\d]*\\.?[\\d]+)$/;\n\n/**\n * Provides numeric defaults for all parameters. This is used by {@link Position.get} to optionally provide\n * numeric defaults.\n *\n * @type {{rotation: number, scale: number, minWidth: null, minHeight: null, translateZ: number, top: number, left: number, maxHeight: null, translateY: number, translateX: number, width: number, transformOrigin: null, rotateX: number, rotateY: number, height: number, maxWidth: null, zIndex: null, rotateZ: number}}\n */\nconst numericDefaults = {\n // Other keys\n height: 0,\n left: 0,\n maxHeight: null,\n maxWidth: null,\n minHeight: null,\n minWidth: null,\n top: 0,\n transformOrigin: null,\n width: 0,\n zIndex: null,\n\n rotateX: 0,\n rotateY: 0,\n rotateZ: 0,\n scale: 1,\n translateX: 0,\n translateY: 0,\n translateZ: 0,\n\n rotation: 0\n};\n\nObject.freeze(numericDefaults);\n\n/**\n * Sets numeric defaults for a {@link PositionData} like object.\n *\n * @param {object} data - A PositionData like object.\n */\nfunction setNumericDefaults(data)\n{\n // Transform keys\n if (data.rotateX === null) { data.rotateX = 0; }\n if (data.rotateY === null) { data.rotateY = 0; }\n if (data.rotateZ === null) { data.rotateZ = 0; }\n if (data.translateX === null) { data.translateX = 0; }\n if (data.translateY === null) { data.translateY = 0; }\n if (data.translateZ === null) { data.translateZ = 0; }\n if (data.scale === null) { data.scale = 1; }\n\n // Aliases\n if (data.rotation === null) { data.rotation = 0; }\n}\n\n/**\n * Defines bitwise keys for transforms used in {@link Transforms.getMat4}.\n *\n * @type {object}\n */\nconst transformKeysBitwise = {\n rotateX: 1,\n rotateY: 2,\n rotateZ: 4,\n scale: 8,\n translateX: 16,\n translateY: 32,\n translateZ: 64\n};\n\nObject.freeze(transformKeysBitwise);\n\n/**\n * Defines the default transform origin.\n *\n * @type {string}\n */\nconst transformOriginDefault = 'top left';\n\n/**\n * Defines the valid transform origins.\n *\n * @type {string[]}\n */\nconst transformOrigins = ['top left', 'top center', 'top right', 'center left', 'center', 'center right', 'bottom left',\n 'bottom center', 'bottom right'];\n\nObject.freeze(transformOrigins);\n\nexport {\n animateKeys,\n numericDefaults,\n relativeRegex,\n setNumericDefaults,\n transformKeys,\n transformKeysBitwise,\n transformOriginDefault,\n transformOrigins\n};\n","import * as constants from './constants.js';\n\n/**\n * Converts any relative string values for animatable keys to actual updates performed against current data.\n *\n * @param {PositionDataExtended} positionData - position data.\n *\n * @param {Position|PositionData} position - The source position instance.\n */\nexport function convertRelative(positionData, position)\n{\n for (const key in positionData)\n {\n // Key is animatable / numeric.\n if (constants.animateKeys.has(key))\n {\n const value = positionData[key];\n\n if (typeof value !== 'string') { continue; }\n\n // Ignore 'auto' and 'inherit' string values.\n if (value === 'auto' || value === 'inherit') { continue; }\n\n const regexResults = constants.relativeRegex.exec(value);\n\n if (!regexResults)\n {\n throw new Error(\n `convertRelative error: malformed relative key (${key}) with value (${value})`);\n }\n\n const current = position[key];\n\n switch (regexResults[1])\n {\n case '-':\n positionData[key] = current - parseFloat(regexResults[2]);\n break;\n\n case '+':\n positionData[key] = current + parseFloat(regexResults[2]);\n break;\n\n case '*':\n positionData[key] = current * parseFloat(regexResults[2]);\n break;\n }\n }\n }\n}\n","import { cubicOut } from 'svelte/easing';\n\nimport { lerp } from '@typhonjs-fvtt/runtime/svelte/math';\nimport {\n isIterable,\n isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\nimport { AnimationControl } from './AnimationControl.js';\nimport { AnimationManager } from './AnimationManager.js';\n\nimport { convertRelative } from '../convertRelative.js';\n\nimport {\n animateKeys,\n setNumericDefaults } from '../constants.js';\n\nexport class AnimationAPI\n{\n /** @type {PositionData} */\n #data;\n\n /** @type {Position} */\n #position;\n\n /**\n * Tracks the number of animation control instances that are active.\n *\n * @type {number}\n */\n #instanceCount = 0;\n\n /**\n * Provides a bound function to pass as data to AnimationManager to invoke\n *\n * @type {Function}\n * @see {AnimationAPI.#cleanupInstance}\n */\n #cleanup;\n\n constructor(position, data)\n {\n this.#position = position;\n this.#data = data;\n\n this.#cleanup = this.#cleanupInstance.bind(this);\n }\n\n /**\n * Returns whether there are scheduled animations whether active or delayed for this Position.\n *\n * @returns {boolean} Are there active animation instances.\n */\n get isScheduled()\n {\n return this.#instanceCount > 0;\n }\n\n /**\n * Adds / schedules an animation w/ the AnimationManager. This contains the final steps common to all tweens.\n *\n * @param {object} initial -\n *\n * @param {object} destination -\n *\n * @param {number} duration -\n *\n * @param {HTMLElement} el -\n *\n * @param {number} delay -\n *\n * @param {Function} ease -\n *\n * @param {Function} interpolate -\n *\n * @returns {AnimationControl} The associated animation control.\n */\n #addAnimation(initial, destination, duration, el, delay, ease, interpolate)\n {\n // Set initial data for transform values that are often null by default.\n setNumericDefaults(initial);\n setNumericDefaults(destination);\n\n // Reject all initial data that is not a number.\n for (const key in initial)\n {\n if (!Number.isFinite(initial[key])) { delete initial[key]; }\n }\n\n const keys = Object.keys(initial);\n const newData = Object.assign({ immediateElementUpdate: true }, initial);\n\n // Nothing to animate, so return now.\n if (keys.length === 0) { return AnimationControl.voidControl; }\n\n const animationData = {\n active: true,\n cleanup: this.#cleanup,\n cancelled: false,\n control: void 0,\n current: 0,\n destination,\n duration: duration * 1000, // Internally the AnimationManager works in ms.\n ease,\n el,\n finished: false,\n initial,\n interpolate,\n keys,\n newData,\n position: this.#position,\n resolve: void 0,\n start: void 0\n };\n\n if (delay > 0)\n {\n animationData.active = false;\n\n // Delay w/ setTimeout and schedule w/ AnimationManager if not already canceled\n setTimeout(() =>\n {\n if (!animationData.cancelled)\n {\n animationData.active = true;\n\n const now = performance.now();\n\n // Offset start time by delta between last rAF time. This allows a delayed tween to start from the\n // precise delayed time.\n animationData.start = now + (AnimationManager.current - now);\n }\n }, delay * 1000);\n }\n\n // Schedule immediately w/ AnimationManager\n this.#instanceCount++;\n AnimationManager.add(animationData);\n\n // Create animation control\n return new AnimationControl(animationData, true);\n }\n\n /**\n * Cancels all animation instances for this Position instance.\n */\n cancel()\n {\n AnimationManager.cancel(this.#position);\n }\n\n /**\n * Cleans up an animation instance.\n *\n * @param {object} data - Animation data for an animation instance.\n */\n #cleanupInstance(data)\n {\n this.#instanceCount--;\n\n data.active = false;\n data.finished = true;\n\n if (typeof data.resolve === 'function') { data.resolve(data.cancelled); }\n }\n\n /**\n * Returns all currently scheduled AnimationControl instances for this Position instance.\n *\n * @returns {AnimationControl[]} All currently scheduled animation controls for this Position instance.\n */\n getScheduled()\n {\n return AnimationManager.getScheduled(this.#position);\n }\n\n /**\n * Provides a tween from given position data to the current position.\n *\n * @param {PositionDataExtended} fromData - The starting position.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.delay=0] - Delay in seconds before animation starts.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {AnimationControl} A control object that can cancel animation and provides a `finished` Promise.\n */\n from(fromData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isObject(fromData))\n {\n throw new TypeError(`AnimationAPI.from error: 'fromData' is not an object.`);\n }\n\n const position = this.#position;\n const parent = position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return AnimationControl.voidControl;\n }\n\n // Cache any target element allowing AnimationManager to stop animation if it becomes disconnected from DOM.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n if (!Number.isFinite(delay) || delay < 0)\n {\n throw new TypeError(`AnimationAPI.from error: 'delay' is not a positive number.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.from error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.from error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.from error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key in fromData)\n {\n if (data[key] !== void 0 && fromData[key] !== data[key])\n {\n initial[key] = fromData[key];\n destination[key] = data[key];\n }\n }\n\n convertRelative(initial, data);\n\n return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate);\n }\n\n /**\n * Provides a tween from given position data to the current position.\n *\n * @param {PositionDataExtended} fromData - The starting position.\n *\n * @param {PositionDataExtended} toData - The ending position.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.delay=0] - Delay in seconds before animation starts.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {AnimationControl} A control object that can cancel animation and provides a `finished` Promise.\n */\n fromTo(fromData, toData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isObject(fromData))\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'fromData' is not an object.`);\n }\n\n if (!isObject(toData))\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'toData' is not an object.`);\n }\n\n const parent = this.#position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return AnimationControl.voidControl;\n }\n\n // Cache any target element allowing AnimationManager to stop animation if it becomes disconnected from DOM.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n if (!Number.isFinite(delay) || delay < 0)\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'delay' is not a positive number.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key in fromData)\n {\n if (toData[key] === void 0)\n {\n console.warn(\n `AnimationAPI.fromTo warning: key ('${key}') from 'fromData' missing in 'toData'; skipping this key.`);\n continue;\n }\n\n if (data[key] !== void 0)\n {\n initial[key] = fromData[key];\n destination[key] = toData[key];\n }\n }\n\n convertRelative(initial, data);\n convertRelative(destination, data);\n\n return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate);\n }\n\n /**\n * Provides a tween to given position data from the current position.\n *\n * @param {PositionDataExtended} toData - The destination position.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.delay=0] - Delay in seconds before animation starts.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {AnimationControl} A control object that can cancel animation and provides a `finished` Promise.\n */\n to(toData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isObject(toData))\n {\n throw new TypeError(`AnimationAPI.to error: 'toData' is not an object.`);\n }\n\n const parent = this.#position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return AnimationControl.voidControl;\n }\n\n // Cache any target element allowing AnimationManager to stop animation if it becomes disconnected from DOM.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n if (!Number.isFinite(delay) || delay < 0)\n {\n throw new TypeError(`AnimationAPI.to error: 'delay' is not a positive number.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.to error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.to error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.to error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key in toData)\n {\n if (data[key] !== void 0 && toData[key] !== data[key])\n {\n destination[key] = toData[key];\n initial[key] = data[key];\n }\n }\n\n convertRelative(destination, data);\n\n return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate);\n }\n\n /**\n * Returns a function that provides an optimized way to constantly update a to-tween.\n *\n * @param {Iterable} keys - The keys for quickTo.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {quickToCallback} quick-to tween function.\n */\n quickTo(keys, { duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isIterable(keys))\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'keys' is not an iterable list.`);\n }\n\n const parent = this.#position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n throw new Error(`AnimationAPI.quickTo error: 'parent' is not positionable.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key of keys)\n {\n if (typeof key !== 'string')\n {\n throw new TypeError(`AnimationAPI.quickTo error: key is not a string.`);\n }\n\n if (!animateKeys.has(key))\n {\n throw new Error(`AnimationAPI.quickTo error: key ('${key}') is not animatable.`);\n }\n\n if (data[key] !== void 0)\n {\n destination[key] = data[key];\n initial[key] = data[key];\n }\n }\n\n const keysArray = [...keys];\n\n Object.freeze(keysArray);\n\n const newData = Object.assign({ immediateElementUpdate: true }, initial);\n\n const animationData = {\n active: true,\n cleanup: this.#cleanup,\n cancelled: false,\n control: void 0,\n current: 0,\n destination,\n duration: duration * 1000, // Internally the AnimationManager works in ms.\n ease,\n el: void 0,\n finished: true, // Note: start in finished state to add to AnimationManager on first callback.\n initial,\n interpolate,\n keys,\n newData,\n position: this.#position,\n resolve: void 0,\n start: void 0\n };\n\n const quickToCB = (...args) =>\n {\n const argsLength = args.length;\n\n if (argsLength === 0) { return; }\n\n for (let cntr = keysArray.length; --cntr >= 0;)\n {\n const key = keysArray[cntr];\n if (data[key] !== void 0) { initial[key] = data[key]; }\n }\n\n // Handle case where the first arg is an object. Update all quickTo keys from data contained in the object.\n if (isObject(args[0]))\n {\n const objData = args[0];\n\n for (const key in objData)\n {\n if (destination[key] !== void 0) { destination[key] = objData[key]; }\n }\n }\n else // Assign each variable argument to the key specified in the initial `keys` array above.\n {\n for (let cntr = 0; cntr < argsLength && cntr < keysArray.length; cntr++)\n {\n const key = keysArray[cntr];\n if (destination[key] !== void 0) { destination[key] = args[cntr]; }\n }\n }\n\n convertRelative(destination, data);\n\n // Set initial data for transform values that are often null by default.\n setNumericDefaults(initial);\n setNumericDefaults(destination);\n\n // Set target element to animation data to track if it is removed from the DOM hence ending the animation.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n animationData.el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n // Reschedule the quickTo animation with AnimationManager as it is finished.\n if (animationData.finished)\n {\n animationData.finished = false;\n animationData.active = true;\n animationData.current = 0;\n\n this.#instanceCount++;\n AnimationManager.add(animationData);\n }\n else // QuickTo animation is currently scheduled w/ AnimationManager so reset start and current time.\n {\n const now = performance.now();\n\n // Offset start time by delta between last rAF time. This allows a delayed tween to start from the\n // precise delayed time.\n animationData.start = now + (AnimationManager.current - now);\n animationData.current = 0;\n }\n };\n\n quickToCB.keys = keysArray;\n\n /**\n * Sets options of quickTo tween.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.duration] - Duration in seconds.\n *\n * @param {Function} [opts.ease] - Easing function.\n *\n * @param {Function} [opts.interpolate] - Interpolation function.\n *\n * @returns {quickToCallback} The quickTo callback.\n */\n quickToCB.options = ({ duration, ease, interpolate } = {}) => // eslint-disable-line no-shadow\n {\n if (duration !== void 0 && (!Number.isFinite(duration) || duration < 0))\n {\n throw new TypeError(`AnimationAPI.quickTo.options error: 'duration' is not a positive number.`);\n }\n\n if (ease !== void 0 && typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo.options error: 'ease' is not a function.`);\n }\n\n if (interpolate !== void 0 && typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo.options error: 'interpolate' is not a function.`);\n }\n\n if (duration >= 0) { animationData.duration = duration * 1000; }\n if (ease) { animationData.ease = ease; }\n if (interpolate) { animationData.interpolate = interpolate; }\n\n return quickToCB;\n };\n\n return quickToCB;\n }\n}\n\n/**\n * @callback quickToCallback\n *\n * @param {...number|object} args - Either individual numbers corresponding to the order in which keys are specified or\n * a single object with keys specified and numerical values.\n *\n * @property {({duration?: number, ease?: Function, interpolate?: Function}) => quickToCallback} options - A function\n * to update options for quickTo function.\n */\n","/**\n * Provides a basic {@link TJSBasicAnimation} implementation for a Position animation for a group of Position instances.\n */\nexport class AnimationGroupControl\n{\n /** @type {AnimationControl[]} */\n #animationControls;\n\n /** @type {Promise[]>} */\n #finishedPromise;\n\n /**\n * Defines a static empty / void animation control.\n *\n * @type {AnimationGroupControl}\n */\n static #voidControl = new AnimationGroupControl(null);\n\n /**\n * Provides a static void / undefined AnimationGroupControl that is automatically resolved.\n *\n * @returns {AnimationGroupControl} Void AnimationGroupControl\n */\n static get voidControl() { return this.#voidControl; }\n\n /**\n * @param {AnimationControl[]} animationControls - An array of AnimationControl instances.\n */\n constructor(animationControls)\n {\n this.#animationControls = animationControls;\n }\n\n /**\n * Get a promise that resolves when all animations are finished.\n *\n * @returns {Promise[]>|Promise} Finished Promise for all animations.\n */\n get finished()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return Promise.resolve(); }\n\n if (!(this.#finishedPromise instanceof Promise))\n {\n const promises = [];\n for (let cntr = animationControls.length; --cntr >= 0;)\n {\n promises.push(animationControls[cntr].finished);\n }\n\n this.#finishedPromise = Promise.all(promises);\n }\n\n return this.#finishedPromise;\n }\n\n /**\n * Returns whether there are active animation instances for this group.\n *\n * Note: a delayed animation may not be started / active yet. Use {@link AnimationGroupControl.isFinished} to\n * determine if all animations in the group are finished.\n *\n * @returns {boolean} Are there active animation instances.\n */\n get isActive()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return false; }\n\n for (let cntr = animationControls.length; --cntr >= 0;)\n {\n if (animationControls[cntr].isActive) { return true; }\n }\n\n return false;\n }\n\n /**\n * Returns whether all animations in the group are finished.\n *\n * @returns {boolean} Are all animation instances finished.\n */\n get isFinished()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return true; }\n\n for (let cntr = animationControls.length; --cntr >= 0;)\n {\n if (!animationControls[cntr].isFinished) { return false; }\n }\n\n return false;\n }\n\n /**\n * Cancels the all animations.\n */\n cancel()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return; }\n\n for (let cntr = this.#animationControls.length; --cntr >= 0;)\n {\n this.#animationControls[cntr].cancel();\n }\n }\n}\n","import {\n isIterable,\n isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\nimport { AnimationManager } from './AnimationManager.js';\nimport { AnimationAPI } from './AnimationAPI.js';\nimport { AnimationGroupControl } from './AnimationGroupControl.js';\n\n/**\n * Provides a public API for grouping multiple {@link Position} animations together with the AnimationManager.\n *\n * Note: To remove cyclic dependencies as this class provides the Position static / group Animation API `instanceof`\n * checks are not done against Position. Instead, a check for the animate property being an instanceof\n * {@link AnimationAPI} is performed in {@link AnimationGroupAPI.#isPosition}.\n *\n * @see AnimationAPI\n */\nexport class AnimationGroupAPI\n{\n /**\n * Checks of the given object is a Position instance by checking for AnimationAPI.\n *\n * @param {*} object - Any data.\n *\n * @returns {boolean} Is Position.\n */\n static #isPosition(object)\n {\n return isObject(object) && object.animate instanceof AnimationAPI;\n }\n\n /**\n * Cancels any animation for given Position data.\n *\n * @param {Position|{position: Position}|Iterable|Iterable<{position: Position}>} position -\n */\n static cancel(position)\n {\n if (isIterable(position))\n {\n let index = -1;\n\n for (const entry of position)\n {\n index++;\n\n const actualPosition = this.#isPosition(entry) ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.cancel warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n AnimationManager.cancel(actualPosition);\n }\n }\n else\n {\n const actualPosition = this.#isPosition(position) ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.cancel warning: No Position instance found.`);\n return;\n }\n\n AnimationManager.cancel(actualPosition);\n }\n }\n\n /**\n * Cancels all Position animation.\n */\n static cancelAll() { AnimationManager.cancelAll(); }\n\n /**\n * Gets all animation controls for the given position data.\n *\n * @param {Position|{position: Position}|Iterable|Iterable<{position: Position}>} position -\n *\n * @returns {{position: Position, data: object|void, controls: AnimationControl[]}[]} Results array.\n */\n static getScheduled(position)\n {\n const results = [];\n\n if (isIterable(position))\n {\n let index = -1;\n\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.getScheduled warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n const controls = AnimationManager.getScheduled(actualPosition);\n\n results.push({ position: actualPosition, data: isPosition ? void 0 : entry, controls });\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.getScheduled warning: No Position instance found.`);\n return results;\n }\n\n const controls = AnimationManager.getScheduled(actualPosition);\n\n results.push({ position: actualPosition, data: isPosition ? void 0 : position, controls });\n }\n\n return results;\n }\n\n /**\n * Provides the `from` animation tween for one or more Position instances as a group.\n *\n * @param {Position|{position: Position}|Iterable|Iterable<{position: Position}>} position -\n *\n * @param {object|Function} fromData -\n *\n * @param {object|Function} options -\n *\n * @returns {TJSBasicAnimation} Basic animation control.\n */\n static from(position, fromData, options)\n {\n if (!isObject(fromData) && typeof fromData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.from error: 'fromData' is not an object or function.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.from error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {AnimationControl[]}\n */\n const animationControls = [];\n\n let index = -1;\n let callbackOptions;\n\n const hasDataCallback = typeof fromData === 'function';\n const hasOptionCallback = typeof options === 'function';\n const hasCallback = hasDataCallback || hasOptionCallback;\n\n if (hasCallback) { callbackOptions = { index, position: void 0, data: void 0 }; }\n\n let actualFromData = fromData;\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.from warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n }\n\n if (hasDataCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualFromData === null || actualFromData === void 0) { continue; }\n\n if (typeof actualFromData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.from error: fromData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.from error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.from(actualFromData, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.from warning: No Position instance found.`);\n return AnimationGroupControl.voidControl;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n }\n\n if (hasDataCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n if (typeof actualFromData !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.from error: fromData callback function failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.from error: options callback function failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.from(actualFromData, actualOptions));\n }\n\n return new AnimationGroupControl(animationControls);\n }\n\n /**\n * Provides the `fromTo` animation tween for one or more Position instances as a group.\n *\n * @param {Position|{position: Position}|Iterable|Iterable<{position: Position}>} position -\n *\n * @param {object|Function} fromData -\n *\n * @param {object|Function} toData -\n *\n * @param {object|Function} options -\n *\n * @returns {TJSBasicAnimation} Basic animation control.\n */\n static fromTo(position, fromData, toData, options)\n {\n if (!isObject(fromData) && typeof fromData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: 'fromData' is not an object or function.`);\n }\n\n if (!isObject(toData) && typeof toData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: 'toData' is not an object or function.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {AnimationControl[]}\n */\n const animationControls = [];\n\n let index = -1;\n let callbackOptions;\n\n const hasFromCallback = typeof fromData === 'function';\n const hasToCallback = typeof toData === 'function';\n const hasOptionCallback = typeof options === 'function';\n const hasCallback = hasFromCallback || hasToCallback || hasOptionCallback;\n\n if (hasCallback) { callbackOptions = { index, position: void 0, data: void 0 }; }\n\n let actualFromData = fromData;\n let actualToData = toData;\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.fromTo warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n }\n\n if (hasFromCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualFromData === null || actualFromData === void 0) { continue; }\n\n if (typeof actualFromData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: fromData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasToCallback)\n {\n actualToData = toData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualToData === null || actualToData === void 0) { continue; }\n\n if (typeof actualToData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: toData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.fromTo(actualFromData, actualToData, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.fromTo warning: No Position instance found.`);\n return AnimationGroupControl.voidControl;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n }\n\n if (hasFromCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n if (typeof actualFromData !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.fromTo error: fromData callback function failed to return an object.`);\n }\n }\n\n if (hasToCallback)\n {\n actualToData = toData(callbackOptions);\n\n if (typeof actualToData !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.fromTo error: toData callback function failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.fromTo error: options callback function failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.fromTo(actualFromData, actualToData, actualOptions));\n }\n\n return new AnimationGroupControl(animationControls);\n }\n\n /**\n * Provides the `to` animation tween for one or more Position instances as a group.\n *\n * @param {Position|{position: Position}|Iterable|Iterable<{position: Position}>} position -\n *\n * @param {object|Function} toData -\n *\n * @param {object|Function} options -\n *\n * @returns {TJSBasicAnimation} Basic animation control.\n */\n static to(position, toData, options)\n {\n if (!isObject(toData) && typeof toData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.to error: 'toData' is not an object or function.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.to error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {AnimationControl[]}\n */\n const animationControls = [];\n\n let index = -1;\n let callbackOptions;\n\n const hasDataCallback = typeof toData === 'function';\n const hasOptionCallback = typeof options === 'function';\n const hasCallback = hasDataCallback || hasOptionCallback;\n\n if (hasCallback) { callbackOptions = { index, position: void 0, data: void 0 }; }\n\n let actualToData = toData;\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.to warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n }\n\n if (hasDataCallback)\n {\n actualToData = toData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualToData === null || actualToData === void 0) { continue; }\n\n if (typeof actualToData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.to error: toData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.to error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.to(actualToData, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.to warning: No Position instance found.`);\n return AnimationGroupControl.voidControl;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n }\n\n if (hasDataCallback)\n {\n actualToData = toData(callbackOptions);\n\n if (typeof actualToData !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.to error: toData callback function failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.to error: options callback function failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.to(actualToData, actualOptions));\n }\n\n return new AnimationGroupControl(animationControls);\n }\n\n /**\n * Provides the `to` animation tween for one or more Position instances as a group.\n *\n * @param {Position|{position: Position}|Iterable|Iterable<{position: Position}>} position -\n *\n * @param {Iterable} keys -\n *\n * @param {object|Function} options -\n *\n * @returns {quickToCallback} Basic animation control.\n */\n static quickTo(position, keys, options)\n {\n if (!isIterable(keys))\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: 'keys' is not an iterable list.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {quickToCallback[]}\n */\n const quickToCallbacks = [];\n\n let index = -1;\n\n const hasOptionCallback = typeof options === 'function';\n\n const callbackOptions = { index, position: void 0, data: void 0 };\n\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.quickTo warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n quickToCallbacks.push(actualPosition.animate.quickTo(keys, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.quickTo warning: No Position instance found.`);\n return () => null;\n }\n\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.quickTo error: options callback function failed to return an object.`);\n }\n }\n\n quickToCallbacks.push(actualPosition.animate.quickTo(keys, actualOptions));\n }\n\n const keysArray = [...keys];\n\n Object.freeze(keysArray);\n\n const quickToCB = (...args) =>\n {\n const argsLength = args.length;\n\n if (argsLength === 0) { return; }\n\n if (typeof args[0] === 'function')\n {\n const dataCallback = args[0];\n\n index = -1;\n let cntr = 0;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition)) { continue; }\n\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n\n const toData = dataCallback(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (toData === null || toData === void 0) { continue; }\n\n /**\n * @type {boolean}\n */\n const toDataIterable = isIterable(toData);\n\n if (!Number.isFinite(toData) && !toDataIterable && typeof toData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: toData callback function iteration(${\n index}) failed to return a finite number, iterable list, or object.`);\n }\n\n if (toDataIterable)\n {\n quickToCallbacks[cntr++](...toData);\n }\n else\n {\n quickToCallbacks[cntr++](toData);\n }\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition)) { return; }\n\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n\n const toData = dataCallback(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (toData === null || toData === void 0) { return; }\n\n const toDataIterable = isIterable(toData);\n\n if (!Number.isFinite(toData) && !toDataIterable && typeof toData !== 'object')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: toData callback function iteration(${\n index}) failed to return a finite number, iterable list, or object.`);\n }\n\n if (toDataIterable)\n {\n quickToCallbacks[cntr++](...toData);\n }\n else\n {\n quickToCallbacks[cntr++](toData);\n }\n }\n }\n else\n {\n for (let cntr = quickToCallbacks.length; --cntr >= 0;)\n {\n quickToCallbacks[cntr](...args);\n }\n }\n };\n\n quickToCB.keys = keysArray;\n\n /**\n * Sets options of quickTo tween.\n *\n * @param {object|Function} [options] - Optional parameters.\n *\n * @param {number} [options.duration] - Duration in seconds.\n *\n * @param {Function} [options.ease] - Easing function.\n *\n * @param {Function} [options.interpolate] - Interpolation function.\n *\n * @returns {quickToCallback} The quickTo callback.\n */\n quickToCB.options = (options) => // eslint-disable-line no-shadow\n {\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: 'options' is not an object or function.`);\n }\n\n // Set options object for each quickTo callback.\n if (isObject(options))\n {\n for (let cntr = quickToCallbacks.length; --cntr >= 0;) { quickToCallbacks[cntr].options(options); }\n }\n else if (typeof options === 'function')\n {\n if (isIterable(position))\n {\n index = -1;\n let cntr = 0;\n\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(\n `AnimationGroupAPI.quickTo.options warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.quickTo.options error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n\n quickToCallbacks[cntr++].options(actualOptions);\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.quickTo.options warning: No Position instance found.`);\n return quickToCB;\n }\n\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n\n actualOptions = options(callbackOptions);\n\n if (typeof actualOptions !== 'object')\n {\n throw new TypeError(\n `AnimationGroupAPI.quickTo error: options callback function failed to return an object.`);\n }\n\n quickToCallbacks[0].options(actualOptions);\n }\n }\n\n return quickToCB;\n };\n\n return quickToCB;\n }\n}\n","export class Centered\n{\n /**\n * @type {HTMLElement}\n */\n #element;\n\n /**\n * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not\n * performance oriented. If manually set this height is used instead of `offsetHeight`.\n *\n * @type {number}\n */\n #height;\n\n /**\n * Set from an optional value in the constructor to lock accessors preventing modification.\n */\n #lock;\n\n /**\n * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not\n * performance oriented. If manually set this width is used instead of `offsetWidth`.\n *\n * @type {number}\n */\n #width;\n\n constructor({ element, lock = false, width, height } = {})\n {\n this.element = element;\n this.width = width;\n this.height = height;\n\n this.#lock = typeof lock === 'boolean' ? lock : false;\n }\n\n get element() { return this.#element; }\n\n get height() { return this.#height; }\n\n get width() { return this.#width; }\n\n set element(element)\n {\n if (this.#lock) { return; }\n\n if (element === void 0 || element === null || element instanceof HTMLElement)\n {\n this.#element = element;\n }\n else\n {\n throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`);\n }\n }\n\n set height(height)\n {\n if (this.#lock) { return; }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n set width(width)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n }\n\n setDimension(width, height)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n getLeft(width)\n {\n // Determine containing bounds from manual values; or any element; lastly the browser width / height.\n const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth;\n\n return (boundsWidth - width) / 2;\n }\n\n getTop(height)\n {\n const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight;\n\n return (boundsHeight - height) / 2;\n }\n}\n","import { Centered } from './Centered.js';\n\nconst browserCentered = new Centered();\n\nexport { browserCentered, Centered };\n\n","export class PositionChangeSet\n{\n constructor()\n {\n this.left = false;\n this.top = false;\n this.width = false;\n this.height = false;\n this.maxHeight = false;\n this.maxWidth = false;\n this.minHeight = false;\n this.minWidth = false;\n this.zIndex = false;\n this.transform = false;\n this.transformOrigin = false;\n }\n\n hasChange()\n {\n return this.left || this.top || this.width || this.height || this.maxHeight || this.maxWidth || this.minHeight ||\n this.minWidth || this.zIndex || this.transform || this.transformOrigin;\n }\n\n set(value)\n {\n this.left = value;\n this.top = value;\n this.width = value;\n this.height = value;\n this.maxHeight = value;\n this.maxWidth = value;\n this.minHeight = value;\n this.minWidth = value;\n this.zIndex = value;\n this.transform = value;\n this.transformOrigin = value;\n }\n}\n","/**\n * Defines stored positional data.\n */\nexport class PositionData\n{\n constructor({ height = null, left = null, maxHeight = null, maxWidth = null, minHeight = null, minWidth = null,\n rotateX = null, rotateY = null, rotateZ = null, scale = null, translateX = null, translateY = null,\n translateZ = null, top = null, transformOrigin = null, width = null, zIndex = null } = {})\n {\n /**\n * @type {number|'auto'|'inherit'|null}\n */\n this.height = height;\n\n /**\n * @type {number|null}\n */\n this.left = left;\n\n /**\n * @type {number|null}\n */\n this.maxHeight = maxHeight;\n\n /**\n * @type {number|null}\n */\n this.maxWidth = maxWidth;\n\n /**\n * @type {number|null}\n */\n this.minHeight = minHeight;\n\n /**\n * @type {number|null}\n */\n this.minWidth = minWidth;\n\n /**\n * @type {number|null}\n */\n this.rotateX = rotateX;\n\n /**\n * @type {number|null}\n */\n this.rotateY = rotateY;\n\n /**\n * @type {number|null}\n */\n this.rotateZ = rotateZ;\n\n /**\n * @type {number|null}\n */\n this.scale = scale;\n\n /**\n * @type {number|null}\n */\n this.top = top;\n\n /**\n * @type {string|null}\n */\n this.transformOrigin = transformOrigin;\n\n /**\n * @type {number|null}\n */\n this.translateX = translateX;\n\n /**\n * @type {number|null}\n */\n this.translateY = translateY;\n\n /**\n * @type {number|null}\n */\n this.translateZ = translateZ;\n\n /**\n * @type {number|'auto'|'inherit'|null}\n */\n this.width = width;\n\n /**\n * @type {number|null}\n */\n this.zIndex = zIndex;\n\n Object.seal(this);\n }\n\n /**\n * Copies given data to this instance.\n *\n * @param {PositionData} data - Copy from this instance.\n *\n * @returns {PositionData} This instance.\n */\n copy(data)\n {\n this.height = data.height;\n this.left = data.left;\n this.maxHeight = data.maxHeight;\n this.maxWidth = data.maxWidth;\n this.minHeight = data.minHeight;\n this.minWidth = data.minWidth;\n this.rotateX = data.rotateX;\n this.rotateY = data.rotateY;\n this.rotateZ = data.rotateZ;\n this.scale = data.scale;\n this.top = data.top;\n this.transformOrigin = data.transformOrigin;\n this.translateX = data.translateX;\n this.translateY = data.translateY;\n this.translateZ = data.translateZ;\n this.width = data.width;\n this.zIndex = data.zIndex;\n\n return this;\n }\n}\n","import { linear } from 'svelte/easing';\n\nimport { lerp } from '@typhonjs-fvtt/runtime/svelte/math';\nimport { isIterable } from '@typhonjs-fvtt/runtime/svelte/util';\n\nexport class PositionStateAPI\n{\n /** @type {PositionData} */\n #data;\n\n /**\n * @type {Map}\n */\n #dataSaved = new Map();\n\n /** @type {Position} */\n #position;\n\n /** @type {Transforms} */\n #transforms;\n\n constructor(position, data, transforms)\n {\n this.#position = position;\n this.#data = data;\n this.#transforms = transforms;\n }\n\n /**\n * Returns any stored save state by name.\n *\n * @param {string} name - Saved data set name.\n *\n * @returns {PositionDataExtended} The saved data set.\n */\n get({ name })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - getSave error: 'name' is not a string.`); }\n\n return this.#dataSaved.get(name);\n }\n\n /**\n * Returns any associated default data.\n *\n * @returns {PositionDataExtended} Associated default data.\n */\n getDefault()\n {\n return this.#dataSaved.get('#defaultData');\n }\n\n /**\n * Removes and returns any position state by name.\n *\n * @param {object} options - Options.\n *\n * @param {string} options.name - Name to remove and retrieve.\n *\n * @returns {PositionDataExtended} Saved position data.\n */\n remove({ name })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - remove: 'name' is not a string.`); }\n\n const data = this.#dataSaved.get(name);\n this.#dataSaved.delete(name);\n\n return data;\n }\n\n /**\n * Resets data to default values and invokes set.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.keepZIndex=false] - When true keeps current z-index.\n *\n * @param {boolean} [opts.invokeSet=true] - When true invokes set method.\n *\n * @returns {boolean} Operation successful.\n */\n reset({ keepZIndex = false, invokeSet = true } = {})\n {\n const defaultData = this.#dataSaved.get('#defaultData');\n\n // Quit early if there is no saved default data.\n if (typeof defaultData !== 'object') { return false; }\n\n // Cancel all animations for Position if there are currently any scheduled.\n if (this.#position.animate.isScheduled)\n {\n this.#position.animate.cancel();\n }\n\n const zIndex = this.#position.zIndex;\n\n const data = Object.assign({}, defaultData);\n\n if (keepZIndex) { data.zIndex = zIndex; }\n\n // Reset the transform data.\n this.#transforms.reset(data);\n\n // If current minimized invoke `maximize`.\n if (this.#position.parent?.reactive?.minimized)\n {\n this.#position.parent?.maximize?.({ animate: false, duration: 0 });\n }\n\n // Note next clock tick scheduling.\n if (invokeSet) { setTimeout(() => this.#position.set(data), 0); }\n\n return true;\n }\n\n /**\n * Restores a saved positional state returning the data. Several optional parameters are available\n * to control whether the restore action occurs silently (no store / inline styles updates), animates\n * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to} allows\n * specification of the duration, easing, and interpolate functions along with configuring a Promise to be\n * returned if awaiting the end of the animation.\n *\n * @param {object} params - Parameters\n *\n * @param {string} params.name - Saved data set name.\n *\n * @param {boolean} [params.remove=false] - Remove data set.\n *\n * @param {Iterable} [params.properties] - Specific properties to set / animate.\n *\n * @param {boolean} [params.silent] - Set position data directly; no store or style updates.\n *\n * @param {boolean} [params.async=false] - If animating return a Promise that resolves with any saved data.\n *\n * @param {boolean} [params.animateTo=false] - Animate to restore data.\n *\n * @param {number} [params.duration=0.1] - Duration in seconds.\n *\n * @param {Function} [params.ease=linear] - Easing function.\n *\n * @param {Function} [params.interpolate=lerp] - Interpolation function.\n *\n * @returns {PositionDataExtended|Promise} Saved position data.\n */\n restore({ name, remove = false, properties, silent = false, async = false, animateTo = false, duration = 0.1,\n ease = linear, interpolate = lerp })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - restore error: 'name' is not a string.`); }\n\n const dataSaved = this.#dataSaved.get(name);\n\n if (dataSaved)\n {\n if (remove) { this.#dataSaved.delete(name); }\n\n let data = dataSaved;\n\n if (isIterable(properties))\n {\n data = {};\n for (const property of properties) { data[property] = dataSaved[property]; }\n }\n\n // Update data directly with no store or inline style updates.\n if (silent)\n {\n for (const property in data) { this.#data[property] = data[property]; }\n return dataSaved;\n }\n else if (animateTo) // Animate to saved data.\n {\n // Provide special handling to potentially change transform origin as this parameter is not animated.\n if (data.transformOrigin !== this.#position.transformOrigin)\n {\n this.#position.transformOrigin = data.transformOrigin;\n }\n\n // Return a Promise with saved data that resolves after animation ends.\n if (async)\n {\n return this.#position.animate.to(data, { duration, ease, interpolate }).finished.then(() => dataSaved);\n }\n else // Animate synchronously.\n {\n this.#position.animate.to(data, { duration, ease, interpolate });\n }\n }\n else\n {\n // Default options is to set data for an immediate update.\n this.#position.set(data);\n }\n }\n\n return dataSaved;\n }\n\n /**\n * Saves current position state with the opportunity to add extra data to the saved state.\n *\n * @param {object} opts - Options.\n *\n * @param {string} opts.name - name to index this saved data.\n *\n * @param {...*} [opts.extra] - Extra data to add to saved data.\n *\n * @returns {PositionData} Current position data\n */\n save({ name, ...extra })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - save error: 'name' is not a string.`); }\n\n const data = this.#position.get(extra);\n\n this.#dataSaved.set(name, data);\n\n return data;\n }\n\n /**\n * Directly sets a position state.\n *\n * @param {object} opts - Options.\n *\n * @param {string} opts.name - name to index this saved data.\n *\n * @param {...*} [opts.data] - Position data to set.\n */\n set({ name, ...data })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - set error: 'name' is not a string.`); }\n\n this.#dataSaved.set(name, data);\n }\n}\n","import { writable } from 'svelte/store';\n\nimport { propertyStore } from '@typhonjs-fvtt/runtime/svelte/store';\nimport { styleParsePixels } from '@typhonjs-fvtt/runtime/svelte/util';\n\nexport class StyleCache\n{\n constructor()\n {\n /** @type {HTMLElement|undefined} */\n this.el = void 0;\n\n /** @type {CSSStyleDeclaration} */\n this.computed = void 0;\n\n /** @type {number|undefined} */\n this.marginLeft = void 0;\n\n /** @type {number|undefined} */\n this.marginTop = void 0;\n\n /** @type {number|undefined} */\n this.maxHeight = void 0;\n\n /** @type {number|undefined} */\n this.maxWidth = void 0;\n\n /** @type {number|undefined} */\n this.minHeight = void 0;\n\n /** @type {number|undefined} */\n this.minWidth = void 0;\n\n /** @type {boolean} */\n this.hasWillChange = false;\n\n /**\n * @type {ResizeObserverData}\n */\n this.resizeObserved = {\n contentHeight: void 0,\n contentWidth: void 0,\n offsetHeight: void 0,\n offsetWidth: void 0\n };\n\n /**\n * Provides a writable store to track offset & content width / height from an associated `resizeObserver` action.\n *\n * @type {Writable}\n */\n const storeResizeObserved = writable(this.resizeObserved);\n\n this.stores = {\n element: writable(this.el),\n resizeContentHeight: propertyStore(storeResizeObserved, 'contentHeight'),\n resizeContentWidth: propertyStore(storeResizeObserved, 'contentWidth'),\n resizeObserved: storeResizeObserved,\n resizeOffsetHeight: propertyStore(storeResizeObserved, 'offsetHeight'),\n resizeOffsetWidth: propertyStore(storeResizeObserved, 'offsetWidth')\n };\n }\n\n /**\n * Returns the cached offsetHeight from any attached `resizeObserver` action otherwise gets the offsetHeight from\n * the element directly. The more optimized path is using `resizeObserver` as getting it from the element\n * directly is more expensive and alters the execution order of an animation frame.\n *\n * @returns {number} The element offsetHeight.\n */\n get offsetHeight()\n {\n if (this.el instanceof HTMLElement)\n {\n return this.resizeObserved.offsetHeight !== void 0 ? this.resizeObserved.offsetHeight : this.el.offsetHeight;\n }\n\n throw new Error(`StyleCache - get offsetHeight error: no element assigned.`);\n }\n\n /**\n * Returns the cached offsetWidth from any attached `resizeObserver` action otherwise gets the offsetWidth from\n * the element directly. The more optimized path is using `resizeObserver` as getting it from the element\n * directly is more expensive and alters the execution order of an animation frame.\n *\n * @returns {number} The element offsetHeight.\n */\n get offsetWidth()\n {\n if (this.el instanceof HTMLElement)\n {\n return this.resizeObserved.offsetWidth !== void 0 ? this.resizeObserved.offsetWidth : this.el.offsetWidth;\n }\n\n throw new Error(`StyleCache - get offsetWidth error: no element assigned.`);\n }\n\n /**\n * @param {HTMLElement} el -\n *\n * @returns {boolean} Does element match cached element.\n */\n hasData(el) { return this.el === el; }\n\n /**\n * Resets the style cache.\n */\n reset()\n {\n // Remove will-change inline style from previous element if it is still connected.\n if (this.el instanceof HTMLElement && this.el.isConnected && !this.hasWillChange)\n {\n this.el.style.willChange = null;\n }\n\n this.el = void 0;\n this.computed = void 0;\n this.marginLeft = void 0;\n this.marginTop = void 0;\n this.maxHeight = void 0;\n this.maxWidth = void 0;\n this.minHeight = void 0;\n this.minWidth = void 0;\n\n this.hasWillChange = false;\n\n // Silently reset `resizedObserved`; With proper usage the `resizeObserver` action issues an update on removal.\n this.resizeObserved.contentHeight = void 0;\n this.resizeObserved.contentWidth = void 0;\n this.resizeObserved.offsetHeight = void 0;\n this.resizeObserved.offsetWidth = void 0;\n\n // Reset the tracked element this Position instance is modifying.\n this.stores.element.set(void 0);\n }\n\n /**\n * Updates the style cache with new data from the given element.\n *\n * @param {HTMLElement} el - An HTML element.\n */\n update(el)\n {\n this.el = el;\n\n this.computed = globalThis.getComputedStyle(el);\n\n this.marginLeft = styleParsePixels(el.style.marginLeft) ?? styleParsePixels(this.computed.marginLeft);\n this.marginTop = styleParsePixels(el.style.marginTop) ?? styleParsePixels(this.computed.marginTop);\n this.maxHeight = styleParsePixels(el.style.maxHeight) ?? styleParsePixels(this.computed.maxHeight);\n this.maxWidth = styleParsePixels(el.style.maxWidth) ?? styleParsePixels(this.computed.maxWidth);\n\n // Note that the computed styles for below will always be 0px / 0 when no style is active.\n this.minHeight = styleParsePixels(el.style.minHeight) ?? styleParsePixels(this.computed.minHeight);\n this.minWidth = styleParsePixels(el.style.minWidth) ?? styleParsePixels(this.computed.minWidth);\n\n // Tracks if there already is a will-change property on the inline or computed styles.\n const willChange = el.style.willChange !== '' ? el.style.willChange : void 0 ?? this.computed.willChange;\n\n this.hasWillChange = willChange !== '' && willChange !== 'auto';\n\n // Update the tracked element this Position instance is modifying.\n this.stores.element.set(el);\n }\n}\n","import { mat4, vec3 } from '@typhonjs-fvtt/runtime/svelte/math';\n\n/**\n * Provides the output data for {@link Transforms.getData}.\n */\nexport class TransformData\n{\n constructor()\n {\n Object.seal(this);\n }\n\n /**\n * Stores the calculated bounding rectangle.\n *\n * @type {DOMRect}\n */\n #boundingRect = new DOMRect();\n\n /**\n * Stores the individual transformed corner points of the window in screenspace clockwise from:\n * top left -> top right -> bottom right -> bottom left.\n *\n * @type {Vector3[]}\n */\n #corners = [vec3.create(), vec3.create(), vec3.create(), vec3.create()];\n\n /**\n * Stores the current gl-matrix mat4 data.\n *\n * @type {Matrix4}\n */\n #mat4 = mat4.create();\n\n /**\n * Stores the pre & post origin translations to apply to matrix transforms.\n *\n * @type {Matrix4[]}\n */\n #originTranslations = [mat4.create(), mat4.create()];\n\n /**\n * @returns {DOMRect} The bounding rectangle.\n */\n get boundingRect() { return this.#boundingRect; }\n\n /**\n * @returns {Vector3[]} The transformed corner points as vec3 in screen space.\n */\n get corners() { return this.#corners; }\n\n /**\n * @returns {string} Returns the CSS style string for the transform matrix.\n */\n get css() { return `matrix3d(${this.mat4.join(',')})`; }\n\n /**\n * @returns {Matrix4} The transform matrix.\n */\n get mat4() { return this.#mat4; }\n\n /**\n * @returns {Matrix4[]} The pre / post translation matrices for origin translation.\n */\n get originTranslations() { return this.#originTranslations; }\n}\n\n/**\n * @typedef {Float32Array} Vector3 - 3 Dimensional Vector.\n *\n * @see https://glmatrix.net/docs/module-vec3.html\n */\n\n/**\n * @typedef {Float32Array} Matrix4 - 4x4 Matrix; Format: column-major, when typed out it looks like row-major.\n *\n * @see https://glmatrix.net/docs/module-mat4.html\n */\n","import { isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Provides the storage and sequencing of managed position validators. Each validator added may be a bespoke function or\n * a {@link ValidatorData} object containing an `id`, `validator`, and `weight` attributes; `validator` is the only\n * required attribute.\n *\n * The `id` attribute can be anything that creates a unique ID for the validator; recommended strings or numbers. This\n * allows validators to be removed by ID easily.\n *\n * The `weight` attribute is a number between 0 and 1 inclusive that allows validators to be added in a\n * predictable order which is especially handy if they are manipulated at runtime. A lower weighted validator always\n * runs before a higher weighted validator. If no weight is specified the default of '1' is assigned and it is appended\n * to the end of the validators list.\n *\n * This class forms the public API which is accessible from the `.validators` getter in the main Position instance.\n * ```\n * const position = new Position();\n * position.validators.add(...);\n * position.validators.clear();\n * position.validators.length;\n * position.validators.remove(...);\n * position.validators.removeBy(...);\n * position.validators.removeById(...);\n * ```\n */\nexport class AdapterValidators\n{\n /** @type {boolean} */\n #enabled = true;\n\n /**\n * @type {ValidatorData[]}\n */\n #validatorData;\n\n #mapUnsubscribe = new Map();\n\n /**\n * @returns {[AdapterValidators, ValidatorData[]]} Returns this and internal storage for validator adapter.\n */\n constructor()\n {\n this.#validatorData = [];\n\n Object.seal(this);\n\n return [this, this.#validatorData];\n }\n\n /**\n * @returns {boolean} Returns the enabled state.s\n */\n get enabled() { return this.#enabled; }\n\n /**\n * @returns {number} Returns the length of the validators array.\n */\n get length() { return this.#validatorData.length; }\n\n /**\n * @param {boolean} enabled - Sets enabled state.\n */\n set enabled(enabled)\n {\n if (typeof enabled !== 'boolean') { throw new TypeError(`'enabled' is not a boolean.`); }\n\n this.#enabled = enabled;\n }\n\n /**\n * Provides an iterator for validators.\n *\n * @returns {Generator} Generator / iterator of validators.\n * @yields {ValidatorData}\n */\n *[Symbol.iterator]()\n {\n if (this.#validatorData.length === 0) { return; }\n\n for (const entry of this.#validatorData)\n {\n yield { ...entry };\n }\n }\n\n /**\n * @param {...(ValidatorFn|ValidatorData)} validators -\n */\n add(...validators)\n {\n /**\n * Tracks the number of validators added that have subscriber functionality.\n *\n * @type {number}\n */\n // let subscribeCount = 0; // TODO: Currently unused\n\n for (const validator of validators)\n {\n const validatorType = typeof validator;\n\n if (validatorType !== 'function' && validatorType !== 'object' || validator === null)\n {\n throw new TypeError(`AdapterValidator error: 'validator' is not a function or object.`);\n }\n\n let data = void 0;\n let subscribeFn = void 0;\n\n switch (validatorType)\n {\n case 'function':\n data = {\n id: void 0,\n validator,\n weight: 1\n };\n\n subscribeFn = validator.subscribe;\n break;\n\n case 'object':\n if (typeof validator.validator !== 'function')\n {\n throw new TypeError(`AdapterValidator error: 'validator' attribute is not a function.`);\n }\n\n if (validator.weight !== void 0 && typeof validator.weight !== 'number' ||\n (validator.weight < 0 || validator.weight > 1))\n {\n throw new TypeError(\n `AdapterValidator error: 'weight' attribute is not a number between '0 - 1' inclusive.`);\n }\n\n data = {\n id: validator.id !== void 0 ? validator.id : void 0,\n validator: validator.validator.bind(validator),\n weight: validator.weight || 1,\n instance: validator\n };\n\n subscribeFn = validator.validator.subscribe ?? validator.subscribe;\n break;\n }\n\n // Find the index to insert where data.weight is less than existing values weight.\n const index = this.#validatorData.findIndex((value) =>\n {\n return data.weight < value.weight;\n });\n\n // If an index was found insert at that location.\n if (index >= 0)\n {\n this.#validatorData.splice(index, 0, data);\n }\n else // push to end of validators.\n {\n this.#validatorData.push(data);\n }\n\n if (typeof subscribeFn === 'function')\n {\n // TODO: consider how to handle validator updates.\n const unsubscribe = subscribeFn();\n\n // Ensure that unsubscribe is a function.\n if (typeof unsubscribe !== 'function')\n {\n throw new TypeError(\n 'AdapterValidator error: Filter has subscribe function, but no unsubscribe function is returned.');\n }\n\n // Ensure that the same validator is not subscribed to multiple times.\n if (this.#mapUnsubscribe.has(data.validator))\n {\n throw new Error(\n 'AdapterValidator error: Filter added already has an unsubscribe function registered.');\n }\n\n this.#mapUnsubscribe.set(data.validator, unsubscribe);\n // subscribeCount++; // TODO: Currently unused\n }\n }\n\n // Filters with subscriber functionality are assumed to immediately invoke the `subscribe` callback. If the\n // subscriber count is less than the amount of validators added then automatically trigger an index update\n // manually.\n // TODO: handle validator updates.\n // if (subscribeCount < validators.length) { this.#indexUpdate(); }\n }\n\n clear()\n {\n this.#validatorData.length = 0;\n\n // Unsubscribe from all validators with subscription support.\n for (const unsubscribe of this.#mapUnsubscribe.values())\n {\n unsubscribe();\n }\n\n this.#mapUnsubscribe.clear();\n\n // TODO: handle validator updates.\n // this.#indexUpdate();\n }\n\n /**\n * @param {...(ValidatorFn|ValidatorData)} validators -\n */\n remove(...validators)\n {\n const length = this.#validatorData.length;\n\n if (length === 0) { return; }\n\n for (const data of validators)\n {\n // Handle the case that the validator may either be a function or a validator entry / object.\n const actualValidator = typeof data === 'function' ? data : isObject(data) ? data.validator : void 0;\n\n if (!actualValidator) { continue; }\n\n for (let cntr = this.#validatorData.length; --cntr >= 0;)\n {\n if (this.#validatorData[cntr].validator === actualValidator)\n {\n this.#validatorData.splice(cntr, 1);\n\n // Invoke any unsubscribe function for given validator then remove from tracking.\n let unsubscribe = void 0;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(actualValidator)) === 'function')\n {\n unsubscribe();\n this.#mapUnsubscribe.delete(actualValidator);\n }\n }\n }\n }\n\n // Update the index a validator was removed.\n // TODO: handle validator updates.\n // if (length !== this.#validatorData.length) { this.#indexUpdate(); }\n }\n\n /**\n * Remove validators by the provided callback. The callback takes 3 parameters: `id`, `validator`, and `weight`.\n * Any truthy value returned will remove that validator.\n *\n * @param {function(*, ValidatorFn, number): boolean} callback - Callback function to evaluate each validator\n * entry.\n */\n removeBy(callback)\n {\n const length = this.#validatorData.length;\n\n if (length === 0) { return; }\n\n if (typeof callback !== 'function')\n {\n throw new TypeError(`AdapterValidator error: 'callback' is not a function.`);\n }\n\n this.#validatorData = this.#validatorData.filter((data) =>\n {\n const remove = callback.call(callback, { ...data });\n\n if (remove)\n {\n let unsubscribe;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.validator)) === 'function')\n {\n unsubscribe();\n this.#mapUnsubscribe.delete(data.validator);\n }\n }\n\n // Reverse remove boolean to properly validator / remove this validator.\n return !remove;\n });\n\n // TODO: handle validator updates.\n // if (length !== this.#validatorData.length) { this.#indexUpdate(); }\n }\n\n removeById(...ids)\n {\n const length = this.#validatorData.length;\n\n if (length === 0) { return; }\n\n this.#validatorData = this.#validatorData.filter((data) =>\n {\n let remove = false;\n\n for (const id of ids) { remove |= data.id === id; }\n\n // If not keeping invoke any unsubscribe function for given validator then remove from tracking.\n if (remove)\n {\n let unsubscribe;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.validator)) === 'function')\n {\n unsubscribe();\n this.#mapUnsubscribe.delete(data.validator);\n }\n }\n\n return !remove; // Swap here to actually remove the item via array validator method.\n });\n\n // TODO: handle validator updates.\n // if (length !== this.#validatorData.length) { this.#indexUpdate(); }\n }\n}\n\n/**\n * @callback ValidatorFn - Position validator function that takes a {@link PositionData} instance potentially\n * modifying it or returning null if invalid.\n *\n * @param {ValidationData} valData - Validation data.\n *\n * @returns {PositionData|null} The validated position data or null to cancel position update.\n *\n */\n\n/**\n * @typedef {object} ValidatorData\n *\n * @property {*} [id=undefined] - An ID associated with this validator. Can be used to remove the validator.\n *\n * @property {ValidatorFn} validator - Position validator function that takes a {@link PositionData} instance\n * potentially modifying it or returning null if invalid.\n *\n * @property {number} [weight=1] - A number between 0 and 1 inclusive to position this validator against others.\n *\n * @property {Function} [subscribe] - Optional subscribe function following the Svelte store / subscribe pattern.\n */\n\n/**\n * @typedef {ValidatorFn|ValidatorData|Iterable} PositionValidatorOptions Defines the\n * position validator options.\n */\n","export class BasicBounds\n{\n /**\n * When true constrains the min / max width or height to element.\n *\n * @type {boolean}\n */\n #constrain;\n\n /**\n * @type {HTMLElement}\n */\n #element;\n\n /**\n * When true the validator is active.\n *\n * @type {boolean}\n */\n #enabled;\n\n /**\n * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not\n * performance oriented. If manually set this height is used instead of `offsetHeight`.\n *\n * @type {number}\n */\n #height;\n\n /**\n * Set from an optional value in the constructor to lock accessors preventing modification.\n */\n #lock;\n\n /**\n * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not\n * performance oriented. If manually set this width is used instead of `offsetWidth`.\n *\n * @type {number}\n */\n #width;\n\n constructor({ constrain = true, element, enabled = true, lock = false, width, height } = {})\n {\n this.element = element;\n this.constrain = constrain;\n this.enabled = enabled;\n this.width = width;\n this.height = height;\n\n this.#lock = typeof lock === 'boolean' ? lock : false;\n }\n\n get constrain() { return this.#constrain; }\n\n get element() { return this.#element; }\n\n get enabled() { return this.#enabled; }\n\n get height() { return this.#height; }\n\n get width() { return this.#width; }\n\n set constrain(constrain)\n {\n if (this.#lock) { return; }\n\n if (typeof constrain !== 'boolean') { throw new TypeError(`'constrain' is not a boolean.`); }\n\n this.#constrain = constrain;\n }\n\n set element(element)\n {\n if (this.#lock) { return; }\n\n if (element === void 0 || element === null || element instanceof HTMLElement)\n {\n this.#element = element;\n }\n else\n {\n throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`);\n }\n }\n\n set enabled(enabled)\n {\n if (this.#lock) { return; }\n\n if (typeof enabled !== 'boolean') { throw new TypeError(`'enabled' is not a boolean.`); }\n\n this.#enabled = enabled;\n }\n\n set height(height)\n {\n if (this.#lock) { return; }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n set width(width)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n }\n\n setDimension(width, height)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n /**\n * Provides a validator that respects transforms in positional data constraining the position to within the target\n * elements bounds.\n *\n * @param {ValidationData} valData - The associated validation data for position updates.\n *\n * @returns {PositionData} Potentially adjusted position data.\n */\n validator(valData)\n {\n // Early out if element is undefined or local enabled state is false.\n if (!this.#enabled) { return valData.position; }\n\n // Determine containing bounds from manual values; or any element; lastly the browser width / height.\n const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth;\n const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight;\n\n if (typeof valData.position.width === 'number')\n {\n const maxW = valData.maxWidth ?? (this.#constrain ? boundsWidth : Number.MAX_SAFE_INTEGER);\n valData.position.width = valData.width = Math.clamped(valData.position.width, valData.minWidth, maxW);\n\n if ((valData.width + valData.position.left + valData.marginLeft) > boundsWidth)\n {\n valData.position.left = boundsWidth - valData.width - valData.marginLeft;\n }\n }\n\n if (typeof valData.position.height === 'number')\n {\n const maxH = valData.maxHeight ?? (this.#constrain ? boundsHeight : Number.MAX_SAFE_INTEGER);\n valData.position.height = valData.height = Math.clamped(valData.position.height, valData.minHeight, maxH);\n\n if ((valData.height + valData.position.top + valData.marginTop) > boundsHeight)\n {\n valData.position.top = boundsHeight - valData.height - valData.marginTop;\n }\n }\n\n const maxL = Math.max(boundsWidth - valData.width - valData.marginLeft, 0);\n valData.position.left = Math.round(Math.clamped(valData.position.left, 0, maxL));\n\n const maxT = Math.max(boundsHeight - valData.height - valData.marginTop, 0);\n valData.position.top = Math.round(Math.clamped(valData.position.top, 0, maxT));\n\n return valData.position;\n }\n}\n","import { TransformData } from '../transform/TransformData.js';\n\nconst s_TRANSFORM_DATA = new TransformData();\n\nexport class TransformBounds\n{\n /**\n * When true constrains the min / max width or height to element.\n *\n * @type {boolean}\n */\n #constrain;\n\n /**\n * @type {HTMLElement}\n */\n #element;\n\n /**\n * When true the validator is active.\n *\n * @type {boolean}\n */\n #enabled;\n\n /**\n * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not\n * performance oriented. If manually set this height is used instead of `offsetHeight`.\n *\n * @type {number}\n */\n #height;\n\n /**\n * Set from an optional value in the constructor to lock accessors preventing modification.\n */\n #lock;\n\n /**\n * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not\n * performance oriented. If manually set this width is used instead of `offsetWidth`.\n *\n * @type {number}\n */\n #width;\n\n constructor({ constrain = true, element, enabled = true, lock = false, width, height } = {})\n {\n this.element = element;\n this.constrain = constrain;\n this.enabled = enabled;\n this.width = width;\n this.height = height;\n\n this.#lock = typeof lock === 'boolean' ? lock : false;\n }\n\n get constrain() { return this.#constrain; }\n\n get element() { return this.#element; }\n\n get enabled() { return this.#enabled; }\n\n get height() { return this.#height; }\n\n get width() { return this.#width; }\n\n set constrain(constrain)\n {\n if (this.#lock) { return; }\n\n if (typeof constrain !== 'boolean') { throw new TypeError(`'constrain' is not a boolean.`); }\n\n this.#constrain = constrain;\n }\n\n set element(element)\n {\n if (this.#lock) { return; }\n\n if (element === void 0 || element === null || element instanceof HTMLElement)\n {\n this.#element = element;\n }\n else\n {\n throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`);\n }\n }\n\n set enabled(enabled)\n {\n if (this.#lock) { return; }\n\n if (typeof enabled !== 'boolean') { throw new TypeError(`'enabled' is not a boolean.`); }\n\n this.#enabled = enabled;\n }\n\n set height(height)\n {\n if (this.#lock) { return; }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n set width(width)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n }\n\n setDimension(width, height)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n /**\n * Provides a validator that respects transforms in positional data constraining the position to within the target\n * elements bounds.\n *\n * @param {ValidationData} valData - The associated validation data for position updates.\n *\n * @returns {PositionData} Potentially adjusted position data.\n */\n validator(valData)\n {\n // Early out if element is undefined or local enabled state is false.\n if (!this.#enabled) { return valData.position; }\n\n // Determine containing bounds from manual values; or any element; lastly the browser width / height.\n const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth;\n const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight;\n\n // Ensure min / max width constraints when position width is a number; not 'auto' or 'inherit'. If constrain is\n // true cap width bounds.\n if (typeof valData.position.width === 'number')\n {\n const maxW = valData.maxWidth ?? (this.#constrain ? boundsWidth : Number.MAX_SAFE_INTEGER);\n valData.position.width = Math.clamped(valData.width, valData.minWidth, maxW);\n }\n\n // Ensure min / max height constraints when position height is a number; not 'auto' or 'inherit'. If constrain\n // is true cap height bounds.\n if (typeof valData.position.height === 'number')\n {\n const maxH = valData.maxHeight ?? (this.#constrain ? boundsHeight : Number.MAX_SAFE_INTEGER);\n valData.position.height = Math.clamped(valData.height, valData.minHeight, maxH);\n }\n\n // Get transform data. First set constraints including any margin top / left as offsets and width / height. Used\n // when position width / height is 'auto'.\n const data = valData.transforms.getData(valData.position, s_TRANSFORM_DATA, valData);\n\n // Check the bounding rectangle against browser height / width. Adjust position based on how far the overlap of\n // the bounding rect is outside the bounds height / width. The order below matters as the constraints are top /\n // left oriented, so perform those checks last.\n\n const initialX = data.boundingRect.x;\n const initialY = data.boundingRect.y;\n\n if (data.boundingRect.bottom + valData.marginTop > boundsHeight)\n {\n data.boundingRect.y += boundsHeight - data.boundingRect.bottom - valData.marginTop;\n }\n\n if (data.boundingRect.right + valData.marginLeft > boundsWidth)\n {\n data.boundingRect.x += boundsWidth - data.boundingRect.right - valData.marginLeft;\n }\n\n if (data.boundingRect.top - valData.marginTop < 0)\n {\n data.boundingRect.y += Math.abs(data.boundingRect.top - valData.marginTop);\n }\n\n if (data.boundingRect.left - valData.marginLeft < 0)\n {\n data.boundingRect.x += Math.abs(data.boundingRect.left - valData.marginLeft);\n }\n\n valData.position.left -= initialX - data.boundingRect.x;\n valData.position.top -= initialY - data.boundingRect.y;\n\n return valData.position;\n }\n}\n","import { BasicBounds } from './BasicBounds.js';\nimport { TransformBounds } from './TransformBounds.js';\n\nconst basicWindow = new BasicBounds({ lock: true });\nconst transformWindow = new TransformBounds({ lock: true });\n\nexport { basicWindow, BasicBounds, transformWindow, TransformBounds };\n","import { degToRad, mat4, vec3 } from '@typhonjs-fvtt/runtime/svelte/math';\n\nimport * as constants from '../constants.js';\n\nimport { TransformData } from './TransformData.js';\n\n/** @type {number[]} */\nconst s_SCALE_VECTOR = [1, 1, 1];\n\n/** @type {number[]} */\nconst s_TRANSLATE_VECTOR = [0, 0, 0];\n\n/** @type {Matrix4} */\nconst s_MAT4_RESULT = mat4.create();\n\n/** @type {Matrix4} */\nconst s_MAT4_TEMP = mat4.create();\n\n/** @type {Vector3} */\nconst s_VEC3_TEMP = vec3.create();\n\nexport class Transforms\n{\n /**\n * Stores the transform keys in the order added.\n *\n * @type {string[]}\n */\n #orderList = [];\n\n constructor()\n {\n this._data = {};\n }\n\n /**\n * @returns {boolean} Whether there are active transforms in local data.\n */\n get isActive() { return this.#orderList.length > 0; }\n\n /**\n * @returns {number|undefined} Any local rotateX data.\n */\n get rotateX() { return this._data.rotateX; }\n\n /**\n * @returns {number|undefined} Any local rotateY data.\n */\n get rotateY() { return this._data.rotateY; }\n\n /**\n * @returns {number|undefined} Any local rotateZ data.\n */\n get rotateZ() { return this._data.rotateZ; }\n\n /**\n * @returns {number|undefined} Any local rotateZ scale.\n */\n get scale() { return this._data.scale; }\n\n /**\n * @returns {number|undefined} Any local translateZ data.\n */\n get translateX() { return this._data.translateX; }\n\n /**\n * @returns {number|undefined} Any local translateZ data.\n */\n get translateY() { return this._data.translateY; }\n\n /**\n * @returns {number|undefined} Any local translateZ data.\n */\n get translateZ() { return this._data.translateZ; }\n\n /**\n * Sets the local rotateX data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set rotateX(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.rotateX === void 0) { this.#orderList.push('rotateX'); }\n\n this._data.rotateX = value;\n }\n else\n {\n if (this._data.rotateX !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'rotateX');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.rotateX;\n }\n }\n\n /**\n * Sets the local rotateY data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set rotateY(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.rotateY === void 0) { this.#orderList.push('rotateY'); }\n\n this._data.rotateY = value;\n }\n else\n {\n if (this._data.rotateY !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'rotateY');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.rotateY;\n }\n }\n\n /**\n * Sets the local rotateZ data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set rotateZ(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.rotateZ === void 0) { this.#orderList.push('rotateZ'); }\n\n this._data.rotateZ = value;\n }\n\n else\n {\n if (this._data.rotateZ !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'rotateZ');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.rotateZ;\n }\n }\n\n /**\n * Sets the local scale data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set scale(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.scale === void 0) { this.#orderList.push('scale'); }\n\n this._data.scale = value;\n }\n else\n {\n if (this._data.scale !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'scale');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.scale;\n }\n }\n\n /**\n * Sets the local translateX data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set translateX(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.translateX === void 0) { this.#orderList.push('translateX'); }\n\n this._data.translateX = value;\n }\n\n else\n {\n if (this._data.translateX !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'translateX');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.translateX;\n }\n }\n\n /**\n * Sets the local translateY data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set translateY(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.translateY === void 0) { this.#orderList.push('translateY'); }\n\n this._data.translateY = value;\n }\n\n else\n {\n if (this._data.translateY !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'translateY');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.translateY;\n }\n }\n\n /**\n * Sets the local translateZ data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set translateZ(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.translateZ === void 0) { this.#orderList.push('translateZ'); }\n\n this._data.translateZ = value;\n }\n\n else\n {\n if (this._data.translateZ !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'translateZ');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.translateZ;\n }\n }\n\n /**\n * Returns the matrix3d CSS transform for the given position / transform data.\n *\n * @param {object} [data] - Optional position data otherwise use local stored transform data.\n *\n * @returns {string} The CSS matrix3d string.\n */\n getCSS(data = this._data)\n {\n return `matrix3d(${this.getMat4(data, s_MAT4_RESULT).join(',')})`;\n }\n\n /**\n * Returns the matrix3d CSS transform for the given position / transform data.\n *\n * @param {object} [data] - Optional position data otherwise use local stored transform data.\n *\n * @returns {string} The CSS matrix3d string.\n */\n getCSSOrtho(data = this._data)\n {\n return `matrix3d(${this.getMat4Ortho(data, s_MAT4_RESULT).join(',')})`;\n }\n\n /**\n * Collects all data including a bounding rect, transform matrix, and points array of the given {@link PositionData}\n * instance with the applied local transform data.\n *\n * @param {PositionData} position - The position data to process.\n *\n * @param {TransformData} [output] - Optional TransformData output instance.\n *\n * @param {object} [validationData] - Optional validation data for adjustment parameters.\n *\n * @returns {TransformData} The output TransformData instance.\n */\n getData(position, output = new TransformData(), validationData = {})\n {\n const valWidth = validationData.width ?? 0;\n const valHeight = validationData.height ?? 0;\n const valOffsetTop = validationData.offsetTop ?? validationData.marginTop ?? 0;\n const valOffsetLeft = validationData.offsetLeft ?? validationData.offsetLeft ?? 0;\n\n position.top += valOffsetTop;\n position.left += valOffsetLeft;\n\n const width = Number.isFinite(position.width) ? position.width : valWidth;\n const height = Number.isFinite(position.height) ? position.height : valHeight;\n\n const rect = output.corners;\n\n if (this.hasTransform(position))\n {\n rect[0][0] = rect[0][1] = rect[0][2] = 0;\n rect[1][0] = width;\n rect[1][1] = rect[1][2] = 0;\n rect[2][0] = width;\n rect[2][1] = height;\n rect[2][2] = 0;\n rect[3][0] = 0;\n rect[3][1] = height;\n rect[3][2] = 0;\n\n const matrix = this.getMat4(position, output.mat4);\n\n const translate = s_GET_ORIGIN_TRANSLATION(position.transformOrigin, width, height, output.originTranslations);\n\n if (constants.transformOriginDefault === position.transformOrigin)\n {\n vec3.transformMat4(rect[0], rect[0], matrix);\n vec3.transformMat4(rect[1], rect[1], matrix);\n vec3.transformMat4(rect[2], rect[2], matrix);\n vec3.transformMat4(rect[3], rect[3], matrix);\n }\n else\n {\n vec3.transformMat4(rect[0], rect[0], translate[0]);\n vec3.transformMat4(rect[0], rect[0], matrix);\n vec3.transformMat4(rect[0], rect[0], translate[1]);\n\n vec3.transformMat4(rect[1], rect[1], translate[0]);\n vec3.transformMat4(rect[1], rect[1], matrix);\n vec3.transformMat4(rect[1], rect[1], translate[1]);\n\n vec3.transformMat4(rect[2], rect[2], translate[0]);\n vec3.transformMat4(rect[2], rect[2], matrix);\n vec3.transformMat4(rect[2], rect[2], translate[1]);\n\n vec3.transformMat4(rect[3], rect[3], translate[0]);\n vec3.transformMat4(rect[3], rect[3], matrix);\n vec3.transformMat4(rect[3], rect[3], translate[1]);\n }\n\n rect[0][0] = position.left + rect[0][0];\n rect[0][1] = position.top + rect[0][1];\n rect[1][0] = position.left + rect[1][0];\n rect[1][1] = position.top + rect[1][1];\n rect[2][0] = position.left + rect[2][0];\n rect[2][1] = position.top + rect[2][1];\n rect[3][0] = position.left + rect[3][0];\n rect[3][1] = position.top + rect[3][1];\n }\n else\n {\n rect[0][0] = position.left;\n rect[0][1] = position.top;\n rect[1][0] = position.left + width;\n rect[1][1] = position.top;\n rect[2][0] = position.left + width;\n rect[2][1] = position.top + height;\n rect[3][0] = position.left;\n rect[3][1] = position.top + height;\n\n mat4.identity(output.mat4);\n }\n\n let maxX = Number.MIN_SAFE_INTEGER;\n let maxY = Number.MIN_SAFE_INTEGER;\n let minX = Number.MAX_SAFE_INTEGER;\n let minY = Number.MAX_SAFE_INTEGER;\n\n for (let cntr = 4; --cntr >= 0;)\n {\n if (rect[cntr][0] > maxX) { maxX = rect[cntr][0]; }\n if (rect[cntr][0] < minX) { minX = rect[cntr][0]; }\n if (rect[cntr][1] > maxY) { maxY = rect[cntr][1]; }\n if (rect[cntr][1] < minY) { minY = rect[cntr][1]; }\n }\n\n const boundingRect = output.boundingRect;\n boundingRect.x = minX;\n boundingRect.y = minY;\n boundingRect.width = maxX - minX;\n boundingRect.height = maxY - minY;\n\n position.top -= valOffsetTop;\n position.left -= valOffsetLeft;\n\n return output;\n }\n\n /**\n * Creates a transform matrix based on local data applied in order it was added.\n *\n * If no data object is provided then the source is the local transform data. If another data object is supplied\n * then the stored local transform order is applied then all remaining transform keys are applied. This allows the\n * construction of a transform matrix in advance of setting local data and is useful in collision detection.\n *\n * @param {object} [data] - PositionData instance or local transform data.\n *\n * @param {Matrix4} [output] - The output mat4 instance.\n *\n * @returns {Matrix4} Transform matrix.\n */\n getMat4(data = this._data, output = mat4.create())\n {\n const matrix = mat4.identity(output);\n\n // Bitwise tracks applied transform keys from local transform data.\n let seenKeys = 0;\n\n const orderList = this.#orderList;\n\n // First apply ordered transforms from local transform data.\n for (let cntr = 0; cntr < orderList.length; cntr++)\n {\n const key = orderList[cntr];\n\n switch (key)\n {\n case 'rotateX':\n seenKeys |= constants.transformKeysBitwise.rotateX;\n mat4.multiply(matrix, matrix, mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n seenKeys |= constants.transformKeysBitwise.rotateY;\n mat4.multiply(matrix, matrix, mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n seenKeys |= constants.transformKeysBitwise.rotateZ;\n mat4.multiply(matrix, matrix, mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'scale':\n seenKeys |= constants.transformKeysBitwise.scale;\n s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data[key];\n mat4.multiply(matrix, matrix, mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR));\n break;\n\n case 'translateX':\n seenKeys |= constants.transformKeysBitwise.translateX;\n s_TRANSLATE_VECTOR[0] = data.translateX;\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = 0;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateY':\n seenKeys |= constants.transformKeysBitwise.translateY;\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = data.translateY;\n s_TRANSLATE_VECTOR[2] = 0;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateZ':\n seenKeys |= constants.transformKeysBitwise.translateZ;\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = data.translateZ;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n }\n }\n\n // Now apply any new keys not set in local transform data that have not been applied yet.\n if (data !== this._data)\n {\n for (let cntr = 0; cntr < constants.transformKeys.length; cntr++)\n {\n const key = constants.transformKeys[cntr];\n\n // Reject bad / no data or if the key has already been applied.\n if (data[key] === null || (seenKeys & constants.transformKeysBitwise[key]) > 0) { continue; }\n\n switch (key)\n {\n case 'rotateX':\n mat4.multiply(matrix, matrix, mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n mat4.multiply(matrix, matrix, mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n mat4.multiply(matrix, matrix, mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'scale':\n s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data[key];\n mat4.multiply(matrix, matrix, mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR));\n break;\n\n case 'translateX':\n s_TRANSLATE_VECTOR[0] = data[key];\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = 0;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateY':\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = data[key];\n s_TRANSLATE_VECTOR[2] = 0;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateZ':\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = data[key];\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n }\n }\n }\n\n return matrix;\n }\n\n /**\n * Provides an orthographic enhancement to convert left / top positional data to a translate operation.\n *\n * This transform matrix takes into account that the remaining operations are , but adds any left / top attributes from passed in data to\n * translate X / Y.\n *\n * If no data object is provided then the source is the local transform data. If another data object is supplied\n * then the stored local transform order is applied then all remaining transform keys are applied. This allows the\n * construction of a transform matrix in advance of setting local data and is useful in collision detection.\n *\n * @param {object} [data] - PositionData instance or local transform data.\n *\n * @param {Matrix4} [output] - The output mat4 instance.\n *\n * @returns {Matrix4} Transform matrix.\n */\n getMat4Ortho(data = this._data, output = mat4.create())\n {\n const matrix = mat4.identity(output);\n\n // Attempt to retrieve values from passed in data otherwise default to 0.\n // Always perform the translation last regardless of order added to local transform data.\n // Add data.left to translateX and data.top to translateY.\n s_TRANSLATE_VECTOR[0] = (data.left ?? 0) + (data.translateX ?? 0);\n s_TRANSLATE_VECTOR[1] = (data.top ?? 0) + (data.translateY ?? 0);\n s_TRANSLATE_VECTOR[2] = data.translateZ ?? 0;\n mat4.multiply(matrix, matrix, mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n\n // Scale can also be applied out of order.\n if (data.scale !== null)\n {\n s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data.scale;\n mat4.multiply(matrix, matrix, mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR));\n }\n\n // Early out if there is not rotation data.\n if (data.rotateX === null && data.rotateY === null && data.rotateZ === null) { return matrix; }\n\n // Rotation transforms must be applied in the order they are added.\n\n // Bitwise tracks applied transform keys from local transform data.\n let seenKeys = 0;\n\n const orderList = this.#orderList;\n\n // First apply ordered transforms from local transform data.\n for (let cntr = 0; cntr < orderList.length; cntr++)\n {\n const key = orderList[cntr];\n\n switch (key)\n {\n case 'rotateX':\n seenKeys |= constants.transformKeysBitwise.rotateX;\n mat4.multiply(matrix, matrix, mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n seenKeys |= constants.transformKeysBitwise.rotateY;\n mat4.multiply(matrix, matrix, mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n seenKeys |= constants.transformKeysBitwise.rotateZ;\n mat4.multiply(matrix, matrix, mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n }\n }\n\n // Now apply any new keys not set in local transform data that have not been applied yet.\n if (data !== this._data)\n {\n for (let cntr = 0; cntr < constants.transformKeys.length; cntr++)\n {\n const key = constants.transformKeys[cntr];\n\n // Reject bad / no data or if the key has already been applied.\n if (data[key] === null || (seenKeys & constants.transformKeysBitwise[key]) > 0) { continue; }\n\n switch (key)\n {\n case 'rotateX':\n mat4.multiply(matrix, matrix, mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n mat4.multiply(matrix, matrix, mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n mat4.multiply(matrix, matrix, mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n }\n }\n }\n\n return matrix;\n }\n\n /**\n * Tests an object if it contains transform keys and the values are finite numbers.\n *\n * @param {object} data - An object to test for transform data.\n *\n * @returns {boolean} Whether the given PositionData has transforms.\n */\n hasTransform(data)\n {\n for (const key of constants.transformKeys)\n {\n if (Number.isFinite(data[key])) { return true; }\n }\n\n return false;\n }\n\n /**\n * Resets internal data from the given object containing valid transform keys.\n *\n * @param {object} data - An object with transform data.\n */\n reset(data)\n {\n for (const key in data)\n {\n if (constants.transformKeys.includes(key))\n {\n if (Number.isFinite(data[key]))\n {\n this._data[key] = data[key];\n }\n else\n {\n const index = this.#orderList.findIndex((entry) => entry === key);\n if (index >= 0) { this.#orderList.splice(index, 1); }\n\n delete this._data[key];\n }\n }\n }\n }\n}\n\n/**\n * Returns the translations necessary to translate a matrix operation based on the `transformOrigin` parameter of the\n * given position instance. The first entry / index 0 is the pre-translation and last entry / index 1 is the post-\n * translation.\n *\n * This method is used internally, but may be useful if you need the origin translation matrices to transform\n * bespoke points based on any `transformOrigin` set in {@link PositionData}.\n *\n * @param {string} transformOrigin - The transform origin attribute from PositionData.\n *\n * @param {number} width - The PositionData width or validation data width when 'auto'.\n *\n * @param {number} height - The PositionData height or validation data height when 'auto'.\n *\n * @param {Matrix4[]} output - Output Mat4 array.\n *\n * @returns {Matrix4[]} Output Mat4 array.\n */\nfunction s_GET_ORIGIN_TRANSLATION(transformOrigin, width, height, output)\n{\n const vector = s_VEC3_TEMP;\n\n switch (transformOrigin)\n {\n case 'top left':\n vector[0] = vector[1] = 0;\n mat4.fromTranslation(output[0], vector);\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'top center':\n vector[0] = -width * 0.5;\n vector[1] = 0;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width * 0.5;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'top right':\n vector[0] = -width;\n vector[1] = 0;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'center left':\n vector[0] = 0;\n vector[1] = -height * 0.5;\n mat4.fromTranslation(output[0], vector);\n vector[1] = height * 0.5;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case null: // By default null / no transform is center.\n case 'center':\n vector[0] = -width * 0.5;\n vector[1] = -height * 0.5;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width * 0.5;\n vector[1] = height * 0.5;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'center right':\n vector[0] = -width;\n vector[1] = -height * 0.5;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width;\n vector[1] = height * 0.5;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'bottom left':\n vector[0] = 0;\n vector[1] = -height;\n mat4.fromTranslation(output[0], vector);\n vector[1] = height;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'bottom center':\n vector[0] = -width * 0.5;\n vector[1] = -height;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width * 0.5;\n vector[1] = height;\n mat4.fromTranslation(output[1], vector);\n break;\n\n case 'bottom right':\n vector[0] = -width;\n vector[1] = -height;\n mat4.fromTranslation(output[0], vector);\n vector[0] = width;\n vector[1] = height;\n mat4.fromTranslation(output[1], vector);\n break;\n\n // No valid transform origin parameter; set identity.\n default:\n mat4.identity(output[0]);\n mat4.identity(output[1]);\n break;\n }\n\n return output;\n}\n","import { writable } from 'svelte/store';\n\nimport { TransformData } from '../transform/TransformData.js';\nimport { PositionData } from '../PositionData.js';\n\nexport class UpdateElementData\n{\n constructor()\n {\n /**\n * Stores the private data from Position.\n *\n * @type {PositionData}\n */\n this.data = void 0;\n\n /**\n * Provides a copy of local data sent to subscribers.\n *\n * @type {PositionData}\n */\n this.dataSubscribers = new PositionData();\n\n /**\n * Stores the current dimension data used for the readable `dimension` store.\n *\n * @type {{width: number | 'auto', height: number | 'auto'}}\n */\n this.dimensionData = { width: 0, height: 0 };\n\n /**\n * @type {PositionChangeSet}\n */\n this.changeSet = void 0;\n\n /**\n * @type {PositionOptions}\n */\n this.options = void 0;\n\n /**\n * Stores if this Position / update data is queued for update.\n *\n * @type {boolean}\n */\n this.queued = false;\n\n /**\n * @type {StyleCache}\n */\n this.styleCache = void 0;\n\n /**\n * @type {Transforms}\n */\n this.transforms = void 0;\n\n /**\n * Stores the current transform data used for the readable `transform` store. It is only active when there are\n * subscribers to the store or calculateTransform options is true.\n *\n * @type {TransformData}\n */\n this.transformData = new TransformData();\n\n /**\n * @type {(function(PositionData): void)[]}\n */\n this.subscriptions = void 0;\n\n /**\n * @type {Writable<{width: (number|\"auto\"), height: (number|\"auto\")}>}\n */\n this.storeDimension = writable(this.dimensionData);\n\n // When there are subscribers set option to calculate transform updates; set to false when no subscribers.\n\n /**\n * @type {Writable}\n */\n this.storeTransform = writable(this.transformData, () =>\n {\n this.options.transformSubscribed = true;\n return () => this.options.transformSubscribed = false;\n });\n\n /**\n * Stores the queued state for update element processing.\n *\n * @type {boolean}\n */\n this.queued = false;\n\n // Seal data backing readable stores.\n Object.seal(this.dimensionData);\n }\n}\n","import { isWritableStore } from '@typhonjs-fvtt/runtime/svelte/store';\n\n/**\n * Svelte doesn't provide any events for the animate directive.\n *\n * The provided function below wraps a Svelte animate directive function generating bubbling events for start & end of\n * animation.\n *\n * These events are `animate:start` and `animate:end`.\n *\n * This is useful for instance if you are animating several nodes in a scrollable container where the overflow parameter\n * needs to be set to `none` while animating such that the scrollbar is not activated by the animation.\n *\n * Optionally you may also provide a boolean writable store that will be set to true when animation is active. In some\n * cases this leads to an easier implementation for gating on animation state.\n *\n * @example With events\n * const flipWithEvents = animateEvents(flip);\n * \n *\n *
console.log('animate:start')\n * on:animate:end={() => console.log('animate:end')}>\n * {#each someData as entry (entry.id)}\n *
\n * {/each}\n\n * @example With optional store\n * const isAnimating = writable(false);\n * const flipWithEvents = animateEvents(flip, isAnimating);\n * \n *\n *
\n * {#each someData as entry (entry.id)}\n *
\n * {/each}\n *\n * @param {(node: Element, { from: DOMRect, to: DOMRect }, params?: *) => import('svelte/animate').AnimationConfig} fn -\n * A Svelte animation function.\n *\n * @param {import('svelte/store').Writable} [store] - An optional boolean writable store that is set to true\n * when animation is active.\n *\n * @returns {(node: Element, { from: DOMRect, to: DOMRect }, params?: *) => import('svelte/animate').AnimationConfig}\n * Wrapped animation function.\n */\nfunction animateEvents(fn, store = void 0)\n{\n if (typeof fn !== 'function') { throw new TypeError(`'fn' is not a function.`); }\n if (store !== void 0 && !isWritableStore(store)) { throw new TypeError(`'store' is not a writable store.`); }\n\n // Track a single start / end sequence across all animations.\n let startFired = false;\n let endFired = false;\n\n return (node, animations, params = {}) =>\n {\n const animationConfig = fn(node, animations, params);\n\n // Store any existing tick function.\n const existingTick = animationConfig.tick;\n\n // Use tick callback to fire events only once when t / time is 0 and 1.\n animationConfig.tick = (t, u) =>\n {\n // If there is any tick function then invoke it.\n if (existingTick) { existingTick(t, u); }\n\n if (!startFired && t === 0)\n {\n if (store) { store.set(true); }\n node.dispatchEvent(new CustomEvent('animate:start', { bubbles: true }));\n startFired = true;\n endFired = false;\n }\n\n if (!endFired && t === 1)\n {\n if (store) { store.set(false); }\n node.dispatchEvent(new CustomEvent('animate:end', { bubbles: true }));\n endFired = true;\n startFired = false;\n }\n };\n\n return animationConfig;\n };\n}\n\n/**\n * Awaits `requestAnimationFrame` calls by the counter specified. This allows asynchronous applications for direct /\n * inline style modification amongst other direct animation techniques.\n *\n * @param {number} [cntr=1] - A positive integer greater than 0 for amount of requestAnimationFrames to wait.\n *\n * @returns {Promise} Returns current time equivalent to `performance.now()`.\n */\nasync function nextAnimationFrame(cntr = 1)\n{\n if (!Number.isInteger(cntr) || cntr < 1)\n {\n throw new TypeError(`nextAnimationFrame error: 'cntr' must be a positive integer greater than 0.`);\n }\n\n let currentTime = performance.now();\n for (;--cntr >= 0;)\n {\n currentTime = await new Promise((resolve) => requestAnimationFrame(resolve));\n }\n\n return currentTime;\n}\n\nexport { animateEvents, nextAnimationFrame };\n//# sourceMappingURL=index.js.map\n","import { nextAnimationFrame } from '@typhonjs-fvtt/runtime/svelte/animate';\n\n/**\n * Decouples updates to any parent target HTMLElement inline styles. Invoke {@link Position.elementUpdated} to await\n * on the returned promise that is resolved with the current render time via `nextAnimationFrame` /\n * `requestAnimationFrame`. This allows the underlying data model to be updated immediately while updates to the\n * element are in sync with the browser and potentially in the future be further throttled.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n */\nexport class UpdateElementManager\n{\n static list = [];\n static listCntr = 0;\n\n static updatePromise;\n\n static get promise() { return this.updatePromise; }\n\n /**\n * Potentially adds the given element and internal updateData instance to the list.\n *\n * @param {HTMLElement} el - An HTMLElement instance.\n *\n * @param {UpdateElementData} updateData - An UpdateElementData instance.\n *\n * @returns {Promise} The unified next frame update promise. Returns `currentTime`.\n */\n static add(el, updateData)\n {\n if (this.listCntr < this.list.length)\n {\n const entry = this.list[this.listCntr];\n entry[0] = el;\n entry[1] = updateData;\n }\n else\n {\n this.list.push([el, updateData]);\n }\n\n this.listCntr++;\n updateData.queued = true;\n\n if (!this.updatePromise) { this.updatePromise = this.wait(); }\n\n return this.updatePromise;\n }\n\n /**\n * Await on `nextAnimationFrame` and iterate over list map invoking callback functions.\n *\n * @returns {Promise} The next frame Promise / currentTime from nextAnimationFrame.\n */\n static async wait()\n {\n // Await the next animation frame. In the future this can be extended to multiple frames to divide update rate.\n const currentTime = await nextAnimationFrame();\n\n this.updatePromise = void 0;\n\n for (let cntr = this.listCntr; --cntr >= 0;)\n {\n // Obtain data for entry.\n const entry = this.list[cntr];\n const el = entry[0];\n const updateData = entry[1];\n\n // Clear entry data.\n entry[0] = void 0;\n entry[1] = void 0;\n\n // Reset queued state.\n updateData.queued = false;\n\n // Early out if the element is no longer connected to the DOM / shadow root.\n // if (!el.isConnected || !updateData.changeSet.hasChange()) { continue; }\n if (!el.isConnected) { continue; }\n\n if (updateData.options.ortho)\n {\n s_UPDATE_ELEMENT_ORTHO(el, updateData);\n }\n else\n {\n s_UPDATE_ELEMENT(el, updateData);\n }\n\n // If calculate transform options is enabled then update the transform data and set the readable store.\n if (updateData.options.calculateTransform || updateData.options.transformSubscribed)\n {\n s_UPDATE_TRANSFORM(el, updateData);\n }\n\n // Update all subscribers with changed data.\n this.updateSubscribers(updateData);\n }\n\n this.listCntr = 0;\n\n return currentTime;\n }\n\n /**\n * Potentially immediately updates the given element.\n *\n * @param {HTMLElement} el - An HTMLElement instance.\n *\n * @param {UpdateElementData} updateData - An UpdateElementData instance.\n */\n static immediate(el, updateData)\n {\n // Early out if the element is no longer connected to the DOM / shadow root.\n // if (!el.isConnected || !updateData.changeSet.hasChange()) { continue; }\n if (!el.isConnected) { return; }\n\n if (updateData.options.ortho)\n {\n s_UPDATE_ELEMENT_ORTHO(el, updateData);\n }\n else\n {\n s_UPDATE_ELEMENT(el, updateData);\n }\n\n // If calculate transform options is enabled then update the transform data and set the readable store.\n if (updateData.options.calculateTransform || updateData.options.transformSubscribed)\n {\n s_UPDATE_TRANSFORM(el, updateData);\n }\n\n // Update all subscribers with changed data.\n this.updateSubscribers(updateData);\n }\n\n /**\n * @param {UpdateElementData} updateData - Data change set.\n */\n static updateSubscribers(updateData)\n {\n const data = updateData.data;\n const changeSet = updateData.changeSet;\n\n if (!changeSet.hasChange()) { return; }\n\n // Make a copy of the data.\n const output = updateData.dataSubscribers.copy(data);\n\n const subscriptions = updateData.subscriptions;\n\n // Early out if there are no subscribers.\n if (subscriptions.length > 0)\n {\n for (let cntr = 0; cntr < subscriptions.length; cntr++) { subscriptions[cntr](output); }\n }\n\n // Update dimension data if width / height has changed.\n if (changeSet.width || changeSet.height)\n {\n updateData.dimensionData.width = data.width;\n updateData.dimensionData.height = data.height;\n updateData.storeDimension.set(updateData.dimensionData);\n }\n\n changeSet.set(false);\n }\n}\n\n/**\n * Decouples updates to any parent target HTMLElement inline styles. Invoke {@link Position.elementUpdated} to await\n * on the returned promise that is resolved with the current render time via `nextAnimationFrame` /\n * `requestAnimationFrame`. This allows the underlying data model to be updated immediately while updates to the\n * element are in sync with the browser and potentially in the future be further throttled.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n *\n * @param {UpdateElementData} updateData - Update data.\n */\nfunction s_UPDATE_ELEMENT(el, updateData)\n{\n const changeSet = updateData.changeSet;\n const data = updateData.data;\n\n if (changeSet.left)\n {\n el.style.left = `${data.left}px`;\n }\n\n if (changeSet.top)\n {\n el.style.top = `${data.top}px`;\n }\n\n if (changeSet.zIndex)\n {\n el.style.zIndex = typeof data.zIndex === 'number' ? `${data.zIndex}` : null;\n }\n\n if (changeSet.width)\n {\n el.style.width = typeof data.width === 'number' ? `${data.width}px` : data.width;\n }\n\n if (changeSet.height)\n {\n el.style.height = typeof data.height === 'number' ? `${data.height}px` : data.height;\n }\n\n if (changeSet.transformOrigin)\n {\n // When set to 'center' we can simply set the transform to null which is center by default.\n el.style.transformOrigin = data.transformOrigin === 'center' ? null : data.transformOrigin;\n }\n\n // Update all transforms in order added to transforms object.\n if (changeSet.transform)\n {\n el.style.transform = updateData.transforms.isActive ? updateData.transforms.getCSS() : null;\n }\n}\n\n/**\n * Decouples updates to any parent target HTMLElement inline styles. Invoke {@link Position.elementUpdated} to await\n * on the returned promise that is resolved with the current render time via `nextAnimationFrame` /\n * `requestAnimationFrame`. This allows the underlying data model to be updated immediately while updates to the\n * element are in sync with the browser and potentially in the future be further throttled.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n *\n * @param {UpdateElementData} updateData - Update data.\n */\nfunction s_UPDATE_ELEMENT_ORTHO(el, updateData)\n{\n const changeSet = updateData.changeSet;\n const data = updateData.data;\n\n if (changeSet.zIndex)\n {\n el.style.zIndex = typeof data.zIndex === 'number' ? `${data.zIndex}` : null;\n }\n\n if (changeSet.width)\n {\n el.style.width = typeof data.width === 'number' ? `${data.width}px` : data.width;\n }\n\n if (changeSet.height)\n {\n el.style.height = typeof data.height === 'number' ? `${data.height}px` : data.height;\n }\n\n if (changeSet.transformOrigin)\n {\n // When set to 'center' we can simply set the transform to null which is center by default.\n el.style.transformOrigin = data.transformOrigin === 'center' ? null : data.transformOrigin;\n }\n\n // Update all transforms in order added to transforms object.\n if (changeSet.left || changeSet.top || changeSet.transform)\n {\n el.style.transform = updateData.transforms.getCSSOrtho(data);\n }\n}\n\n/**\n * Updates the applied transform data and sets the readble `transform` store.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n *\n * @param {UpdateElementData} updateData - Update element data.\n */\nfunction s_UPDATE_TRANSFORM(el, updateData)\n{\n s_VALIDATION_DATA.height = updateData.data.height !== 'auto' ? updateData.data.height :\n updateData.styleCache.offsetHeight;\n\n s_VALIDATION_DATA.width = updateData.data.width !== 'auto' ? updateData.data.width :\n updateData.styleCache.offsetWidth;\n\n s_VALIDATION_DATA.marginLeft = updateData.styleCache.marginLeft;\n\n s_VALIDATION_DATA.marginTop = updateData.styleCache.marginTop;\n\n // Get transform data. First set constraints including any margin top / left as offsets and width / height. Used\n // when position width / height is 'auto'.\n updateData.transforms.getData(updateData.data, updateData.transformData, s_VALIDATION_DATA);\n\n updateData.storeTransform.set(updateData.transformData);\n}\n\nconst s_VALIDATION_DATA = {\n height: void 0,\n width: void 0,\n marginLeft: void 0,\n marginTop: void 0\n};\n","import {\n propertyStore,\n subscribeIgnoreFirst } from '@typhonjs-fvtt/runtime/svelte/store';\n\nimport {\n isIterable,\n isObject,\n isPlainObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\nimport { AnimationAPI } from './animation/AnimationAPI.js';\nimport { AnimationGroupAPI } from './animation/AnimationGroupAPI.js';\nimport * as constants from './constants.js';\nimport { convertRelative } from './convertRelative.js';\nimport * as positionInitial from './initial/index.js';\nimport { PositionChangeSet } from './PositionChangeSet.js';\nimport { PositionData } from './PositionData.js';\nimport { PositionStateAPI } from './PositionStateAPI.js';\nimport { StyleCache } from './StyleCache.js';\nimport { TransformData } from './transform/TransformData.js';\nimport { AdapterValidators } from './validators/AdapterValidators.js';\nimport * as positionValidators from './validators/index.js';\nimport { Transforms } from './transform/Transforms.js';\nimport { UpdateElementData } from './update/UpdateElementData.js';\nimport { UpdateElementManager } from './update/UpdateElementManager.js';\n\n/**\n * Provides a store for position following the subscriber protocol in addition to providing individual writable derived\n * stores for each independent variable.\n */\nexport class Position\n{\n /**\n * @type {PositionData}\n */\n #data = new PositionData();\n\n /**\n * Provides the animation API.\n *\n * @type {AnimationAPI}\n */\n #animate = new AnimationAPI(this, this.#data);\n\n /**\n * Provides a way to turn on / off the position handling.\n *\n * @type {boolean}\n */\n #enabled = true;\n\n /**\n * Stores the style attributes that changed on update.\n *\n * @type {PositionChangeSet}\n */\n #positionChangeSet = new PositionChangeSet();\n\n /**\n * Stores ongoing options that are set in the constructor or by transform store subscription.\n *\n * @type {PositionOptions}\n */\n #options = {\n calculateTransform: false,\n initialHelper: void 0,\n ortho: true,\n transformSubscribed: false\n };\n\n /**\n * The associated parent for positional data tracking. Used in validators.\n *\n * @type {PositionParent}\n */\n #parent;\n\n /**\n * @type {StorePosition}\n */\n #stores;\n\n /**\n * Stores an instance of the computer styles for the target element.\n *\n * @type {StyleCache}\n */\n #styleCache;\n\n /**\n * Stores the subscribers.\n *\n * @type {(function(PositionData): void)[]}\n */\n #subscriptions = [];\n\n /**\n * @type {Transforms}\n */\n #transforms = new Transforms();\n\n /**\n * @type {UpdateElementData}\n */\n #updateElementData;\n\n /**\n * Stores the UpdateElementManager wait promise.\n *\n * @type {Promise}\n */\n #updateElementPromise;\n\n /**\n * @type {AdapterValidators}\n */\n #validators;\n\n /**\n * @type {ValidatorData[]}\n */\n #validatorData;\n\n /**\n * @type {PositionStateAPI}\n */\n #state = new PositionStateAPI(this, this.#data, this.#transforms);\n\n /**\n * @returns {AnimationGroupAPI} Public Animation API.\n */\n static get Animate() { return AnimationGroupAPI; }\n\n /**\n * @returns {{browserCentered?: Centered, Centered?: *}} Initial position helpers.\n */\n static get Initial() { return positionInitial; }\n\n /**\n * Returns TransformData class / constructor.\n *\n * @returns {TransformData} TransformData class / constructor.\n */\n static get TransformData() { return TransformData; }\n\n /**\n * Returns default validators.\n *\n * Note: `basicWindow` and `BasicBounds` will eventually be removed.\n *\n * @returns {{basicWindow?: BasicBounds, transformWindow?: TransformBounds, TransformBounds?: *, BasicBounds?: *}}\n * Available validators.\n */\n static get Validators() { return positionValidators; }\n\n /**\n * Returns a duplicate of a given position instance copying any options and validators.\n *\n * // TODO: Consider more safety over options processing.\n *\n * @param {Position} position - A position instance.\n *\n * @param {PositionOptions} options - Position options.\n *\n * @returns {Position} A duplicate position instance.\n */\n static duplicate(position, options)\n {\n if (!(position instanceof Position)) { throw new TypeError(`'position' is not an instance of Position.`); }\n\n const newPosition = new Position(options);\n\n newPosition.#options = Object.assign({}, position.#options, options);\n newPosition.#validators.add(...position.#validators);\n\n newPosition.set(position.#data);\n\n return newPosition;\n }\n\n /**\n * @param {PositionParent|PositionOptionsAll} [parent] - A potential parent element or object w/ `elementTarget`\n * getter. May also be the PositionOptions object w/ 1 argument.\n *\n * @param {PositionOptionsAll} [options] - Default values.\n */\n constructor(parent, options)\n {\n // Test if `parent` is a plain object; if so treat as options object.\n if (isPlainObject(parent))\n {\n options = parent;\n }\n else\n {\n this.#parent = parent;\n }\n\n const data = this.#data;\n const transforms = this.#transforms;\n\n this.#styleCache = new StyleCache();\n\n const updateData = new UpdateElementData();\n\n updateData.changeSet = this.#positionChangeSet;\n updateData.data = this.#data;\n updateData.options = this.#options;\n updateData.styleCache = this.#styleCache;\n updateData.subscriptions = this.#subscriptions;\n updateData.transforms = this.#transforms;\n\n this.#updateElementData = updateData;\n\n if (isObject(options))\n {\n // Set Position options\n if (typeof options.calculateTransform === 'boolean')\n {\n this.#options.calculateTransform = options.calculateTransform;\n }\n\n if (typeof options.ortho === 'boolean')\n {\n this.#options.ortho = options.ortho;\n }\n\n // Set default values from options.\n\n if (Number.isFinite(options.height) || options.height === 'auto' || options.height === 'inherit' ||\n options.height === null)\n {\n data.height = updateData.dimensionData.height = typeof options.height === 'number' ?\n Math.round(options.height) : options.height;\n }\n\n if (Number.isFinite(options.left) || options.left === null)\n {\n data.left = typeof options.left === 'number' ? Math.round(options.left) : options.left;\n }\n\n if (Number.isFinite(options.maxHeight) || options.maxHeight === null)\n {\n data.maxHeight = typeof options.maxHeight === 'number' ? Math.round(options.maxHeight) : options.maxHeight;\n }\n\n if (Number.isFinite(options.maxWidth) || options.maxWidth === null)\n {\n data.maxWidth = typeof options.maxWidth === 'number' ? Math.round(options.maxWidth) : options.maxWidth;\n }\n\n if (Number.isFinite(options.minHeight) || options.minHeight === null)\n {\n data.minHeight = typeof options.minHeight === 'number' ? Math.round(options.minHeight) : options.minHeight;\n }\n\n if (Number.isFinite(options.minWidth) || options.minWidth === null)\n {\n data.minWidth = typeof options.minWidth === 'number' ? Math.round(options.minWidth) : options.minWidth;\n }\n\n if (Number.isFinite(options.rotateX) || options.rotateX === null)\n {\n transforms.rotateX = data.rotateX = options.rotateX;\n }\n\n if (Number.isFinite(options.rotateY) || options.rotateY === null)\n {\n transforms.rotateY = data.rotateY = options.rotateY;\n }\n\n if (Number.isFinite(options.rotateZ) || options.rotateZ === null)\n {\n transforms.rotateZ = data.rotateZ = options.rotateZ;\n }\n\n if (Number.isFinite(options.scale) || options.scale === null)\n {\n transforms.scale = data.scale = options.scale;\n }\n\n if (Number.isFinite(options.top) || options.top === null)\n {\n data.top = typeof options.top === 'number' ? Math.round(options.top) : options.top;\n }\n\n if (typeof options.transformOrigin === 'string' || options.transformOrigin === null)\n {\n data.transformOrigin = constants.transformOrigins.includes(options.transformOrigin) ?\n options.transformOrigin : null;\n }\n\n if (Number.isFinite(options.translateX) || options.translateX === null)\n {\n transforms.translateX = data.translateX = options.translateX;\n }\n\n if (Number.isFinite(options.translateY) || options.translateY === null)\n {\n transforms.translateY = data.translateY = options.translateY;\n }\n\n if (Number.isFinite(options.translateZ) || options.translateZ === null)\n {\n transforms.translateZ = data.translateZ = options.translateZ;\n }\n\n if (Number.isFinite(options.width) || options.width === 'auto' || options.width === 'inherit' ||\n options.width === null)\n {\n data.width = updateData.dimensionData.width = typeof options.width === 'number' ?\n Math.round(options.width) : options.width;\n }\n\n if (Number.isFinite(options.zIndex) || options.zIndex === null)\n {\n data.zIndex = typeof options.zIndex === 'number' ? Math.round(options.zIndex) : options.zIndex;\n }\n }\n\n this.#stores = {\n // The main properties for manipulating Position.\n height: propertyStore(this, 'height'),\n left: propertyStore(this, 'left'),\n rotateX: propertyStore(this, 'rotateX'),\n rotateY: propertyStore(this, 'rotateY'),\n rotateZ: propertyStore(this, 'rotateZ'),\n scale: propertyStore(this, 'scale'),\n top: propertyStore(this, 'top'),\n transformOrigin: propertyStore(this, 'transformOrigin'),\n translateX: propertyStore(this, 'translateX'),\n translateY: propertyStore(this, 'translateY'),\n translateZ: propertyStore(this, 'translateZ'),\n width: propertyStore(this, 'width'),\n zIndex: propertyStore(this, 'zIndex'),\n\n // Stores that control validation when width / height is not `auto`.\n maxHeight: propertyStore(this, 'maxHeight'),\n maxWidth: propertyStore(this, 'maxWidth'),\n minHeight: propertyStore(this, 'minHeight'),\n minWidth: propertyStore(this, 'minWidth'),\n\n // Readable stores based on updates or from resize observer changes.\n dimension: { subscribe: updateData.storeDimension.subscribe },\n element: { subscribe: this.#styleCache.stores.element.subscribe },\n resizeContentHeight: { subscribe: this.#styleCache.stores.resizeContentHeight.subscribe },\n resizeContentWidth: { subscribe: this.#styleCache.stores.resizeContentWidth.subscribe },\n resizeOffsetHeight: { subscribe: this.#styleCache.stores.resizeOffsetHeight.subscribe },\n resizeOffsetWidth: { subscribe: this.#styleCache.stores.resizeOffsetWidth.subscribe },\n transform: { subscribe: updateData.storeTransform.subscribe },\n\n // Protected store that should only be set by resizeObserver action.\n resizeObserved: this.#styleCache.stores.resizeObserved,\n };\n\n // When resize change from any applied resizeObserver action automatically set data for new validation run.\n // A resizeObserver prop should be set to true for ApplicationShell components or usage of resizeObserver action\n // to monitor for changes. This should only be used on elements that have 'auto' for width or height.\n subscribeIgnoreFirst(this.#stores.resizeObserved, (resizeData) =>\n {\n const parent = this.#parent;\n const el = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n\n // Only invoke set if there is a target element and the resize data has a valid offset width & height.\n if (el instanceof HTMLElement && Number.isFinite(resizeData?.offsetWidth) &&\n Number.isFinite(resizeData?.offsetHeight))\n {\n this.set(data);\n }\n });\n\n this.#stores.transformOrigin.values = constants.transformOrigins;\n\n [this.#validators, this.#validatorData] = new AdapterValidators();\n\n if (options?.initial || options?.positionInitial)\n {\n const initialHelper = options.initial ?? options.positionInitial;\n\n if (typeof initialHelper?.getLeft !== 'function' || typeof initialHelper?.getTop !== 'function')\n {\n throw new Error(\n `'options.initial' position helper does not contain 'getLeft' and / or 'getTop' functions.`);\n }\n\n this.#options.initialHelper = options.initial;\n }\n\n if (options?.validator)\n {\n if (isIterable(options?.validator)) { this.validators.add(...options.validator); }\n else { this.validators.add(options.validator); }\n }\n }\n\n /**\n * Returns the animation API.\n *\n * @returns {AnimationAPI} Animation API.\n */\n get animate()\n {\n return this.#animate;\n }\n\n /**\n * Returns the dimension data for the readable store.\n *\n * @returns {{width: number | 'auto', height: number | 'auto'}} Dimension data.\n */\n get dimension()\n {\n return this.#updateElementData.dimensionData;\n }\n\n /**\n * Returns the enabled state.\n *\n * @returns {boolean} Enabled state.\n */\n get enabled()\n {\n return this.#enabled;\n }\n\n /**\n * Returns the current HTMLElement being positioned.\n *\n * @returns {HTMLElement|undefined} Current HTMLElement being positioned.\n */\n get element()\n {\n return this.#styleCache.el;\n }\n\n /**\n * Returns a promise that is resolved on the next element update with the time of the update.\n *\n * @returns {Promise} Promise resolved on element update.\n */\n get elementUpdated()\n {\n return this.#updateElementPromise;\n }\n\n /**\n * Returns the associated {@link PositionParent} instance.\n *\n * @returns {PositionParent} The PositionParent instance.\n */\n get parent() { return this.#parent; }\n\n /**\n * Returns the state API.\n *\n * @returns {PositionStateAPI} Position state API.\n */\n get state() { return this.#state; }\n\n /**\n * Returns the derived writable stores for individual data variables.\n *\n * @returns {StorePosition} Derived / writable stores.\n */\n get stores() { return this.#stores; }\n\n /**\n * Returns the transform data for the readable store.\n *\n * @returns {TransformData} Transform Data.\n */\n get transform()\n {\n return this.#updateElementData.transformData;\n }\n\n /**\n * Returns the validators.\n *\n * @returns {AdapterValidators} validators.\n */\n get validators() { return this.#validators; }\n\n /**\n * Sets the enabled state.\n *\n * @param {boolean} enabled - New enabled state.\n */\n set enabled(enabled)\n {\n if (typeof enabled !== 'boolean')\n {\n throw new TypeError(`'enabled' is not a boolean.`);\n }\n\n this.#enabled = enabled;\n }\n\n /**\n * Sets the associated {@link PositionParent} instance. Resets the style cache and default data.\n *\n * @param {PositionParent|void} parent - A PositionParent instance.\n */\n set parent(parent)\n {\n if (parent !== void 0 && !(parent instanceof HTMLElement) && !isObject(parent))\n {\n throw new TypeError(`'parent' is not an HTMLElement, object, or undefined.`);\n }\n\n this.#parent = parent;\n\n // Reset any stored default data & the style cache.\n this.#state.remove({ name: '#defaultData' });\n this.#styleCache.reset();\n\n // If a parent is defined then invoke set to update any parent element.\n if (parent) { this.set(this.#data); }\n }\n\n// Data accessors ----------------------------------------------------------------------------------------------------\n\n /**\n * @returns {number|'auto'|'inherit'|null} height\n */\n get height() { return this.#data.height; }\n\n /**\n * @returns {number|null} left\n */\n get left() { return this.#data.left; }\n\n /**\n * @returns {number|null} maxHeight\n */\n get maxHeight() { return this.#data.maxHeight; }\n\n /**\n * @returns {number|null} maxWidth\n */\n get maxWidth() { return this.#data.maxWidth; }\n\n /**\n * @returns {number|null} minHeight\n */\n get minHeight() { return this.#data.minHeight; }\n\n /**\n * @returns {number|null} minWidth\n */\n get minWidth() { return this.#data.minWidth; }\n\n /**\n * @returns {number|null} rotateX\n */\n get rotateX() { return this.#data.rotateX; }\n\n /**\n * @returns {number|null} rotateY\n */\n get rotateY() { return this.#data.rotateY; }\n\n /**\n * @returns {number|null} rotateZ\n */\n get rotateZ() { return this.#data.rotateZ; }\n\n /**\n * @returns {number|null} alias for rotateZ\n */\n get rotation() { return this.#data.rotateZ; }\n\n /**\n * @returns {number|null} scale\n */\n get scale() { return this.#data.scale; }\n\n /**\n * @returns {number|null} top\n */\n get top() { return this.#data.top; }\n\n /**\n * @returns {string} transformOrigin\n */\n get transformOrigin() { return this.#data.transformOrigin; }\n\n /**\n * @returns {number|null} translateX\n */\n get translateX() { return this.#data.translateX; }\n\n /**\n * @returns {number|null} translateY\n */\n get translateY() { return this.#data.translateY; }\n\n /**\n * @returns {number|null} translateZ\n */\n get translateZ() { return this.#data.translateZ; }\n\n /**\n * @returns {number|'auto'|'inherit'|null} width\n */\n get width() { return this.#data.width; }\n\n /**\n * @returns {number|null} z-index\n */\n get zIndex() { return this.#data.zIndex; }\n\n /**\n * @param {number|string|null} height -\n */\n set height(height)\n {\n this.#stores.height.set(height);\n }\n\n /**\n * @param {number|string|null} left -\n */\n set left(left)\n {\n this.#stores.left.set(left);\n }\n\n /**\n * @param {number|string|null} maxHeight -\n */\n set maxHeight(maxHeight)\n {\n this.#stores.maxHeight.set(maxHeight);\n }\n\n /**\n * @param {number|string|null} maxWidth -\n */\n set maxWidth(maxWidth)\n {\n this.#stores.maxWidth.set(maxWidth);\n }\n\n /**\n * @param {number|string|null} minHeight -\n */\n set minHeight(minHeight)\n {\n this.#stores.minHeight.set(minHeight);\n }\n\n /**\n * @param {number|string|null} minWidth -\n */\n set minWidth(minWidth)\n {\n this.#stores.minWidth.set(minWidth);\n }\n\n /**\n * @param {number|string|null} rotateX -\n */\n set rotateX(rotateX)\n {\n this.#stores.rotateX.set(rotateX);\n }\n\n /**\n * @param {number|string|null} rotateY -\n */\n set rotateY(rotateY)\n {\n this.#stores.rotateY.set(rotateY);\n }\n\n /**\n * @param {number|string|null} rotateZ -\n */\n set rotateZ(rotateZ)\n {\n this.#stores.rotateZ.set(rotateZ);\n }\n\n /**\n * @param {number|string|null} rotateZ - alias for rotateZ\n */\n set rotation(rotateZ)\n {\n this.#stores.rotateZ.set(rotateZ);\n }\n\n /**\n * @param {number|string|null} scale -\n */\n set scale(scale)\n {\n this.#stores.scale.set(scale);\n }\n\n /**\n * @param {number|string|null} top -\n */\n set top(top)\n {\n this.#stores.top.set(top);\n }\n\n /**\n * @param {string} transformOrigin -\n */\n set transformOrigin(transformOrigin)\n {\n if (constants.transformOrigins.includes(transformOrigin)) { this.#stores.transformOrigin.set(transformOrigin); }\n }\n\n /**\n * @param {number|string|null} translateX -\n */\n set translateX(translateX)\n {\n this.#stores.translateX.set(translateX);\n }\n\n /**\n * @param {number|string|null} translateY -\n */\n set translateY(translateY)\n {\n this.#stores.translateY.set(translateY);\n }\n\n /**\n * @param {number|string|null} translateZ -\n */\n set translateZ(translateZ)\n {\n this.#stores.translateZ.set(translateZ);\n }\n\n /**\n * @param {number|string|null} width -\n */\n set width(width)\n {\n this.#stores.width.set(width);\n }\n\n /**\n * @param {number|string|null} zIndex -\n */\n set zIndex(zIndex)\n {\n this.#stores.zIndex.set(zIndex);\n }\n\n /**\n * Assigns current position to object passed into method.\n *\n * @param {object|PositionData} [position] - Target to assign current position data.\n *\n * @param {PositionGetOptions} [options] - Defines options for specific keys and substituting null for numeric\n * default values.\n *\n * @returns {PositionData} Passed in object with current position data.\n */\n get(position = {}, options)\n {\n const keys = options?.keys;\n const excludeKeys = options?.exclude;\n const numeric = options?.numeric ?? false;\n\n if (isIterable(keys))\n {\n // Replace any null values potentially with numeric default values.\n if (numeric)\n {\n for (const key of keys) { position[key] = this[key] ?? constants.numericDefaults[key]; }\n }\n else // Accept current values.\n {\n for (const key of keys) { position[key] = this[key]; }\n }\n\n // Remove any excluded keys.\n if (isIterable(excludeKeys))\n {\n for (const key of excludeKeys) { delete position[key]; }\n }\n\n return position;\n }\n else\n {\n const data = Object.assign(position, this.#data);\n\n // Remove any excluded keys.\n if (isIterable(excludeKeys))\n {\n for (const key of excludeKeys) { delete data[key]; }\n }\n\n // Potentially set numeric defaults.\n if (numeric) { constants.setNumericDefaults(data); }\n\n return data;\n }\n }\n\n /**\n * @returns {PositionData} Current position data.\n */\n toJSON()\n {\n return Object.assign({}, this.#data);\n }\n\n /**\n * All calculation and updates of position are implemented in {@link Position}. This allows position to be fully\n * reactive and in control of updating inline styles for the application.\n *\n * Note: the logic for updating position is improved and changes a few aspects from the default\n * {@link Application.setPosition}. The gate on `popOut` is removed, so to ensure no positional application occurs\n * popOut applications can set `this.options.positionable` to false ensuring no positional inline styles are\n * applied.\n *\n * The initial set call on an application with a target element will always set width / height as this is\n * necessary for correct calculations.\n *\n * When a target element is present updated styles are applied after validation. To modify the behavior of set\n * implement one or more validator functions and add them from the application via\n * `this.position.validators.add()`.\n *\n * Updates to any target element are decoupled from the underlying Position data. This method returns this instance\n * that you can then await on the target element inline style update by using {@link Position.elementUpdated}.\n *\n * @param {PositionDataExtended} [position] - Position data to set.\n *\n * @returns {Position} This Position instance.\n */\n set(position = {})\n {\n if (typeof position !== 'object') { throw new TypeError(`Position - set error: 'position' is not an object.`); }\n\n const parent = this.#parent;\n\n // An early out to prevent `set` from taking effect if not enabled.\n if (!this.#enabled)\n {\n return this;\n }\n\n // An early out to prevent `set` from taking effect if options `positionable` is false.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return this;\n }\n\n // Callers can specify to immediately update an associated element. This is useful if set is called from\n // requestAnimationFrame / rAF. Library integrations like GSAP invoke set from rAF.\n const immediateElementUpdate = position.immediateElementUpdate === true;\n\n const data = this.#data;\n const transforms = this.#transforms;\n\n // Find the target HTML element and verify that it is connected storing it in `el`.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n const changeSet = this.#positionChangeSet;\n const styleCache = this.#styleCache;\n\n if (el)\n {\n // Cache the computed styles of the element.\n if (!styleCache.hasData(el))\n {\n styleCache.update(el);\n\n // Add will-change property if not already set in inline or computed styles.\n if (!styleCache.hasWillChange)\n {\n // TODO: This is commented out as there is a Chrome bug that reduces quality / blurs\n // child elements when `will-change: transform` is set.\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1343711#c4\n\n // el.style.willChange = this.#options.ortho ? 'transform' : 'top, left, transform';\n }\n\n // Update all properties / clear queued state.\n changeSet.set(true);\n this.#updateElementData.queued = false;\n }\n\n // Converts any relative string position data to numeric inputs.\n convertRelative(position, this);\n\n position = this.#updatePosition(position, parent, el, styleCache);\n\n // Check if a validator cancelled the update.\n if (position === null) { return this; }\n }\n\n if (Number.isFinite(position.left))\n {\n position.left = Math.round(position.left);\n\n if (data.left !== position.left) { data.left = position.left; changeSet.left = true; }\n }\n\n if (Number.isFinite(position.top))\n {\n position.top = Math.round(position.top);\n\n if (data.top !== position.top) { data.top = position.top; changeSet.top = true; }\n }\n\n if (Number.isFinite(position.maxHeight) || position.maxHeight === null)\n {\n position.maxHeight = typeof position.maxHeight === 'number' ? Math.round(position.maxHeight) : null;\n\n if (data.maxHeight !== position.maxHeight) { data.maxHeight = position.maxHeight; changeSet.maxHeight = true; }\n }\n\n if (Number.isFinite(position.maxWidth) || position.maxWidth === null)\n {\n position.maxWidth = typeof position.maxWidth === 'number' ? Math.round(position.maxWidth) : null;\n\n if (data.maxWidth !== position.maxWidth) { data.maxWidth = position.maxWidth; changeSet.maxWidth = true; }\n }\n\n if (Number.isFinite(position.minHeight) || position.minHeight === null)\n {\n position.minHeight = typeof position.minHeight === 'number' ? Math.round(position.minHeight) : null;\n\n if (data.minHeight !== position.minHeight) { data.minHeight = position.minHeight; changeSet.minHeight = true; }\n }\n\n if (Number.isFinite(position.minWidth) || position.minWidth === null)\n {\n position.minWidth = typeof position.minWidth === 'number' ? Math.round(position.minWidth) : null;\n\n if (data.minWidth !== position.minWidth) { data.minWidth = position.minWidth; changeSet.minWidth = true; }\n }\n\n if (Number.isFinite(position.rotateX) || position.rotateX === null)\n {\n if (data.rotateX !== position.rotateX)\n {\n data.rotateX = transforms.rotateX = position.rotateX;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.rotateY) || position.rotateY === null)\n {\n if (data.rotateY !== position.rotateY)\n {\n data.rotateY = transforms.rotateY = position.rotateY;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.rotateZ) || position.rotateZ === null)\n {\n if (data.rotateZ !== position.rotateZ)\n {\n data.rotateZ = transforms.rotateZ = position.rotateZ;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.scale) || position.scale === null)\n {\n position.scale = typeof position.scale === 'number' ? Math.max(0, Math.min(position.scale, 1000)) : null;\n\n if (data.scale !== position.scale)\n {\n data.scale = transforms.scale = position.scale;\n changeSet.transform = true;\n }\n }\n\n if ((typeof position.transformOrigin === 'string' && constants.transformOrigins.includes(\n position.transformOrigin)) || position.transformOrigin === null)\n {\n if (data.transformOrigin !== position.transformOrigin)\n {\n data.transformOrigin = position.transformOrigin;\n changeSet.transformOrigin = true;\n }\n }\n\n if (Number.isFinite(position.translateX) || position.translateX === null)\n {\n if (data.translateX !== position.translateX)\n {\n data.translateX = transforms.translateX = position.translateX;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.translateY) || position.translateY === null)\n {\n if (data.translateY !== position.translateY)\n {\n data.translateY = transforms.translateY = position.translateY;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.translateZ) || position.translateZ === null)\n {\n if (data.translateZ !== position.translateZ)\n {\n data.translateZ = transforms.translateZ = position.translateZ;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.zIndex))\n {\n position.zIndex = Math.round(position.zIndex);\n\n if (data.zIndex !== position.zIndex) { data.zIndex = position.zIndex; changeSet.zIndex = true; }\n }\n\n if (Number.isFinite(position.width) || position.width === 'auto' || position.width === 'inherit' ||\n position.width === null)\n {\n position.width = typeof position.width === 'number' ? Math.round(position.width) : position.width;\n\n if (data.width !== position.width) { data.width = position.width; changeSet.width = true; }\n }\n\n if (Number.isFinite(position.height) || position.height === 'auto' || position.height === 'inherit' ||\n position.height === null)\n {\n position.height = typeof position.height === 'number' ? Math.round(position.height) : position.height;\n\n if (data.height !== position.height) { data.height = position.height; changeSet.height = true; }\n }\n\n if (el)\n {\n const defaultData = this.#state.getDefault();\n\n // Set default data after first set operation that has a target element.\n if (typeof defaultData !== 'object')\n {\n this.#state.save({ name: '#defaultData', ...Object.assign({}, data) });\n }\n\n // If `immediateElementUpdate` is true in position data passed to `set` then update the element immediately.\n // This is for rAF based library integrations like GSAP.\n if (immediateElementUpdate)\n {\n UpdateElementManager.immediate(el, this.#updateElementData);\n this.#updateElementPromise = Promise.resolve(performance.now());\n }\n // Else if not queued then queue an update for the next rAF callback.\n else if (!this.#updateElementData.queued)\n {\n this.#updateElementPromise = UpdateElementManager.add(el, this.#updateElementData);\n }\n }\n else\n {\n // Notify main store subscribers.\n UpdateElementManager.updateSubscribers(this.#updateElementData);\n }\n\n return this;\n }\n\n /**\n *\n * @param {function(PositionData): void} handler - Callback function that is invoked on update / changes. Receives\n * a copy of the PositionData.\n *\n * @returns {(function(): void)} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n\n handler(Object.assign({}, this.#data)); // call handler with current value\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n\n /**\n * @param {PositionDataExtended} opts -\n *\n * @param {number|null} opts.left -\n *\n * @param {number|null} opts.top -\n *\n * @param {number|null} opts.maxHeight -\n *\n * @param {number|null} opts.maxWidth -\n *\n * @param {number|null} opts.minHeight -\n *\n * @param {number|null} opts.minWidth -\n *\n * @param {number|'auto'|null} opts.width -\n *\n * @param {number|'auto'|null} opts.height -\n *\n * @param {number|null} opts.rotateX -\n *\n * @param {number|null} opts.rotateY -\n *\n * @param {number|null} opts.rotateZ -\n *\n * @param {number|null} opts.scale -\n *\n * @param {string} opts.transformOrigin -\n *\n * @param {number|null} opts.translateX -\n *\n * @param {number|null} opts.translateY -\n *\n * @param {number|null} opts.translateZ -\n *\n * @param {number|null} opts.zIndex -\n *\n * @param {number|null} opts.rotation - alias for rotateZ\n *\n * @param {*} opts.rest -\n *\n * @param {object} parent -\n *\n * @param {HTMLElement} el -\n *\n * @param {StyleCache} styleCache -\n *\n * @returns {null|PositionData} Updated position data or null if validation fails.\n */\n #updatePosition({\n // Directly supported parameters\n left, top, maxWidth, maxHeight, minWidth, minHeight, width, height, rotateX, rotateY, rotateZ, scale,\n transformOrigin, translateX, translateY, translateZ, zIndex,\n\n // Aliased parameters\n rotation,\n\n ...rest\n } = {}, parent, el, styleCache)\n {\n let currentPosition = s_DATA_UPDATE.copy(this.#data);\n\n // Update width if an explicit value is passed, or if no width value is set on the element.\n if (el.style.width === '' || width !== void 0)\n {\n if (width === 'auto' || (currentPosition.width === 'auto' && width !== null))\n {\n currentPosition.width = 'auto';\n width = styleCache.offsetWidth;\n }\n else if (width === 'inherit' || (currentPosition.width === 'inherit' && width !== null))\n {\n currentPosition.width = 'inherit';\n width = styleCache.offsetWidth;\n }\n else\n {\n const newWidth = Number.isFinite(width) ? width : currentPosition.width;\n currentPosition.width = width = Number.isFinite(newWidth) ? Math.round(newWidth) : styleCache.offsetWidth;\n }\n }\n else\n {\n width = Number.isFinite(currentPosition.width) ? currentPosition.width : styleCache.offsetWidth;\n }\n\n // Update height if an explicit value is passed, or if no height value is set on the element.\n if (el.style.height === '' || height !== void 0)\n {\n if (height === 'auto' || (currentPosition.height === 'auto' && height !== null))\n {\n currentPosition.height = 'auto';\n height = styleCache.offsetHeight;\n }\n else if (height === 'inherit' || (currentPosition.height === 'inherit' && height !== null))\n {\n currentPosition.height = 'inherit';\n height = styleCache.offsetHeight;\n }\n else\n {\n const newHeight = Number.isFinite(height) ? height : currentPosition.height;\n currentPosition.height = height = Number.isFinite(newHeight) ? Math.round(newHeight) :\n styleCache.offsetHeight;\n }\n }\n else\n {\n height = Number.isFinite(currentPosition.height) ? currentPosition.height : styleCache.offsetHeight;\n }\n\n // Update left\n if (Number.isFinite(left))\n {\n currentPosition.left = left;\n }\n else if (!Number.isFinite(currentPosition.left))\n {\n // Potentially use any initial position helper if available or set to 0.\n currentPosition.left = typeof this.#options.initialHelper?.getLeft === 'function' ?\n this.#options.initialHelper.getLeft(width) : 0;\n }\n\n // Update top\n if (Number.isFinite(top))\n {\n currentPosition.top = top;\n }\n else if (!Number.isFinite(currentPosition.top))\n {\n // Potentially use any initial position helper if available or set to 0.\n currentPosition.top = typeof this.#options.initialHelper?.getTop === 'function' ?\n this.#options.initialHelper.getTop(height) : 0;\n }\n\n if (Number.isFinite(maxHeight) || maxHeight === null)\n {\n currentPosition.maxHeight = Number.isFinite(maxHeight) ? Math.round(maxHeight) : null;\n }\n\n if (Number.isFinite(maxWidth) || maxWidth === null)\n {\n currentPosition.maxWidth = Number.isFinite(maxWidth) ? Math.round(maxWidth) : null;\n }\n\n if (Number.isFinite(minHeight) || minHeight === null)\n {\n currentPosition.minHeight = Number.isFinite(minHeight) ? Math.round(minHeight) : null;\n }\n\n if (Number.isFinite(minWidth) || minWidth === null)\n {\n currentPosition.minWidth = Number.isFinite(minWidth) ? Math.round(minWidth) : null;\n }\n\n // Update rotate X/Y/Z, scale, z-index\n if (Number.isFinite(rotateX) || rotateX === null) { currentPosition.rotateX = rotateX; }\n if (Number.isFinite(rotateY) || rotateY === null) { currentPosition.rotateY = rotateY; }\n\n // Handle alias for rotateZ. First check if `rotateZ` is valid and different from the current value. Next check if\n // `rotation` is valid and use it for `rotateZ`.\n if (rotateZ !== currentPosition.rotateZ && (Number.isFinite(rotateZ) || rotateZ === null))\n {\n currentPosition.rotateZ = rotateZ;\n }\n else if (rotation !== currentPosition.rotateZ && (Number.isFinite(rotation) || rotation === null))\n {\n currentPosition.rotateZ = rotation;\n }\n\n if (Number.isFinite(translateX) || translateX === null) { currentPosition.translateX = translateX; }\n if (Number.isFinite(translateY) || translateY === null) { currentPosition.translateY = translateY; }\n if (Number.isFinite(translateZ) || translateZ === null) { currentPosition.translateZ = translateZ; }\n\n if (Number.isFinite(scale) || scale === null)\n {\n currentPosition.scale = typeof scale === 'number' ? Math.max(0, Math.min(scale, 1000)) : null;\n }\n\n if (typeof transformOrigin === 'string' || transformOrigin === null)\n {\n currentPosition.transformOrigin = constants.transformOrigins.includes(transformOrigin) ? transformOrigin :\n null;\n }\n\n if (Number.isFinite(zIndex) || zIndex === null)\n {\n currentPosition.zIndex = typeof zIndex === 'number' ? Math.round(zIndex) : zIndex;\n }\n\n const validatorData = this.#validatorData;\n\n // If there are any validators allow them to potentially modify position data or reject the update.\n if (this.#validators.enabled && validatorData.length)\n {\n s_VALIDATION_DATA.parent = parent;\n\n s_VALIDATION_DATA.el = el;\n\n s_VALIDATION_DATA.computed = styleCache.computed;\n\n s_VALIDATION_DATA.transforms = this.#transforms;\n\n s_VALIDATION_DATA.height = height;\n\n s_VALIDATION_DATA.width = width;\n\n s_VALIDATION_DATA.marginLeft = styleCache.marginLeft;\n\n s_VALIDATION_DATA.marginTop = styleCache.marginTop;\n\n s_VALIDATION_DATA.maxHeight = styleCache.maxHeight ?? currentPosition.maxHeight;\n\n s_VALIDATION_DATA.maxWidth = styleCache.maxWidth ?? currentPosition.maxWidth;\n\n // Given a parent w/ reactive state and is minimized ignore styleCache min-width/height.\n const isMinimized = parent?.reactive?.minimized ?? false;\n\n // Note the use of || for accessing the style cache as the left hand is ignored w/ falsy values such as '0'.\n s_VALIDATION_DATA.minHeight = isMinimized ? currentPosition.minHeight ?? 0 :\n styleCache.minHeight || (currentPosition.minHeight ?? 0);\n\n s_VALIDATION_DATA.minWidth = isMinimized ? currentPosition.minWidth ?? 0 :\n styleCache.minWidth || (currentPosition.minWidth ?? 0);\n\n for (let cntr = 0; cntr < validatorData.length; cntr++)\n {\n s_VALIDATION_DATA.position = currentPosition;\n s_VALIDATION_DATA.rest = rest;\n currentPosition = validatorData[cntr].validator(s_VALIDATION_DATA);\n\n if (currentPosition === null) { return null; }\n }\n }\n\n // Return the updated position object.\n return currentPosition;\n }\n}\n\nconst s_DATA_UPDATE = new PositionData();\n\n/**\n * @type {ValidationData}\n */\nconst s_VALIDATION_DATA = {\n position: void 0,\n parent: void 0,\n el: void 0,\n computed: void 0,\n transforms: void 0,\n height: void 0,\n width: void 0,\n marginLeft: void 0,\n marginTop: void 0,\n maxHeight: void 0,\n maxWidth: void 0,\n minHeight: void 0,\n minWidth: void 0,\n rest: void 0\n};\n\nObject.seal(s_VALIDATION_DATA);\n\n/**\n * @typedef {object} PositionInitialHelper\n *\n * @property {(width: number) => number} getLeft - Returns the left position given the width of the browser window.\n *\n * @property {(height: number) => number} getTop - Returns the top position given the height of the browser window.\n */\n\n/**\n * @typedef {object} PositionDataExtended\n *\n * @property {number|string|null} [height] -\n *\n * @property {number|string|null} [left] -\n *\n * @property {number|string|null} [maxHeight] -\n *\n * @property {number|string|null} [maxWidth] -\n *\n * @property {number|string|null} [minHeight] -\n *\n * @property {number|string|null} [minWidth] -\n *\n * @property {number|string|null} [rotateX] -\n *\n * @property {number|string|null} [rotateY] -\n *\n * @property {number|string|null} [rotateZ] -\n *\n * @property {number|string|null} [scale] -\n *\n * @property {number|string|null} [top] -\n *\n * @property {string|null} [transformOrigin] -\n *\n * @property {number|string|null} [translateX] -\n *\n * @property {number|string|null} [translateY] -\n *\n * @property {number|string|null} [translateZ] -\n *\n * @property {number|string|null} [width] -\n *\n * @property {number|string|null} [zIndex] -\n *\n * Extended properties -----------------------------------------------------------------------------------------------\n *\n * @property {boolean} [immediateElementUpdate] - When true any associated element is updated immediately.\n *\n * @property {number|null} [rotation] - Alias for `rotateZ`.\n */\n\n/**\n * @typedef {object} PositionGetOptions\n *\n * @property {Iterable} keys - When provided only these keys are copied.\n *\n * @property {Iterable} exclude - When provided these keys are excluded.\n *\n * @property {boolean} numeric - When true any `null` values are converted into defaults.\n */\n\n/**\n * @typedef {object} PositionOptions - Options set in constructor.\n *\n * @property {boolean} calculateTransform - When true always calculate transform data.\n *\n * @property {PositionInitialHelper} initialHelper - Provides a helper for setting initial position data.\n *\n * @property {boolean} ortho - Sets Position to orthographic mode using just transform / matrix3d for positioning.\n *\n * @property {boolean} transformSubscribed - Set to true when there are subscribers to the readable transform store.\n */\n\n/**\n * @typedef {PositionOptions & PositionData} PositionOptionsAll\n */\n\n/**\n * @typedef {HTMLElement | object} PositionParent\n *\n * @property {Function} [elementTarget] - Potentially returns any parent object.\n */\n\n/**\n * @typedef {object} ResizeObserverData\n *\n * @property {number|undefined} contentHeight -\n *\n * @property {number|undefined} contentWidth -\n *\n * @property {number|undefined} offsetHeight -\n *\n * @property {number|undefined} offsetWidth -\n */\n\n/**\n * @typedef {object} StorePosition - Provides individual writable stores for {@link Position}.\n *\n * @property {import('svelte/store').Readable<{width: number, height: number}>} dimension - Readable store for dimension\n * data.\n *\n * @property {import('svelte/store').Readable} element - Readable store for current element.\n *\n * @property {import('svelte/store').Writable} left - Derived store for `left` updates.\n *\n * @property {import('svelte/store').Writable} top - Derived store for `top` updates.\n *\n * @property {import('svelte/store').Writable} width - Derived store for `width` updates.\n *\n * @property {import('svelte/store').Writable} height - Derived store for `height` updates.\n *\n * @property {import('svelte/store').Writable} maxHeight - Derived store for `maxHeight` updates.\n *\n * @property {import('svelte/store').Writable} maxWidth - Derived store for `maxWidth` updates.\n *\n * @property {import('svelte/store').Writable} minHeight - Derived store for `minHeight` updates.\n *\n * @property {import('svelte/store').Writable} minWidth - Derived store for `minWidth` updates.\n *\n * @property {import('svelte/store').Readable} resizeContentHeight - Readable store for `contentHeight`.\n *\n * @property {import('svelte/store').Readable} resizeContentWidth - Readable store for `contentWidth`.\n *\n * @property {import('svelte/store').Writable} resizeObserved - Protected store for resize observer updates.\n *\n * @property {import('svelte/store').Readable} resizeOffsetHeight - Readable store for `offsetHeight`.\n *\n * @property {import('svelte/store').Readable} resizeOffsetWidth - Readable store for `offsetWidth`.\n *\n * @property {import('svelte/store').Writable} rotate - Derived store for `rotate` updates.\n *\n * @property {import('svelte/store').Writable} rotateX - Derived store for `rotateX` updates.\n *\n * @property {import('svelte/store').Writable} rotateY - Derived store for `rotateY` updates.\n *\n * @property {import('svelte/store').Writable} rotateZ - Derived store for `rotateZ` updates.\n *\n * @property {import('svelte/store').Writable} scale - Derived store for `scale` updates.\n *\n * @property {import('svelte/store').Readable} transform - Readable store for transform data.\n *\n * @property {import('svelte/store').Writable} transformOrigin - Derived store for `transformOrigin`.\n *\n * @property {import('svelte/store').Writable} translateX - Derived store for `translateX` updates.\n *\n * @property {import('svelte/store').Writable} translateY - Derived store for `translateY` updates.\n *\n * @property {import('svelte/store').Writable} translateZ - Derived store for `translateZ` updates.\n *\n * @property {import('svelte/store').Writable} zIndex - Derived store for `zIndex` updates.\n */\n\n/**\n * @typedef {object} ValidationData\n *\n * @property {PositionData} position -\n *\n * @property {PositionParent} parent -\n *\n * @property {HTMLElement} el -\n *\n * @property {CSSStyleDeclaration} computed -\n *\n * @property {Transforms} transforms -\n *\n * @property {number} height -\n *\n * @property {number} width -\n *\n * @property {number|undefined} marginLeft -\n *\n * @property {number|undefined} marginTop -\n *\n * @property {number|undefined} maxHeight -\n *\n * @property {number|undefined} maxWidth -\n *\n * @property {number|undefined} minHeight -\n *\n * @property {number|undefined} minWidth -\n *\n * @property {object} rest - The rest of any data submitted to {@link Position.set}\n */\n","import { linear } from 'svelte/easing';\n\nimport { lerp } from '@typhonjs-fvtt/runtime/svelte/math';\nimport { isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Provides the ability the save / restore application state for positional and UI state such as minimized status.\n *\n * You can restore a saved state with animation; please see the options of {@link ApplicationState.restore}.\n */\nexport class ApplicationState\n{\n /** @type {ApplicationShellExt} */\n #application;\n\n /** @type {Map} */\n #dataSaved = new Map();\n\n /**\n * @param {ApplicationShellExt} application - The application.\n */\n constructor(application)\n {\n this.#application = application;\n\n Object.seal(this);\n }\n\n /**\n * Returns current application state along with any extra data passed into method.\n *\n * @param {object} [extra] - Extra data to add to application state.\n *\n * @returns {ApplicationStateData} Passed in object with current application state.\n */\n get(extra = {})\n {\n return Object.assign(extra, {\n position: this.#application?.position?.get(),\n beforeMinimized: this.#application?.position?.state.get({ name: '#beforeMinimized' }),\n options: Object.assign({}, this.#application?.options),\n ui: { minimized: this.#application?.reactive?.minimized }\n });\n }\n\n /**\n * Returns any stored save state by name.\n *\n * @param {string} name - Saved data set name.\n *\n * @returns {ApplicationStateData} The saved data set.\n */\n getSave({ name })\n {\n if (typeof name !== 'string')\n {\n throw new TypeError(`ApplicationState - getSave error: 'name' is not a string.`);\n }\n\n return this.#dataSaved.get(name);\n }\n\n /**\n * Removes and returns any application state by name.\n *\n * @param {object} options - Options.\n *\n * @param {string} options.name - Name to remove and retrieve.\n *\n * @returns {ApplicationStateData} Saved application data.\n */\n remove({ name })\n {\n if (typeof name !== 'string') { throw new TypeError(`ApplicationState - remove: 'name' is not a string.`); }\n\n const data = this.#dataSaved.get(name);\n this.#dataSaved.delete(name);\n\n return data;\n }\n\n /**\n * Restores a saved application state returning the data. Several optional parameters are available\n * to control whether the restore action occurs silently (no store / inline styles updates), animates\n * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to} allows\n * specification of the duration, easing, and interpolate functions along with configuring a Promise to be\n * returned if awaiting the end of the animation.\n *\n * @param {object} params - Parameters\n *\n * @param {string} params.name - Saved data set name.\n *\n * @param {boolean} [params.remove=false] - Remove data set.\n *\n * @param {boolean} [params.async=false] - If animating return a Promise that resolves with any saved data.\n *\n * @param {boolean} [params.animateTo=false] - Animate to restore data.\n *\n * @param {number} [params.duration=0.1] - Duration in seconds.\n *\n * @param {Function} [params.ease=linear] - Easing function.\n *\n * @param {Function} [params.interpolate=lerp] - Interpolation function.\n *\n * @returns {ApplicationStateData|Promise} Saved application data.\n */\n restore({ name, remove = false, async = false, animateTo = false, duration = 0.1, ease = linear,\n interpolate = lerp })\n {\n if (typeof name !== 'string')\n {\n throw new TypeError(`ApplicationState - restore error: 'name' is not a string.`);\n }\n\n const dataSaved = this.#dataSaved.get(name);\n\n if (dataSaved)\n {\n if (remove) { this.#dataSaved.delete(name); }\n\n if (async)\n {\n return this.set(dataSaved, { async, animateTo, duration, ease, interpolate }).then(() => dataSaved);\n }\n else\n {\n this.set(dataSaved, { async, animateTo, duration, ease, interpolate });\n }\n }\n\n return dataSaved;\n }\n\n /**\n * Saves current application state with the opportunity to add extra data to the saved state.\n *\n * @param {object} options - Options.\n *\n * @param {string} options.name - name to index this saved data.\n *\n * @param {...*} [options.extra] - Extra data to add to saved data.\n *\n * @returns {ApplicationStateData} Current application data\n */\n save({ name, ...extra })\n {\n if (typeof name !== 'string') { throw new TypeError(`ApplicationState - save error: 'name' is not a string.`); }\n\n const data = this.get(extra);\n\n this.#dataSaved.set(name, data);\n\n return data;\n }\n\n /**\n * Restores a saved application state returning the data. Several optional parameters are available\n * to control whether the restore action occurs silently (no store / inline styles updates), animates\n * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to} allows\n * specification of the duration, easing, and interpolate functions along with configuring a Promise to be\n * returned if awaiting the end of the animation.\n *\n * Note: If serializing application state any minimized apps will use the before minimized state on initial render\n * of the app as it is currently not possible to render apps with Foundry VTT core API in the minimized state.\n *\n * TODO: THIS METHOD NEEDS TO BE REFACTORED WHEN TRL IS MADE INTO A STANDALONE FRAMEWORK.\n *\n * @param {ApplicationStateData} data - Saved data set name.\n *\n * @param {object} [opts] - Optional parameters\n *\n * @param {boolean} [opts.async=false] - If animating return a Promise that resolves with any saved data.\n *\n * @param {boolean} [opts.animateTo=false] - Animate to restore data.\n *\n * @param {number} [opts.duration=0.1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=linear] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {ApplicationShellExt|Promise} When synchronous the application or Promise when\n * animating resolving with application.\n */\n set(data, { async = false, animateTo = false, duration = 0.1, ease = linear, interpolate = lerp } = {})\n {\n if (!isObject(data))\n {\n throw new TypeError(`ApplicationState - restore error: 'data' is not an object.`);\n }\n\n const application = this.#application;\n\n if (!isObject(data?.position))\n {\n console.warn(`ApplicationState.set warning: 'data.position' is not an object.`);\n return application;\n }\n\n // TODO: TAKE NOTE THAT WE ARE ACCESSING A FOUNDRY APP v1 GETTER HERE TO DETERMINE IF APPLICATION IS RENDERED.\n // TODO: THIS NEEDS TO BE REFACTORED WHEN CONVERTING TRL TO A GENERIC FRAMEWORK.\n const rendered = application.rendered;\n\n if (animateTo && !rendered)\n {\n console.warn(`ApplicationState.set warning: Application is not rendered and 'animateTo' is true.`);\n return application;\n }\n\n // Update data directly with no store or inline style updates.\n if (animateTo) // Animate to saved data.\n {\n // Provide special handling to potentially change transform origin as this parameter is not animated.\n if (data.position.transformOrigin !== application.position.transformOrigin)\n {\n application.position.transformOrigin = data.position.transformOrigin;\n }\n\n if (isObject(data?.ui))\n {\n const minimized = typeof data.ui?.minimized === 'boolean' ? data.ui.minimized : false;\n\n if (application?.reactive?.minimized && !minimized)\n {\n application.maximize({ animate: false, duration: 0 });\n }\n }\n\n const promise = application.position.animate.to(data.position,\n { duration, ease, interpolate }).finished.then((cancelled) =>\n {\n if (cancelled) { return application; }\n\n // Merge in saved options to application.\n if (isObject(data?.options))\n {\n application?.reactive.mergeOptions(data.options);\n }\n\n if (isObject(data?.ui))\n {\n const minimized = typeof data.ui?.minimized === 'boolean' ? data.ui.minimized : false;\n\n // Application is currently minimized and stored state is not, so reset minimized state without\n // animation.\n if (!application?.reactive?.minimized && minimized)\n {\n application.minimize({ animate: false, duration: 0 });\n }\n }\n\n if (isObject(data?.beforeMinimized))\n {\n application.position.state.set({ name: '#beforeMinimized', ...data.beforeMinimized });\n }\n\n return application;\n });\n\n // Return a Promise with the application that resolves after animation ends.\n if (async) { return promise; }\n }\n else\n {\n if (rendered)\n {\n // Merge in saved options to application.\n if (isObject(data?.options))\n {\n application?.reactive.mergeOptions(data.options);\n }\n\n if (isObject(data?.ui))\n {\n const minimized = typeof data.ui?.minimized === 'boolean' ? data.ui.minimized : false;\n\n // Application is currently minimized and stored state is not, so reset minimized state without\n // animation.\n if (application?.reactive?.minimized && !minimized)\n {\n application.maximize({ animate: false, duration: 0 });\n }\n else if (!application?.reactive?.minimized && minimized)\n {\n application.minimize({ animate: false, duration });\n }\n }\n\n if (isObject(data?.beforeMinimized))\n {\n application.position.state.set({ name: '#beforeMinimized', ...data.beforeMinimized });\n }\n\n // Default options is to set data for an immediate update.\n application.position.set(data.position);\n }\n else\n {\n // When not rendered set position to the 'beforeMinimized' data if it exists otherwise set w/ 'position'.\n // Currently, w/ Foundry core Application API it is impossible to initially render an app in the minimized\n // state.\n\n let positionData = data.position;\n\n if (isObject(data.beforeMinimized))\n {\n // Take before minimized data.\n positionData = data.beforeMinimized;\n\n // Apply position left / top to before minimized data. This covers the case when an app is minimized,\n // but then moved. This allows restoration of the before minimized parameters w/ the last position\n // location.\n positionData.left = data.position.left;\n positionData.top = data.position.top;\n }\n\n application.position.set(positionData);\n }\n }\n\n return application;\n }\n}\n\n/**\n * @typedef {object} ApplicationStateData\n *\n * @property {PositionDataExtended} position - Application position.\n *\n * @property {object} beforeMinimized - Any application saved position state for #beforeMinimized\n *\n * @property {object} options - Application options.\n *\n * @property {object} ui - Application UI state.\n */\n","import { isObject } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Provides a helper class for {@link SvelteApplication} by combining all methods that work on the {@link SvelteData[]}\n * of mounted components. This class is instantiated and can be retrieved by the getter `svelte` via SvelteApplication.\n */\nexport class GetSvelteData\n{\n /**\n * @type {MountedAppShell[]|null[]}\n */\n #applicationShellHolder;\n\n /**\n * @type {SvelteData[]}\n */\n #svelteData;\n\n /**\n * Keep a direct reference to the SvelteData array in an associated {@link SvelteApplication}.\n *\n * @param {MountedAppShell[]|null[]} applicationShellHolder - A reference to the MountedAppShell array.\n *\n * @param {SvelteData[]} svelteData - A reference to the SvelteData array of mounted components.\n */\n constructor(applicationShellHolder, svelteData)\n {\n this.#applicationShellHolder = applicationShellHolder;\n this.#svelteData = svelteData;\n }\n\n /**\n * Returns any mounted {@link MountedAppShell}.\n *\n * @returns {MountedAppShell|null} Any mounted application shell.\n */\n get applicationShell() { return this.#applicationShellHolder[0]; }\n\n /**\n * Returns the indexed Svelte component.\n *\n * @param {number} index -\n *\n * @returns {object} The loaded Svelte component.\n */\n component(index)\n {\n const data = this.#svelteData[index];\n return isObject(data) ? data?.component : void 0;\n }\n\n /**\n * Returns the Svelte component entries iterator.\n *\n * @returns {Generator>} Svelte component entries iterator.\n * @yields\n */\n *componentEntries()\n {\n for (let cntr = 0; cntr < this.#svelteData.length; cntr++)\n {\n yield [cntr, this.#svelteData[cntr].component];\n }\n }\n\n /**\n * Returns the Svelte component values iterator.\n *\n * @returns {Generator} Svelte component values iterator.\n * @yields\n */\n *componentValues()\n {\n for (let cntr = 0; cntr < this.#svelteData.length; cntr++)\n {\n yield this.#svelteData[cntr].component;\n }\n }\n\n /**\n * Returns the indexed SvelteData entry.\n *\n * @param {number} index -\n *\n * @returns {SvelteData} The loaded Svelte config + component.\n */\n data(index)\n {\n return this.#svelteData[index];\n }\n\n /**\n * Returns the {@link SvelteData} instance for a given component.\n *\n * @param {object} component - Svelte component.\n *\n * @returns {SvelteData} - The loaded Svelte config + component.\n */\n dataByComponent(component)\n {\n for (const data of this.#svelteData)\n {\n if (data.component === component) { return data; }\n }\n\n return void 0;\n }\n\n /**\n * Returns the SvelteData entries iterator.\n *\n * @returns {IterableIterator<[number, SvelteData]>} SvelteData entries iterator.\n */\n dataEntries()\n {\n return this.#svelteData.entries();\n }\n\n /**\n * Returns the SvelteData values iterator.\n *\n * @returns {IterableIterator} SvelteData values iterator.\n */\n dataValues()\n {\n return this.#svelteData.values();\n }\n\n /**\n * Returns the length of the mounted Svelte component list.\n *\n * @returns {number} Length of mounted Svelte component list.\n */\n get length()\n {\n return this.#svelteData.length;\n }\n}\n","import {\n isApplicationShell,\n isObject,\n parseSvelteConfig } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Instantiates and attaches a Svelte component to the main inserted HTML.\n *\n * @param {object} opts - Optional parameters.\n *\n * @param {object} opts.app - The target application\n *\n * @param {HTMLElement} opts.template - Any HTML template.\n *\n * @param {object} opts.config - Svelte component options\n *\n * @param {Function} opts.elementRootUpdate - A callback to assign to the external context.\n *\n * @returns {SvelteData} The config + instantiated Svelte component.\n */\nexport function loadSvelteConfig({ app, template, config, elementRootUpdate } = {})\n{\n const svelteOptions = isObject(config.options) ? config.options : {};\n\n let target;\n\n // A specific HTMLElement to append Svelte component.\n if (config.target instanceof HTMLElement)\n {\n target = config.target;\n }\n // A string target defines a selector to find in existing HTML.\n else if (template instanceof HTMLElement && typeof config.target === 'string')\n {\n target = template.querySelector(config.target);\n }\n else // No target defined, create a document fragment.\n {\n target = document.createDocumentFragment();\n }\n\n if (target === void 0)\n {\n console.log(\n `%c[TRL] loadSvelteConfig error - could not find target selector, '${config.target}', for config:\\n`,\n 'background: rgb(57,34,34)', config);\n\n throw new Error();\n }\n\n const NewSvelteComponent = config.class;\n\n const svelteConfig = parseSvelteConfig({ ...config, target }, app);\n\n const externalContext = svelteConfig.context.get('#external');\n\n // Inject the Foundry application instance and `elementRootUpdate` to the external context.\n externalContext.application = app;\n externalContext.elementRootUpdate = elementRootUpdate;\n externalContext.sessionStorage = app.reactive.sessionStorage;\n\n let eventbus;\n\n // Potentially inject any TyphonJS eventbus and track the proxy in the SvelteData instance.\n if (isObject(app._eventbus) && typeof app._eventbus.createProxy === 'function')\n {\n eventbus = app._eventbus.createProxy();\n externalContext.eventbus = eventbus;\n }\n\n // Seal external context so that it can't be extended.\n Object.seal(externalContext);\n\n // TODO: Remove deprecation warning in the future -----------------------------------------------------------------\n\n svelteConfig.context.set('external', new Proxy({}, {\n get(targetUnused, prop)\n {\n console.warn(`[TRL] Deprecation warning: Please change getContext('external') to getContext('#external').`);\n return externalContext[prop];\n }\n }));\n\n // TODO: Remove deprecation warning in the future -----------------------------------------------------------------\n\n // Create the Svelte component.\n /**\n * @type {import('svelte').SvelteComponent}\n */\n const component = new NewSvelteComponent(svelteConfig);\n\n // Set any eventbus to the config.\n svelteConfig.eventbus = eventbus;\n\n /**\n * @type {HTMLElement}\n */\n let element;\n\n // We can directly get the root element from components which follow the application store contract.\n if (isApplicationShell(component))\n {\n element = component.elementRoot;\n }\n\n // Detect if target is a synthesized DocumentFragment with a child element. Child elements will be present\n // if the Svelte component mounts and renders initial content into the document fragment.\n if (target instanceof DocumentFragment && target.firstElementChild)\n {\n if (element === void 0) { element = target.firstElementChild; }\n template.append(target);\n }\n else if (config.target instanceof HTMLElement && element === void 0)\n {\n if (config.target instanceof HTMLElement && typeof svelteOptions.selectorElement !== 'string')\n {\n console.log(\n `%c[TRL] loadSvelteConfig error - HTMLElement target with no 'selectorElement' defined.\\n` +\n `\\nNote: If configuring an application shell and directly targeting a HTMLElement did you bind an` +\n `'elementRoot' and include ''?\\n` +\n `\\nOffending config:\\n`, 'background: rgb(57,34,34)', config);\n\n throw new Error();\n }\n\n // The target is an HTMLElement so find the Application element from `selectorElement` option.\n element = target.querySelector(svelteOptions.selectorElement);\n\n if (element === null || element === void 0)\n {\n console.log(\n `%c[TRL] loadSvelteConfig error - HTMLElement target with 'selectorElement', '${\n svelteOptions.selectorElement}', not found for config:\\n`,\n 'background: rgb(57,34,34)', config);\n\n throw new Error();\n }\n }\n\n // If the configuration / original target is an HTML element then do not inject HTML.\n const injectHTML = !(config.target instanceof HTMLElement);\n\n return { config: svelteConfig, component, element, injectHTML };\n}\n","import { derived, writable } from \"svelte/store\";\n\nimport {\n propertyStore,\n subscribeIgnoreFirst,\n TJSSessionStorage } from '@typhonjs-fvtt/runtime/svelte/store';\n\nimport {\n deepMerge,\n safeAccess,\n safeSet } from '@typhonjs-fvtt/runtime/svelte/util';\n\n/**\n * Contains the reactive functionality / Svelte stores associated with SvelteApplication and retrievable by\n * {@link SvelteApplication.reactive}.\n *\n * There are several reactive getters for UI state such and for two-way bindings / stores see\n * {@link SvelteReactive.storeUIState}:\n * - {@link SvelteReactive.dragging}\n * - {@link SvelteReactive.minimized}\n * - {@link SvelteReactive.resizing}\n *\n * There are also reactive getters / setters for {@link SvelteApplicationOptions} and Foundry\n * {@link ApplicationOptions}. You can use the following as one way bindings and update the associated stores. For\n * two-way bindings / stores see {@link SvelteReactive.storeAppOptions}.\n *\n * - {@link SvelteReactive.draggable}\n * - {@link SvelteReactive.focusAuto}\n * - {@link SvelteReactive.focusKeep}\n * - {@link SvelteReactive.focusTrap}\n * - {@link SvelteReactive.headerButtonNoClose}\n * - {@link SvelteReactive.headerButtonNoLabel}\n * - {@link SvelteReactive.headerIcon}\n * - {@link SvelteReactive.headerNoTitleMinimized}\n * - {@link SvelteReactive.minimizable}\n * - {@link SvelteReactive.popOut}\n * - {@link SvelteReactive.positionable}\n * - {@link SvelteReactive.resizable}\n * - {@link SvelteReactive.title}\n *\n * An instance of TJSSessionStorage is accessible via {@link SvelteReactive.sessionStorage}. Optionally you can pass\n * in an existing instance that can be shared across multiple SvelteApplications by setting\n * {@link SvelteApplicationOptions.sessionStorage}.\n *\n * -------------------------------------------------------------------------------------------------------------------\n *\n * This API is not sealed, and it is recommended that you extend it with accessors to get / set data that is reactive\n * in your application. An example of setting an exported prop `document` from the main mounted application shell.\n *\n * @example\n * import { hasSetter } from '@typhonjs-fvtt/runtime/svelte/util';\n *\n * // Note: make a normal comment.\n * // * @member {object} document - Adds accessors to SvelteReactive to get / set the document associated with\n * // * Document with the mounted application shell Svelte component.\n * // *\n * // * @memberof SvelteReactive#\n * // *\n * Object.defineProperty(this.reactive, 'document', {\n * get: () => this.svelte?.applicationShell?.document,\n * set: (document) =>\n * {\n * const component = this.svelte?.applicationShell;\n * if (hasSetter(component, 'document')) { component.document = document; }\n * }\n * });\n */\nexport class SvelteReactive\n{\n /**\n * @type {SvelteApplication}\n */\n #application;\n\n /**\n * @type {boolean}\n */\n #initialized = false;\n\n /** @type {TJSSessionStorage} */\n #sessionStorage;\n\n /**\n * The Application option store which is injected into mounted Svelte component context under the `external` key.\n *\n * @type {StoreAppOptions}\n */\n #storeAppOptions;\n\n /**\n * Stores the update function for `#storeAppOptions`.\n *\n * @type {import('svelte/store').Writable.update}\n */\n #storeAppOptionsUpdate;\n\n /**\n * Stores the UI state data to make it accessible via getters.\n *\n * @type {object}\n */\n #dataUIState;\n\n /**\n * The UI option store which is injected into mounted Svelte component context under the `external` key.\n *\n * @type {StoreUIOptions}\n */\n #storeUIState;\n\n /**\n * Stores the update function for `#storeUIState`.\n *\n * @type {import('svelte/store').Writable.update}\n */\n #storeUIStateUpdate;\n\n /**\n * Stores the unsubscribe functions from local store subscriptions.\n *\n * @type {import('svelte/store').Unsubscriber[]}\n */\n #storeUnsubscribe = [];\n\n /**\n * @param {SvelteApplication} application - The host Foundry application.\n */\n constructor(application)\n {\n this.#application = application;\n const optionsSessionStorage = application?.options?.sessionStorage;\n\n if (optionsSessionStorage !== void 0 && !(optionsSessionStorage instanceof TJSSessionStorage))\n {\n throw new TypeError(`'options.sessionStorage' is not an instance of TJSSessionStorage.`);\n }\n\n this.#sessionStorage = optionsSessionStorage !== void 0 ? optionsSessionStorage : new TJSSessionStorage();\n }\n\n /**\n * Initializes reactive support. Package private for internal use.\n *\n * @returns {SvelteStores|void} Internal methods to interact with Svelte stores.\n * @package\n */\n initialize()\n {\n if (this.#initialized) { return; }\n\n this.#initialized = true;\n\n this.#storesInitialize();\n\n return {\n appOptionsUpdate: this.#storeAppOptionsUpdate,\n uiOptionsUpdate: this.#storeUIStateUpdate,\n subscribe: this.#storesSubscribe.bind(this),\n unsubscribe: this.#storesUnsubscribe.bind(this)\n };\n }\n\n// Store getters -----------------------------------------------------------------------------------------------------\n\n /**\n * @returns {TJSSessionStorage} Returns TJSSessionStorage instance.\n */\n get sessionStorage()\n {\n return this.#sessionStorage;\n }\n\n /**\n * Returns the store for app options.\n *\n * @returns {StoreAppOptions} App options store.\n */\n get storeAppOptions() { return this.#storeAppOptions; }\n\n /**\n * Returns the store for UI options.\n *\n * @returns {StoreUIOptions} UI options store.\n */\n get storeUIState() { return this.#storeUIState; }\n\n// Only reactive getters ---------------------------------------------------------------------------------------------\n\n /**\n * Returns the current dragging UI state.\n *\n * @returns {boolean} Dragging UI state.\n */\n get dragging() { return this.#dataUIState.dragging; }\n\n /**\n * Returns the current minimized UI state.\n *\n * @returns {boolean} Minimized UI state.\n */\n get minimized() { return this.#dataUIState.minimized; }\n\n /**\n * Returns the current resizing UI state.\n *\n * @returns {boolean} Resizing UI state.\n */\n get resizing() { return this.#dataUIState.resizing; }\n\n// Reactive getter / setters -----------------------------------------------------------------------------------------\n\n /**\n * Returns the draggable app option.\n *\n * @returns {boolean} Draggable app option.\n */\n get draggable() { return this.#application?.options?.draggable; }\n\n /**\n * Returns the focusAuto app option.\n *\n * @returns {boolean} When true auto-management of app focus is enabled.\n */\n get focusAuto() { return this.#application?.options?.focusAuto; }\n\n /**\n * Returns the focusKeep app option.\n *\n * @returns {boolean} When `focusAuto` and `focusKeep` is true; keeps internal focus.\n */\n get focusKeep() { return this.#application?.options?.focusKeep; }\n\n /**\n * Returns the focusTrap app option.\n *\n * @returns {boolean} When true focus trapping / wrapping is enabled keeping focus inside app.\n */\n get focusTrap() { return this.#application?.options?.focusTrap; }\n\n /**\n * Returns the headerButtonNoClose app option.\n *\n * @returns {boolean} Remove the close the button in header app option.\n */\n get headerButtonNoClose() { return this.#application?.options?.headerButtonNoClose; }\n\n /**\n * Returns the headerButtonNoLabel app option.\n *\n * @returns {boolean} Remove the labels from buttons in header app option.\n */\n get headerButtonNoLabel() { return this.#application?.options?.headerButtonNoLabel; }\n\n /**\n * Returns the headerIcon app option.\n *\n * @returns {string|void} URL for header app icon.\n */\n get headerIcon() { return this.#application?.options?.headerIcon; }\n\n /**\n * Returns the headerNoTitleMinimized app option.\n *\n * @returns {boolean} When true removes the header title when minimized.\n */\n get headerNoTitleMinimized() { return this.#application?.options?.headerNoTitleMinimized; }\n\n /**\n * Returns the minimizable app option.\n *\n * @returns {boolean} Minimizable app option.\n */\n get minimizable() { return this.#application?.options?.minimizable; }\n\n /**\n * Returns the Foundry popOut state; {@link Application.popOut}\n *\n * @returns {boolean} Positionable app option.\n */\n get popOut() { return this.#application.popOut; }\n\n /**\n * Returns the positionable app option; {@link SvelteApplicationOptions.positionable}\n *\n * @returns {boolean} Positionable app option.\n */\n get positionable() { return this.#application?.options?.positionable; }\n\n /**\n * Returns the resizable option.\n *\n * @returns {boolean} Resizable app option.\n */\n get resizable() { return this.#application?.options?.resizable; }\n\n /**\n * Returns the title accessor from the parent Application class; {@link Application.title}\n * TODO: Application v2; note that super.title localizes `this.options.title`; IMHO it shouldn't.\n *\n * @returns {string} Title.\n */\n get title() { return this.#application.title; }\n\n /**\n * Sets `this.options.draggable` which is reactive for application shells.\n *\n * @param {boolean} draggable - Sets the draggable option.\n */\n set draggable(draggable)\n {\n if (typeof draggable === 'boolean') { this.setOptions('draggable', draggable); }\n }\n\n /**\n * Sets `this.options.focusAuto` which is reactive for application shells.\n *\n * @param {boolean} focusAuto - Sets the focusAuto option.\n */\n set focusAuto(focusAuto)\n {\n if (typeof focusAuto === 'boolean') { this.setOptions('focusAuto', focusAuto); }\n }\n\n /**\n * Sets `this.options.focusKeep` which is reactive for application shells.\n *\n * @param {boolean} focusKeep - Sets the focusKeep option.\n */\n set focusKeep(focusKeep)\n {\n if (typeof focusKeep === 'boolean') { this.setOptions('focusKeep', focusKeep); }\n }\n\n /**\n * Sets `this.options.focusTrap` which is reactive for application shells.\n *\n * @param {boolean} focusTrap - Sets the focusTrap option.\n */\n set focusTrap(focusTrap)\n {\n if (typeof focusTrap === 'boolean') { this.setOptions('focusTrap', focusTrap); }\n }\n\n /**\n * Sets `this.options.headerButtonNoClose` which is reactive for application shells.\n *\n * @param {boolean} headerButtonNoClose - Sets the headerButtonNoClose option.\n */\n set headerButtonNoClose(headerButtonNoClose)\n {\n if (typeof headerButtonNoClose === 'boolean') { this.setOptions('headerButtonNoClose', headerButtonNoClose); }\n }\n\n /**\n * Sets `this.options.headerButtonNoLabel` which is reactive for application shells.\n *\n * @param {boolean} headerButtonNoLabel - Sets the headerButtonNoLabel option.\n */\n set headerButtonNoLabel(headerButtonNoLabel)\n {\n if (typeof headerButtonNoLabel === 'boolean') { this.setOptions('headerButtonNoLabel', headerButtonNoLabel); }\n }\n\n /**\n * Sets `this.options.headerIcon` which is reactive for application shells.\n *\n * @param {string|void} headerIcon - Sets the headerButtonNoLabel option.\n */\n set headerIcon(headerIcon)\n {\n if (headerIcon === void 0 || typeof headerIcon === 'string') { this.setOptions('headerIcon', headerIcon); }\n }\n\n /**\n * Sets `this.options.headerNoTitleMinimized` which is reactive for application shells.\n *\n * @param {boolean} headerNoTitleMinimized - Sets the headerNoTitleMinimized option.\n */\n set headerNoTitleMinimized(headerNoTitleMinimized)\n {\n if (typeof headerNoTitleMinimized === 'boolean')\n {\n this.setOptions('headerNoTitleMinimized', headerNoTitleMinimized);\n }\n }\n\n /**\n * Sets `this.options.minimizable` which is reactive for application shells that are also pop out.\n *\n * @param {boolean} minimizable - Sets the minimizable option.\n */\n set minimizable(minimizable)\n {\n if (typeof minimizable === 'boolean') { this.setOptions('minimizable', minimizable); }\n }\n\n /**\n * Sets `this.options.popOut` which is reactive for application shells. This will add / remove this application\n * from `ui.windows`.\n *\n * @param {boolean} popOut - Sets the popOut option.\n */\n set popOut(popOut)\n {\n if (typeof popOut === 'boolean') { this.setOptions('popOut', popOut); }\n }\n\n /**\n * Sets `this.options.positionable` enabling / disabling {@link SvelteApplication.position.set}.\n *\n * @param {boolean} positionable - Sets the positionable option.\n */\n set positionable(positionable)\n {\n if (typeof positionable === 'boolean') { this.setOptions('positionable', positionable); }\n }\n\n /**\n * Sets `this.options.resizable` which is reactive for application shells.\n *\n * @param {boolean} resizable - Sets the resizable option.\n */\n set resizable(resizable)\n {\n if (typeof resizable === 'boolean') { this.setOptions('resizable', resizable); }\n }\n\n /**\n * Sets `this.options.title` which is reactive for application shells.\n *\n * Note: Will set empty string if title is undefined or null.\n *\n * @param {string|undefined|null} title - Application title; will be localized, so a translation key is fine.\n */\n set title(title)\n {\n if (typeof title === 'string')\n {\n this.setOptions('title', title);\n }\n else if (title === void 0 || title === null)\n {\n this.setOptions('title', '');\n }\n }\n\n // Reactive Options API -------------------------------------------------------------------------------------------\n\n /**\n * Provides a way to safely get this applications options given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * // TODO DOCUMENT the accessor in more detail.\n *\n * @param {string} accessor - The path / key to set. You can set multiple levels.\n *\n * @param {*} [defaultValue] - A default value returned if the accessor is not found.\n *\n * @returns {*} Value at the accessor.\n */\n getOptions(accessor, defaultValue)\n {\n return safeAccess(this.#application.options, accessor, defaultValue);\n }\n\n /**\n * Provides a way to merge `options` into this applications options and update the appOptions store.\n *\n * @param {object} options - The options object to merge with `this.options`.\n */\n mergeOptions(options)\n {\n this.#storeAppOptionsUpdate((instanceOptions) => deepMerge(instanceOptions, options));\n }\n\n /**\n * Provides a way to safely set this applications options given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * Additionally if an application shell Svelte component is mounted and exports the `appOptions` property then\n * the application options is set to `appOptions` potentially updating the application shell / Svelte component.\n *\n * // TODO DOCUMENT the accessor in more detail.\n *\n * @param {string} accessor - The path / key to set. You can set multiple levels.\n *\n * @param {*} value - Value to set.\n */\n setOptions(accessor, value)\n {\n const success = safeSet(this.#application.options, accessor, value);\n\n // If `this.options` modified then update the app options store.\n if (success)\n {\n this.#storeAppOptionsUpdate(() => this.#application.options);\n }\n }\n\n /**\n * Initializes the Svelte stores and derived stores for the application options and UI state.\n *\n * While writable stores are created the update method is stored in private variables locally and derived Readable\n * stores are provided for essential options which are commonly used.\n *\n * These stores are injected into all Svelte components mounted under the `external` context: `storeAppOptions` and\n * ` storeUIState`.\n */\n #storesInitialize()\n {\n const writableAppOptions = writable(this.#application.options);\n\n // Keep the update function locally, but make the store essentially readable.\n this.#storeAppOptionsUpdate = writableAppOptions.update;\n\n /**\n * Create custom store. The main subscribe method for all app options changes is provided along with derived\n * writable stores for all reactive options.\n *\n * @type {StoreAppOptions}\n */\n const storeAppOptions = {\n subscribe: writableAppOptions.subscribe,\n\n draggable: propertyStore(writableAppOptions, 'draggable'),\n focusAuto: propertyStore(writableAppOptions, 'focusAuto'),\n focusKeep: propertyStore(writableAppOptions, 'focusKeep'),\n focusTrap: propertyStore(writableAppOptions, 'focusTrap'),\n headerButtonNoClose: propertyStore(writableAppOptions, 'headerButtonNoClose'),\n headerButtonNoLabel: propertyStore(writableAppOptions, 'headerButtonNoLabel'),\n headerIcon: propertyStore(writableAppOptions, 'headerIcon'),\n headerNoTitleMinimized: propertyStore(writableAppOptions, 'headerNoTitleMinimized'),\n minimizable: propertyStore(writableAppOptions, 'minimizable'),\n popOut: propertyStore(writableAppOptions, 'popOut'),\n positionable: propertyStore(writableAppOptions, 'positionable'),\n resizable: propertyStore(writableAppOptions, 'resizable'),\n title: propertyStore(writableAppOptions, 'title')\n };\n\n Object.freeze(storeAppOptions);\n\n this.#storeAppOptions = storeAppOptions;\n\n this.#dataUIState = {\n dragging: false,\n headerButtons: [],\n minimized: this.#application._minimized,\n resizing: false\n };\n\n // Create a store for UI state data.\n const writableUIOptions = writable(this.#dataUIState);\n\n // Keep the update function locally, but make the store essentially readable.\n this.#storeUIStateUpdate = writableUIOptions.update;\n\n /**\n * @type {StoreUIOptions}\n */\n const storeUIState = {\n subscribe: writableUIOptions.subscribe,\n\n dragging: propertyStore(writableUIOptions, 'dragging'),\n headerButtons: derived(writableUIOptions, ($options, set) => set($options.headerButtons)),\n minimized: derived(writableUIOptions, ($options, set) => set($options.minimized)),\n resizing: propertyStore(writableUIOptions, 'resizing')\n };\n\n Object.freeze(storeUIState);\n\n // Initialize the store with options set in the Application constructor.\n this.#storeUIState = storeUIState;\n }\n\n /**\n * Registers local store subscriptions for app options. `popOut` controls registering this app with `ui.windows`.\n *\n * @see SvelteApplication._injectHTML\n */\n #storesSubscribe()\n {\n // Register local subscriptions.\n\n // Handles updating header buttons to add / remove the close button.\n this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.headerButtonNoClose, (value) =>\n {\n this.updateHeaderButtons({ headerButtonNoClose: value });\n }));\n\n // Handles updating header buttons to add / remove button labels.\n this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.headerButtonNoLabel, (value) =>\n {\n this.updateHeaderButtons({ headerButtonNoLabel: value });\n }));\n\n // Handles adding / removing this application from `ui.windows` when popOut changes.\n this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.popOut, (value) =>\n {\n if (value && this.#application.rendered)\n {\n globalThis.ui.windows[this.#application.appId] = this.#application;\n }\n else\n {\n delete globalThis.ui.windows[this.#application.appId];\n }\n }));\n }\n\n /**\n * Unsubscribes from any locally monitored stores.\n *\n * @see SvelteApplication.close\n */\n #storesUnsubscribe()\n {\n this.#storeUnsubscribe.forEach((unsubscribe) => unsubscribe());\n this.#storeUnsubscribe = [];\n }\n\n /**\n * Updates the UI Options store with the current header buttons. You may dynamically add / remove header buttons\n * if using an application shell Svelte component. In either overriding `_getHeaderButtons` or responding to the\n * Hooks fired return a new button array and the uiOptions store is updated and the application shell will render\n * the new buttons.\n *\n * Optionally you can set in the SvelteApplication app options {@link SvelteApplicationOptions.headerButtonNoClose}\n * to remove the close button and {@link SvelteApplicationOptions.headerButtonNoLabel} to true and labels will be\n * removed from the header buttons.\n *\n * @param {object} opts - Optional parameters (for internal use)\n *\n * @param {boolean} opts.headerButtonNoClose - The value for `headerButtonNoClose`.\n *\n * @param {boolean} opts.headerButtonNoLabel - The value for `headerButtonNoLabel`.\n */\n updateHeaderButtons({ headerButtonNoClose = this.#application.options.headerButtonNoClose,\n headerButtonNoLabel = this.#application.options.headerButtonNoLabel } = {})\n {\n let buttons = this.#application._getHeaderButtons();\n\n // Remove close button if this.options.headerButtonNoClose is true;\n if (typeof headerButtonNoClose === 'boolean' && headerButtonNoClose)\n {\n buttons = buttons.filter((button) => button.class !== 'close');\n }\n\n // Remove labels if this.options.headerButtonNoLabel is true;\n if (typeof headerButtonNoLabel === 'boolean' && headerButtonNoLabel)\n {\n for (const button of buttons) { button.label = void 0; }\n }\n\n this.#storeUIStateUpdate((options) =>\n {\n options.headerButtons = buttons;\n return options;\n });\n }\n}\n","// import { Position } from '@typhonjs-fvtt/runtime/svelte/store';\nimport { Position } from './position/Position.js';\n\nimport {\n A11yHelper,\n deepMerge,\n hasGetter,\n isApplicationShell,\n isHMRProxy,\n isObject,\n outroAndDestroy } from '@typhonjs-fvtt/runtime/svelte/util';\n\nimport {\n ApplicationState,\n GetSvelteData,\n loadSvelteConfig,\n SvelteReactive } from './internal/index.js';\n\n/**\n * Provides a Svelte aware extension to Application to control the app lifecycle appropriately. You can declaratively\n * load one or more components from `defaultOptions`.\n */\nexport class SvelteApplication extends Application\n{\n /**\n * Stores the first mounted component which follows the application shell contract.\n *\n * @type {MountedAppShell[]|null[]} Application shell.\n */\n #applicationShellHolder = [null];\n\n /**\n * Stores and manages application state for saving / restoring / serializing.\n *\n * @type {ApplicationState}\n */\n #applicationState;\n\n /**\n * Stores the target element which may not necessarily be the main element.\n *\n * @type {HTMLElement}\n */\n #elementTarget = null;\n\n /**\n * Stores the content element which is set for application shells.\n *\n * @type {HTMLElement}\n */\n #elementContent = null;\n\n /**\n * Stores initial z-index from `_renderOuter` to set to target element / Svelte component.\n *\n * @type {number}\n */\n #initialZIndex = 95;\n\n /**\n * Stores on mount state which is checked in _render to trigger onSvelteMount callback.\n *\n * @type {boolean}\n */\n #onMount = false;\n\n /**\n * The position store.\n *\n * @type {Position}\n */\n #position;\n\n /**\n * Contains the Svelte stores and reactive accessors.\n *\n * @type {SvelteReactive}\n */\n #reactive;\n\n /**\n * Stores SvelteData entries with instantiated Svelte components.\n *\n * @type {SvelteData[]}\n */\n #svelteData = [];\n\n /**\n * Provides a helper class that combines multiple methods for interacting with the mounted components tracked in\n * {@link SvelteData}.\n *\n * @type {GetSvelteData}\n */\n #getSvelteData = new GetSvelteData(this.#applicationShellHolder, this.#svelteData);\n\n /**\n * Contains methods to interact with the Svelte stores.\n *\n * @type {SvelteStores}\n */\n #stores;\n\n /**\n * @param {SvelteApplicationOptions} options - The options for the application.\n *\n * @inheritDoc\n */\n constructor(options = {})\n {\n super(options);\n\n this.#applicationState = new ApplicationState(this);\n\n // Initialize Position with the position object set by Application.\n this.#position = new Position(this, {\n ...this.position,\n ...this.options,\n initial: this.options.positionInitial,\n ortho: this.options.positionOrtho,\n validator: this.options.positionValidator\n });\n\n // Remove old position field.\n delete this.position;\n\n /**\n * Define accessors to retrieve Position by `this.position`.\n *\n * @member {Position} position - Adds accessors to SvelteApplication to get / set the position data.\n *\n * @memberof SvelteApplication#\n */\n Object.defineProperty(this, 'position', {\n get: () => this.#position,\n set: (position) => { if (isObject(position)) { this.#position.set(position); } }\n });\n\n this.#reactive = new SvelteReactive(this);\n\n this.#stores = this.#reactive.initialize();\n }\n\n /**\n * Specifies the default options that SvelteApplication supports.\n *\n * @returns {SvelteApplicationOptions} options - Application options.\n * @see https://foundryvtt.com/api/interfaces/client.ApplicationOptions.html\n */\n static get defaultOptions()\n {\n return deepMerge(super.defaultOptions, {\n defaultCloseAnimation: true, // If false the default slide close animation is not run.\n draggable: true, // If true then application shells are draggable.\n focusAuto: true, // When true auto-management of app focus is enabled.\n focusKeep: false, // When `focusAuto` and `focusKeep` is true; keeps internal focus.\n focusSource: void 0, // Stores any A11yFocusSource data that is applied when app is closed.\n focusTrap: true, // When true focus trapping / wrapping is enabled keeping focus inside app.\n headerButtonNoClose: false, // If true then the close header button is removed.\n headerButtonNoLabel: false, // If true then header button labels are removed for application shells.\n headerIcon: void 0, // Sets a header icon given an image URL.\n headerNoTitleMinimized: false, // If true then header title is hidden when application is minimized.\n minHeight: MIN_WINDOW_HEIGHT, // Assigned to position. Number specifying minimum window height.\n minWidth: MIN_WINDOW_WIDTH, // Assigned to position. Number specifying minimum window width.\n positionable: true, // If false then `position.set` does not take effect.\n positionInitial: Position.Initial.browserCentered, // A helper for initial position placement.\n positionOrtho: true, // When true Position is optimized for orthographic use.\n positionValidator: Position.Validators.transformWindow, // A function providing the default validator.\n sessionStorage: void 0, // An instance of SessionStorage to share across SvelteApplications.\n svelte: void 0, // A Svelte configuration object.\n transformOrigin: 'top left' // By default, 'top / left' respects rotation when minimizing.\n });\n }\n\n /**\n * Returns the content element if an application shell is mounted.\n *\n * @returns {HTMLElement} Content element.\n */\n get elementContent() { return this.#elementContent; }\n\n /**\n * Returns the target element or main element if no target defined.\n *\n * @returns {HTMLElement} Target element.\n */\n get elementTarget() { return this.#elementTarget; }\n\n /**\n * Returns the reactive accessors & Svelte stores for SvelteApplication.\n *\n * @returns {SvelteReactive} The reactive accessors & Svelte stores.\n */\n get reactive() { return this.#reactive; }\n\n /**\n * Returns the application state manager.\n *\n * @returns {ApplicationState} The application state manager.\n */\n get state() { return this.#applicationState; }\n\n /**\n * Returns the Svelte helper class w/ various methods to access mounted Svelte components.\n *\n * @returns {GetSvelteData} GetSvelteData\n */\n get svelte() { return this.#getSvelteData; }\n\n /**\n * In this case of when a template is defined in app options `html` references the inner HTML / template. However,\n * to activate classic v1 tabs for a Svelte component the element target is passed as an array simulating JQuery as\n * the element is retrieved immediately and the core listeners use standard DOM queries.\n *\n * @inheritDoc\n * @protected\n * @ignore\n */\n _activateCoreListeners(html)\n {\n super._activateCoreListeners(typeof this.options.template === 'string' ? html : [this.#elementTarget]);\n }\n\n /**\n * Provide an override to set this application as the active window regardless of z-index. Changes behaviour from\n * Foundry core. This is important / used for instance in dialog key handling for left / right button selection.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.force=false] - Force bring to top; will increment z-index by popOut order.\n *\n */\n bringToTop({ force = false } = {})\n {\n if (force || this.popOut) { super.bringToTop(); }\n\n // If the activeElement is not `document.body` and not contained in this app via elementTarget then blur the\n // current active element and make `document.body`focused. This allows key to close all open apps / windows.\n if (document.activeElement !== document.body && !this.elementTarget.contains(document.activeElement))\n {\n // Blur current active element.\n if (document.activeElement instanceof HTMLElement) { document.activeElement.blur(); }\n\n // Make document body focused.\n document.body.focus();\n }\n\n globalThis.ui.activeWindow = this;\n }\n\n /**\n * Note: This method is fully overridden and duplicated as Svelte components need to be destroyed manually and the\n * best visual result is to destroy them after the default slide up animation occurs, but before the element\n * is removed from the DOM.\n *\n * If you destroy the Svelte components before the slide up animation the Svelte elements are removed immediately\n * from the DOM. The purpose of overriding ensures the slide up animation is always completed before\n * the Svelte components are destroyed and then the element is removed from the DOM.\n *\n * Close the application and un-register references to it within UI mappings.\n * This function returns a Promise which resolves once the window closing animation concludes\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {boolean} [options.force] - Force close regardless of render state.\n *\n * @returns {Promise} A Promise which resolves once the application is closed.\n * @ignore\n */\n async close(options = {})\n {\n const states = Application.RENDER_STATES;\n if (!options.force && ![states.RENDERED, states.ERROR].includes(this._state)) { return; }\n\n // Unsubscribe from any local stores.\n this.#stores.unsubscribe();\n\n /**\n * @ignore\n */\n this._state = states.CLOSING;\n\n /**\n * Get the element.\n *\n * @type {HTMLElement}\n */\n const el = this.#elementTarget;\n if (!el) { return this._state = states.CLOSED; }\n\n // Make any window content overflow hidden to avoid any scrollbars appearing in default or Svelte outro\n // transitions.\n const content = el.querySelector('.window-content');\n if (content)\n {\n content.style.overflow = 'hidden';\n\n // Set all children of content to overflow hidden as if there is going to be additional scrolling elements\n // they are likely one level deep.\n for (let cntr = content.children.length; --cntr >= 0;)\n {\n content.children[cntr].style.overflow = 'hidden';\n }\n }\n\n // Dispatch Hooks for closing the base and subclass applications\n for (const cls of this.constructor._getInheritanceChain())\n {\n /**\n * A hook event that fires whenever this Application is closed.\n *\n * @param {Application} app The Application instance being closed\n *\n * @param {jQuery[]} html The application HTML when it is closed\n *\n * @function closeApplication\n *\n * @memberof hookEvents\n */\n Hooks.call(`close${cls.name}`, this, el);\n }\n\n // If options `defaultCloseAnimation` is false then do not execute the standard slide up animation.\n // This allows Svelte components to provide any out transition. Application shells will automatically set\n // `defaultCloseAnimation` based on any out transition set or unset.\n const animate = typeof this.options.defaultCloseAnimation === 'boolean' ? this.options.defaultCloseAnimation :\n true;\n\n if (animate)\n {\n // Set min height for full slide.\n el.style.minHeight = '0';\n\n const { paddingBottom, paddingTop } = globalThis.getComputedStyle(el);\n\n // Slide-up application.\n await el.animate([\n { maxHeight: `${el.clientHeight}px`, paddingTop, paddingBottom },\n { maxHeight: 0, paddingTop: 0, paddingBottom: 0 }\n ], { duration: 250, easing: 'ease-in', fill: 'forwards' }).finished;\n }\n\n // Stores the Promises returned from running outro transitions and destroying each Svelte component.\n const svelteDestroyPromises = [];\n\n // Manually invoke the destroy callbacks for all Svelte components.\n for (const entry of this.#svelteData)\n {\n // Use `outroAndDestroy` to run outro transitions before destroying.\n svelteDestroyPromises.push(outroAndDestroy(entry.component));\n\n // If any proxy eventbus has been added then remove all event registrations from the component.\n const eventbus = entry.config.eventbus;\n if (isObject(eventbus) && typeof eventbus.off === 'function')\n {\n eventbus.off();\n entry.config.eventbus = void 0;\n }\n }\n\n // Await all Svelte components to destroy.\n await Promise.all(svelteDestroyPromises);\n\n // Reset SvelteData like this to maintain reference to GetSvelteData / `this.svelte`.\n this.#svelteData.length = 0;\n\n // Remove element from the DOM. Most SvelteComponents have already removed it.\n el.remove();\n\n // Silently restore any width / height state before minimized as applicable.\n this.position.state.restore({\n name: '#beforeMinimized',\n properties: ['width', 'height'],\n silent: true,\n remove: true\n });\n\n // Clean up data\n this.#applicationShellHolder[0] = null;\n /**\n * @ignore\n */\n this._element = null;\n this.#elementContent = null;\n this.#elementTarget = null;\n delete globalThis.ui.windows[this.appId];\n /**\n * @ignore\n */\n this._minimized = false;\n /**\n * @ignore\n */\n this._scrollPositions = null;\n this._state = states.CLOSED;\n\n this.#onMount = false;\n\n // Update the minimized UI store options.\n this.#stores.uiOptionsUpdate((storeOptions) => deepMerge(storeOptions, { minimized: this._minimized }));\n\n // Apply any stored focus options and then remove them from options.\n A11yHelper.applyFocusSource(this.options.focusSource);\n\n delete this.options.focusSource;\n }\n\n /**\n * Inject the Svelte components defined in `this.options.svelte`. The Svelte component can attach to the existing\n * pop-out of Application or provide no template and render into a document fragment which is then attached to the\n * DOM.\n *\n * @param {JQuery} html -\n *\n * @inheritDoc\n * @ignore\n */\n _injectHTML(html)\n {\n if (this.popOut && html.length === 0 && Array.isArray(this.options.svelte))\n {\n throw new Error(\n 'SvelteApplication - _injectHTML - A popout app with no template can only support one Svelte component.');\n }\n\n // Make sure the store is updated with the latest header buttons. Also allows filtering buttons before display.\n this.reactive.updateHeaderButtons();\n\n // Create a function to generate a callback for Svelte components to invoke to update the tracked elements for\n // application shells in the rare cases that the main element root changes. The update is only trigged on\n // successive changes of `elementRoot`. Returns a boolean to indicate the element roots are updated.\n const elementRootUpdate = () =>\n {\n let cntr = 0;\n\n return (elementRoot) =>\n {\n if (elementRoot !== null && elementRoot !== void 0 && cntr++ > 0)\n {\n this.#updateApplicationShell();\n return true;\n }\n\n return false;\n };\n };\n\n if (Array.isArray(this.options.svelte))\n {\n for (const svelteConfig of this.options.svelte)\n {\n const svelteData = loadSvelteConfig({\n app: this,\n template: html[0],\n config: svelteConfig,\n elementRootUpdate\n });\n\n if (isApplicationShell(svelteData.component))\n {\n if (this.svelte.applicationShell !== null)\n {\n throw new Error(\n `SvelteApplication - _injectHTML - An application shell is already mounted; offending config:\n ${JSON.stringify(svelteConfig)}`);\n }\n\n this.#applicationShellHolder[0] = svelteData.component;\n\n // If Vite / HMR / svelte_hmr is enabled then add a hook to receive callbacks when the ProxyComponent\n // refreshes. Update the element root accordingly and force an update to Position.\n // See this issue for info about `on_hmr`:\n // https://github.com/sveltejs/svelte-hmr/issues/57\n if (isHMRProxy(svelteData.component) && Array.isArray(svelteData.component?.$$?.on_hmr))\n {\n svelteData.component.$$.on_hmr.push(() => () => this.#updateApplicationShell());\n }\n }\n\n this.#svelteData.push(svelteData);\n }\n }\n else if (isObject(this.options.svelte))\n {\n const svelteData = loadSvelteConfig({\n app: this,\n template: html[0],\n config: this.options.svelte,\n elementRootUpdate\n });\n\n if (isApplicationShell(svelteData.component))\n {\n // A sanity check as shouldn't hit this case as only one component is being mounted.\n if (this.svelte.applicationShell !== null)\n {\n throw new Error(\n `SvelteApplication - _injectHTML - An application shell is already mounted; offending config:\n ${JSON.stringify(this.options.svelte)}`);\n }\n\n this.#applicationShellHolder[0] = svelteData.component;\n\n // If Vite / HMR / svelte_hmr is enabled then add a hook to receive callbacks when the ProxyComponent\n // refreshes. Update the element root accordingly and force an update to Position.\n // See this issue for info about `on_hmr`:\n // https://github.com/sveltejs/svelte-hmr/issues/57\n if (isHMRProxy(svelteData.component) && Array.isArray(svelteData.component?.$$?.on_hmr))\n {\n svelteData.component.$$.on_hmr.push(() => () => this.#updateApplicationShell());\n }\n }\n\n this.#svelteData.push(svelteData);\n }\n\n // Detect if this is a synthesized DocumentFragment.\n const isDocumentFragment = html.length && html[0] instanceof DocumentFragment;\n\n // If any of the Svelte components mounted directly targets an HTMLElement then do not inject HTML.\n let injectHTML = true;\n for (const svelteData of this.#svelteData)\n {\n if (!svelteData.injectHTML) { injectHTML = false; break; }\n }\n if (injectHTML) { super._injectHTML(html); }\n\n if (this.svelte.applicationShell !== null)\n {\n this._element = $(this.svelte.applicationShell.elementRoot);\n\n // Detect if the application shell exports an `elementContent` accessor.\n this.#elementContent = hasGetter(this.svelte.applicationShell, 'elementContent') ?\n this.svelte.applicationShell.elementContent : null;\n\n // Detect if the application shell exports an `elementTarget` accessor.\n this.#elementTarget = hasGetter(this.svelte.applicationShell, 'elementTarget') ?\n this.svelte.applicationShell.elementTarget : null;\n }\n else if (isDocumentFragment) // Set the element of the app to the first child element in order of Svelte components mounted.\n {\n for (const svelteData of this.#svelteData)\n {\n if (svelteData.element instanceof HTMLElement)\n {\n this._element = $(svelteData.element);\n break;\n }\n }\n }\n\n // Potentially retrieve a specific target element if `selectorTarget` is defined otherwise make the target the\n // main element.\n if (this.#elementTarget === null)\n {\n this.#elementTarget = typeof this.options.selectorTarget === 'string' ?\n this._element[0].querySelector(this.options.selectorTarget) : this._element[0];\n }\n\n if (this.#elementTarget === null || this.#elementTarget === void 0)\n {\n throw new Error(`SvelteApplication - _injectHTML: Target element '${this.options.selectorTarget}' not found.`);\n }\n\n // The initial zIndex may be set in application options or for popOut applications is stored by `_renderOuter`\n // in `this.#initialZIndex`.\n if (typeof this.options.positionable === 'boolean' && this.options.positionable)\n {\n this.#elementTarget.style.zIndex = typeof this.options.zIndex === 'number' ? this.options.zIndex :\n this.#initialZIndex ?? 95;\n }\n\n // Subscribe to local store handling.\n this.#stores.subscribe();\n }\n\n /**\n * Provides a mechanism to update the UI options store for maximized.\n *\n * Note: the sanity check is duplicated from {@link Application.maximize} the store is updated _before_\n * performing the rest of animations. This allows application shells to remove / show any resize handlers\n * correctly. Extra constraint data is stored in a saved position state in {@link SvelteApplication.minimize}\n * to animate the content area.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.animate=true] - When true perform default maximizing animation.\n *\n * @param {number} [opts.duration=0.1] - Controls content area animation duration in seconds.\n */\n async maximize({ animate = true, duration = 0.1 } = {})\n {\n if (!this.popOut || [false, null].includes(this._minimized)) { return; }\n\n this._minimized = null;\n\n const durationMS = duration * 1000; // For WAAPI.\n\n // Get content\n const element = this.elementTarget;\n const header = element.querySelector('.window-header');\n const content = element.querySelector('.window-content');\n\n // Get the complete position before minimized. Used to reset min width & height to initial values later.\n const positionBefore = this.position.state.get({ name: '#beforeMinimized' });\n\n // First animate / restore width / async.\n if (animate)\n {\n await this.position.state.restore({\n name: '#beforeMinimized',\n async: true,\n animateTo: true,\n properties: ['width'],\n duration: 0.1\n });\n }\n\n element.classList.remove('minimized');\n\n // Reset display none on all children of header.\n for (let cntr = header.children.length; --cntr >= 0;) { header.children[cntr].style.display = null; }\n\n content.style.display = null;\n\n let constraints;\n\n if (animate)\n {\n // Next animate / restore height synchronously and remove key. Retrieve constraints data for slide up animation\n // below.\n ({ constraints } = this.position.state.restore({\n name: '#beforeMinimized',\n animateTo: true,\n properties: ['height'],\n remove: true,\n duration\n }));\n }\n else\n {\n ({ constraints } = this.position.state.remove({ name: '#beforeMinimized' }));\n }\n\n // Slide down content with stored constraints.\n await content.animate([\n { maxHeight: 0, paddingTop: 0, paddingBottom: 0, offset: 0 },\n { ...constraints, offset: 1 },\n { maxHeight: '100%', offset: 1 },\n ], { duration: durationMS, fill: 'forwards' }).finished; // WAAPI in ms.\n\n // Restore previous min width & height from saved data, app options, or default Foundry values.\n this.position.set({\n minHeight: positionBefore.minHeight ?? this.options?.minHeight ?? MIN_WINDOW_HEIGHT,\n minWidth: positionBefore.minWidth ?? this.options?.minWidth ?? MIN_WINDOW_WIDTH,\n });\n\n // Remove inline styles that override any styles assigned to the app.\n element.style.minWidth = null;\n element.style.minHeight = null;\n\n this._minimized = false;\n\n // Using a 50ms timeout prevents any instantaneous display of scrollbars with the above maximize animation.\n setTimeout(() =>\n {\n content.style.overflow = null;\n\n // Reset all children of content removing overflow hidden.\n for (let cntr = content.children.length; --cntr >= 0;)\n {\n content.children[cntr].style.overflow = null;\n }\n }, 50);\n\n this.#stores.uiOptionsUpdate((options) => deepMerge(options, { minimized: false }));\n }\n\n /**\n * Provides a mechanism to update the UI options store for minimized.\n *\n * Note: the sanity check is duplicated from {@link Application.minimize} the store is updated _before_\n * performing the rest of animations. This allows application shells to remove / show any resize handlers\n * correctly. Extra constraint data is stored in a saved position state in {@link SvelteApplication.minimize}\n * to animate the content area.\n *\n * @param {object} [opts] - Optional parameters\n *\n * @param {boolean} [opts.animate=true] - When true perform default minimizing animation.\n *\n * @param {number} [opts.duration=0.1] - Controls content area animation duration in seconds.\n */\n async minimize({ animate = true, duration = 0.1 } = {})\n {\n if (!this.rendered || !this.popOut || [true, null].includes(this._minimized)) { return; }\n\n this.#stores.uiOptionsUpdate((options) => deepMerge(options, { minimized: true }));\n\n this._minimized = null;\n\n const durationMS = duration * 1000; // For WAAPI.\n\n const element = this.elementTarget;\n\n // Get content\n const header = element.querySelector('.window-header');\n const content = element.querySelector('.window-content');\n\n // Save current max / min height & width.\n const beforeMinWidth = this.position.minWidth;\n const beforeMinHeight = this.position.minHeight;\n\n // Set minimized min width & height for header bar.\n this.position.set({ minWidth: 100, minHeight: 30 });\n\n // Also set inline styles to override any styles scoped to the app.\n element.style.minWidth = '100px';\n element.style.minHeight = '30px';\n\n if (content)\n {\n content.style.overflow = 'hidden';\n\n // Set all children of content to overflow hidden as if there is going to be additional scrolling elements\n // they are likely one level deep.\n for (let cntr = content.children.length; --cntr >= 0;)\n {\n content.children[cntr].style.overflow = 'hidden';\n }\n }\n\n const { paddingBottom, paddingTop } = globalThis.getComputedStyle(content);\n\n // Extra data that is saved with the current position. Used during `maximize`.\n const constraints = {\n maxHeight: `${content.clientHeight}px`,\n paddingTop,\n paddingBottom\n };\n\n // Slide-up content\n if (animate)\n {\n const animation = content.animate([\n constraints,\n { maxHeight: 0, paddingTop: 0, paddingBottom: 0 }\n ], { duration: durationMS, fill: 'forwards' }); // WAAPI in ms.\n\n // Set display style to none when animation finishes.\n animation.finished.then(() => content.style.display = 'none');\n }\n else\n {\n setTimeout(() => content.style.display = 'none', durationMS);\n }\n\n // Save current position state and add the constraint data to use in `maximize`.\n const saved = this.position.state.save({ name: '#beforeMinimized', constraints });\n\n // Set the initial before min width & height.\n saved.minWidth = beforeMinWidth;\n saved.minHeight = beforeMinHeight;\n\n const headerOffsetHeight = header.offsetHeight;\n\n // minHeight needs to be adjusted to header height.\n this.position.minHeight = headerOffsetHeight;\n\n if (animate)\n {\n // First await animation of height upward.\n await this.position.animate.to({ height: headerOffsetHeight }, { duration }).finished;\n }\n\n // Set all header buttons besides close and the window title to display none.\n for (let cntr = header.children.length; --cntr >= 0;)\n {\n const className = header.children[cntr].className;\n\n if (className.includes('window-title') || className.includes('close')) { continue; }\n\n // v10+ of Foundry core styles automatically hides anything besides the window title and close button, so\n // explicitly set display to block.\n if (className.includes('keep-minimized'))\n {\n header.children[cntr].style.display = 'block';\n continue;\n }\n\n header.children[cntr].style.display = 'none';\n }\n\n if (animate)\n {\n // Await animation of width to the left / minimum width.\n await this.position.animate.to({ width: MIN_WINDOW_WIDTH }, { duration: 0.1 }).finished;\n }\n\n element.classList.add('minimized');\n\n this._minimized = true;\n }\n\n /**\n * Provides a callback after all Svelte components are initialized.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {HTMLElement} [opts.element] - HTMLElement container for main application element.\n *\n * @param {HTMLElement} [opts.elementContent] - HTMLElement container for content area of application shells.\n *\n * @param {HTMLElement} [opts.elementTarget] - HTMLElement container for main application target element.\n */\n onSvelteMount({ element, elementContent, elementTarget } = {}) {} // eslint-disable-line no-unused-vars\n\n /**\n * Provides a callback after the main application shell is remounted. This may occur during HMR / hot module\n * replacement or directly invoked from the `elementRootUpdate` callback passed to the application shell component\n * context.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {HTMLElement} [opts.element] - HTMLElement container for main application element.\n *\n * @param {HTMLElement} [opts.elementContent] - HTMLElement container for content area of application shells.\n *\n * @param {HTMLElement} [opts.elementTarget] - HTMLElement container for main application target element.\n */\n onSvelteRemount({ element, elementContent, elementTarget } = {}) {} // eslint-disable-line no-unused-vars\n\n /**\n * Override replacing HTML as Svelte components control the rendering process. Only potentially change the outer\n * application frame / title for pop-out applications.\n *\n * @inheritDoc\n * @ignore\n */\n _replaceHTML(element, html) // eslint-disable-line no-unused-vars\n {\n if (!element.length) { return; }\n\n this.reactive.updateHeaderButtons();\n }\n\n /**\n * Provides an override verifying that a new Application being rendered for the first time doesn't have a\n * corresponding DOM element already loaded. This is a check that only occurs when `this._state` is\n * `Application.RENDER_STATES.NONE`. It is useful in particular when SvelteApplication has a static ID\n * explicitly set in `this.options.id` and long intro / outro transitions are assigned. If a new application\n * sharing this static ID attempts to open / render for the first time while an existing DOM element sharing\n * this static ID exists then the initial render is cancelled below rather than crashing later in the render\n * cycle {@link Position.set}.\n *\n * @inheritDoc\n * @protected\n * @ignore\n */\n async _render(force = false, options = {})\n {\n // Store any focusSource instance.\n if (isObject(options?.focusSource)) { this.options.focusSource = options.focusSource; }\n\n if (this._state === Application.RENDER_STATES.NONE &&\n document.querySelector(`#${this.id}`) instanceof HTMLElement)\n {\n console.warn(`SvelteApplication - _render: A DOM element already exists for CSS ID '${this.id\n }'. Cancelling initial render for new application with appId '${this.appId}'.`);\n\n return;\n }\n\n await super._render(force, options);\n\n if (!this.#onMount)\n {\n this.onSvelteMount({ element: this._element[0], elementContent: this.#elementContent, elementTarget:\n this.#elementTarget });\n\n this.#onMount = true;\n }\n }\n\n /**\n * Render the inner application content. Only render a template if one is defined otherwise provide an empty\n * JQuery element per the core Foundry API.\n *\n * @param {object} data The data used to render the inner template\n *\n * @returns {Promise.} A promise resolving to the constructed jQuery object\n *\n * @protected\n * @ignore\n */\n async _renderInner(data)\n {\n const html = typeof this.template === 'string' ? await renderTemplate(this.template, data) :\n document.createDocumentFragment();\n\n return $(html);\n }\n\n /**\n * Stores the initial z-index set in `_renderOuter` which is used in `_injectHTML` to set the target element\n * z-index after the Svelte component is mounted.\n *\n * @returns {Promise} Outer frame / unused.\n * @protected\n * @ignore\n */\n async _renderOuter()\n {\n const html = await super._renderOuter();\n this.#initialZIndex = html[0].style.zIndex;\n return html;\n }\n\n /**\n * All calculation and updates of position are implemented in {@link Position.set}. This allows position to be fully\n * reactive and in control of updating inline styles for the application.\n *\n * This method remains for backward compatibility with Foundry. If you have a custom override quite likely you need\n * to update to using the {@link Position.validators} functionality.\n *\n * @param {PositionDataExtended} [position] - Position data.\n *\n * @returns {Position} The updated position object for the application containing the new values\n */\n setPosition(position)\n {\n return this.position.set(position);\n }\n\n /**\n * This method is invoked by the `elementRootUpdate` callback that is added to the external context passed to\n * Svelte components. When invoked it updates the local element roots tracked by SvelteApplication.\n *\n * This method may also be invoked by HMR / hot module replacement via `svelte-hmr`.\n */\n #updateApplicationShell()\n {\n const applicationShell = this.svelte.applicationShell;\n\n if (applicationShell !== null)\n {\n this._element = $(applicationShell.elementRoot);\n\n // Detect if the application shell exports an `elementContent` accessor.\n this.#elementContent = hasGetter(applicationShell, 'elementContent') ?\n applicationShell.elementContent : null;\n\n // Detect if the application shell exports an `elementTarget` accessor.\n this.#elementTarget = hasGetter(applicationShell, 'elementTarget') ?\n applicationShell.elementTarget : null;\n\n if (this.#elementTarget === null)\n {\n this.#elementTarget = typeof this.options.selectorTarget === 'string' ?\n this._element[0].querySelector(this.options.selectorTarget) : this._element[0];\n }\n\n // The initial zIndex may be set in application options or for popOut applications is stored by `_renderOuter`\n // in `this.#initialZIndex`.\n if (typeof this.options.positionable === 'boolean' && this.options.positionable)\n {\n this.#elementTarget.style.zIndex = typeof this.options.zIndex === 'number' ? this.options.zIndex :\n this.#initialZIndex ?? 95;\n\n super.bringToTop();\n\n // Ensure that new root element has inline position styles set.\n this.position.set(this.position.get());\n }\n\n super._activateCoreListeners([this.#elementTarget]);\n\n this.onSvelteRemount({ element: this._element[0], elementContent: this.#elementContent, elementTarget:\n this.#elementTarget });\n }\n }\n}\n\n/**\n * @typedef {ApplicationOptions} SvelteApplicationOptions\n *\n * @property {boolean} [defaultCloseAnimation=true] - If false the default slide close animation is not run.\n *\n * @property {boolean} [draggable=true] - If true then application shells are draggable.\n *\n * @property {boolean} [focusAuto=true] - When true auto-management of app focus is enabled.\n *\n * @property {boolean} [focusKeep=false] - When `focusAuto` and `focusKeep` is true; keeps internal focus.\n *\n * @property {object} [focusSource] - Defines A11yHelper focus source to apply when application closes.\n *\n * @property {boolean} [headerButtonNoClose=false] - If true then the close header button is removed.\n *\n * @property {boolean} [headerButtonNoLabel=false] - If true then header button labels are removed.\n *\n * @property {boolean} [headerNoTitleMinimized=false] - If true then header title is hidden when minimized.\n *\n * @property {number} [minHeight=MIN_WINDOW_HEIGHT] - Assigned to position. Number specifying minimum window height.\n *\n * @property {number} [minWidth=MIN_WINDOW_WIDTH] - Assigned to position. Number specifying minimum window width.\n *\n * @property {boolean} [positionable=true] - If false then `position.set` does not take effect.\n *\n * @property {PositionInitialHelper} [positionInitial] - A helper for initial position placement.\n *\n * @property {boolean} [positionOrtho=true] - When true Position is optimized for orthographic use.\n *\n * @property {PositionValidatorOptions} [positionValidator] - A validator function or data or list of validators.\n *\n * @property {object} [sessionStorage] - An instance of TJSSessionStorage to share across SvelteApplications.\n *\n * @property {object} [svelte] - A Svelte configuration object defining the main component.\n *\n * @property {string} [transformOrigin='top left'] - By default, 'top / left' respects rotation when minimizing.\n */\n\n/**\n * @typedef {object} SvelteData\n *\n * @property {object} config -\n *\n * @property {import('svelte').SvelteComponent} component -\n *\n * @property {HTMLElement} element -\n *\n * @property {boolean} injectHTML -\n */\n\n/**\n * @typedef {object} SvelteStores\n *\n * @property {import('svelte/store').Writable.update} appOptionsUpdate - Update function for app options store.\n *\n * @property {Function} subscribe - Subscribes to local stores.\n *\n * @property {import('svelte/store').Writable.update} uiOptionsUpdate - Update function for UI options store.\n *\n * @property {Function} unsubscribe - Unsubscribes from local stores.\n */\n","import { StyleManager } from '@typhonjs-fvtt/runtime/svelte/util';\n\nconst s_STYLE_KEY = '#__trl-root-styles';\n\nconst cssVariables = new StyleManager({ docKey: s_STYLE_KEY, version: 1 });\n\nexport { cssVariables };\n","import { isUpdatableStore, isWritableStore } from '@typhonjs-fvtt/runtime/svelte/store';\nimport { styleParsePixels, isObject, debounce, hasSetter, isIterable } from '@typhonjs-fvtt/runtime/svelte/util';\nimport { cubicOut } from 'svelte/easing';\n\n/**\n * Provides an action to always blur the element when any pointer up event occurs on the element.\n *\n * @param {HTMLElement} node - The node to handle always blur on pointer up.\n *\n * @returns {{destroy: Function}} Lifecycle functions.\n */\nfunction alwaysBlur(node)\n{\n /**\n * Blurs node if active element.\n */\n function blurNode()\n {\n setTimeout(() => { if (document.activeElement === node) { node.blur(); } }, 0);\n }\n\n node.addEventListener('pointerup', blurNode);\n\n return {\n destroy: () => node.removeEventListener('pointerup', blurNode)\n };\n}\n\n/**\n * Provides an action to monitor the given HTMLElement node with `ResizeObserver` posting width / height changes\n * to the target in various ways depending on the shape of the target. The target can be one of the following and the\n * precedence order is listed from top to bottom:\n *\n * - has a `resizeObserved` function as attribute; offset then content width / height are passed as parameters.\n * - has a `setContentBounds` function as attribute; content width / height are passed as parameters.\n * - has a `setDimension` function as attribute; offset width / height are passed as parameters.\n * - target is an object; offset and content width / height attributes are directly set on target.\n * - target is a function; the function is invoked with offset then content width / height parameters.\n * - has a writable store `resizeObserved` as an attribute; updated with offset & content width / height.\n * - has an object 'stores' that has a writable store `resizeObserved` as an attribute; updated with offset &\n * content width / height.\n *\n * Note: Svelte currently uses an archaic IFrame based workaround to monitor offset / client width & height changes.\n * A more up to date way to do this is with ResizeObserver. To track when Svelte receives ResizeObserver support\n * monitor this issue: {@link https://github.com/sveltejs/svelte/issues/4233}\n *\n * Can-I-Use: {@link https://caniuse.com/resizeobserver}\n *\n * @param {HTMLElement} node - The node associated with the action.\n *\n * @param {ResizeObserverTarget} target - An object or function to update with observed width & height changes.\n *\n * @returns {{update: Function, destroy: Function}} The action lifecycle methods.\n * @see {@link https://github.com/sveltejs/svelte/issues/4233}\n */\nfunction resizeObserver(node, target)\n{\n ResizeObserverManager.add(node, target);\n\n return {\n update: (newTarget) =>\n {\n ResizeObserverManager.remove(node, target);\n target = newTarget;\n ResizeObserverManager.add(node, target);\n },\n\n destroy: () =>\n {\n ResizeObserverManager.remove(node, target);\n }\n };\n}\n\n/**\n * Provides a function that when invoked with an element updates the cached styles for each subscriber of the element.\n *\n * The style attributes cached to calculate offset height / width include border & padding dimensions. You only need\n * to update the cache if you change border or padding attributes of the element.\n *\n * @param {HTMLElement} el - An HTML element.\n */\nresizeObserver.updateCache = function(el)\n{\n if (!(el instanceof HTMLElement)) { throw new TypeError(`resizeObserverUpdate error: 'el' is not an HTMLElement.`); }\n\n const subscribers = s_MAP.get(el);\n\n if (Array.isArray(subscribers))\n {\n const computed = globalThis.getComputedStyle(el);\n\n // Cache styles first from any inline styles then computed styles defaulting to 0 otherwise.\n // Used to create the offset width & height values from the context box ResizeObserver provides.\n const borderBottom = styleParsePixels(el.style.borderBottom) ?? styleParsePixels(computed.borderBottom) ?? 0;\n const borderLeft = styleParsePixels(el.style.borderLeft) ?? styleParsePixels(computed.borderLeft) ?? 0;\n const borderRight = styleParsePixels(el.style.borderRight) ?? styleParsePixels(computed.borderRight) ?? 0;\n const borderTop = styleParsePixels(el.style.borderTop) ?? styleParsePixels(computed.borderTop) ?? 0;\n const paddingBottom = styleParsePixels(el.style.paddingBottom) ?? styleParsePixels(computed.paddingBottom) ?? 0;\n const paddingLeft = styleParsePixels(el.style.paddingLeft) ?? styleParsePixels(computed.paddingLeft) ?? 0;\n const paddingRight = styleParsePixels(el.style.paddingRight) ?? styleParsePixels(computed.paddingRight) ?? 0;\n const paddingTop = styleParsePixels(el.style.paddingTop) ?? styleParsePixels(computed.paddingTop) ?? 0;\n\n const additionalWidth = borderLeft + borderRight + paddingLeft + paddingRight;\n const additionalHeight = borderTop + borderBottom + paddingTop + paddingBottom;\n\n for (const subscriber of subscribers)\n {\n subscriber.styles.additionalWidth = additionalWidth;\n subscriber.styles.additionalHeight = additionalHeight;\n s_UPDATE_SUBSCRIBER(subscriber, subscriber.contentWidth, subscriber.contentHeight);\n }\n }\n};\n\n// Below is the static ResizeObserverManager ------------------------------------------------------------------------\n\nconst s_MAP = new Map();\n\n/**\n * Provides a static / single instance of ResizeObserver that can notify listeners in different ways.\n *\n * The action, {@link resizeObserver}, utilizes ResizeObserverManager for automatic registration and removal\n * via Svelte.\n */\nclass ResizeObserverManager\n{\n /**\n * Add an HTMLElement and ResizeObserverTarget instance for monitoring. Create cached style attributes for the\n * given element include border & padding dimensions for offset width / height calculations.\n *\n * @param {HTMLElement} el - The element to observe.\n *\n * @param {ResizeObserverTarget} target - A target that contains one of several mechanisms for updating resize data.\n */\n static add(el, target)\n {\n const updateType = s_GET_UPDATE_TYPE(target);\n\n if (updateType === 0)\n {\n throw new Error(`'target' does not match supported ResizeObserverManager update mechanisms.`);\n }\n\n const computed = globalThis.getComputedStyle(el);\n\n // Cache styles first from any inline styles then computed styles defaulting to 0 otherwise.\n // Used to create the offset width & height values from the context box ResizeObserver provides.\n const borderBottom = styleParsePixels(el.style.borderBottom) ?? styleParsePixels(computed.borderBottom) ?? 0;\n const borderLeft = styleParsePixels(el.style.borderLeft) ?? styleParsePixels(computed.borderLeft) ?? 0;\n const borderRight = styleParsePixels(el.style.borderRight) ?? styleParsePixels(computed.borderRight) ?? 0;\n const borderTop = styleParsePixels(el.style.borderTop) ?? styleParsePixels(computed.borderTop) ?? 0;\n const paddingBottom = styleParsePixels(el.style.paddingBottom) ?? styleParsePixels(computed.paddingBottom) ?? 0;\n const paddingLeft = styleParsePixels(el.style.paddingLeft) ?? styleParsePixels(computed.paddingLeft) ?? 0;\n const paddingRight = styleParsePixels(el.style.paddingRight) ?? styleParsePixels(computed.paddingRight) ?? 0;\n const paddingTop = styleParsePixels(el.style.paddingTop) ?? styleParsePixels(computed.paddingTop) ?? 0;\n\n const data = {\n updateType,\n target,\n\n // Stores most recent contentRect.width and contentRect.height values from ResizeObserver.\n contentWidth: 0,\n contentHeight: 0,\n\n // Convenience data for total border & padding for offset width & height calculations.\n styles: {\n additionalWidth: borderLeft + borderRight + paddingLeft + paddingRight,\n additionalHeight: borderTop + borderBottom + paddingTop + paddingBottom\n }\n };\n\n if (s_MAP.has(el))\n {\n const subscribers = s_MAP.get(el);\n subscribers.push(data);\n }\n else\n {\n s_MAP.set(el, [data]);\n }\n\n s_RESIZE_OBSERVER.observe(el);\n }\n\n /**\n * Removes all targets from monitoring when just an element is provided otherwise removes a specific target\n * from the monitoring map. If no more targets remain then the element is removed from monitoring.\n *\n * @param {HTMLElement} el - Element to remove from monitoring.\n *\n * @param {ResizeObserverTarget} [target] - A specific target to remove from monitoring.\n */\n static remove(el, target = void 0)\n {\n const subscribers = s_MAP.get(el);\n if (Array.isArray(subscribers))\n {\n const index = subscribers.findIndex((entry) => entry.target === target);\n if (index >= 0)\n {\n // Update target subscriber with undefined values.\n s_UPDATE_SUBSCRIBER(subscribers[index], void 0, void 0);\n\n subscribers.splice(index, 1);\n }\n\n // Remove element monitoring if last target removed.\n if (subscribers.length === 0)\n {\n s_MAP.delete(el);\n s_RESIZE_OBSERVER.unobserve(el);\n }\n }\n }\n}\n\n/**\n * Defines the various shape / update type of the given target.\n *\n * @type {Record}\n */\nconst s_UPDATE_TYPES = {\n none: 0,\n attribute: 1,\n function: 2,\n resizeObserved: 3,\n setContentBounds: 4,\n setDimension: 5,\n storeObject: 6,\n storesObject: 7\n};\n\nconst s_RESIZE_OBSERVER = new ResizeObserver((entries) =>\n{\n for (const entry of entries)\n {\n const subscribers = s_MAP.get(entry?.target);\n\n if (Array.isArray(subscribers))\n {\n const contentWidth = entry.contentRect.width;\n const contentHeight = entry.contentRect.height;\n\n for (const subscriber of subscribers)\n {\n s_UPDATE_SUBSCRIBER(subscriber, contentWidth, contentHeight);\n }\n }\n }\n});\n\n/**\n * Determines the shape of the target instance regarding valid update mechanisms to set width & height changes.\n *\n * @param {*} target - The target instance.\n *\n * @returns {number} Update type value.\n */\nfunction s_GET_UPDATE_TYPE(target)\n{\n if (target?.resizeObserved instanceof Function) { return s_UPDATE_TYPES.resizeObserved; }\n if (target?.setDimension instanceof Function) { return s_UPDATE_TYPES.setDimension; }\n if (target?.setContentBounds instanceof Function) { return s_UPDATE_TYPES.setContentBounds; }\n\n const targetType = typeof target;\n\n // Does the target have resizeObserved writable store?\n if (targetType !== null && (targetType === 'object' || targetType === 'function'))\n {\n if (isUpdatableStore(target.resizeObserved))\n {\n return s_UPDATE_TYPES.storeObject;\n }\n\n // Now check for a child stores object which is a common TRL pattern for exposing stores.\n const stores = target?.stores;\n if (isObject(stores) || typeof stores === 'function')\n {\n if (isUpdatableStore(stores.resizeObserved))\n {\n return s_UPDATE_TYPES.storesObject;\n }\n }\n }\n\n if (targetType !== null && targetType === 'object') { return s_UPDATE_TYPES.attribute; }\n\n if (targetType === 'function') { return s_UPDATE_TYPES.function; }\n\n return s_UPDATE_TYPES.none;\n}\n\n/**\n * Updates a subscriber target with given content width & height values. Offset width & height is calculated from\n * the content values + cached styles.\n *\n * @param {object} subscriber - Internal data about subscriber.\n *\n * @param {number|undefined} contentWidth - ResizeObserver contentRect.width value or undefined.\n *\n * @param {number|undefined} contentHeight - ResizeObserver contentRect.height value or undefined.\n */\nfunction s_UPDATE_SUBSCRIBER(subscriber, contentWidth, contentHeight)\n{\n const styles = subscriber.styles;\n\n subscriber.contentWidth = contentWidth;\n subscriber.contentHeight = contentHeight;\n\n const offsetWidth = Number.isFinite(contentWidth) ? contentWidth + styles.additionalWidth : void 0;\n const offsetHeight = Number.isFinite(contentHeight) ? contentHeight + styles.additionalHeight : void 0;\n\n const target = subscriber.target;\n\n switch (subscriber.updateType)\n {\n case s_UPDATE_TYPES.attribute:\n target.contentWidth = contentWidth;\n target.contentHeight = contentHeight;\n target.offsetWidth = offsetWidth;\n target.offsetHeight = offsetHeight;\n break;\n\n case s_UPDATE_TYPES.function:\n target?.(offsetWidth, offsetHeight, contentWidth, contentHeight);\n break;\n\n case s_UPDATE_TYPES.resizeObserved:\n target.resizeObserved?.(offsetWidth, offsetHeight, contentWidth, contentHeight);\n break;\n\n case s_UPDATE_TYPES.setContentBounds:\n target.setContentBounds?.(contentWidth, contentHeight);\n break;\n\n case s_UPDATE_TYPES.setDimension:\n target.setDimension?.(offsetWidth, offsetHeight);\n break;\n\n case s_UPDATE_TYPES.storeObject:\n target.resizeObserved.update((object) =>\n {\n object.contentHeight = contentHeight;\n object.contentWidth = contentWidth;\n object.offsetHeight = offsetHeight;\n object.offsetWidth = offsetWidth;\n\n return object;\n });\n break;\n\n case s_UPDATE_TYPES.storesObject:\n target.stores.resizeObserved.update((object) =>\n {\n object.contentHeight = contentHeight;\n object.contentWidth = contentWidth;\n object.offsetHeight = offsetHeight;\n object.offsetWidth = offsetWidth;\n\n return object;\n });\n break;\n }\n}\n\n/**\n * @typedef {object | Function} ResizeObserverTarget\n *\n * @property {number} [contentHeight] -\n *\n * @property {number} [contentWidth] -\n *\n * @property {number} [offsetHeight] -\n *\n * @property {number} [offsetWidth] -\n *\n * @property {Writable | Function} [resizedObserver] - Either a function or a writable store.\n *\n * @property {Function} [setContentSize] - A function that is invoked with content width & height changes.\n *\n * @property {Function} [setDimension] - A function that is invoked with offset width & height changes.\n *\n * @property {{resizedObserver: Writable}} [stores] - An object with a writable store.\n */\n\n/**\n * Provides an action to save `scrollTop` of an element with a vertical scrollbar. This action should be used on the\n * scrollable element and must include a writable store that holds the active store for the current `scrollTop` value.\n * You may switch the stores externally and this action will set the `scrollTop` based on the newly set store. This is\n * useful for instance providing a select box that controls the scrollable container.\n *\n * @param {HTMLElement} element - The target scrollable HTML element.\n *\n * @param {import('svelte/store').Writable} store - A writable store that stores the element scrollTop.\n *\n * @returns {{destroy: Function, update: Function}} Lifecycle functions.\n */\nfunction applyScrolltop(element, store)\n{\n if (!isWritableStore(store))\n {\n throw new TypeError(`applyScrolltop error: 'store' must be a writable Svelte store.`);\n }\n\n /**\n * Updates element `scrollTop`.\n *\n * @param {number} value -\n */\n function storeUpdate(value)\n {\n if (!Number.isFinite(value)) { return; }\n\n // For some reason for scrollTop to take on first update from a new element setTimeout is necessary.\n setTimeout(() => element.scrollTop = value, 0);\n }\n\n let unsubscribe = store.subscribe(storeUpdate);\n\n const resizeControl = resizeObserver(element, debounce(() =>\n {\n if (element.isConnected) { store.set(element.scrollTop); }\n }, 500));\n\n /**\n * Save target `scrollTop` to the current set store.\n *\n * @param {Event} event -\n */\n function onScroll(event)\n {\n store.set(event.target.scrollTop);\n }\n\n const debounceFn = debounce((e) => onScroll(e), 500);\n\n element.addEventListener('scroll', debounceFn);\n\n return {\n update: (newStore) =>\n {\n unsubscribe();\n store = newStore;\n\n if (!isWritableStore(store))\n {\n throw new TypeError(`applyScrolltop.update error: 'store' must be a writable Svelte store.`);\n }\n\n unsubscribe = store.subscribe(storeUpdate);\n },\n\n destroy: () =>\n {\n element.removeEventListener('scroll', debounceFn);\n unsubscribe();\n resizeControl.destroy();\n }\n };\n}\n\n/**\n * Provides an action to blur the element when any pointer down event occurs outside the element. This can be useful\n * for input elements including select to blur / unfocus the element when any pointer down occurs outside the element.\n *\n * @param {HTMLElement} node - The node to handle automatic blur on focus loss.\n *\n * @returns {{destroy: Function}} Lifecycle functions.\n */\nfunction autoBlur(node)\n{\n /**\n * Removes listener on blur.\n */\n function onBlur() { document.body.removeEventListener('pointerdown', onPointerDown); }\n\n /**\n * Adds listener on focus.\n */\n function onFocus() { document.body.addEventListener('pointerdown', onPointerDown); }\n\n /**\n * Blur the node if a pointer down event happens outside the node.\n *\n * @param {PointerEvent} event -\n */\n function onPointerDown(event)\n {\n if (event.target === node || node.contains(event.target)) { return; }\n\n if (document.activeElement === node) { node.blur(); }\n }\n\n node.addEventListener('blur', onBlur);\n node.addEventListener('focus', onFocus);\n\n return {\n destroy: () =>\n {\n document.body.removeEventListener('pointerdown', onPointerDown);\n node.removeEventListener('blur', onBlur);\n node.removeEventListener('focus', onFocus);\n }\n };\n}\n\n/**\n * Provides an action to monitor focus state of a given element and set an associated store with current focus state.\n *\n * This action is usable with any writable store.\n *\n * @param {HTMLElement} node - Target element.\n *\n * @param {import('svelte/store').Writable} storeFocused - Update store for focus changes.\n *\n * @returns {{update: (function(object): void), destroy: (function(): void)}} Action lifecycle methods.\n */\nfunction isFocused(node, storeFocused)\n{\n let localFocused = false;\n\n /**\n * Updates `storeFocused` w/ current focused state.\n *\n * @param {boolean} current - current focused state.\n */\n function setFocused(current)\n {\n localFocused = current;\n\n if (isWritableStore(storeFocused)) { storeFocused.set(localFocused); }\n }\n\n /**\n * Focus event listener.\n */\n function onFocus()\n {\n setFocused(true);\n }\n\n /**\n * Blur event listener.\n */\n function onBlur()\n {\n setFocused(false);\n }\n\n /**\n * Activate listeners.\n */\n function activateListeners()\n {\n node.addEventListener('focus', onFocus);\n node.addEventListener('blur', onBlur);\n }\n\n /**\n * Remove listeners.\n */\n function removeListeners()\n {\n node.removeEventListener('focus', onFocus);\n node.removeEventListener('blur', onBlur);\n }\n\n activateListeners();\n\n return {\n update: (newStoreFocused) => // eslint-disable-line no-shadow\n {\n storeFocused = newStoreFocused;\n setFocused(localFocused);\n },\n\n destroy: () => removeListeners()\n };\n}\n\n/**\n * Provides an action to forward on key down & up events. This can be any object that has associated `keydown` and\n * `keyup` methods. See {@link KeyStore} for a store implementation.\n *\n * @param {HTMLElement} node - Target element.\n *\n * @param {{keydown: Function, keyup: Function}} keyStore - Object to forward events key down / up events to...\n *\n * @returns {{update: (function(object): void), destroy: (function(): void)}} Action lifecycle methods.\n */\nfunction keyforward(node, keyStore)\n{\n if (typeof keyStore?.keydown !== 'function' || typeof keyStore.keyup !== 'function')\n {\n throw new TypeError(`'keyStore' doesn't have required 'keydown' or 'keyup' methods.`);\n }\n\n /**\n * @param {KeyboardEvent} event -\n */\n function onKeydown(event)\n {\n keyStore.keydown(event);\n }\n\n /**\n * @param {KeyboardEvent} event -\n */\n function onKeyup(event)\n {\n keyStore.keyup(event);\n }\n\n /**\n * Activates key listeners.\n */\n function activateListeners()\n {\n node.addEventListener('keydown', onKeydown);\n node.addEventListener('keyup', onKeyup);\n }\n\n /**\n * Removes key listeners.\n */\n function removeListeners()\n {\n node.removeEventListener('keydown', onKeydown);\n node.removeEventListener('keyup', onKeyup);\n }\n\n activateListeners();\n\n return {\n update: (newKeyStore) => // eslint-disable-line no-shadow\n {\n keyStore = newKeyStore;\n\n if (typeof keyStore?.keydown !== 'function' || typeof keyStore.keyup !== 'function')\n {\n throw new TypeError(`'newKeyStore' doesn't have required 'keydown' or 'keyup' methods.`);\n }\n },\n\n destroy: () => removeListeners()\n };\n}\n\n/**\n * Provides an action to apply style properties provided as an object.\n *\n * @param {HTMLElement} node - Target element\n *\n * @param {object} properties - Key / value object of properties to set.\n *\n * @returns {Function} Update function.\n */\nfunction applyStyles(node, properties)\n{\n /** Sets properties on node. */\n function setProperties()\n {\n if (typeof properties !== 'object') { return; }\n\n for (const prop of Object.keys(properties))\n {\n node.style.setProperty(`${prop}`, properties[prop]);\n }\n }\n\n setProperties();\n\n return {\n update(newProperties)\n {\n properties = newProperties;\n setProperties();\n }\n };\n}\n\n/**\n * Provides an action to apply a Position instance to a HTMLElement and invoke `position.parent`\n *\n * @param {HTMLElement} node - The node associated with the action.\n *\n * @param {Position} position - A position instance.\n *\n * @returns {{update: Function, destroy: Function}} The action lifecycle methods.\n */\nfunction applyPosition(node, position)\n{\n if (hasSetter(position, 'parent')) { position.parent = node; }\n\n return {\n update: (newPosition) =>\n {\n // Sanity case to short circuit update if positions are the same instance.\n if (newPosition === position && newPosition.parent === position.parent) { return; }\n\n if (hasSetter(position)) { position.parent = void 0; }\n\n position = newPosition;\n\n if (hasSetter(position, 'parent')) { position.parent = node; }\n },\n\n destroy: () => { if (hasSetter(position, 'parent')) { position.parent = void 0; } }\n };\n}\n\n/**\n * Provides an action to enable pointer dragging of an HTMLElement and invoke `position.set` on a given {@link Position}\n * instance provided. When the attached boolean store state changes the draggable action is enabled or disabled.\n *\n * @param {HTMLElement} node - The node associated with the action.\n *\n * @param {object} params - Required parameters.\n *\n * @param {Position} params.position - A position instance.\n *\n * @param {boolean} [params.active=true] - A boolean value; attached to a readable store.\n *\n * @param {number} [params.button=0] - MouseEvent button; {@link https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button}.\n *\n * @param {import('svelte/store').Writable} [params.storeDragging] - A writable store that tracks \"dragging\"\n * state.\n *\n * @param {boolean} [params.ease=true] - When true easing is enabled.\n *\n * @param {object} [params.easeOptions] - Gsap `to / `quickTo` vars object.\n *\n * @param {Iterable} [params.hasTargetClassList] - When defined any event targets that have a class in this\n * list are allowed.\n *\n * @param {Iterable} [params.ignoreTargetClassList] - When defined any event targets that have a class in this\n * list are ignored.\n *\n * @returns {{update: Function, destroy: Function}} The action lifecycle methods.\n */\nfunction draggable(node, { position, active = true, button = 0, storeDragging = void 0, ease = false,\n easeOptions = { duration: 0.1, ease: cubicOut }, hasTargetClassList, ignoreTargetClassList })\n{\n if (hasTargetClassList !== void 0 && !isIterable(hasTargetClassList))\n {\n throw new TypeError(`'hasTargetClassList' is not iterable.`);\n }\n\n if (ignoreTargetClassList !== void 0 && !isIterable(ignoreTargetClassList))\n {\n throw new TypeError(`'ignoreTargetClassList' is not iterable.`);\n }\n\n /**\n * Duplicate the app / Positionable starting position to track differences.\n *\n * @type {object}\n */\n let initialPosition = null;\n\n /**\n * Stores the initial X / Y on drag down.\n *\n * @type {object}\n */\n let initialDragPoint = {};\n\n /**\n * Stores the current dragging state and gates the move pointer as the dragging store is not\n * set until the first pointer move.\n *\n * @type {boolean}\n */\n let dragging = false;\n\n /**\n * Stores the quickTo callback to use for optimized tweening when easing is enabled.\n *\n * @type {quickToCallback}\n */\n let quickTo = position.animate.quickTo(['top', 'left'], easeOptions);\n\n /**\n * Remember event handlers associated with this action so they may be later unregistered.\n *\n * @type {object}\n */\n const handlers = {\n dragDown: ['pointerdown', (e) => onDragPointerDown(e), false],\n dragMove: ['pointermove', (e) => onDragPointerChange(e), false],\n dragUp: ['pointerup', (e) => onDragPointerUp(e), false]\n };\n\n /**\n * Activates listeners.\n */\n function activateListeners()\n {\n // Drag handlers\n node.addEventListener(...handlers.dragDown);\n node.classList.add('draggable');\n }\n\n /**\n * Removes listeners.\n */\n function removeListeners()\n {\n if (typeof storeDragging?.set === 'function') { storeDragging.set(false); }\n\n // Drag handlers\n node.removeEventListener(...handlers.dragDown);\n node.removeEventListener(...handlers.dragMove);\n node.removeEventListener(...handlers.dragUp);\n node.classList.remove('draggable');\n }\n\n if (active)\n {\n activateListeners();\n }\n\n /**\n * Handle the initial pointer down that activates dragging behavior for the positionable.\n *\n * @param {PointerEvent} event - The pointer down event.\n */\n function onDragPointerDown(event)\n {\n if (event.button !== button || !event.isPrimary) { return; }\n\n // Do not process if the position system is not enabled.\n if (!position.enabled) { return; }\n\n // Potentially ignore this event if `ignoreTargetClassList` is defined and the `event.target` has a matching\n // class.\n if (ignoreTargetClassList !== void 0 && event.target instanceof HTMLElement)\n {\n for (const targetClass of ignoreTargetClassList)\n {\n if (event.target.classList.contains(targetClass)) { return; }\n }\n }\n\n // Potentially ignore this event if `hasTargetClassList` is defined and the `event.target` does not have any\n // matching class from the list.\n if (hasTargetClassList !== void 0 && event.target instanceof HTMLElement)\n {\n let foundTarget = false;\n\n for (const targetClass of hasTargetClassList)\n {\n if (event.target.classList.contains(targetClass))\n {\n foundTarget = true;\n break;\n }\n }\n\n if (!foundTarget) { return; }\n }\n\n event.preventDefault();\n\n dragging = false;\n\n // Record initial position.\n initialPosition = position.get();\n initialDragPoint = { x: event.clientX, y: event.clientY };\n\n // Add move and pointer up handlers.\n node.addEventListener(...handlers.dragMove);\n node.addEventListener(...handlers.dragUp);\n\n node.setPointerCapture(event.pointerId);\n }\n\n /**\n * Move the positionable.\n *\n * @param {PointerEvent} event - The pointer move event.\n */\n function onDragPointerChange(event)\n {\n // See chorded button presses for pointer events:\n // https://www.w3.org/TR/pointerevents3/#chorded-button-interactions\n // TODO: Support different button configurations for PointerEvents.\n if ((event.buttons & 1) === 0)\n {\n onDragPointerUp(event);\n return;\n }\n\n if (event.button !== -1 || !event.isPrimary) { return; }\n\n event.preventDefault();\n\n // Only set store dragging on first move event.\n if (!dragging && typeof storeDragging?.set === 'function')\n {\n dragging = true;\n storeDragging.set(true);\n }\n\n /** @type {number} */\n const newLeft = initialPosition.left + (event.clientX - initialDragPoint.x);\n /** @type {number} */\n const newTop = initialPosition.top + (event.clientY - initialDragPoint.y);\n\n if (ease)\n {\n quickTo(newTop, newLeft);\n }\n else\n {\n s_POSITION_DATA.left = newLeft;\n s_POSITION_DATA.top = newTop;\n\n position.set(s_POSITION_DATA);\n }\n }\n\n /**\n * Finish dragging and set the final position and removing listeners.\n *\n * @param {PointerEvent} event - The pointer up event.\n */\n function onDragPointerUp(event)\n {\n event.preventDefault();\n\n dragging = false;\n if (typeof storeDragging?.set === 'function') { storeDragging.set(false); }\n\n node.removeEventListener(...handlers.dragMove);\n node.removeEventListener(...handlers.dragUp);\n }\n\n return {\n // The default of active being true won't automatically add listeners twice.\n update: (options) =>\n {\n if (typeof options.active === 'boolean')\n {\n active = options.active;\n if (active) { activateListeners(); }\n else { removeListeners(); }\n }\n\n if (typeof options.button === 'number')\n {\n button = options.button;\n }\n\n if (options.position !== void 0 && options.position !== position)\n {\n position = options.position;\n quickTo = position.animate.quickTo(['top', 'left'], easeOptions);\n }\n\n if (typeof options.ease === 'boolean') { ease = options.ease; }\n\n if (isObject(options.easeOptions))\n {\n easeOptions = options.easeOptions;\n quickTo.options(easeOptions);\n }\n\n if (options.hasTargetClassList !== void 0)\n {\n if (!isIterable(options.hasTargetClassList))\n {\n throw new TypeError(`'hasTargetClassList' is not iterable.`);\n }\n else\n {\n hasTargetClassList = options.hasTargetClassList;\n }\n }\n\n if (options.ignoreTargetClassList !== void 0)\n {\n if (!isIterable(options.ignoreTargetClassList))\n {\n throw new TypeError(`'ignoreTargetClassList' is not iterable.`);\n }\n else\n {\n ignoreTargetClassList = options.ignoreTargetClassList;\n }\n }\n },\n\n destroy: () => removeListeners()\n };\n}\n\nclass DraggableOptions\n{\n #ease = false;\n\n #easeOptions = { duration: 0.1, ease: cubicOut };\n\n /**\n * Stores the subscribers.\n *\n * @type {(function(DraggableOptions): void)[]}\n */\n #subscriptions = [];\n\n constructor({ ease, easeOptions } = {})\n {\n // Define the following getters directly on this instance and make them enumerable. This allows them to be\n // picked up w/ `Object.assign`.\n Object.defineProperty(this, 'ease', {\n get: () => { return this.#ease; },\n set: (newEase) =>\n {\n if (typeof newEase !== 'boolean') { throw new TypeError(`'ease' is not a boolean.`); }\n\n this.#ease = newEase;\n this.#updateSubscribers();\n },\n enumerable: true\n });\n\n Object.defineProperty(this, 'easeOptions', {\n get: () => { return this.#easeOptions; },\n set: (newEaseOptions) =>\n {\n if (newEaseOptions === null || typeof newEaseOptions !== 'object')\n {\n throw new TypeError(`'easeOptions' is not an object.`);\n }\n\n if (newEaseOptions.duration !== void 0)\n {\n if (!Number.isFinite(newEaseOptions.duration))\n {\n throw new TypeError(`'easeOptions.duration' is not a finite number.`);\n }\n\n if (newEaseOptions.duration < 0) { throw new Error(`'easeOptions.duration' is less than 0.`); }\n\n this.#easeOptions.duration = newEaseOptions.duration;\n }\n\n if (newEaseOptions.ease !== void 0)\n {\n if (typeof newEaseOptions.ease !== 'function' && typeof newEaseOptions.ease !== 'string')\n {\n throw new TypeError(`'easeOptions.ease' is not a function or string.`);\n }\n\n this.#easeOptions.ease = newEaseOptions.ease;\n }\n\n this.#updateSubscribers();\n },\n enumerable: true\n });\n\n // Set default options.\n if (ease !== void 0) { this.ease = ease; }\n if (easeOptions !== void 0) { this.easeOptions = easeOptions; }\n }\n\n\n /**\n * @returns {number} Get ease duration\n */\n get easeDuration() { return this.#easeOptions.duration; }\n\n /**\n * @returns {string|Function} Get easing function value.\n */\n get easeValue() { return this.#easeOptions.ease; }\n\n\n /**\n * @param {number} duration - Set ease duration.\n */\n set easeDuration(duration)\n {\n if (!Number.isFinite(duration))\n {\n throw new TypeError(`'duration' is not a finite number.`);\n }\n\n if (duration < 0) { throw new Error(`'duration' is less than 0.`); }\n\n this.#easeOptions.duration = duration;\n this.#updateSubscribers();\n }\n\n /**\n * @param {string|Function} value - Get easing function value.\n */\n set easeValue(value)\n {\n if (typeof value !== 'function' && typeof value !== 'string')\n {\n throw new TypeError(`'value' is not a function or string.`);\n }\n\n this.#easeOptions.ease = value;\n this.#updateSubscribers();\n }\n\n /**\n * Resets all options data to default values.\n */\n reset()\n {\n this.#ease = false;\n this.#easeOptions = { duration: 0.1, ease: cubicOut };\n this.#updateSubscribers();\n }\n\n /**\n * Resets easing options to default values.\n */\n resetEase()\n {\n this.#easeOptions = { duration: 0.1, ease: cubicOut };\n this.#updateSubscribers();\n }\n\n /**\n *\n * @param {function(DraggableOptions): void} handler - Callback function that is invoked on update / changes.\n * Receives the DraggableOptions object / instance.\n *\n * @returns {(function(): void)} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n\n handler(this); // call handler with current value\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n\n #updateSubscribers()\n {\n const subscriptions = this.#subscriptions;\n\n // Early out if there are no subscribers.\n if (subscriptions.length > 0)\n {\n for (let cntr = 0; cntr < subscriptions.length; cntr++) { subscriptions[cntr](this); }\n }\n }\n}\n\n/**\n * Define a function to get a DraggableOptions instance.\n *\n * @param {{ ease?: boolean, easeOptions?: object }} options - Draggable options.\n *\n * @returns {DraggableOptions} A new options instance.\n */\ndraggable.options = (options) => new DraggableOptions(options);\n\n/**\n * Used for direct call to `position.set`.\n *\n * @type {{top: number, left: number}}\n */\nconst s_POSITION_DATA = { left: 0, top: 0 };\n\nexport { alwaysBlur, applyPosition, applyScrolltop, applyStyles, autoBlur, draggable, isFocused, keyforward, resizeObserver };\n//# sourceMappingURL=index.js.map\n","import { linear } from 'svelte/easing';\nimport { lerp } from '@typhonjs-fvtt/runtime/svelte/math';\nimport { fade, slide } from 'svelte/transition';\n\n/**\n * Provides a rotate transition. For options `easing` is applied to to the rotate transition. The default easing is\n * linear.\n *\n * Note: that when reversing the transition that time goes from `1 - 0`, so if specific options are applied for\n * rotating out transition then `end` and `initial` are swapped.\n *\n * @param {HTMLElement} node - The transition node.\n *\n * @param {object} options - Optional parameters.\n *\n * @param {number} [options.delay] - Delay in ms before start of transition.\n *\n * @param {number} [options.duration] - Total transition length in ms.\n *\n * @param {Function} [options.easing=linear] - The easing function to apply to the rotate transition.\n *\n * @param {number} [options.end=0] - End rotation in degrees.\n *\n * @param {number} [options.initial=0] - Initial rotation in degrees.\n *\n * @returns {{duration: number, css: (function(*=): string), delay: number, easing: (x: number) => number}}\n * Transition object.\n */\nfunction rotate(node, options)\n{\n const easingRotate = options.easing ?? linear;\n\n const initialDeg = options.initial ?? 0;\n const endDeg = options.end ?? 0;\n\n return {\n delay: options.delay ?? 0,\n duration: options.duration ?? 500,\n easing: linear,\n css: (t) =>\n {\n const rotateT = easingRotate(t);\n return `transform: rotate(${lerp(initialDeg, endDeg, rotateT)}deg)`;\n }\n };\n}\n\n/**\n * Combines rotate & fade transitions into a single transition. For options `easing` this is applied to both transitions,\n * however if provided `easingRotate` and / or `easingFade` will take precedence. The default easing is linear.\n *\n * Note: that when reversing the transition that time goes from `1 - 0`, so if specific options are applied for\n * rotating out transition then `end` and `initial` are swapped.\n *\n * @param {HTMLElement} node - The transition node.\n *\n * @param {object} options - Optional parameters.\n *\n * @param {number} [options.delay] - Delay in ms before start of transition.\n *\n * @param {number} [options.duration] - Total transition length in ms.\n *\n * @param {Function} [options.easing=linear] - The easing function to apply to both slide & fade transitions.\n *\n * @param {Function} [options.easingFade=linear] - The easing function to apply to the fade transition.\n *\n * @param {Function} [options.easingRotate=linear] - The easing function to apply to the rotate transition.\n *\n * @param {number} [options.end=0] - End rotation in degrees.\n *\n * @param {number} [options.initial=0] - Initial rotation in degrees.\n *\n * @returns {{duration: number, css: (function(*=): string), delay: number, easing: (x: number) => number}}\n * Transition object.\n */\nfunction rotateFade(node, options)\n{\n const easingFade = options.easingFade || options.easing || linear;\n const easingRotate = options.easingRotate || options.easing || linear;\n\n const fadeTransition = fade(node);\n\n const initialDeg = options.initial ?? 0;\n const endDeg = options.end ?? 0;\n\n return {\n delay: options.delay ?? 0,\n duration: options.duration ?? 500,\n easing: linear,\n css: (t) =>\n {\n const fadeT = easingFade(t);\n const rotateT = easingRotate(t);\n\n return `transform: rotate(${lerp(initialDeg, endDeg, rotateT)}deg); ${fadeTransition.css(fadeT, 1 - fadeT)}`;\n }\n };\n}\n\n/**\n * Combines slide & fade transitions into a single transition. For options `easing` this is applied to both transitions,\n * however if provided `easingSlide` and / or `easingFade` will take precedence. The default easing is linear.\n *\n * @param {HTMLElement} node - The transition node.\n *\n * @param {object} options - Optional parameters.\n *\n * @param {number} [options.delay] - Delay in ms before start of transition.\n *\n * @param {number} [options.duration] - Total transition length in ms.\n *\n * @param {Function} [options.easing=linear] - The easing function to apply to both slide & fade transitions.\n *\n * @param {Function} [options.easingFade=linear] - The easing function to apply to the fade transition.\n *\n * @param {Function} [options.easingSlide=linear] - The easing function to apply to the slide transition.\n *\n * @returns {{duration: number, css: (function(*=): string), delay: number, easing: (x: number) => number}}\n * Transition object.\n */\nfunction slideFade(node, options)\n{\n const fadeEasing = options.easingFade || options.easing || linear;\n const slideEasing = options.easingSlide || options.easing || linear;\n\n const fadeTransition = fade(node);\n const slideTransition = slide(node);\n\n return {\n delay: options.delay || 0,\n duration: options.duration || 500,\n easing: linear,\n css: (t) =>\n {\n const fadeT = fadeEasing(t);\n const slideT = slideEasing(t);\n return `${slideTransition.css(slideT, 1 - slideT)}; ${fadeTransition.css(fadeT, 1 - fadeT)}`;\n }\n };\n}\n\n/**\n * Converts a Svelte transition to an animation. Both transitions & animations use the same CSS / styles solution and\n * resulting data so wrap the transition function with the signature of an animation.\n *\n * @param {(node: Element, params?: object) => import('svelte/transition').TransitionConfig} fn -\n * A Svelte transition function.\n *\n * @returns {(node: Element, { from: DOMRect, to: DOMRect }, params?: object) => import('svelte/transition').TransitionConfig} -\n * Transition function converted to an animation.\n */\nfunction toAnimation(fn)\n{\n return (node, animations, params = {}) => fn(node, params);\n}\n\nconst s_DEFAULT_TRANSITION = () => void 0;\nconst s_DEFAULT_TRANSITION_OPTIONS = {};\n\nexport { rotate, rotateFade, s_DEFAULT_TRANSITION, s_DEFAULT_TRANSITION_OPTIONS, slideFade, toAnimation };\n//# sourceMappingURL=index.js.map\n","import { writable } from 'svelte/store';\n\n/**\n * Provides the internal context to all application shells.\n */\nexport class AppShellContextInternal\n{\n /** @type {InternalAppStores} */\n #stores;\n\n constructor()\n {\n this.#stores = {\n elementContent: writable(void 0),\n elementRoot: writable(void 0)\n };\n\n Object.freeze(this.#stores);\n Object.seal(this);\n }\n\n /**\n * @returns {InternalAppStores} The internal context stores for elementContent / elementRoot\n */\n get stores()\n {\n return this.#stores;\n }\n}\n\n/**\n * @typedef {object} InternalAppStores\n *\n * @property {import('svelte/store').Writable} elementContent - The window content element.\n *\n * @property {import('svelte/store').Writable} elementRoot - The window root element.\n */\n","/**\n * A helper to create a set of radio checkbox input elements in a named set.\n * The provided keys are the possible radio values while the provided values are human readable labels.\n *\n * @param {string} name The radio checkbox field name\n *\n * @param {object} choices A mapping of radio checkbox values to human readable labels\n *\n * @param {object} options Options which customize the radio boxes creation\n *\n * @param {string} options.checked Which key is currently checked?\n *\n * @param {boolean} options.localize Pass each label through string localization?\n *\n * @returns {string} HTML for radio boxes.\n *\n * @example The provided input data\n * let groupName = \"importantChoice\";\n * let choices = {a: \"Choice A\", b: \"Choice B\"};\n * let chosen = \"a\";\n *\n * @example The template HTML structure\n *
\n * \n *
\n * {@html radioBoxes(groupName, choices, { checked: chosen, localize: true})}\n *
\n *
\n */\nfunction radioBoxes(name, choices, options)\n{\n const checked = options['checked'] || null;\n\n const localize = options['localize'] || false;\n\n let html = '';\n\n for (let [key, label] of Object.entries(choices)) // eslint-disable-line prefer-const\n {\n if (localize) { label = globalThis.game.i18n.localize(label); }\n const isChecked = checked === key;\n html += ``;\n }\n\n return new globalThis.Handlebars.SafeString(html);\n}\n\n/**\n * Converts the `selectOptions` Handlebars helper to be Svelte compatible. This is useful when initially converting\n * over an app to Svelte and for essential usage to several dialogs that mirror the core Foundry experience. For\n * an example of usage see {@link TJSDocumentOwnership}.\n *\n * A helper to create a set of `;\n }\n\n return new globalThis.Handlebars.SafeString(html);\n}\n\n/**\n * Localize a string including variable formatting for input arguments. Provide a string ID which defines the localized\n * template. Variables can be included in the template enclosed in braces and will be substituted using those named\n * keys.\n *\n * @param {string} stringId - The string ID to translate.\n *\n * @param {object} [data] - Provided input data.\n *\n * @returns {string} The translated and formatted string\n */\nfunction localize(stringId, data)\n{\n const result = typeof data !== 'object' ? globalThis.game.i18n.localize(stringId) :\n globalThis.game.i18n.format(stringId, data);\n\n return result !== void 0 ? result : '';\n}\n\nexport { localize, radioBoxes, selectOptions };\n//# sourceMappingURL=index.js.map\n","\n\n\n\n\n\n {@html icon}{#if label}{label}{/if}\n\n\n\n","\n\n{#key draggable}\n
\n {#if typeof $storeHeaderIcon === 'string'}\n icon\n {/if}\n

\n {localize($storeTitle)}\n

\n {#each buttonsLeft as button}\n \n {/each}\n \n {#each buttonsRight as button}\n \n {/each}\n
\n{/key}\n\n\n","\n\n\n
\n\n\n","\n\n
\n \n
\n","\n\n\n\n{#if inTransition || outTransition}\n
\n \n
\n \n
\n \n \n
\n{:else}\n
\n \n
\n \n
\n \n \n
\n{/if}\n\n\n","import { cssVariables } from './cssVariables.js';\n\nexport { default as TJSComponentShell } from './TJSComponentShell.svelte';\nexport { default as TJSContainer } from './TJSContainer.svelte';\nexport { default as TJSGlassPane } from './TJSGlassPane.svelte';\nexport * from './application/index.js';\nexport * from './dialog/index.js';\n\n/**\n * @typedef {object} TransformData\n *\n * @property {Function} transition - A transition applying to both in & out.\n *\n * @property {Function} inTransition - A transition applying to in.\n *\n * @property {Function} outTransition - A transition applying to out.\n *\n * @property {object} transitionOptions - The options config object for in & out transitions.\n *\n * @property {object} inTransitionOptions - The options config object for in transitions.\n *\n * @property {object} outTransitionOptions - The options config object for out transitions.\n */\n\n/**\n * Provides default CSS variables for core components.\n */\ncssVariables.setProperties({\n // Anchor text shadow / header buttons\n '--tjs-default-text-shadow-focus-hover': '0 0 8px var(--color-shadow-primary)',\n\n // TJSApplicationShell app background.\n '--tjs-app-background': `url(\"${globalThis.foundry.utils.getRoute('/ui/denim075.png')}\")`,\n}, false);\n","import { SvelteApplication } from './SvelteApplication.js';\n\nexport * from './SvelteApplication.js';\nexport * from './TJSDialog.js';\n\n// TODO: temporary\nexport * from './position/Position.js';\n\n// Handle `PopOut!` module hooks to allow applications to popout to their own browser window -------------------------\n\nHooks.on('PopOut:loading', (app) =>\n{\n if (app instanceof SvelteApplication) { app.position.enabled = false; }\n});\n\nHooks.on('PopOut:popin', (app) =>\n{\n if (app instanceof SvelteApplication) { app.position.enabled = true; }\n});\n\nHooks.on('PopOut:close', (app) =>\n{\n if (app instanceof SvelteApplication) { app.position.enabled = true; }\n});\n\n/**\n * @typedef {object} MountedAppShell - Application shell contract for Svelte components.\n *\n * @property {HTMLElement} elementRoot - The root element / exported prop.\n *\n * @property {HTMLElement} [elementContent] - The content element / exported prop.\n *\n * @property {HTMLElement} [elementTarget] - The target element / exported prop.\n */\n\n/**\n * @typedef {ApplicationShell} ApplicationShellExt\n *\n * @property {SvelteReactive} reactive -\n *\n * @property {object} options -\n *\n * @property {Position} position -\n */\n\n/**\n * @typedef {object} StoreAppOptions - Provides a custom readable Svelte store for Application options state.\n *\n * @property {import('svelte/store').Readable} subscribe - Subscribe to all app options updates.\n *\n * @property {import('svelte/store').Writable} draggable - Derived store for `draggable` updates.\n *\n * @property {import('svelte/store').Writable} focusAuto - Derived store for `focusAuto` updates.\n *\n * @property {import('svelte/store').Writable} focusKeep - Derived store for `focusKeep` updates.\n *\n * @property {import('svelte/store').Writable} focusTrap - Derived store for `focusTrap` updates.\n *\n * @property {import('svelte/store').Writable} headerButtonNoClose - Derived store for `headerButtonNoClose`\n * updates.\n *\n * @property {import('svelte/store').Writable} headerButtonNoLabel - Derived store for `headerButtonNoLabel`\n * updates.\n *\n * @property {import('svelte/store').Writable} headerIcon - Derived store for `headerIcon` updates.\n *\n * @property {import('svelte/store').Writable} headerNoTitleMinimized - Derived store for\n * `headerNoTitleMinimized` updates.\n *\n * @property {import('svelte/store').Writable} minimizable - Derived store for `minimizable` updates.\n *\n * @property {import('svelte/store').Writable} popOut - Derived store for `popOut` updates.\n *\n * @property {import('svelte/store').Writable} positionable - Derived store for `positionable` updates.\n *\n * @property {import('svelte/store').Writable} resizable - Derived store for `resizable` updates.\n *\n * @property {import('svelte/store').Writable} title - Derived store for `title` updates.\n */\n\n/**\n * @typedef {object} StoreUIOptions - Provides a custom readable Svelte store for UI options state.\n *\n * @property {import('svelte/store').Readable.subscribe} subscribe - Subscribe to all UI options updates.\n *\n * @property {import('svelte/store').Writable} dragging - Derived store for `dragging` updates.\n *\n * @property {import('svelte/store').Readable} headerButtons - Derived store for\n * `headerButtons` updates.\n *\n * @property {import('svelte/store').Readable} minimized - Derived store for `minimized` updates.\n *\n * @property {import('svelte/store').Writable} resizing - Derived store for `resizing` updates.\n */\n\n/**\n * @typedef {object} TransformData\n *\n * @property {Function} transition - A transition applying to both in & out.\n *\n * @property {Function} inTransition - A transition applying to in.\n *\n * @property {Function} outTransition - A transition applying to out.\n *\n * @property {object} transitionOptions - The options config object for in & out transitions.\n *\n * @property {object} inTransitionOptions - The options config object for in transitions.\n *\n * @property {object} outTransitionOptions - The options config object for out transitions.\n */\n","import { debug } from \"../lib/lib.js\";\n\nclass loading_bar {\n constructor() {\n this.total = 0;\n this.current = 0;\n this.lastPct = 0;\n }\n\n init(context, total) {\n this.context = context;\n this.total = total;\n this.current = 0;\n this.lastPct = 0;\n SceneNavigation.displayProgressBar({ label: this.context, pct: 1 });\n }\n\n incrementProgress() {\n this.current += 1;\n const pct = Math.round((this.current / this.total) * 100);\n if (pct !== this.lastPct) {\n debug(`${pct}% loaded...`);\n SceneNavigation.displayProgressBar({ label: this.context, pct: pct });\n }\n this.lastPct = pct;\n }\n}\n\nconst LoadingBar = new loading_bar();\n\nexport default LoadingBar;\n","import CONSTANTS from \"../constants.js\";\n\nconst SequencerFileCache = {\n _videos: {},\n _preloadedFiles: new Set(),\n _totalCacheSize: 0,\n _validTypes: [\"video/webm\", \"video/x-webm\", \"application/octet-stream\"],\n\n async loadVideo(inSrc) {\n if (!this._videos[inSrc]) {\n const blob = await fetch(inSrc, {\n mode: \"cors\",\n credentials: \"same-origin\",\n })\n .then((r) => r.blob())\n .catch((err) => {\n console.error(err);\n });\n\n if (this._validTypes.indexOf(blob?.type) === -1) return false;\n\n while (this._totalCacheSize + blob.size > 524288000) {\n const entries = Object.entries(this._videos);\n\n entries.sort((a, b) => {\n return b[1].lastUsed - a[1].lastUsed;\n });\n\n const [oldSrc] = entries[0];\n\n this._preloadedFiles.delete(oldSrc);\n this._totalCacheSize -= this._videos[oldSrc].blob.size;\n delete this._videos[oldSrc];\n }\n\n this._totalCacheSize += blob.size;\n this._preloadedFiles.add(inSrc);\n this._videos[inSrc] = {\n blob,\n lastUsed: +new Date(),\n };\n }\n\n this._videos[inSrc].lastUsed = +new Date();\n return this._videos[inSrc].blob;\n },\n\n srcExists(inSrc) {\n if (this._preloadedFiles.has(inSrc)) {\n return true;\n }\n return srcExists(inSrc);\n },\n\n async loadFile(inSrc, preload = false) {\n if (inSrc.toLowerCase().endsWith(\".webm\")) {\n let blob = await this.loadVideo(inSrc);\n if (!blob) return false;\n this._preloadedFiles.add(inSrc);\n if (preload) return true;\n return get_video_texture(blob);\n } else if (AudioHelper.hasAudioExtension(inSrc)) {\n try {\n const audio = await AudioHelper.preloadSound(inSrc);\n if (audio) {\n this._preloadedFiles.add(inSrc);\n }\n return audio;\n } catch (err) {\n console.error(`Failed to load audio: ${inSrc}`);\n return false;\n }\n }\n\n const texture = await loadTexture(inSrc);\n if (texture) {\n this._preloadedFiles.add(inSrc);\n }\n return texture;\n },\n};\n\nasync function get_video_texture(inBlob) {\n return new Promise(async (resolve) => {\n const video = document.createElement(\"video\");\n video.preload = \"auto\";\n video.crossOrigin = \"anonymous\";\n video.controls = true;\n video.autoplay = false;\n video.autoload = true;\n video.muted = true;\n video.src = URL.createObjectURL(inBlob);\n\n let canplay = true;\n video.oncanplay = async () => {\n if (!canplay) return;\n canplay = false;\n\n video.height = video.videoHeight;\n video.width = video.videoWidth;\n\n const baseTexture = PIXI.BaseTexture.from(video, {\n resourceOptions: { autoPlay: false },\n });\n\n if (game.settings.get(CONSTANTS.MODULE_NAME, \"enable-pixi-fix\")) {\n baseTexture.alphaMode = PIXI.ALPHA_MODES.PREMULTIPLIED_ALPHA;\n }\n\n const texture = new PIXI.Texture(baseTexture);\n\n resolve(texture);\n };\n\n video.onerror = () => {\n URL.revokeObjectURL(video.src);\n reject();\n };\n });\n}\n\nexport default SequencerFileCache;\n","import * as lib from \"../lib/lib.js\";\nimport SequencerFileCache from \"./sequencer-file-cache.js\";\n\nconst flipBookTextureCache = {};\n\nexport class SequencerFileBase {\n static make(inData, inDBPath, inMetadata) {\n const originalFile = inData?.file ?? inData;\n const file = foundry.utils.duplicate(originalFile);\n const isRangeFind =\n typeof file !== \"string\" && !Array.isArray(originalFile)\n ? Object.keys(originalFile).filter((key) => key.endsWith(\"ft\")).length >\n 0\n : false;\n\n return isRangeFind\n ? new SequencerFileRangeFind(inData, inDBPath, inMetadata)\n : new SequencerFile(inData, inDBPath, inMetadata);\n }\n}\n\nexport class SequencerFile extends SequencerFileBase {\n rangeFind = false;\n\n constructor(inData, inDBPath, inMetadata) {\n super();\n inData = foundry.utils.duplicate(inData);\n inMetadata = foundry.utils.duplicate(inMetadata);\n this.originalData = inData;\n this.originalMetadata = inMetadata;\n for (let [key, value] of Object.entries(inMetadata)) {\n this[key] = value;\n }\n this.dbPath = inDBPath;\n this.moduleName = inDBPath.split(\".\")[0];\n this.originalFile = inData?.file ?? inData;\n this.file = foundry.utils.duplicate(this.originalFile);\n this.fileIndex = null;\n\n this.fileTextureMap = Object.fromEntries(\n this.getAllFiles().map((file) => {\n return [file, false];\n })\n );\n\n this.twister = false;\n }\n\n clone() {\n return SequencerFile.make(\n this.originalData,\n this.dbPath,\n this.originalMetadata\n );\n }\n\n async validate() {\n let isValid = true;\n const directories = {};\n const allFiles = this.getAllFiles();\n for (const file of allFiles) {\n let directory = file.split(\"/\");\n directory.pop();\n directory = directory.join(\"/\");\n if (directories[directory] === undefined) {\n directories[directory] = await lib.getFiles(directory);\n }\n }\n for (const file of allFiles) {\n let directory = file.split(\"/\");\n directory.pop();\n directory = directory.join(\"/\");\n\n if (directories[directory].indexOf(file) === -1) {\n console.warn(\n `\"${this.dbPath}\" has an incorrect file path, could not find file. Points to:\\n${file}`\n );\n isValid = false;\n }\n }\n return isValid;\n }\n\n getAllFiles() {\n return [this.file].deepFlatten();\n }\n\n getFile() {\n if (Array.isArray(this.file)) {\n this.fileIndex = lib.is_real_number(this.fileIndex)\n ? this.fileIndex\n : lib.random_array_element(this.file, {\n twister: this.twister,\n index: true,\n });\n return this.file[this.fileIndex];\n }\n return this.file;\n }\n\n getTimestamps() {\n if (Array.isArray(this.originalMetadata?.timestamps)) {\n return (\n this.originalMetadata?.timestamps?.[this.fileIndex] ??\n this.originalMetadata?.timestamps[0]\n );\n }\n return this.originalMetadata?.timestamps;\n }\n\n getPreviewFile(entry) {\n let parts = entry.split(\".\");\n let files = this.getAllFiles();\n if (Array.isArray(files)) {\n if (lib.is_real_number(parts[parts.length - 1])) {\n files = files[parts[parts.length - 1]];\n } else {\n const index = Math.floor(lib.interpolate(0, files.length - 1, 0.5));\n files = files?.[index - 1] ?? files[index];\n }\n }\n return files;\n }\n\n destroy() {\n if (this.originalMetadata?.flipbook) return;\n for (let texture of Object.values(this.fileTextureMap)) {\n if (!texture) continue;\n try {\n texture?.baseTexture?.resource?.source?.removeAttribute(\"src\");\n } catch (err) {}\n try {\n texture?.baseTexture?.resource?.source?.pause();\n } catch (err) {}\n try {\n texture?.baseTexture?.resource?.source?.remove();\n } catch (err) {}\n try {\n texture?.baseTexture?.resource?.source?.load();\n } catch (err) {}\n texture.destroy();\n }\n }\n\n async _getTexture(file) {\n if (this.fileTextureMap[file]) return this.fileTextureMap[file];\n this.fileTextureMap[file] = await SequencerFileCache.loadFile(file);\n return this.fileTextureMap[file];\n }\n\n _adjustScaleForPadding(distance, width) {\n return (\n distance /\n (width - (this.template ? this.template[1] + this.template[2] : 0))\n );\n }\n\n _adjustAnchorForPadding(width) {\n return this.template ? this.template[1] / width : undefined;\n }\n\n async _getFlipBookSheet(filePath) {\n if (!this.originalMetadata?.flipbook) return false;\n if (flipBookTextureCache[filePath]) {\n return flipBookTextureCache[filePath];\n }\n flipBookTextureCache[filePath] = this.file.map((file) => {\n return PIXI.Texture.from(file);\n });\n return flipBookTextureCache[filePath];\n }\n\n async getTexture(distance) {\n const filePath = this.getFile();\n const texture = await this._getTexture(this.getFile());\n const sheet = await this._getFlipBookSheet(filePath);\n return {\n filePath,\n texture,\n sheet,\n spriteScale: this._adjustScaleForPadding(distance, texture.width),\n spriteAnchor: this._adjustAnchorForPadding(texture.width),\n };\n }\n}\n\nexport class SequencerFileRangeFind extends SequencerFile {\n rangeFind = true;\n\n constructor(...args) {\n super(...args);\n this._fileDistanceMap = false;\n }\n\n static get ftToDistanceMap() {\n return {\n \"90ft\": canvas.grid.size * 15,\n \"60ft\": canvas.grid.size * 9,\n \"30ft\": canvas.grid.size * 5,\n \"15ft\": canvas.grid.size * 2,\n \"05ft\": 0,\n };\n }\n\n get _gridSizeDiff() {\n return canvas.grid.size / this.template[0];\n }\n\n getAllFiles() {\n return Object.values(this.file).deepFlatten();\n }\n\n getFile(inFt) {\n if (inFt && this.file[inFt]) {\n if (Array.isArray(this.file[inFt])) {\n const fileIndex = lib.is_real_number(this.fileIndex)\n ? this.fileIndex\n : lib.random_array_element(this.file[inFt], {\n twister: this.twister,\n index: true,\n });\n return this.file[inFt][fileIndex];\n }\n return this.file[inFt];\n }\n\n return this.file;\n }\n\n getPreviewFile(entry) {\n let parts = entry.split(\".\");\n const ft = parts.find(\n (part) =>\n Object.keys(SequencerFileRangeFind.ftToDistanceMap).indexOf(part) > -1\n );\n if (!ft) {\n return super.getPreviewFile(entry);\n }\n const fileIndex = parts.slice(parts.indexOf(ft) + 1)?.[0];\n if (lib.is_real_number(Number(fileIndex))) {\n this.fileIndex = Number(fileIndex);\n }\n return this.getFile(ft);\n }\n\n async getTexture(distance = 400) {\n const { filePath, texture } = await this._getTextureForDistance(distance);\n return {\n filePath,\n texture,\n spriteScale: this._adjustScaleForPadding(distance, texture.width),\n spriteAnchor: this._adjustAnchorForPadding(texture.width),\n };\n }\n\n _getMatchingDistance(inEntry) {\n return SequencerFileRangeFind.ftToDistanceMap[inEntry] / this._gridSizeDiff;\n }\n\n _rangeFind(inDistance) {\n if (!this._fileDistanceMap) {\n let distances = Object.keys(this.file)\n .filter(\n (entry) =>\n Object.keys(SequencerFileRangeFind.ftToDistanceMap).indexOf(entry) >\n -1\n )\n .map((ft) => {\n return {\n file: this.getFile(ft),\n minDistance: this._getMatchingDistance(ft),\n };\n });\n\n let uniqueDistances = [\n ...new Set(distances.map((item) => item.minDistance)),\n ];\n uniqueDistances.sort((a, b) => a - b);\n\n let max = Math.max(...uniqueDistances);\n let min = Math.min(...uniqueDistances);\n\n this._fileDistanceMap = distances.map((entry) => {\n entry.distances = {\n min: entry.minDistance === min ? 0 : entry.minDistance,\n max:\n entry.minDistance === max\n ? Infinity\n : uniqueDistances[uniqueDistances.indexOf(entry.minDistance) + 1],\n };\n return entry;\n });\n }\n\n const possibleFiles = this._fileDistanceMap\n .filter((entry) => {\n const relativeDistance = inDistance / this._gridSizeDiff;\n return (\n relativeDistance >= entry.distances.min &&\n relativeDistance < entry.distances.max\n );\n })\n .map((entry) => entry.file)\n .flat();\n\n return possibleFiles.length > 1\n ? lib.random_array_element(possibleFiles, { twister: this.twister })\n : possibleFiles[0];\n }\n\n async _getTextureForDistance(distance) {\n const filePath = this._rangeFind(distance);\n const texture = await this._getTexture(filePath);\n return { filePath, texture };\n }\n}\n\nexport class SequencerFileProxy extends SequencerFileBase {\n constructor(dbPath, entry) {\n super();\n let sequencerEntry = false;\n return new Proxy(this, {\n get(target, prop) {\n // Return the proxy's property if it has it\n if (prop === \"dbPath\") return dbPath;\n if (!sequencerEntry) {\n sequencerEntry = Sequencer.Database.getEntry(entry);\n }\n // If the path results in an array, grab a random element every time\n if (Array.isArray(this.entry)) {\n return Reflect.get(lib.random_array_element(sequencerEntry), prop);\n }\n return Reflect.get(sequencerEntry, prop);\n },\n });\n }\n}\n","import * as lib from \"../lib/lib.js\";\nimport LoadingBar from \"../utils/loadingBar.js\";\nimport { SequencerFile, SequencerFileBase } from \"./sequencer-file.js\";\nimport { writable, get } from \"svelte/store\";\nimport CONSTANTS from \"../constants.js\";\n\nclass Database {\n #entriesStore = writable({});\n\n privateModules = [];\n flattenedEntries = [];\n inverseFlattenedEntries = new Map();\n\n get entries() {\n return get(this.#entriesStore);\n }\n set entries(entries) {\n this.#entriesStore.set(entries);\n }\n get entriesStore() {\n return this.#entriesStore;\n }\n\n get publicModules() {\n return Object.keys(this.entries).filter(\n (module) => !this.privateModules.includes(module)\n );\n }\n\n get publicFlattenedEntries() {\n return this.flattenedEntries.filter((entry) => {\n return this.privateModules.indexOf(entry.split(\".\")[0]) === -1;\n });\n }\n\n get publicFlattenedSimpleEntries() {\n return lib.make_array_unique(\n this.publicFlattenedEntries.map((entry) => {\n return entry.split(CONSTANTS.FEET_REGEX)[0];\n })\n );\n }\n\n /**\n * Retrieves an object of every public entry\n *\n * @return {object}\n */\n get filePathDatabasePaths() {\n const fileDatabaseObject = {};\n Object.entries(this.entries)\n .map((entry) => entry[1])\n .deepFlatten()\n .forEach((sequencerFile) => {\n if (sequencerFile?.rangeFind) {\n Object.entries(sequencerFile.file).forEach((entry) => {\n fileDatabaseObject[entry[1]] =\n sequencerFile.dbPath + \".\" + entry[0];\n });\n } else {\n fileDatabaseObject[sequencerFile.file] = sequencerFile.dbPath;\n }\n });\n return fileDatabaseObject;\n }\n\n /**\n * Registers a set of entries to the database on the given module name\n *\n * @param {string} inModuleName The namespace to assign to the inserted entries\n * @param {object} inEntries The entries to merge into the database\n * @param {boolean} isPrivate Whether to mark these entries as private and not show in Effect Player or Database Viewer\n * @return {boolean}\n */\n registerEntries(inModuleName, inEntries, isPrivate = false) {\n if (inModuleName.includes(\".\"))\n return this._throwError(\n \"registerEntries\",\n \"module name must not contain periods\"\n );\n if (this.entries[inModuleName])\n lib.custom_warning(\n \"Sequencer\",\n `registerEntries | module \"${inModuleName}\" has already been registered to the database! Do you have two similar modules active?`,\n true\n );\n this._flatten(inEntries, inModuleName);\n const processedEntries = this._processEntries(inModuleName, inEntries);\n this.entries = foundry.utils.mergeObject(this.entries, {\n [inModuleName]: processedEntries,\n });\n if (isPrivate) this.privateModules.push(inModuleName);\n console.log(\n `Sequencer | Database | Entries for \"${inModuleName}\" registered`\n );\n Hooks.callAll(\"registerSequencerDatabaseEntries\", inModuleName);\n return true;\n }\n\n /**\n * Validates the entries under a certain module name, checking whether paths to assets are correct or not\n *\n * @param {string} inModuleName The namespace to assign to the inserted entries\n * @return {boolean}\n */\n async validateEntries(inModuleName) {\n let entries = this.getEntry(inModuleName);\n if (!Array.isArray(entries)) {\n entries = [entries];\n }\n ui.notifications.info(\n `Validating paths registered to \"${inModuleName}\"...`\n );\n let isValid = true;\n LoadingBar.init(\n `Validating paths registered to \"${inModuleName}\"...`,\n entries.length\n );\n for (let entry of entries) {\n const result = await entry.validate();\n LoadingBar.incrementProgress();\n isValid = !(!result || !isValid);\n }\n if (!isValid) {\n ui.notifications.error(\n `Validation of paths registered to \"${inModuleName}\" failed! Errors logged in console.`\n );\n } else {\n ui.notifications.info(\n `Validation of paths registered to \"${inModuleName}\" complete! No errors found!`\n );\n }\n }\n\n /**\n * Quickly checks if the entry exists in the database\n *\n * @param {string} inString The entry to find in the database\n * @return {boolean} If the entry exists in the database\n */\n entryExists(inString) {\n if (typeof inString !== \"string\")\n return this._throwError(\"entryExists\", \"inString must be of type string\");\n inString = inString.trim();\n if (inString === \"\")\n return this._throwError(\"entryExists\", \"inString cannot be empty\");\n inString = inString.replace(/\\[[0-9]+]$/, \"\");\n return this.flattenedEntries.find((entry) => entry.startsWith(inString));\n }\n\n /**\n * Gets the entry in the database by a dot-notated string\n *\n * @param {string} inString The entry to find in the database\n * @param {boolean} softFail Whether it should soft fail (no error) when no entry was found\n * @return {array|SequencerFile|boolean} The found entry in the database, or false if not found (with warning)\n */\n getEntry(inString, { softFail = false } = {}) {\n if (typeof inString !== \"string\") {\n if (softFail) return false;\n return this._throwError(\"getEntry\", \"inString must be of type string\");\n }\n inString = inString.trim();\n if (inString === \"\") {\n if (softFail) return false;\n return this._throwError(\"getEntry\", \"inString cannot be empty\");\n }\n inString = inString.replace(/\\[[0-9]+]$/, \"\");\n if (!this.entryExists(inString)) {\n if (softFail) return false;\n return this._throwError(\n \"getEntry\",\n `Could not find ${inString} in database`\n );\n }\n\n let ft = false;\n let index = false;\n if (CONSTANTS.FEET_REGEX.test(inString)) {\n ft = inString.match(CONSTANTS.FEET_REGEX)[0];\n const split = inString.split(ft).filter((str) => str !== \"\");\n if (split.length > 1) {\n index = split[1].split(\".\")[0];\n }\n inString = split[0];\n }\n\n const module = inString.split(\".\")[0];\n const exactEntries = this.entries[module].filter((entry) => {\n return entry.dbPath === inString;\n });\n\n let filteredEntries = (\n exactEntries.length\n ? exactEntries\n : this.entries[module].filter((entry) => {\n return entry.dbPath.startsWith(inString);\n })\n ).map((entry) => {\n let foundFile = entry;\n if (ft) foundFile = entry.file?.[ft] ?? foundFile;\n if (index) foundFile = foundFile?.[index] ?? foundFile;\n return foundFile;\n });\n\n if (!filteredEntries.length)\n return this._throwError(\n \"getEntry\",\n `Could not find ${inString} in database`\n );\n\n const foundEntry =\n filteredEntries.length === 1 ? filteredEntries[0] : filteredEntries;\n\n if (index && filteredEntries.length === 1) {\n foundEntry.fileIndex = Number(index);\n }\n\n return foundEntry;\n }\n\n /**\n * Gets all files under a database path\n *\n * @param {string} inDBPath The module to get all files from\n * @return {array|boolean} The found entries in the database under the module's name, or false if not found (with warning)\n */\n getAllFileEntries(inDBPath) {\n if (typeof inDBPath !== \"string\")\n return this._throwError(\n \"getAllFileEntries\",\n \"inDBPath must be of type string\"\n );\n inDBPath = inDBPath.trim();\n if (inDBPath === \"\")\n return this._throwError(\"getAllFileEntries\", \"inDBPath cannot be empty\");\n if (!this.entryExists(inDBPath))\n return this._throwError(\n \"getAllFileEntries\",\n `Could not find ${inDBPath} in database`\n );\n const entries = this._recurseGetFilePaths(inDBPath);\n return lib.make_array_unique(entries.flat());\n }\n\n /**\n * Get all valid entries under a certain path\n *\n * @param {string} inPath The database path to get entries under\n * @return {array|boolean} An array containing the next layer of valid paths\n */\n getPathsUnder(\n inPath,\n { ranges = false, arrays = false, match = false } = {}\n ) {\n if (typeof inPath !== \"string\")\n return this._throwError(\"getPathsUnder\", \"inPath must be of type string\");\n inPath = inPath.trim();\n if (inPath === \"\")\n return this._throwError(\"getPathsUnder\", \"inPath cannot be empty\");\n inPath = inPath.replace(/\\[[0-9]+]$/, \"\");\n if (!this.entryExists(inPath))\n return this._throwError(\n \"getPathsUnder\",\n `Could not find ${inPath} in database`\n );\n let entries = this.flattenedEntries.filter((e) => {\n return (\n (e.startsWith(inPath + \".\") || e === inPath) &&\n (!match || (match && e.match(match)))\n );\n });\n if (entries.length === 0) return [];\n return lib.make_array_unique(\n entries\n .map((e) => (!arrays ? e.split(CONSTANTS.ARRAY_REGEX)[0] : e))\n .map((e) => (!ranges ? e.split(CONSTANTS.FEET_REGEX)[0] : e))\n .map((e) => e.split(inPath)[1])\n .map((e) => (e ? e.split(\".\")[1] : \"\"))\n .filter(Boolean)\n );\n }\n\n /**\n * Get all valid entries under a certain path\n *\n * @param {string} inPath The database path to search for\n * @param {boolean} publicOnly Whether to only search for public modules\n * @return {array|boolean} An array containing potential database paths\n */\n searchFor(inPath, publicOnly = true) {\n const modules = publicOnly ? this.publicModules : Object.keys(this.entries);\n const originalEntries = publicOnly\n ? this.publicFlattenedEntries\n : this.flattenedEntries;\n\n if ((!inPath || inPath === \"\") && !modules.includes(inPath)) return modules;\n\n if (typeof inPath !== \"string\") {\n return this._throwError(\"searchFor\", \"inString must be of type string\");\n }\n\n inPath = inPath.trim();\n\n if (inPath === \"\")\n return this._throwError(\"searchFor\", \"inString cannot be empty\");\n\n inPath = inPath.replace(/\\[[0-9]+]$/, \"\");\n inPath = inPath.trim();\n\n let entries = originalEntries.filter(\n (e) => e.startsWith(inPath) && e !== inPath\n );\n\n if (inPath.endsWith(\".\")) inPath = inPath.substring(0, inPath.length - 1);\n let length = inPath.split(\".\").length + 1;\n let foundEntries = entries.map((e) => {\n let path = e.split(CONSTANTS.FEET_REGEX)[0];\n return path.split(\".\").slice(0, length).join(\".\");\n });\n\n if (foundEntries.length === 0) {\n const regexString = lib\n .str_to_search_regex_str(inPath)\n .replace(/\\s+/g, \"|\");\n const searchParts = regexString.split(\"|\").length;\n const regexSearch = new RegExp(regexString, \"gu\");\n foundEntries = originalEntries\n .filter((e) => {\n return e.match(regexSearch)?.length >= searchParts;\n })\n .map((e) => {\n return e.split(CONSTANTS.FEET_REGEX)[0];\n });\n }\n\n return lib.make_array_unique(foundEntries);\n }\n\n /**\n * Throws an error without THROWING one. Duh.\n *\n * @param inFunctionName\n * @param inError\n * @returns {boolean}\n * @private\n */\n _throwError(inFunctionName, inError) {\n let error = `Sequencer | Database | ${inFunctionName} - ${inError}`;\n ui.notifications.error(error);\n return false;\n }\n\n /**\n * Gets all file paths from the entirety of\n *\n * @param inDBPath\n * @returns {Array}\n * @private\n */\n _recurseGetFilePaths(inDBPath) {\n const module = inDBPath.split(\".\")[0];\n return this.entries[module]\n .filter((entry) => entry.dbPath.startsWith(inDBPath))\n .map((entry) => {\n return entry.getAllFiles();\n })\n .flat();\n }\n\n /**\n * Flattens a given object to just their db path and file path\n *\n * @param entries\n * @param inModule\n * @private\n */\n _flatten(entries, inModule) {\n let flattened = lib.flatten_object(\n foundry.utils.duplicate({ [inModule]: entries })\n );\n this.flattenedEntries = lib.make_array_unique(\n this.flattenedEntries.concat(\n Object.keys(flattened).map((file) => file.split(\".file\")[0])\n )\n );\n this.inverseFlattenedEntries = Object.keys(flattened).reduce(\n (acc, entry) => {\n return acc.set(flattened[entry], entry.split(\".file\")[0]);\n },\n this.inverseFlattenedEntries\n );\n }\n\n /**\n * Processes and recurse into a large object containing file paths at any given depth\n *\n * @param moduleName\n * @param entries\n * @returns {object}\n * @private\n */\n _processEntries(moduleName, entries) {\n const allPaths = new Set(\n this.flattenedEntries\n .filter((e) => e.split(\".\")[0] === moduleName)\n .map((e) => e.split(CONSTANTS.FEET_REGEX)[0])\n );\n\n const allTemplates = foundry.utils.mergeObject(entries?._templates ?? {}, {\n default: [100, 0, 0],\n });\n\n if (entries?._templates) {\n delete entries?._templates;\n }\n\n const moduleEntries = [];\n\n const mediaFileExtensions = Object.keys(CONST.FILE_CATEGORIES.IMAGE)\n .concat(Object.keys(CONST.FILE_CATEGORIES.VIDEO))\n .concat(Object.keys(CONST.FILE_CATEGORIES.AUDIO));\n\n for (let wholeDBPath of allPaths) {\n let metadata = this._getCleanData(entries);\n let dbPath = wholeDBPath.split(\".\");\n dbPath.shift();\n let combinedPath = \"\";\n for (let part of dbPath) {\n combinedPath = combinedPath ? combinedPath + \".\" + part : part;\n const entry = getProperty(entries, combinedPath);\n if (Array.isArray(entry) || typeof entry === \"string\" || entry?.file) {\n metadata = this._getCleanData(entry, { existingData: metadata });\n break;\n }\n metadata = this._getCleanData(entry, { existingData: metadata });\n }\n\n if (!metadata.template) metadata.template = \"default\";\n if (typeof metadata.template === \"string\") {\n metadata.template =\n allTemplates?.[metadata.template] ?? allTemplates?.[\"default\"];\n }\n\n let data = getProperty(entries, dbPath.join(\".\"));\n if (!Array.isArray(data) && !(typeof data === \"string\")) {\n data = this._getCleanData(data, { metadata: false });\n }\n\n if (typeof data === \"string\") {\n const existingEntry = this.entryExists(data);\n const extension = data\n .split(\".\")\n [data.split(\".\").length - 1].toLowerCase();\n\n if (\n !existingEntry &&\n extension &&\n !mediaFileExtensions.includes(extension)\n ) {\n console.warn(\n `Sequencer | Database | registerEntries - failed to register ${wholeDBPath} to ${data}!`\n );\n this.flattenedEntries.splice(\n this.flattenedEntries.indexOf(wholeDBPath),\n 1\n );\n continue;\n } else if (existingEntry) {\n moduleEntries.push(new SequencerFileProxy(wholeDBPath, data));\n continue;\n }\n }\n\n moduleEntries.push(SequencerFileBase.make(data, wholeDBPath, metadata));\n }\n\n return moduleEntries;\n }\n\n _getCleanData(data, { existingData = {}, metadata = true } = {}) {\n data = Object.entries(data).filter((entry) => {\n return metadata === entry[0].startsWith(\"_\");\n });\n if (metadata) {\n data = data.map((entry) => [entry[0].slice(1), entry[1]]);\n }\n return foundry.utils.mergeObject(existingData, Object.fromEntries(data));\n }\n}\n\nconst SequencerDatabase = new Database();\n\nexport default SequencerDatabase;\n","\r\n\r\n\r\n\r\n\r\n","\r\n\r\n
\r\n","import SequencerDatabase from \"../../modules/sequencer-database.js\";\nimport { SequencerFileBase } from \"../../modules/sequencer-file.js\";\nimport CONSTANTS from \"../../constants.js\";\nimport * as lib from \"../../lib/lib.js\";\nimport { writable, get } from \"svelte/store\";\nimport TreeViewEntry from \"./TreeViewEntry.svelte\";\nimport TreeViewSeparator from \"./TreeViewSeparator.svelte\";\n\nlet lastFile = false;\n\nfunction getFileData(entryText) {\n let entry = SequencerDatabase.getEntry(entryText);\n\n if (Array.isArray(entry)) {\n if (entry.includes(lastFile) && entry.length > 1) {\n entry.splice(entry.indexOf(lastFile), 1);\n }\n entry = lib.random_array_element(entry);\n lastFile = entry;\n }\n\n let previewFile = entry?.file ?? entry;\n if (entry instanceof SequencerFileBase) {\n previewFile = entry.clone().getPreviewFile(entryText);\n }\n\n let lowerCaseEntry = previewFile ? previewFile.toLowerCase() : \"unknown.jpg\";\n\n const isAudio =\n lowerCaseEntry.endsWith(\"ogg\") ||\n lowerCaseEntry.endsWith(\"mp3\") ||\n lowerCaseEntry.endsWith(\"wav\");\n const isImage = !lowerCaseEntry.endsWith(\"webm\") && !isAudio;\n const isVideo = !isAudio && !isImage;\n const icon = previewFile\n ? isVideo\n ? \"fa-film\"\n : isAudio\n ? \"fa-volume-high\"\n : \"fa-image\"\n : \"fa-question-mark\";\n const title = previewFile\n ? isVideo\n ? \"Animated WebM\"\n : isAudio\n ? \"Audio\"\n : \"Image\"\n : \"Unknown\";\n\n return {\n file: previewFile ?? \"unknown.jpg\",\n dbEntry: entry,\n icon,\n title,\n isAudio,\n isImage,\n isVideo,\n };\n}\n\nfunction copyPath(dbPath, getFilepath, quotes = false) {\n const tempInput = document.createElement(\"input\");\n tempInput.value = `${dbPath}`;\n\n let entry;\n if (getFilepath) {\n entry = Sequencer.Database.getEntry(dbPath);\n\n if (entry instanceof SequencerFileBase) {\n const specificFt = dbPath.match(CONSTANTS.FEET_REGEX);\n if (specificFt) {\n const ft = specificFt[0].replaceAll(\".\", \"\");\n entry = entry.getFile(ft);\n } else {\n const files = entry.getAllFiles();\n if (Array.isArray(files)) {\n const index = Math.floor(lib.interpolate(0, files.length - 1, 0.5));\n entry = files[index];\n }\n }\n }\n\n tempInput.value = `${entry?.file ?? entry}`;\n }\n\n if (quotes) {\n tempInput.value = `\"${tempInput.value}\"`;\n }\n\n document.body.appendChild(tempInput);\n tempInput.select();\n document.execCommand(\"copy\");\n document.body.removeChild(tempInput);\n document.execCommand(\"copy\");\n}\n\nfunction playFile(entry) {\n const { file, isAudio, isImage, isVideo } = getFileData(entry);\n\n databaseStore.elements.audio.classList.toggle(\"hidden\", !isAudio);\n databaseStore.elements.image.classList.toggle(\"hidden\", !isImage);\n databaseStore.elements.player.classList.toggle(\"hidden\", !isVideo);\n\n if (isImage) {\n databaseStore.elements.image.src = file;\n databaseStore.metadata.set({\n type: \"Image\",\n duration: \"n/a\",\n });\n return;\n }\n\n const element = isAudio\n ? databaseStore.elements.audio\n : databaseStore.elements.player;\n\n element.onerror = () => {\n const error = `Sequencer Database Viewer | Could not play file: ${file}`;\n ui.notifications.error(error);\n console.error(error);\n };\n\n element.oncanplay = () => {\n element.play();\n };\n\n element.onloadedmetadata = () => {\n databaseStore.metadata.set({\n type: isVideo ? \"Video\" : isAudio ? \"Audio\" : \"Image\",\n duration: isImage ? \"n/a\" : element.duration * 1000 + \"ms\",\n });\n };\n\n element.src = file;\n}\n\nconst treeStore = writable({});\nconst visibleTreeStore = writable([]);\nlet flattenedEntries = [];\nconst entriesStore = SequencerDatabase.entriesStore;\nconst packStore = writable(SequencerDatabase.publicModules);\nconst selectedPackStore = writable(\"all\");\nconst searchStore = writable(\"\");\nconst cleanSearchStore = writable(\"\");\nconst searchRegexStore = writable(new RegExp(\"\", \"gu\"));\n\nSequencerDatabase.entriesStore.subscribe(() => {\n packStore.set(SequencerDatabase.publicModules);\n});\n\nconst databaseStore = {\n metadata: writable(false),\n allRanges: writable(false),\n subLists: writable(false),\n listView: writable(false),\n packStore: packStore,\n selectedPackStore: selectedPackStore,\n visibleTreeStore: visibleTreeStore,\n search: searchStore,\n cleanSearchStore: cleanSearchStore,\n searchRegex: searchRegexStore,\n elements: {},\n copyPath,\n playFile,\n openTreePath,\n};\n\nentriesStore.subscribe(() => {\n filterFlattenedEntries();\n});\n\ndatabaseStore.allRanges.subscribe(() => {\n filterFlattenedEntries();\n});\n\ndatabaseStore.subLists.subscribe(() => {\n filterFlattenedEntries();\n});\n\ndatabaseStore.selectedPackStore.subscribe(() => {\n filterFlattenedEntries();\n});\n\nsearchStore.subscribe((val) => {\n const cleanSearch = lib.str_to_search_regex_str(val).replace(/\\s+/g, \"|\");\n cleanSearchStore.set(cleanSearch);\n searchRegexStore.set(new RegExp(cleanSearch, \"gu\"));\n updateVisualTree();\n});\n\nfunction filterFlattenedEntries() {\n const selectedPack = get(selectedPackStore);\n const search = get(searchStore);\n const searchRegex = get(searchRegexStore);\n const subLists = get(databaseStore.subLists);\n const allRanges = get(databaseStore.allRanges);\n flattenedEntries = lib.make_array_unique(\n SequencerDatabase.publicFlattenedEntries\n .filter((e) => {\n return (\n (selectedPack === \"all\" || e.startsWith(selectedPack + \".\")) &&\n (!search || e.match(searchRegex))\n );\n })\n .map((e) => (!subLists ? e.split(CONSTANTS.ARRAY_REGEX)[0] : e))\n .map((e) => (!allRanges ? e.split(CONSTANTS.FEET_REGEX)[0] : e))\n );\n treeStore.set(\n flattenedEntries.reduce((acc, entry) => {\n let path = \"\";\n for (const part of entry.split(\".\")) {\n const fullPath = path ? path + \".\" + part : part;\n path = path ? path + \".children.\" + part : part;\n if (!getProperty(acc, path)) {\n setProperty(\n acc,\n path,\n foundry.utils.mergeObject(\n {\n path: part,\n fullPath,\n open: false,\n children: {},\n },\n getProperty(acc, path)\n )\n );\n }\n }\n return acc;\n }, {})\n );\n}\n\nfunction openTreePath(fullPath, open, openAll = false) {\n treeStore.update((tree) => {\n const fullTreePath = fullPath.split(\".\").join(\".children.\");\n const node = getProperty(tree, fullTreePath);\n setProperty(tree, fullTreePath + \".open\", open);\n if ((!open || openAll) && !foundry.utils.isEmpty(node.children)) {\n recurseOpenTree(node.children, open);\n }\n return tree;\n });\n}\n\nfunction recurseOpenTree(children, open) {\n for (const node of Object.values(children)) {\n node.open = open;\n if (!foundry.utils.isEmpty(node.children)) {\n recurseOpenTree(node.children, open);\n }\n }\n}\n\ntreeStore.subscribe(() => {\n updateVisualTree();\n});\n\nfunction updateVisualTree() {\n const tree = get(treeStore);\n const visibleTree = recurseTree(tree)\n .deepFlatten()\n .filter((e) => e.visible);\n visibleTreeStore.set(visibleTree);\n}\n\nfunction recurseTree(tree, path = \"\", depth = 0) {\n const search = get(searchStore);\n const searchRegex = get(searchRegexStore);\n const searchParts = get(cleanSearchStore).split(\"|\");\n return Object.entries(tree).map(([key, data]) => {\n const fullPath = path ? path + \".\" + key : key;\n\n const children = recurseTree(\n data.children,\n fullPath,\n depth + 1\n ).deepFlatten();\n\n const matchParts = lib.make_array_unique(fullPath.match(searchRegex) || []);\n const open =\n data.open ||\n (search &&\n (matchParts.length >= searchParts.length ||\n children.filter((e) => e.visible).length));\n let visible = !search || matchParts.length >= searchParts.length;\n\n if (visible) {\n children.forEach((e) => (e.visible = true));\n } else {\n visible = children.filter((e) => e.visible).length;\n }\n\n const entry = {\n class: TreeViewEntry,\n path: key,\n fullPath: fullPath,\n open,\n visible,\n hasChildren: !foundry.utils.isEmpty(data.children),\n depth,\n };\n\n const leaf = [entry];\n if ((data.open || entry.open) && entry.hasChildren) {\n leaf.push(...children, {\n fullPath: randomID(),\n class: TreeViewSeparator,\n });\n }\n return leaf;\n });\n}\n\nexport { databaseStore };\n","\r\n\r\n\r\n\t\r\n\t\r\n\t\r\n\r\n\t
\r\n\t\t
{@html highlight}
\r\n\t\t{entry}\r\n\t
\r\n\r\n\r\n\r\n","/**\r\n * virtual list core calculating center\r\n */\r\n\r\nconst DIRECTION_TYPE = {\r\n FRONT: \"FRONT\", // scroll up or left\r\n BEHIND: \"BEHIND\", // scroll down or right\r\n}\r\nconst CALC_TYPE = {\r\n INIT: \"INIT\",\r\n FIXED: \"FIXED\",\r\n DYNAMIC: \"DYNAMIC\",\r\n}\r\nconst LEADING_BUFFER = 2\r\n\r\nexport default class {\r\n param\r\n callUpdate\r\n firstRangeTotalSize = 0\r\n firstRangeAverageSize = 0\r\n lastCalcIndex = 0\r\n fixedSizeValue = 0\r\n calcType = CALC_TYPE.INIT\r\n offset = 0\r\n direction = \"\"\r\n range\r\n\r\n constructor(param, callUpdate) {\r\n this.init(param, callUpdate)\r\n }\r\n\r\n init(param, callUpdate) {\r\n // param data\r\n this.param = param\r\n this.callUpdate = callUpdate\r\n\r\n // size data\r\n this.sizes = new Map()\r\n this.firstRangeTotalSize = 0\r\n this.firstRangeAverageSize = 0\r\n this.lastCalcIndex = 0\r\n this.fixedSizeValue = 0\r\n this.calcType = CALC_TYPE.INIT\r\n\r\n // scroll data\r\n this.offset = 0\r\n this.direction = \"\"\r\n\r\n // range data\r\n this.range = Object.create(null)\r\n if (param) {\r\n this.checkRange(0, param.keeps - 1)\r\n }\r\n\r\n // benchmark example data\r\n // this.__bsearchCalls = 0\r\n // this.__getIndexOffsetCalls = 0\r\n }\r\n\r\n destroy() {\r\n this.init(null, null)\r\n }\r\n\r\n // return current render range\r\n getRange() {\r\n const range = Object.create(null)\r\n range.start = this.range.start\r\n range.end = this.range.end\r\n range.padFront = this.range.padFront\r\n range.padBehind = this.range.padBehind\r\n return range\r\n }\r\n\r\n isBehind() {\r\n return this.direction === DIRECTION_TYPE.BEHIND\r\n }\r\n\r\n isFront() {\r\n return this.direction === DIRECTION_TYPE.FRONT\r\n }\r\n\r\n // return start index offset\r\n getOffset(start) {\r\n return (start < 1 ? 0 : this.getIndexOffset(start)) + this.param.slotHeaderSize\r\n }\r\n\r\n updateParam(key, value) {\r\n if (this.param && (key in this.param)) {\r\n // if uniqueIds change, find out deleted id and remove from size map\r\n if (key === \"uniqueIds\") {\r\n this.sizes.forEach((v, key) => {\r\n if (!value.includes(key)) {\r\n this.sizes.delete(key)\r\n }\r\n })\r\n }\r\n this.param[key] = value\r\n }\r\n }\r\n\r\n // save each size map by id\r\n saveSize(id, size) {\r\n this.sizes.set(id, size)\r\n\r\n // we assume size type is fixed at the beginning and remember first size value\r\n // if there is no size value different from this at next coming saving\r\n // we think it's a fixed size list, otherwise is dynamic size list\r\n if (this.calcType === CALC_TYPE.INIT) {\r\n this.fixedSizeValue = size\r\n this.calcType = CALC_TYPE.FIXED\r\n } else if (this.calcType === CALC_TYPE.FIXED && this.fixedSizeValue !== size) {\r\n this.calcType = CALC_TYPE.DYNAMIC\r\n // it's no use at all\r\n delete this.fixedSizeValue\r\n }\r\n\r\n // calculate the average size only in the first range\r\n if (this.calcType !== CALC_TYPE.FIXED && typeof this.firstRangeTotalSize !== \"undefined\") {\r\n if (this.sizes.size < Math.min(this.param.keeps, this.param.uniqueIds.length)) {\r\n this.firstRangeTotalSize = [...this.sizes.values()].reduce((acc, val) => acc + val, 0)\r\n this.firstRangeAverageSize = Math.round(this.firstRangeTotalSize / this.sizes.size)\r\n } else {\r\n // it's done using\r\n delete this.firstRangeTotalSize\r\n }\r\n }\r\n }\r\n\r\n // in some special situation (e.g. length change) we need to update in a row\r\n // try going to render next range by a leading buffer according to current direction\r\n handleDataSourcesChange() {\r\n let start = this.range.start\r\n\r\n if (this.isFront()) {\r\n start = start - LEADING_BUFFER\r\n } else if (this.isBehind()) {\r\n start = start + LEADING_BUFFER\r\n }\r\n\r\n start = Math.max(start, 0)\r\n\r\n this.updateRange(this.range.start, this.getEndByStart(start))\r\n }\r\n\r\n // when slot size change, we also need force update\r\n handleSlotSizeChange() {\r\n this.handleDataSourcesChange()\r\n }\r\n\r\n // calculating range on scroll\r\n handleScroll(offset) {\r\n this.direction = offset < this.offset ? DIRECTION_TYPE.FRONT : DIRECTION_TYPE.BEHIND\r\n this.offset = offset\r\n\r\n if (!this.param) {\r\n return\r\n }\r\n\r\n if (this.direction === DIRECTION_TYPE.FRONT) {\r\n this.handleFront()\r\n } else if (this.direction === DIRECTION_TYPE.BEHIND) {\r\n this.handleBehind()\r\n }\r\n }\r\n\r\n // ----------- public method end -----------\r\n\r\n handleFront() {\r\n const overs = this.getScrollOvers()\r\n // should not change range if start doesn't exceed overs\r\n if (overs > this.range.start) {\r\n return\r\n }\r\n\r\n // move up start by a buffer length, and make sure its safety\r\n const start = Math.max(overs - this.param.buffer, 0)\r\n this.checkRange(start, this.getEndByStart(start))\r\n }\r\n\r\n handleBehind() {\r\n const overs = this.getScrollOvers()\r\n // range should not change if scroll overs within buffer\r\n if (overs < this.range.start + this.param.buffer) {\r\n return\r\n }\r\n\r\n this.checkRange(overs, this.getEndByStart(overs))\r\n }\r\n\r\n // return the pass overs according to current scroll offset\r\n getScrollOvers() {\r\n // if slot header exist, we need subtract its size\r\n const offset = this.offset - this.param.slotHeaderSize\r\n if (offset <= 0) {\r\n return 0\r\n }\r\n\r\n // if is fixed type, that can be easily\r\n if (this.isFixedType()) {\r\n return Math.floor(offset / this.fixedSizeValue)\r\n }\r\n\r\n let low = 0\r\n let middle = 0\r\n let middleOffset = 0\r\n let high = this.param.uniqueIds.length\r\n\r\n while (low <= high) {\r\n // this.__bsearchCalls++\r\n middle = low + Math.floor((high - low) / 2)\r\n middleOffset = this.getIndexOffset(middle)\r\n\r\n if (middleOffset === offset) {\r\n return middle\r\n } else if (middleOffset < offset) {\r\n low = middle + 1\r\n } else if (middleOffset > offset) {\r\n high = middle - 1\r\n }\r\n }\r\n\r\n return low > 0 ? --low : 0\r\n }\r\n\r\n // return a scroll offset from given index, can efficiency be improved more here?\r\n // although the call frequency is very high, its only a superposition of numbers\r\n getIndexOffset(givenIndex) {\r\n if (!givenIndex) {\r\n return 0\r\n }\r\n\r\n let offset = 0\r\n let indexSize = 0\r\n for (let index = 0; index < givenIndex; index++) {\r\n // this.__getIndexOffsetCalls++\r\n indexSize = this.sizes.get(this.param.uniqueIds[index])\r\n offset = offset + (typeof indexSize === \"number\" ? indexSize : this.getEstimateSize())\r\n }\r\n\r\n // remember last calculate index\r\n this.lastCalcIndex = Math.max(this.lastCalcIndex, givenIndex - 1)\r\n this.lastCalcIndex = Math.min(this.lastCalcIndex, this.getLastIndex())\r\n\r\n return offset\r\n }\r\n\r\n // is fixed size type\r\n isFixedType() {\r\n return this.calcType === CALC_TYPE.FIXED\r\n }\r\n\r\n // return the real last index\r\n getLastIndex() {\r\n return this.param.uniqueIds.length - 1\r\n }\r\n\r\n // in some conditions range is broke, we need correct it\r\n // and then decide whether need update to next range\r\n checkRange(start, end) {\r\n const keeps = this.param.keeps\r\n const total = this.param.uniqueIds.length\r\n\r\n // data less than keeps, render all\r\n if (total <= keeps) {\r\n start = 0\r\n end = this.getLastIndex()\r\n } else if (end - start < keeps - 1) {\r\n // if range length is less than keeps, correct it base on end\r\n start = end - keeps + 1\r\n }\r\n\r\n if (this.range.start !== start) {\r\n this.updateRange(start, end)\r\n }\r\n }\r\n\r\n // setting to a new range and rerender\r\n updateRange(start, end) {\r\n this.range.start = start\r\n this.range.end = end\r\n this.range.padFront = this.getPadFront()\r\n this.range.padBehind = this.getPadBehind()\r\n this.callUpdate(this.getRange())\r\n }\r\n\r\n // return end base on start\r\n getEndByStart(start) {\r\n const theoryEnd = start + this.param.keeps - 1\r\n const truelyEnd = Math.min(theoryEnd, this.getLastIndex())\r\n return truelyEnd\r\n }\r\n\r\n // return total front offset\r\n getPadFront() {\r\n if (this.isFixedType()) {\r\n return this.fixedSizeValue * this.range.start\r\n } else {\r\n return this.getIndexOffset(this.range.start)\r\n }\r\n }\r\n\r\n // return total behind offset\r\n getPadBehind() {\r\n const end = this.range.end\r\n const lastIndex = this.getLastIndex()\r\n\r\n if (this.isFixedType()) {\r\n return (lastIndex - end) * this.fixedSizeValue\r\n }\r\n\r\n // if it's all calculated, return the exactly offset\r\n if (this.lastCalcIndex === lastIndex) {\r\n return this.getIndexOffset(lastIndex) - this.getIndexOffset(end)\r\n } else {\r\n // if not, use a estimated value\r\n return (lastIndex - end) * this.getEstimateSize()\r\n }\r\n }\r\n\r\n // get the item estimate size\r\n getEstimateSize() {\r\n return this.isFixedType() ? this.fixedSizeValue : (this.firstRangeAverageSize || this.param.estimateSize)\r\n }\r\n}\r\n","\r\n\r\n
\r\n \r\n
\r\n","\r\n\r\n
\r\n {#if $$slots.header}\r\n \r\n \r\n \r\n {/if}\r\n
\r\n {#each displayItems as dataItem (dataItem[key])}\r\n \r\n \r\n \r\n {/each}\r\n
\r\n {#if $$slots.footer}\r\n \r\n \r\n \r\n {/if}\r\n
\r\n
\r\n","\r\n\r\n\r\n\r\n\r\n\r\n\t
\r\n\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t
\r\n\r\n\t\t
\r\n\r\n\t\t\t{#if $listView}\r\n
\r\n \r\n \r\n \r\n
\r\n\t\t\t{:else}\r\n
\r\n \r\n \r\n \r\n
\r\n\t\t\t{/if}\r\n\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t
\r\n\r\n\t\t
\r\n\r\n\t
\r\n\r\n
\r\n\r\n\r\n","import { SvelteApplication } from \"@typhonjs-fvtt/runtime/svelte/application\";\nimport DatabaseShell from \"./database-shell.svelte\";\n\nexport class DatabaseViewerApp extends SvelteApplication {\n static get defaultOptions() {\n return foundry.utils.mergeObject(super.defaultOptions, {\n title: game.i18n.localize(\"SEQUENCER.Database.Title\"),\n classes: [\"dialog\"],\n width: 900,\n height: 425,\n svelte: {\n class: DatabaseShell,\n target: document.body,\n },\n });\n }\n\n static getActiveApp() {\n return Object.values(ui.windows).find((app) => {\n return (\n app instanceof this && app._state > Application.RENDER_STATES.CLOSED\n );\n });\n }\n\n static async show(options = {}) {\n const existingApp = this.getActiveApp();\n if (existingApp) return existingApp.render(false, { focus: true });\n return new Promise((resolve) => {\n options.resolve = resolve;\n new this(options).render(true, { focus: true });\n });\n }\n}\n","\r\n\r\n
\r\n\t

{@html localize(\"SEQUENCER.HowTo.Welcome\")}

\r\n\t

{@html localize(\"SEQUENCER.HowTo.Explanation\")}

\r\n\t{#if game.user.isGM}\r\n\t\t

{@html localize(\"SEQUENCER.HowTo.PermissionsExplanation\")}

\r\n\t\t\r\n\t{/if}\r\n\t

{@html localize(\"SEQUENCER.HowTo.PlayerExplanation\")}

\r\n\t

{@html localize(\"SEQUENCER.HowTo.LayerExplanation\")}

\r\n\t
    \r\n\t\t
  1. \r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.Click\")}
    \r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.ClickLabel\")}\r\n\t\t
  2. \r\n\t\t
  3. \r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.ClickDrag\")}
    \r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.ClickDragLabel\")}\r\n\t\t
  4. \r\n\t\t
  5. \r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.Shift\")}
    \r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.ShiftLabel\")}\r\n\t\t
  6. \r\n\t\t
  7. \r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.ShiftControl\")}
    \r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.ShiftControlLabel\")}\r\n\t\t
  8. \r\n\t\t
  9. \r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.MoreToCome\")}\r\n\t\t
  10. \r\n\t
\r\n
\r\n\r\n\r\n","\r\n\r\n\r\n\r\n\r\n\r\n","import { get, writable } from \"svelte/store\";\nimport CONSTANTS from \"../constants.js\";\n\nconst SequenceManager = {\n VisibleEffects: writable({}),\n RunningSounds: writable({}),\n RunningSequences: writable({}),\n};\n\n/* ------------------ Effects ------------------ */\nSequenceManager.VisibleEffects.get = (id) => {\n return get(SequenceManager.VisibleEffects)[id];\n};\n\nSequenceManager.VisibleEffects.add = (id, data) => {\n SequenceManager.VisibleEffects.update((effects) => {\n effects[id] = data;\n return effects;\n });\n};\n\nSequenceManager.VisibleEffects.delete = (id) => {\n SequenceManager.VisibleEffects.update((effects) => {\n delete effects[id];\n return effects;\n });\n};\n\nSequenceManager.VisibleEffects.values = () => {\n return Object.values(get(SequenceManager.VisibleEffects));\n};\n\n/* ------------------ Sounds ------------------ */\nSequenceManager.RunningSounds.get = (id) => {\n return get(SequenceManager.RunningSounds)[id];\n};\n\nSequenceManager.RunningSounds.add = (id, data) => {\n SequenceManager.RunningSounds.update((effects) => {\n effects[id] = data;\n return effects;\n });\n};\n\nSequenceManager.RunningSounds.delete = (id) => {\n SequenceManager.RunningSounds.update((effects) => {\n delete effects[id];\n return effects;\n });\n};\n\nSequenceManager.RunningSounds.values = () => {\n return Object.values(get(SequenceManager.RunningSounds));\n};\n\nSequenceManager.RunningSounds.keys = () => {\n return Object.keys(get(SequenceManager.RunningSounds));\n};\n\n/* ----------------- Sequences ------------------ */\nSequenceManager.RunningSequences.get = (id) => {\n return get(SequenceManager.RunningSequences)[id];\n};\n\nSequenceManager.RunningSequences.add = (id, sequence) => {\n SequenceManager.RunningSequences.update((sequences) => {\n sequences[id] = sequence;\n return sequences;\n });\n};\n\nSequenceManager.RunningSequences.delete = (id) => {\n SequenceManager.RunningSequences.update((sequences) => {\n delete sequences[id];\n return sequences;\n });\n};\n\nSequenceManager.RunningSequences.clearFinishedSequences = () => {\n SequenceManager.RunningSequences.update((sequences) => {\n for (const sequence of Object.values(sequences)) {\n if (\n get(sequence.status) === CONSTANTS.STATUS.COMPLETE ||\n get(sequence.status) === CONSTANTS.STATUS.ABORTED\n ) {\n delete sequences[sequence.id];\n }\n }\n return sequences;\n });\n};\n\nSequenceManager.RunningSequences.stopAll = () => {\n SequenceManager.RunningSequences.update((sequences) => {\n for (const sequence of Object.values(sequences)) {\n sequence._abort();\n }\n return sequences;\n });\n};\n\nSequenceManager.RunningSequences.values = () => {\n return Object.values(get(SequenceManager.RunningSequences));\n};\n\nexport default SequenceManager;\n","export default class ColorMatrixFilter extends globalThis.PIXI.filters\n .ColorMatrixFilter {\n /**\n * Properties & default values:\n * - hue [false]\n * - brightness [1]\n * - contrast [1]\n * - saturate [1]\n */\n constructor(inData) {\n super();\n this.isValid = true;\n this.values = {};\n for (let [key, value] of Object.entries(inData)) {\n this.setValue(key, value);\n if (!this.isValid) break;\n }\n }\n\n setValue(key, value) {\n try {\n this.values[key] = value;\n this[key](value, true);\n } catch (err) {\n ui.notifications.warn(\n `Sequencer | ${this.constructor.name} | Could not set property ${key}`\n );\n }\n }\n}\n","export default class BlurFilter extends globalThis.PIXI.filters.BlurFilter {\n /**\n * Properties & default values:\n * - strength [8]\n * - blur [2]\n * - blurX [2]\n * - blurY [2]\n * - quality [4]\n * - resolution [PIXI.settings.FILTER_RESOLUTION]\n * - kernelSize [5]\n */\n constructor(inData = {}) {\n inData = foundry.utils.mergeObject(\n {\n strength: 1,\n quality: 4,\n resolution: PIXI.settings.FILTER_RESOLUTION,\n kernelSize: 5,\n },\n inData\n );\n\n super(...Object.values(inData));\n\n this.isValid = true;\n for (let [key, value] of Object.entries(inData)) {\n try {\n this[key] = value;\n } catch (err) {\n ui.notifications.warn(\n `Sequencer | ${this.constructor.name} | Could not set property ${key}`\n );\n this.isValid = false;\n }\n }\n }\n}\n","export default class NoiseFilter extends globalThis.PIXI.filters.NoiseFilter {\n /**\n * Properties & default values:\n * - noise [0.5]\n * - seed [Math.random()]\n */\n constructor(inData = {}) {\n super();\n\n inData = foundry.utils.mergeObject(\n {\n noise: 0.5,\n seed: Math.random(),\n },\n inData\n );\n\n this.isValid = true;\n for (let [key, value] of Object.entries(inData)) {\n try {\n this[key] = value;\n } catch (err) {\n ui.notifications.warn(\n `Sequencer | ${this.constructor.name} | Could not set property ${key}`\n );\n this.isValid = false;\n }\n }\n }\n}\n","export default class GlowFilter extends globalThis.PIXI.filters.GlowFilter {\n /**\n * Properties & default values:\n * - distance [10]\n * - outerStrength [4]\n * - innerStrength [0]\n * - color [0xffffff]\n * - quality [0.1]\n * - knockout [false]\n */\n constructor(inData = {}) {\n inData = foundry.utils.mergeObject(\n {\n distance: 10,\n outerStrength: 4,\n innerStrength: 0,\n color: 0xffffff,\n quality: 0.1,\n knockout: false,\n },\n inData\n );\n\n super(inData);\n\n this.isValid = true;\n }\n}\n","let shader = `\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\nfloat alpha;\n\nvoid main() {\n vec4 pixel = texture2D(uSampler, vTextureCoord);\n alpha = smoothstep(0.6,1.0,pixel.a);\n gl_FragColor = vec4(alpha, alpha, alpha, pixel.a);\n}\n`;\n\nexport default class ClipFilter extends PIXI.Filter {\n constructor() {\n super(null, shader);\n }\n}\n","import ColorMatrixFilter from \"./filters/color-matrix-filter.js\";\nimport BlurFilter from \"./filters/blur-filter.js\";\nimport NoiseFilter from \"./filters/noise-filter.js\";\nimport GlowFilter from \"./filters/glow-filter.js\";\nimport ClipFilter from \"./filters/clip-filter.js\";\n\nconst filters = {\n ColorMatrix: ColorMatrixFilter,\n Blur: BlurFilter,\n Noise: NoiseFilter,\n Glow: GlowFilter,\n Clip: ClipFilter,\n};\n\nexport default filters;\n","import * as lib from \"../lib/lib.js\";\n\nconst SequencerAnimationEngine = {\n _animations: [],\n _debug: undefined,\n _deltas: [],\n\n ticker: false,\n dt: 0,\n\n isRunning: false,\n\n addAnimation(origin, attributes = [], timeDifference = 0) {\n if (!Array.isArray(attributes)) attributes = [attributes];\n\n return new Promise((resolve) => {\n this._animations.push({\n origin,\n attributes: attributes.map((attribute) => {\n attribute.targetId =\n lib.get_object_identifier(attribute.target) +\n \"-\" +\n attribute.propertyName;\n attribute.started = false;\n attribute.initialized = false;\n attribute.finishing = false;\n attribute.complete = false;\n attribute.progress = 0;\n attribute.value = 0;\n\n attribute.duration = attribute.duration ?? 0;\n attribute.durationDone = timeDifference ?? 0;\n\n if (attribute?.looping) {\n attribute.loopDuration =\n attribute.loopDuration ?? attribute.duration ?? 0;\n attribute.loopDurationDone =\n timeDifference % attribute.loopDuration ?? 0;\n attribute.loops = attribute.loops ?? 0;\n attribute.loopsDone = Math.floor(\n attribute.durationDone / attribute.duration\n );\n attribute.index = attribute.loopsDone % attribute.values.length;\n attribute.nextIndex =\n (attribute.loopsDone + 1) % attribute.values.length;\n if (!attribute.pingPong && attribute.nextIndex === 0) {\n attribute.index = 0;\n attribute.nextIndex = 1;\n }\n }\n return attribute;\n }),\n complete: false,\n totalDt: timeDifference,\n resolve: resolve,\n });\n if (!this.ticker || !this.ticker.started) {\n this.start();\n }\n lib.debug(`Added animations to Animation Engine`);\n });\n },\n\n endAnimations(target) {\n this._animations = this._animations.filter(\n (animation) => animation.origin !== target\n );\n },\n\n start() {\n lib.debug(`Animation Engine Started`);\n if (!this.ticker) {\n this.ticker = new PIXI.Ticker();\n this.ticker.add(this.nextFrame.bind(this));\n }\n this.ticker.start();\n },\n\n nextFrame() {\n if (this._animations.length === 0) {\n lib.debug(`Animation Engine Paused`);\n this.ticker.stop();\n this._startingValues = {};\n return;\n }\n\n this._animations.forEach((animation) => this._animate(animation));\n this._animations = this._animations.filter(\n (animation) => !animation.complete\n );\n this._applyDeltas();\n for (const targetId of Object.keys(this._startingValues)) {\n if (\n !this._animations.some((_a) =>\n _a.attributes.some((_b) => _b.targetId === targetId)\n )\n ) {\n delete this._startingValues[targetId];\n }\n }\n },\n\n _startingValues: {},\n\n _applyDeltas() {\n const deltas = [];\n\n for (const animation of this._animations) {\n for (const attribute of animation.attributes) {\n if (!attribute.started || attribute.complete) continue;\n\n if (attribute.finishing) {\n attribute.complete = true;\n }\n\n let delta = deltas.find(\n (delta) =>\n attribute.targetId === delta.targetId &&\n attribute.setPropertyName === delta.setPropertyName\n );\n\n if (!delta) {\n delta = {\n targetId: attribute.targetId,\n target: attribute.target,\n getPropertyName:\n attribute.getPropertyName ?? attribute.propertyName,\n setPropertyName: attribute.propertyName,\n value: 0,\n };\n\n if (attribute.target instanceof PIXI.filters.ColorMatrixFilter) {\n delta.value = attribute.previousValue;\n }\n\n deltas.push(delta);\n }\n\n delta.value += attribute.delta;\n }\n }\n\n for (let delta of deltas) {\n const finalValue =\n lib.deep_get(delta.target, delta.getPropertyName) + delta.value;\n\n try {\n lib.deep_set(delta.target, delta.setPropertyName, finalValue);\n } catch (err) {\n //console.log(err)\n }\n }\n },\n\n _animate(animation) {\n animation.totalDt += this.ticker.elapsedMS;\n\n animation.attributes\n .filter((attribute) => !attribute.complete)\n .forEach((attribute) =>\n this._animateAttribute(animation.totalDt, attribute)\n );\n\n animation.complete =\n animation.attributes.filter((attribute) => !attribute.complete).length ===\n 0;\n\n if (animation.complete) {\n animation.resolve();\n }\n },\n\n _animateAttribute(totalDt, attribute) {\n if (totalDt < attribute.delay) return;\n\n if (!attribute.started) {\n const funkyProperty =\n attribute.propertyName.includes(\"scale\") ||\n attribute.propertyName.includes(\"alpha\");\n\n if (\n this._startingValues[attribute.targetId] === undefined ||\n attribute.absolute\n ) {\n const getProperty = funkyProperty || attribute.from === undefined;\n\n this._startingValues[attribute.targetId] = getProperty\n ? lib.deep_get(\n attribute.target,\n attribute.getPropertyName ?? attribute.propertyName\n )\n : attribute.from;\n\n if (!attribute.propertyName.includes(\"scale\")) {\n lib.deep_set(\n attribute.target,\n attribute.propertyName,\n this._startingValues[attribute.targetId]\n );\n }\n }\n\n attribute.previousValue = this._startingValues[attribute.targetId];\n\n if (attribute?.looping) {\n attribute.values = attribute.values.map((value) => {\n return value + attribute.previousValue - (funkyProperty ? 1.0 : 0);\n });\n } else if (attribute.from === undefined) {\n attribute.from = attribute.previousValue;\n }\n }\n\n attribute.started = true;\n\n if (attribute?.looping && attribute?.indefinite) {\n this._handleIndefiniteLoop(attribute);\n } else if (attribute?.looping) {\n this._handleLoops(attribute);\n } else {\n this._handleDefault(attribute);\n }\n\n attribute.delta = attribute.value - attribute.previousValue;\n\n attribute.previousValue = attribute.value;\n },\n\n _handleBaseLoop(attribute) {\n if (!attribute.initialized) {\n if (attribute.values.length === 1) {\n attribute.values.unshift(\n lib.deep_get(attribute.target, attribute.propertyName)\n );\n }\n attribute.initialized = true;\n }\n\n attribute.loopDurationDone += this.ticker.deltaMS;\n attribute.progress = attribute.loopDurationDone / attribute.loopDuration;\n\n attribute.value = lib.interpolate(\n attribute.values[attribute.index],\n attribute.values[attribute.nextIndex],\n attribute.progress,\n attribute.ease\n );\n\n if (attribute.progress >= 1.0) {\n attribute.loopDurationDone -= attribute.loopDuration;\n\n attribute.index = (attribute.index + 1) % attribute.values.length;\n attribute.nextIndex = (attribute.nextIndex + 1) % attribute.values.length;\n\n if (!attribute.pingPong && attribute.nextIndex === 0) {\n attribute.index = 0;\n attribute.nextIndex = 1;\n }\n\n attribute.loopsDone++;\n\n attribute.value = lib.interpolate(\n attribute.values[attribute.index],\n attribute.values[attribute.nextIndex],\n attribute.progress % 1.0,\n attribute.ease\n );\n }\n },\n\n _handleIndefiniteLoop(attribute) {\n return this._handleBaseLoop(attribute);\n },\n\n _handleLoops(attribute) {\n this._handleBaseLoop(attribute);\n\n attribute.durationDone += this.ticker.deltaMS;\n attribute.overallProgress = attribute.durationDone / attribute.duration;\n\n if (\n attribute.progress >= 1.0 &&\n attribute.loopsDone === attribute.loops * 2\n ) {\n attribute.finishing = true;\n attribute.value = attribute.values[attribute.index];\n }\n\n if (attribute.overallProgress >= 1.0) {\n attribute.finishing = true;\n }\n },\n\n _handleDefault(attribute) {\n attribute.durationDone += this.ticker.deltaMS;\n attribute.progress = attribute.durationDone / attribute.duration;\n\n attribute.value = lib.interpolate(\n attribute.from,\n attribute.to,\n attribute.progress,\n attribute.ease\n );\n\n if (attribute.progress >= 1.0) {\n attribute.value = attribute.to;\n attribute.finishing = true;\n }\n },\n};\n\nexport default SequencerAnimationEngine;\n","import { sequencerSocket, SOCKET_HANDLERS } from \"../sockets.js\";\nimport SequencerAnimationEngine from \"./sequencer-animation-engine.js\";\nimport * as lib from \"../lib/lib.js\";\nimport SequenceManager from \"./sequence-manager.js\";\n\nexport default class SequencerAudioHelper {\n /**\n * Play an audio file.\n *\n * @param {{src: string, loop?: boolean, volume?: number, _fadeIn?: {duration: number}, _fadeOut?: {duration: number}, duration?: number}} data The data that describes the audio to play.\n * @param {boolean} [push=false] A flag indicating whether or not to make other clients play the audio, too.\n * @returns {Number} A promise that resolves when the audio file has finished playing.\n */\n static async play(data, push = true) {\n if (push)\n sequencerSocket.executeForOthers(SOCKET_HANDLERS.PLAY_SOUND, data);\n return this._play(data);\n }\n\n /**\n * @param {{src: string, loop?: boolean, volume: number, _fadeIn?: {duration: number}, _fadeOut?: {duration: number}, duration?: number}} data\n * @returns {Number}\n * @private\n */\n static async _play(data) {\n if (\n !game.settings.get(\"sequencer\", \"soundsEnabled\") ||\n game.user.viewedScene !== data.sceneId ||\n (data?.users?.length && !data?.users?.includes(game.userId))\n ) {\n return new Promise((resolve) => setTimeout(resolve, data.duration));\n }\n\n Hooks.callAll(\"createSequencerSound\", data);\n\n lib.debug(`Playing sound:`, data);\n\n data.volume =\n (data.volume ?? 0.8) * game.settings.get(\"core\", \"globalInterfaceVolume\");\n\n const sound = await game.audio.play(data.src, {\n volume: data.fadeIn ? 0 : data.volume,\n loop: data.loop,\n offset: data.startTime,\n });\n\n SequenceManager.RunningSounds.add(data.id, sound);\n\n if (data.fadeIn) {\n SequencerAnimationEngine.addAnimation(data.id, {\n target: sound,\n propertyName: \"volume\",\n from: 0.0,\n to: data.volume,\n duration: Math.min(data.fadeIn.duration, data.duration),\n ease: data.fadeIn.ease,\n delay: Math.min(data.fadeIn.delay, data.duration),\n });\n }\n\n if (data.fadeOut) {\n SequencerAnimationEngine.addAnimation(data.id, {\n target: sound,\n propertyName: \"volume\",\n from: data.volume,\n to: 0.0,\n duration: Math.min(data.fadeOut.duration, data.duration),\n ease: data.fadeOut.ease,\n delay: Math.max(\n data.duration - data.fadeOut.duration + data.fadeOut.delay,\n 0\n ),\n });\n }\n\n if (data.duration) {\n setTimeout(() => {\n sound.stop();\n }, data.duration);\n }\n\n new Promise((resolve) => {\n sound.on(\"stop\", resolve);\n sound.on(\"end\", resolve);\n }).then(() => {\n SequenceManager.RunningSounds.delete(data.id);\n Hooks.callAll(\"endedSequencerSound\", data);\n });\n\n return data.duration;\n }\n\n static stop(ids, push = true) {\n if (push && game.user.isGM)\n sequencerSocket.executeForOthers(SOCKET_HANDLERS.STOP_SOUNDS, ids);\n return this._stop(ids);\n }\n\n static _stop(ids) {\n for (const id of ids) {\n const sound = SequenceManager.RunningSounds.get(id);\n if (sound) {\n sound.stop();\n }\n }\n }\n}\n","import * as lib from \"../lib/lib.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport { sequencerSocket, SOCKET_HANDLERS } from \"../sockets.js\";\n\nlet lockedView = false;\n\nexport default class SequencerFoundryReplicator {\n static registerHooks() {\n Hooks.on(\"canvasPan\", () => {\n if (!lockedView) return;\n canvas.stage.pivot.set(lockedView.x, lockedView.y);\n canvas.stage.scale.set(lockedView.scale, lockedView.scale);\n canvas.updateBlur(lockedView.scale);\n canvas.controls._onCanvasPan();\n canvas.hud.align();\n });\n }\n\n static _validateObject(inObject, sceneId) {\n if (lib.is_UUID(inObject) || !canvaslib.is_object_canvas_data(inObject)) {\n inObject = lib.get_object_from_scene(inObject, sceneId);\n }\n return inObject?._object ?? inObject;\n }\n\n static _getPositionFromData(data) {\n const source = this._validateObject(data.source, data.sceneId);\n\n const position =\n source instanceof PlaceableObject\n ? canvaslib.get_object_position(source)\n : source?.worldPosition || source?.center || source;\n\n const multiplier = data.randomOffset;\n const twister = new MersenneTwister(data.seed);\n\n if (source && multiplier) {\n let randomOffset = canvaslib.get_random_offset(\n source,\n multiplier,\n twister\n );\n position.x -= randomOffset.x;\n position.y -= randomOffset.y;\n }\n\n let extraOffset = data.offset;\n if (extraOffset) {\n let newOffset = {\n x: extraOffset.x,\n y: extraOffset.y,\n };\n if (extraOffset.gridUnits) {\n newOffset.x *= canvas.grid.size;\n newOffset.y *= canvas.grid.size;\n }\n if (extraOffset.local) {\n newOffset = canvaslib.rotateAroundPoint(\n 0,\n 0,\n newOffset.x,\n newOffset.y,\n source?.rotation ?? 0\n );\n }\n position.x -= newOffset.x;\n position.y -= newOffset.y;\n }\n\n return position;\n }\n\n static playScrollingText(data, push = true) {\n if (push) {\n sequencerSocket.executeForOthers(\n SOCKET_HANDLERS.CREATE_SCROLLING_TEXT,\n data\n );\n }\n return this._playScrollingText(data);\n }\n\n static _playScrollingText(data) {\n if (game.user.viewedScene !== data.sceneId) return;\n if (data.users.length && !data.users.includes(game.userId)) return;\n\n canvas.interface.createScrollingText(\n this._getPositionFromData(data),\n data.content,\n data.options\n );\n\n return data.options?.duration ?? 2000;\n }\n\n static panCanvas(data, push = true) {\n if (push) {\n sequencerSocket.executeForOthers(\n SOCKET_HANDLERS.CREATE_SCROLLING_TEXT,\n data\n );\n }\n\n return this._panCanvas(data);\n }\n\n static _panCanvas(data) {\n if (game.user.viewedScene !== data.sceneId) return;\n if (data.users.length && !data.users.includes(game.userId)) return;\n\n const position = this._getPositionFromData(data);\n\n canvas.animatePan({\n x: position.x,\n y: position.y,\n scale: data.scale,\n duration: data.duration,\n speed: data.speed,\n });\n\n if (data.speed) {\n let ray = new Ray(canvas.stage.pivot, {\n x: position.x,\n y: position.y,\n });\n data.duration = Math.round((ray.distance * 1000) / data.speed);\n }\n\n if (data.lockView > 0) {\n setTimeout(() => {\n lockedView = {\n x: position.x,\n y: position.y,\n scale: data.scale,\n };\n }, data.duration);\n setTimeout(() => {\n lockedView = false;\n }, data.lockView + data.duration);\n }\n\n return data.duration + (data.lockView ?? 0);\n }\n}\n","import SequencerAudioHelper from \"./modules/sequencer-audio-helper.js\";\nimport CONSTANTS from \"./constants.js\";\nimport FlagManager from \"./utils/flag-manager.js\";\nimport SequencerFoundryReplicator from \"./modules/sequencer-foundry-replicator.js\";\nimport * as lib from \"./lib/lib.js\";\n\nexport const SOCKET_HANDLERS = {\n PLAY_EFFECT: \"playEffect\",\n END_EFFECTS: \"endEffects\",\n UPDATE_EFFECT: \"updateEffects\",\n ADD_EFFECT_ANIMATIONS: \"addEffectAnimations\",\n PLAY_SOUND: \"playSound\",\n STOP_SOUNDS: \"stopSounds\",\n PRELOAD: \"preload\",\n PRELOAD_RESPONSE: \"preloadResponse\",\n PRELOAD_DONE: \"preloadDone\",\n UPDATE_DOCUMENT: \"updateDocument\",\n ADD_FLAGS: \"addFlags\",\n REMOVE_FLAGS: \"removeFlags\",\n UPDATE_POSITION: \"updatePosition\",\n CREATE_SCROLLING_TEXT: \"createScrollingText\",\n PAN_CANVAS: \"panCanvas\",\n RUN_SEQUENCE_LOCALLY: \"runSequenceLocally\",\n};\n\nexport let sequencerSocket;\n\nexport function registerSocket() {\n console.log(\"Sequencer | Registered sequencerSocket\");\n sequencerSocket = socketlib.registerModule(CONSTANTS.MODULE_NAME);\n sequencerSocket.register(SOCKET_HANDLERS.PLAY_EFFECT, (...args) =>\n Sequencer.EffectManager._playEffect(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.END_EFFECTS, (...args) =>\n Sequencer.EffectManager._endManyEffects(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.UPDATE_EFFECT, (...args) =>\n Sequencer.EffectManager._updateEffect(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.ADD_EFFECT_ANIMATIONS, (...args) =>\n Sequencer.EffectManager._addEffectAnimations(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.PLAY_SOUND, (...args) =>\n SequencerAudioHelper._play(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.STOP_SOUNDS, (...args) =>\n SequencerAudioHelper._stop(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.PRELOAD, (...args) =>\n Sequencer.Preloader.respond(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.PRELOAD_RESPONSE, (...args) =>\n Sequencer.Preloader.handleResponse(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.UPDATE_DOCUMENT, (...args) =>\n updateDocument(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.ADD_FLAGS, (...args) =>\n FlagManager._addFlags(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.REMOVE_FLAGS, (...args) =>\n FlagManager._removeFlags(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.UPDATE_POSITION, (...args) =>\n Sequencer.EffectManager._updatePosition(...args)\n );\n sequencerSocket.register(SOCKET_HANDLERS.CREATE_SCROLLING_TEXT, (data) =>\n SequencerFoundryReplicator._playScrollingText(data)\n );\n sequencerSocket.register(SOCKET_HANDLERS.PAN_CANVAS, (data) =>\n SequencerFoundryReplicator._panCanvas(data)\n );\n sequencerSocket.register(SOCKET_HANDLERS.RUN_SEQUENCE_LOCALLY, (data) => {\n lib.debug(\"Playing remote Sequence\");\n new Sequence().fromJSON(data).play();\n });\n}\n\nasync function updateDocument(documentUuid, updates, animate) {\n const document = await fromUuid(documentUuid);\n return document.update(updates, animate);\n}\n","import * as lib from \"../lib/lib.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport { sequencerSocket, SOCKET_HANDLERS } from \"../sockets.js\";\nimport CONSTANTS from \"../constants.js\";\n\nconst flagManager = {\n flagAddBuffer: new Map(),\n flagRemoveBuffer: new Map(),\n _latestFlagVersion: false,\n\n get latestFlagVersion() {\n if (!this._latestFlagVersion) {\n const versions = Object.keys(this.migrations);\n versions.sort((a, b) => {\n return isNewerVersion(a, b) ? -1 : 1;\n });\n this._latestFlagVersion = versions[0];\n }\n return this._latestFlagVersion;\n },\n\n /**\n * Sanitizes the effect data, accounting for changes to the structure in previous versions\n *\n * @param inDocument\n * @returns {array}\n */\n getFlags(inDocument) {\n let effects = getProperty(inDocument, CONSTANTS.EFFECTS_FLAG);\n\n if (!effects?.length) return [];\n\n effects = foundry.utils.deepClone(effects);\n\n const changes = [];\n for (let [effectId, effectData] of effects) {\n let effectVersion = effectData?.flagVersion ?? \"1.0.0\";\n\n if (effectData.flagVersion === this.latestFlagVersion) continue;\n\n for (let [version, migration] of Object.entries(this.migrations)) {\n if (!isNewerVersion(version, effectVersion)) continue;\n\n effectData = migration(inDocument, effectData);\n }\n\n lib.debug(\n `Migrated effect with ID ${effectId} from version ${effectVersion} to version ${this.latestFlagVersion}`\n );\n\n effectData.flagVersion = this.latestFlagVersion;\n\n changes.push(effectData);\n }\n\n if (changes.length) {\n flagManager.addFlags(inDocument.uuid, changes);\n }\n\n return effects;\n },\n\n migrations: {\n \"2.0.0\": (inDocument, effectData) => {\n effectData._id = effectData.id;\n effectData.creationTimestamp = effectData.timestamp;\n\n if (effectData.template) {\n effectData.template = {\n gridSize: effectData.template[0],\n startPoint: effectData.template[1],\n endPoint: effectData.template[2],\n };\n }\n\n if (effectData.attachTo) {\n effectData.attachTo = {\n active: true,\n align: \"center\",\n rotation: true,\n bindVisibility: true,\n bindAlpha: true,\n };\n effectData.source = inDocument.uuid;\n const objectSize = canvaslib.get_object_dimensions(inDocument, true);\n effectData.offset = {\n x: effectData.position.x - objectSize.width,\n y: effectData.position.y - objectSize.height,\n };\n } else if (effectData.position) {\n effectData.source = effectData.position;\n }\n\n if (effectData.reachTowards) {\n effectData.stretchTo = {\n attachTo: false,\n onlyX: false,\n };\n }\n\n if (effectData.filters) {\n effectData.filters = Object.entries(effectData.filters).map((entry) => {\n return {\n className: entry[0],\n ...entry[1],\n };\n });\n }\n\n effectData.moveSpeed = effectData.speed;\n\n effectData.target = null;\n effectData.forcedIndex = null;\n effectData.flipX = false;\n effectData.flipY = false;\n effectData.nameOffsetMap = {};\n effectData.sequenceId = 0;\n\n delete effectData.id;\n delete effectData.timestamp;\n delete effectData.position;\n delete effectData.reachTowards;\n delete effectData.speed;\n delete effectData.audioVolume;\n delete effectData.gridSizeDifference;\n delete effectData.template;\n\n if (effectData.animatedProperties) {\n delete effectData.animatedProperties.fadeInAudio;\n delete effectData.animatedProperties.fadeOutAudio;\n }\n\n effectData = foundry.utils.mergeObject(\n effectData,\n effectData.animatedProperties\n );\n\n delete effectData.animatedProperties;\n\n return effectData;\n },\n\n \"2.0.6\": (inDocument, effectData) => {\n effectData.private = null;\n\n return effectData;\n },\n\n \"2.0.8\": (inDocument, effectData) => {\n if (effectData.stretchTo) {\n effectData.stretchTo.tiling = false;\n }\n\n return effectData;\n },\n\n \"2.0.9\": (inDocument, effectData) => {\n effectData.tilingTexture = false;\n\n if (effectData.stretchTo?.tiling !== undefined) {\n if (effectData.stretchTo.tiling) {\n effectData.tilingTexture = {\n scale: { x: 1, y: 1 },\n position: { x: 0, y: 0 },\n };\n }\n delete effectData.stretchTo.tiling;\n }\n\n return effectData;\n },\n\n \"2.1.0\": (inDocument, effectData) => {\n if (effectData.randomOffset) {\n effectData.randomOffset = {\n source: !effectData.target ? effectData.randomOffset : false,\n target: !!effectData.target ? effectData.randomOffset : false,\n };\n }\n\n if (effectData.nameOffsetMap) {\n Object.values(effectData.nameOffsetMap).forEach((offsetMap) => {\n if (offsetMap.randomOffset) {\n offsetMap.randomOffset = {\n source: !offsetMap.target ? offsetMap.randomOffset : false,\n target: !!offsetMap.target ? offsetMap.randomOffset : false,\n };\n }\n });\n }\n\n return effectData;\n },\n },\n\n /**\n * Adds effects to a given document\n *\n * @param inObjectUUID\n * @param inEffects\n */\n addFlags: (inObjectUUID, inEffects) => {\n if (!Array.isArray(inEffects)) inEffects = [inEffects];\n sequencerSocket.executeAsGM(\n SOCKET_HANDLERS.ADD_FLAGS,\n inObjectUUID,\n inEffects\n );\n },\n\n /**\n * Removes effects from a given document\n *\n * @param inObjectUUID\n * @param inEffects\n * @param removeAll\n */\n removeFlags: (inObjectUUID, inEffects, removeAll = false) => {\n sequencerSocket.executeAsGM(\n SOCKET_HANDLERS.REMOVE_FLAGS,\n inObjectUUID,\n inEffects,\n removeAll\n );\n },\n\n _addFlags: (inObjectUUID, inEffects) => {\n if (!Array.isArray(inEffects)) inEffects = [inEffects];\n\n let flagsToSet = flagManager.flagAddBuffer.get(inObjectUUID) ?? {\n effects: [],\n };\n\n flagsToSet.effects.push(...inEffects);\n\n flagManager.flagAddBuffer.set(inObjectUUID, flagsToSet);\n\n flagManager.updateFlags();\n },\n\n _removeFlags: (inObjectUUID, inEffects, removeAll = false) => {\n if (inEffects && !Array.isArray(inEffects)) inEffects = [inEffects];\n\n let flagsToSet = flagManager.flagRemoveBuffer.get(inObjectUUID) ?? {\n effects: [],\n removeAll: removeAll,\n };\n\n if (inEffects) flagsToSet.effects.push(...inEffects);\n\n flagManager.flagRemoveBuffer.set(inObjectUUID, flagsToSet);\n\n flagManager.updateFlags();\n },\n\n updateFlags: debounce(async () => {\n let flagsToAdd = Array.from(flagManager.flagAddBuffer);\n let flagsToRemove = Array.from(flagManager.flagRemoveBuffer);\n\n flagManager.flagAddBuffer.clear();\n flagManager.flagRemoveBuffer.clear();\n\n flagsToAdd.forEach((entry) => (entry[1].original = true));\n flagsToRemove.forEach((entry) => (entry[1].original = true));\n\n const objects = new Set([\n ...flagsToAdd.map((effect) => effect[0]).filter(Boolean),\n ...flagsToRemove.map((effect) => effect[0]).filter(Boolean),\n ]);\n\n flagsToAdd = new Map(flagsToAdd);\n flagsToRemove = new Map(flagsToRemove);\n\n const actorUpdates = {};\n const sceneObjectsToUpdate = {};\n\n for (let objectUUID of objects) {\n let object = lib.from_uuid_fast(objectUUID);\n\n if (!object) {\n lib.custom_warning(\n \"Sequencer\",\n `Failed to set flags on non-existent object with UUID: ${objectUUID}`\n );\n continue;\n }\n\n let toAdd = flagsToAdd.get(objectUUID) ?? { effects: [] };\n let toRemove = flagsToRemove.get(objectUUID) ?? {\n effects: [],\n removeAll: false,\n };\n\n const existingFlags = new Map(\n getProperty(object, CONSTANTS.EFFECTS_FLAG) ?? []\n );\n\n if (toRemove?.removeAll) {\n toRemove.effects = Array.from(existingFlags).map((entry) => entry[0]);\n }\n\n for (let effect of toAdd.effects) {\n if (typeof effect === \"string\") {\n effect = existingFlags.get(effect);\n if (!effect) continue;\n }\n existingFlags.set(effect._id, effect);\n }\n\n for (let effect of toRemove.effects) {\n if (typeof effect === \"string\") {\n effect = existingFlags.get(effect);\n if (!effect) continue;\n }\n existingFlags.delete(effect._id);\n }\n\n let flagsToSet = Array.from(existingFlags);\n const options = {};\n\n const isLinkedToken = object instanceof TokenDocument && object.actorLink;\n const isLinkedActor =\n object instanceof Actor && object.prototypeToken.actorLink;\n\n if (\n (isLinkedToken || isLinkedActor) &&\n (toAdd.original || toRemove.original)\n ) {\n const actor = isLinkedActor ? object : object.actor;\n actorUpdates[actor.id] = flagsToSet.filter(\n (effect) => effect[1]?.persistOptions?.persistTokenPrototype\n );\n flagsToSet = flagsToSet.filter(\n (effect) => !effect[1]?.persistOptions?.persistTokenPrototype\n );\n if (\n isLinkedToken &&\n game.modules.get(\"multilevel-tokens\")?.active &&\n getProperty(object, \"flags.multilevel-tokens.stoken\")\n ) {\n options[\"mlt_bypass\"] = true;\n }\n }\n\n if (object?.documentName === \"Scene\") {\n const sceneId = object.id;\n sceneObjectsToUpdate[sceneId] = sceneObjectsToUpdate[sceneId] ?? {\n updates: {},\n documents: {},\n };\n sceneObjectsToUpdate[sceneId].updates[CONSTANTS.EFFECTS_FLAG] =\n flagsToSet;\n } else if (!(object instanceof Actor)) {\n const sceneId = object.parent.id;\n const docName = object.documentName;\n sceneObjectsToUpdate[sceneId] = sceneObjectsToUpdate[sceneId] ?? {\n updates: {},\n documents: {},\n };\n sceneObjectsToUpdate[sceneId].documents[docName] = sceneObjectsToUpdate[\n sceneId\n ].documents[docName] ?? {\n options: {},\n updates: [],\n };\n sceneObjectsToUpdate[sceneId].documents[docName].options = options;\n sceneObjectsToUpdate[sceneId].documents[docName].updates.push({\n _id: object.id,\n [CONSTANTS.EFFECTS_FLAG]: flagsToSet,\n });\n }\n }\n\n for (const [sceneId, sceneData] of Object.entries(sceneObjectsToUpdate)) {\n const scene = game.scenes.get(sceneId);\n if (!foundry.utils.isEmpty(sceneData.updates)) {\n await scene.update(sceneData.updates);\n }\n for (const [documentType, documentData] of Object.entries(\n sceneData.documents\n )) {\n await scene.updateEmbeddedDocuments(\n documentType,\n documentData.updates,\n documentData.options\n );\n lib.debug(\n `Flags set for documents of type \"${documentType}\" in scene with ID \"${sceneId}\"`\n );\n }\n }\n\n await Actor.updateDocuments(\n Object.entries(actorUpdates).map(([actorId, effects]) => ({\n _id: actorId,\n [CONSTANTS.EFFECTS_FLAG]: effects,\n }))\n );\n }, 250),\n};\n\nexport default flagManager;\n","import CanvasEffect from \"../canvas-effects/canvas-effect.js\";\nimport { sequencerSocket, SOCKET_HANDLERS } from \"../sockets.js\";\nimport * as lib from \"../lib/lib.js\";\nimport flagManager from \"../utils/flag-manager.js\";\nimport CONSTANTS from \"../constants.js\";\nimport SequenceManager from \"./sequence-manager.js\";\nimport { EffectsUIApp } from \"../formapplications/effects-ui/effects-ui-app.js\";\n\nconst PositionContainer = new Map();\nconst TemporaryPositionsContainer = new Map();\n\nexport default class SequencerEffectManager {\n /**\n * Returns all of the currently running effects on the canvas\n *\n * @returns {Array}\n */\n static get effects() {\n return Array.from(SequenceManager.VisibleEffects.values());\n }\n\n static _updatePosition(uuid, position) {\n TemporaryPositionsContainer.set(uuid, position);\n }\n\n static getPositionForUUID(uuid) {\n return TemporaryPositionsContainer.get(uuid);\n }\n\n /**\n * Opens the Sequencer Effects UI with the effects tab open\n */\n static show() {\n return EffectsUIApp.show({ tab: \"manager\" });\n }\n\n /**\n * Play an effect on the canvas.\n *\n * @param {object} data The data that describes the audio to play\n * @param {boolean} [push=true] A flag indicating whether or not to make other clients play the effect\n * @returns {CanvasEffect} A CanvasEffect object\n */\n static async play(data, push = true) {\n if (!lib.user_can_do(\"permissions-effect-create\")) {\n lib.custom_warning(\n \"Sequencer\",\n \"EffectManager | play | Players do not have permissions to play effects. This can be configured in Sequencer's module settings.\"\n );\n return;\n }\n if (push)\n sequencerSocket.executeForOthers(SOCKET_HANDLERS.PLAY_EFFECT, data);\n if (data?.persistOptions?.persistTokenPrototype) {\n this._playPrototypeTokenEffects(data, push);\n }\n return this._playEffect(data);\n }\n\n /**\n * Get effects that are playing on the canvas based on a set of filters\n *\n * @param {object} inFilter An object containing filters that determine which effects to return\n * - object: An ID or a PlaceableObject\n * - name: The name of the effect\n * - sceneId: the ID of the scene to search within\n * @returns {Array} An array containing effects that match the given filter\n */\n static getEffects(inFilter = {}) {\n const filters = this._validateFilters(inFilter);\n if (!inFilter)\n throw lib.custom_error(\n \"Sequencer\",\n \"EffectManager | getEffects | Incorrect or incomplete parameters provided\"\n );\n return this._filterEffects(filters);\n }\n\n /**\n * Updates effects based on a set of filters\n *\n * @param {object} inFilter An object containing filters that determine which effects to return\n * - object: An ID or a PlaceableObject\n * - name: The name of the effect\n * - sceneId: the ID of the scene to search within\n * - effects: a single CanvasEffect or its ID, or an array of such\n * @param {object} inUpdates\n * @returns {promise}\n */\n static updateEffects(inFilter, inUpdates) {\n inFilter = this._validateFilters(inFilter);\n if (!inFilter)\n throw lib.custom_error(\n \"Sequencer\",\n \"EffectManager | updateEffects | Incorrect or incomplete parameters provided\"\n );\n\n CanvasEffect.validateUpdate(inUpdates);\n\n const effectsToUpdate = this._filterEffects(inFilter).filter(\n (effect) => effect.userCanUpdate\n );\n\n return Promise.allSettled(\n effectsToUpdate.map((effect) => effect.update(inUpdates))\n );\n }\n\n /**\n * End effects that are playing on the canvas based on a set of filters\n *\n * @param {object} inFilter An object containing filters that determine which effects to end\n * - object: An ID or a PlaceableObject\n * - name: The name of the effect\n * - sceneId: the ID of the scene to search within\n * - effects: a single CanvasEffect or its ID, or an array of such\n * @param {boolean} [push=true] A flag indicating whether or not to make other clients end the effects\n * @returns {promise} A promise that resolves when the effects have ended\n */\n static async endEffects(inFilter = {}, push = true) {\n inFilter = this._validateFilters(inFilter);\n if (!inFilter)\n throw lib.custom_error(\n \"Sequencer\",\n \"EffectManager | endEffects | Incorrect or incomplete parameters provided\"\n );\n const effectsToEnd = this._getEffectsByFilter(inFilter);\n if (!effectsToEnd.length) return;\n if (push)\n sequencerSocket.executeForOthers(\n SOCKET_HANDLERS.END_EFFECTS,\n effectsToEnd\n );\n return this._endManyEffects(effectsToEnd);\n }\n\n /**\n * End all effects that are playing on the canvas\n *\n * @param {string} [inSceneId] A parameter which determines which scene to end all effects on, defaults to current viewed scene\n * @param {boolean} [push=true] A flag indicating whether or not to make other clients end all effects\n * @returns {promise} A promise that resolves when all of the effects have _ended\n */\n static async endAllEffects(inSceneId = game.user.viewedScene, push = true) {\n const inFilter = this._validateFilters({ sceneId: inSceneId });\n if (!inFilter)\n throw lib.custom_error(\n \"Sequencer\",\n \"EffectManager | endAllEffects | Incorrect or incomplete parameters provided\"\n );\n const effectsToEnd = this._getEffectsByFilter(inFilter);\n if (!effectsToEnd.length) return;\n if (push)\n sequencerSocket.executeForOthers(\n SOCKET_HANDLERS.END_EFFECTS,\n effectsToEnd\n );\n return this._endManyEffects(effectsToEnd);\n }\n\n static _getEffectsByFilter(inFilter) {\n return lib.make_array_unique(\n this._filterEffects(inFilter)\n .filter((effect) => effect.userCanDelete)\n .map((effect) => {\n return effect.data?.persistOptions?.persistTokenPrototype\n ? effect.data?.persistOptions?.id ?? effect.id\n : effect.id;\n })\n );\n }\n\n /**\n * If an effect has been named its position will be cached, which can be retrieved with this method\n *\n * @param {string} inName\n * @returns {object|boolean}\n * @private\n */\n static getEffectPositionByName(inName) {\n if (!(typeof inName === \"string\"))\n throw lib.custom_error(\n \"Sequencer\",\n \"EffectManager | getEffectPositionByName | inName must be of type string\"\n );\n return PositionContainer.get(inName) ?? false;\n }\n\n /**\n * Filters the existing effects based on the given filter\n *\n * @param inFilter\n * @returns {array}\n * @private\n */\n static _filterEffects(inFilter) {\n if (inFilter.name) {\n inFilter.name = new RegExp(\n lib.str_to_search_regex_str(lib.safe_str(inFilter.name)),\n \"gu\"\n );\n }\n let effects = this.effects;\n if (inFilter.sceneId && inFilter.sceneId !== canvas.scene.id) {\n effects = lib\n .get_all_documents_from_scene(inFilter.sceneId)\n .map((doc) => {\n return getProperty(doc, CONSTANTS.EFFECTS_FLAG);\n })\n .filter((flags) => !!flags)\n .map((flags) => {\n return flags.map((flag) => CanvasEffect.make(flag[1]));\n })\n .deepFlatten();\n }\n return effects.filter((effect) => {\n return (\n (!inFilter.effects || inFilter.effects.includes(effect.id)) &&\n (!inFilter.name ||\n (effect.data.name &&\n effect.data.name.match(inFilter.name)?.length)) &&\n (!inFilter.source || inFilter.source === effect.data.source) &&\n (!inFilter.target || inFilter.target === effect.data.target) &&\n (!inFilter.origin || inFilter.origin === effect.data.origin)\n );\n });\n }\n\n /**\n * Validates an object actually exists, and gets its UUID\n *\n * @param object\n * @param sceneId\n * @returns {string}\n * @private\n */\n static _validateObject(object, sceneId) {\n if (\n !(\n object instanceof foundry.abstract.Document ||\n object instanceof PlaceableObject ||\n typeof object === \"string\"\n )\n ) {\n throw lib.custom_error(\n \"Sequencer\",\n \"EffectManager | object must be instance of PlaceableObject or of type string\"\n );\n } else if (\n object instanceof PlaceableObject ||\n object instanceof foundry.abstract.Document\n ) {\n object = lib.get_object_identifier(object?.document ?? object);\n } else if (typeof object === \"string\") {\n const actualObject = lib.get_object_from_scene(object, sceneId);\n if (!actualObject) {\n throw lib.custom_error(\n \"Sequencer\",\n `EffectManager | could not find object with ID: ${object}`\n );\n }\n const uuid = lib.get_object_identifier(actualObject);\n if (!uuid) {\n throw lib.custom_error(\n \"Sequencer\",\n `EffectManager | could could not establish identifier of object with ID: ${object}`\n );\n }\n object = uuid;\n }\n\n return object;\n }\n\n /**\n * Validates the filter given to any of the above public methods\n *\n * @param inFilter\n * @returns {boolean}\n * @private\n */\n static _validateFilters(inFilter) {\n if (inFilter?.sceneId) {\n if (typeof inFilter.sceneId !== \"string\")\n throw lib.custom_error(\n \"Sequencer\",\n \"EffectManager | inFilter.sceneId must be of type string\"\n );\n if (!game.scenes.get(inFilter.sceneId))\n throw lib.custom_error(\n \"Sequencer\",\n \"EffectManager | inFilter.sceneId must be a valid scene id (could not find scene)\"\n );\n } else {\n inFilter.sceneId = game.user.viewedScene;\n }\n\n if (inFilter?.object) {\n inFilter.source = this._validateObject(inFilter.object, inFilter.sceneId);\n delete inFilter.object;\n }\n\n if (inFilter?.source) {\n inFilter.source = this._validateObject(inFilter.source, inFilter.sceneId);\n }\n\n if (inFilter?.target) {\n inFilter.target = this._validateObject(inFilter.target, inFilter.sceneId);\n }\n\n if (inFilter?.name && typeof inFilter?.name !== \"string\")\n throw lib.custom_error(\n \"Sequencer\",\n \"EffectManager | inFilter.name must be of type string\"\n );\n if (inFilter?.origin && typeof inFilter?.origin !== \"string\")\n throw lib.custom_error(\n \"Sequencer\",\n \"EffectManager | inFilter.origin must be of type string\"\n );\n\n if (inFilter?.effects) {\n if (!Array.isArray(inFilter.effects))\n inFilter.effects = [inFilter.effects];\n inFilter.effects = inFilter.effects.map((effect) => {\n if (!(typeof effect === \"string\" || effect instanceof CanvasEffect))\n throw lib.custom_error(\n \"Sequencer\",\n \"EffectManager | collections in inFilter.effects must be of type string or CanvasEffect\"\n );\n if (effect instanceof CanvasEffect) return effect.id;\n return effect;\n });\n }\n\n if (\n !inFilter.name &&\n !inFilter.origin &&\n !inFilter.target &&\n !inFilter.sceneId &&\n !inFilter.effects &&\n !inFilter.origin\n )\n return false;\n\n return foundry.utils.mergeObject(\n {\n effects: false,\n name: false,\n source: false,\n target: false,\n sceneId: false,\n origin: false,\n },\n inFilter\n );\n }\n\n /**\n * Actually plays the effect on the canvas\n *\n * @param data\n * @param setFlags\n * @returns {Promise<{duration: Promise, promise: Promise}>}\n * @private\n */\n static async _playEffect(data, setFlags = true) {\n const effect = CanvasEffect.make(data);\n\n if (\n data.persist &&\n setFlags &&\n effect.context &&\n effect.owner &&\n !data.temporary &&\n !data.remote\n ) {\n flagManager.addFlags(effect.context.uuid, effect.data);\n }\n\n if (!effect.shouldPlay) return;\n\n const playData = effect.play();\n\n SequenceManager.VisibleEffects.add(effect.id, effect);\n if (effect.data.name) {\n effect._ticker.add(() => {\n if (effect.isDestroyed) return;\n PositionContainer.set(effect.data.name, {\n start: effect.sourcePosition,\n end: effect.targetPosition,\n });\n });\n }\n\n if (data.temporary && effect.owner) {\n let lastSourcePosition = {};\n let lastTargetPosition = {};\n effect._ticker.add(() => {\n if (effect.source && !effect.isSourceDestroyed) {\n const sourceData = effect.getSourceData();\n if (JSON.stringify(sourceData) !== lastSourcePosition) {\n sequencerSocket.executeForOthers(\n SOCKET_HANDLERS.UPDATE_POSITION,\n data.source,\n sourceData\n );\n lastSourcePosition = JSON.stringify(sourceData);\n }\n }\n if (effect.target && !effect.isTargetDestroyed) {\n const targetData = effect.getTargetData();\n if (JSON.stringify(targetData) !== lastTargetPosition) {\n sequencerSocket.executeForOthers(\n SOCKET_HANDLERS.UPDATE_POSITION,\n data.target,\n targetData\n );\n lastTargetPosition = JSON.stringify(targetData);\n }\n }\n });\n }\n\n if (!data.persist) {\n playData.promise.then(() => this._removeEffect(effect));\n }\n\n return playData;\n }\n\n /**\n * Updates a single effect with the given data\n *\n * @param inEffectId\n * @param inUpdates\n * @returns {promise|boolean}\n * @private\n */\n static _updateEffect(inEffectId, inUpdates) {\n const effect = SequenceManager.VisibleEffects.get(inEffectId);\n if (!effect) return false;\n return effect._update(inUpdates);\n }\n\n /**\n * Updates a single effect with new animations\n *\n * @param inEffectId\n * @param inAnimations\n * @param inLoopingAnimations\n * @returns {promise|boolean}\n * @private\n */\n static _addEffectAnimations(inEffectId, inAnimations, inLoopingAnimations) {\n const effect = SequenceManager.VisibleEffects.get(inEffectId);\n if (!effect) return false;\n return effect._addAnimations(inAnimations, inLoopingAnimations);\n }\n\n /**\n * Sets up persisting effects when the scene is first loaded\n *\n * @returns {promise}\n */\n static async setUpPersists() {\n await this.tearDownPersists();\n const allObjects = lib.get_all_documents_from_scene();\n allObjects.push(canvas.scene);\n const docEffectsMap = allObjects.reduce((acc, doc) => {\n let tokenEffects = flagManager.getFlags(doc);\n if (doc instanceof TokenDocument && doc?.actorLink) {\n const actorEffects = flagManager.getFlags(doc?.actor);\n actorEffects.forEach((e) => {\n e[1]._id = randomID();\n e[1].source = doc.uuid;\n e[1].sceneId = doc.parent.id;\n });\n tokenEffects = tokenEffects.concat(actorEffects);\n }\n if (tokenEffects.length) {\n acc[doc.uuid] = tokenEffects;\n }\n return acc;\n }, {});\n const promises = Object.entries(docEffectsMap)\n .map(([uuid, effects]) => {\n return this._playEffectMap(effects, fromUuidSync(uuid));\n })\n .flat();\n return Promise.all(promises).then(() => {\n Hooks.callAll(\"sequencerEffectManagerReady\");\n });\n }\n\n /**\n * Tears down persisting effects when the scene is unloaded\n */\n static tearDownPersists() {\n return Promise.allSettled(\n this.effects.map((effect) => {\n SequenceManager.VisibleEffects.delete(effect.id);\n return effect.destroy();\n })\n );\n }\n\n /**\n * Patches an object's creation data before it's created so that the effect plays on it correctly\n *\n * @param inDocument\n * @param data\n * @param options\n * @returns {*}\n */\n static async patchCreationData(inDocument, data, options) {\n const effects = flagManager.getFlags(inDocument);\n\n if (!effects?.length) return;\n\n const updates = {};\n\n let documentUuid;\n if (!inDocument._id) {\n const documentId = randomID();\n documentUuid = inDocument.uuid + documentId;\n updates[\"_id\"] = documentId;\n options.keepId = true;\n } else {\n documentUuid = inDocument.uuid;\n }\n\n updates[CONSTANTS.EFFECTS_FLAG] = this.patchEffectDataForDocument(\n documentUuid,\n effects\n );\n\n return inDocument.updateSource(updates);\n }\n\n static patchEffectDataForDocument(inDocumentUuid, effects) {\n return effects.map((effect) => {\n effect[0] = randomID();\n const effectData = effect[1];\n effectData._id = effect[0];\n if (lib.is_UUID(effectData.source)) {\n if (effectData.masks.includes(effectData.source)) {\n const index = effectData.masks.indexOf(effectData.source);\n effectData.masks[index] = inDocumentUuid;\n }\n effectData.source = inDocumentUuid;\n }\n effectData.sceneId = inDocumentUuid.split(\".\")[1];\n return effect;\n });\n }\n\n /**\n * Plays the effects of a given document on creation\n *\n * @param inDocument\n * @returns {*}\n */\n static async documentCreated(inDocument) {\n let effects = flagManager.getFlags(inDocument);\n if (inDocument instanceof TokenDocument && inDocument?.actorLink) {\n let actorEffects = flagManager.getFlags(inDocument.actor);\n if (actorEffects.length) {\n actorEffects = this.patchEffectDataForDocument(\n inDocument.uuid,\n actorEffects\n );\n }\n effects = effects.concat(actorEffects);\n }\n if (!effects?.length) return;\n return this._playEffectMap(effects, inDocument);\n }\n\n /**\n * Plays multiple effects at the same time\n *\n * @param inEffects\n * @param inDocument\n * @returns {Promise<{duration: Promise, promise: Promise}[]>}\n * @private\n */\n static _playEffectMap(inEffects, inDocument) {\n if (inEffects instanceof Map) inEffects = Array.from(inEffects);\n return Promise.all(\n inEffects.map(async (effect) => {\n if (!CanvasEffect.checkValid(effect[1])) {\n if (game.user.isGM) {\n lib.custom_warning(\n `Removed effect from ${inDocument.uuid} as it no longer had a valid source or target`\n );\n }\n return flagManager.removeFlags(inDocument.uuid, effect);\n }\n return this._playEffect(effect[1], false)\n .then((result) => {\n if (!result) {\n lib.debug(\"Error playing effect\");\n }\n })\n .catch((err) => {\n lib.debug(\"Error playing effect:\", err);\n });\n })\n );\n }\n\n /**\n * Ends one or many effects at the same time, returning a promise that resolves once every effect has fully ended\n *\n * @param inEffectIds\n * @returns {Promise}\n * @private\n */\n static async _endManyEffects(inEffectIds = false) {\n const actorEffectsToEnd = this.effects.filter((effect) => {\n return (\n effect.context?.actorLink &&\n inEffectIds.includes(effect.data?.persistOptions?.id)\n );\n });\n const effectsByActorUuid = Object.values(\n lib.group_by(actorEffectsToEnd, \"context.actor.uuid\")\n );\n\n const regularEffectsToEnd = this.effects.filter((effect) => {\n return (\n inEffectIds.includes(effect.id) ||\n (!effect.context?.actorLink &&\n inEffectIds.includes(effect.data?.persistOptions?.id))\n );\n });\n const effectsByContextUuid = Object.values(\n lib.group_by(regularEffectsToEnd, \"context.uuid\")\n );\n\n effectsByContextUuid.forEach((effects) => {\n effects = effects.filter(\n (effect) => effect.data.persist && !effect.data.temporary\n );\n if (!effects.length) return;\n const effectData = effects.map((effect) => effect.data);\n flagManager.removeFlags(\n effects[0].context.uuid,\n effectData,\n !inEffectIds\n );\n });\n\n effectsByActorUuid.forEach((effects) => {\n effects = effects.filter(\n (effect) => effect.data.persist && !effect.data.temporary\n );\n if (!effects.length) return;\n\n const effectContext = effects[0].context;\n const effectData = effects.map((effect) => effect.data);\n\n if (\n !(\n effectContext instanceof TokenDocument &&\n effectContext.actorLink &&\n effectContext.actor.prototypeToken.actorLink\n )\n ) {\n return;\n }\n\n const persistentEffectData = effectData.filter(\n (data) => data?.persistOptions?.persistTokenPrototype\n );\n if (!persistentEffectData.length) return;\n\n const actorEffects = flagManager.getFlags(effectContext.actor);\n const applicableActorEffects = actorEffects\n .filter((effect) => {\n return (\n effect[1]?.persistOptions?.persistTokenPrototype &&\n persistentEffectData.some(\n (persistentEffect) =>\n persistentEffect.persistOptions.id ===\n effect[1]?.persistOptions?.id\n )\n );\n })\n .map((e) => e[0]);\n\n flagManager.removeFlags(\n effectContext.actor.uuid,\n applicableActorEffects,\n !inEffectIds\n );\n });\n\n const effectsToEnd = effectsByContextUuid\n .concat(effectsByActorUuid)\n .deepFlatten();\n\n return Promise.allSettled(\n effectsToEnd.map((effect) => this._removeEffect(effect))\n );\n }\n\n static _effectContextFilter(inUUID, effectData) {\n return (\n effectData?.source === inUUID ||\n effectData?.target === inUUID ||\n (effectData?.tiedDocuments ?? []).indexOf(inUUID) > -1\n );\n }\n\n /**\n * Handles the deletion of objects that effects are attached to\n *\n * @param inUUID\n * @returns {Promise}\n */\n static objectDeleted(inUUID) {\n const documentsToCheck = game.scenes\n .filter((scene) => scene.id !== game.user.viewedScene)\n .map((scene) => [scene, ...lib.get_all_documents_from_scene(scene.id)])\n .deepFlatten();\n\n const documentEffectsToEnd = documentsToCheck\n .map((obj) => {\n const objEffects = flagManager.getFlags(obj);\n const effectsToEnd = objEffects.filter(([effectId, effectData]) =>\n this._effectContextFilter(inUUID, effectData)\n );\n return {\n document: obj,\n effects: effectsToEnd.map((effect) => effect[0]),\n };\n })\n .filter((obj) => obj.effects.length);\n\n const visibleEffectsToEnd = this.effects\n .filter((effect) => this._effectContextFilter(inUUID, effect.data))\n .map((e) => e.id);\n\n return Promise.allSettled([\n this._endManyEffects(visibleEffectsToEnd),\n ...documentEffectsToEnd.map((obj) => {\n return flagManager.removeFlags(obj.document.uuid, obj.effects);\n }),\n ]);\n }\n\n /**\n * Removes the effect from the manager and ends it, returning a promise that resolves once the effect has fully _ended\n *\n * @param effect\n * @returns {Promise}\n * @private\n */\n static _removeEffect(effect) {\n SequenceManager.VisibleEffects.delete(effect.id);\n TemporaryPositionsContainer.delete(effect.data.source);\n TemporaryPositionsContainer.delete(effect.data.target);\n return effect.endEffect();\n }\n\n static async _playPrototypeTokenEffects(data, push) {\n if (!lib.is_UUID(data.source)) return;\n\n const object = lib.from_uuid_fast(data.source);\n\n if (!(object instanceof TokenDocument)) return;\n\n const tokenEffectsToPlay = game.scenes\n .map((scene) =>\n scene.tokens.filter((token) => {\n return (\n token.actorLink && token.actor === object.actor && token !== object\n );\n })\n )\n .deepFlatten();\n\n for (const tokenDocument of tokenEffectsToPlay) {\n const duplicatedData = foundry.utils.deepClone(data);\n duplicatedData._id = randomID();\n duplicatedData.sceneId = tokenDocument.uuid.split(\".\")[1];\n duplicatedData.masks = duplicatedData.masks\n .map((uuid) => uuid.replace(duplicatedData.source, tokenDocument.uuid))\n .filter((uuid) => uuid.includes(duplicatedData.sceneId));\n duplicatedData.source = tokenDocument.uuid;\n if (CanvasEffect.checkValid(duplicatedData)) {\n if (push)\n sequencerSocket.executeForOthers(\n SOCKET_HANDLERS.PLAY_EFFECT,\n duplicatedData\n );\n if (duplicatedData.sceneId === game.user.viewedScene) {\n await this._playEffect(duplicatedData, false);\n }\n }\n }\n }\n}\n","import {\n EffectPlayer,\n InteractionManager,\n SelectionManager,\n} from \"../modules/sequencer-interaction-manager.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport CONSTANTS from \"../constants.js\";\n\nexport class BaseEffectsLayer extends InteractionLayer {\n static get layerOptions() {\n return foundry.utils.mergeObject(super.layerOptions, {\n elevation: 100000000,\n name: \"sequencerEffects\",\n });\n }\n}\n\nexport class SequencerInterfaceLayer extends InteractionLayer {\n constructor(...args) {\n super(...args);\n }\n\n static get layerOptions() {\n return foundry.utils.mergeObject(super.layerOptions, {\n elevation: 100000000,\n name: \"sequencerInterfaceEffects\",\n });\n }\n\n deactivate() {\n super.deactivate();\n if (!this.active) return;\n this._clearChildren();\n this.active = false;\n InteractionManager.tearDown();\n }\n\n _setup() {\n if (!this.UIContainer || this.UIContainer._destroyed) {\n this.UIContainer = new PIXI.Container();\n this.UIContainer.sortableChildren = true;\n this.UIContainer.parentName = \"sequencerUIContainer\";\n this.UIContainer.zIndex = 10000000000000;\n this.addChild(this.UIContainer);\n\n this.linePoint = this.UIContainer.addChild(new PIXI.Graphics());\n this.line = this.UIContainer.addChild(new PIXI.Graphics());\n this.lineHead = this.UIContainer.addChild(new PIXI.Graphics());\n this.suggestionPoint = this.UIContainer.addChild(new PIXI.Graphics());\n this.effectHoverBoxes = this.UIContainer.addChild(new PIXI.Graphics());\n this.effectSelectionBorder = this.UIContainer.addChild(\n new PIXI.Graphics()\n );\n this.effectSourcePosition = this.UIContainer.addChild(\n new PIXI.Graphics()\n );\n this.effectTargetPosition = this.UIContainer.addChild(\n new PIXI.Graphics()\n );\n\n this.suggestionPoint.filters = [new PIXI.filters.AlphaFilter(0.75)];\n this.effectSourcePosition.filters = [new PIXI.filters.AlphaFilter(0.75)];\n this.effectTargetPosition.filters = [new PIXI.filters.AlphaFilter(0.75)];\n\n this.effectSelectionBorder.zIndex = 1;\n\n this.effectSourcePosition.interactive = true;\n this.effectSourcePosition.on(\"mousedown\", () => {\n SelectionManager.sourcePointSelected();\n });\n\n this.effectTargetPosition.interactive = true;\n this.effectTargetPosition.on(\"mousedown\", () => {\n SelectionManager.targetPointSelected();\n });\n }\n }\n\n async _draw(...args) {}\n\n render(...args) {\n super.render(...args);\n this._setup();\n this._clearChildren();\n this._drawHoveredEffectElements();\n if (!this.active) return;\n this._drawLine();\n this._drawPoints();\n this._drawSelectedEffectElements();\n this._drawSuggestionPoint();\n }\n\n _clearChildren() {\n if (!this.UIContainer) return;\n this.UIContainer.children.forEach((child) => {\n child.clear();\n });\n }\n\n _drawLine() {\n if (\n !EffectPlayer.startPos ||\n !EffectPlayer.endPos ||\n game?.activeTool !== \"play-effect\"\n )\n return;\n\n this.line.lineStyle(3, CONSTANTS.COLOR.PRIMARY, 1);\n // If line already present then set its position only\n this.line.moveTo(EffectPlayer.startPos.x, EffectPlayer.startPos.y);\n this.line.lineTo(EffectPlayer.endPos.x, EffectPlayer.endPos.y);\n }\n\n _drawPoints() {\n if (game?.activeTool !== \"play-effect\") return;\n\n const startPos = EffectPlayer.startPos || EffectPlayer.cursorPos;\n\n this.linePoint.beginFill(CONSTANTS.COLOR.PRIMARY);\n this.linePoint.drawCircle(startPos.x, startPos.y, 5);\n\n if (EffectPlayer.sourceAttachFound) {\n this._drawCrossAtLocation(this.linePoint, startPos);\n }\n\n if (!EffectPlayer.endPos) return;\n\n const angle = new Ray(startPos, EffectPlayer.endPos).angle;\n\n this.lineHead.beginFill(CONSTANTS.COLOR.PRIMARY);\n this.lineHead.moveTo(0, -5);\n this.lineHead.lineTo(-15, 30);\n this.lineHead.lineTo(15, 30);\n this.lineHead.endFill();\n this.lineHead.rotation = angle + Math.PI / 2;\n this.lineHead.position.set(EffectPlayer.endPos.x, EffectPlayer.endPos.y);\n\n if (EffectPlayer.targetAttachFound) {\n this.linePoint.beginFill(CONSTANTS.COLOR.SECONDARY);\n this._drawCrossAtLocation(this.linePoint, EffectPlayer.endPos);\n }\n }\n\n _drawHoveredEffectElements() {\n const effects = new Set(SelectionManager.hoveredEffects);\n if (SelectionManager.hoveredEffectUI)\n effects.add(SelectionManager.hoveredEffectUI);\n for (const effect of effects) {\n if (\n !effect ||\n effect === SelectionManager.selectedEffect ||\n effect.data.screenSpace ||\n effect._isEnding\n )\n continue;\n this._drawBoxAroundEffect(this.effectHoverBoxes, effect);\n }\n }\n\n _drawSelectedEffectElements() {\n if (!SelectionManager.selectedEffect) return;\n this._drawBoxAroundEffect(\n this.effectSelectionBorder,\n SelectionManager.selectedEffect,\n true\n );\n this._drawEffectStartEndPoints(SelectionManager.selectedEffect);\n }\n\n _drawBoxAroundEffect(graphic, effect, selected = false) {\n if (\n !effect ||\n effect._destroyed ||\n !effect.spriteContainer ||\n !effect.ready\n )\n return;\n\n graphic.lineStyle(3, selected ? CONSTANTS.COLOR.PRIMARY : 0xffffff, 0.9);\n\n let boundingBox = effect.sprite.getLocalBounds();\n let dimensions = {\n x: effect.position.x + boundingBox.x * effect.sprite.scale.x,\n y: effect.position.y + boundingBox.y * effect.sprite.scale.y,\n width: boundingBox.width * effect.sprite.scale.x,\n height: boundingBox.height * effect.sprite.scale.y,\n };\n\n if (effect.data.shapes.length) {\n for (const shape of Object.values(effect.shapes)) {\n boundingBox = shape.getLocalBounds();\n dimensions = {\n x: Math.min(\n dimensions.x,\n effect.position.x + boundingBox.x * shape.scale.x\n ),\n y: Math.min(\n dimensions.y,\n effect.position.y + boundingBox.y * shape.scale.y\n ),\n width: Math.max(dimensions.width, boundingBox.width * shape.scale.x),\n height: Math.max(\n dimensions.height,\n boundingBox.height * shape.scale.y\n ),\n };\n }\n }\n\n const rotation = Math.normalizeRadians(\n effect.rotationContainer.rotation +\n effect.spriteContainer.rotation +\n effect.sprite.rotation\n );\n\n this._drawRectangle(graphic, effect.position, rotation, dimensions);\n }\n\n _drawRectangle(graphic, position, rotation, dimensions) {\n graphic.moveTo(\n ...canvaslib.rotate_coordinate(\n position,\n {\n x: dimensions.x,\n y: dimensions.y,\n },\n -rotation\n )\n );\n\n graphic.lineTo(\n ...canvaslib.rotate_coordinate(\n position,\n {\n x: dimensions.x + dimensions.width,\n y: dimensions.y,\n },\n -rotation\n )\n );\n\n graphic.lineTo(\n ...canvaslib.rotate_coordinate(\n position,\n {\n x: dimensions.x + dimensions.width,\n y: dimensions.y + dimensions.height,\n },\n -rotation\n )\n );\n\n graphic.lineTo(\n ...canvaslib.rotate_coordinate(\n position,\n {\n x: dimensions.x,\n y: dimensions.y + dimensions.height,\n },\n -rotation\n )\n );\n\n graphic.lineTo(\n ...canvaslib.rotate_coordinate(\n position,\n {\n x: dimensions.x,\n y: dimensions.y,\n },\n -rotation\n )\n );\n\n graphic.lineTo(\n ...canvaslib.rotate_coordinate(\n position,\n {\n x: dimensions.x + dimensions.width,\n y: dimensions.y,\n },\n -rotation\n )\n );\n }\n\n /**\n * Draws the start/end point circles\n * @private\n */\n _drawEffectStartEndPoints(effect) {\n if (!effect || effect._destroyed || !effect.spriteContainer) return;\n\n if (\n !effect.data.stretchTo ||\n !effect.sourcePosition ||\n !effect.targetPosition\n )\n return;\n\n this.effectSourcePosition.beginFill(CONSTANTS.COLOR.PRIMARY);\n this.effectSourcePosition.drawCircle(\n effect.sourcePosition.x,\n effect.sourcePosition.y,\n canvas.grid.size * 0.25\n );\n\n if (typeof effect.data.source === \"string\") {\n this._drawCrossAtLocation(\n this.effectSourcePosition,\n effect.sourcePosition\n );\n }\n\n this.effectTargetPosition.beginFill(CONSTANTS.COLOR.SECONDARY);\n this.effectTargetPosition.drawCircle(\n effect.targetPosition.x,\n effect.targetPosition.y,\n canvas.grid.size * 0.25\n );\n this.effectTargetPosition.alpha = 0.75;\n\n if (typeof effect.data.target === \"string\") {\n this._drawCrossAtLocation(\n this.effectTargetPosition,\n effect.targetPosition\n );\n }\n }\n\n _drawSuggestionPoint() {\n if (\n !SelectionManager.suggestedProperties ||\n !SelectionManager.selectedEffect\n )\n return;\n\n const effect = SelectionManager.selectedEffect;\n const suggestion = SelectionManager.suggestedProperties;\n\n this.suggestionPoint.position.set(0, 0);\n this.suggestionPoint.rotation = 0;\n\n if (effect.data.stretchTo) {\n this.suggestionPoint.beginFill(suggestion.color);\n this.suggestionPoint.drawCircle(\n suggestion.position.x,\n suggestion.position.y,\n canvas.grid.size * 0.25\n );\n if (suggestion.showCursor) {\n this._drawCrossAtLocation(this.suggestionPoint, suggestion.position);\n }\n return;\n }\n\n const boundingBox = effect.spriteContainer.getLocalBounds();\n\n const dimensions = {\n x: boundingBox.x * effect.scale.x,\n y: boundingBox.y * effect.scale.y,\n width: boundingBox.width * effect.scale.x,\n height: boundingBox.height * effect.scale.y,\n };\n\n this.suggestionPoint.lineStyle(3, CONSTANTS.COLOR.PRIMARY, 0.9);\n this.suggestionPoint.position.set(\n suggestion.position.x,\n suggestion.position.y\n );\n this._drawRectangle(\n this.suggestionPoint,\n suggestion.position,\n effect.rotation,\n dimensions,\n true\n );\n\n if (suggestion.showCursor) {\n this.suggestionPoint.beginFill(CONSTANTS.COLOR.SECONDARY);\n this._drawCrossAtLocation(this.suggestionPoint);\n }\n\n if (suggestion.showPoint) {\n this.suggestionPoint.drawCircle(0, 0, canvas.grid.size * 0.2);\n }\n }\n\n _drawCrossAtLocation(inElement, inPosition = { x: 0, y: 0 }) {\n inElement.drawRect(\n inPosition.x + canvas.grid.size * -0.05,\n inPosition.y + canvas.grid.size * -0.5,\n canvas.grid.size * 0.1,\n canvas.grid.size\n );\n inElement.drawRect(\n inPosition.x + canvas.grid.size * -0.5,\n inPosition.y + canvas.grid.size * -0.05,\n canvas.grid.size,\n canvas.grid.size * 0.1\n );\n }\n}\n\nexport class UIEffectsLayer extends InteractionLayer {\n static get layerOptions() {\n return foundry.utils.mergeObject(super.layerOptions, {\n zIndex: 999999999999999,\n name: \"sequencerEffectsAboveEverything\",\n });\n }\n\n updateTransform() {\n if (this.sortableChildren && this.sortDirty) {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(PIXI.Transform.IDENTITY);\n this.worldAlpha = this.alpha;\n\n for (let child of this.children) {\n if (child.visible) {\n child.updateTransform();\n }\n }\n }\n}\n\nlet layer = false;\n\nexport class SequencerAboveUILayer {\n constructor(name, zIndex = 0.1) {\n this.canvas = document.createElement(\"canvas\");\n this.canvas.id = name;\n\n this.canvas.style.cssText = `\n position:absolute;\n touch-action: none;\n pointer-events: none;\n width:100%;\n height:100%;\n z-index:${zIndex};\n padding: 0;\n margin: 0;\n `;\n\n document.body.appendChild(this.canvas);\n\n this.app = new PIXI.Application({\n width: window.innerWidth,\n height: window.innerHeight,\n view: this.canvas,\n antialias: true,\n backgroundAlpha: 0.0,\n sharedTicker: true,\n });\n\n this.app.resizeTo = window;\n this.app.stage.renderable = false;\n }\n\n static setup() {\n if (!game.settings.get(\"sequencer\", \"enable-above-ui-screenspace\")) return;\n layer = new this(\"sequencerUILayerAbove\", 10000);\n }\n\n static getLayer() {\n return layer ? layer.app.stage : canvas.uiEffectsLayer;\n }\n\n static addChild(...args) {\n const result = this.getLayer().addChild(...args);\n layer.app.stage.renderable = layer.app.stage.children.length > 0;\n return result;\n }\n\n static sortChildren() {\n return this.getLayer().sortChildren();\n }\n\n static removeContainerByEffect(inEffect) {\n const child = this.getLayer().children.find((child) => child === inEffect);\n if (!child) return;\n this.getLayer().removeChild(child);\n layer.app.stage.renderable = layer.app.stage.children.length > 0;\n }\n\n updateTransform() {\n if (this.app.stage.sortableChildren && this.app.stage.sortDirty) {\n this.app.stage.sortChildren();\n }\n\n this.app.stage._boundsID++;\n\n this.app.stage.transform.updateTransform(PIXI.Transform.IDENTITY);\n this.app.stage.worldAlpha = this.app.stage.alpha;\n\n for (let child of this.app.stage.children) {\n if (child.visible) {\n child.updateTransform();\n }\n }\n }\n}\n","export default class VisionSamplerShader extends BaseSamplerShader {\n /** @override */\n static classPluginName = null;\n\n /** @inheritdoc */\n static vertexShader = `\n precision ${PIXI.settings.PRECISION_VERTEX} float;\n attribute vec2 aVertexPosition;\n attribute vec2 aTextureCoord;\n uniform mat3 projectionMatrix;\n uniform vec2 screenDimensions;\n varying vec2 vUvsMask;\n varying vec2 vUvs;\n void main() {\n vUvs = aTextureCoord;\n vUvsMask = aVertexPosition / screenDimensions;\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }\n `;\n\n /** @inheritdoc */\n static fragmentShader = `\n precision ${PIXI.settings.PRECISION_FRAGMENT} float;\n varying vec2 vUvs;\n varying vec2 vUvsMask;\n uniform vec4 tintAlpha;\n uniform sampler2D sampler;\n uniform sampler2D maskSampler;\n uniform bool enableVisionMasking;\n void main() {\n float mask = enableVisionMasking ? texture2D(maskSampler, vUvsMask).r : 1.0;\n gl_FragColor = texture2D(sampler, vUvs) * tintAlpha * mask;\n }\n `;\n\n /** @inheritdoc */\n static defaultUniforms = {\n tintAlpha: [1, 1, 1, 1],\n sampler: 0,\n maskSampler: 0,\n screenDimensions: [1, 1],\n enableVisionMasking: false,\n };\n\n /** @override */\n _preRender(mesh) {\n super._preRender(mesh);\n this.uniforms.maskSampler = canvas.masks.vision.renderTexture;\n this.uniforms.screenDimensions = canvas.screenDimensions;\n this.uniforms.enableVisionMasking = canvas.effects.visibility.visible;\n }\n}\n","import CONSTANTS from \"../constants.js\";\nimport filters from \"../lib/filters.js\";\nimport * as lib from \"../lib/lib.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport { SequencerFileBase } from \"../modules/sequencer-file.js\";\nimport SequencerAnimationEngine from \"../modules/sequencer-animation-engine.js\";\nimport SequencerFileCache from \"../modules/sequencer-file-cache.js\";\nimport flagManager from \"../utils/flag-manager.js\";\nimport { sequencerSocket, SOCKET_HANDLERS } from \"../sockets.js\";\nimport SequencerEffectManager from \"../modules/sequencer-effect-manager.js\";\nimport { SequencerAboveUILayer } from \"./effects-layer.js\";\nimport VisionSamplerShader from \"../lib/filters/vision-mask-filter.js\";\n\nconst hooksManager = {\n _hooks: new Map(),\n _hooksRegistered: new Set(),\n\n addHook(effectUuid, hookName, callable, callNow = false) {\n if (!this._hooksRegistered.has(hookName)) {\n lib.debug(\"registering hook for: \" + hookName);\n this._hooksRegistered.add(hookName);\n Hooks.on(hookName, (...args) => {\n this._hookCalled(hookName, ...args);\n });\n }\n\n const key = hookName + \"-\" + effectUuid;\n\n if (!this._hooks.has(key)) {\n this._hooks.set(key, []);\n }\n\n this._hooks.get(key).push(callable);\n\n if (callNow) {\n setTimeout(() => {\n callable();\n }, 20);\n }\n },\n\n _hookCalled(hookName, ...args) {\n Array.from(this._hooks)\n .filter((entry) => entry[0].startsWith(hookName + \"-\"))\n .map((hooks) => hooks[1])\n .deepFlatten()\n .forEach((callback) => callback(...args));\n },\n\n removeHooks(effectUuid) {\n Array.from(this._hooks)\n .filter((entry) => entry[0].endsWith(\"-\" + effectUuid))\n .forEach((entry) => this._hooks.delete(entry[0]));\n },\n};\n\nexport default class CanvasEffect extends PIXI.Container {\n #elevation = 0;\n #sort = 0;\n\n constructor(inData) {\n super();\n\n this.sortableChildren = true;\n\n // Set default values\n this.actualCreationTime = +new Date();\n this.data = inData;\n\n this._resolve = null;\n this._durationResolve = null;\n\n this.ready = false;\n this._ended = false;\n this._isEnding = false;\n\n this._cachedSourceData = {};\n this._cachedTargetData = {};\n\n this.uuid = false;\n }\n\n static get protectedValues() {\n return [\n \"_id\",\n \"sequenceId\",\n \"creationTimestamp\",\n \"creatorUserId\",\n \"moduleName\",\n \"index\",\n \"repetition\",\n \"moves\",\n \"fadeIn\",\n \"fadeOut\",\n \"scaleIn\",\n \"scaleOut\",\n \"rotateIn\",\n \"rotateOut\",\n \"fadeInAudio\",\n \"fadeOutAudio\",\n \"animations\",\n \"nameOffsetMap\",\n \"persist\",\n ];\n }\n\n /** @type {number} */\n get elevation() {\n return this.#elevation;\n }\n\n set elevation(value) {\n this.#elevation = value;\n }\n\n /** @type {number} */\n get sort() {\n return this.#sort;\n }\n\n set sort(value) {\n this.#sort = value;\n }\n\n get context() {\n return this.data.attachTo?.active && this.sourceDocument\n ? this.sourceDocument\n : game.scenes.get(this.data.sceneId);\n }\n\n get isIsometricActive() {\n const sceneIsIsometric = getProperty(\n game.scenes.get(this.data.sceneId),\n CONSTANTS.INTEGRATIONS.ISOMETRIC.SCENE_ENABLED\n );\n return CONSTANTS.INTEGRATIONS.ISOMETRIC.ACTIVE && sceneIsIsometric;\n }\n\n /**\n * The ID of the effect\n *\n * @returns {string}\n */\n get id() {\n return this.data._id;\n }\n\n /**\n * Whether this effect is destroyed or is in the process of being destroyed\n */\n get isDestroyed() {\n return (\n (this.source && this.isSourceDestroyed) ||\n (this.target && this.isTargetDestroyed)\n );\n }\n\n /**\n * Whether the source of this effect is temporary\n *\n * @returns {boolean}\n */\n get isSourceTemporary() {\n return (\n this.data.attachTo?.active &&\n this.sourceDocument &&\n !lib.is_UUID(this.sourceDocument?.uuid)\n );\n }\n\n /**\n * Whether the source of this effect has been destroyed\n *\n * @returns {boolean}\n */\n get isSourceDestroyed() {\n return (\n this.source && (this.source?.destroyed || this.sourceDocument?._destroyed)\n );\n }\n\n /**\n * Whether the target of this effect is temporary\n *\n * @returns {boolean}\n */\n get isTargetTemporary() {\n return (\n (this.data.stretchTo?.attachTo || this.data.rotateTowards?.attachTo) &&\n this.targetDocument &&\n !lib.is_UUID(this.targetDocument.uuid)\n );\n }\n\n /**\n * Whether the target of this effect has been destroyed\n *\n * @returns {boolean}\n */\n get isTargetDestroyed() {\n return (\n this.target && (this.target?.destroyed || this.targetDocument?._destroyed)\n );\n }\n\n /**\n * The source object (or source location) of the effect\n *\n * @returns {boolean|object}\n */\n get source() {\n if (!this._source && this.data.source) {\n this._source = this._getObjectByID(this.data.source);\n this._source = this._source?._object ?? this._source;\n }\n return this._source;\n }\n\n /**\n * Retrieves the source document\n *\n * @returns {Document|PlaceableObject}\n */\n get sourceDocument() {\n return this.source?.document ?? this.source;\n }\n\n /**\n * Retrieves the PIXI object for the source object\n *\n * @returns {*|PIXI.Sprite|TileHUD}\n */\n get sourceMesh() {\n return this.source?.mesh ?? this.source?.template;\n }\n\n /**\n * The source position with the relevant offsets calculated\n *\n * @returns {{x: number, y: number}}\n */\n get sourcePosition() {\n let position = this.getSourceData().position;\n let offset = this._getOffset(this.data.source, true);\n\n return {\n x: position.x - offset.x,\n y: position.y - offset.y,\n };\n }\n\n /**\n * The target object (or target location) of the effect\n *\n * @returns {boolean|object}\n */\n get target() {\n if (!this._target && this.data.target) {\n this._target = this._getObjectByID(this.data.target);\n this._target = this._target?._object ?? this._target;\n }\n return this._target;\n }\n\n /**\n * Retrieves the document of the target\n *\n * @returns {Document|PlaceableObject}\n */\n get targetDocument() {\n return this.target?.document ?? this.target;\n }\n\n /**\n * Retrieves the PIXI object for the target object\n *\n * @returns {*|PIXI.Sprite|TileHUD}\n */\n get targetMesh() {\n return this.target?.mesh ?? this.target?.template;\n }\n\n /**\n * The target position with the relevant offsets calculated\n *\n * @returns {{x: number, y: number}}\n */\n get targetPosition() {\n const position = this.getTargetData().position;\n const offset = this._getOffset(this.data.target);\n\n return {\n x: position.x - offset.x,\n y: position.y - offset.y,\n };\n }\n\n /**\n * Returns this effect's world position\n *\n * @returns {{x: number, y: number}}\n */\n get worldPosition() {\n const t = canvas.stage.worldTransform;\n return {\n x: (this.sprite.worldTransform.tx - t.tx) / canvas.stage.scale.x,\n y: (this.sprite.worldTransform.ty - t.ty) / canvas.stage.scale.y,\n };\n }\n\n /**\n * Whether the current user is the owner of this effect\n *\n * @returns {boolean}\n */\n get owner() {\n return this.data.creatorUserId === game.user.id;\n }\n\n /**\n * Whether the current user can update this effect\n *\n * @returns {boolean}\n */\n get userCanUpdate() {\n return (\n game.user.isGM ||\n this.owner ||\n (this.data.attachTo?.active &&\n this.sourceDocument.canUserModify(game.user, \"update\"))\n );\n }\n\n /**\n * Whether the current user can delete this effect\n *\n * @returns {boolean}\n */\n get userCanDelete() {\n return this.userCanUpdate || lib.user_can_do(\"permissions-effect-delete\");\n }\n\n /**\n * Whether this effect is on the current scene\n *\n * @returns {boolean}\n */\n get onCurrentScene() {\n return this.data.sceneId === game.user.viewedScene;\n }\n\n /**\n * Whether this effect should be shown as faded or not - effects created by users for other users should be shown\n * for all\n *\n * @returns {boolean}\n */\n get shouldShowFadedVersion() {\n // If the user has not set the opacity user-specific effects to 0\n // And it is not an effect that is only played for the user who created the effect\n // And if the effect is going to be played for a subset of users\n // And the users does not contain this user\n return (\n game.settings.get(CONSTANTS.MODULE_NAME, \"user-effect-opacity\") !== 0 &&\n this.data.users &&\n this.data.users.length &&\n !(\n this.data.users.length === 1 &&\n this.data.users.includes(this.data.creatorUserId)\n ) &&\n !this.data.users.includes(game.userId)\n );\n }\n\n /**\n * Getter for the current playing video of the effect\n *\n * @returns {null|*}\n */\n get video() {\n return this._video;\n }\n\n /**\n * Setter for the current playing video of the effect\n */\n set video(inVideo) {\n if (!inVideo) return;\n\n inVideo.playbackRate = this.data.playbackRate\n ? this.data.playbackRate\n : 1.0;\n inVideo.muted = !this.data.volume;\n inVideo.volume =\n (this.data.volume ?? 0) *\n game.settings.get(\"core\", \"globalInterfaceVolume\");\n\n if (!this._video) {\n this._video = inVideo;\n return;\n }\n\n const isLooping = this._video?.loop;\n const currentTime = this._video.currentTime;\n\n this._video = inVideo;\n\n this._video.currentTime = this.playNaturally\n ? 0\n : Math.min(currentTime, this._video.duration);\n this._video.loop = isLooping;\n\n this._texture.update();\n }\n\n async playMedia() {\n if (this.animatedSprite) {\n await this.sprite.play();\n } else if (this.video) {\n try {\n await this.video.play();\n } catch (err) {}\n }\n this._setupTimestampHook(this.mediaCurrentTime * 1000);\n }\n\n async pauseMedia() {\n if (this.animatedSprite) {\n return this.sprite.stop();\n } else if (this.video) {\n return this.video.pause();\n }\n }\n\n get mediaLooping() {\n if (this.animatedSprite) {\n return this.sprite.loop;\n }\n return this.video?.loop ?? false;\n }\n\n set mediaLooping(looping) {\n if (this.animatedSprite) {\n this.sprite.loop = looping;\n return;\n }\n if (this.video) {\n this.video.loop = looping;\n }\n }\n\n get mediaIsPlaying() {\n if (this.animatedSprite) {\n return this.sprite.playing;\n }\n return this.video;\n }\n\n get mediaCurrentTime() {\n if (this.animatedSprite) {\n return (\n (this.sprite.currentFrame / this.sprite.totalFrames) *\n (this.sprite.totalFrames / 24)\n );\n }\n return this.video?.currentTime ?? null;\n }\n\n set mediaPlaybackRate(inPlaybackRate) {\n if (this.animatedSprite) {\n this.sprite.animationSpeed = 0.4 * inPlaybackRate;\n } else if (this.video) {\n this.video.playbackRate = inPlaybackRate;\n }\n }\n\n set mediaCurrentTime(newTime) {\n if (this.animatedSprite) {\n const newFrame = Math.floor(newTime * this.sprite.totalFrames);\n const clampedFrame = Math.max(\n 0,\n Math.min(newFrame, this.sprite.totalFrames)\n );\n if (this.mediaIsPlaying) {\n this.sprite.gotoAndPlay(clampedFrame);\n } else {\n this.sprite.gotoAndStop(clampedFrame);\n }\n } else if (this.video) {\n this.video.currentTime = newTime;\n }\n }\n\n get mediaDuration() {\n if (this.animatedSprite) {\n return (\n this.sprite.totalFrames /\n this.sprite.animationSpeed /\n PIXI.Ticker.shared.FPS\n );\n } else if (this.video) {\n return this.video?.duration;\n }\n return 1;\n }\n\n get hasAnimatedMedia() {\n return !!(this.video || this.animatedSprite);\n }\n\n /**\n * The template of the effect, determining the effect's internal grid size, and start/end padding\n *\n * @returns {object}\n */\n get template() {\n return foundry.utils.mergeObject(\n {\n gridSize: 100,\n startPoint: 0,\n endPoint: 0,\n },\n this._template ?? {}\n );\n }\n\n /**\n * The grid size difference between the internal effect's grid vs the grid on the canvas. If the effect is in screen space, we ignore this.\n *\n * @returns {number}\n */\n get gridSizeDifference() {\n return canvas.grid.size / this.template.gridSize;\n }\n\n /**\n * Whether the effect should be flipped on any given axis\n *\n * @returns {number}\n */\n get flipX() {\n return this.data.flipX ? -1 : 1;\n }\n\n get flipY() {\n return this.data.flipY ? -1 : 1;\n }\n\n /**\n * Whether this effect should play at all, depending on a multitude of factors\n *\n * @returns {boolean}\n */\n get shouldPlay() {\n return (\n (game.user.viewedScene === this.data.sceneId ||\n this.data.creatorUserId === game.userId) &&\n (game.user.isGM ||\n !this.data.users ||\n this.data.users.length === 0 ||\n this.data.users.includes(game.userId))\n );\n }\n\n get shouldPlayVisible() {\n let playVisible =\n this.shouldPlay &&\n game.settings.get(\"sequencer\", \"effectsEnabled\") &&\n game.user.viewedScene === this.data.sceneId;\n\n if (\n isNewerVersion(game.version, \"10.289\") &&\n game.settings.get(\"core\", \"photosensitiveMode\")\n ) {\n playVisible = false;\n lib.throttled_custom_warning(\n this.data.moduleName,\n \"Photosensitive Mode is turned on, so Sequencer's visual effects aren't being rendered\"\n );\n }\n\n return playVisible;\n }\n\n /**\n * Whether this effect should play naturally, or be constrained to a subsection of the video\n *\n * @returns {boolean}\n */\n get playNaturally() {\n return (\n (!this.data.time ||\n (this._startTime === 0 && this._endTime === this.mediaDuration)) &&\n this._animationTimes.loopStart === undefined &&\n this._animationTimes.loopEnd === undefined\n );\n }\n\n static make(inData) {\n return !inData.persist\n ? new CanvasEffect(inData)\n : new PersistentCanvasEffect(inData);\n }\n\n static checkValid(effectData) {\n let sourceExists = true;\n let targetExists = true;\n if (effectData.source && lib.is_UUID(effectData.source)) {\n sourceExists = lib.from_uuid_fast(effectData.source);\n }\n if (effectData.target && lib.is_UUID(effectData.target)) {\n targetExists = lib.from_uuid_fast(effectData.target);\n }\n if (\n effectData.source &&\n lib.is_UUID(effectData.source) &&\n effectData.target &&\n lib.is_UUID(effectData.target)\n ) {\n const sourceScene = effectData.source.split(\".\")[1];\n const targetScene = effectData.target.split(\".\")[1];\n if (sourceScene !== targetScene || sourceScene !== effectData.sceneId)\n return false;\n }\n return sourceExists && targetExists;\n }\n\n /**\n * Validates that the update contains the appropriate data\n *\n * @param inUpdates\n */\n static validateUpdate(inUpdates) {\n const updateKeys = Object.keys(inUpdates);\n const protectedValues = updateKeys.filter((key) =>\n CanvasEffect.protectedValues.includes(key)\n );\n if (protectedValues.length) {\n throw lib.custom_error(\n \"Sequencer\",\n `CanvasEffect | update | You cannot update the following keys of an effect's data: ${protectedValues.join(\n \"\\n - \"\n )}`\n );\n }\n if (updateKeys.includes(\"source\")) {\n if (\n !(\n lib.is_UUID(inUpdates.source) ||\n canvaslib.is_object_canvas_data(inUpdates.source)\n )\n ) {\n throw lib.custom_error(\n \"Sequencer\",\n `CanvasEffect | update | source must be of type document UUID or object with X and Y coordinates`\n );\n }\n }\n if (updateKeys.includes(\"target\")) {\n if (\n !(\n lib.is_UUID(inUpdates.target) ||\n canvaslib.is_object_canvas_data(inUpdates.target)\n )\n ) {\n throw lib.custom_error(\n \"Sequencer\",\n `CanvasEffect | update | target must be of type document UUID or object with X and Y coordinates`\n );\n }\n }\n }\n\n getHook(type, uuid) {\n if (!lib.is_UUID(uuid)) return false;\n const parts = uuid.split(\".\");\n return type + parts[parts.length - 2];\n }\n\n /**\n * Gets the source hook name\n *\n * @param {string} type\n * @returns {string|boolean}\n */\n getSourceHook(type = \"\") {\n return this.getHook(type, this.data.source);\n }\n\n /**\n * The source object's current position, or its current position\n *\n * @returns {boolean|object}\n */\n getSourceData() {\n if (this.data.temporary && !this.owner) {\n return SequencerEffectManager.getPositionForUUID(this.data.source);\n }\n\n const position =\n this.source instanceof PlaceableObject && !this.isSourceTemporary\n ? canvaslib.get_object_position(this.source)\n : this.source?.worldPosition || this.source?.center || this.source;\n\n const { width, height } = canvaslib.get_object_dimensions(this.source);\n\n if (this.isIsometricActive && this.source instanceof PlaceableObject) {\n position.x +=\n ((this.sourceDocument.elevation ?? 0) / canvas.scene.grid.distance) *\n canvas.grid.size;\n position.y -=\n ((this.sourceDocument.elevation ?? 0) / canvas.scene.grid.distance) *\n canvas.grid.size;\n if (\n this.data.isometric?.overlay ||\n this.target instanceof PlaceableObject\n ) {\n position.x += (this.source?.height ?? height) / 2;\n position.y -= (this.source?.height ?? height) / 2;\n }\n }\n\n if (position !== undefined) {\n this._cachedSourceData.position = position;\n }\n\n if (width !== undefined && height !== undefined) {\n this._cachedSourceData.width = width;\n this._cachedSourceData.height = height;\n }\n\n let rotation = 0;\n if (\n this.source instanceof MeasuredTemplate &&\n this.sourceDocument?.t !== \"rect\"\n ) {\n rotation = Math.normalizeRadians(\n Math.toRadians(this.sourceDocument?.direction)\n );\n } else if (!(this.source instanceof MeasuredTemplate)) {\n rotation = this.sourceDocument?.rotation\n ? Math.normalizeRadians(Math.toRadians(this.sourceDocument?.rotation))\n : 0;\n }\n\n if (rotation !== undefined) {\n this._cachedSourceData.rotation = rotation;\n }\n\n const alpha =\n this.sourceDocument instanceof TokenDocument ||\n this.sourceDocument instanceof TileDocument\n ? this.sourceDocument?.alpha ?? 1.0\n : 1.0;\n\n if (alpha !== undefined) {\n this._cachedSourceData.alpha = alpha;\n }\n\n return {\n ...this._cachedSourceData,\n };\n }\n\n /**\n * Gets the target hook name\n *\n * @param {string} type\n * @returns {string|boolean}\n */\n getTargetHook(type = \"\") {\n return this.getHook(type, this.data.target);\n }\n\n /**\n * The target object's current position, or its current position\n *\n * @returns {boolean|object}\n */\n getTargetData() {\n if (this.data.temporary && !this.owner) {\n return (\n SequencerEffectManager.getPositionForUUID(this.data.target) ??\n this.getSourceData()\n );\n }\n\n const position =\n this.target instanceof PlaceableObject && !this.isTargetTemporary\n ? canvaslib.get_object_position(this.target, { measure: true })\n : this.target?.worldPosition || this.target?.center || this.target;\n\n const { width, height } = canvaslib.get_object_dimensions(this.target);\n\n if (this.isIsometricActive && this.target instanceof PlaceableObject) {\n const targetHeight = this.target?.height ?? height;\n position.x +=\n ((this.targetDocument.elevation ?? 0) / canvas.scene.grid.distance) *\n canvas.grid.size +\n targetHeight;\n position.y -=\n ((this.targetDocument.elevation ?? 0) / canvas.scene.grid.distance) *\n canvas.grid.size +\n targetHeight;\n }\n\n if (width !== undefined && height !== undefined) {\n this._cachedTargetData.width = width;\n this._cachedTargetData.height = height;\n }\n\n if (position !== undefined) {\n this._cachedTargetData.position = position;\n }\n\n let rotation = 0;\n if (\n this.target instanceof MeasuredTemplate &&\n this.targetDocument?.t !== \"rect\"\n ) {\n rotation = Math.normalizeRadians(\n Math.toRadians(this.targetDocument?.direction)\n );\n } else if (!(this.target instanceof MeasuredTemplate)) {\n rotation = this.targetDocument?.rotation\n ? Math.normalizeRadians(Math.toRadians(this.targetDocument?.rotation))\n : 0;\n }\n\n if (rotation !== undefined) {\n this._cachedTargetData.rotation = rotation;\n }\n\n const alpha =\n this.targetDocument instanceof TokenDocument ||\n this.targetDocument instanceof TileDocument\n ? this.targetDocument?.alpha ?? 1.0\n : 1.0;\n\n if (alpha !== undefined) {\n this._cachedTargetData.alpha = alpha;\n }\n\n return {\n ...this._cachedTargetData,\n };\n }\n\n /**\n * Calculates the offset for a given offset property and name mapping\n *\n * @param {string} offsetMapName\n * @param {boolean} source\n * @returns {{x: number, y: number}|*}\n * @private\n */\n _getOffset(offsetMapName, source = false) {\n const key = source ? \"source\" : \"target\";\n\n const offset = {\n x: 0,\n y: 0,\n };\n\n let twister = this._twister;\n\n let nameOffsetMap = this._nameOffsetMap?.[this.data.name];\n\n if (nameOffsetMap) {\n twister = nameOffsetMap.twister;\n }\n\n // If the effect is missing, and it's not the source we're offsetting OR it is the source, but we don't have a target (it's playing on the spot)\n if (this.data.missed && (!source || !this.data.target)) {\n let missedOffset =\n this._offsetCache[key]?.missedOffset ||\n canvaslib.calculate_missed_position(this.source, this.target, twister);\n this._offsetCache[key].missedOffset = missedOffset;\n offset.x -= missedOffset.x;\n offset.y -= missedOffset.y;\n }\n\n const obj = source ? this.source : this.target;\n const multiplier = source\n ? this.data.randomOffset?.source\n : this.data.randomOffset?.target;\n\n if (obj && multiplier) {\n let randomOffset =\n this._offsetCache[key]?.randomOffset ||\n canvaslib.get_random_offset(obj, multiplier, twister);\n this._offsetCache[key].randomOffset = randomOffset;\n offset.x -= randomOffset.x;\n offset.y -= randomOffset.y;\n }\n\n let extraOffset = this.data?.offset?.[key];\n if (extraOffset) {\n let newOffset = {\n x: extraOffset.x,\n y: extraOffset.y,\n };\n if (extraOffset.gridUnits) {\n newOffset.x *= canvas.grid.size;\n newOffset.y *= canvas.grid.size;\n }\n if (extraOffset.local) {\n newOffset = canvaslib.rotateAroundPoint(\n 0,\n 0,\n newOffset.x,\n newOffset.y,\n -this.rotationContainer.angle\n );\n }\n offset.x -= newOffset.x;\n offset.y -= newOffset.y;\n }\n\n let offsetMap = this._nameOffsetMap?.[offsetMapName];\n\n if (!this._offsetCache[key][\"nameCache\"][offsetMapName]) {\n this._offsetCache[key][\"nameCache\"][offsetMapName] = {};\n }\n\n if (offsetMap) {\n if (offsetMap.missed) {\n const missedOffset =\n this._offsetCache[key][\"nameCache\"][offsetMapName]?.missedOffset ||\n canvaslib.calculate_missed_position(\n offsetMap.sourceObj,\n offsetMap.targetObj,\n offsetMap.twister\n );\n this._offsetCache[key][\"nameCache\"][offsetMapName].missedOffset =\n missedOffset;\n offset.x -= missedOffset.x;\n offset.y -= missedOffset.y;\n }\n\n const obj = offsetMap.targetObj || offsetMap.sourceObj;\n const multiplier =\n offsetMap.randomOffset?.source || offsetMap.randomOffset?.target;\n\n if (obj && multiplier) {\n let randomOffset =\n this._offsetCache[key][\"nameCache\"][offsetMapName]?.randomOffset ||\n canvaslib.get_random_offset(obj, multiplier, offsetMap.twister);\n this._offsetCache[key][\"nameCache\"][offsetMapName].randomOffset =\n randomOffset;\n offset.x -= randomOffset.x;\n offset.y -= randomOffset.y;\n }\n\n if (offsetMap.offset) {\n offset.x += offsetMap.offset.x;\n offset.y += offsetMap.offset.y;\n }\n }\n\n return offset;\n }\n\n /**\n * Initializes the name offset map by establishing targets\n *\n * @param inOffsetMap\n * @returns {{setup}|*}\n * @private\n */\n _setupOffsetMap(inOffsetMap) {\n if (!inOffsetMap.setup) {\n inOffsetMap.setup = true;\n inOffsetMap.sourceObj = inOffsetMap.source\n ? this._validateObject(inOffsetMap.source)\n : false;\n inOffsetMap.targetObj = inOffsetMap.target\n ? this._validateObject(inOffsetMap.target)\n : false;\n const repetition = this.data.repetition % inOffsetMap.repetitions;\n const seed = lib.get_hash(`${inOffsetMap.seed}-${repetition}`);\n inOffsetMap.twister = new MersenneTwister(seed);\n }\n\n return inOffsetMap;\n }\n\n /**\n * Plays the effect, returning two promises; one that resolves once the duration has been established, and another\n * when the effect has finished playing\n *\n * @returns {Object}\n */\n play() {\n const durationPromise = new Promise((resolve, reject) => {\n this._durationResolve = resolve;\n });\n\n const finishPromise = new Promise(async (resolve, reject) => {\n this._resolve = resolve;\n Hooks.callAll(\"createSequencerEffect\", this);\n lib.debug(`Playing effect:`, this.data);\n this._initialize();\n });\n\n return {\n duration: durationPromise,\n promise: finishPromise,\n };\n }\n\n /**\n * Ends the effect\n */\n endEffect() {\n if (this._ended) return;\n Hooks.callAll(\"endedSequencerEffect\", this);\n this.destroy();\n }\n\n destroy(...args) {\n this._destroyDependencies();\n return super.destroy(...args);\n }\n\n /**\n * Updates this effect with the given parameters\n * @param inUpdates\n * @returns {Promise}\n */\n async update(inUpdates) {\n if (!this.userCanUpdate)\n throw lib.custom_error(\n \"Sequencer\",\n \"CanvasEffect | Update | You do not have permission to update this effect\"\n );\n CanvasEffect.validateUpdate(inUpdates);\n\n const newData = foundry.utils.deepClone(this.data);\n const updateKeys = Object.keys(inUpdates);\n\n updateKeys.forEach((key) => {\n setProperty(newData, key, inUpdates[key]);\n });\n\n if (\n Object.keys(foundry.utils.diffObject(newData, this.data)).length === 0\n ) {\n lib.debug(\n `Skipped updating effect with ID ${this.id} - no changes needed`\n );\n return;\n }\n\n if (this.data.persist) {\n const originalSourceUUID =\n lib.is_UUID(this.data.source) && this.data.attachTo\n ? this.data.source\n : \"Scene.\" + this.data.sceneId;\n\n const newSourceUUID =\n lib.is_UUID(newData.source) && newData.attachTo\n ? newData.source\n : \"Scene.\" + newData.sceneId;\n\n if (originalSourceUUID !== newSourceUUID) {\n flagManager.removeFlags(originalSourceUUID, newData);\n }\n\n flagManager.addFlags(newSourceUUID, newData);\n }\n\n lib.debug(`Updated effect with ID ${this.id}`);\n\n return sequencerSocket.executeForEveryone(\n SOCKET_HANDLERS.UPDATE_EFFECT,\n this.id,\n newData\n );\n }\n\n async addAnimatedProperties({ animations = [], loopingAnimation = [] } = {}) {\n const animationsToAdd = [];\n if (!Array.isArray(animations)) {\n throw lib.custom_error(\n this.data.moduleName,\n `animations must be an array of arrays`\n );\n }\n for (const animationData of animations) {\n if (!Array.isArray(animationData)) {\n throw lib.custom_error(\n this.data.moduleName,\n `each entry in animations must be an array, each with target, property name, and animation options`\n );\n }\n const result = canvaslib.validateAnimation(...animationData);\n if (typeof result === \"string\") {\n throw lib.custom_error(this.data.moduleName, result);\n }\n result.creationTimestamp = +new Date();\n animationsToAdd.push(result);\n }\n if (!Array.isArray(loopingAnimation)) {\n throw lib.custom_error(\n this.data.moduleName,\n `loopingAnimation must be an array of arrays`\n );\n }\n for (const animationData of loopingAnimation) {\n if (!Array.isArray(animationData)) {\n throw lib.custom_error(\n this.data.moduleName,\n `each entry in loopingAnimation must be an array, each with target, property name, and animation options`\n );\n }\n const result = canvaslib.validateLoopingAnimation(...animationData);\n if (typeof result === \"string\") {\n throw lib.custom_error(this.data.moduleName, result);\n }\n result.creationTimestamp = +new Date();\n animationsToAdd.push(result);\n }\n\n if (this.data.persist) {\n const originalSourceUUID =\n lib.is_UUID(this.data.source) && this.data.attachTo\n ? this.data.source\n : \"Scene.\" + this.data.sceneId;\n const newData = foundry.utils.deepClone(this.data);\n newData.animations = (newData.animations ?? []).concat(\n foundry.utils.deepClone(animationsToAdd)\n );\n flagManager.addFlags(originalSourceUUID, newData);\n }\n\n return sequencerSocket.executeForEveryone(\n SOCKET_HANDLERS.ADD_EFFECT_ANIMATIONS,\n this.id,\n animationsToAdd\n );\n }\n\n async _addAnimations(inAnimations) {\n this._playAnimations(inAnimations);\n this.data.animations = (this.data.animations ?? []).concat(inAnimations);\n }\n\n /**\n * Updates the effect\n *\n * @param inUpdates\n * @returns {Promise}\n * @private\n */\n _update(inUpdates) {\n this.data = inUpdates;\n Hooks.callAll(\"updateSequencerEffect\", this);\n this._destroyDependencies();\n return this._reinitialize();\n }\n\n /**\n * Determines whether a position is within the bounds of this effect\n *\n * @param inPosition\n * @returns {boolean}\n */\n isPositionWithinBounds(inPosition) {\n if (!this.spriteContainer) return false;\n return canvaslib.is_position_within_bounds(\n inPosition,\n this.spriteContainer,\n this.parent\n );\n }\n\n /**\n * Initializes the effect and places it on the canvas\n *\n * @param {boolean} play\n * @returns {Promise}\n * @private\n */\n async _initialize(play = true) {\n this.ready = false;\n this._initializeVariables();\n await this._contextLostCallback();\n await this._loadTexture();\n this._addToContainer();\n this._createSprite();\n this._calculateDuration();\n this._createShapes();\n await this._setupMasks();\n await this._transformSprite();\n this._playCustomAnimations();\n this._playPresetAnimations();\n this._setEndTimeout();\n this._timeoutVisibility();\n if (play) await this.playMedia();\n this.ready = true;\n }\n\n /**\n * Reinitializes the effect after it has been updated\n *\n * @param play\n * @returns {Promise}\n * @private\n */\n async _reinitialize(play = true) {\n this.renderable = false;\n if (!this.shouldPlay) {\n return Sequencer.EffectManager._removeEffect(this);\n }\n this.actualCreationTime = +new Date();\n return this._initialize(play);\n }\n\n /**\n * Initializes variables core to the function of the effect\n * This is run as a part of the construction of the effect\n *\n * @private\n */\n _initializeVariables() {\n // Responsible for rotating the sprite\n this.rotationContainer = this.addChild(new PIXI.Container());\n this.rotationContainer.id = this.id + \"-rotationContainer\";\n\n this.isometricContainer = this.rotationContainer.addChild(\n new PIXI.Container()\n );\n this.isometricContainer.id = this.id + \"-isometricContainer\";\n\n // An offset container for the sprite\n this.spriteContainer = this.isometricContainer.addChild(\n new PIXI.Container()\n );\n this.spriteContainer.id = this.id + \"-spriteContainer\";\n\n this._template = this.data.template;\n this._ended = null;\n this._maskContainer = null;\n this._maskSprite = null;\n this._file = null;\n this._loopOffset = 0;\n this.effectFilters = {};\n this._animationDuration = 0;\n this._animationTimes = {};\n this._twister = new MersenneTwister(this.data.creationTimestamp);\n this._video = null;\n this._distanceCache = null;\n this._isRangeFind = false;\n this._customAngle = 0;\n this._currentFilePath = this.data.file;\n this._relatedSprites = {};\n this._hooks = [];\n\n if (this._resetTimeout) {\n clearTimeout(this._resetTimeout);\n }\n this._resetTimeout = null;\n\n this._source = false;\n this._target = false;\n this._offsetCache = {\n source: { nameCache: {} },\n target: { nameCache: {} },\n };\n\n this._nameOffsetMap = Object.fromEntries(\n Object.entries(\n foundry.utils.deepClone(this.data.nameOffsetMap ?? {})\n ).map((entry) => {\n return [entry[0], this._setupOffsetMap(entry[1])];\n })\n );\n\n this.uuid = !lib.is_UUID(this.context.uuid)\n ? this.id\n : this.context.uuid + \".data.flags.sequencer.effects.\" + this.id;\n\n const maxPerformance = game.settings.get(\"core\", \"performanceMode\") === 3;\n const maxFPS = game.settings.get(\"core\", \"maxFPS\");\n\n this._ticker = new PIXI.Ticker();\n this._ticker.maxFPS = maxPerformance && maxFPS === 60 ? 60 : maxFPS;\n this._ticker.start();\n }\n\n /**\n * Destroys all dependencies to this element, such as tickers, animations, textures, and child elements\n *\n * @private\n */\n _destroyDependencies() {\n if (this._ended) return;\n this._ended = true;\n\n this.mask = null;\n\n hooksManager.removeHooks(this.uuid);\n\n try {\n this._ticker.stop();\n this._ticker.destroy();\n } catch (err) {}\n\n this._ticker = null;\n\n Object.values(this._relatedSprites).forEach((sprite) =>\n sprite.destroy({ children: true })\n );\n\n SequencerAnimationEngine.endAnimations(this.id);\n\n if (this._maskContainer) this._maskContainer.destroy({ children: true });\n if (this._maskSprite) {\n try {\n this._maskSprite.texture.destroy(true);\n this._maskSprite.destroy();\n } catch (err) {}\n }\n\n if (this._file instanceof SequencerFileBase) {\n this._file.destroy();\n }\n\n if (this.video) {\n try {\n this.video.removeAttribute(\"src\");\n this.video.pause();\n this.video.load();\n } catch (err) {}\n }\n\n try {\n if (this.data.screenSpace) {\n SequencerAboveUILayer.removeContainerByEffect(this);\n }\n } catch (err) {}\n\n this.removeChildren().forEach((child) => child.destroy({ children: true }));\n }\n\n /**\n * Plays preset animations\n *\n * @private\n */\n _playPresetAnimations() {\n this._moveTowards();\n\n this._fadeIn();\n this._fadeInAudio();\n this._scaleIn();\n this._rotateIn();\n\n this._fadeOut();\n this._fadeOutAudio();\n this._scaleOut();\n this._rotateOut();\n }\n\n /**\n * Gets an object based on an identifier, checking if it exists within the named offset map, whether it's a\n * coordinate object, or if it's an UUID that needs to be fetched from the scene\n *\n * @param inIdentifier\n * @returns {*}\n * @private\n */\n _getObjectByID(inIdentifier) {\n let source = inIdentifier;\n let offsetMap = this._nameOffsetMap?.[inIdentifier];\n if (offsetMap) {\n source = offsetMap?.targetObj || offsetMap?.sourceObj || source;\n } else {\n source = this._validateObject(source);\n }\n return source;\n }\n\n /**\n * Validates the given parameter, whether it's a UUID or a coordinate object, and returns the proper one\n *\n * @param inObject\n * @returns {*}\n * @private\n */\n _validateObject(inObject) {\n if (lib.is_UUID(inObject) || !canvaslib.is_object_canvas_data(inObject)) {\n inObject = lib.get_object_from_scene(inObject, this.data.sceneId);\n inObject = inObject?._object ?? inObject;\n }\n return inObject;\n }\n\n /**\n * Adds this effect to the appropriate container on the right layer\n *\n * @private\n */\n _addToContainer() {\n let layer;\n if (this.data.screenSpaceAboveUI) {\n layer = SequencerAboveUILayer;\n } else if (this.data.screenSpace) {\n layer = canvas.sequencerEffectsUILayer;\n } else if (this.data.aboveLighting) {\n layer = canvas.interface;\n } else {\n layer = canvas.primary;\n }\n\n layer.addChild(this);\n layer.sortChildren();\n }\n\n /**\n * Loads the texture for this effect, handling cases where it's a simple path or a database path\n *\n * @private\n */\n async _loadTexture() {\n if (this.data.file === \"\") {\n return;\n }\n\n if (this.data.customRange) {\n this._file = SequencerFileBase.make(\n this.data.file,\n Object.values(this.template),\n \"temporary.range.file\"\n );\n } else {\n if (!Sequencer.Database.entryExists(this.data.file)) {\n let texture = await SequencerFileCache.loadFile(this.data.file);\n this.video = this.data.file.toLowerCase().endsWith(\".webm\")\n ? texture?.baseTexture?.resource?.source ?? false\n : false;\n this._texture = texture;\n this._file = texture;\n this._currentFilePath = this.data.file;\n return;\n }\n\n this._file = Sequencer.Database.getEntry(this.data.file).clone();\n }\n\n this._file.fileIndex = this.data.forcedIndex;\n this._file.twister = this._twister;\n\n this._isRangeFind = this._file?.rangeFind;\n\n this.spriteSheet = false;\n if (this.data.stretchTo) {\n let ray = new Ray(this.sourcePosition, this.targetPosition);\n this._rotateTowards(ray);\n ray = new Ray(this.sourcePosition, this.targetPosition);\n let { filePath, texture, sheet } = await this._getTextureForDistance(\n ray.distance\n );\n this._currentFilePath = filePath;\n this._texture = texture;\n this.spriteSheet = sheet;\n } else if (\n !this._isRangeFind ||\n (this._isRangeFind && !this.data.stretchTo)\n ) {\n const { filePath, texture, sheet } = await this._file.getTexture();\n this._currentFilePath = filePath;\n this._texture = texture;\n this.spriteSheet = sheet;\n }\n\n if (\n this._isRangeFind &&\n (this.data.stretchTo?.attachTo?.active || this.data.attachTo?.active)\n ) {\n let sprite;\n let spriteType = this.data.tilingTexture ? PIXI.TilingSprite : SpriteMesh;\n if (this.data.xray) {\n sprite = new spriteType(this._texture);\n } else {\n sprite = new spriteType(this._texture, VisionSamplerShader);\n }\n this._relatedSprites[this._currentFilePath] = sprite;\n\n new Promise(async (resolve) => {\n for (let filePath of this._file.getAllFiles()) {\n if (filePath === this._currentFilePath) continue;\n\n let texture = await this._file._getTexture(filePath);\n\n let sprite;\n let spriteType = this.data.tilingTexture\n ? PIXI.TilingSprite\n : SpriteMesh;\n if (this.data.xray) {\n sprite = new spriteType(texture);\n } else {\n sprite = new spriteType(texture, VisionSamplerShader);\n }\n sprite.renderable = false;\n this._relatedSprites[filePath] = sprite;\n }\n\n resolve();\n });\n }\n\n this._template = this._file.template ?? this._template;\n this.video = this._currentFilePath.toLowerCase().endsWith(\".webm\")\n ? this._texture?.baseTexture?.resource?.source\n : false;\n }\n\n /**\n * Calculates the duration of this effect, based on animation durations, the video source duration, end/start times, etc\n *\n * @private\n */\n _calculateDuration() {\n this._animationDuration = this.data.duration || this.mediaDuration * 1000;\n\n // If the effect moves, then infer the duration from the distance divided by the speed\n if (this.data.moveSpeed && this.data.moves) {\n let distance = canvaslib.distance_between(\n this.sourcePosition,\n this.targetPosition\n );\n let durationFromSpeed = (distance / this.data.moveSpeed) * 1000;\n this._animationDuration = Math.max(durationFromSpeed, this.data.duration);\n } else if (!this.data.duration && !this.hasAnimatedMedia) {\n // Determine static image duration\n let fadeDuration =\n (this.data.fadeIn?.duration ?? 0) + (this.data.fadeOut?.duration ?? 0);\n let scaleDuration =\n (this.data.scaleIn?.duration ?? 0) +\n (this.data.scaleOut?.duration ?? 0);\n let rotateDuration =\n (this.data.rotateIn?.duration ?? 0) +\n (this.data.rotateOut?.duration ?? 0);\n let moveDuration = 0;\n if (this.data.moves) {\n let distance = canvaslib.distance_between(\n this.sourcePosition,\n this.targetPosition\n );\n moveDuration =\n (this.data.moveSpeed\n ? (distance / this.data.moveSpeed) * 1000\n : 1000) + this.data.moves.delay;\n }\n\n let animationDurations = this.data.animations\n ? Math.max(\n ...this.data.animations.map((animation) => {\n if (animation.looping) {\n if (animation.loops === 0) return 0;\n return (\n (animation?.duration ?? 0) * (animation?.loops ?? 0) +\n (animation?.delay ?? 0)\n );\n } else {\n return (animation?.duration ?? 0) + (animation?.delay ?? 0);\n }\n })\n )\n : 0;\n\n this._animationDuration = Math.max(\n fadeDuration,\n scaleDuration,\n rotateDuration,\n moveDuration,\n animationDurations\n );\n\n this._animationDuration = this._animationDuration || 1000;\n }\n\n // Clamp effect duration to start time and end time\n this._startTime = 0;\n if (this.data.time?.start && this.mediaCurrentTime !== null) {\n let currentTime = !this.data.time.start.isPerc\n ? this.data.time.start.value ?? 0\n : this._animationDuration * this.data.time.start.value;\n this.mediaCurrentTime = currentTime / 1000;\n this._startTime = this.mediaCurrentTime;\n }\n\n if (this.data.time?.end) {\n this._animationDuration = !this.data.time.end.isPerc\n ? this.data.time.isRange\n ? this.data.time.end.value - this.data.time.start.value\n : this._animationDuration - this.data.time.end.value\n : this._animationDuration * this.data.time.end.value;\n }\n\n this._endTime = this._animationDuration / 1000;\n\n if (\n this._file?.markers &&\n this._startTime === 0 &&\n this._endTime === this.mediaDuration\n ) {\n this._animationTimes.loopStart = this._file.markers.loop.start / 1000;\n this._animationTimes.loopEnd = this._file.markers.loop.end / 1000;\n this._animationTimes.forcedEnd = this._file.markers.forcedEnd / 1000;\n }\n\n this._animationDuration /= this.data.playbackRate ?? 1.0;\n\n // Resolve duration promise so that owner of effect may know when it is finished\n this._durationResolve(this._animationDuration);\n\n this.mediaLooping =\n this._animationDuration / 1000 > this.mediaDuration && !this.data.noLoop;\n\n this.mediaPlaybackRate = this.data.playbackRate\n ? this.data.playbackRate\n : 1.0;\n }\n\n /**\n * If this effect is animatable, hold off on rendering it for a bit so that the animations have time to initialize to\n * prevent it from spawning and then jumping to the right place\n *\n * @private\n */\n _timeoutVisibility() {\n setTimeout(\n () => {\n this._setupHooks();\n },\n this.data.animations ? 50 : 0\n );\n }\n\n /**\n * If this effect is attached to an object, check whether the object has been destroyed, if so, end the effect\n *\n * @private\n */\n _contextLostCallback() {\n if (this.isSourceTemporary) {\n this._ticker.add(() => {\n if (this.isSourceDestroyed) {\n this._ticker.stop();\n this._source = this.sourcePosition;\n SequencerEffectManager.endEffects({ effects: this });\n }\n });\n }\n if (this.isTargetTemporary) {\n this._ticker.add(() => {\n if (this.isTargetDestroyed) {\n this._ticker.stop();\n this._target = this.targetPosition;\n SequencerEffectManager.endEffects({ effects: this });\n }\n });\n }\n }\n\n /**\n * Creates the sprite, and the relevant containers that manage the position and offsets of the overall visual look of the sprite\n *\n * @private\n */\n _createSprite() {\n this.renderable = false;\n\n const args = [this.spriteSheet ? this.spriteSheet : null];\n if (\n !this.data.xray &&\n !this.spriteSheet &&\n !this.data.screenSpace &&\n !this.data.screenSpaceAboveUI\n ) {\n args.push(VisionSamplerShader);\n }\n\n const spriteType = this.spriteSheet ? PIXI.AnimatedSprite : SpriteMesh;\n const sprite = new spriteType(...args);\n this.sprite = this.spriteContainer.addChild(sprite);\n this.sprite.id = this.id + \"-sprite\";\n\n Object.values(this._relatedSprites).forEach((sprite) => {\n this.sprite.addChild(sprite);\n });\n\n this.animatedSprite = false;\n if (this.spriteSheet) {\n this.animatedSprite = true;\n this.sprite.animationSpeed = 0.4;\n this.sprite.loop = false;\n }\n\n let textSprite;\n\n if (this.data.text) {\n const text = this.data.text.text;\n const fontSettings = foundry.utils.deepClone(this.data.text);\n fontSettings.fontSize =\n (fontSettings?.fontSize ?? 26) * (150 / canvas.grid.size);\n\n textSprite = new PIXI.Text(text, fontSettings);\n textSprite.resolution = 5;\n textSprite.zIndex = 1;\n\n textSprite.anchor.set(\n this.data.text?.anchor?.x ?? 0.5,\n this.data.text?.anchor?.y ?? 0.5\n );\n }\n\n this.sprite.filters = [];\n\n if (this.data.filters) {\n for (let index = 0; index < this.data.filters.length; index++) {\n const filterData = this.data.filters[index];\n const filter = new filters[filterData.className](filterData.data);\n filter.id =\n this.id + \"-\" + filterData.className + \"-\" + index.toString();\n this.sprite.filters.push(filter);\n const filterKeyName = filterData.name || filterData.className;\n this.effectFilters[filterKeyName] = filter;\n }\n }\n\n this.alphaFilter = new PIXI.filters.AlphaFilter(this.data.opacity);\n this.alphaFilter.id = this.id + \"-alphaFilter\";\n this.sprite.filters.push(this.alphaFilter);\n\n let spriteOffsetX = this.data.spriteOffset?.x ?? 0;\n let spriteOffsetY = this.data.spriteOffset?.y ?? 0;\n if (this.data.spriteOffset?.gridUnits) {\n spriteOffsetX *= canvas.grid.size;\n spriteOffsetY *= canvas.grid.size;\n }\n\n this.sprite.position.set(spriteOffsetX, spriteOffsetY);\n\n this.sprite.anchor.set(\n this.data.spriteAnchor?.x ?? 0.5,\n this.data.spriteAnchor?.y ?? 0.5\n );\n\n this.sprite.rotation = Math.normalizeRadians(\n Math.toRadians(this.data.spriteRotation ?? 0)\n );\n\n this._customAngle = this.data.angle ?? 0;\n if (this.data.randomRotation) {\n this._customAngle += lib.random_float_between(-360, 360, this._twister);\n }\n\n this.spriteContainer.rotation = -Math.normalizeRadians(\n Math.toRadians(this._customAngle)\n );\n\n if (CONSTANTS.INTEGRATIONS.ISOMETRIC.ACTIVE) {\n this.isometricContainer.rotation = Math.PI / 4;\n }\n\n if (this.data.tint) {\n this.sprite.tint = this.data.tint;\n }\n\n if (textSprite) {\n if (this.data.tint) {\n textSprite.tint = this.data.tint;\n }\n this.sprite.addChild(textSprite);\n }\n\n if (this.shouldShowFadedVersion) {\n this.filters = [\n new PIXI.filters.ColorMatrixFilter({ saturation: -1 }),\n new PIXI.filters.AlphaFilter(\n game.settings.get(CONSTANTS.MODULE_NAME, \"user-effect-opacity\") / 100\n ),\n ];\n }\n\n this.updateElevation();\n }\n\n _createShapes() {\n const nonMaskShapes = (this.data?.shapes ?? []).filter(\n (shape) => !shape.isMask\n );\n this.shapes = {};\n for (const shape of nonMaskShapes) {\n const graphic = canvaslib.createShape(shape);\n graphic.filters = this.sprite.filters;\n this.spriteContainer.addChild(graphic);\n this.shapes[shape?.name ?? \"shape-\" + randomID()] = graphic;\n }\n }\n\n updateElevation() {\n const targetElevation =\n Math.max(\n canvaslib.get_object_elevation(this.source ?? {}),\n canvaslib.get_object_elevation(this.target ?? {})\n ) + 1;\n let effectElevation = this.data.elevation?.elevation ?? 0;\n if (!this.data.elevation?.absolute) {\n effectElevation += targetElevation;\n }\n const isIsometric = getProperty(\n game.scenes.get(this.data.sceneId),\n CONSTANTS.INTEGRATIONS.ISOMETRIC.SCENE_ENABLED\n );\n if (CONSTANTS.INTEGRATIONS.ISOMETRIC.ACTIVE && isIsometric) {\n const sourceSort = this.source\n ? this.sourceMesh.sort + (this.data.isometric?.overlay ? 1 : -1)\n : 0;\n const targetSort = this.target\n ? this.targetMesh.sort + (this.data.isometric?.overlay ? 1 : -1)\n : 0;\n this.sort = Math.max(sourceSort, targetSort);\n } else {\n this.sort = !lib.is_real_number(this.data.zIndex)\n ? this.data.index + this.parent.children.length\n : 100000 + this.data.zIndex;\n }\n this.elevation = effectElevation;\n this.parent.sortChildren();\n }\n\n updateTransform() {\n super.updateTransform();\n if (this.data.screenSpace || this.data.screenSpaceAboveUI) {\n const [screenWidth, screenHeight] = canvas.screenDimensions;\n\n this.position.set(\n (this.data.screenSpacePosition?.x ?? 0) +\n screenWidth *\n (this.data.screenSpaceAnchor?.x ?? this.data.anchor?.x ?? 0.5),\n (this.data.screenSpacePosition?.y ?? 0) +\n screenHeight *\n (this.data.screenSpaceAnchor?.y ?? this.data.anchor?.y ?? 0.5)\n );\n\n if (this.data.screenSpaceScale) {\n const scaleData = this.data.screenSpaceScale ?? { x: 1, y: 1 };\n\n let scaleX = scaleData.x;\n let scaleY = scaleData.y;\n\n if (scaleData.fitX) {\n scaleX = scaleX * (screenWidth / this.sprite.width);\n }\n\n if (scaleData.fitY) {\n scaleY = scaleY * (screenHeight / this.sprite.height);\n }\n\n scaleX = scaleData.ratioX ? scaleY : scaleX;\n scaleY = scaleData.ratioY ? scaleX : scaleY;\n\n this.scale.set(scaleX, scaleY);\n }\n }\n }\n\n async _setupMasks() {\n const maskShapes = this.data.shapes.filter((shape) => shape.isMask);\n\n if (!this.data?.masks?.length && !maskShapes.length) return;\n\n this.masksReady = false;\n\n this._maskContainer = new PIXI.Container();\n\n // const maskFilter = MaskFilter.create();\n // maskFilter.masks = this.data.masks.map(uuid => {\n // const documentObj = fromUuidSync(uuid);\n // if (!documentObj || documentObj.parent !== this.sourceDocument.parent) return false;\n // const obj = documentObj.object;\n // return obj?.mesh ?? obj?.template ?? obj?.shape;\n // }).filter(Boolean)\n //\n // this.sprite.filters.push(maskFilter);\n\n this._maskSprite = new PIXI.Sprite();\n this.parent.addChild(this._maskSprite);\n if (this.sprite) {\n this.sprite.mask = this._maskSprite;\n }\n\n const blurFilter = new filters.Blur({ strength: 2 });\n this._maskContainer.filters = [blurFilter];\n\n for (const uuid of this.data.masks) {\n const documentType = uuid.split(\".\")[2];\n const documentObj = await fromUuid(uuid);\n if (!documentObj || documentObj.parent !== this.sourceDocument.parent)\n continue;\n\n const placeableObject = documentObj.object;\n const objMaskSprite =\n documentType === \"Token\" || documentType === \"Tile\"\n ? new PIXI.Sprite()\n : new PIXI.Graphics();\n objMaskSprite.uuid = uuid;\n objMaskSprite.placeableObject = placeableObject;\n objMaskSprite.documentType = documentType;\n\n const clipFilter = new filters.Clip();\n const blurFilter = new filters.Blur({ strength: 1 });\n objMaskSprite.filters = [blurFilter, clipFilter];\n\n const spriteContainer = new PIXI.Container();\n\n spriteContainer.addChild(objMaskSprite);\n spriteContainer.maskSprite = objMaskSprite;\n spriteContainer.exclude = false;\n\n this._maskContainer.addChild(spriteContainer);\n\n hooksManager.addHook(this.uuid, \"delete\" + documentType, (doc) => {\n if (doc !== documentObj) return;\n const mask = this._maskContainer.children.find(\n (mask) => mask.maskSprite.uuid === doc.uuid\n );\n if (!mask) return;\n mask.destroy();\n this._updateMaskSprite();\n if (!this._maskContainer.children.length) {\n if (this.sprite) {\n this.sprite.mask = null;\n }\n }\n });\n\n hooksManager.addHook(this.uuid, \"update\" + documentType, (doc) => {\n if (doc !== documentObj) return;\n const mask = this._maskContainer.children.find(\n (mask) => mask.maskSprite.uuid === doc.uuid\n );\n if (!mask) return;\n const changed = this._handleUpdatingMask(mask);\n if (changed) this._updateMaskSprite();\n });\n }\n\n let anyMaskChanged = false;\n\n for (const maskShape of maskShapes) {\n const graphic = canvaslib.createShape(maskShape);\n\n const clipFilter = new filters.Clip();\n const blurFilter = new filters.Blur({ strength: 1 });\n graphic.filters = [blurFilter, clipFilter];\n\n const spriteContainer = new PIXI.Container();\n\n spriteContainer.addChild(graphic);\n spriteContainer.maskSprite = graphic;\n spriteContainer.exclude = true;\n\n this._maskContainer.addChild(spriteContainer);\n\n anyMaskChanged = true;\n }\n\n if (!this._maskContainer.children.length) {\n if (this.sprite) {\n this.sprite.mask = null;\n }\n return false;\n }\n\n this._ticker.add(() => {\n for (let container of this._maskContainer.children) {\n if (!container.exclude) {\n anyMaskChanged =\n anyMaskChanged || this._handleUpdatingMask(container);\n }\n }\n\n if (anyMaskChanged) {\n this._updateMaskSprite();\n }\n });\n\n this.masksReady = true;\n }\n\n _handleUpdatingMask(container) {\n const mask = container.maskSprite;\n\n let objectSprite;\n let objectWidth = 0;\n let objectHeight = 0;\n let additionalData = {\n walledmask: getProperty(\n mask.placeableObject,\n \"flags.walledtemplates.enabled\"\n ),\n };\n try {\n if (mask.documentType === \"Token\") {\n objectSprite = mask.placeableObject.mesh;\n objectWidth = objectSprite.width / 2;\n objectHeight = objectSprite.height / 2;\n additionalData[\"img\"] = mask.placeableObject.document.texture.src;\n additionalData[\"elevation\"] = mask.placeableObject.document.elevation;\n } else if (mask.documentType === \"Tile\") {\n objectSprite = mask.placeableObject.mesh;\n objectWidth = objectSprite.width / 2;\n objectHeight = objectSprite.height / 2;\n additionalData[\"img\"] = mask.placeableObject.document.texture.src;\n } else if (mask.documentType === \"Drawing\") {\n objectSprite = mask.placeableObject.shape;\n } else if (mask.documentType === \"MeasuredTemplate\") {\n objectSprite = mask.placeableObject.template;\n additionalData[\"direction\"] = mask.placeableObject.direction;\n additionalData[\"distance\"] = mask.placeableObject.distance;\n additionalData[\"angle\"] = mask.placeableObject.angle;\n additionalData[\"width\"] = mask.placeableObject.width;\n }\n } catch (err) {\n return false;\n }\n\n let position = {\n x: objectSprite.parent.x + objectSprite.x - objectWidth,\n y: objectSprite.parent.y + objectSprite.y - objectHeight,\n };\n\n const angle = objectSprite.angle;\n\n const data = duplicate(additionalData);\n\n const noChange =\n container.position.x === position.x &&\n container.position.y === position.y &&\n mask.scale.x === objectSprite.scale.x &&\n mask.scale.y === objectSprite.scale.y &&\n mask.texture === objectSprite.texture &&\n mask.angle === angle &&\n foundry.utils.isEmpty(foundry.utils.diffObject(mask.oldData, data));\n\n if (noChange) return false;\n\n if (mask.documentType === \"Drawing\") {\n mask.clear();\n mask.beginFill(0xffffff, 1);\n\n const drawingType = mask.placeableObject.type;\n\n if (drawingType === CONST.DRAWING_TYPES.RECTANGLE) {\n mask.drawRect(\n objectSprite.width / -2,\n objectSprite.height / -2,\n objectSprite.width,\n objectSprite.height\n );\n } else if (drawingType === CONST.DRAWING_TYPES.ELLIPSE) {\n mask.drawEllipse(\n objectSprite.width / -2,\n objectSprite.height / -2,\n objectSprite.width / 2,\n objectSprite.height / 2\n );\n } else {\n const vertices = mask.placeableObject.points;\n\n if (drawingType === CONST.DRAWING_TYPES.FREEHAND) {\n // Shamelessly stolen from Foundry's source-code\n let factor = mask.placeableObject.bezierFactor ?? 0.5;\n\n // Get drawing points\n let last = vertices[vertices.length - 1];\n let isClosed = vertices[0].equals(last);\n\n // Handle edge cases\n mask.moveTo(...vertices[0]);\n if (vertices.length < 2) return;\n else if (vertices.length === 2) {\n mask.lineTo(...vertices[1]);\n return;\n }\n\n // Set initial conditions\n let [previous, point] = vertices.slice(0, 2);\n let cp0 = canvaslib.getBezierControlPoints(\n factor,\n last,\n previous,\n point\n ).next_cp0;\n let cp1, next_cp0, next;\n\n // Begin iteration\n for (let i = 1; i < vertices.length; i++) {\n next = vertices[i + 1];\n if (next) {\n let bp = canvaslib.getBezierControlPoints(\n factor,\n previous,\n point,\n next\n );\n cp1 = bp.cp1;\n next_cp0 = bp.next_cp0;\n }\n\n // First point\n if (i === 1 && !isClosed) {\n mask.quadraticCurveTo(cp1.x, cp1.y, point[0], point[1]);\n }\n\n // Last Point\n else if (i === vertices.length - 1 && !isClosed) {\n mask.quadraticCurveTo(cp0.x, cp0.y, point[0], point[1]);\n }\n\n // Bezier points\n else {\n mask.bezierCurveTo(\n cp0.x,\n cp0.y,\n cp1.x,\n cp1.y,\n point[0],\n point[1]\n );\n }\n\n // Increment\n previous = point;\n point = next;\n cp0 = next_cp0;\n }\n } else {\n mask.moveTo(...vertices[0]);\n for (let i = 1; i < vertices.length; i++) {\n mask.lineTo(...vertices[i]);\n }\n }\n }\n\n mask.endFill();\n } else if (mask.documentType === \"MeasuredTemplate\") {\n mask.clear();\n mask.beginFill(0xffffff, 1);\n const shape = mask.placeableObject.shape.clone();\n mask.drawShape(shape);\n }\n\n mask.texture = objectSprite.texture;\n container.position.set(position.x, position.y);\n mask.scale.set(objectSprite.scale.x, objectSprite.scale.y);\n mask.angle = angle;\n mask.oldData = additionalData;\n\n if (mask instanceof PIXI.Sprite) {\n mask.anchor.set(0.5, 0.5);\n mask.position.set(mask.width / 2, mask.height / 2);\n\n if (CONSTANTS.INTEGRATIONS.ISOMETRIC.ACTIVE) {\n const elevation =\n game.settings.get(\n CONSTANTS.INTEGRATIONS.ISOMETRIC.MODULE_NAME,\n \"token_elevation\"\n ) && mask.placeableObject.document?.elevation\n ? (canvas.scene.grid.distance /\n mask.placeableObject.document.elevation) *\n mask.placeableObject.document.height\n : Infinity;\n\n const isometricType = getProperty(\n mask.placeableObject.document,\n CONSTANTS.INTEGRATIONS.ISOMETRIC.PROJECTION_FLAG\n );\n\n switch (isometricType) {\n case CONSTANTS.INTEGRATIONS.ISOMETRIC.PROJECTION_TYPES.TOPDOWN:\n break;\n case CONSTANTS.INTEGRATIONS.ISOMETRIC.PROJECTION_TYPES.DIAMETRIC:\n mask.anchor.set(0.5, 0.75 + 0.505 / elevation);\n break;\n default:\n mask.anchor.set(0.5, 0.69 + 0.63 / elevation);\n break;\n }\n }\n }\n\n return true;\n }\n\n _updateMaskSprite() {\n if (!this.masksReady) return;\n\n const smallestX = this._maskContainer.children.reduce((acc, container) => {\n let x;\n const bounds = container.getBounds();\n if (container.exclude) {\n x = this.x - bounds.width / 2 + container.maskSprite.offset.x;\n } else {\n x = bounds.x;\n }\n return acc >= x ? x : acc;\n }, Infinity);\n\n const smallestY = this._maskContainer.children.reduce((acc, container) => {\n let y;\n const bounds = container.getBounds(true);\n if (container.exclude) {\n y = this.y - bounds.height / 2 + container.maskSprite.offset.y;\n } else {\n y = bounds.y;\n }\n return acc >= y ? y : acc;\n }, Infinity);\n\n this._maskSprite.position.set(smallestX, smallestY);\n\n this._maskSprite.texture.destroy(true);\n this._maskSprite.texture = canvas.app.renderer.generateTexture(\n this._maskContainer\n );\n }\n\n /**\n * Sets up the hooks relating to this effect's source and target\n *\n * @private\n */\n _setupHooks() {\n const attachedToSource =\n this.data.attachTo?.active && lib.is_UUID(this.data.source);\n const attachedToTarget =\n (this.data.stretchTo?.attachTo || this.data.rotateTowards?.attachTo) &&\n lib.is_UUID(this.data.target);\n\n const baseRenderable = this.shouldPlayVisible;\n let renderable = baseRenderable;\n let alpha = null;\n\n if (attachedToSource) {\n hooksManager.addHook(this.uuid, this.getSourceHook(\"delete\"), (doc) => {\n const uuid = doc.uuid;\n if (doc !== this.sourceDocument) return;\n this._source = this._cachedSourceData.position;\n SequencerEffectManager.objectDeleted(uuid);\n });\n\n if (this.data.attachTo?.bindVisibility) {\n hooksManager.addHook(\n this.uuid,\n \"sightRefresh\",\n () => {\n const sourceVisible =\n this.source && (this.sourceMesh?.visible ?? true);\n const sourceHidden =\n this.sourceDocument && (this.sourceDocument?.hidden ?? false);\n const targetVisible =\n this.target &&\n (!attachedToTarget || (this.targetMesh?.visible ?? true));\n this.renderable =\n baseRenderable && (sourceVisible || targetVisible);\n this.alpha = sourceVisible && sourceHidden ? 0.5 : 1.0;\n renderable = baseRenderable && this.renderable;\n },\n true\n );\n }\n\n if (this.data.attachTo?.bindAlpha || this.data.attachTo?.bindElevation) {\n hooksManager.addHook(this.uuid, this.getSourceHook(\"update\"), (doc) => {\n if (doc !== this.sourceDocument) return;\n if (this.data.attachTo?.bindAlpha) {\n this.spriteContainer.alpha = this._cachedSourceData.alpha;\n }\n if (this.data.attachTo?.bindElevation) {\n this.updateElevation();\n }\n });\n }\n\n if (this.data.attachTo?.bindAlpha) {\n alpha = this._cachedSourceData.alpha;\n }\n }\n\n if (attachedToTarget) {\n hooksManager.addHook(this.uuid, this.getTargetHook(\"delete\"), (doc) => {\n if (doc !== this.target) return;\n this._target = this._cachedTargetData.position;\n const uuid = doc.uuid;\n SequencerEffectManager.objectDeleted(uuid);\n });\n hooksManager.addHook(this.uuid, this.getTargetHook(\"update\"), (doc) => {\n if (doc !== this.target) return;\n this.updateElevation();\n });\n }\n\n for (let uuid of this.data?.tiedDocuments ?? []) {\n const tiedDocument = lib.from_uuid_fast(uuid);\n if (tiedDocument) {\n hooksManager.addHook(\n this.uuid,\n this.getHook(\"delete\", tiedDocument.uuid),\n (doc) => {\n if (tiedDocument !== doc) return;\n SequencerEffectManager.objectDeleted(doc.uuid);\n }\n );\n }\n }\n\n setTimeout(() => {\n this.renderable = renderable;\n this.spriteContainer.alpha = alpha ?? 1.0;\n }, 25);\n }\n\n /**\n * Calculates the padding and scale to stretch an effect across the given distance\n *\n * If the file is a SequencerFileBase instance, it will also pick the appropriate file for the right distance\n *\n * @param distance\n * @returns {Object}\n * @private\n */\n async _getTextureForDistance(distance) {\n if (!this._distanceCache || this._distanceCache?.distance !== distance) {\n let scaleX = 1.0;\n let scaleY = 1.0;\n let texture;\n let filePath;\n let spriteAnchor = this.data.anchor?.x ?? 1.0;\n\n if (this._file instanceof SequencerFileBase) {\n const scaledDistance = distance / (this.data.scale.x ?? 1.0);\n const result = await this._file.getTexture(scaledDistance);\n\n filePath = result.filePath;\n\n texture = result.texture;\n\n spriteAnchor = result.spriteAnchor ?? this.data.anchor?.x ?? 0.0;\n\n scaleX = result.spriteScale;\n\n if (this.data.stretchTo?.onlyX) {\n const widthWithPadding =\n texture.width - (this.template.startPoint + this.template.endPoint);\n scaleY = widthWithPadding / texture.width;\n } else {\n scaleY = result.spriteScale;\n }\n } else if (this._file instanceof PIXI.Texture) {\n filePath = this.data.file;\n\n texture = this._file;\n\n spriteAnchor = this.template.startPoint / texture.width;\n\n const widthWithPadding =\n texture.width - (this.template.startPoint + this.template.endPoint);\n let spriteScale = distance / widthWithPadding;\n\n scaleX = spriteScale;\n\n if (this.data.stretchTo?.onlyX) {\n scaleY = widthWithPadding / texture.width;\n } else {\n scaleY = spriteScale;\n }\n }\n\n this._distanceCache = {\n filePath,\n texture,\n spriteAnchor,\n scaleX,\n scaleY,\n distance,\n };\n }\n\n return this._distanceCache;\n }\n\n /**\n * Applies the distance scaling to the sprite based on the previous method\n *\n * @returns {Promise}\n * @private\n */\n async _applyDistanceScaling() {\n const ray = new Ray(this.sourcePosition, this.targetPosition);\n\n this._rotateTowards(ray);\n\n let { filePath, texture, spriteAnchor, scaleX, scaleY, distance } =\n await this._getTextureForDistance(ray.distance);\n\n if (this._currentFilePath !== filePath || !this._relatedSprites[filePath]) {\n this._texture = texture;\n this.video = filePath.toLowerCase().endsWith(\".webm\")\n ? texture?.baseTexture?.resource?.source ?? false\n : false;\n\n Object.values(this._relatedSprites).forEach((subsprite) => {\n subsprite.renderable = false;\n });\n\n this._currentFilePath = filePath;\n\n if (this._relatedSprites[filePath]) {\n this._relatedSprites[filePath].renderable = true;\n } else {\n let sprite;\n let spriteType = this.data.tilingTexture\n ? PIXI.TilingSprite\n : SpriteMesh;\n if (this.data.xray) {\n sprite = new spriteType(texture);\n } else {\n sprite = new spriteType(texture, VisionSamplerShader);\n }\n this._relatedSprites[filePath] = sprite;\n if (this.data.tint) {\n sprite.tint = this.data.tint;\n }\n\n this.sprite.addChild(sprite);\n }\n }\n\n try {\n this._relatedSprites[filePath].texture?.baseTexture?.resource?.source\n .play()\n .then(() => {\n this._relatedSprites[filePath].texture.update();\n });\n } catch (err) {}\n\n if (this._relatedSprites[filePath]) {\n if (this.data.attachTo?.active) {\n this._applyAttachmentOffset();\n }\n\n const sprite = this._relatedSprites[filePath];\n\n if (!sprite.parent) {\n this.sprite.addChild(sprite);\n }\n\n if (this.data.tilingTexture) {\n const scaleX = (this.data.scale.x ?? 1.0) * this.gridSizeDifference;\n const scaleY = (this.data.scale.y ?? 1.0) * this.gridSizeDifference;\n sprite.width = distance / scaleX;\n sprite.height = texture.height;\n sprite.scale.set(scaleX * this.flipX, scaleY * this.flipY);\n\n sprite.tileScale.x = this.data.tilingTexture.scale.x;\n sprite.tileScale.y = this.data.tilingTexture.scale.y;\n\n sprite.tilePosition = this.data.tilingTexture.position;\n } else {\n sprite.scale.set(\n scaleX * (this.data.scale.x ?? 1.0) * this.flipX,\n scaleY * (this.data.scale.y ?? 1.0) * this.flipY\n );\n }\n\n sprite.anchor.set(\n this.flipX === 1 ? spriteAnchor : 1 - spriteAnchor,\n this.data.anchor?.y ?? 0.5\n );\n }\n }\n\n /**\n * Rotates the effect towards the target\n *\n * @param ray\n * @private\n */\n _rotateTowards(ray) {\n if (!ray) {\n const sourcePosition =\n this.flipX === 1 ? this.sourcePosition : this.targetPosition;\n const targetPosition =\n this.flipX === 1 ? this.targetPosition : this.sourcePosition;\n ray = new Ray(sourcePosition, targetPosition);\n }\n\n this.rotationContainer.rotation = Math.normalizeRadians(\n ray.angle + Math.toRadians(this.data.rotateTowards?.rotationOffset ?? 0)\n );\n this._tweakRotationForIsometric();\n }\n\n _tweakRotationForIsometric() {\n if (!CONSTANTS.INTEGRATIONS.ISOMETRIC.ACTIVE) return;\n\n if (this.data.stretchTo) {\n let skew = Math.normalizeRadians(\n this.rotationContainer.rotation - Math.PI / 4\n );\n\n if (\n Math.abs(skew) >= Math.PI / 2 - 0.5 &&\n Math.abs(skew) <= Math.PI / 2 + 0.5\n ) {\n skew -= Math.PI / 2;\n }\n\n this.isometricContainer.skew.set(Math.normalizeRadians(skew), 0);\n this.isometricContainer.rotation = 0;\n } else if (this.data?.isometric?.overlay) {\n this.rotationContainer.rotation = 0;\n let skew = Math.PI / 4 + this.rotationContainer.rotation;\n this.isometricContainer.skew.set(\n Math.normalizeRadians(skew - Math.PI / 4),\n 0\n );\n this.isometricContainer.scale.set(\n 1.0,\n window.scale ?? CONSTANTS.INTEGRATIONS.ISOMETRIC.ISOMETRIC_CONVERSION\n );\n } else {\n this.isometricContainer.rotation = 0;\n }\n }\n\n /**\n * Transforms the sprite, rotating it, stretching it, scaling it, sizing it according its data\n *\n * @private\n */\n async _transformSprite() {\n if (this.data.stretchTo) {\n if (this.data.stretchTo?.attachTo) {\n this._transformStretchToAttachedSprite();\n }\n\n await this._applyDistanceScaling();\n } else {\n if (!this.sprite?.texture?.valid && this._texture?.valid) {\n this.sprite.texture = this._texture;\n }\n }\n\n if (\n this.video &&\n (this._startTime || this._loopOffset > 0) &&\n this.video?.currentTime !== undefined\n ) {\n await lib.wait(20);\n this.sprite.texture.update();\n }\n\n if (!this.data.stretchTo) {\n this._transformNoStretchSprite();\n }\n\n if (this.data.attachTo?.active && !this.data.stretchTo?.attachTo) {\n await this._transformAttachedNoStretchSprite();\n } else {\n if (!this.data.screenSpace) {\n this.position.set(this.sourcePosition.x, this.sourcePosition.y);\n }\n }\n\n if (this.data.rotateTowards) {\n this._rotateTowards();\n\n if (this.data.rotateTowards?.attachTo) {\n this._transformRotateTowardsAttachedSprite();\n }\n }\n\n this._tweakRotationForIsometric();\n\n if (!this.data.anchor && this.data.rotateTowards) {\n const startPointRatio =\n this.template.startPoint / this._texture.width / 2;\n this.spriteContainer.pivot.set(\n this.sprite.width * (-0.5 + startPointRatio),\n 0\n );\n } else {\n this.spriteContainer.pivot.set(\n lib.interpolate(\n this.sprite.width * -0.5,\n this.sprite.width * 0.5,\n this.data.anchor?.x ?? 0.5\n ),\n lib.interpolate(\n this.sprite.height * -0.5,\n this.sprite.height * 0.5,\n this.data.anchor?.y ?? 0.5\n )\n );\n }\n }\n\n _transformStretchToAttachedSprite() {\n this._ticker.add(async () => {\n try {\n await this._applyDistanceScaling();\n } catch (err) {\n //lib.debug_error(err);\n }\n });\n }\n\n _transformNoStretchSprite() {\n if (this.data.tilingTexture) {\n this.sprite.tileScale = {\n x: this.data.tilingTexture.scale.x * this.gridSizeDifference,\n y: this.data.tilingTexture.scale.y * this.gridSizeDifference,\n };\n\n this.sprite.tilePosition = this.data.tilingTexture.position;\n }\n\n const baseScaleX =\n (this.data.scale?.x ?? 1.0) *\n (this.data.spriteScale?.x ?? 1.0) *\n this.flipX;\n const baseScaleY =\n (this.data.scale?.y ?? 1.0) *\n (this.data.spriteScale?.y ?? 1.0) *\n this.flipY;\n\n const heightWidthRatio = this.sprite.height / this.sprite.width;\n const widthHeightRatio = this.sprite.width / this.sprite.height;\n const ratioToUse = heightWidthRatio > widthHeightRatio;\n\n if (this.data.scaleToObject) {\n let { width, height } = this.target\n ? this.getTargetData()\n : this.getSourceData();\n\n const target = this.targetDocument || this.sourceDocument;\n if (target instanceof TokenDocument) {\n width *= this.data.scaleToObject?.considerTokenScale\n ? target.texture.scaleX\n : 1.0;\n height *= this.data.scaleToObject?.considerTokenScale\n ? target.texture.scaleY\n : 1.0;\n }\n\n if (this.data.scaleToObject?.uniform) {\n let newWidth = Math.max(width, height);\n height = Math.max(width, height);\n width = newWidth;\n } else {\n width = width * (ratioToUse ? widthHeightRatio : 1.0);\n height = height * (!ratioToUse ? heightWidthRatio : 1.0);\n }\n\n this.sprite.width =\n width * (this.data.scaleToObject?.scale ?? 1.0) * baseScaleX;\n this.sprite.height =\n height * (this.data.scaleToObject?.scale ?? 1.0) * baseScaleY;\n } else if (this.data.size) {\n let { height, width } = this.data.size;\n\n if (this.data.size.width === \"auto\" || this.data.size.height === \"auto\") {\n height = this.sprite.height;\n width = this.sprite.width;\n\n if (this.data.size.width === \"auto\") {\n height = this.data.size.height;\n if (this.data.size.gridUnits) {\n height *= canvas.grid.size;\n }\n width = height * widthHeightRatio;\n } else if (this.data.size.height === \"auto\") {\n width = this.data.size.width;\n if (this.data.size.gridUnits) {\n width *= canvas.grid.size;\n }\n height = width * heightWidthRatio;\n }\n } else if (this.data.size.gridUnits) {\n height *= canvas.grid.size;\n width *= canvas.grid.size;\n }\n\n this.sprite.width = width * baseScaleX;\n this.sprite.height = height * baseScaleY;\n } else {\n this.sprite.scale.set(\n baseScaleX * this.gridSizeDifference,\n baseScaleY * this.gridSizeDifference\n );\n }\n }\n\n async _transformAttachedNoStretchSprite() {\n const applyRotation =\n this.data.attachTo?.followRotation &&\n !(\n this.sourceDocument instanceof TokenDocument &&\n this.sourceDocument.lockRotation\n ) &&\n (this.sourceDocument?.rotation !== undefined ||\n this.sourceDocument?.direction !== undefined) &&\n !this.data.rotateTowards &&\n !this.data.stretchTo;\n\n this._ticker.add(() => {\n if (this.isDestroyed) return;\n\n if (applyRotation) {\n this.rotationContainer.rotation = this.getSourceData().rotation;\n }\n\n this._tweakRotationForIsometric();\n\n try {\n this._applyAttachmentOffset();\n } catch (err) {\n lib.debug_error(err);\n }\n });\n }\n\n _applyAttachmentOffset() {\n let offset = { x: 0, y: 0 };\n\n if (this.data.attachTo?.align && this.data.attachTo?.align !== \"center\") {\n offset = canvaslib.align({\n context: this.source,\n spriteWidth: this.sprite.width,\n spriteHeight: this.sprite.height,\n align: this.data.attachTo?.align,\n edge: this.data.attachTo?.edge,\n });\n }\n\n this.position.set(\n this.sourcePosition.x - offset.x,\n this.sourcePosition.y - offset.y\n );\n }\n\n _transformRotateTowardsAttachedSprite() {\n this._ticker.add(async () => {\n if (this.isDestroyed) return;\n try {\n this._rotateTowards();\n } catch (err) {\n lib.debug_error(err);\n }\n });\n }\n\n /**\n * Provided an animation targeting the rotation of the sprite's primary container, this method will counter-rotate\n * the sprite in an equal fashion so that the sprite's rotation remains static relative to this animation\n *\n * @param animation\n * @returns {*[]}\n * @private\n */\n _counterAnimateRotation(animation) {\n if (\n animation.target === this.spriteContainer &&\n this.data.zeroSpriteRotation\n ) {\n delete animation.target;\n let counterAnimation = foundry.utils.deepClone(animation);\n animation.target = this.spriteContainer;\n counterAnimation.target = this.sprite;\n if (counterAnimation.values) {\n counterAnimation.values = counterAnimation.values.map(\n (value) => value * -1\n );\n } else {\n counterAnimation.from *= -1;\n counterAnimation.to *= -1;\n }\n if (!Array.isArray(animation)) {\n animation = [animation, counterAnimation];\n } else {\n animation.push(counterAnimation);\n }\n }\n\n return animation;\n }\n\n /**\n * Plays the custom animations of this effect\n *\n * @returns {number}\n * @private\n */\n _playCustomAnimations() {\n if (!this.data.animations) return 0;\n\n this._playAnimations(\n foundry.utils.deepClone(this.data.animations) ?? [],\n this.actualCreationTime - this.data.creationTimestamp\n );\n }\n\n _playAnimations(animations, timeDifference = 0) {\n let animationsToSend = [];\n\n const oneShotAnimations = animations.filter(\n (animation) => !animation.looping && !animation.fromEnd\n );\n\n for (let animation of oneShotAnimations) {\n animation.target = foundry.utils.getProperty(this, animation.target);\n\n if (!animation.target) continue;\n\n if (animation.propertyName.indexOf(\"rotation\") > -1) {\n animation.from = animation.from * (Math.PI / 180);\n animation.to = animation.to * (Math.PI / 180);\n }\n\n if (\n [\"position.x\", \"position.y\", \"height\", \"width\"].includes(\n animation.propertyName\n ) &&\n animation.gridUnits\n ) {\n animation.from *= canvas.grid.size;\n animation.to *= canvas.grid.size;\n }\n\n if ([\"hue\"].includes(animation.propertyName)) {\n animation.getPropertyName = \"values.\" + animation.propertyName;\n }\n\n animationsToSend = animationsToSend.concat(\n this._counterAnimateRotation(animation)\n );\n }\n\n const loopingAnimations = animations.filter(\n (animation) => animation.looping\n );\n\n for (let animation of loopingAnimations) {\n animation.target = foundry.utils.getProperty(this, animation.target);\n\n if (!animation.target) continue;\n\n if (animation.propertyName.indexOf(\"rotation\") > -1) {\n animation.values = animation.values.map((angle) => {\n return angle * (Math.PI / 180);\n });\n }\n\n if (\n [\"position.x\", \"position.y\", \"height\", \"width\"].includes(\n animation.propertyName\n ) &&\n animation.gridUnits\n ) {\n animation.values = animation.values.map((value) => {\n return value * canvas.grid.size;\n });\n }\n\n if ([\"hue\"].includes(animation.propertyName)) {\n animation.getPropertyName = \"values.\" + animation.propertyName;\n }\n\n animationsToSend = animationsToSend.concat(\n this._counterAnimateRotation(animation)\n );\n }\n\n if (!(this instanceof PersistentCanvasEffect)) {\n animationsToSend = animationsToSend.concat(\n this._getFromEndCustomAnimations()\n );\n }\n\n setTimeout(() => {\n SequencerAnimationEngine.addAnimation(\n this.id,\n animationsToSend,\n timeDifference\n );\n }, 20);\n }\n\n _getFromEndCustomAnimations(immediate = false) {\n let fromEndAnimations = [];\n\n const animations = foundry.utils.deepClone(this.data.animations) ?? [];\n\n const oneShotEndingAnimations = animations.filter(\n (animation) => !animation.looping && animation.fromEnd\n );\n\n for (let animation of oneShotEndingAnimations) {\n animation.target = foundry.utils.getProperty(this, animation.target);\n\n if (!animation.target) continue;\n\n animation.delay = lib.is_real_number(immediate)\n ? Math.max(immediate - animation.duration + animation.delay, 0)\n : Math.max(\n this._animationDuration - animation.duration + animation.delay,\n 0\n );\n\n if (animation.propertyName.indexOf(\"rotation\") > -1) {\n animation.from = animation.from * (Math.PI / 180);\n animation.to = animation.to * (Math.PI / 180);\n }\n\n if (\n [\"position.x\", \"position.y\", \"height\", \"width\"].includes(\n animation.propertyName\n ) &&\n animation.gridUnits\n ) {\n animation.from *= canvas.grid.size;\n animation.to *= canvas.grid.size;\n }\n\n fromEndAnimations = fromEndAnimations.concat(\n this._counterAnimateRotation(animation)\n );\n }\n\n return fromEndAnimations;\n }\n\n /**\n * Fades in the effect at the start of the effect\n *\n * @returns {number|*}\n * @private\n */\n _fadeIn() {\n if (!this.data.fadeIn || !this.sprite) return 0;\n\n let fadeIn = this.data.fadeIn;\n\n if (\n this.actualCreationTime -\n (this.data.creationTimestamp + fadeIn.duration + fadeIn.delay) >\n 0\n ) {\n return;\n }\n\n this.alphaFilter.alpha = 0.0;\n\n SequencerAnimationEngine.addAnimation(this.id, {\n target: this.alphaFilter,\n propertyName: \"alpha\",\n to: this.data.opacity,\n duration: fadeIn.duration,\n ease: fadeIn.ease,\n delay: fadeIn.delay,\n absolute: true,\n });\n\n return fadeIn.duration + fadeIn.delay;\n }\n\n /**\n * Fades in the effect's audio at the start of the effect\n *\n * @returns {number|*}\n * @private\n */\n _fadeInAudio() {\n if (!this.data.fadeInAudio || !this.sprite || !this.video) return 0;\n\n let fadeInAudio = this.data.fadeInAudio;\n\n if (\n this.actualCreationTime -\n (this.data.creationTimestamp +\n fadeInAudio.duration +\n fadeInAudio.delay) >\n 0\n )\n return;\n\n this.video.volume = 0.0;\n\n SequencerAnimationEngine.addAnimation(this.id, {\n target: this,\n propertyName: \"video.volume\",\n to:\n (this.data.volume ?? 0) *\n game.settings.get(\"core\", \"globalInterfaceVolume\"),\n duration: fadeInAudio.duration,\n ease: fadeInAudio.ease,\n delay: fadeInAudio.delay,\n absolute: true,\n });\n\n return fadeInAudio.duration + fadeInAudio.delay;\n }\n\n /**\n * Fades out the effect at the end of the effect's duration\n *\n * @returns {number|*}\n * @private\n */\n _fadeOut(immediate = false) {\n if (!this.data.fadeOut || !this.sprite) return 0;\n\n let fadeOut = this.data.fadeOut;\n\n fadeOut.delay = lib.is_real_number(immediate)\n ? Math.max(immediate - fadeOut.duration + fadeOut.delay, 0)\n : Math.max(this._animationDuration - fadeOut.duration + fadeOut.delay, 0);\n\n SequencerAnimationEngine.addAnimation(this.id, {\n target: this.alphaFilter,\n propertyName: \"alpha\",\n to: 0.0,\n duration: fadeOut.duration,\n ease: fadeOut.ease,\n delay: fadeOut.delay,\n absolute: true,\n });\n\n return fadeOut.duration + fadeOut.delay;\n }\n\n /**\n * Fades out the effect at the end of the effect's duration\n *\n * @returns {number|*}\n * @private\n */\n _fadeOutAudio(immediate = false) {\n if (!this.data.fadeOutAudio || !this.sprite || !this.video) return 0;\n\n let fadeOutAudio = this.data.fadeOutAudio;\n\n fadeOutAudio.delay = lib.is_real_number(immediate)\n ? Math.max(immediate - fadeOutAudio.duration + fadeOutAudio.delay, 0)\n : Math.max(\n this._animationDuration - fadeOutAudio.duration + fadeOutAudio.delay,\n 0\n );\n\n SequencerAnimationEngine.addAnimation(this.id, {\n target: this,\n propertyName: \"video.volume\",\n to: 0.0,\n duration: fadeOutAudio.duration,\n ease: fadeOutAudio.ease,\n delay: fadeOutAudio.delay,\n absolute: true,\n });\n\n return fadeOutAudio.duration + fadeOutAudio.delay;\n }\n\n /**\n * Determines the scale to animate from or to\n * @param property\n * @returns {{x: number, y: number}}\n * @private\n */\n _determineScale(property) {\n let scale = {\n x: this.sprite.scale.x,\n y: this.sprite.scale.y,\n };\n\n if (lib.is_real_number(property.value)) {\n scale.x *= property.value * this.gridSizeDifference * this.flipX;\n scale.y *= property.value * this.gridSizeDifference * this.flipY;\n } else {\n scale.x *= property.value.x * this.gridSizeDifference * this.flipX;\n scale.y *= property.value.y * this.gridSizeDifference * this.flipY;\n }\n\n return scale;\n }\n\n /**\n * Scales the effect in at the start of the effect\n *\n * @returns {number|*}\n * @private\n */\n _scaleIn() {\n if (!this.data.scaleIn || !this.sprite) return 0;\n\n let scaleIn = this.data.scaleIn;\n let fromScale = this._determineScale(scaleIn);\n\n if (\n this.actualCreationTime -\n (this.data.creationTimestamp + scaleIn.duration + scaleIn.delay) >\n 0\n )\n return;\n\n let toScale = {\n x: this.sprite.scale.x,\n y: this.sprite.scale.y,\n };\n\n this.sprite.scale.set(fromScale.x, fromScale.y);\n\n SequencerAnimationEngine.addAnimation(this.id, [\n {\n target: this.sprite,\n propertyName: \"scale.x\",\n from: fromScale.x,\n to: toScale.x,\n duration: scaleIn.duration,\n ease: scaleIn.ease,\n delay: scaleIn.delay,\n absolute: true,\n },\n {\n target: this.sprite,\n propertyName: \"scale.y\",\n from: fromScale.y,\n to: toScale.y,\n duration: scaleIn.duration,\n ease: scaleIn.ease,\n delay: scaleIn.delay,\n absolute: true,\n },\n ]);\n\n return scaleIn.duration + scaleIn.delay;\n }\n\n /**\n * Scales the effect out at the end of the effect's duration\n *\n * @returns {number|*}\n * @private\n */\n _scaleOut(immediate = false) {\n if (!this.data.scaleOut || !this.sprite) return 0;\n\n let scaleOut = this.data.scaleOut;\n let scale = this._determineScale(scaleOut);\n\n scaleOut.delay = lib.is_real_number(immediate)\n ? Math.max(immediate - scaleOut.duration + scaleOut.delay, 0)\n : Math.max(\n this._animationDuration - scaleOut.duration + scaleOut.delay,\n 0\n );\n\n SequencerAnimationEngine.addAnimation(this.id, [\n {\n target: this.sprite,\n propertyName: \"scale.x\",\n to: scale.x,\n duration: scaleOut.duration,\n ease: scaleOut.ease,\n delay: scaleOut.delay,\n absolute: true,\n },\n {\n target: this.sprite,\n propertyName: \"scale.y\",\n to: scale.y,\n duration: scaleOut.duration,\n ease: scaleOut.ease,\n delay: scaleOut.delay,\n absolute: true,\n },\n ]);\n\n return scaleOut.duration + scaleOut.delay;\n }\n\n /**\n * Rotates the effect in at the start of the effect\n *\n * @returns {number|*}\n * @private\n */\n _rotateIn() {\n if (!this.data.rotateIn || !this.sprite) return 0;\n\n let rotateIn = this.data.rotateIn;\n\n if (\n this.actualCreationTime -\n (this.data.creationTimestamp + rotateIn.duration + rotateIn.delay) >\n 0\n )\n return;\n\n let original_radians = this.spriteContainer.rotation;\n this.spriteContainer.rotation = rotateIn.value * (Math.PI / 180);\n\n SequencerAnimationEngine.addAnimation(\n this.id,\n this._counterAnimateRotation({\n target: this.spriteContainer,\n propertyName: \"rotation\",\n to: original_radians,\n duration: rotateIn.duration,\n ease: rotateIn.ease,\n delay: rotateIn.delay,\n absolute: true,\n })\n );\n\n return rotateIn.duration + rotateIn.delay;\n }\n\n /**\n * Rotates the effect out at the end of the effect's duration\n *\n * @returns {number|*}\n * @private\n */\n _rotateOut(immediate = false) {\n if (!this.data.rotateOut || !this.sprite) return 0;\n\n let rotateOut = this.data.rotateOut;\n\n rotateOut.delay = lib.is_real_number(immediate)\n ? Math.max(immediate - rotateOut.duration + rotateOut.delay, 0)\n : Math.max(\n this._animationDuration - rotateOut.duration + rotateOut.delay,\n 0\n );\n\n SequencerAnimationEngine.addAnimation(\n this.id,\n this._counterAnimateRotation({\n target: this.spriteContainer,\n propertyName: \"rotation\",\n to: rotateOut.value * (Math.PI / 180),\n duration: rotateOut.duration,\n ease: rotateOut.ease,\n delay: rotateOut.delay,\n absolute: true,\n })\n );\n\n return rotateOut.duration + rotateOut.delay;\n }\n\n /**\n * Causes the effect to move towards the given location\n *\n * @returns {number|*}\n * @private\n */\n _moveTowards() {\n if (!this.data.moves || !this.sprite) return 0;\n\n let moves = this.data.moves;\n\n let movementDuration = this._animationDuration;\n if (this.data.moveSpeed) {\n const distance = canvaslib.distance_between(\n this.sourcePosition,\n this.targetPosition\n );\n movementDuration = (distance / this.data.moveSpeed) * 1000;\n }\n\n if (this.data.moves.rotate) this._rotateTowards();\n\n const duration = movementDuration - moves.delay;\n\n if (\n this.actualCreationTime -\n (this.data.creationTimestamp + duration + moves.delay) >\n 0\n )\n return;\n\n SequencerAnimationEngine.addAnimation(this.id, [\n {\n target: this,\n propertyName: \"position.x\",\n to: this.targetPosition.x,\n duration: duration,\n ease: moves.ease,\n delay: moves.delay,\n },\n {\n target: this,\n propertyName: \"position.y\",\n to: this.targetPosition.y,\n duration: duration,\n ease: moves.ease,\n delay: moves.delay,\n },\n ]);\n\n return duration + moves.delay;\n }\n\n /**\n * If this effect is temporary, this sets the timeout for when the effect should resolve and get removed;\n *\n * @private\n */\n _setEndTimeout() {\n setTimeout(() => {\n this._resolve(this.data);\n this.endEffect();\n }, this._animationDuration);\n }\n\n _setupTimestampHook(offset) {\n if (!this._file?.originalMetadata?.timestamps || this._ended) return;\n const timestamps = this._file.getTimestamps();\n const timestampArray = Array.isArray(timestamps)\n ? timestamps\n : [timestamps];\n for (const timestamp of timestampArray) {\n if (!lib.is_real_number(timestamp)) continue;\n let realTimestamp = timestamp - offset;\n if (realTimestamp < 0) {\n realTimestamp += this._endTime;\n }\n setTimeout(() => {\n if (this._ended) return;\n Hooks.callAll(\"sequencerEffectTimestamp\", this, this._file);\n if (this.mediaLooping) {\n const offsets = (this._endTime - this.mediaCurrentTime) * -1000;\n this._setupTimestampHook(offsets);\n }\n }, realTimestamp);\n }\n }\n}\n\nclass PersistentCanvasEffect extends CanvasEffect {\n /**\n * @OVERRIDE\n * @returns {Promise}\n * @private\n */\n async _initialize() {\n await super._initialize(false);\n await this._startEffect();\n }\n\n /**\n * @OVERRIDE\n * @returns {Promise}\n * @private\n */\n async _reinitialize() {\n await super._reinitialize(false);\n }\n\n /** @OVERRIDE */\n _playPresetAnimations() {\n this._moveTowards();\n this._fadeIn();\n this._scaleIn();\n this._rotateIn();\n }\n\n /**\n * Starts the loop of this effect, calculating the difference between the effect's creation time, and the actual\n * creation time on the client\n *\n * @returns {Promise}\n * @private\n */\n async _startEffect() {\n if (!this.hasAnimatedMedia) return;\n\n let creationTimeDifference =\n this.actualCreationTime - this.data.creationTimestamp;\n\n if (!this.data.noLoop) {\n return this._startLoop(creationTimeDifference);\n }\n\n if (creationTimeDifference < this._animationDuration) {\n this.mediaCurrentTime = creationTimeDifference / 1000;\n if (this._endTime !== this.mediaDuration) {\n setTimeout(() => {\n this.mediaCurrentTime = this._endTime;\n this.sprite.texture.update();\n }, this._endTime * 1000 - creationTimeDifference);\n }\n await this.playMedia();\n return;\n }\n\n await this.pauseMedia();\n this.mediaCurrentTime = this._endTime;\n if (this.sprite.texture && this.video) {\n const oldRenderable = this.renderable;\n this.renderable = false;\n setTimeout(() => {\n this.renderable = oldRenderable;\n this.sprite.texture.update();\n }, 350);\n }\n }\n\n /**\n * Kicks off the loop, or just sets the video to loop\n *\n * @param creationTimeDifference\n * @returns {Promise}\n * @private\n */\n async _startLoop(creationTimeDifference) {\n this.mediaLooping = this.playNaturally;\n if (!this._animationTimes.loopStart) {\n this._loopOffset =\n (creationTimeDifference % this._animationDuration) / 1000;\n } else if (creationTimeDifference / 1000 > this._animationTimes.loopStart) {\n const loopDuration =\n this._animationTimes.loopEnd - this._animationTimes.loopStart;\n this._loopOffset =\n (creationTimeDifference % (loopDuration * 1000)) / 1000;\n }\n return this._resetLoop();\n }\n\n /**\n * Continuously reset the video to the right time so that the start and end time can be preserved\n *\n * @returns {Promise}\n * @private\n */\n async _resetLoop(firstLoop = true) {\n if (this._ended) return;\n\n let loopWaitTime = 0;\n if (this._animationTimes.loopStart) {\n if (this._isEnding) return;\n this.mediaCurrentTime =\n (firstLoop ? 0 : this._animationTimes.loopStart) +\n (this._loopOffset > 0 ? this._loopOffset : 0);\n loopWaitTime =\n (this._animationTimes.loopEnd - this.mediaCurrentTime) * 1000;\n } else {\n this.mediaCurrentTime = this._startTime + this._loopOffset;\n loopWaitTime = this._animationDuration - this._loopOffset * 1000;\n }\n\n await this.playMedia();\n\n if (this.mediaLooping) {\n return;\n }\n\n this._resetTimeout = setTimeout(() => {\n if (this._ended) return;\n this._loopOffset = 0;\n this._resetLoop(false);\n }, loopWaitTime);\n }\n\n /** @OVERRIDE */\n _timeoutVisibility() {\n let creationTimeDifference =\n this.actualCreationTime - this.data.creationTimestamp;\n let timeout =\n creationTimeDifference === 0 && !this.data.animations ? 0 : 50;\n setTimeout(() => {\n this._setupHooks();\n }, timeout);\n }\n\n /** @OVERRIDE */\n _setEndTimeout() {\n let creationTimeDifference =\n this.actualCreationTime - this.data.creationTimestamp;\n if (\n !this.data.noLoop ||\n creationTimeDifference >= this._animationDuration ||\n !(this.hasAnimatedMedia || this.data.text)\n )\n return;\n setTimeout(() => {\n this.pauseMedia();\n }, this._animationDuration);\n }\n\n /** @OVERRIDE */\n async endEffect() {\n if (this._isEnding) return;\n this._isEnding = true;\n let fullWaitDuration = 0;\n let extraEndDuration = this.data.extraEndDuration ?? 0;\n if (this._animationTimes?.forcedEnd) {\n this.mediaCurrentTime = this._animationTimes.forcedEnd;\n fullWaitDuration =\n (this.mediaDuration - (this._animationTimes?.forcedEnd ?? 0)) * 1000;\n } else if (this._animationTimes?.loopEnd) {\n fullWaitDuration = (this.mediaDuration - this.mediaCurrentTime) * 1000;\n this.mediaLooping = false;\n extraEndDuration = Math.max(extraEndDuration, fullWaitDuration);\n }\n const fromEndCustomAnimations =\n this._getFromEndCustomAnimations(extraEndDuration);\n const durations = [\n this._fadeOut(extraEndDuration),\n this._fadeOutAudio(extraEndDuration),\n this._scaleOut(extraEndDuration),\n this._rotateOut(extraEndDuration),\n this.data.extraEndDuration,\n fullWaitDuration,\n ...fromEndCustomAnimations.map(\n (animation) => animation.duration + animation.delay\n ),\n ].filter(Boolean);\n SequencerAnimationEngine.addAnimation(this.id, fromEndCustomAnimations);\n const waitDuration = Math.max(...durations, 0);\n this._resolve(waitDuration);\n return new Promise((resolve) =>\n setTimeout(() => {\n super.endEffect();\n resolve(this.data);\n }, waitDuration)\n );\n }\n}\n","import * as lib from \"./lib.js\";\nimport CanvasEffect from \"../canvas-effects/canvas-effect.js\";\nimport CONSTANTS from \"../constants.js\";\n\nexport function createShape(shape) {\n const graphic = new PIXI.Graphics();\n\n graphic.beginFill(\n shape?.fillColor ?? 0xffffff,\n shape?.fillColor !== undefined ? shape?.fillAlpha ?? 1 : 0\n );\n\n graphic.lineStyle(\n shape.lineSize ?? (shape?.lineColor !== undefined ? 1 : 0),\n shape?.lineColor ?? 0xffffff\n );\n\n const offsetX =\n (shape.offset?.x ?? 0) * (shape.offset?.gridUnits ? canvas.grid.size : 1);\n const offsetY =\n (shape.offset?.y ?? 0) * (shape.offset?.gridUnits ? canvas.grid.size : 1);\n const sizeMultiplier = shape.gridUnits ? canvas.grid.size : 1;\n\n graphic.offset = {\n x: offsetX,\n y: offsetY,\n };\n\n switch (shape.type) {\n case CONSTANTS.SHAPES.CIRC:\n graphic.drawCircle(\n graphic.offset.x,\n graphic.offset.y,\n shape.radius * sizeMultiplier\n );\n break;\n case CONSTANTS.SHAPES.RECT:\n graphic.drawRect(\n graphic.offset.x,\n graphic.offset.y,\n shape.width * sizeMultiplier,\n shape.height * sizeMultiplier\n );\n break;\n case CONSTANTS.SHAPES.ELIP:\n graphic.drawEllipse(\n graphic.offset.x,\n graphic.offset.y,\n shape.width * sizeMultiplier,\n shape.height * sizeMultiplier\n );\n break;\n case CONSTANTS.SHAPES.RREC:\n graphic.drawRoundedRect(\n graphic.offset.x,\n graphic.offset.y,\n shape.width * sizeMultiplier,\n shape.height * sizeMultiplier,\n shape.radius * sizeMultiplier\n );\n break;\n case CONSTANTS.SHAPES.POLY:\n graphic.drawPolygon(\n shape.points.map((point, index) => {\n return new PIXI.Point(\n point[0] * sizeMultiplier + graphic.offset.x,\n point[1] * sizeMultiplier + graphic.offset.y\n );\n })\n );\n break;\n }\n\n graphic.alpha = shape.alpha ?? 1.0;\n\n graphic.endFill();\n\n return graphic;\n}\n\nexport function calculate_missed_position(source, target, twister) {\n const sourcePosition = get_object_position(source);\n\n if (!target) {\n const sourceDimensions = get_object_dimensions(source, true);\n\n const angle = twister.random() * Math.PI * 2;\n let x = Math.cos(angle) * sourceDimensions.width;\n let y = Math.sin(angle) * sourceDimensions.height;\n\n return {\n x: lib.random_float_between(x * 1.5, x * 2.5, twister),\n y: lib.random_float_between(y * 1.5, y * 2.5, twister),\n };\n }\n\n const targetDimensions = get_object_dimensions(target, true);\n const targetPosition = get_object_position(target);\n\n const ray = new Ray(targetPosition, sourcePosition);\n\n let startRadians = ray.angle + Math.PI / 2;\n let endRadians = ray.angle - Math.PI / 2;\n\n let distance = ray.distance / canvas.grid.size - 1;\n\n let angle;\n\n if (distance < 1) {\n angle = twister.random() > 0.5 ? startRadians : endRadians;\n } else {\n distance = Math.max(Math.abs(distance - 15), 6);\n\n endRadians -= Math.PI / distance;\n startRadians += Math.PI / distance;\n\n angle = lib.interpolate(startRadians, endRadians, twister.random());\n }\n\n let x = Math.cos(angle) * targetDimensions.width;\n let y = Math.sin(angle) * targetDimensions.height;\n\n return {\n x: lib.random_float_between(x * 1.5, x * 2.5, twister),\n y: lib.random_float_between(y * 1.5, y * 2.5, twister),\n };\n}\n\nexport function get_object_position(\n obj,\n { measure = false, exact = false } = {}\n) {\n if (obj instanceof CanvasEffect) {\n return obj.worldPosition;\n }\n\n obj = obj?._object ?? obj.object ?? obj;\n\n let pos = {};\n if (obj instanceof MeasuredTemplate) {\n if (measure) {\n if (obj.document.t === \"cone\" || obj.document.t === \"ray\") {\n pos.x = obj.ray.B.x;\n pos.y = obj.ray.B.y;\n }\n }\n if (obj.document.t === \"rect\") {\n pos.x = obj.x;\n pos.y = obj.y;\n\n if (!exact) {\n pos.x += Math.abs(obj.shape.width / 2) + obj.shape.x;\n pos.y += Math.abs(obj.shape.height / 2) + obj.shape.y;\n }\n }\n } else if (obj instanceof Tile) {\n pos = {\n x: obj.document.x,\n y: obj.document.y,\n };\n\n if (!exact) {\n pos.x += Math.abs(obj.document.width / 2);\n pos.y += Math.abs(obj.document.height / 2);\n }\n } else if (obj instanceof Token) {\n pos = {\n x: obj.mesh.x,\n y: obj.mesh.y,\n };\n\n if (exact) {\n const halfSize = get_object_dimensions(obj, true);\n pos.x -= halfSize.width;\n pos.y -= halfSize.height;\n }\n }\n\n pos = {\n x:\n pos.x ??\n obj?.x ??\n obj?.position?.x ??\n obj?.position?._x ??\n obj?.document?.x ??\n obj?.document?.position?.x ??\n 0,\n y:\n pos.y ??\n obj?.y ??\n obj?.position?.y ??\n obj?.position?._y ??\n obj?.document?.y ??\n obj?.document?.position?.y ??\n 0,\n };\n\n if (!lib.is_real_number(pos.x) || !lib.is_real_number(pos.y)) {\n return false;\n }\n\n return pos;\n}\n\nexport function get_random_offset(target, randomOffset, twister = false) {\n let { width, height } = get_object_dimensions(target, true);\n\n width *= randomOffset;\n height *= randomOffset;\n\n return {\n x: lib.random_float_between(width * -1, width, twister),\n y: lib.random_float_between(height * -1, height, twister),\n };\n}\n\nexport function get_object_dimensions(inObj, half = false) {\n inObj = inObj?.object ?? inObj?._object ?? inObj;\n\n let width =\n inObj?.hitArea?.width ??\n inObj?.w ??\n inObj?.shape?.width ??\n (inObj?.shape?.radius ? inObj?.shape?.radius * 2 : undefined) ??\n inObj?.width ??\n canvas.grid.size;\n\n let height =\n inObj?.hitArea?.height ??\n inObj?.h ??\n inObj?.shape?.height ??\n (inObj?.shape?.radius ? inObj?.shape?.radius * 2 : undefined) ??\n inObj?.height ??\n canvas.grid.size;\n\n return {\n width: width / (half ? 2 : 1),\n height: height / (half ? 2 : 1),\n };\n}\n\nexport const alignments = {\n \"top-left\": { x: 0.5, y: 0.5 },\n top: { x: 0, y: 0.5 },\n \"top-right\": { x: -0.5, y: 0.5 },\n left: { x: 0.5, y: 0 },\n center: { x: 0, y: 0 },\n right: { x: -0.5, y: 0 },\n \"bottom-left\": { x: 0.5, y: -0.5 },\n bottom: { x: 0, y: -0.5 },\n \"bottom-right\": { x: -0.5, y: -0.5 },\n};\n\nexport function align({\n context,\n spriteWidth,\n spriteHeight,\n align,\n edge,\n} = {}) {\n let { width, height } = get_object_dimensions(context);\n\n const alignRatio = alignments[align];\n const offset = {\n x: lib.interpolate(width * -0.5, width * 0.5, alignRatio.x + 0.5),\n y: lib.interpolate(height * -0.5, height * 0.5, alignRatio.y + 0.5),\n };\n\n return {\n x:\n offset.x +\n (edge && edge !== \"on\"\n ? spriteWidth * alignRatio.x * (edge === \"outer\" ? 1 : -1)\n : 0),\n y:\n offset.y +\n (edge && edge !== \"on\"\n ? spriteHeight * alignRatio.y * (edge === \"outer\" ? 1 : -1)\n : 0),\n };\n}\n\nexport function is_object_canvas_data(inObj) {\n if (typeof inObj !== \"object\") return false;\n const keys = Object.keys(inObj);\n keys.sort();\n return (\n (keys.includes(\"x\") && keys.includes(\"y\")) ||\n (keys.includes(\"height\") &&\n keys.includes(\"width\") &&\n keys.includes(\"x\") &&\n keys.includes(\"y\"))\n );\n}\n\nexport function get_object_canvas_data(inObject, measure = false) {\n inObject = inObject?.object ?? inObject;\n return {\n ...get_object_position(inObject, { measure }),\n ...get_object_dimensions(inObject?.mesh ?? inObject?.tile ?? inObject),\n elevation: get_object_elevation(inObject),\n uuid: inObject?.document?.uuid ?? inObject?.uuid,\n cachedLocation: true,\n };\n}\n\nexport function get_object_elevation(inObject) {\n return inObject?.document?.elevation ?? inObject?.elevation ?? 0;\n}\n\nexport function get_mouse_position(snapToGrid = false, gridSnap = 2) {\n const pos = canvas.app.renderer.plugins.interaction.mouse.getLocalPosition(\n canvas.app.stage\n );\n return !snapToGrid\n ? new PIXI.Point(pos.x, pos.y)\n : canvas.grid.getSnappedPosition(pos.x, pos.y, gridSnap);\n}\n\nexport function distance_between(p1, p2) {\n return new Ray(p1, p2).distance;\n}\n\n/**\n * Whether the current video is playing or not\n *\n * @returns {boolean}\n */\nexport function is_video_playing(video) {\n return (\n !!video &&\n video.currentTime >= 0 &&\n !video.paused &&\n video.currentTime <= video.duration\n );\n}\n\n/**\n * Determines whether a position is within the bounds of this effect\n *\n * @param inPosition\n * @param inElement\n * @param relativeTo\n * @returns {boolean}\n */\nexport function is_position_within_bounds(inPosition, inElement, relativeTo) {\n const localPosition = inElement.toLocal(inPosition, relativeTo);\n return inElement.getLocalBounds().contains(localPosition.x, localPosition.y);\n}\n\nexport function rotate_coordinate(p1, p2, radians) {\n let cos = Math.cos(radians);\n let sin = Math.sin(radians);\n let nx = cos * (p2.x - p1.x) + sin * (p2.y - p1.y) + p1.x;\n let ny = cos * (p2.y - p1.y) - sin * (p2.x - p1.x) + p1.y;\n return [nx, ny];\n}\n\n/**\n * Gets the closest token to a certain position\n *\n * @param inPosition\n * @param minimumDistance\n * @returns {*|boolean}\n */\nexport function get_closest_token(\n inPosition,\n { minimumDistance = false } = {}\n) {\n let tokens = Array.from(canvas.scene.tokens);\n if (minimumDistance) {\n tokens = tokens.filter(\n (token) =>\n distance_between(get_object_position(token), inPosition) <=\n minimumDistance\n );\n }\n tokens.sort((a, b) => {\n return (\n distance_between(get_object_position(a), inPosition) -\n distance_between(get_object_position(b), inPosition)\n );\n });\n return tokens?.[0] ?? false;\n}\n\nexport function getBezierControlPoints(factor, previous, point, next) {\n // Calculate distance vectors\n let vector = { x: next[0] - previous[0], y: next[1] - previous[1] },\n preDistance = Math.hypot(previous[0] - point[0], previous[1] - point[1]),\n postDistance = Math.hypot(next[0] - point[0], next[1] - point[1]),\n distance = preDistance + postDistance;\n\n // Compute control point locations\n let cp0d = distance === 0 ? 0 : factor * (preDistance / distance),\n cp1d = distance === 0 ? 0 : factor * (postDistance / distance);\n\n // Return points\n return {\n cp1: {\n x: point[0] - vector.x * cp0d,\n y: point[1] - vector.y * cp0d,\n },\n next_cp0: {\n x: point[0] + vector.x * cp1d,\n y: point[1] + vector.y * cp1d,\n },\n };\n}\n\nexport function rotateAroundPoint(cx, cy, x, y, angle) {\n let radians = (Math.PI / 180) * angle,\n cos = Math.cos(radians),\n sin = Math.sin(radians),\n nx = cos * (x - cx) + sin * (y - cy) + cx,\n ny = cos * (y - cy) - sin * (x - cx) + cy;\n return { x: nx, y: ny };\n}\n\nexport function validateAnimation(inTarget, inPropertyName, inOptions) {\n if (typeof inPropertyName !== \"string\") {\n return `inPropertyName must be of type string`;\n }\n if (typeof inTarget !== \"string\") {\n return `inTarget must be of type string`;\n }\n if (!lib.is_real_number(inOptions.from)) {\n return `inOptions.from must be of type number`;\n }\n if (!lib.is_real_number(inOptions.to)) {\n return `inOptions.to must be of type number`;\n }\n if (!lib.is_real_number(inOptions.duration)) {\n return `inOptions.duration must be of type number`;\n }\n if (inOptions?.delay !== undefined && !lib.is_real_number(inOptions.delay)) {\n return `inOptions.delay must be of type number`;\n }\n if (inOptions?.ease !== undefined && typeof inOptions.ease !== \"string\") {\n return `inOptions.ease must be of type string`;\n }\n if (\n inOptions?.fromEnd !== undefined &&\n typeof inOptions.fromEnd !== \"boolean\"\n ) {\n return `inOptions.fromEnd must be of type boolean`;\n }\n if (inOptions?.gridUnits !== undefined) {\n if (typeof inOptions.gridUnits !== \"boolean\") {\n return `inOptions.gridUnits must be of type boolean`;\n }\n if (\n inOptions.gridUnits &&\n ![\n \"position.x\",\n \"position.y\",\n \"scale.x\",\n \"scale.y\",\n \"height\",\n \"width\",\n ].includes(inPropertyName)\n ) {\n return `if inOptions.gridUnits is true, inPropertyName must be position.x, position.y, scale.x, scale.y, width, or height`;\n }\n }\n\n return {\n target: inTarget,\n propertyName: inPropertyName,\n from: inOptions?.from,\n to: inOptions?.to,\n duration: inOptions?.duration ?? 0,\n delay: inOptions?.delay ?? 0,\n ease: inOptions?.ease ?? \"linear\",\n looping: false,\n fromEnd: inOptions?.fromEnd ?? false,\n gridUnits: inOptions?.gridUnits ?? false,\n };\n}\n\nexport function validateLoopingAnimation(inTarget, inPropertyName, inOptions) {\n if (typeof inPropertyName !== \"string\") {\n return `inPropertyName must be of type string`;\n }\n if (typeof inTarget !== \"string\") {\n return `inTarget must be of type string`;\n }\n\n if (!inOptions?.values) {\n if (!inOptions?.from === undefined || !inOptions?.to === undefined) {\n return `if inOptions.values is not set, you must provide inOptions.from and inOptions.to`;\n }\n if (!lib.is_real_number(inOptions.from)) {\n return `inOptions.from must be of type number`;\n }\n if (!lib.is_real_number(inOptions.to)) {\n return `inOptions.to must be of type number`;\n }\n inOptions.values = [inOptions?.from, inOptions?.to];\n delete inOptions.from;\n delete inOptions.to;\n } else {\n if (!Array.isArray(inOptions.values)) {\n return `inOptions.values must be of type array`;\n }\n inOptions.values.forEach((value) => {\n if (!lib.is_real_number(value)) {\n return `values in inOptions.keys must be of type number`;\n }\n });\n }\n\n if (!lib.is_real_number(inOptions.duration)) {\n return `inOptions.duration must be of type number`;\n }\n\n if (inOptions?.delay !== undefined && !lib.is_real_number(inOptions.delay)) {\n return `inOptions.delay must be of type number`;\n }\n if (inOptions?.ease !== undefined && typeof inOptions.ease !== \"string\") {\n return `inOptions.ease must be of type string`;\n }\n if (inOptions?.loops !== undefined && !lib.is_real_number(inOptions.loops)) {\n return `inOptions.loops must be of type number`;\n }\n if (\n inOptions?.pingPong !== undefined &&\n typeof inOptions.pingPong !== \"boolean\"\n ) {\n return `inOptions.pingPong must be of type boolean`;\n }\n if (inOptions?.gridUnits !== undefined) {\n if (typeof inOptions.gridUnits !== \"boolean\") {\n return `inOptions.gridUnits must be of type boolean`;\n }\n if (\n inOptions.gridUnits &&\n ![\n \"position.x\",\n \"position.y\",\n \"scale.x\",\n \"scale.y\",\n \"height\",\n \"width\",\n ].includes(inPropertyName)\n ) {\n return `if inOptions.gridUnits is true, inPropertyName must be position.x, position.y, scale.x, scale.y, width, or height`;\n }\n }\n\n return {\n target: inTarget,\n propertyName: inPropertyName,\n values: inOptions?.values,\n duration: inOptions?.duration ?? 0,\n delay: inOptions?.delay ?? 0,\n ease: inOptions?.ease ?? \"linear\",\n looping: true,\n loops: inOptions?.loops,\n indefinite:\n inOptions?.loops === undefined || !lib.is_real_number(inOptions?.loops),\n pingPong: inOptions?.pingPong ?? false,\n gridUnits: inOptions?.gridUnits ?? false,\n };\n}\n","import { writable, get } from \"svelte/store\";\nimport { EffectPlayer } from \"../../modules/sequencer-interaction-manager.js\";\nimport CONSTANTS from \"../../constants.js\";\n\nconst PlayerSettings = {\n file: {\n label: \"SEQUENCER.Player.Option.File\",\n store: writable(\"\"),\n default: \"\",\n },\n scale: {\n label: \"SEQUENCER.Player.Option.Scale\",\n store: writable(1.0),\n default: 1.0,\n },\n users: {\n label: \"SEQUENCER.Player.Option.ForUsers\",\n store: writable([]),\n default: [],\n },\n belowTokens: {\n label: \"SEQUENCER.Player.Option.BelowTokens\",\n store: writable(false),\n default: false,\n },\n snapToGrid: {\n label: \"SEQUENCER.Player.Option.SnapToGrid\",\n store: writable(false),\n default: false,\n },\n rotation: {\n label: \"SEQUENCER.Player.Option.Rotation\",\n store: writable(0),\n default: 0,\n },\n randomRotation: {\n label: \"SEQUENCER.Player.Option.Randomize\",\n store: writable(false),\n default: false,\n },\n fadeIn: {\n label: \"SEQUENCER.Player.Option.FadeIn\",\n store: writable(0),\n default: 0,\n },\n fadeOut: {\n label: \"SEQUENCER.Player.Option.FadeOut\",\n store: writable(0),\n default: 0,\n },\n scaleIn: {\n label: \"SEQUENCER.Player.Option.ScaleIn\",\n store: writable(0),\n default: 0,\n },\n scaleOut: {\n label: \"SEQUENCER.Player.Option.ScaleOut\",\n store: writable(0),\n default: 0,\n },\n\n mirrorX: {\n label: \"SEQUENCER.Player.Option.MirrorX\",\n store: writable(false),\n default: false,\n },\n mirrorY: {\n label: \"SEQUENCER.Player.Option.MirrorY\",\n store: writable(false),\n default: false,\n },\n randomMirrorX: {\n label: \"SEQUENCER.Player.Option.Randomize\",\n store: writable(false),\n default: false,\n },\n randomMirrorY: {\n label: \"SEQUENCER.Player.Option.Randomize\",\n store: writable(false),\n default: false,\n },\n\n offsetX: {\n label: \"SEQUENCER.Player.Option.OffsetX\",\n store: writable(0),\n default: 0,\n },\n offsetY: {\n label: \"SEQUENCER.Player.Option.OffsetY\",\n store: writable(0),\n default: 0,\n },\n\n offsetGridUnits: {\n label: \"SEQUENCER.Player.Option.GridUnits\",\n store: writable(false),\n default: false,\n },\n\n randomOffsetAmount: {\n label: \"SEQUENCER.Player.Option.RandomOffset\",\n store: writable(0),\n default: 0,\n },\n\n randomOffset: {\n label: \"SEQUENCER.Player.Option.Randomize\",\n store: writable(false),\n default: false,\n },\n\n preload: {\n label: \"SEQUENCER.Player.Option.Preload\",\n store: writable(false),\n default: false,\n },\n moveTowards: {\n label: \"SEQUENCER.Player.Option.DragBehavior\",\n label_off: \"SEQUENCER.Player.Option.DragStretch\",\n label_on: \"SEQUENCER.Player.Option.DragMove\",\n store: writable(false),\n default: false,\n },\n moveSpeed: {\n label: \"SEQUENCER.Player.Option.MoveSpeed\",\n store: writable(0),\n default: 0,\n },\n attachTo: {\n label: \"SEQUENCER.Player.Option.AttachTo\",\n store: writable(false),\n default: false,\n callback: (e) => {\n EffectPlayer.sourceAttach = e.target.checked;\n },\n },\n stretchToAttach: {\n label: \"SEQUENCER.Player.Option.StretchToAttach\",\n store: writable(false),\n default: false,\n callback: (e) => {\n EffectPlayer.targetAttach = e.target.checked;\n },\n },\n persist: {\n label: \"SEQUENCER.Player.Option.Persist\",\n store: writable(false),\n default: false,\n },\n repeat: {\n label: \"SEQUENCER.Player.Option.Repeat\",\n store: writable(false),\n default: false,\n },\n repetitions: {\n label: \"SEQUENCER.Player.Option.Repetitions\",\n store: writable(1.0),\n default: 1.0,\n },\n repeatDelayMin: {\n label: \"SEQUENCER.Player.Option.DelayMin\",\n store: writable(200),\n default: 200,\n },\n repeatDelayMax: {\n label: \"SEQUENCER.Player.Option.DelayMax\",\n store: writable(400),\n default: 400,\n },\n};\n\nPlayerSettings.export = () => {\n return Object.fromEntries(\n Object.entries(PlayerSettings).map((entry) => {\n return [entry[0], get(entry[1].store)];\n })\n );\n};\n\nPlayerSettings.import = (settings) => {\n Object.entries(PlayerSettings).forEach((entry) => {\n if (settings?.[entry[0]] !== undefined) {\n entry[1].store.set(settings?.[entry[0]]);\n } else if (entry[1]?.default !== undefined) {\n entry[1].store.set(entry[1].default);\n }\n });\n};\n\nPlayerSettings.getPresets = () => {\n return Object.keys(game.settings.get(CONSTANTS.MODULE_NAME, \"effectPresets\"));\n};\n\nPlayerSettings.loadPreset = (name) => {\n const effectPresets = game.settings.get(\n CONSTANTS.MODULE_NAME,\n \"effectPresets\"\n );\n return PlayerSettings.import(effectPresets[name]);\n};\n\nPlayerSettings.savePreset = async (name) => {\n const newName = await promptNewPresetName(name);\n if (!newName) return;\n const effectPresets = game.settings.get(\n CONSTANTS.MODULE_NAME,\n \"effectPresets\"\n );\n effectPresets[newName] = PlayerSettings.export();\n return game.settings.set(\n CONSTANTS.MODULE_NAME,\n \"effectPresets\",\n effectPresets\n );\n};\n\nPlayerSettings.copyPreset = async (name) => {\n const newName = await promptNewPresetName(name, true);\n if (!newName) return;\n const effectPresets = game.settings.get(\n CONSTANTS.MODULE_NAME,\n \"effectPresets\"\n );\n effectPresets[newName] = PlayerSettings.export();\n return game.settings.set(\n CONSTANTS.MODULE_NAME,\n \"effectPresets\",\n effectPresets\n );\n};\n\nPlayerSettings.deletePreset = (name) => {\n const effectPresets = game.settings.get(\n CONSTANTS.MODULE_NAME,\n \"effectPresets\"\n );\n delete effectPresets[name];\n return game.settings.set(\n CONSTANTS.MODULE_NAME,\n \"effectPresets\",\n effectPresets\n );\n};\n\nasync function promptNewPresetName(inName, copy = false) {\n const effectPresets = game.settings.get(\n CONSTANTS.MODULE_NAME,\n \"effectPresets\"\n );\n\n let title = copy\n ? game.i18n.localize(\"SEQUENCER.Player.CopyPresetTitle\")\n : game.i18n.localize(\"SEQUENCER.Player.CreateNewPresetTitle\");\n\n let presetName = await new Promise((resolve) => {\n let rejected = false;\n new Dialog({\n title: title,\n content: `

`,\n buttons: {\n okay: {\n icon: '',\n label: game.i18n.localize(\"SEQUENCER.OK\"),\n callback: async (html) => {\n let name = html.find(\"#newPresetName\").val();\n\n if (name === \"\" || !name) {\n name = false;\n rejected = true;\n }\n\n resolve(name);\n },\n },\n cancel: {\n icon: '',\n label: game.i18n.localize(\"SEQUENCER.Cancel\"),\n callback: () => {\n rejected = true;\n resolve(false);\n },\n },\n },\n close: () => {},\n render: (html) => {\n html.find(\"#newPresetName\").val(inName).focus();\n },\n }).render(true);\n });\n\n if (presetName) {\n if (presetName.toLowerCase() === \"default\") {\n Dialog.prompt({\n title: game.i18n.localize(\"SEQUENCER.Player.DefaultErrorTitle\"),\n content: `

${game.i18n.localize(\n \"SEQUENCER.Player.DefaultErrorContent\"\n )}

`,\n label: game.i18n.localize(\"SEQUENCER.OK\"),\n callback: () => {},\n });\n return false;\n }\n\n if (effectPresets[presetName]) {\n const overwrite = await Dialog.confirm({\n title: game.i18n.localize(\"SEQUENCER.Player.OverwritePresetTitle\"),\n content: `

${game.i18n.format(\n \"SEQUENCER.Player.OverwritePresetContent\",\n { preset_name: presetName }\n )}

`,\n });\n\n if (!overwrite) {\n presetName = await promptPresetName(presetName);\n }\n }\n }\n\n return presetName;\n}\n\nPlayerSettings.migrateOldPresets = () => {\n if (!game.user.isGM) return;\n\n const effectPresets = game.settings.get(\n CONSTANTS.MODULE_NAME,\n \"effectPresets\"\n );\n\n const presetsToUpdate = Object.values(effectPresets).filter((preset) => {\n return !preset?.version;\n });\n\n if (!presetsToUpdate.length) return;\n\n const newEffectPresets = Object.fromEntries(\n Object.entries(effectPresets).map(([name, preset]) => {\n if (preset?.version) return [name, preset];\n preset.version = game.modules.get(CONSTANTS.MODULE_NAME).version;\n if (preset.repetitions > 1) {\n preset.repeat = true;\n }\n if (preset.randomMirrorY) {\n preset.mirrorY = true;\n }\n if (preset.randomOffset) {\n preset.randomOffsetAmount = 1;\n preset.offsetGridUnits = true;\n }\n return [name, preset];\n })\n );\n\n return game.settings.set(\n CONSTANTS.MODULE_NAME,\n \"effectPresets\",\n newEffectPresets\n );\n};\n\nexport { PlayerSettings };\n","import * as lib from \"../lib/lib.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport SequencerEffectManager from \"./sequencer-effect-manager.js\";\nimport CONSTANTS from \"../constants.js\";\nimport SequencerFileCache from \"./sequencer-file-cache.js\";\nimport { EffectsUIApp } from \"../formapplications/effects-ui/effects-ui-app.js\";\nimport { get } from \"svelte/store\";\nimport { PlayerSettings } from \"../formapplications/effects-ui/effect-player-store.js\";\n\n/**\n * -------------------------------------------------------------\n * | THIS IS A MESS, YOU HAVE BEEN WARNED |\n * -------------------------------------------------------------\n */\n\nexport const InteractionManager = {\n startDragPosition: false,\n\n state: {\n LeftMouseDown: false,\n RightMouseDown: false,\n Dragging: false,\n },\n\n get isLayerActive() {\n return canvas.sequencerInterfaceLayer.active;\n },\n\n initialize() {\n window.addEventListener(\"mousedown\", (event) => {\n if (!canvas.ready) return;\n if (!this.isLayerActive) return;\n const hover = document.elementFromPoint(event.clientX, event.clientY);\n if (!hover || hover.id !== \"board\") return;\n\n const button = event.button;\n if (!(button === 0 || button === 2)) return;\n if (button === 0) {\n this.state.LeftMouseDown = true;\n this._propagateEvent(\"mouseLeftDown\");\n }\n if (button === 2) {\n this.state.RightMouseDown = true;\n this._propagateEvent(\"mouseRightDown\");\n }\n });\n\n window.addEventListener(\"mouseup\", (event) => {\n if (!canvas.ready) return;\n if (!this.isLayerActive) return;\n const hover = document.elementFromPoint(event.clientX, event.clientY);\n if (!hover || hover.id !== \"board\") return;\n if (document.activeElement.tagName !== \"BODY\") return;\n\n const button = event.button;\n if (!(button === 0 || button === 2)) return;\n if (button === 0) {\n this.state.LeftMouseDown = false;\n this._propagateEvent(\"mouseLeftUp\");\n this.state.Dragging = false;\n this.startDragPosition = false;\n }\n if (button === 2) {\n this.state.RightMouseDown = false;\n this._propagateEvent(\"mouseRightUp\");\n this.state.Dragging = false;\n this.startDragPosition = false;\n }\n });\n\n window.addEventListener(\"mousemove\", (event) => {\n if (!canvas.ready) return;\n const hover = document.elementFromPoint(event.clientX, event.clientY);\n if (!hover || hover.id !== \"board\") return;\n if (!this.isLayerActive) return;\n this._propagateEvent(\"mouseMove\");\n if (this.state.LeftMouseDown && !this.startDragPosition) {\n this.startDragPosition = canvaslib.get_mouse_position();\n }\n if (this.state.LeftMouseDown && !this.state.Dragging) {\n const distance = canvaslib.distance_between(\n this.startDragPosition,\n canvaslib.get_mouse_position()\n );\n this.state.Dragging = distance > 20;\n }\n });\n\n EffectPlayer.initialize();\n SelectionManager.initialize();\n },\n\n tearDown() {\n EffectPlayer.tearDown();\n SelectionManager.tearDown();\n },\n\n _propagateEvent(eventName) {\n if (EffectPlayer.isActive && EffectPlayer[eventName]) {\n EffectPlayer[eventName]();\n }\n if (SelectionManager.isActive && SelectionManager[eventName]) {\n SelectionManager[eventName]();\n }\n },\n};\n\nexport const EffectPlayer = {\n sequenceBuffer: [],\n\n playMany: false,\n playManySequenced: false,\n\n cursorPos: false,\n startPos: false,\n endPos: false,\n\n get snapLocationToGrid() {\n return get(PlayerSettings.snapToGrid.store);\n },\n\n get sourceAttach() {\n return get(PlayerSettings.attachTo.store);\n },\n\n get targetAttach() {\n return get(PlayerSettings.stretchToAttach.store);\n },\n\n sourceAttachFound: false,\n targetAttachFound: false,\n\n get isActive() {\n return (\n InteractionManager.isLayerActive && game?.activeTool === \"play-effect\"\n );\n },\n\n /**\n * Opens the Sequencer Effects UI with the player tab open\n */\n show() {\n return EffectsUIApp.show({ tab: \"player\" });\n },\n\n initialize() {\n this.layer = canvas.sequencerInterfaceLayer;\n },\n\n tearDown() {\n this._reset();\n },\n\n /**\n * Mouse events\n */\n mouseLeftDown() {\n this._evaluateStartPosition();\n },\n\n mouseLeftUp() {\n if (!this.startPos) return;\n this._playEffect();\n this.startPos = false;\n this.endPos = false;\n this.sourceAttachFound = false;\n this.targetAttachFound = false;\n },\n\n mouseRightUp() {\n this._reset();\n },\n\n mouseMove() {\n this._evaluateCursorPosition();\n\n if (InteractionManager.state.Dragging) {\n this._evaluateEndPosition();\n }\n },\n\n /**\n * Hotkeys\n */\n playManyUp() {\n this._playEffects();\n this._reset();\n },\n\n /**\n * Private methods\n */\n _evaluatePosition(attach = false) {\n let position = canvaslib.get_mouse_position(this.snapLocationToGrid);\n\n const attachToObject = attach\n ? canvaslib.get_closest_token(position, {\n minimumDistance: canvas.grid.size,\n })\n : false;\n\n let attachFound = false;\n if (attachToObject) {\n attachFound = true;\n position = canvaslib.get_object_position(attachToObject);\n }\n\n return [position, attachFound];\n },\n\n _evaluateCursorPosition() {\n const attach = InteractionManager.state.Dragging\n ? this.targetAttach\n : this.sourceAttach;\n\n [this.cursorPos] = this._evaluatePosition(attach);\n },\n\n _evaluateStartPosition() {\n if (this.startPos) return;\n\n [this.startPos, this.sourceAttachFound] = this._evaluatePosition(\n this.sourceAttach\n );\n },\n\n _evaluateEndPosition() {\n [this.endPos, this.targetAttachFound] = this._evaluatePosition(\n this.targetAttach\n );\n },\n\n _reset() {\n if (!this.layer) return;\n this.startPos = false;\n this.endPos = false;\n this.sourceAttachFound = false;\n this.targetAttachFound = false;\n this.sequenceBuffer = [];\n this._evaluateCursorPosition();\n },\n\n async _playEffect() {\n const settings = foundry.utils.mergeObject(PlayerSettings.export(), {\n ...InteractionManager.state,\n startPos: this.startPos,\n endPos: this.endPos,\n });\n\n if (!settings.users.length || settings.users?.[0] === \"all\")\n settings.users = [];\n\n if (settings.file === \"\") return;\n\n if (\n !(\n Sequencer.Database.entryExists(settings.file) ||\n (await SequencerFileCache.srcExists(settings.file))\n )\n ) {\n throw lib.custom_error(\n \"Sequencer\",\n `Sequencer Player | Could not find file or database entry: ${settings.file}`\n );\n }\n\n if (settings.preload) {\n await Sequencer.Preloader.preloadForClients(settings.file);\n }\n\n const sequence =\n this.sequenceBuffer.length > 0 && this.playManySequenced\n ? this.sequenceBuffer[this.sequenceBuffer.length - 1]\n : new Sequence();\n\n const effect = sequence\n .effect()\n .file(settings.file)\n .forUsers(settings.users)\n .mirrorX(settings.mirrorX && !settings.randomMirrorX)\n .mirrorY(settings.mirrorY && !settings.randomMirrorY)\n .randomizeMirrorX(settings.randomMirrorX)\n .randomizeMirrorY(settings.randomMirrorY)\n .persist(settings.persist)\n .belowTokens(settings.belowTokens);\n\n if (settings.repeat) {\n effect.repeats(\n settings.repetitions,\n settings.repeatDelayMin,\n settings.repeatDelayMax\n );\n }\n\n if (settings.fadeIn > 0) effect.fadeIn(settings.fadeIn);\n if (settings.fadeOut > 0) effect.fadeOut(settings.fadeOut);\n\n const offsetData = settings.randomOffset\n ? {\n offset: { x: settings.offsetX, y: settings.offsetY },\n gridUnits: settings.offsetGridUnits,\n }\n : {};\n const offsetSource = !settings.Dragging ? offsetData : {};\n const attachToObject = settings.attachTo\n ? canvaslib.get_closest_token(settings.startPos, {\n minimumDistance: canvas.grid.size,\n })\n : false;\n if (attachToObject) {\n effect.attachTo(attachToObject, {\n randomOffset:\n settings.randomOffset && !settings.Dragging\n ? settings.randomOffsetAmount\n : false,\n ...offsetSource,\n });\n } else {\n effect.atLocation(settings.startPos, {\n randomOffset:\n settings.randomOffset && !settings.Dragging\n ? settings.randomOffsetAmount\n : false,\n ...offsetSource,\n });\n }\n\n if (\n settings.persist &&\n settings.name &&\n settings.name !== \"\" &&\n settings.name !== \"default\" &&\n settings.name !== \"new\"\n ) {\n effect.name(\"Preset: \" + settings.name);\n }\n\n if (settings.Dragging) {\n if (settings.moveTowards) {\n effect.moveTowards(settings.endPos, {\n randomOffset: settings.randomOffset\n ? settings.randomOffsetAmount\n : false,\n ...offsetData,\n });\n if (settings.moveSpeed) {\n effect.moveSpeed(settings.moveSpeed);\n }\n } else {\n let target = settings.stretchToAttach\n ? canvaslib.get_closest_token(settings.endPos, {\n minimumDistance: canvas.grid.size,\n })\n : settings.endPos;\n effect.stretchTo(target, {\n attachTo: settings.stretchToAttach,\n randomOffset: settings.randomOffset\n ? settings.randomOffsetAmount\n : false,\n ...offsetData,\n });\n }\n }\n\n if (!settings.Dragging || (settings.Dragging && settings.moveTowards)) {\n effect.scale(settings.scale);\n if (settings.scaleIn > 0)\n effect.scaleIn(0, settings.scaleIn, { ease: \"easeInOutSine\" });\n if (settings.scaleOut > 0)\n effect.scaleOut(0, settings.scaleOut, { ease: \"easeInOutSine\" });\n effect.randomRotation(settings.randomRotation);\n }\n\n if (this.playManySequenced) {\n effect.waitUntilFinished();\n }\n\n if (!this.playManySequenced || this.sequenceBuffer.length === 0) {\n this.sequenceBuffer.push(sequence);\n }\n\n if (!this.playMany && !this.playManySequenced) this._playEffects();\n },\n\n _playEffects() {\n this.sequenceBuffer.forEach((sequence) => sequence.play());\n this.sequenceBuffer = [];\n },\n};\n\nexport const SelectionManager = {\n selectedEffect: false,\n hoveredEffects: new Set(),\n suggestedProperties: false,\n sourceOrTarget: false,\n dragOffset: false,\n hoveredEffectUI: false,\n\n get snapToGrid() {\n return get(PlayerSettings.snapToGrid.store);\n },\n\n set snapToGrid(bool) {\n PlayerSettings.snapToGrid.store.set(bool);\n },\n\n set attachToTarget(bool) {\n PlayerSettings.stretchToAttach.store.set(bool);\n },\n\n get attachToTarget() {\n return get(PlayerSettings.stretchToAttach.store);\n },\n\n get isActive() {\n return (\n InteractionManager.isLayerActive && game?.activeTool === \"select-effect\"\n );\n },\n\n get effects() {\n return SequencerEffectManager.effects.filter(\n (effect) => effect.userCanDelete\n );\n },\n\n initialize() {\n this.layer = canvas.sequencerInterfaceLayer;\n },\n\n tearDown() {\n this._reset();\n this.hoveredEffects = new Set();\n },\n\n sourcePointSelected() {\n this.sourceOrTarget = \"source\";\n },\n\n targetPointSelected() {\n this.sourceOrTarget = \"target\";\n },\n\n /**\n * Mouse Events\n */\n mouseLeftDown() {\n if (!this.selectedEffect) {\n return this._selectEffects();\n }\n if (!this.hoveredEffects.size) {\n this._reset();\n }\n },\n\n mouseRightDown() {},\n\n mouseLeftUp() {\n if (!InteractionManager.state.Dragging) {\n return this._selectEffects();\n }\n if (\n !InteractionManager.state.Dragging ||\n !this.selectedEffect ||\n !this.suggestedProperties\n )\n return;\n this._updateEffect();\n },\n\n mouseRightUp() {\n InteractionManager.state.LeftMouseDown = false;\n this.suggestedProperties = false;\n this.sourceOrTarget = false;\n this.dragOffset = false;\n },\n\n mouseMove() {\n this._evaluateHoveredEffects();\n if (\n InteractionManager.state.LeftMouseDown &&\n !InteractionManager.state.RightMouseDown\n ) {\n this._evaluateEffectPositionUpdate();\n }\n },\n\n /**\n * Hotkeys\n */\n async delete() {\n if (!this.selectedEffect) return;\n await SequencerEffectManager.endEffects({ effects: this.selectedEffect });\n this.selectedEffect = false;\n },\n\n attachToTargetDown() {\n if (\n InteractionManager.state.LeftMouseDown &&\n !InteractionManager.state.RightMouseDown\n ) {\n this._evaluateEffectPositionUpdate();\n }\n },\n\n /**\n * Private methods\n */\n _selectEffects() {\n this._reset();\n if (!this.hoveredEffects.size) return;\n const firstElement = Array.from(this.hoveredEffects)[0];\n this.selectedEffect = !firstElement.selected ? firstElement : false;\n },\n\n _evaluateHoveredEffects() {\n const position = canvaslib.get_mouse_position();\n this.hoveredEffects = this.effects.filter((effect) =>\n effect.isPositionWithinBounds(position)\n );\n this.hoveredEffects.sort((a, b) => {\n return a.data.layer !== b.data.zIndex\n ? a.data.zIndex - b.data.zIndex\n : a.data.layer - b.data.zIndex;\n });\n this.hoveredEffects = new Set(this.hoveredEffects);\n },\n\n _evaluateEffectPositionUpdate() {\n if (!this.selectedEffect) return;\n\n if (this.selectedEffect.data.stretchTo && !this.sourceOrTarget) {\n return;\n }\n\n let showCursor = false;\n let showPoint = this.snapToGrid;\n\n let position = canvaslib.get_mouse_position(this.snapToGrid);\n\n if (!this.selectedEffect.data.stretchTo && !this.dragOffset) {\n this.dragOffset = {\n x: position.x - this.selectedEffect.position.x,\n y: position.y - this.selectedEffect.position.y,\n };\n }\n\n if (this.attachToTarget) {\n const obj = canvaslib.get_closest_token(position, {\n minimumDistance: canvas.grid.size,\n });\n if (obj) {\n position = canvaslib.get_object_position(obj);\n showCursor = true;\n showPoint = false;\n }\n }\n\n if (this.dragOffset && !showCursor && !this.snapToGrid) {\n position.x -= this.dragOffset.x;\n position.y -= this.dragOffset.y;\n }\n\n const color =\n (this.sourceOrTarget || \"source\") === \"source\"\n ? CONSTANTS.COLOR.PRIMARY\n : CONSTANTS.COLOR.SECONDARY;\n\n this.suggestedProperties = {\n position,\n showCursor,\n showPoint,\n color,\n };\n },\n\n _updateEffect() {\n if (!this.selectedEffect) return;\n\n const updates = {\n attachTo: this.selectedEffect.data.attachTo,\n stretchTo: this.selectedEffect.data.stretchTo,\n };\n\n const obj = this.attachToTarget\n ? canvaslib.get_closest_token(this.suggestedProperties.position, {\n minimumDistance: canvas.grid.size,\n type: TokenDocument,\n })\n : false;\n let objUuid = obj ? lib.get_object_identifier(obj) : false;\n\n if (this.sourceOrTarget === \"source\") {\n if (!updates.attachTo) {\n updates.attachTo = {\n active: false,\n align: \"center\",\n rotation: true,\n bindVisibility: true,\n bindAlpha: true,\n };\n }\n updates.attachTo = foundry.utils.mergeObject(updates.attachTo || {}, {\n active: this.attachToTarget && !!objUuid,\n });\n if (this.attachToTarget && objUuid) {\n updates.source = objUuid;\n } else {\n updates[\"source\"] = this.suggestedProperties.position;\n }\n } else if (this.sourceOrTarget === \"target\") {\n updates.stretchTo.attachTo = this.attachToTarget && !!objUuid;\n if (this.attachToTarget && objUuid) {\n updates.target = objUuid;\n } else {\n updates[\"target\"] = this.suggestedProperties.position;\n }\n } else {\n updates[\"source\"] = this.suggestedProperties.position;\n }\n\n this.selectedEffect.update(updates);\n\n this.suggestedProperties = false;\n this.sourceOrTarget = false;\n this.dragOffset = false;\n },\n\n _reset() {\n this.selectedEffect = false;\n this.suggestedProperties = false;\n this.sourceOrTarget = false;\n this.dragOffset = false;\n },\n};\n","\r\n\r\n\r\n
\r\n\t\r\n\t
\r\n\t\t{getEffectName(effect)}\r\n\t
\r\n
\r\n\r\n\r\n\r\n","\r\n\r\n\r\n
\r\n\t\r\n\t
\r\n\t\t{sound.src.split(\"/\").slice(-1)}\r\n\t
\r\n
\r\n\r\n\r\n\r\n","\r\n\r\n
\r\n\r\n {#if !effects.length && !sounds.length}\r\n\r\n
\r\n

{localize(\"SEQUENCER.Manager.NothingPlaying\")}

\r\n
\r\n\r\n {/if}\r\n\r\n {#if effects.length}\r\n \r\n\r\n
\r\n\r\n {#if persistentEffects.length}\r\n

{localize(\"SEQUENCER.Manager.PersistentEffects\")}

\r\n
\r\n {#each persistentEffects as effect (effect.id)}\r\n \r\n {/each}\r\n
\r\n {/if}\r\n\r\n {#if temporaryEffects.length && persistentEffects.length}\r\n
\r\n {/if}\r\n\r\n {#if temporaryEffects.length}\r\n

{localize(\"SEQUENCER.Manager.TemporaryEffects\")}

\r\n
\r\n {#each temporaryEffects as effect (effect.id)}\r\n \r\n {/each}\r\n
\r\n {/if}\r\n\r\n
\r\n\r\n {/if}\r\n\r\n {#if sounds.length}\r\n \r\n\r\n
\r\n\r\n

{localize(\"SEQUENCER.Manager.Sounds\")}

\r\n\r\n
\r\n {#each sounds as [id, sound] (id)}\r\n \r\n {/each}\r\n
\r\n
\r\n\r\n {/if}\r\n\r\n
\r\n\r\n\r\n","\r\n\r\n
\r\n\t\r\n\t\r\n\t\r\n
\r\n\r\n\r\n","\r\n\r\n
\r\n\t\r\n\t\r\n
\r\n","\r\n\r\n
\r\n\t{#if localize(setting.label)}\r\n\t\t\r\n\t{/if}\r\n\t { if($store === null) $store = 0; }}/>\r\n
\r\n\r\n\r\n\r\n","\r\n\r\n
\r\n\r\n\t
{ $store = false; }}>\r\n\t\t{localize(setting.label_off)}\r\n\t
\r\n\t
{ $store = true; }}>\r\n\t\t{localize(setting.label_on)}\r\n\t
\r\n\r\n
\r\n\r\n\r\n\r\n","\r\n\r\n
\r\n\r\n\t
\r\n\r\n\t\tEffect\r\n\r\n\t\t\r\n\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t{#each suggestions as suggestion}\r\n\t\t\t\t\t\r\n\t\t\t\t{/each}\r\n\t\t\t\r\n\t\t
\r\n\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t
\r\n\r\n\t\t
\r\n\r\n\t\t\t
{localize(\"SEQUENCER.Player.Presets\")}
\r\n\r\n\t\t\t
\r\n\r\n\t\t\t\t\r\n\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\r\n\r\n\t\t\t
\r\n\r\n\t\t
\r\n\r\n\t
\r\n\r\n\t
\r\n\r\n\t\tTransform\r\n\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t
\r\n\r\n\t
\r\n\r\n\t
\r\n\r\n\t\tBehavior\r\n\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t
\r\n\r\n\t
\r\n\r\n
\r\n\r\n\r\n","\r\n\r\n\r\n\r\n\r\n\r\n\r\n","\r\n\r\n\r\n\r\n\r\n","\r\n\r\n\r\n\r\n{#each sequence.sections as section}\r\n \r\n{/each}\r\n\r\n\r\n\r\n","\r\n\r\n
\r\n\r\n {#if !runningSequences.length}\r\n\r\n
\r\n

{localize(\"SEQUENCER.Sequences.NoSequences\")}

\r\n
\r\n\r\n {:else}\r\n\r\n
\r\n \r\n \r\n
\r\n\r\n
\r\n {#each runningSequences as [id, sequence], index (id)}\r\n \r\n {/each}\r\n
\r\n\r\n {/if}\r\n\r\n
\r\n\r\n\r\n","\r\n\r\n\r\n\r\n\r\n\r\n\t\r\n\r\n\t\r\n\r\n\r\n","import { SvelteApplication } from \"@typhonjs-fvtt/runtime/svelte/application\";\nimport EffectsUIShell from \"./effects-ui-shell.svelte\";\n\nexport class EffectsUIApp extends SvelteApplication {\n static get defaultOptions() {\n return foundry.utils.mergeObject(super.defaultOptions, {\n title: game.i18n.localize(\"SEQUENCER.ManagerUI\"),\n classes: [\"dialog\"],\n width: \"auto\",\n height: \"auto\",\n top: 65,\n left: 120,\n resizable: false,\n svelte: {\n class: EffectsUIShell,\n target: document.body,\n },\n });\n }\n\n static getActiveApp() {\n return Object.values(ui.windows).find((app) => {\n return (\n app instanceof this && app._state > Application.RENDER_STATES.CLOSED\n );\n });\n }\n\n static async show(options = {}) {\n const existingApp = this.getActiveApp();\n if (existingApp) return existingApp.render(false, { focus: true });\n return new Promise((resolve) => {\n options.resolve = resolve;\n new this(options).render(true, { focus: true });\n });\n }\n}\n","import CONSTANTS from \"./constants.js\";\nimport { user_can_do } from \"./lib/lib.js\";\nimport { DatabaseViewerApp } from \"./formapplications/database/database-viewer-app.js\";\nimport { EffectsUIApp } from \"./formapplications/effects-ui/effects-ui-app.js\";\n\nexport function registerSettings() {\n game.settings.register(CONSTANTS.MODULE_NAME, \"enable-pixi-fix\", {\n name: \"SEQUENCER.Setting.EnablePixiFix.Title\",\n hint: \"SEQUENCER.Setting.EnablePixiFix.Label\",\n scope: \"client\",\n config: true,\n default: true,\n requiresReload: true,\n type: Boolean,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"enable-global-pixi-fix\", {\n name: \"SEQUENCER.Setting.EnableGlobalPixiFix.Title\",\n hint: \"SEQUENCER.Setting.EnableGlobalPixiFix.Label\",\n scope: \"client\",\n config: true,\n default: false,\n requiresReload: true,\n type: Boolean,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"enable-above-ui-screenspace\", {\n name: \"SEQUENCER.Setting.EnableAboveUIScreenspace.Title\",\n hint: \"SEQUENCER.Setting.EnableAboveUIScreenspace.Label\",\n scope: \"client\",\n config: true,\n default: true,\n requiresReload: true,\n type: Boolean,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"debug\", {\n name: \"SEQUENCER.Setting.Debug.Title\",\n hint: \"SEQUENCER.Setting.Debug.Label\",\n scope: \"client\",\n config: true,\n default: false,\n type: Boolean,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"showSidebarTools\", {\n name: \"SEQUENCER.Setting.ShowTools.Title\",\n hint: \"SEQUENCER.Setting.ShowTools.Label\",\n scope: \"client\",\n config: true,\n default: true,\n requiresReload: true,\n type: Boolean,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"showTokenSidebarTools\", {\n name: \"SEQUENCER.Setting.ShowTokenTools.Title\",\n hint: \"SEQUENCER.Setting.ShowTokenTools.Label\",\n scope: \"client\",\n config: true,\n default: true,\n requiresReload: true,\n type: Boolean,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"effectsEnabled\", {\n name: \"SEQUENCER.Setting.EnableEffects.Title\",\n hint: \"SEQUENCER.Setting.EnableEffects.Label\",\n scope: \"client\",\n config: true,\n default: true,\n requiresReload: true,\n type: Boolean,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"soundsEnabled\", {\n name: \"SEQUENCER.Setting.EnableSounds.Title\",\n hint: \"SEQUENCER.Setting.EnableSounds.Label\",\n scope: \"client\",\n config: true,\n default: true,\n requiresReload: true,\n type: Boolean,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"user-effect-opacity\", {\n name: \"SEQUENCER.Setting.ExternalEffectOpacity.Title\",\n hint: \"SEQUENCER.Setting.ExternalEffectOpacity.Label\",\n scope: \"client\",\n config: true,\n default: 50,\n type: Number,\n range: {\n min: 0,\n max: 100,\n step: 1,\n },\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"db-list-view\", {\n scope: \"client\",\n config: false,\n default: false,\n type: Boolean,\n });\n\n const permissionLevels = [\n game.i18n.localize(\"SEQUENCER.Permission.Player\"),\n game.i18n.localize(\"SEQUENCER.Permission.Trusted\"),\n game.i18n.localize(\"SEQUENCER.Permission.Assistant\"),\n game.i18n.localize(\"SEQUENCER.Permission.GM\"),\n ];\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"permissions-effect-create\", {\n name: \"SEQUENCER.Setting.Permission.EffectCreate.Title\",\n hint: \"SEQUENCER.Setting.Permission.EffectCreate.Label\",\n scope: \"world\",\n config: true,\n default: 0,\n type: Number,\n choices: permissionLevels,\n requiresReload: true,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"permissions-effect-delete\", {\n name: \"SEQUENCER.Setting.Permission.EffectDelete.Title\",\n hint: \"SEQUENCER.Setting.Permission.EffectDelete.Label\",\n scope: \"world\",\n config: true,\n default: 2,\n type: Number,\n choices: permissionLevels,\n requiresReload: true,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"permissions-sound-create\", {\n name: \"SEQUENCER.Setting.Permission.SoundCreate.Title\",\n hint: \"SEQUENCER.Setting.Permission.SoundCreate.Label\",\n scope: \"world\",\n config: true,\n default: 0,\n type: Number,\n choices: permissionLevels,\n requiresReload: true,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"permissions-preload\", {\n name: \"SEQUENCER.Setting.Permission.PreloadClients.Title\",\n hint: \"SEQUENCER.Setting.Permission.PreloadClients.Label\",\n scope: \"world\",\n config: true,\n default: 1,\n type: Number,\n choices: permissionLevels,\n requiresReload: true,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"permissions-sidebar-tools\", {\n name: \"SEQUENCER.Setting.Permission.UseSidebarTools.Title\",\n hint: \"SEQUENCER.Setting.Permission.UseSidebarTools.Label\",\n scope: \"world\",\n config: true,\n default: 0,\n type: Number,\n choices: permissionLevels,\n requiresReload: true,\n });\n\n game.settings.register(CONSTANTS.MODULE_NAME, \"effectPresets\", {\n scope: \"client\",\n default: {},\n type: Object,\n });\n\n Hooks.on(\"getSceneControlButtons\", (controls) => {\n if (!game.settings.get(CONSTANTS.MODULE_NAME, \"showSidebarTools\")) return;\n\n const selectTool = {\n icon: \"fas fa-expand\",\n name: \"select-effect\",\n title: \"SEQUENCER.SidebarButtons.Select\",\n visible:\n user_can_do(\"permissions-effect-create\") &&\n user_can_do(\"permissions-sidebar-tools\"),\n };\n\n const playTool = {\n icon: \"fas fa-play\",\n name: \"play-effect\",\n title: \"SEQUENCER.SidebarButtons.Play\",\n visible:\n user_can_do(\"permissions-effect-create\") &&\n user_can_do(\"permissions-sidebar-tools\"),\n onClick: () => {\n EffectsUIApp.show({ inFocus: true, tab: \"player\" });\n },\n };\n\n const viewer = {\n icon: \"fas fa-film\",\n name: \"effectviewer\",\n title: \"SEQUENCER.SidebarButtons.Manager\",\n button: true,\n visible:\n user_can_do(\"permissions-effect-create\") &&\n user_can_do(\"permissions-sidebar-tools\"),\n onClick: () => {\n EffectsUIApp.show({ inFocus: true, tab: \"manager\" });\n },\n };\n\n const database = {\n icon: \"fas fa-database\",\n name: \"effectdatabase\",\n title: \"SEQUENCER.SidebarButtons.Database\",\n button: true,\n visible: user_can_do(\"permissions-sidebar-tools\"),\n onClick: () => {\n DatabaseViewerApp.show();\n },\n };\n\n controls.push({\n name: CONSTANTS.MODULE_NAME,\n title: \"Sequencer Layer\",\n icon: \"fas fa-list-ol\",\n layer: \"sequencerInterfaceLayer\",\n visible:\n user_can_do(\"permissions-effect-create\") &&\n user_can_do(\"permissions-sidebar-tools\"),\n activeTool: \"select-effect\",\n tools: [selectTool, playTool, database, viewer],\n });\n\n if (!game.settings.get(CONSTANTS.MODULE_NAME, \"showTokenSidebarTools\"))\n return;\n\n const bar = controls.find((c) => c.name === \"token\");\n bar.tools.push(database);\n bar.tools.push(viewer);\n });\n\n console.log(\"Sequencer | Registered settings\");\n}\n\nexport async function migrateSettings() {\n const oldPixiFixSetting = game.settings.storage\n .get(\"client\")\n .getItem(\"sequencer.disable-pixi-fix\");\n\n if (oldPixiFixSetting) {\n const value = oldPixiFixSetting === \"true\";\n game.settings.storage\n .get(\"client\")\n .removeItem(\"sequencer.disable-pixi-fix\");\n await game.settings.set(CONSTANTS.MODULE_NAME, \"enable-pixi-fix\", !value);\n }\n\n const oldScreenspaceSetting = game.settings.storage\n .get(\"client\")\n .getItem(\"sequencer.disable-above-ui-screenspace\");\n if (oldScreenspaceSetting) {\n const value = oldScreenspaceSetting === \"true\";\n game.settings.storage\n .get(\"client\")\n .removeItem(\"sequencer.disable-above-ui-screenspace\");\n await game.settings.set(\n CONSTANTS.MODULE_NAME,\n \"enable-above-ui-screenspace\",\n !value\n );\n }\n}\n","import {\n BaseEffectsLayer,\n SequencerInterfaceLayer,\n UIEffectsLayer,\n} from \"./canvas-effects/effects-layer.js\";\n\nexport default function registerLayers() {\n CONFIG.Canvas.layers = foundry.utils.mergeObject(Canvas.layers, {\n sequencerEffects: {\n layerClass: BaseEffectsLayer,\n group: \"primary\",\n },\n sequencerInterfaceLayer: {\n layerClass: SequencerInterfaceLayer,\n group: \"interface\",\n },\n sequencerEffectsUILayer: {\n layerClass: UIEffectsLayer,\n group: \"interface\",\n },\n });\n\n if (!Object.is(Canvas.layers, CONFIG.Canvas.layers)) {\n const layers = Canvas.layers;\n Object.defineProperty(Canvas, \"layers\", {\n get: function () {\n return foundry.utils.mergeObject(layers, CONFIG.Canvas.layers);\n },\n });\n }\n\n console.log(\"Sequencer | Registered Layers\");\n}\n","import CONSTANTS from \"./constants.js\";\nimport {\n EffectPlayer,\n SelectionManager,\n} from \"./modules/sequencer-interaction-manager.js\";\nimport { PlayerSettings } from \"./formapplications/effects-ui/effect-player-store.js\";\n\nconst hotkeys = {\n get _ready() {\n return canvas.ready && canvas.sequencerInterfaceLayer.active;\n },\n\n playTool: {\n playManySequencedDown: () => {\n if (!hotkeys._ready) return;\n EffectPlayer.playManySequenced = true;\n },\n playManySequencedUp: () => {\n if (!hotkeys._ready) return;\n EffectPlayer.playManySequenced = false;\n if (!EffectPlayer.isActive) return;\n EffectPlayer.playManyUp();\n },\n playManyDown: () => {\n if (!hotkeys._ready) return;\n EffectPlayer.playMany = true;\n },\n playManyUp: () => {\n if (!hotkeys._ready) return;\n EffectPlayer.playMany = false;\n if (!EffectPlayer.isActive) return;\n EffectPlayer.playManyUp();\n },\n attachToDown: () => {\n if (!hotkeys._ready) return;\n PlayerSettings.attachTo.store.set(true);\n PlayerSettings.stretchToAttach.store.set(true);\n },\n attachToUp: () => {\n if (!hotkeys._ready) return;\n PlayerSettings.attachTo.store.set(false);\n PlayerSettings.stretchToAttach.store.set(false);\n },\n },\n\n selectTool: {\n snapToGridDown: () => {\n if (!hotkeys._ready) return;\n SelectionManager.snapToGrid = true;\n },\n snapToGridUp: () => {\n if (!hotkeys._ready) return;\n SelectionManager.snapToGrid = false;\n },\n attachToTargetDown: () => {\n if (!hotkeys._ready) return;\n if (!SelectionManager.isActive) return;\n PlayerSettings.attachTo.store.set(true);\n PlayerSettings.stretchToAttach.store.set(true);\n },\n attachToTargetUp: () => {\n if (!hotkeys._ready) return;\n PlayerSettings.attachTo.store.set(false);\n PlayerSettings.stretchToAttach.store.set(false);\n },\n deleteDown: () => {\n if (!hotkeys._ready) return;\n SelectionManager.delete();\n },\n },\n};\n\nexport default function registerHotkeys() {\n game.keybindings.register(CONSTANTS.MODULE_NAME, \"play-tool-hotkey-control\", {\n name: \"SEQUENCER.Hotkeys.PlayTool.Control\",\n editable: [{ key: \"ControlLeft\" }],\n onDown: hotkeys.playTool.playManySequencedDown,\n onUp: hotkeys.playTool.playManySequencedUp,\n });\n\n game.keybindings.register(CONSTANTS.MODULE_NAME, \"play-tool-hotkey-shift\", {\n name: \"SEQUENCER.Hotkeys.PlayTool.Shift\",\n editable: [{ key: \"ShiftLeft\" }],\n onDown: hotkeys.playTool.playManyDown,\n onUp: hotkeys.playTool.playManyUp,\n });\n\n game.keybindings.register(CONSTANTS.MODULE_NAME, \"play-tool-hotkey-alt\", {\n name: \"SEQUENCER.Hotkeys.PlayTool.Alt\",\n editable: [{ key: \"AltLeft\" }],\n onDown: hotkeys.playTool.attachToDown,\n onUp: hotkeys.playTool.attachToDown,\n });\n\n game.keybindings.register(\n CONSTANTS.MODULE_NAME,\n \"select-tool-hotkey-control\",\n {\n name: \"SEQUENCER.Hotkeys.SelectTool.Control\",\n editable: [{ key: \"ControlLeft\" }],\n onDown: hotkeys.selectTool.snapToGridDown,\n onUp: hotkeys.selectTool.snapToGridUp,\n }\n );\n\n game.keybindings.register(CONSTANTS.MODULE_NAME, \"select-tool-hotkey-alt\", {\n name: \"SEQUENCER.Hotkeys.SelectTool.Alt\",\n editable: [{ key: \"AltLeft\" }],\n onDown: hotkeys.selectTool.attachToTargetDown,\n onUp: hotkeys.selectTool.attachToTargetUp,\n });\n\n game.keybindings.register(\n CONSTANTS.MODULE_NAME,\n \"select-tool-hotkey-delete\",\n {\n name: \"SEQUENCER.Hotkeys.SelectTool.Delete\",\n editable: [{ key: \"Delete\" }],\n onDown: hotkeys.selectTool.deleteDown,\n }\n );\n}\n","export default async function registerTypes(register) {\n fetch(\"modules/sequencer/typings/types.d.ts\")\n .then((response) => response.text())\n .then((content) => register(\"sequencer/types.d.ts\", content));\n}\n","import { custom_error, is_function } from \"../lib/lib.js\";\n\nconst presetMap = new Map();\n\nexport default class SequencerPresets {\n /**\n * Adds a preset that can then be used in sequences\n *\n * @param {string} inName\n * @param {Function} inFunction\n * @param {boolean} [overwrite=false] overwrite\n * @returns {Map}\n */\n static add(inName, inFunction, overwrite = false) {\n if (typeof inName !== \"string\") {\n throw custom_error(\n \"Sequencer\",\n `SequencerPresets | inName must be of type string`\n );\n }\n\n if (!is_function(inFunction)) {\n throw custom_error(\n \"Sequencer\",\n `SequencerPresets | inFunction must be of type function`\n );\n }\n\n if (presetMap.get(inName) && !overwrite) {\n throw custom_error(\n \"Sequencer\",\n `SequencerPresets | Preset \"${inName}\" already exists`\n );\n }\n\n presetMap.set(inName, inFunction);\n console.log(`Sequencer | Presets | Added \"${inName}\" preset`);\n return presetMap;\n }\n\n /**\n * Retrieves all presets\n *\n * @returns {Map}\n */\n static getAll() {\n return presetMap;\n }\n\n /**\n * Retrieves preset based on its name\n *\n * @param {string} name\n * @returns {Function}\n */\n static get(name) {\n return presetMap.get(name);\n }\n}\n","import * as lib from \"../lib/lib.js\";\nimport SequencerPresets from \"../modules/sequencer-presets.js\";\nimport CONSTANTS from \"../constants.js\";\nimport { get, writable } from \"svelte/store\";\n\nexport default class Section {\n constructor(inSequence) {\n this.sequence = inSequence;\n this._applyTraits();\n this._sectionStatus = writable(CONSTANTS.STATUS.READY);\n this._playIf = true;\n this._waitUntilFinished = false;\n this._async = false;\n this._waitUntilFinishedDelay = [0, 0];\n this._repetitions = 1;\n this._currentRepetition = 0;\n this._repeatDelayMin = 0;\n this._repeatDelayMax = 0;\n this._repeatDelay = 0;\n this._delayMin = 0;\n this._delayMax = 0;\n this._basicDelay = 0;\n this._duration = false;\n }\n\n static niceName = \"Section\";\n\n /**\n * @protected\n */\n get _shouldAsync() {\n return this._async || this._waitAnyway;\n }\n\n /**\n * @protected\n */\n get shouldWaitUntilFinished() {\n return this._waitUntilFinished || this._waitAnyway;\n }\n\n /**\n * @protected\n */\n get _waitAnyway() {\n return (\n ((this._async || this._waitUntilFinished) && this._isLastRepetition) ||\n (this._isLastRepetition && this._isLastSection)\n );\n }\n\n /**\n * @protected\n */\n get _isLastSection() {\n return (\n this.sequence.sections.length - 1 === this.sequence.sections.indexOf(this)\n );\n }\n\n /** ------------------------------------------------------------------------------------------------------------------------------ *\n * Methods below this point should NOT be overridden by child instances of the class, they are integral to the sequence functioning\n * ------------------------------------------------------------------------------------------------------------------------------- */\n\n /**\n * @protected\n */\n get _isLastRepetition() {\n return (\n this._repetitions === 1 ||\n this._repetitions === this._currentRepetition + 1\n );\n }\n\n /**\n * @protected\n */\n get _currentWaitTime() {\n let waitUntilFinishedDelay = this._waitAnyway\n ? lib.random_int_between(...this._waitUntilFinishedDelay)\n : 0;\n return waitUntilFinishedDelay + this._repeatDelay;\n }\n\n /**\n * Method overwritten by inheriting classes, which is called just before the \"run\" method is called (see below)\n *\n * @returns {Promise}\n * @protected\n */\n async preRun() {}\n\n /**\n * Method overwritten by inheriting classes, which is called when this section is executed by the Sequence\n *\n * @returns {Promise}\n * @protected\n */\n async run() {}\n\n /**\n * Method overwritten by inheriting classes, which is called when this section is serialized by the Sequence\n *\n * @returns {object}\n * @private\n */\n async _serialize() {\n return {\n async: this._async,\n delay: [this._delayMin, this._delayMax],\n waitUntilFinished: this._waitUntilFinished,\n waitUntilFinishedDelay: this._waitUntilFinishedDelay,\n repetitions: this._repetitions,\n repetitionsDelay: [this._repeatDelayMin, this._repeatDelayMax],\n };\n }\n\n _deserialize(data) {\n this._async = data.async;\n this._waitUntilFinished = data.waitUntilFinished;\n this._waitUntilFinishedDelay = data.waitUntilFinishedDelay;\n this._repetitions = data.repetitions;\n this._repeatDelayMin = data.repetitionsDelay[0];\n this._repeatDelayMax = data.repetitionsDelay[1];\n return this;\n }\n\n /**\n * Method overwritten by inheriting classes, which stores data or prepares data before the Sequence executes it (see EffectsSection)\n *\n * @protected\n */\n async _initialize() {}\n\n /**\n * Method overwritten by inheriting classes. Inheriting classes uses the following to apply traits to themselves:\n * - Object.assign(this.constructor.prototype, trait)\n *\n * @protected\n */\n _applyTraits() {}\n\n /**\n * Causes the section to be repeated n amount of times, with an optional delay. If given inRepeatDelayMin\n * and inRepeatDelayMax, a random repetition delay will be picked for every repetition\n *\n * @param {number} inRepetitions\n * @param {number} inRepeatDelayMin\n * @param {number} inRepeatDelayMax\n * @returns {Section} this\n */\n repeats(inRepetitions, inRepeatDelayMin = 0, inRepeatDelayMax) {\n if (!lib.is_real_number(inRepetitions))\n throw this.sequence._customError(\n this,\n \"repeats\",\n \"inRepetitions must be of type number\"\n );\n if (!lib.is_real_number(inRepeatDelayMin))\n throw this.sequence._customError(\n this,\n \"repeats\",\n \"repeatDelayMin must be of type number\"\n );\n if (inRepeatDelayMax && !lib.is_real_number(inRepeatDelayMax)) {\n throw this.sequence._customError(\n this,\n \"repeats\",\n \"repeatDelayMax must be of type number\"\n );\n }\n this._repetitions = inRepetitions;\n this._repeatDelayMin = Math.min(\n inRepeatDelayMin,\n inRepeatDelayMax ?? inRepeatDelayMin\n );\n this._repeatDelayMax = Math.max(\n inRepeatDelayMin,\n inRepeatDelayMax ?? inRepeatDelayMin\n );\n return this;\n }\n\n /**\n * Causes the effect or sound to not play, and skip all delays, repetitions, waits, etc. If you pass a function,\n * the function should return something false-y if you do not want the effect or sound to play.\n *\n * @param {boolean|function} inCondition\n * @returns {Section} this\n */\n playIf(inCondition) {\n this._playIf = inCondition;\n return this;\n }\n\n /**\n * Causes the section to finish running before starting the next section.\n *\n * @param {number|boolean} [minDelay=0] minDelay\n * @param {number/null} [maxDelay=null] maxDelay\n * @returns {Section} this\n */\n waitUntilFinished(minDelay = 0, maxDelay = null) {\n if (minDelay === false) return this;\n if (!lib.is_real_number(minDelay))\n throw this.sequence._customError(\n this,\n \"waitUntilFinished\",\n \"minDelay must be of type number\"\n );\n if (maxDelay !== null && !lib.is_real_number(maxDelay))\n throw this.sequence._customError(\n this,\n \"waitUntilFinished\",\n \"maxDelay must be of type number\"\n );\n this._waitUntilFinished = true;\n this._waitUntilFinishedDelay = [\n Math.min(minDelay, maxDelay ?? minDelay),\n Math.max(minDelay, maxDelay ?? minDelay),\n ];\n return this;\n }\n\n /**\n * Causes each effect or sound to finish playing before the next one starts playing. This differs from\n * .waitUntilFinished() in the sense that this is for each repetition, whilst .waitUntilFinished() is\n * for the entire section.\n *\n * @returns {Section} this\n */\n async() {\n this._async = true;\n return this;\n }\n\n /**\n * Delays the effect or sound from being played for a set amount of milliseconds. If given a second number, a\n * random delay between the two numbers will be generated.\n *\n * @param {number} [msMin=1] minMs\n * @param {number} [msMax=1] maxMs\n * @returns {Section} this\n */\n delay(msMin, msMax) {\n if (!lib.is_real_number(msMin))\n throw this.sequence._customError(\n this,\n \"delay\",\n \"msMin must be of type number\"\n );\n if (msMax && !lib.is_real_number(msMax))\n throw this.sequence._customError(\n this,\n \"delay\",\n \"msMax must be of type number\"\n );\n this._delayMin = Math.min(msMin, msMax ?? msMin);\n this._delayMax = Math.max(msMin, msMax ?? msMin);\n return this;\n }\n\n /**\n * Overrides the duration of this section\n *\n * @param {number} inDuration\n * @returns {Section} this\n */\n duration(inDuration) {\n if (!lib.is_real_number(inDuration))\n throw this.sequence._customError(\n this,\n \"duration\",\n \"inDuration must be of type number\"\n );\n this._duration = inDuration;\n return this;\n }\n\n /**\n * Applies a preset to the current section\n *\n * @param {string} presetName\n * @param {*} args\n * @returns {Section|FunctionSection|EffectSection|AnimationSection|SoundSection}\n */\n preset(presetName, ...args) {\n if (typeof presetName !== \"string\") {\n throw this.sequence._customError(\n this,\n \"name\",\n `inName must be of type string`\n );\n }\n const preset = SequencerPresets.get(presetName);\n if (!preset) {\n lib.custom_warning(\n \"Sequencer\",\n `preset | Could not find preset with name \"${presetName}\"`\n );\n return this;\n }\n return preset(this, ...args);\n }\n\n /**\n * @protected\n */\n async _shouldPlay() {\n return lib.is_function(this._playIf) ? await this._playIf() : this._playIf;\n }\n\n /**\n * @protected\n */\n _validateLocation(inLocation) {\n inLocation = lib.validate_document(inLocation);\n if (typeof inLocation === \"string\") {\n inLocation = lib.get_object_from_scene(inLocation) ?? inLocation;\n }\n if (typeof inLocation === \"string\") {\n inLocation = lib.safe_str(inLocation);\n }\n return inLocation;\n }\n\n /**\n * @protected\n */\n async _execute() {\n if (!(await this._shouldPlay())) {\n this.sectionStatus = CONSTANTS.STATUS.SKIPPED;\n return;\n }\n this._basicDelay = lib.random_float_between(this._delayMin, this._delayMax);\n return new Promise(async (resolve) => {\n setTimeout(async () => {\n this.sectionStatus = CONSTANTS.STATUS.RUNNING;\n for (let i = 0; i < this._repetitions; i++) {\n if (get(this.sectionStatus) === CONSTANTS.STATUS.ABORTED) {\n resolve();\n return;\n }\n this._currentRepetition = i;\n this._repeatDelay =\n i !== this._repetitions - 1\n ? lib.random_float_between(\n this._repeatDelayMin,\n this._repeatDelayMax\n )\n : 0;\n await this.preRun();\n if (this._shouldAsync) {\n await this.run();\n } else {\n this.run();\n }\n if (this._repetitions > 1 && i !== this._repetitions - 1) {\n await this._delayBetweenRepetitions();\n }\n }\n resolve();\n }, this._basicDelay);\n }).then(() => {\n this.sectionStatus = CONSTANTS.STATUS.COMPLETE;\n });\n }\n\n set sectionStatus(inStatus) {\n this._sectionStatus.update((currentStatus) => {\n if (\n currentStatus === CONSTANTS.STATUS.READY ||\n (currentStatus === CONSTANTS.STATUS.RUNNING &&\n inStatus !== CONSTANTS.STATUS.ABORTED)\n ) {\n return inStatus;\n }\n return currentStatus;\n });\n }\n\n get sectionStatus() {\n return this._sectionStatus;\n }\n\n _abortSection() {\n this.sectionStatus = CONSTANTS.STATUS.ABORTED;\n }\n\n /**\n * @protected\n */\n async _delayBetweenRepetitions() {\n let self = this;\n return new Promise((resolve) => {\n setTimeout(resolve, self._repeatDelay);\n });\n }\n}\n","import * as lib from \"../lib/lib.js\";\nimport Section from \"./section.js\";\n\nexport default class FunctionSection extends Section {\n constructor(inSequence, inFunc) {\n super(inSequence);\n if (!lib.is_function(inFunc))\n this._customError(\n \"create\",\n \"The given function needs to be an actual function\"\n );\n this._func = inFunc;\n this._waitUntilFinished = inFunc.constructor.name === \"AsyncFunction\";\n }\n\n static niceName = \"Function\";\n\n /**\n * @returns {Promise}\n */\n async run() {\n lib.debug(\"Running function\");\n await this._func();\n }\n\n /**\n * @returns {Promise}\n * @private\n */\n async _execute() {\n await this.run();\n }\n}\n","import { is_real_number } from \"../../lib/lib.js\";\nimport { validateAnimation } from \"../../lib/canvas-lib.js\";\nimport * as canvaslib from \"../../lib/canvas-lib.js\";\n\nexport default {\n /**\n * Base properties\n */\n _animations: null,\n\n /**\n * Animates a property on the target of the animation.\n *\n * @param {string} inTarget\n * @param {string} inPropertyName\n * @param {object} inOptions\n * @param {Number} inOptions.from - a single number from which to animate\n * @param {Number} inOptions.to - a single number to which to animate\n * @param {Number} inOptions.duration - how long in ms the animation should take\n * @param {Number} inOptions.delay - inserts a delay in ms before the animation starts\n * @param {String} inOptions.ease - what type of easing the animation should use\n * @param {Boolean} inOptions.gridUnits - if animating width or height, this will set it to work in the scene's grid units\n * @param {Boolean} inOptions.fromEnd - makes this animation play from the end, like fadeOut, scaleOut, etc\n *\n * @returns this\n */\n animateProperty(inTarget, inPropertyName, inOptions = {}) {\n if (!this._animations) this._animations = [];\n\n const result = canvaslib.validateAnimation(\n inTarget,\n inPropertyName,\n inOptions\n );\n\n if (typeof result === \"string\") {\n throw this.sequence._customError(this, \"animateProperty\", result);\n }\n\n this._animations.push(result);\n\n return this;\n },\n\n /**\n * Loops a property between a set of values on the target\n *\n * @param {string} inTarget\n * @param {string} inPropertyName\n * @param {object} inOptions\n * @param {Number} inOptions.from - a single number from which to loop\n * @param {Number} inOptions.to - a single number to which to loop\n * @param {Number} inOptions.values - an array of values to loop between\n * @param {Number} inOptions.duration - how long in ms the loop should take\n * @param {Number} inOptions.loops - how many loops in total this animation should go through - if none are specified, the loop is indefinite\n * @param {Number} inOptions.delay - inserts a delay in ms before the animation starts\n * @param {String} inOptions.ease - what type of easing the animation should use\n * @param {Boolean} inOptions.pingPong - sets whether loop should interpolate to the first value after it reaches the first value, or simply set it to the first value\n * @param {Boolean} inOptions.gridUnits - if animating width or height, this will set it to work in the scene's grid units\n *\n * @returns this\n */\n loopProperty(inTarget, inPropertyName, inOptions = {}) {\n if (!this._animations) this._animations = [];\n\n const result = canvaslib.validateLoopingAnimation(\n inTarget,\n inPropertyName,\n inOptions\n );\n\n if (typeof result === \"string\") {\n throw this.sequence._customError(this, \"loopProperty\", result);\n }\n\n this._animations.push(result);\n\n return this;\n },\n};\n","import { is_real_number } from \"../../lib/lib.js\";\n\nexport default {\n /**\n * Base properties\n */\n _volume: null,\n _fadeInAudio: null,\n _fadeOutAudio: null,\n\n /**\n * Sets the volume of the sound.\n *\n * @param {number} inVolume\n * @returns this\n */\n volume(inVolume) {\n if (!is_real_number(inVolume))\n throw this.sequence._customError(\n this,\n \"volume\",\n \"inVolume must be of type number\"\n );\n this._volume = Math.max(0, Math.min(1.0, inVolume));\n return this;\n },\n\n /**\n * Causes the animated section to fade in its audio (if any) when played\n *\n * @param {number} duration How long the fade should be\n * @param {object} [options] Additional options, such as easing and delay\n * @returns this\n */\n fadeInAudio(duration, options = {}) {\n if (typeof options !== \"object\")\n throw this.sequence._customError(\n this,\n \"fadeInAudio\",\n \"options must be of type object\"\n );\n options = foundry.utils.mergeObject(\n {\n ease: \"linear\",\n delay: 0,\n },\n options\n );\n if (!is_real_number(duration))\n throw this.sequence._customError(\n this,\n \"fadeInAudio\",\n \"duration must be of type number\"\n );\n if (typeof options.ease !== \"string\")\n throw this.sequence._customError(\n this,\n \"fadeInAudio\",\n \"options.ease must be of type string\"\n );\n if (!is_real_number(options.delay))\n throw this.sequence._customError(\n this,\n \"fadeInAudio\",\n \"options.delay must be of type number\"\n );\n this._fadeInAudio = {\n duration: duration,\n ease: options.ease,\n delay: options.delay,\n };\n return this;\n },\n\n /**\n * Causes the audio to fade out at the end of the animated section's duration\n *\n * @param {number} duration How long the fade should be\n * @param {object} [options] Additional options, such as easing and delay\n * @returns this\n */\n fadeOutAudio(duration, options = {}) {\n if (typeof options !== \"object\")\n throw this.sequence._customError(\n this,\n \"fadeOutAudio\",\n \"options must be of type object\"\n );\n options = foundry.utils.mergeObject(\n {\n ease: \"linear\",\n delay: 0,\n },\n options\n );\n if (!is_real_number(duration))\n throw this.sequence._customError(\n this,\n \"fadeOutAudio\",\n \"duration must be of type number\"\n );\n if (typeof options.ease !== \"string\")\n throw this.sequence._customError(\n this,\n \"fadeOutAudio\",\n \"ease must be of type string\"\n );\n if (!is_real_number(options.delay))\n throw this.sequence._customError(\n this,\n \"fadeOutAudio\",\n \"delay must be of type number\"\n );\n this._fadeOutAudio = {\n duration: duration,\n ease: options.ease,\n delay: options.delay,\n };\n return this;\n },\n};\n","import * as lib from \"../../lib/lib.js\";\nimport { SequencerFileRangeFind } from \"../../modules/sequencer-file.js\";\n\nexport default {\n /**\n * Base properties\n */\n _file: \"\",\n _fileOptions: false,\n _baseFolder: \"\",\n _mustache: null,\n\n /**\n * Declares which file to be played. This may also be an array of paths, which will be randomly picked from each\n * time the section is played.\n *\n * @param {string|array} inFile\n * @returns this\n */\n file(inFile) {\n this._file = inFile;\n return this;\n },\n\n /**\n * Defines the base folder that will prepend to the file path. This is mainly just useful to make the file\n * path easier to manage.\n *\n * @param {string} inBaseFolder\n * @returns this\n */\n baseFolder(inBaseFolder) {\n if (typeof inBaseFolder !== \"string\")\n throw this.sequence._customError(\n this,\n \"baseFolder\",\n \"inBaseFolder must be of type string\"\n );\n this._baseFolder = inBaseFolder + (inBaseFolder.endsWith(\"/\") ? \"\" : \"/\");\n return this;\n },\n\n /**\n * Sets the Mustache of the filepath. This is applied after the randomization of the filepath, if available.\n *\n * @param {object} inMustache\n * @returns this\n */\n setMustache(inMustache) {\n if (typeof inMustache !== \"object\")\n throw this.sequence._customError(\n this,\n \"setMustache\",\n \"inMustache must be of type object\"\n );\n this._mustache = inMustache;\n return this;\n },\n\n async _determineFile(inFile) {\n if (!Array.isArray(inFile) && typeof inFile === \"object\") {\n return this._validateCustomRange(inFile);\n }\n\n if (Array.isArray(inFile))\n inFile = lib.random_array_element(inFile, { recurse: true });\n\n inFile = this._applyMustache(inFile);\n\n if (Sequencer.Database.entryExists(inFile)) {\n return this._determineDatabaseFile(inFile);\n }\n\n const determinedFile = await this._processFile(inFile);\n\n return { file: determinedFile, forcedIndex: false, customRange: false };\n },\n\n async _processFile(inFile) {\n inFile = this._applyMustache(inFile);\n inFile = this._applyBaseFolder(inFile);\n inFile = await this._applyWildcard(inFile);\n if (Array.isArray(inFile))\n inFile = lib.random_array_element(inFile, { recurse: true });\n return inFile;\n },\n\n async _validateCustomRange(inFile) {\n const finalFiles = {};\n const validRanges = Object.keys(SequencerFileRangeFind.ftToDistanceMap);\n for (const [range, rangeFile] of Object.entries(inFile)) {\n if (!validRanges.includes(range)) {\n throw this.sequence._customError(\n this,\n \"file\",\n `a file-distance key map must only contain the following keys: ${validRanges.join(\n \", \"\n )}`\n );\n }\n finalFiles[range] = await this._processFile(rangeFile);\n }\n\n return { file: finalFiles, forcedIndex: false, customRange: true };\n },\n\n _determineDatabaseFile(inFile) {\n const entries = Sequencer.Database.getEntry(inFile);\n const entry = Array.isArray(entries)\n ? lib.random_array_element(entries)\n : entries;\n const match = inFile.match(/(\\d)+$/);\n return {\n file: entry,\n forcedIndex: match ? Number(match[1]) : false,\n customRange: false,\n };\n },\n\n _applyBaseFolder(inFile) {\n if (Array.isArray(inFile))\n return inFile.map((file) => this._applyBaseFolder(file));\n return inFile.startsWith(this._baseFolder)\n ? inFile\n : this._baseFolder + inFile;\n },\n\n _applyMustache(inFile) {\n if (!this._mustache) return inFile;\n let template = Handlebars.compile(inFile);\n return template(this._mustache);\n },\n\n async _applyWildcard(inFile) {\n if (!inFile.includes(\"*\")) return inFile;\n if (Array.isArray(inFile))\n return inFile.map(async (file) => await this._applyWildcard(file));\n inFile = this._applyBaseFolder(inFile);\n return lib.getFiles(inFile, {\n applyWildCard: true,\n softFail: this.sequence.softFail,\n });\n },\n};\n","import { is_real_number } from \"../../lib/lib.js\";\nimport * as canvaslib from \"../../lib/canvas-lib.js\";\n\nexport default {\n /**\n * Base properties\n */\n _moveTowards: null,\n _moveSpeed: null,\n\n /**\n * Sets the location to move the target object to\n *\n * @param {object|string} inTarget\n * @param {object} options\n * @returns this\n */\n moveTowards(inTarget, options = {}) {\n options = foundry.utils.mergeObject(\n {\n ease: \"linear\",\n delay: 0,\n rotate: true,\n cacheLocation: false,\n },\n options\n );\n if (typeof options.ease !== \"string\")\n throw this.sequence._customError(\n this,\n \"moveTowards\",\n \"options.ease must be of type string\"\n );\n if (!is_real_number(options.delay))\n throw this.sequence._customError(\n this,\n \"moveTowards\",\n \"options.delay must be of type number\"\n );\n if (typeof options.rotate !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"moveTowards\",\n \"options.rotate must be of type boolean\"\n );\n if (typeof options.cacheLocation !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"moveTowards\",\n \"options.cacheLocation must be of type boolean\"\n );\n options.target = this._validateLocation(inTarget);\n if (!options.target)\n throw this.sequence._customError(\n this,\n \"moveTowards\",\n \"could not find position of given object\"\n );\n options.target = options.cacheLocation\n ? canvaslib.get_object_position(options.cacheLocation, { measure: true })\n : options.target;\n this._moveTowards = options;\n return this;\n },\n\n /**\n * Sets the speed (pixels per frame) to move the target object\n *\n * @param {number} inSpeed\n * @returns this\n */\n moveSpeed(inSpeed) {\n if (!is_real_number(inSpeed))\n throw this.sequence._customError(\n this,\n \"moveSpeed\",\n \"inSpeed must be of type number\"\n );\n this._moveSpeed = inSpeed;\n return this;\n },\n};\n","import { is_real_number } from \"../../lib/lib.js\";\n\nexport default {\n /**\n * Base properties\n */\n _opacity: null,\n _fadeIn: null,\n _fadeOut: null,\n\n /**\n * Sets the opacity of the effect. If used with ._fadeIn() and/or ._fadeOut(), this defines what the effect will fade to/from\n *\n * @param {number} inOpacity\n * @returns this\n */\n opacity(inOpacity) {\n if (!is_real_number(inOpacity))\n throw this.sequence._customError(\n this,\n \"opacity\",\n \"inOpacity must be of type number\"\n );\n this._opacity = inOpacity;\n return this;\n },\n\n /**\n * Causes the effect to fade in when played\n *\n * @param {number} duration How long the fade should be\n * @param {object} [options] Additional options, such as easing and delay\n * @returns this\n */\n fadeIn(duration, options = {}) {\n if (typeof options !== \"object\")\n throw this.sequence._customError(\n this,\n \"fadeIn\",\n \"options must be of type object\"\n );\n options = foundry.utils.mergeObject(\n {\n ease: \"linear\",\n delay: 0,\n },\n options\n );\n if (!is_real_number(duration))\n throw this.sequence._customError(\n this,\n \"fadeIn\",\n \"duration must be of type number\"\n );\n if (typeof options.ease !== \"string\")\n throw this.sequence._customError(\n this,\n \"fadeIn\",\n \"options.ease must be of type string\"\n );\n if (!is_real_number(options.delay))\n throw this.sequence._customError(\n this,\n \"fadeIn\",\n \"options.delay must be of type number\"\n );\n this._fadeIn = {\n duration: duration,\n ease: options.ease,\n delay: options.delay,\n };\n return this;\n },\n\n /**\n * Causes the effect to fade out at the end of the effect's duration\n *\n * @param {number} duration How long the fade should be\n * @param {object} [options] Additional options, such as easing and delay\n * @returns this\n */\n fadeOut(duration, options = {}) {\n if (typeof options !== \"object\")\n throw this.sequence._customError(\n this,\n \"fadeOut\",\n \"options must be of type object\"\n );\n options = foundry.utils.mergeObject(\n {\n ease: \"linear\",\n delay: 0,\n },\n options\n );\n if (!is_real_number(duration))\n throw this.sequence._customError(\n this,\n \"fadeOut\",\n \"duration must be of type number\"\n );\n if (typeof options.ease !== \"string\")\n throw this.sequence._customError(\n this,\n \"fadeOut\",\n \"ease must be of type string\"\n );\n if (!is_real_number(options.delay))\n throw this.sequence._customError(\n this,\n \"fadeOut\",\n \"delay must be of type number\"\n );\n this._fadeOut = {\n duration: duration,\n ease: options.ease,\n delay: options.delay,\n };\n return this;\n },\n};\n","import { is_real_number } from \"../../lib/lib.js\";\n\nexport default {\n /**\n * Base properties\n */\n _angle: null,\n _rotateIn: null,\n _rotateOut: null,\n _randomRotation: null,\n _rotateTowards: null,\n\n /**\n * The object gets a random rotation, which means it should not be used with .stretchTo()\n *\n * @param {boolean} [inBool=true] inBool\n * @returns this\n */\n randomRotation(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"randomRotation\",\n \"inBool must be of type boolean\"\n );\n this._randomRotation = inBool;\n return this;\n },\n\n /**\n * Sets the rotation of the object, which is added on top of the calculated rotation after .rotateTowards() or .randomRotation()\n *\n * @param {number} inRotation\n * @returns this\n */\n rotate(inRotation) {\n if (!is_real_number(inRotation))\n throw this.sequence._customError(\n this,\n \"opacity\",\n \"inRotation must be of type number\"\n );\n this._angle = inRotation;\n return this;\n },\n\n /**\n * Causes the object to rotate when it starts playing\n *\n * @param {number} degrees\n * @param {number} duration\n * @param {object} [options] options\n * @returns this\n */\n rotateIn(degrees, duration, options = {}) {\n if (typeof options !== \"object\")\n throw this.sequence._customError(\n this,\n \"rotateIn\",\n \"options must be of type object\"\n );\n options = foundry.utils.mergeObject(\n {\n ease: \"linear\",\n delay: 0,\n },\n options\n );\n if (!is_real_number(degrees))\n throw this.sequence._customError(\n this,\n \"rotateOut\",\n \"degrees must be of type number\"\n );\n if (!is_real_number(duration))\n throw this.sequence._customError(\n this,\n \"rotateOut\",\n \"duration must be of type number\"\n );\n if (typeof options.ease !== \"string\")\n throw this.sequence._customError(\n this,\n \"rotateIn\",\n \"options.ease must be of type string\"\n );\n if (!is_real_number(options.delay))\n throw this.sequence._customError(\n this,\n \"rotateIn\",\n \"options.delay must be of type number\"\n );\n this._rotateIn = {\n value: degrees,\n duration: duration,\n ease: options.ease,\n delay: options.delay,\n };\n return this;\n },\n\n /**\n * Causes the object to rotate at the end of the effect's duration\n *\n * @param {number} degrees\n * @param {number} duration\n * @param {object} [options] options\n * @returns this\n */\n rotateOut(degrees, duration, options = {}) {\n if (typeof options !== \"object\")\n throw this.sequence._customError(\n this,\n \"rotateOut\",\n \"options must be of type object\"\n );\n options = foundry.utils.mergeObject(\n {\n ease: \"linear\",\n delay: 0,\n },\n options\n );\n if (!is_real_number(degrees))\n throw this.sequence._customError(\n this,\n \"rotateOut\",\n \"degrees must be of type number\"\n );\n if (!is_real_number(duration))\n throw this.sequence._customError(\n this,\n \"rotateOut\",\n \"duration must be of type number\"\n );\n if (typeof options.ease !== \"string\")\n throw this.sequence._customError(\n this,\n \"rotateOut\",\n \"options.ease must be of type string\"\n );\n if (!is_real_number(options.delay))\n throw this.sequence._customError(\n this,\n \"rotateOut\",\n \"options.delay must be of type number\"\n );\n this._rotateOut = {\n value: degrees,\n duration: duration,\n ease: options.ease,\n delay: options.delay,\n };\n return this;\n },\n};\n","import { is_real_number } from \"../../lib/lib.js\";\n\nexport default {\n _scaleMin: null,\n _scaleMax: null,\n _scaleIn: null,\n _scaleOut: null,\n\n /**\n * A method that can take the following:\n * - A number to set the scale uniformly\n * - An object with x and y for non-uniform scaling\n * - Two numbers which the Sequencer will randomly pick a uniform scale between\n *\n * @param {number|object} inScaleMin\n * @param {number} [inScaleMax] inScaleMax\n * @returns this\n */\n scale(inScaleMin, inScaleMax) {\n if (!is_real_number(inScaleMin) && typeof inScaleMin !== \"object\")\n throw this.sequence._customError(\n this,\n \"scale\",\n \"inScale must be of type number or object\"\n );\n if (is_real_number(inScaleMin)) {\n if (inScaleMax && !is_real_number(inScaleMax)) {\n throw this.sequence._customError(\n this,\n \"scale\",\n \"if inScaleMin is a number, inScaleMax must also be of type number\"\n );\n }\n }\n this._scaleMin = inScaleMin;\n this._scaleMax = inScaleMax ?? false;\n return this;\n },\n\n /**\n * Causes the effect to scale when it starts playing\n *\n * @param {number|object} scale\n * @param {number} duration\n * @param {object} [options] options\n * @returns this\n */\n scaleIn(scale, duration, options = {}) {\n if (typeof options !== \"object\")\n throw this.sequence._customError(\n this,\n \"scaleIn\",\n \"options must be of type object\"\n );\n options = foundry.utils.mergeObject(\n {\n ease: \"linear\",\n delay: 0,\n },\n options\n );\n if (!is_real_number(duration))\n throw this.sequence._customError(\n this,\n \"scaleIn\",\n \"duration must be of type number\"\n );\n if (!is_real_number(scale) && typeof scale !== \"object\")\n throw this.sequence._customError(\n this,\n \"scaleIn\",\n \"scale must be of type number or object\"\n );\n if (typeof options.ease !== \"string\")\n throw this.sequence._customError(\n this,\n \"scaleIn\",\n \"options.ease must be of type string\"\n );\n if (!is_real_number(options.delay))\n throw this.sequence._customError(\n this,\n \"scaleIn\",\n \"options.delay must be of type number\"\n );\n this._scaleIn = {\n value: scale,\n duration: duration,\n ease: options.ease,\n delay: options.delay,\n };\n return this;\n },\n\n /**\n * Causes the effect to scale at the end of the effect's duration\n *\n * @param {number|object} scale\n * @param {number} duration\n * @param {object} [options] options\n * @returns this\n */\n scaleOut(scale, duration, options = {}) {\n if (typeof options !== \"object\")\n throw this.sequence._customError(\n this,\n \"scaleOut\",\n \"options must be of type object\"\n );\n options = foundry.utils.mergeObject(\n {\n ease: \"linear\",\n delay: 0,\n },\n options\n );\n if (!is_real_number(duration))\n throw this.sequence._customError(\n this,\n \"scaleOut\",\n \"duration must be of type number\"\n );\n if (!is_real_number(scale) && typeof scale !== \"object\")\n throw this.sequence._customError(\n this,\n \"scaleOut\",\n \"scale must be of type number or object\"\n );\n if (typeof options.ease !== \"string\")\n throw this.sequence._customError(\n this,\n \"scaleOut\",\n \"options.ease must be of type string\"\n );\n if (!is_real_number(options.delay))\n throw this.sequence._customError(\n this,\n \"scaleOut\",\n \"options.delay must be of type number\"\n );\n this._scaleOut = {\n value: scale,\n duration: duration,\n ease: options.ease,\n delay: options.delay,\n };\n return this;\n },\n};\n","import { is_real_number } from \"../../lib/lib.js\";\n\nexport default {\n _hasTime: true,\n _isRange: false,\n _startTime: null,\n _startPerc: null,\n _endTime: null,\n _endPerc: null,\n\n /**\n * Sets the start and end time of the section, playing only that range\n *\n * @param {number} inMsStart\n * @param {number} inMsEnd\n * @returns this\n */\n timeRange(inMsStart, inMsEnd) {\n if (!is_real_number(inMsStart))\n throw this.sequence._customError(\n this,\n \"timeRange\",\n \"inMsStart must be of type number\"\n );\n if (!is_real_number(inMsEnd))\n throw this.sequence._customError(\n this,\n \"timeRange\",\n \"inMsEnd must be of type number\"\n );\n this._startTime = inMsStart;\n this._endTime = inMsEnd;\n this._isRange = true;\n return this;\n },\n\n /**\n * Sets the start time of the section.\n *\n * @param {number} inMs\n * @returns this\n */\n startTime(inMs) {\n if (!is_real_number(inMs))\n throw this.sequence._customError(\n this,\n \"startTime\",\n \"inMs must be of type number\"\n );\n this._startTime = inMs;\n this._startPerc = false;\n this._isRange = false;\n return this;\n },\n\n /**\n * Sets the start time of the section based on a percentage from its total duration.\n *\n * @param {number} inPercentage\n * @returns this\n */\n startTimePerc(inPercentage) {\n if (!is_real_number(inPercentage))\n throw this.sequence._customError(\n this,\n \"startTimePerc\",\n \"inPercentage must be of type number\"\n );\n this._startTime = inPercentage;\n this._startPerc = true;\n this._isRange = false;\n return this;\n },\n\n /**\n * Sets the ending time of the section (from the end).\n *\n * @param {number} inMs\n * @returns this\n */\n endTime(inMs) {\n if (!is_real_number(inMs))\n throw this.sequence._customError(\n this,\n \"endTime\",\n \"inMs must be of type number\"\n );\n this._endTime = inMs;\n this._endPerc = false;\n this._isRange = false;\n return this;\n },\n\n /**\n * Sets the ending time of the section based on a percentage from the total duration.\n *\n * @param {number} inPercentage\n * @returns this\n */\n endTimePerc(inPercentage) {\n if (!is_real_number(inPercentage))\n throw this.sequence._customError(\n this,\n \"endTimePerc\",\n \"inPercentage must be of type number\"\n );\n this._endTime = inPercentage;\n this._endPerc = true;\n this._isRange = false;\n return this;\n },\n};\n","export default {\n _users: null,\n\n _addUser(inUser) {\n if (!this._users) this._users = [];\n if (typeof inUser !== \"string\")\n throw this.sequence._customError(\n this,\n \"_addUser\",\n \"inUser must be of type string\"\n );\n if (!game.users.has(inUser)) {\n if (game.users.getName(inUser)) {\n inUser = game.users.getName(inUser).id;\n } else {\n throw this.sequence._customError(\n this,\n \"_addUser\",\n `user with id or name \"${inUser}\" does not exist!`\n );\n }\n }\n\n if (!this._users.includes(inUser)) this._users.push(inUser);\n },\n\n _deleteUser(inUser) {\n if (!this._users) this._users = [];\n if (this._users.includes(inUser)) {\n let index = this._users.indexOf(inUser);\n this._users.splice(index, 1);\n }\n },\n\n /**\n * Causes section to be executed only locally, and not push to other connected clients.\n *\n * @param {boolean} inLocally\n * @returns this\n */\n locally(inLocally = true) {\n if (inLocally) this._addUser(game.userId);\n else this._deleteUser(game.userId);\n return this;\n },\n\n /**\n * Causes the section to be executed for only a set of users.\n *\n * @param {string|User|array} inUsers\n * @returns this\n */\n forUsers(inUsers) {\n if (!Array.isArray(inUsers)) {\n if (typeof inUsers !== \"string\")\n throw this.sequence._customError(\n this,\n \"forUsers\",\n \"inUser must be of type string\"\n );\n inUsers = [inUsers];\n }\n inUsers.forEach((u) => this._addUser(u));\n return this;\n },\n};\n","import filters from \"../../lib/filters.js\";\n\nexport default {\n _filters: null,\n\n _addFilter(inFilterName, inData, inName = false) {\n if (!this._filters) this._filters = [];\n this._filters.push({\n className: inFilterName,\n name: inName,\n data: inData,\n });\n },\n\n _testFilter(inFilterName, inData) {\n let filter = new filters[inFilterName](inData);\n if (!filter.isValid)\n throw this.sequence._customError(\n this,\n \"filter\",\n `Could not create ${inFilterName} filter - data is malformed!`\n );\n },\n\n filter(inFilterName, inData = {}, inName = \"\") {\n if (typeof inFilterName !== \"string\")\n throw this.sequence._customError(\n this,\n \"filter\",\n `inFilterName must be of type string`\n );\n if (!Object.keys(filters).includes(inFilterName))\n throw this.sequence._customError(\n this,\n \"filter\",\n `\"${inFilterName}\" does not exist`\n );\n this._testFilter(inFilterName, inData);\n this._addFilter(inFilterName, inData, inName);\n return this;\n },\n};\n","import * as lib from \"../../lib/lib.js\";\nimport { is_real_number } from \"../../lib/lib.js\";\n\nexport default {\n _tint: null,\n\n /**\n * Tints the target of this section by the color given to the\n *\n * @param {number|string} inColor\n * @returns this\n */\n tint(inColor) {\n if (!is_real_number(inColor) && typeof inColor !== \"string\")\n throw this.sequence._customError(\n this,\n \"tint\",\n `inColor must be of type string (hexadecimal) or number (decimal)!`\n );\n this._tint = lib.parseColor(inColor);\n return this;\n },\n};\n","import * as lib from \"../../lib/lib.js\";\nimport * as canvaslib from \"../../lib/canvas-lib.js\";\n\nexport default {\n /**\n * Base properties\n */\n _source: null,\n\n /**\n * A smart method that can take a reference to an object, or a direct on the canvas to play the effect at,\n * or a string reference (see .name())\n *\n * @param {Object|String} inLocation\n * @param {Object} inOptions\n * @returns {EffectSection}\n */\n atLocation(inLocation, inOptions = {}) {\n if (!(typeof inLocation === \"object\" || typeof inLocation === \"string\")) {\n throw this.sequence._customError(\n this,\n \"atLocation\",\n `inLocation is invalid, and must be of type of object, string, placeable object, or document`\n );\n }\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"atLocation\",\n `inOptions must be of type object`\n );\n inOptions = foundry.utils.mergeObject(\n {\n cacheLocation: false,\n offset: false,\n randomOffset: false,\n gridUnits: false,\n local: false,\n },\n inOptions\n );\n inLocation = this._validateLocation(inLocation);\n if (inLocation === undefined)\n throw this.sequence._customError(\n this,\n \"atLocation\",\n \"could not find position of given object\"\n );\n if (typeof inOptions.cacheLocation !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"atLocation\",\n \"inOptions.cacheLocation must be of type boolean\"\n );\n if (\n !(\n typeof inOptions.randomOffset === \"boolean\" ||\n lib.is_real_number(inOptions.randomOffset)\n )\n )\n throw this.sequence._customError(\n this,\n \"atLocation\",\n \"inOptions.randomOffset must be of type boolean or number\"\n );\n\n this._temporaryEffect =\n this._temporaryEffect ||\n (inLocation instanceof foundry.abstract.Document\n ? !lib.is_UUID(inLocation?.uuid)\n : false);\n\n if (inOptions.offset) {\n const offsetData = this._validateOffset(\n \"atLocation\",\n inOptions.offset,\n inOptions\n );\n this._offset = {\n source: offsetData,\n target: this._offset?.target ?? false,\n };\n }\n\n this._randomOffset = {\n source: inOptions.randomOffset,\n target: this._randomOffset?.target ?? false,\n };\n\n this._source =\n inOptions.cacheLocation && typeof inLocation !== \"string\"\n ? canvaslib.get_object_canvas_data(inLocation)\n : inLocation;\n return this;\n },\n};\n","import * as lib from \"../../lib/lib.js\";\n\nexport default {\n _offset: null,\n _randomOffset: null,\n\n _validateOffset(functionName, inOffset, inOptions = {}) {\n inOffset = foundry.utils.mergeObject(\n {\n x: 0,\n y: 0,\n },\n inOffset\n );\n inOptions = foundry.utils.mergeObject(\n {\n gridUnits: false,\n local: false,\n },\n inOptions\n );\n if (typeof inOptions.gridUnits !== \"boolean\")\n throw this.sequence._customError(\n this,\n functionName,\n \"inOptions.gridUnits must be of type boolean\"\n );\n if (typeof inOptions.local !== \"boolean\")\n throw this.sequence._customError(\n this,\n functionName,\n \"inOptions.local must be of type boolean\"\n );\n if (!lib.is_real_number(inOffset.x))\n throw this.sequence._customError(\n this,\n functionName,\n `inOffset.x must be of type number!`\n );\n if (!lib.is_real_number(inOffset.y))\n throw this.sequence._customError(\n this,\n functionName,\n `inOffset.y must be of type number!`\n );\n return {\n ...inOffset,\n ...inOptions,\n };\n },\n};\n","export default {\n _text: null,\n\n /**\n * Creates a text element, attached to the sprite. The options for the text are available here:\n * https://pixijs.io/pixi-text-style/\n *\n * @param {String} inText\n * @param {Object} inOptions\n * @returns {EffectSection}\n */\n text(inText, inOptions = {}) {\n if (typeof inText !== \"string\")\n throw this.sequence._customError(\n this,\n \"text\",\n \"inText must be of type string\"\n );\n this._text = foundry.utils.mergeObject(\n {\n text: inText,\n },\n inOptions\n );\n return this;\n },\n};\n","import animation from \"./animation.js\";\nimport audio from \"./audio.js\";\nimport files from \"./files.js\";\nimport moves from \"./moves.js\";\nimport opacity from \"./opacity.js\";\nimport rotation from \"./rotation.js\";\nimport scale from \"./scale.js\";\nimport time from \"./time.js\";\nimport users from \"./users.js\";\nimport filter from \"./filter.js\";\nimport tint from \"./tint.js\";\nimport location from \"./location.js\";\nimport offset from \"./offset.js\";\nimport text from \"./text.js\";\n\nexport default {\n animation,\n audio,\n files,\n moves,\n opacity,\n rotation,\n scale,\n time,\n users,\n filter,\n tint,\n location,\n offset,\n text,\n};\n","import * as lib from \"../lib/lib.js\";\nimport { is_real_number } from \"../lib/lib.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport Section from \"./section.js\";\nimport traits from \"./traits/_traits.js\";\nimport CanvasEffect from \"../canvas-effects/canvas-effect.js\";\nimport flagManager from \"../utils/flag-manager.js\";\nimport SequencerFileCache from \"../modules/sequencer-file-cache.js\";\nimport CONSTANTS from \"../constants.js\";\n\nexport default class EffectSection extends Section {\n constructor(inSequence, inFile = \"\") {\n super(inSequence);\n this._deserializedData = null;\n this._file = inFile;\n this._text = null;\n this._source = null;\n this._stretchTo = null;\n this._attachTo = null;\n this._from = null;\n this._origin = null;\n this._anchor = null;\n this._spriteAnchor = null;\n this._randomOffset = null;\n this._missed = null;\n this._private = null;\n this._randomMirrorX = null;\n this._randomMirrorY = null;\n this._mirrorX = null;\n this._mirrorY = null;\n this._playbackRate = null;\n this._template = null;\n this._overrides = [];\n this._name = null;\n this._zIndex = null;\n this._offset = null;\n this._spriteOffset = null;\n this._size = null;\n this._persist = null;\n this._persistOptions = null;\n this._zeroSpriteRotation = null;\n this._extraEndDuration = null;\n this._noLoop = null;\n this._tilingTexture = null;\n this._snapToGrid = null;\n this._scaleToObject = null;\n this._screenSpace = null;\n this._screenSpaceAboveUI = null;\n this._screenSpaceAnchor = null;\n this._screenSpacePosition = null;\n this._screenSpaceScale = null;\n this._elevation = null;\n this._masks = [];\n this._tiedDocuments = [];\n this._selfMask = false;\n this._temporaryEffect = false;\n this._spriteRotation = 0;\n this._isRangedEffect = null;\n this._offsetLegacy = null;\n this._randomOffsetLegacy = null;\n this._aboveLighting = null;\n this._spriteScaleMin = 1.0;\n this._spriteScaleMax = null;\n this._isometric = null;\n this._shapes = [];\n this._xray = null;\n this._playEffect = true;\n }\n\n static niceName = \"Effect\";\n\n /**\n * @private\n */\n get _target() {\n return this._stretchTo || this._rotateTowards || this._moveTowards || false;\n }\n\n static debounceWarning() {\n lib.custom_warning(\n \"Sequencer\",\n \"Effect | This user does not have permissions to play effects. This can be configured in Sequencer's module settings.\"\n );\n }\n\n /**\n * Causes the effect's position to be stored and can then be used with .atLocation(), .stretchTowards(),\n * and .rotateTowards() to refer to previous effects' locations\n *\n * @param {String} inName\n * @returns {EffectSection}\n */\n name(inName) {\n if (typeof inName !== \"string\")\n throw this.sequence._customError(\n this,\n \"name\",\n \"inName must be of type string\"\n );\n this._name = lib.safe_str(inName);\n return this;\n }\n\n /**\n * Causes the effect to persist indefinitely on the canvas until _ended via SequencerEffectManager.endAllEffects() or\n * name the effect with .name() and then end it through SequencerEffectManager.endEffect()\n *\n * @param {Boolean} [inBool=true] inBool\n * @param {Object} [inOptions={}] inOptions\n * @returns {EffectSection}\n */\n persist(inBool = true, inOptions = {}) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"persist\",\n \"inBool must be of type boolean\"\n );\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"persist\",\n `inOptions must be of type object`\n );\n inOptions = foundry.utils.mergeObject(\n {\n id: randomID(),\n persistTokenPrototype: false,\n },\n inOptions\n );\n if (typeof inOptions.persistTokenPrototype !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"persist\",\n \"inOptions.persistTokenPrototype must be of type boolean\"\n );\n this._persist = inBool;\n this._persistOptions = inOptions;\n return this;\n }\n\n /**\n * Sets the effect's playback rate. A playback rate of 2.0 would make it play 2x as fast, 0.5 would make\n * it play half as fast.\n *\n * @param {Number} inNumber\n * @returns {EffectSection}\n */\n playbackRate(inNumber = 1.0) {\n if (!lib.is_real_number(inNumber))\n throw this.sequence._customError(\n this,\n \"playbackRate\",\n \"inNumber must be of type number\"\n );\n this._playbackRate = inNumber;\n return this;\n }\n\n /**\n * Causes the effect to target a location close to the .stretchTowards() location, but not on it.\n *\n * @param {Boolean} [inBool=true] inBool\n * @returns {EffectSection}\n */\n missed(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"missed\",\n \"inBool must be of type boolean\"\n );\n this._missed = inBool;\n return this;\n }\n\n /**\n * Adds a function that will run at the end of the effect serialization step, but before it is played. Allows direct\n * modifications of effect's data. For example, it could be manipulated to change which file will be used based\n * on the distance to the target.\n *\n * @param {Function} inFunc\n * @returns {EffectSection}\n */\n addOverride(inFunc) {\n if (!lib.is_function(inFunc))\n throw this.sequence._customError(\n this,\n \"addOverride\",\n \"The given function needs to be an actual function.\"\n );\n this._overrides.push(inFunc);\n return this;\n }\n\n /**\n * A smart method that can take a reference to an object, or a direct on the canvas to attach an effect to,\n * or a string reference (see .name())\n *\n * @param {Object|String} inObject\n * @param {Object} inOptions\n * @returns {EffectSection}\n */\n attachTo(inObject, inOptions = {}) {\n if (!(typeof inObject === \"object\" || typeof inObject === \"string\")) {\n throw this.sequence._customError(\n this,\n \"attachTo\",\n `inObject is invalid, and must be of type of object, string, placeable object, or document`\n );\n }\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"attachTo\",\n `inOptions must be of type object`\n );\n inOptions = foundry.utils.mergeObject(\n {\n align: \"center\",\n edge: \"on\",\n bindVisibility: true,\n bindAlpha: true,\n bindElevation: true,\n followRotation: true,\n offset: false,\n randomOffset: false,\n gridUnits: false,\n local: false,\n },\n inOptions\n );\n\n const validatedObject = this._validateLocation(inObject);\n if (validatedObject === undefined)\n throw this.sequence._customError(\n this,\n \"attachTo\",\n \"could not find given object\"\n );\n\n let isValidObject = true;\n if (typeof inObject === \"string\") {\n isValidObject =\n validatedObject instanceof Token ||\n validatedObject instanceof TokenDocument ||\n validatedObject instanceof Tile ||\n validatedObject instanceof TileDocument ||\n validatedObject instanceof Drawing ||\n validatedObject instanceof DrawingDocument ||\n validatedObject instanceof MeasuredTemplate ||\n validatedObject instanceof MeasuredTemplateDocument ||\n validatedObject instanceof CanvasEffect;\n if (!isValidObject) {\n this.sequence._showWarning(\n this,\n \"attachTo\",\n \"Only Tokens, Tiles, Drawings, and MeasuredTemplates may have attached effects - will play effect on target's location\"\n );\n }\n }\n\n const aligns = Object.keys(canvaslib.alignments);\n if (\n typeof inOptions.align !== \"string\" ||\n !aligns.includes(inOptions.align)\n ) {\n throw this.sequence._customError(\n this,\n \"attachTo\",\n `inOptions.align must be of type string, one of: ${aligns.join(\", \")}`\n );\n }\n if (\n typeof inOptions.edge !== \"string\" ||\n !(\n inOptions.edge === \"on\" ||\n inOptions.edge === \"inner\" ||\n inOptions.edge === \"outer\"\n )\n ) {\n throw this.sequence._customError(\n this,\n \"attachTo\",\n `inOptions.edge must of type string with the value of either \"on\", \"inner\", or \"outer\"`\n );\n }\n if (typeof inOptions.bindVisibility !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"attachTo\",\n `inOptions.bindVisibility must be of type boolean`\n );\n if (typeof inOptions.followRotation !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"attachTo\",\n `inOptions.followRotation must be of type boolean`\n );\n if (typeof inOptions.bindAlpha !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"attachTo\",\n \"inOptions.bindAlpha must be of type boolean\"\n );\n if (typeof inOptions.bindElevation !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"attachTo\",\n \"inOptions.bindElevation must be of type boolean\"\n );\n if (\n !(\n typeof inOptions.randomOffset === \"boolean\" ||\n lib.is_real_number(inOptions.randomOffset)\n )\n )\n throw this.sequence._customError(\n this,\n \"attachTo\",\n \"inOptions.randomOffset must be of type boolean or number\"\n );\n\n this._source = validatedObject;\n\n this._temporaryEffect =\n this._temporaryEffect ||\n (validatedObject instanceof foundry.abstract.Document ||\n validatedObject instanceof MeasuredTemplate\n ? !lib.is_UUID(validatedObject?.uuid)\n : false);\n\n if (inOptions.offset) {\n const offsetData = this._validateOffset(\n \"attachTo\",\n inOptions.offset,\n inOptions\n );\n this._offset = {\n source: offsetData,\n target: this._offset?.target ?? false,\n };\n }\n\n this._randomOffset = {\n source: inOptions.randomOffset,\n target: this._randomOffset?.target ?? false,\n };\n\n this._attachTo = {\n active: isValidObject,\n align: inOptions.align,\n edge: inOptions.edge,\n bindVisibility: inOptions.bindVisibility,\n bindAlpha: inOptions.bindAlpha,\n bindElevation: inOptions.bindElevation,\n followRotation: inOptions.followRotation,\n };\n return this;\n }\n\n /**\n * Causes the effect to be rotated and stretched towards an object, or a direct on the canvas to play the effect at, or a string reference (see .name())\n * This effectively calculates the proper X scale for the effect to reach the target\n *\n * @param {Object|String} inLocation\n * @param {Object} inOptions\n * @returns {EffectSection}\n */\n stretchTo(inLocation, inOptions = {}) {\n if (!(typeof inLocation === \"object\" || typeof inLocation === \"string\")) {\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n `inLocation is invalid, and must be of type of object, string, placeable object, or document`\n );\n }\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n `inOptions must be of type object`\n );\n inOptions = foundry.utils.mergeObject(\n {\n cacheLocation: false,\n attachTo: false,\n onlyX: false,\n tiling: false,\n offset: false,\n randomOffset: false,\n gridUnits: false,\n local: false,\n },\n inOptions\n );\n const validatedObject = this._validateLocation(inLocation);\n if (validatedObject === undefined)\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n \"could not find position of given object\"\n );\n if (typeof inOptions.cacheLocation !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n \"inOptions.cacheLocation must be of type boolean\"\n );\n if (typeof inOptions.attachTo !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n \"inOptions.attachTo must be of type boolean\"\n );\n if (typeof inOptions.onlyX !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n \"inOptions.onlyX must be of type boolean\"\n );\n if (typeof inOptions.tiling !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n \"inOptions.tiling must be of type boolean\"\n );\n if (\n !(\n typeof inOptions.randomOffset === \"boolean\" ||\n lib.is_real_number(inOptions.randomOffset)\n )\n )\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n \"inOptions.randomOffset must be of type boolean or number\"\n );\n\n if (inOptions.cacheLocation && inOptions.attachTo) {\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n \"cacheLocation and attachTo cannot both be true - pick one or the other\"\n );\n }\n\n if (inOptions.tiling) this.tilingTexture();\n\n this._temporaryEffect =\n this._temporaryEffect ||\n (validatedObject instanceof foundry.abstract.Document\n ? !lib.is_UUID(validatedObject?.uuid)\n : false);\n\n if (inOptions.offset) {\n const offsetData = this._validateOffset(\n \"stretchTo\",\n inOptions.offset,\n inOptions\n );\n this._offset = {\n source: this._offset?.source ?? false,\n target: offsetData,\n };\n }\n\n this._randomOffset = {\n source: this._randomOffset?.source ?? false,\n target: inOptions.randomOffset,\n };\n\n this._stretchTo = {\n target: inOptions.cacheLocation\n ? canvaslib.get_object_canvas_data(validatedObject, { measure: true })\n : validatedObject,\n attachTo: inOptions.attachTo,\n onlyX: inOptions.onlyX,\n };\n\n return this;\n }\n\n /**\n * Sets the location to rotate the object to\n *\n * @param {object|string} inLocation\n * @param {object} inOptions\n * @returns this\n */\n rotateTowards(inLocation, inOptions = {}) {\n if (!(typeof inLocation === \"object\" || typeof inLocation === \"string\")) {\n throw this.sequence._customError(\n this,\n \"inLocation\",\n `inLocation is invalid, and must be of type of object, string, placeable object, or document`\n );\n }\n inOptions = foundry.utils.mergeObject(\n {\n rotationOffset: 0,\n cacheLocation: false,\n attachTo: false,\n offset: false,\n randomOffset: false,\n local: false,\n gridUnits: false,\n },\n inOptions\n );\n if (!lib.is_real_number(inOptions.rotationOffset))\n throw this.sequence._customError(\n this,\n \"rotateTowards\",\n \"inOptions.rotationOffset must be of type number\"\n );\n if (typeof inOptions.attachTo !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"rotateTowards\",\n \"inOptions.attachTo must be of type boolean\"\n );\n if (typeof inOptions.cacheLocation !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"rotateTowards\",\n \"inOptions.cacheLocation must be of type boolean\"\n );\n const validatedObject = this._validateLocation(inLocation);\n if (!validatedObject)\n throw this.sequence._customError(\n this,\n \"rotateTowards\",\n \"could not find position of given object\"\n );\n\n this._temporaryEffect =\n this._temporaryEffect ||\n (validatedObject instanceof foundry.abstract.Document\n ? !lib.is_UUID(validatedObject?.uuid)\n : false);\n\n if (inOptions.offset) {\n const offsetData = this._validateOffset(\n \"attachTo\",\n inOptions.offset,\n inOptions\n );\n this._offset = {\n source: offsetData,\n target: this._offset?.target ?? false,\n };\n }\n\n this._randomOffset = {\n source: inOptions.randomOffset,\n target: this._randomOffset?.target ?? false,\n };\n\n this._rotateTowards = {\n target: inOptions.cacheLocation\n ? canvaslib.get_object_canvas_data(validatedObject, { measure: true })\n : validatedObject,\n rotationOffset: inOptions.rotationOffset,\n cacheLocation: inOptions.cacheLocation,\n attachTo: inOptions.attachTo,\n };\n\n return this;\n }\n\n /**\n * Create an effect based on the given object, effectively copying the object as an effect. Useful when you want to do some effect magic on tokens or tiles.\n *\n * @param {Object} inObject\n * @param {Object} inOptions\n * @returns {EffectSection}\n */\n from(inObject, inOptions = {}) {\n if (\n !(\n inObject instanceof Token ||\n inObject instanceof Tile ||\n inObject instanceof TokenDocument ||\n inObject instanceof TileDocument\n )\n ) {\n throw this.sequence._customError(\n this,\n \"from\",\n \"inObject must be of type Token, Tile, TokenDocument, or TileDocument\"\n );\n }\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"from\",\n `inOptions must be of type object`\n );\n inObject = inObject.document ?? inObject;\n if (!inObject?.texture?.src)\n throw this.sequence._customError(\n this,\n \"from\",\n \"could not find the image for the given object\"\n );\n inOptions = foundry.utils.mergeObject(\n {\n cacheLocation: false,\n offset: false,\n randomOffset: false,\n local: false,\n gridUnits: false,\n },\n inOptions\n );\n if (typeof inOptions.cacheLocation !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"from\",\n \"inOptions.cacheLocation must be of type boolean\"\n );\n if (\n !(\n typeof inOptions.randomOffset === \"boolean\" ||\n lib.is_real_number(inOptions.randomOffset)\n )\n )\n throw this.sequence._customError(\n this,\n \"from\",\n \"inOptions.randomOffset must be of type boolean or number\"\n );\n\n this._temporaryEffect =\n this._temporaryEffect ||\n (inObject instanceof foundry.abstract.Document\n ? !lib.is_UUID(inObject?.uuid)\n : false);\n\n if (inOptions.offset) {\n const offsetData = this._validateOffset(\n \"attachTo\",\n inOptions.offset,\n inOptions\n );\n this._offset = {\n source: offsetData,\n target: this._offset?.target ?? false,\n };\n }\n\n this._randomOffset = {\n source: inOptions.randomOffset,\n target: this._randomOffset?.target ?? false,\n };\n\n this._from = {\n object: inObject,\n options: inOptions,\n };\n return this;\n }\n\n shape(inType, inOptions = {}) {\n if (typeof inType !== \"string\")\n throw this.sequence._customError(\n this,\n \"shape\",\n \"type must be of type string\"\n );\n\n if (!Object.values(CONSTANTS.SHAPES).includes(inType)) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"type must be one of: \" + Object.values(CONSTANTS.SHAPES).join(\", \")\n );\n }\n\n if (inType === CONSTANTS.SHAPES.POLY) {\n if (!Array.isArray(inOptions.points)) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"if creating polygon, inOptions.points must be of type array\"\n );\n }\n inOptions.points = inOptions.points.map((point) => {\n if (Array.isArray(point)) {\n if (!is_real_number(point[0]) || !is_real_number(point[1])) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"inOptions.points must be an array, containing an array of two numbers or objects with x and y number properties\"\n );\n }\n return point;\n }\n if (typeof point === \"object\") {\n if (!is_real_number(point?.x) || !is_real_number(point?.y)) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"inOptions.points must be an array, containing an array of two numbers or objects with x and y number properties\"\n );\n }\n return [point.x, point.y];\n }\n });\n } else if (inType === CONSTANTS.SHAPES.CIRC) {\n if (typeof inOptions.radius !== \"number\") {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"if creating circle, inOptions.radius must be of type number\"\n );\n }\n } else if (\n inType === CONSTANTS.SHAPES.RECT ||\n inType === CONSTANTS.SHAPES.RREC ||\n inType === CONSTANTS.SHAPES.ELIP\n ) {\n if (inOptions.width ^ inOptions.height) {\n inOptions.width = inOptions.width ?? inOptions.height;\n inOptions.height = inOptions.height ?? inOptions.width;\n }\n if (typeof inOptions.width !== \"number\") {\n throw this.sequence._customError(\n this,\n \"shape\",\n `if creating rectangle, rounded rectangle, or an ellipse, inOptions.width must be of type number`\n );\n }\n if (typeof inOptions.height !== \"number\") {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"if creating rectangle, rounded rectangle, or an ellipse, inOptions.height must be of type number\"\n );\n }\n if (\n inType === CONSTANTS.SHAPES.RREC &&\n typeof inOptions.radius !== \"number\"\n ) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"if creating rounded border rectangle, inOptions.radius must be of type number\"\n );\n }\n }\n\n if (\n inOptions.gridUnits !== undefined &&\n typeof inOptions.gridUnits !== \"boolean\"\n ) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"inOptions.gridUnits must be of type boolean\"\n );\n }\n\n if (inOptions.name && typeof inOptions.name !== \"string\") {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"inOptions.name must be of type string\"\n );\n }\n\n if (\n inOptions.fillColor &&\n !is_real_number(inOptions.fillColor) &&\n typeof inOptions.fillColor !== \"string\"\n ) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"inOptions.fillColor must be of type string (hexadecimal) or number (decimal)\"\n );\n } else {\n inOptions.fillColor = lib.parseColor(inOptions.fillColor).decimal;\n }\n\n if (inOptions.fillAlpha && !is_real_number(inOptions.fillAlpha)) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"inOptions.fillAlpha must be of type number\"\n );\n }\n\n if (inOptions.alpha && !is_real_number(inOptions.alpha)) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"inOptions.alpha must be of type number\"\n );\n }\n\n if (inOptions.lineSize && !is_real_number(inOptions.lineSize)) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"inOptions.lineSize must be of type number\"\n );\n }\n\n if (\n inOptions.lineColor &&\n !is_real_number(inOptions.lineColor) &&\n typeof inOptions.lineColor !== \"string\"\n ) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"inOptions.lineColor must be of type string (hexadecimal) or number (decimal)\"\n );\n } else {\n inOptions.lineColor = lib.parseColor(inOptions.lineColor).decimal;\n }\n\n if (inOptions.offset) {\n inOptions.offset = this._validateOffset(\n \"shape\",\n inOptions.offset,\n inOptions.offset\n );\n }\n\n if (\n inOptions.isMask !== undefined &&\n typeof inOptions.isMask !== \"boolean\"\n ) {\n throw this.sequence._customError(\n this,\n \"shape\",\n \"inOptions.isMask must be of type boolean\"\n );\n }\n\n this._shapes.push({\n ...inOptions,\n type: inType,\n });\n\n return this;\n }\n\n /**\n * Causes the effect to be offset relative to its location based on a given vector\n *\n * @param {Object} inOffset\n * @param {Object} inOptions\n * @returns {EffectSection}\n */\n offset(inOffset, inOptions = {}) {\n this.sequence._showWarning(\n this,\n \"offset\",\n \"This method is becoming deprecated, please use the secondary offset option in atLocation, attachTo, stretchTo instead.\",\n true\n );\n if (inOffset === undefined)\n throw this.sequence._customError(\n this,\n \"offset\",\n \"inOffset must not be undefined\"\n );\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"offset\",\n \"options must be of type object\"\n );\n this._offsetLegacy = this._validateOffset(\"offset\", inOffset, inOptions);\n return this;\n }\n\n /**\n * Causes the effect's sprite to be offset relative to its location based on a given vector\n *\n * @param {Object} inOffset\n * @param {Object} inOptions\n * @returns {EffectSection}\n */\n spriteOffset(inOffset, inOptions = {}) {\n if (inOffset === undefined)\n throw this.sequence._customError(\n this,\n \"spriteOffset\",\n \"inOffset must not be undefined\"\n );\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"spriteOffset\",\n \"options must be of type object\"\n );\n this._spriteOffset = this._validateOffset(\n \"spriteOffset\",\n inOffset,\n inOptions\n );\n return this;\n }\n\n /**\n * Causes the final effect location to be snapped to the grid\n *\n * @param {Boolean} inBool\n * @returns {EffectSection}\n */\n snapToGrid(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"snapToGrid\",\n \"inBool must be of type boolean\"\n );\n this._snapToGrid = inBool;\n return this;\n }\n\n /**\n * Causes the effect to be scaled to the target object's width\n *\n * @param {Number} inScale\n * @param {Object} inOptions\n * @returns {EffectSection}\n */\n scaleToObject(inScale = 1.0, inOptions = {}) {\n if (!lib.is_real_number(inScale))\n throw this.sequence._customError(\n this,\n \"scaleToObject\",\n `inScale must be of type number!`\n );\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"scaleToObject\",\n \"inOptions must be of type object\"\n );\n inOptions = foundry.utils.mergeObject(\n {\n scale: inScale,\n considerTokenScale: false,\n uniform: false,\n },\n inOptions\n );\n if (typeof inOptions.uniform !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"scaleToObject\",\n \"inBool must be of type boolean\"\n );\n this._scaleToObject = inOptions;\n return this;\n }\n\n /**\n * Sets the width and the height of the effect in pixels, this size is set before any scaling\n *\n * @param {Number|Object<{width: {Number}, height: {Number}}>} inSize\n * @param {Object} inOptions\n * @returns {EffectSection}\n */\n size(inSize, inOptions = {}) {\n if (!lib.is_real_number(inSize) && typeof inSize !== \"object\")\n throw this.sequence._customError(\n this,\n \"size\",\n \"inSize must be of type number or object\"\n );\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"size\",\n \"inOptions must be of type object\"\n );\n if (lib.is_real_number(inSize)) {\n inSize = {\n width: inSize,\n height: inSize,\n };\n }\n\n if ((inSize.width === undefined) ^ (inSize.height === undefined)) {\n if (inSize.width) {\n if (!lib.is_real_number(inSize.width))\n throw this.sequence._customError(\n this,\n \"size\",\n \"inSize.width must be of type number or string 'auto'\"\n );\n inSize[\"height\"] = \"auto\";\n } else {\n if (!lib.is_real_number(inSize.height))\n throw this.sequence._customError(\n this,\n \"size\",\n \"inSize.height must be of type number or string 'auto'\"\n );\n inSize[\"width\"] = \"auto\";\n }\n }\n\n inOptions = foundry.utils.mergeObject(\n {\n gridUnits: false,\n },\n inOptions\n );\n\n if (!lib.is_real_number(inSize.width) && inSize.width !== \"auto\")\n throw this.sequence._customError(\n this,\n \"size\",\n \"inSize.width must be of type number or string 'auto'\"\n );\n if (!lib.is_real_number(inSize.height) && inSize.height !== \"auto\")\n throw this.sequence._customError(\n this,\n \"size\",\n \"inSize.height must be of type number or string 'auto'\"\n );\n if (typeof inOptions.gridUnits !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"size\",\n \"inOptions.gridUnits must be of type boolean\"\n );\n\n this._size = {\n width: inSize.width ?? canvas.grid.size,\n height: inSize.height ?? canvas.grid.size,\n ...inOptions,\n };\n return this;\n }\n\n /**\n * This scales the sprite of the effect, and this method can take the following:\n * - A number to set the scale uniformly\n * - An object with x and y for non-uniform scaling\n * - Two numbers which the Sequencer will randomly pick a uniform scale between\n *\n * @param {number|object} inScaleMin\n * @param {number} [inScaleMax] inScaleMax\n * @returns this\n */\n spriteScale(inScaleMin, inScaleMax) {\n if (!lib.is_real_number(inScaleMin) && typeof inScaleMin !== \"object\")\n throw this.sequence._customError(\n this,\n \"spriteScale\",\n \"inScale must be of type number or object\"\n );\n if (lib.is_real_number(inScaleMin)) {\n if (inScaleMax && !lib.is_real_number(inScaleMax)) {\n throw this.sequence._customError(\n this,\n \"spriteScale\",\n \"if inScaleMin is a number, inScaleMax must also be of type number\"\n );\n }\n }\n this._spriteScaleMin = inScaleMin;\n this._spriteScaleMax = inScaleMax ?? false;\n return this;\n }\n\n /**\n * This defines the internal padding of this effect. Gridsize determines the internal grid size of this effect which will determine how big it is on the canvas\n * relative to the canvas's grid size. Start and end point defines padding at the left and right of the effect\n *\n * @param {Number} gridSize\n * @param {Number} startPoint\n * @param {Number} endPoint\n * @returns {EffectSection}\n */\n template({ gridSize, startPoint, endPoint } = {}) {\n if (gridSize && !lib.is_real_number(gridSize))\n throw this.sequence._customError(\n this,\n \"template\",\n \"gridSize must be of type number\"\n );\n if (startPoint && !lib.is_real_number(startPoint))\n throw this.sequence._customError(\n this,\n \"template\",\n \"startPoint must be of type number\"\n );\n if (endPoint && !lib.is_real_number(endPoint))\n throw this.sequence._customError(\n this,\n \"template\",\n \"endPoint must be of type number\"\n );\n if (!gridSize && !startPoint && !endPoint)\n throw this.sequence._customError(\n this,\n \"template\",\n \"You need to define at least one parameter!\"\n );\n if (!this._template) this._template = {};\n if (gridSize) this._template[\"gridSize\"] = gridSize;\n if (startPoint) this._template[\"startPoint\"] = startPoint;\n if (endPoint) this._template[\"endPoint\"] = endPoint;\n return this;\n }\n\n /**\n * This makes the texture of the effect tile, effectively repeat itself within the sprite's dimensions\n *\n * @param {Object|Number} scale\n * @param {Object} position\n * @returns {EffectSection}\n */\n tilingTexture(scale = { x: 1.0, y: 1.0 }, position = { x: 0, y: 0 }) {\n if (lib.is_real_number(scale)) {\n scale = { x: scale, y: scale };\n }\n\n scale = { x: scale?.x ?? 1.0, y: scale?.y ?? 1.0 };\n\n if (!lib.is_real_number(scale.x))\n throw this.sequence._customError(\n this,\n \"tilingTexture\",\n `scale.x must be of type number!`\n );\n if (!lib.is_real_number(scale.y))\n throw this.sequence._customError(\n this,\n \"tilingTexture\",\n `scale.y must be of type number!`\n );\n\n position = { x: position?.x ?? 0, y: position?.y ?? 0 };\n\n if (!lib.is_real_number(position.x))\n throw this.sequence._customError(\n this,\n \"tilingTexture\",\n `position.x must be of type number!`\n );\n if (!lib.is_real_number(position.y))\n throw this.sequence._customError(\n this,\n \"tilingTexture\",\n `position.y must be of type number!`\n );\n\n this._tilingTexture = {\n scale,\n position,\n };\n\n return this;\n }\n\n /**\n * Anchors the sprite's container according to the given x and y coordinates, or uniformly based on a single number\n *\n * @param {Number|Object} inAnchor\n * @returns {EffectSection}\n */\n anchor(inAnchor) {\n if (lib.is_real_number(inAnchor)) {\n inAnchor = {\n x: inAnchor,\n y: inAnchor,\n };\n }\n\n inAnchor = {\n x: inAnchor?.x ?? 0.5,\n y: inAnchor?.y ?? 0.5,\n };\n\n if (!lib.is_real_number(inAnchor.x))\n throw this.sequence._customError(\n this,\n \"anchor\",\n `inAnchor.x must be of type number!`\n );\n if (!lib.is_real_number(inAnchor.y))\n throw this.sequence._customError(\n this,\n \"anchor\",\n `inAnchor.y must be of type number!`\n );\n\n this._anchor = inAnchor;\n return this;\n }\n\n /**\n * Anchors the sprite according to the given x and y coordinates, or uniformly based on a single number\n *\n * @param {Number|Object} inAnchor\n * @returns {EffectSection}\n */\n spriteAnchor(inAnchor) {\n if (lib.is_real_number(inAnchor)) {\n inAnchor = {\n x: inAnchor,\n y: inAnchor,\n };\n }\n\n inAnchor = {\n x: inAnchor?.x ?? 0.5,\n y: inAnchor?.y ?? 0.5,\n };\n\n if (!lib.is_real_number(inAnchor.x))\n throw this.sequence._customError(\n this,\n \"anchor\",\n `inAnchor.x must be of type number!`\n );\n if (!lib.is_real_number(inAnchor.y))\n throw this.sequence._customError(\n this,\n \"anchor\",\n `inAnchor.y must be of type number!`\n );\n\n this._spriteAnchor = inAnchor;\n return this;\n }\n\n /**\n * Centers the sprite, effectively giving it an anchor of {x: 0.5, y: 0.5}\n *\n * Note: If this is used, it will override the anchor set by Aim Towards, which sets the sprite's anchor to the\n * outermost edge of the location the sprite is played at\n *\n * @returns {EffectSection}\n */\n center() {\n this.anchor(0.5);\n return this;\n }\n\n /**\n * The sprite gets a random offset on its target location, usually within the object's bounds. The optional parameter\n * scales how much offset should be added. Defaults to 1.0, which covers the entire target position, 0.5 would cover half.\n *\n * @param {Number} inOffsetScale\n * @returns {EffectSection}\n */\n randomOffset(inOffsetScale = 1.0) {\n this.sequence._showWarning(\n this,\n \"randomOffset\",\n \"This method has been deprecated, please use randomOffset as a second parameter on atLocation, stretchTo, etc.\",\n true\n );\n if (!lib.is_real_number(inOffsetScale))\n throw this.sequence._customError(\n this,\n \"randomOffset\",\n \"inBool must be of type number\"\n );\n this._randomOffsetLegacy = inOffsetScale;\n return this;\n }\n\n /**\n * The sprite gets a randomized flipped X scale. If the scale on that axis was 1, it can\n * become 1 or -1, effectively mirroring the sprite on its horizontal axis\n *\n * @param {Boolean} inBool\n * @returns {EffectSection}\n */\n randomizeMirrorX(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"randomizeMirrorX\",\n \"inBool must be of type boolean\"\n );\n this._randomMirrorX = inBool;\n return this;\n }\n\n /**\n * The sprite gets a randomized flipped Y scale. If the scale on that axis was 1, it can\n * become 1 or -1, effectively mirroring the sprite on its vertical axis\n *\n * @param {Boolean} inBool\n * @returns {EffectSection}\n */\n randomizeMirrorY(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"randomizeMirrorY\",\n \"inBool must be of type boolean\"\n );\n this._randomMirrorY = inBool;\n return this;\n }\n\n /**\n * The sprite gets a flipped X scale. If the scale on that axis was 1, it will become 1 or -1, effectively\n * mirroring the sprite on its horizontal axis\n *\n * @param {Boolean} inBool\n * @returns {EffectSection}\n */\n mirrorX(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"mirrorX\",\n \"inBool must be of type boolean\"\n );\n this._mirrorX = inBool;\n return this;\n }\n\n /**\n * The sprite gets a flipped Y scale. If the scale on that axis was 1, it will become 1 or -1, effectively\n * mirroring the sprite on its vertical axis\n *\n * @param {Boolean} inBool\n * @returns {EffectSection}\n */\n mirrorY(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"mirrorY\",\n \"inBool must be of type boolean\"\n );\n this._mirrorY = inBool;\n return this;\n }\n\n /**\n * Causes the effect to play beneath most tokens\n *\n * @param {Boolean} inBool\n * @returns {EffectSection}\n */\n belowTokens(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"belowTokens\",\n \"inBool must be of type boolean\"\n );\n if (!inBool) return this;\n return this.elevation(0, { absolute: true });\n }\n\n /**\n * Causes the effect to play beneath most tiles\n *\n * @param {Boolean} inBool\n * @returns {EffectSection}\n */\n belowTiles(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"belowTokens\",\n \"inBool must be of type boolean\"\n );\n if (!inBool) return this;\n return this.elevation(-1, { absolute: true });\n }\n\n /**\n * Causes the effect to be played on top of the vision mask\n *\n * @param {Boolean} inBool\n * @returns {EffectSection}\n */\n aboveLighting(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"aboveLighting\",\n \"inBool must be of type boolean\"\n );\n this._aboveLighting = inBool;\n return this;\n }\n\n /**\n * Changes the effect's elevation\n *\n * @param {Number} inElevation\n * @param {Object} inOptions\n * @returns {EffectSection}\n */\n elevation(inElevation, inOptions = {}) {\n if (typeof inElevation !== \"number\")\n throw this.sequence._customError(\n this,\n \"elevation\",\n \"inElevation must be of type number\"\n );\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"elevation\",\n `inOptions must be of type object`\n );\n\n inOptions = foundry.utils.mergeObject(\n {\n elevation: 1,\n absolute: false,\n },\n inOptions\n );\n\n if (typeof inOptions.absolute !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"elevation\",\n \"inOptions.absolute must be of type boolean\"\n );\n this._elevation = {\n elevation: inElevation,\n absolute: inOptions.absolute,\n };\n return this;\n }\n\n /**\n * Sets the zIndex of the effect, potentially displaying it on top of other effects the same elevation\n *\n * @param {Number} inZIndex\n * @returns {EffectSection}\n */\n zIndex(inZIndex) {\n if (!lib.is_real_number(inZIndex))\n throw this.sequence._customError(\n this,\n \"zIndex\",\n \"inZIndex must be of type number\"\n );\n this._zIndex = inZIndex;\n return this;\n }\n\n /**\n * This method only modifies .persist()ed effects and causes them to not immediately end, but stick around for the given duration passed to this method.\n *\n * @param {Number} inExtraDuration\n * @returns {EffectSection}\n */\n extraEndDuration(inExtraDuration) {\n if (!lib.is_real_number(inExtraDuration))\n throw this.sequence._customError(\n this,\n \"extraEndDuration\",\n \"inExtraDuration must be of type number\"\n );\n this._extraEndDuration = inExtraDuration;\n return this;\n }\n\n /**\n * Rotates the sprite\n *\n * @param {Number} inAngle\n * @returns {EffectSection}\n */\n spriteRotation(inAngle) {\n if (!lib.is_real_number(inAngle))\n throw this.sequence._customError(\n this,\n \"spriteRotation\",\n \"inAngle must be of type number\"\n );\n this._spriteRotation = inAngle;\n return this;\n }\n\n /**\n * Causes the effect to not rotate should its container rotate\n *\n * @param {Boolean} [inBool=true] inBool\n * @returns {EffectSection}\n */\n zeroSpriteRotation(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"zeroSpriteRotation\",\n \"inBool must be of type boolean\"\n );\n this._zeroSpriteRotation = inBool;\n return this;\n }\n\n /**\n * If the effect would loop due to its duration or persistence, this causes it not to\n *\n * @param {Boolean} [inBool=true] inBool\n * @returns {EffectSection}\n */\n noLoop(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"noLoop\",\n \"inBool must be of type boolean\"\n );\n this._noLoop = inBool;\n return this;\n }\n\n /**\n * Causes the effect to not show up in the Effect Manager UI - DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING\n *\n * @param inBool\n * @returns {EffectSection}\n */\n private(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"private\",\n \"inBool must be of type boolean\"\n );\n this._private = inBool;\n return this;\n }\n\n /**\n * Causes the effect to be played in screen space instead of world space (where tokens are)\n *\n * @param {Boolean} [inBool=true] inBool\n * @returns {EffectSection}\n */\n screenSpace(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"screenSpace\",\n \"inBool must be of type boolean\"\n );\n this._screenSpace = inBool;\n this._screenSpaceAnchor = this._screenSpaceAnchor ?? { x: 0.5, y: 0.5 };\n return this;\n }\n\n /**\n * Causes the effect to be played above all of the UI elements\n *\n * @param {Boolean} [inBool=true] inBool\n * @returns {EffectSection}\n */\n screenSpaceAboveUI(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"screenSpaceAboveUI\",\n \"inBool must be of type boolean\"\n );\n this._screenSpaceAboveUI = inBool;\n return this;\n }\n\n /**\n * Positions the effect in a screen space position, offset from its .screenSpaceAnchor()\n *\n * @param {Object} inPosition\n * @returns {EffectSection}\n */\n screenSpacePosition(inPosition) {\n inPosition = {\n x: inPosition?.x ?? 0,\n y: inPosition?.y ?? 0,\n };\n if (!lib.is_real_number(inPosition.x))\n throw this.sequence._customError(\n this,\n \"screenSpacePosition\",\n `inPosition.x must be of type number!`\n );\n if (!lib.is_real_number(inPosition.y))\n throw this.sequence._customError(\n this,\n \"screenSpacePosition\",\n `inPosition.y must be of type number!`\n );\n this._screenSpacePosition = inPosition;\n return this;\n }\n\n /**\n * Anchors the sprite according to the given x and y coordinates, or uniformly based on a single number in screen space\n *\n * @param {Number|Object} inAnchor\n * @returns {EffectSection}\n */\n screenSpaceAnchor(inAnchor) {\n if (lib.is_real_number(inAnchor)) {\n inAnchor = {\n x: inAnchor,\n y: inAnchor,\n };\n }\n\n inAnchor = {\n x: inAnchor?.x ?? 0.5,\n y: inAnchor?.y ?? 0.5,\n };\n\n if (!lib.is_real_number(inAnchor.x))\n throw this.sequence._customError(\n this,\n \"screenSpaceAnchor\",\n `inAnchor.x must be of type number!`\n );\n if (!lib.is_real_number(inAnchor.y))\n throw this.sequence._customError(\n this,\n \"screenSpaceAnchor\",\n `inAnchor.y must be of type number!`\n );\n\n this._screenSpaceAnchor = inAnchor;\n return this;\n }\n\n /**\n * Sets up various properties relating to scale of the effect on the screen\n *\n * @param {Object} inOptions\n * @returns {EffectSection}\n */\n screenSpaceScale(inOptions) {\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"screenSpaceScale\",\n `inOptions must be of type object`\n );\n\n inOptions = foundry.utils.mergeObject(\n {\n x: 1.0,\n y: 1.0,\n fitX: false,\n fitY: false,\n ratioX: false,\n ratioY: false,\n },\n inOptions\n );\n\n if (!lib.is_real_number(inOptions.x))\n throw this.sequence._customError(\n this,\n \"screenSpaceScale\",\n `inOptions.x must be of type number!`\n );\n if (!lib.is_real_number(inOptions.y))\n throw this.sequence._customError(\n this,\n \"screenSpaceScale\",\n `inOptions.y must be of type number!`\n );\n if (typeof inOptions.fitX !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"screenSpaceScale\",\n \"inOptions.fitX must be of type boolean\"\n );\n if (typeof inOptions.fitY !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"screenSpaceScale\",\n \"inOptions.fitY must be of type boolean\"\n );\n if (typeof inOptions.ratioX !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"screenSpaceScale\",\n \"inOptions.ratioX must be of type boolean\"\n );\n if (typeof inOptions.ratioY !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"screenSpaceScale\",\n \"inOptions.ratioY must be of type boolean\"\n );\n\n if (inOptions.ratioX && inOptions.ratioY)\n throw this.sequence._customError(\n this,\n \"screenSpaceScale\",\n \"both ratioX and ratioY cannot be true, one axis must fit or be set directly\"\n );\n\n this._screenSpaceScale = inOptions;\n\n return this;\n }\n\n /**\n * This is for adding extra information to an effect, like the origin of the effect in the form of the item's uuid.\n * The method accepts a string or a Document that has an UUID.\n *\n * @param {string|document} inOrigin\n * @returns {Section}\n */\n origin(inOrigin) {\n inOrigin = lib.validate_document(inOrigin);\n if (inOrigin instanceof foundry.abstract.Document) {\n inOrigin = inOrigin?.uuid;\n if (!inOrigin)\n throw this.sequence._customError(\n this,\n \"origin\",\n \"could not find the UUID for the given Document\"\n );\n }\n if (typeof inOrigin !== \"string\")\n throw this.sequence._customError(\n this,\n \"origin\",\n \"inOrigin must be of type string\"\n );\n this._origin = inOrigin;\n return this;\n }\n\n /**\n * Ties the effect to any number of documents in Foundry - if those get deleted, the effect is ended.\n *\n * @param {String|PlaceableObject|foundry.abstract.Document|Array} inDocuments\n * @returns {EffectSection}\n */\n tieToDocuments(inDocuments) {\n if (!Array.isArray(inDocuments)) {\n inDocuments = [inDocuments];\n }\n for (let doc of inDocuments) {\n if (\n typeof doc !== \"string\" &&\n !(doc instanceof PlaceableObject) &&\n !(doc instanceof foundry.abstract.Document)\n ) {\n throw this.sequence._customError(\n this,\n \"tieToDocument\",\n \"inOrigin must be of type string, PlaceableObject, or Document, or an array thereof\"\n );\n }\n if (typeof doc === \"string\") {\n const obj = lib.from_uuid_fast(doc);\n if (!obj)\n throw this.sequence._customError(\n this,\n \"tieToDocument\",\n `could not find document with UUID \"${doc}\"`\n );\n } else {\n doc = lib.validate_document(doc);\n if (doc instanceof foundry.abstract.Document) {\n doc = doc?.uuid;\n if (!doc)\n throw this.sequence._customError(\n this,\n \"tieToDocument\",\n \"could not find the UUID for the given object\"\n );\n }\n }\n this._tiedDocuments.push(doc);\n }\n return this;\n }\n\n /**\n * Masks the effect to the given object or objects. If no object is given, the effect will be masked to the source\n * of the effect.\n *\n * @param {Token/TokenDocument/Tile/TileDocument/Drawing/DrawingDocument/MeasuredTemplate/MeasuredTemplateDocument/Array} inObject\n * @returns {Section}\n */\n mask(inObject) {\n if (!inObject) {\n this._selfMask = true;\n return this;\n }\n\n if (Array.isArray(inObject)) {\n for (let obj of inObject) {\n this.mask(obj);\n }\n return this;\n }\n\n const validatedObject = this._validateLocation(inObject);\n\n const isValidObject =\n validatedObject instanceof TokenDocument ||\n validatedObject instanceof TileDocument ||\n validatedObject instanceof DrawingDocument ||\n validatedObject instanceof MeasuredTemplateDocument;\n if (!isValidObject) {\n throw this.sequence._customError(\n this,\n \"mask\",\n \"A foundry object was provided, but only Tokens, Tiles, Drawings, and MeasuredTemplates may be used to create effect masks\"\n );\n }\n\n this._masks.push(lib.get_object_identifier(validatedObject));\n\n return this;\n }\n\n /**\n * Causes the effect to be visible through walls\n *\n * @param inBool\n * @returns {EffectSection}\n */\n xray(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"xray\",\n \"inBool must be of type boolean\"\n );\n this._xray = inBool;\n return this;\n }\n\n /**\n * Configures the isometric configuration of this effect\n *\n * @param inOptions\n * @returns {EffectSection}\n */\n isometric(inOptions = {}) {\n if (typeof inOptions !== \"object\")\n throw this.sequence._customError(\n this,\n \"isometric\",\n `inOptions must be of type object`\n );\n inOptions = foundry.utils.mergeObject(\n {\n overlay: false,\n },\n inOptions\n );\n if (typeof inOptions?.overlay !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"isometric\",\n \"inOptions.overlay must be of type boolean\"\n );\n this._isometric = inOptions;\n return this;\n }\n\n /**\n * @private\n */\n _expressWarnings() {\n if (this._stretchTo && this._anchor?.x) {\n this.sequence._showWarning(\n this,\n \"stretchTo\",\n \"you have called .stretchTo() and .anchor() - stretchTo will manually set the X axis of the anchor and may not behave like you expect.\",\n true\n );\n }\n if (this._stretchTo && this._scaleToObject) {\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n \"You're trying to stretch towards an object, while scaling to fit another??? Make up your mind!\"\n );\n }\n if (this._stretchTo && this._randomRotation) {\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n \"You're trying to stretch towards an object, while trying to randomly rotate the effect? What?\"\n );\n }\n if (this._stretchTo && this._moveTowards) {\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n \"You're trying to stretch towards an object, while moving towards it? You're insane.\"\n );\n }\n if (\n this._attachTo &&\n this._stretchTo?.attachTo &&\n (this._startTime || this._endTime) &&\n this._isRangedEffect\n ) {\n throw this.sequence._customError(\n this,\n \"stretchTo\",\n \"Dual-attached range-finding effects combined while using any of the time methods is stable - modern web browsers cannot handle it and it may crash them, so this feature has been disabled.\"\n );\n }\n\n const source = this._getSourceObject();\n const target = this._getTargetObject();\n\n if (\n !this._screenSpace &&\n this._persistOptions?.persistTokenPrototype &&\n this._masks.filter((uuid) => uuid !== source).length > 0\n ) {\n this.sequence._showWarning(\n this,\n \"persist\",\n \"You have applied persistTokenPrototype with multiple masks from objects in the scene - these will not be persisted across scenes!\",\n true\n );\n }\n\n if (!source && !target && !this._screenSpace) {\n throw this.sequence._customError(\n this,\n \"play\",\n \"Could not determine where to play the effect!\"\n );\n }\n }\n\n /**\n * @OVERRIDE\n */\n async preRun() {\n if (this._from) {\n this._file = this._file || this._from.object?.texture?.src;\n\n if (this._source === null) {\n this._source = this._validateLocation(this._from.object);\n }\n\n if (this._size === null) {\n const size = canvaslib.get_object_dimensions(this._from.object);\n this._size = {\n width: size?.width ?? canvas.grid.size,\n height: size?.height ?? canvas.grid.size,\n gridUnits: false,\n };\n }\n\n if (\n this._mirrorX === null &&\n (this._from.object.mirrorX ||\n (this._from.object?.tile && this._from.object?.tile.scale.x < 0))\n ) {\n this._mirrorX = true;\n }\n\n if (\n this._mirrorY === null &&\n (this._from.object.mirrorY ||\n (this._from.object?.tile && this._from.object?.tile.scale.y < 0))\n ) {\n this._mirrorY = true;\n }\n\n if (this._angle === null && this._from.object?.rotation) {\n this._angle = -this._from.object.rotation;\n }\n\n this._randomOffset = {\n source: this._randomOffset?.source ?? this._from.options.randomOffset,\n target: this._randomOffset?.target ?? false,\n };\n }\n }\n\n /**\n * @OVERRIDE\n * @returns {Promise}\n */\n async run() {\n if (!lib.user_can_do(\"permissions-effect-create\") || !this._playEffect) {\n if (!lib.user_can_do(\"permissions-effect-create\")) {\n debounce(EffectSection.debounceWarning, 1000);\n }\n return new Promise((resolve) => {\n resolve();\n });\n }\n if (!this._deserializedData) this._expressWarnings();\n const data = await this._sanitizeEffectData();\n if (Hooks.call(\"preCreateSequencerEffect\", data) === false) return;\n let push =\n !(data?.users?.length === 1 && data?.users?.includes(game.userId)) &&\n !this.sequence.localOnly;\n let canvasEffectData = await Sequencer.EffectManager.play(data, push);\n let totalDuration = this._currentWaitTime;\n if (this._persist) {\n totalDuration += await canvasEffectData.promise;\n } else {\n totalDuration += await canvasEffectData.duration;\n }\n await new Promise((resolve) => setTimeout(resolve, totalDuration));\n }\n\n /**\n * @private\n */\n _applyTraits() {\n Object.assign(this.constructor.prototype, traits.files);\n Object.assign(this.constructor.prototype, traits.audio);\n Object.assign(this.constructor.prototype, traits.moves);\n Object.assign(this.constructor.prototype, traits.opacity);\n Object.assign(this.constructor.prototype, traits.rotation);\n Object.assign(this.constructor.prototype, traits.scale);\n Object.assign(this.constructor.prototype, traits.time);\n Object.assign(this.constructor.prototype, traits.users);\n Object.assign(this.constructor.prototype, traits.animation);\n Object.assign(this.constructor.prototype, traits.filter);\n Object.assign(this.constructor.prototype, traits.tint);\n Object.assign(this.constructor.prototype, traits.location);\n Object.assign(this.constructor.prototype, traits.offset);\n Object.assign(this.constructor.prototype, traits.text);\n }\n\n /**\n * @private\n */\n async _initialize() {\n if (this._name) {\n if (!this.sequence.nameOffsetMap) {\n this.sequence.nameOffsetMap = {};\n }\n\n if (!this.sequence.nameOffsetMap[this._name]) {\n const source = this._getSourceObject();\n const target = this._getTargetObject();\n\n if (this._offsetLegacy && !this._offset) {\n this._offset = {\n source: !target ? this._offsetLegacy : false,\n target: !!target ? this._offsetLegacy : false,\n };\n }\n\n if (this._randomOffsetLegacy && !this._randomOffset) {\n this._randomOffset = {\n source: !target ? this._randomOffsetLegacy : false,\n target: !!target ? this._randomOffsetLegacy : false,\n };\n }\n\n this.sequence.nameOffsetMap[this._name] = {\n seed: `${this._name}-${randomID()}`,\n source: source,\n target: target,\n randomOffset: this._randomOffset,\n missed: this._missed,\n offset: this._offset,\n repetitions: this._repetitions,\n twister: {},\n };\n }\n }\n\n if (\n !this._file &&\n !this._from &&\n !this._text &&\n !this._shapes.length &&\n this.sequence.softFail\n ) {\n this._playEffect = false;\n return;\n }\n\n let fileData = this._file\n ? await this._determineFile(this._file)\n : {\n file: this._file,\n forcedIndex: false,\n customRange: false,\n };\n\n this._isRangedEffect = fileData?.file?.rangeFind;\n\n if (fileData.customRange || fileData.file?.dbPath) return;\n\n let exists = false;\n try {\n exists = await SequencerFileCache.srcExists(fileData.file);\n } catch (err) {}\n\n if (!exists) {\n if (this.sequence.softFail) {\n this._playEffect = false;\n return;\n }\n throw this.sequence._customError(\n this,\n \"Play\",\n `Could not find file:
${fileData.file}`\n );\n }\n }\n\n /**\n * @private\n */\n _getSourceObject() {\n if (!this._source || typeof this._source !== \"object\") return this._source;\n if (this._source?.cachedLocation) {\n return canvaslib.get_object_canvas_data(this._source);\n }\n return (\n lib.get_object_identifier(this._source) ??\n canvaslib.get_object_canvas_data(this._source)\n );\n }\n\n /**\n * @private\n */\n _getTargetObject() {\n if (!this._target?.target) return this._target;\n if (typeof this._target.target !== \"object\") return this._target.target;\n if (this._target?.target?.cachedLocation) {\n return canvaslib.get_object_canvas_data(this._target.target, true);\n }\n return (\n lib.get_object_identifier(this._target.target) ??\n canvaslib.get_object_canvas_data(this._target.target, true)\n );\n }\n\n /**\n * @private\n */\n async _sanitizeEffectData() {\n if (this._deserializedData) {\n this._deserializedData.creationTimestamp = +new Date();\n this._deserializedData.remote = true;\n return this._deserializedData;\n }\n\n const { file, forcedIndex, customRange } =\n this._file && this._playEffect\n ? await this._determineFile(this._file)\n : {\n file: this._file,\n forcedIndex: false,\n customRange: false,\n };\n\n const source = this._getSourceObject();\n const target = this._getTargetObject();\n\n if (this._offsetLegacy) {\n this._offset = {\n source:\n !target && this._offset?.source\n ? this._offsetLegacy\n : this._offset?.source,\n target:\n !!target && this._offset?.target\n ? this._offsetLegacy\n : this._offset?.target,\n };\n }\n\n if (this._randomOffsetLegacy) {\n this._randomOffset = {\n source:\n !target && this._randomOffset?.source\n ? this._randomOffsetLegacy\n : this._randomOffset?.source,\n target:\n !!target && this._randomOffset?.target\n ? this._randomOffsetLegacy\n : this._randomOffset?.target,\n };\n }\n\n if (this._selfMask) {\n this._masks.push(\n lib.get_object_identifier(this._source) ??\n canvaslib.get_object_canvas_data(this._source)\n );\n }\n\n let sceneId = game.user.viewedScene;\n if (lib.is_UUID(source)) {\n const potentialSceneId = source.split(\".\")[1];\n if (game.scenes.get(potentialSceneId)) {\n sceneId = potentialSceneId;\n }\n } else if (lib.is_UUID(target)) {\n const potentialSceneId = target.split(\".\")[1];\n if (game.scenes.get(potentialSceneId)) {\n sceneId = potentialSceneId;\n }\n }\n\n let data = foundry.utils.duplicate({\n /**\n * Core properties\n */\n _id: randomID(),\n flagVersion: flagManager.latestFlagVersion,\n sequenceId: this.sequence.id,\n creationTimestamp: +new Date(),\n sceneId,\n creatorUserId: game.userId,\n moduleName: this.sequence.moduleName,\n users: this._users ? Array.from(this._users) : false,\n name: this._name,\n origin: this._origin,\n index: this.sequence.effectIndex,\n repetition: this._currentRepetition,\n private: this._private,\n temporary: this._temporaryEffect,\n tiedDocuments: Array.from(new Set(this._tiedDocuments)),\n\n /**\n * Source/target properties\n */\n source: source,\n target: target,\n rotateTowards: this._rotateTowards,\n stretchTo: this._stretchTo\n ? {\n attachTo: this._stretchTo.attachTo,\n onlyX: this._stretchTo.onlyX,\n }\n : false,\n moveTowards: this._moveTowards\n ? {\n ease: this._moveTowards.ease,\n rotate: this._moveTowards.rotate,\n }\n : false,\n\n attachTo: this._attachTo,\n missed: this._missed,\n\n /**\n * Sprite properties\n */\n file: file?.dbPath ?? file,\n customRange,\n forcedIndex,\n text: this._text,\n tilingTexture: this._tilingTexture,\n masks: Array.from(new Set(this._masks)),\n shapes: this._shapes,\n volume: this._volume,\n isometric: this._isometric,\n\n // Transforms\n scale: this._getCalculatedScale(\"scale\"),\n spriteScale: this._getCalculatedScale(\"spriteScale\"),\n angle: this._angle,\n size: this._size,\n offset: this._offset,\n anchor: this._anchor,\n spriteOffset: this._spriteOffset,\n spriteAnchor: this._spriteAnchor,\n template: this._template,\n zeroSpriteRotation: this._zeroSpriteRotation,\n randomOffset: this._randomOffset,\n randomRotation: this._randomRotation,\n scaleToObject: this._scaleToObject,\n elevation: this._elevation,\n aboveLighting: this._aboveLighting,\n xray: this._xray,\n\n // Appearance\n zIndex: this._zIndex,\n opacity: lib.is_real_number(this._opacity) ? this._opacity : 1.0,\n filters: this._filters,\n noLoop: this._noLoop,\n spriteRotation: this._spriteRotation,\n tint: this._tint?.decimal,\n flipX: this._mirrorX || (this._randomMirrorX && Math.random() < 0.5),\n flipY: this._mirrorY || (this._randomMirrorY && Math.random() < 0.5),\n\n /**\n * Time properties\n */\n duration: this._duration,\n persist: this._persist,\n persistOptions: this._persistOptions,\n playbackRate: this._playbackRate,\n extraEndDuration: this._extraEndDuration,\n time:\n this._startTime || this._endTime\n ? {\n start: lib.is_real_number(this._startTime)\n ? {\n value: this._startTime,\n isPerc: this._startPerc,\n }\n : false,\n end: lib.is_real_number(this._endTime)\n ? {\n value: this._endTime,\n isPerc: this._endPerc,\n }\n : false,\n isRange: this._isRange,\n }\n : false,\n\n /**\n * Animation properties\n */\n moves: this._moveTowards,\n moveSpeed: this._moveSpeed,\n fadeIn: this._fadeIn,\n fadeOut: this._fadeOut,\n scaleIn: this._scaleIn,\n scaleOut: this._scaleOut,\n rotateIn: this._rotateIn,\n rotateOut: this._rotateOut,\n fadeInAudio: this._fadeInAudio,\n fadeOutAudio: this._fadeOutAudio,\n animations: this._animations,\n\n /**\n * Screenspace properties\n */\n screenSpace: this._screenSpace,\n screenSpaceAboveUI: this._screenSpaceAboveUI,\n screenSpaceAnchor: this._screenSpaceAnchor,\n screenSpacePosition: this._screenSpacePosition,\n screenSpaceScale: this._screenSpaceScale,\n\n nameOffsetMap: this.sequence.nameOffsetMap,\n });\n\n for (let override of this._overrides) {\n data = await override(this, data);\n }\n\n if (\n (typeof data.file !== \"string\" || data.file === \"\") &&\n !data.text &&\n !data.shapes &&\n !data.customRange\n ) {\n throw this.sequence._customError(\n this,\n \"file\",\n \"an effect must have a file, text, or have a shape!\"\n );\n }\n\n // TODO: Revisit this at some point?\n // data = Object.fromEntries(Object.entries(data).filter(entry => entry[1] !== null && entry[1] !== false));\n\n return data;\n }\n\n async _serialize() {\n const data = await super._serialize();\n await this.preRun();\n const sectionData = await this._sanitizeEffectData();\n return {\n ...data,\n type: \"effect\",\n sectionData,\n };\n }\n\n async _deserialize(data) {\n this._deserializedData = data.sectionData;\n return super._deserialize(data);\n }\n\n /**\n * @private\n */\n _getCalculatedScale(type) {\n const min = this[\"_\" + type + \"Min\"];\n const max = this[\"_\" + type + \"Max\"];\n\n let scale = min;\n if (lib.is_real_number(min)) {\n if (max && lib.is_real_number(max)) {\n scale = lib.random_float_between(min, max);\n }\n scale = {\n x: scale,\n y: scale,\n };\n }\n return {\n x: scale?.x ?? 1.0,\n y: scale?.y ?? 1.0,\n };\n }\n}\n","import * as lib from \"../lib/lib.js\";\nimport SequencerAudioHelper from \"../modules/sequencer-audio-helper.js\";\nimport Section from \"./section.js\";\nimport traits from \"./traits/_traits.js\";\nimport { SequencerFileBase } from \"../modules/sequencer-file.js\";\n\nclass SoundSection extends Section {\n constructor(inSequence, inFile = \"\") {\n super(inSequence);\n this._file = inFile;\n this._volume = 0.8;\n this._overrides = [];\n }\n\n static niceName = \"Sound\";\n\n /**\n * Adds a function that will run at the end of the sound serialization step, but before it is played. Allows direct\n * modifications of sound's data.\n *\n * @param {function} inFunc\n * @returns {SoundSection}\n */\n addOverride(inFunc) {\n if (!lib.is_function(inFunc))\n throw this.sequence._customError(\n this,\n \"addOverride\",\n \"The given function needs to be an actual function.\"\n );\n this._overrides.push(inFunc);\n return this;\n }\n\n /**\n * @private\n */\n _applyTraits() {\n Object.assign(this.constructor.prototype, traits.files);\n Object.assign(this.constructor.prototype, traits.audio);\n Object.assign(this.constructor.prototype, traits.time);\n Object.assign(this.constructor.prototype, traits.users);\n }\n\n /**\n * @OVERRIDE\n * @returns {Promise}\n */\n async run() {\n const playData = await this._sanitizeSoundData();\n\n if (!playData.play && this.sequence.softFail) {\n return new Promise((reject) => {\n reject();\n });\n }\n\n if (!playData?.play) {\n this.sequence._customError(\n this,\n \"Play\",\n `File not found: ${playData.src}`\n );\n return new Promise((reject) => reject());\n }\n\n if (Hooks.call(\"preCreateSequencerSound\", playData) === false) return;\n\n let push =\n !(\n playData?.users?.length === 1 && playData?.users?.includes(game.userId)\n ) && !this.sequence.localOnly;\n\n SequencerAudioHelper.play(playData, push);\n\n await new Promise((resolve) =>\n setTimeout(resolve, this._currentWaitTime + playData.duration)\n );\n }\n\n /**\n * @returns {Promise}\n * @private\n */\n async _sanitizeSoundData() {\n if (this._deserializedData) {\n return this._deserializedData;\n }\n\n if (!this._file) {\n return {\n play: false,\n src: false,\n };\n }\n\n let { file, forcedIndex } = await this._determineFile(this._file);\n\n if (!file) {\n return {\n play: false,\n src: false,\n };\n }\n\n if (file instanceof SequencerFileBase) {\n file.forcedIndex = forcedIndex;\n if (file.timeRange) {\n [this._startTime, this._endTime] = file.timeRange;\n this._isRange = true;\n }\n file = file.getFile();\n }\n\n let soundFile = await AudioHelper.preloadSound(file);\n if (!soundFile || soundFile.failed) {\n return {\n play: false,\n src: this._file,\n };\n }\n let duration = soundFile.duration * 1000;\n\n let startTime =\n (this._startTime\n ? !this._startPerc\n ? this._startTime\n : this._startTime * duration\n : 0) / 1000;\n\n if (this._endTime) {\n duration = !this._endPerc\n ? Number(\n this._isRange\n ? this._endTime - this._startTime\n : duration - this._endTime\n )\n : this._endTime * duration;\n }\n\n let data = {\n id: randomID(),\n play: true,\n src: file,\n loop: this._duration > duration,\n volume: this._volume,\n fadeIn: this._fadeInAudio,\n fadeOut: this._fadeOutAudio,\n startTime: startTime,\n duration: this._duration || duration,\n sceneId: game.user.viewedScene,\n users: this._users ? Array.from(this._users) : null,\n };\n\n for (let override of this._overrides) {\n data = await override(this, data);\n }\n\n if (typeof data.src !== \"string\" || data.src === \"\") {\n throw this.sequence._customError(\n this,\n \"file\",\n \"a sound must have a src of type string!\"\n );\n }\n\n return data;\n }\n\n async _serialize() {\n const data = await super._serialize();\n const sectionData = await this._sanitizeSoundData();\n return {\n ...data,\n type: \"sound\",\n sectionData,\n };\n }\n\n async _deserialize(data) {\n this._deserializedData = data.sectionData;\n return super._deserialize(data);\n }\n}\n\nexport default SoundSection;\n","import * as lib from \"../lib/lib.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport Section from \"./section.js\";\nimport traits from \"./traits/_traits.js\";\nimport { sequencerSocket, SOCKET_HANDLERS } from \"../sockets.js\";\n\nclass AnimationSection extends Section {\n constructor(inSequence, inTarget) {\n super(inSequence);\n this._teleportTo = false;\n this._originObject = false;\n this._moveSpeed = 23;\n this._offset = { x: 0, y: 0 };\n this._closestSquare = false;\n this._snapToGrid = false;\n this._hide = undefined;\n if (inTarget) this.on(inTarget);\n }\n\n static niceName = \"Animation\";\n\n /**\n * Sets the target object to be animated\n *\n * @param {object|string} inTarget\n * @returns {AnimationSection}\n */\n on(inTarget) {\n inTarget = this._validateLocation(inTarget);\n if (!inTarget)\n throw this.sequence._customError(\n this,\n \"on\",\n \"could not find position of given object\"\n );\n this._originObject = this._validateLocation(inTarget);\n return this;\n }\n\n /**\n * Sets the location to teleport the target object to\n *\n * @param {object|string} inTarget\n * @param {object} options\n * @returns {AnimationSection}\n */\n teleportTo(inTarget, options = {}) {\n options = foundry.utils.mergeObject(\n {\n delay: 0,\n relativeToCenter: false,\n },\n options\n );\n if (!lib.is_real_number(options.delay))\n throw this.sequence._customError(\n this,\n \"teleportTo\",\n \"options.delay must be of type number\"\n );\n inTarget = this._validateLocation(inTarget);\n if (!inTarget)\n throw this.sequence._customError(\n this,\n \"teleportTo\",\n \"could not find position of given object\"\n );\n options.target = this._validateLocation(inTarget);\n this._teleportTo = options;\n return this;\n }\n\n /**\n * Sets the location to rotate the object to\n *\n * @param {object|string} inLocation\n * @param {object} options\n * @returns this\n */\n rotateTowards(inLocation, options = {}) {\n options = foundry.utils.mergeObject(\n {\n duration: 0,\n ease: \"linear\",\n delay: 0,\n rotationOffset: 0,\n towardsCenter: true,\n cacheLocation: false,\n },\n options\n );\n if (!lib.is_real_number(options.duration))\n throw this.sequence._customError(\n this,\n \"rotateTowards\",\n \"options.duration must be of type number\"\n );\n if (typeof options.ease !== \"string\")\n throw this.sequence._customError(\n this,\n \"rotateTowards\",\n \"options.ease must be of type string\"\n );\n if (!lib.is_real_number(options.delay))\n throw this.sequence._customError(\n this,\n \"rotateTowards\",\n \"options.delay must be of type number\"\n );\n if (!lib.is_real_number(options.rotationOffset))\n throw this.sequence._customError(\n this,\n \"rotateTowards\",\n \"options.rotationOffset must be of type number\"\n );\n if (typeof options.towardsCenter !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"rotateTowards\",\n \"options.towardsCenter must be of type boolean\"\n );\n if (typeof options.cacheLocation !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"rotateTowards\",\n \"options.cacheLocation must be of type boolean\"\n );\n options.target = this._validateLocation(inLocation);\n if (!options.target)\n throw this.sequence._customError(\n this,\n \"rotateTowards\",\n \"could not find position of given object\"\n );\n options.target = options.cacheLocation\n ? canvaslib.get_object_position(options.target, { measure: true })\n : options.target;\n this._rotateTowards = options;\n return this;\n }\n\n /**\n * Causes the movement or teleportation to be offset in the X and/or Y axis\n *\n * @param {object} inOffset\n * @returns {AnimationSection}\n */\n offset(inOffset) {\n inOffset = foundry.utils.mergeObject({ x: 0, y: 0 }, inOffset);\n this._offset = this._validateLocation(inOffset);\n return this;\n }\n\n /**\n * Causes the movement or teleportation to pick the closest non-intersecting square, if the target is a token or tile\n *\n * @param {boolean} inBool\n * @returns {AnimationSection}\n */\n closestSquare(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"closestSquare\",\n \"inBool must be of type boolean\"\n );\n this._closestSquare = inBool;\n return this;\n }\n\n /**\n * Causes the final location to be snapped to the grid\n *\n * @param {boolean} inBool\n * @returns {AnimationSection}\n */\n snapToGrid(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"snapToGrid\",\n \"inBool must be of type boolean\"\n );\n this._snapToGrid = inBool;\n return this;\n }\n\n /**\n * Causes the object to become hidden\n *\n * @param {boolean} inBool\n * @returns {AnimationSection}\n */\n hide(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"hide\",\n \"inBool must be of type boolean\"\n );\n this._hide = inBool;\n return this;\n }\n\n /**\n * Causes the object to become visible\n *\n * @param {boolean} inBool\n * @returns {AnimationSection}\n */\n show(inBool = true) {\n if (typeof inBool !== \"boolean\")\n throw this.sequence._customError(\n this,\n \"show\",\n \"inBool must be of type boolean\"\n );\n this._hide = !inBool;\n return this;\n }\n\n /**\n * @private\n */\n async run() {\n return this._runAnimate();\n }\n\n /**\n * @private\n */\n _applyTraits() {\n Object.assign(this.constructor.prototype, traits.moves);\n Object.assign(this.constructor.prototype, traits.opacity);\n Object.assign(this.constructor.prototype, traits.rotation);\n Object.assign(this.constructor.prototype, traits.audio);\n Object.assign(this.constructor.prototype, traits.tint);\n }\n\n /**\n * @private\n */\n async _updateObject(obj, updates, animate = false, animation = {}) {\n const uuid = obj?.uuid ?? obj?.document?.uuid;\n await sequencerSocket.executeAsGM(\n SOCKET_HANDLERS.UPDATE_DOCUMENT,\n uuid,\n updates,\n { animate, animation }\n );\n }\n\n /**\n * @private\n */\n async _execute() {\n if (!(await this._shouldPlay())) return;\n let self = this;\n this._basicDelay = lib.random_float_between(this._delayMin, this._delayMax);\n return new Promise(async (resolve) => {\n setTimeout(async () => {\n if (this._shouldAsync) {\n await self.run();\n } else {\n self.run();\n }\n resolve();\n }, this._basicDelay);\n });\n }\n\n /**\n * @private\n */\n _getClosestSquare(origin, target) {\n let originLoc = canvaslib.get_object_position(origin, { exact: true });\n let targetLoc = canvaslib.get_object_position(target, { exact: true });\n\n let originDimensions = canvaslib.get_object_dimensions(origin);\n let targetDimensions = canvaslib.get_object_dimensions(target);\n\n let originBottom = Math.max(\n originDimensions.width - canvas.grid.size,\n canvas.grid.size\n );\n let originRight = Math.max(\n originDimensions.height - canvas.grid.size,\n canvas.grid.size\n );\n\n let ray = new Ray(originLoc, targetLoc);\n\n let dx = ray.dx;\n let dy = ray.dy;\n\n if (dx > 0 && Math.abs(dx) > originRight) {\n dx -= originDimensions.width;\n } else if (dx < 0 && Math.abs(dx) > targetDimensions.width) {\n dx += targetDimensions.height;\n } else {\n dx = 0;\n }\n\n if (dy > 0 && Math.abs(dy) > originBottom) {\n dy -= originDimensions.height;\n } else if (dy < 0 && Math.abs(dy) > targetDimensions.height) {\n dy += targetDimensions.height;\n } else {\n dy = 0;\n }\n\n return {\n x: originLoc.x + dx,\n y: originLoc.y + dy,\n };\n }\n\n /**\n * @private\n */\n _snapLocationToGrid(inLocation) {\n return canvas.grid.getSnappedPosition(inLocation.x, inLocation.y);\n }\n\n /**\n * This needs a rewrite, jeesus.\n */\n async _runAnimate() {\n let animData = {\n attributes: [],\n maxFPS: 1000 / game.settings.get(\"core\", \"maxFPS\"),\n lastTimespan: performance.now(),\n totalDt: 0,\n };\n\n let overallDuration = this._duration ? this._duration : 0;\n\n if (this._rotateTowards) {\n let offset =\n (this._angle ? this._angle : 0) + this._rotateTowards.rotationOffset;\n\n let targetLoc =\n this._moveTowards?.target ||\n this._teleportTo?.target ||\n this._originObject;\n\n targetLoc = this._closestSquare\n ? this._getClosestSquare(this._originObject, targetLoc)\n : canvaslib.get_object_position(targetLoc, { exact: true });\n\n targetLoc.x += this._offset.x;\n targetLoc.y += this._offset.y;\n\n if (this._snapToGrid) {\n targetLoc = this._snapLocationToGrid(targetLoc);\n }\n\n if (this._originObject instanceof TokenDocument) {\n setTimeout(async () => {\n let target =\n this._rotateTowards.target?.object ?? this._rotateTowards.target;\n if (this._rotateTowards.towardsCenter) {\n target = target?.center ?? target;\n }\n let ray = new Ray(targetLoc, target);\n let angle = (ray.angle * 180) / Math.PI - 90;\n angle += offset;\n await this._updateObject(\n this._originObject,\n { rotation: angle },\n this._rotateTowards.duration > 0,\n {\n duration: this._rotateTowards.duration,\n easing: this._rotateTowards.ease,\n }\n );\n }, this._rotateTowards.delay ?? 0);\n } else {\n animData.attributes.push({\n name: \"rotationTowards\",\n offset: offset,\n origin: this._originObject,\n originLocation: targetLoc,\n target:\n this._rotateTowards.target?.object ?? this._rotateTowards.target,\n towardsCenter: this._rotateTowards.towardsCenter,\n from: false,\n to: false,\n progress: 0,\n done: false,\n duration: this._rotateTowards.duration,\n durationDone: 0,\n delay: this._rotateTowards.delay,\n ease: this._rotateTowards.ease,\n });\n }\n\n let rotateDuration =\n this._rotateTowards.duration + this._rotateTowards.delay;\n\n overallDuration =\n overallDuration > rotateDuration ? overallDuration : rotateDuration;\n }\n\n if (this._fadeIn) {\n let to = lib.is_real_number(this._opacity) ? this._opacity : 1.0;\n\n if (this._originObject instanceof TokenDocument) {\n setTimeout(async () => {\n await this._updateObject(this._originObject, { alpha: to }, true, {\n duration: this._fadeIn.duration,\n easing: this._fadeIn.ease,\n });\n }, this._fadeIn.delay ?? 0);\n } else {\n animData.attributes.push({\n name: \"alpha\",\n from: 0.0,\n to: to,\n progress: 0,\n done: false,\n duration: this._fadeIn.duration,\n durationDone: 0,\n delay: this._fadeIn.delay,\n ease: this._fadeIn.ease,\n });\n }\n\n let fadeDuration = this._fadeIn.duration + this._fadeIn.delay;\n\n overallDuration =\n overallDuration > fadeDuration ? overallDuration : fadeDuration;\n }\n\n if (this._fadeInAudio && this._originObject?.video?.volume !== undefined) {\n let to = lib.is_real_number(this._volume) ? this._volume : 1.0;\n\n animData.attributes.push({\n name: \"video.volume\",\n from: 0.0,\n to: to,\n progress: 0,\n done: false,\n duration: this._fadeInAudio.duration,\n durationDone: 0,\n delay: this._fadeInAudio.delay,\n ease: this._fadeInAudio.ease,\n });\n\n let fadeDuration = this._fadeInAudio.duration + this._fadeInAudio.delay;\n\n overallDuration =\n overallDuration > fadeDuration ? overallDuration : fadeDuration;\n }\n\n if (this._rotateIn) {\n let from = this._angle ? this._angle : this._originObject.rotation;\n let to = this._rotateIn.value;\n\n if (Math.abs(from - to) > 180) {\n if (to < 0) {\n to += 360;\n } else if (from > to) {\n from -= 360;\n }\n }\n\n if (this._originObject instanceof TokenDocument) {\n setTimeout(async () => {\n if (this._originObject.rotation !== from) {\n await this._updateObject(\n this._originObject,\n { rotation: from },\n false\n );\n }\n await this._updateObject(this._originObject, { rotation: to }, true, {\n duration: this._rotateIn.duration,\n easing: this._rotateIn.ease,\n });\n }, this._rotateIn.delay ?? 0);\n } else {\n animData.attributes.push({\n name: \"rotation\",\n from: from,\n to: to,\n progress: 0,\n done: false,\n duration: this._rotateIn.duration,\n durationDone: 0,\n delay: this._rotateIn.delay,\n ease: this._rotateIn.ease,\n });\n }\n\n let rotateDuration = this._rotateIn.duration + this._rotateIn.delay;\n\n overallDuration =\n overallDuration > rotateDuration ? overallDuration : rotateDuration;\n }\n\n if (this._moveTowards) {\n let originLocation = canvaslib.get_object_position(this._originObject, {\n exact: true,\n });\n let targetLocation = this._closestSquare\n ? this._getClosestSquare(this._originObject, this._moveTowards.target)\n : canvaslib.get_object_position(this._moveTowards.target, {\n exact: true,\n });\n\n targetLocation.x += this._offset.x;\n targetLocation.y += this._offset.y;\n targetLocation.elevation =\n targetLocation?.elevation ?? this._originObject?.elevation;\n\n if (this._moveTowards.relativeToCenter) {\n const dimensions = canvaslib.get_object_dimensions(this._originObject);\n targetLocation.x -= dimensions.width / 2;\n targetLocation.y -= dimensions.height / 2;\n if (this._snapToGrid) {\n targetLocation.x -= 0.01;\n targetLocation.y -= 0.01;\n }\n }\n\n if (this._snapToGrid) {\n targetLocation = this._snapLocationToGrid(targetLocation);\n }\n\n let originalDx = targetLocation.x - originLocation.x;\n let originalDy = targetLocation.y - originLocation.y;\n let originalDistance = Math.sqrt(\n originalDx * originalDx + originalDy * originalDy\n );\n\n let duration = this._duration\n ? this._duration\n : (originalDistance / this._moveSpeed) * animData.maxFPS;\n\n let moveDuration = duration + this._moveTowards.delay;\n\n overallDuration =\n overallDuration > moveDuration ? overallDuration : moveDuration;\n\n if (this._originObject instanceof TokenDocument) {\n setTimeout(async () => {\n await this._updateObject(this._originObject, targetLocation, true, {\n movementSpeed: this._moveSpeed,\n duration,\n easing: this._moveTowards.ease,\n });\n }, this._moveTowards.delay ?? 0);\n } else {\n if (!(duration === 0 || originalDistance === 0)) {\n animData.attributes.push({\n name: \"position\",\n origin: originLocation,\n target: targetLocation,\n originalDistance: originalDistance,\n currentDistance: 0,\n progress: 0,\n speed: 0,\n duration: duration,\n done: false,\n ease: this._moveTowards.ease,\n delay: this._moveTowards.delay,\n });\n }\n }\n }\n\n if (this._fadeOut) {\n let from = lib.is_real_number(this._opacity)\n ? this._opacity\n : this._originObject.alpha ?? 1.0;\n\n if (this._originObject instanceof TokenDocument) {\n setTimeout(async () => {\n await this._updateObject(this._originObject, { alpha: 0 }, true, {\n duration: this._fadeOut.duration,\n easing: this._fadeOut.ease,\n });\n }, this._fadeOut.delay ?? 0);\n } else {\n animData.attributes.push({\n name: \"alpha\",\n from: from,\n to: 0.0,\n progress: 0,\n done: false,\n duration: this._fadeOut.duration,\n durationDone: 0,\n delay: overallDuration - this._fadeOut.duration,\n ease: this._fadeOut.ease,\n });\n }\n\n let fadeOutDuration = this._fadeOut.duration + this._fadeOut.delay;\n\n overallDuration =\n overallDuration > fadeOutDuration ? overallDuration : fadeOutDuration;\n }\n\n if (this._fadeOutAudio && this._originObject?.video?.volume !== undefined) {\n let from = lib.is_real_number(this._volume)\n ? this._volume\n : this._originObject.video.volume;\n\n animData.attributes.push({\n name: \"video.volume\",\n from: from,\n to: 0.0,\n progress: 0,\n done: false,\n duration: this._fadeOutAudio.duration,\n durationDone: 0,\n delay: overallDuration - this._fadeOutAudio.duration,\n ease: this._fadeOutAudio.ease,\n });\n\n let fadeOutAudioDuration =\n this._fadeOutAudio.duration + this._fadeOutAudio.delay;\n\n overallDuration =\n overallDuration > fadeOutAudioDuration\n ? overallDuration\n : fadeOutAudioDuration;\n }\n\n if (this._rotateOut) {\n let from = this._rotateOut.value;\n let to = this._angle ? this._angle : this._originObject.rotation;\n\n if (this._rotateIn) from += this._rotateIn.value;\n\n if (Math.abs(from - to) > 180) {\n if (to < 0) {\n to += 360;\n } else if (from > to) {\n from -= 360;\n }\n }\n\n if (this._originObject instanceof TokenDocument) {\n setTimeout(async () => {\n if (this._originObject.rotation !== from) {\n await this._updateObject(\n this._originObject,\n { rotation: from },\n false\n );\n }\n await this._updateObject(this._originObject, { rotation: to }, true, {\n duration: this._rotateOut.duration,\n easing: this._rotateOut.ease,\n });\n }, this._rotateOut.delay ?? 0);\n } else {\n animData.attributes.push({\n name: \"rotation\",\n from: from,\n to: to,\n progress: 0,\n done: false,\n duration: this._rotateOut.duration,\n durationDone: 0,\n delay: overallDuration - this._rotateOut.duration,\n ease: this._rotateOut.ease,\n });\n }\n\n let rotateOutDuration = this._rotateOut.duration + this._rotateOut.delay;\n\n overallDuration =\n overallDuration > rotateOutDuration\n ? overallDuration\n : rotateOutDuration;\n }\n\n if (this._teleportTo) {\n setTimeout(async () => {\n let targetLocation = this._closestSquare\n ? this._getClosestSquare(this._originObject, this._teleportTo.target)\n : canvaslib.get_object_position(this._teleportTo.target, {\n exact: true,\n });\n targetLocation.x += this._offset.x;\n targetLocation.y += this._offset.y;\n targetLocation.elevation =\n targetLocation?.elevation ?? this._originObject?.elevation;\n const dimensions = canvaslib.get_object_dimensions(this._originObject);\n if (this._teleportTo.relativeToCenter) {\n targetLocation.x -= dimensions.width / 2;\n targetLocation.y -= dimensions.height / 2;\n if (this._snapToGrid) {\n targetLocation.x -= 0.01;\n targetLocation.y -= 0.01;\n }\n }\n if (this._snapToGrid) {\n targetLocation.x -= dimensions.width / 2;\n targetLocation.y -= dimensions.height / 2;\n targetLocation = this._snapLocationToGrid(targetLocation);\n }\n await this._updateObject(this._originObject, targetLocation, false);\n }, this._teleportTo.delay);\n if (overallDuration <= this._teleportTo.delay) {\n this._waitUntilFinished = true;\n }\n overallDuration =\n overallDuration > this._teleportTo.delay\n ? overallDuration\n : this._teleportTo.delay;\n }\n\n let updateAttributes = {};\n if (\n lib.is_real_number(this._angle) &&\n !this._rotateIn &&\n !this._rotateOut\n ) {\n updateAttributes[\"rotation\"] = this._angle;\n }\n\n if (lib.is_real_number(this._opacity) && !this._fadeIn && !this._fadeOut) {\n updateAttributes[\"alpha\"] = this._opacity;\n }\n\n if (\n lib.is_real_number(this._volume) &&\n !this._fadeInAudio &&\n !this._fadeOutAudio &&\n this._originObject?.video?.volume !== undefined\n ) {\n updateAttributes[\"video.volume\"] = this._volume;\n }\n\n if (this._tint) {\n updateAttributes[\"tint\"] = this._tint.hexadecimal;\n }\n\n if (this._hide !== undefined) {\n updateAttributes[\"hidden\"] = this._hide;\n }\n\n if (Object.keys(updateAttributes).length) {\n await lib.wait(1);\n await this._updateObject(this._originObject, updateAttributes);\n await lib.wait(1);\n }\n\n return new Promise(async (resolve) => {\n this._animate(animData, resolve);\n setTimeout(\n resolve,\n Math.max(0, overallDuration + this._currentWaitTime + animData.maxFPS)\n );\n });\n }\n\n /**\n * @private\n */\n async _animate(animData, resolve, timespan) {\n // If it's not the first tick\n if (timespan) {\n let animatedAttributes = {};\n\n let dt = timespan - animData.lastTimespan;\n\n // Limit to set FPS\n if (dt >= animData.maxFPS) {\n animData.totalDt += dt;\n\n for (let attribute of animData.attributes) {\n if (attribute.done) continue;\n\n if (animData.totalDt < attribute.delay) continue;\n\n if (attribute.name === \"position\") {\n attribute.speed =\n attribute.originalDistance / (attribute.duration / dt);\n\n attribute.currentDistance += attribute.speed;\n\n attribute.progress =\n attribute.currentDistance / attribute.originalDistance;\n\n let x = lib.interpolate(\n attribute.origin.x,\n attribute.target.x,\n attribute.progress,\n attribute.ease\n );\n let y = lib.interpolate(\n attribute.origin.y,\n attribute.target.y,\n attribute.progress,\n attribute.ease\n );\n\n if (attribute.currentDistance >= attribute.originalDistance) {\n x = attribute.target.x;\n y = attribute.target.y;\n attribute.done = true;\n }\n\n animatedAttributes[\"x\"] = x;\n animatedAttributes[\"y\"] = y;\n } else {\n if (\n attribute.name === \"rotationTowards\" &&\n !attribute.from &&\n !attribute.to\n ) {\n let target = attribute.target;\n if (this._rotateTowards.towardsCenter)\n target = target?.center ?? target;\n let ray = new Ray(attribute.originLocation, target);\n let angle = (ray.angle * 180) / Math.PI - 90;\n angle += attribute.offset;\n attribute.from = attribute.origin.rotation;\n attribute.to = angle;\n if (Math.abs(attribute.from - attribute.to) > 180) {\n if (attribute.to < 0) {\n attribute.to += 360;\n } else if (attribute.from > attribute.to) {\n attribute.from -= 360;\n }\n }\n attribute.name = \"rotation\";\n }\n\n attribute.durationDone += dt;\n\n attribute.progress = attribute.durationDone / attribute.duration;\n\n let val = lib.interpolate(\n attribute.from,\n attribute.to,\n attribute.progress,\n attribute.ease\n );\n\n if (attribute.progress >= 1.0) {\n val = attribute.to;\n attribute.done = true;\n }\n\n animatedAttributes[attribute.name] = val;\n }\n }\n\n if (Object.keys(animatedAttributes).length > 0) {\n await this._updateObject(this._originObject, animatedAttributes);\n }\n\n animData.attributes = animData.attributes.filter((a) => !a.done);\n\n if (animData.attributes.length === 0) return;\n\n animData.lastTimespan = timespan;\n }\n }\n\n let self = this;\n requestAnimationFrame(function (timespan) {\n self._animate(animData, resolve, timespan);\n });\n }\n}\n\nexport default AnimationSection;\n","import Section from \"./section.js\";\nimport traits from \"./traits/_traits.js\";\nimport * as lib from \"../lib/lib.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport SequencerFoundryReplicator from \"../modules/sequencer-foundry-replicator.js\";\n\nexport default class ScrollingTextSection extends Section {\n constructor(inSequence, target, text, textOptions) {\n super(inSequence);\n this._deserializedData = null;\n this._source = null;\n this._text = \"\";\n this._duration = 2000;\n this._distance = null;\n this._jitter = 0;\n this._anchor = null;\n this._direction = null;\n this._seed = lib.get_hash(randomID());\n if (target) {\n this.atLocation(target);\n }\n if (text) {\n this.text(text, textOptions);\n }\n }\n\n static niceName = \"Scrolling Text\";\n\n /**\n * @private\n */\n _applyTraits() {\n Object.assign(this.constructor.prototype, traits.users);\n Object.assign(this.constructor.prototype, traits.location);\n Object.assign(this.constructor.prototype, traits.offset);\n Object.assign(this.constructor.prototype, traits.text);\n }\n\n direction(inDirection) {\n if (!(typeof inDirection === \"string\" || lib.is_real_number(inDirection))) {\n throw this.sequence._customError(\n this,\n \"direction\",\n \"inDirection must be of type string (CONST.TEXT_ANCHOR_POINTS) or number\"\n );\n }\n if (\n typeof inDirection === \"string\" &&\n !CONST.TEXT_ANCHOR_POINTS[inDirection]\n ) {\n throw this.sequence._customError(\n this,\n \"direction\",\n `${inDirection} does not exist in CONST.TEXT_ANCHOR_POINTS!`\n );\n } else if (typeof inDirection === \"string\") {\n this._direction = CONST.TEXT_ANCHOR_POINTS[inDirection];\n } else {\n this._direction = inDirection;\n }\n return this;\n }\n\n anchor(inAnchor) {\n if (!(typeof inAnchor === \"string\" || lib.is_real_number(inAnchor))) {\n throw this.sequence._customError(\n this,\n \"direction\",\n \"inAnchor must be of type string (CONST.TEXT_ANCHOR_POINTS) or number\"\n );\n }\n if (\n (typeof inAnchor === \"string\" && !CONST.TEXT_ANCHOR_POINTS[inAnchor]) ||\n (lib.is_real_number(inAnchor) &&\n !Object.values(CONST.TEXT_ANCHOR_POINTS).includes(inAnchor))\n ) {\n throw this.sequence._customError(\n this,\n \"direction\",\n `${inAnchor} does not exist in CONST.TEXT_ANCHOR_POINTS!`\n );\n } else if (typeof inAnchor === \"string\") {\n this._anchor = CONST.TEXT_ANCHOR_POINTS[inAnchor];\n } else {\n this._anchor = inAnchor;\n }\n return this;\n }\n\n jitter(inJitter) {\n if (!(lib.is_real_number(inJitter) && inJitter >= 0 && inJitter <= 1.0)) {\n throw this.sequence._customError(\n this,\n \"jitter\",\n \"inJitter must be of type number between 0 and 1\"\n );\n }\n this._jitter = inJitter;\n return this;\n }\n\n async run() {\n const data = await this._sanitizeTextData();\n if (Hooks.call(\"preCreateScrollingText\", data) === false) return;\n const push =\n !(data?.users?.length === 1 && data?.users?.includes(game.userId)) &&\n !this.sequence.localOnly;\n const duration = SequencerFoundryReplicator.playScrollingText(data, push);\n await new Promise((resolve) =>\n setTimeout(resolve, this._currentWaitTime + duration)\n );\n }\n\n _getSourceObject() {\n if (!this._source || typeof this._source !== \"object\") return this._source;\n return (\n lib.get_object_identifier(this._source) ??\n canvaslib.get_object_canvas_data(this._source)\n );\n }\n\n async _sanitizeTextData() {\n if (this._deserializedData) {\n return this._deserializedData;\n }\n\n return {\n sceneId: game.user.viewedScene,\n seed: this._seed,\n sequenceId: this.sequence.id,\n creatorUserId: game.userId,\n users: this._users ? Array.from(this._users) : false,\n moduleName: this.sequence.moduleName,\n source: this._getSourceObject(),\n offset: this._offset?.source ?? false,\n randomOffset: this._randomOffset?.source ?? false,\n content: this._text?.text ?? \"\",\n options: {\n anchor: this._anchor,\n direction: this._direction,\n duration: this._duration,\n distance: this._distance,\n jitter: this._jitter,\n ...this._text,\n },\n };\n }\n\n async _serialize() {\n const data = await super._serialize();\n const sectionData = await this._sanitizeTextData();\n return {\n ...data,\n type: \"scrollingText\",\n sectionData,\n };\n }\n\n async _deserialize(data) {\n this._deserializedData = data.sectionData;\n return super._deserialize(data);\n }\n}\n","import Section from \"./section.js\";\nimport traits from \"./traits/_traits.js\";\nimport * as lib from \"../lib/lib.js\";\nimport { is_real_number } from \"../lib/lib.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport SequencerFoundryReplicator from \"../modules/sequencer-foundry-replicator.js\";\n\nexport default class CanvasPanSection extends Section {\n constructor(inSequence, target, duration, scale) {\n super(inSequence);\n this._deserializedData = null;\n this._source = null;\n this._duration = duration ?? 250;\n this._speed = null;\n this._scale = scale ?? 1.0;\n this._lockView = null;\n this._seed = lib.get_hash(randomID());\n if (target) {\n this.atLocation(target);\n }\n }\n\n static niceName = \"Canvas Pan\";\n\n /**\n * @private\n */\n _applyTraits() {\n Object.assign(this.constructor.prototype, traits.users);\n Object.assign(this.constructor.prototype, traits.location);\n Object.assign(this.constructor.prototype, traits.offset);\n }\n\n /**\n * Sets the speed (pixels per frame) of the canvas pan\n *\n * @param {number} inSpeed\n * @returns this\n */\n speed(inSpeed) {\n if (!is_real_number(inSpeed))\n throw this.sequence._customError(\n this,\n \"speed\",\n \"inSpeed must be of type number\"\n );\n if (inSpeed < 0) {\n throw this.sequence._customError(\n this,\n \"speed\",\n \"inSpeed must be greater or equal to 0\"\n );\n }\n this._speed = inSpeed;\n return this;\n }\n\n /**\n * Sets the zoom level of the canvas pan\n *\n * @param {number} inScale\n * @returns this\n */\n scale(inScale) {\n if (!is_real_number(inScale))\n throw this.sequence._customError(\n this,\n \"scale\",\n \"inScale must be of type number\"\n );\n if (inScale <= 0) {\n throw this.sequence._customError(\n this,\n \"scale\",\n \"inScale must be greater than 0\"\n );\n }\n this._scale = inScale;\n return this;\n }\n\n /**\n * Locks the canvas at the given location for the given duration\n *\n * @param {number} inDuration\n * @returns this\n */\n lockView(inDuration) {\n if (!is_real_number(inDuration))\n throw this.sequence._customError(\n this,\n \"lockView\",\n \"inDuration must be of type number\"\n );\n if (inDuration < 0) {\n throw this.sequence._customError(\n this,\n \"lockView\",\n \"inDuration must be greater or equal to 0\"\n );\n }\n this._lockView = inDuration;\n return this;\n }\n\n async run() {\n const data = await this._sanitizeData();\n if (Hooks.call(\"preCanvasPan\", data) === false) return;\n const push =\n !(data?.users?.length === 1 && data?.users?.includes(game.userId)) &&\n !this.sequence.localOnly;\n const duration = SequencerFoundryReplicator.panCanvas(data, push);\n await new Promise((resolve) =>\n setTimeout(resolve, this._currentWaitTime + duration)\n );\n }\n\n _getSourceObject() {\n if (!this._source || typeof this._source !== \"object\") return this._source;\n return (\n lib.get_object_identifier(this._source) ??\n canvaslib.get_object_canvas_data(this._source)\n );\n }\n\n async _sanitizeData() {\n if (this._deserializedData) {\n return this._deserializedData;\n }\n\n return {\n sceneId: game.user.viewedScene,\n seed: this._seed,\n sequenceId: this.sequence.id,\n creatorUserId: game.userId,\n users: this._users ? Array.from(this._users) : false,\n moduleName: this.sequence.moduleName,\n source: this._getSourceObject(),\n offset: this._offset?.source ?? false,\n randomOffset: this._randomOffset?.source ?? false,\n duration: this._duration,\n speed: this._speed,\n scale: this._scale,\n lockView: this._lockView,\n };\n }\n\n async _serialize() {\n const data = await super._serialize();\n const sectionData = await this._sanitizeData();\n return {\n ...data,\n type: \"canvasPan\",\n sectionData,\n };\n }\n\n async _deserialize(data) {\n this._deserializedData = data.sectionData;\n return super._deserialize(data);\n }\n}\n","import * as lib from \"../lib/lib.js\";\nimport Section from \"./section.js\";\n\nexport default class WaitSection extends Section {\n constructor(inSequence, msMin, msMax) {\n super(inSequence);\n this._waitUntilFinished = true;\n this._waitDuration = lib.random_int_between(msMin, Math.max(msMin, msMax));\n }\n\n static niceName = \"Wait\";\n\n /**\n * @returns {Promise}\n */\n async run() {\n lib.debug(\"Running wait\");\n await new Promise(async (resolve) => {\n setTimeout(resolve, this._waitDuration);\n });\n }\n\n /**\n * @returns {Promise}\n * @private\n */\n async _execute() {\n await this.run();\n }\n\n async _serialize() {\n const data = await super._serialize();\n return {\n ...data,\n type: \"wait\",\n sectionData: {\n waitDuration: this._waitDuration,\n },\n };\n }\n\n async _deserialize(data) {\n this._waitDuration = data.sectionData.waitDuration;\n return super._deserialize(data);\n }\n}\n","import * as lib from \"../lib/lib.js\";\nimport FunctionSection from \"../sections/func.js\";\nimport EffectSection from \"../sections/effect.js\";\nimport SoundSection from \"../sections/sound.js\";\nimport AnimationSection from \"../sections/animation.js\";\nimport Section from \"../sections/section.js\";\nimport SequencerPresets from \"./sequencer-presets.js\";\nimport ScrollingTextSection from \"../sections/scrollingText.js\";\nimport { sequencerSocket, SOCKET_HANDLERS } from \"../sockets.js\";\nimport CanvasPanSection from \"../sections/canvasPan.js\";\nimport SequenceManager from \"./sequence-manager.js\";\nimport { get, writable } from \"svelte/store\";\nimport CONSTANTS from \"../constants.js\";\nimport WaitSection from \"../sections/wait.js\";\n\nexport default class Sequence {\n constructor(\n options = {\n moduleName: \"Sequencer\",\n softFail: false,\n },\n softFail = false\n ) {\n this.id = randomID();\n this.moduleName =\n typeof options === \"string\"\n ? options\n : options?.moduleName ?? \"Sequencer\";\n this.softFail = options?.softFail ?? softFail;\n this.sections = [];\n this.nameOffsetMap = false;\n this.effectIndex = 0;\n this.sectionToCreate = undefined;\n this.localOnly = false;\n this._status = writable(CONSTANTS.STATUS.READY);\n return lib.sequence_proxy_wrap(this);\n }\n\n /**\n * Plays all of this sequence's sections\n *\n * @returns {Promise}\n */\n async play({ remote = false } = {}) {\n if (remote) {\n this.localOnly = true;\n const data = await this.toJSON();\n sequencerSocket.executeForOthers(\n SOCKET_HANDLERS.RUN_SEQUENCE_LOCALLY,\n data\n );\n return new Sequence().fromJSON(data).play();\n }\n Hooks.callAll(\"createSequencerSequence\", this);\n lib.debug(\"Initializing sections\");\n for (let section of this.sections) {\n await section._initialize();\n }\n SequenceManager.RunningSequences.add(this.id, this);\n this.effectIndex = 0;\n lib.debug(\"Playing sections\");\n this.status = CONSTANTS.STATUS.RUNNING;\n const promises = [];\n for (let section of this.sections) {\n if (section instanceof EffectSection) this.effectIndex++;\n if (section.shouldWaitUntilFinished) {\n promises.push(await section._execute());\n } else {\n promises.push(section._execute());\n }\n if (get(this.status) === CONSTANTS.STATUS.ABORTED) {\n continue;\n }\n if (!section._isLastSection) {\n await new Promise((resolve) => setTimeout(resolve, 1));\n }\n }\n\n return Promise.allSettled(promises).then(() => {\n Hooks.callAll(\"endedSequencerSequence\");\n lib.debug(\"Finished playing sections\");\n this.status = CONSTANTS.STATUS.COMPLETE;\n });\n }\n\n /**\n * Creates a section that will run a function.\n *\n * @param {function} inFunc\n * @returns {Sequence} this\n */\n thenDo(inFunc) {\n const func = lib.section_proxy_wrap(new FunctionSection(this, inFunc));\n this.sections.push(func);\n return func;\n }\n\n /**\n * Creates a section that will run a macro based on a name or a direct reference to a macro.\n *\n * @param {string|Macro} inMacro\n * @param {*} args\n * @returns {Sequence} this\n */\n macro(inMacro, ...args) {\n let macro;\n let compendium = false;\n if (typeof inMacro === \"string\") {\n if (inMacro.startsWith(\"Compendium\")) {\n let packArray = inMacro.split(\".\");\n let pack = game.packs.get(`${packArray[1]}.${packArray[2]}`);\n // Catch invalid compendium pack\n if (!pack) {\n if (this.softFail) {\n return this;\n }\n throw lib.custom_error(\n this.moduleName,\n `macro - Compendium '${packArray[1]}.${packArray[2]}' was not found`\n );\n }\n macro = packArray;\n compendium = pack;\n } else {\n macro = game.macros.getName(inMacro);\n if (!macro) {\n if (this.softFail) {\n return this;\n }\n throw lib.custom_error(\n this.moduleName,\n `macro - Macro '${inMacro}' was not found`\n );\n }\n }\n } else if (inMacro instanceof Macro) {\n macro = inMacro;\n } else {\n throw lib.custom_error(\n this.moduleName,\n `macro - inMacro must be of instance string or Macro`\n );\n }\n\n if (args && args.length && !game.modules.get(\"advanced-macros\")?.active) {\n lib.custom_warning(\n this.moduleName,\n `macro - Supplying macros with arguments require the advanced-macros module to be active`,\n true\n );\n }\n\n const func = lib.section_proxy_wrap(\n new FunctionSection(\n this,\n async () => {\n if (compendium) {\n const macroData = (await compendium.getDocuments())\n .find((i) => i.name === macro[3])\n ?.toObject();\n if (!macroData) {\n if (this.softFail) {\n return;\n }\n throw lib.custom_error(\n this.moduleName,\n `macro - Macro '${macro[3]}' was not found in compendium '${macro[1]}.${macro[2]}'`\n );\n }\n macro = new Macro(macroData);\n macro.ownership.default = CONST.DOCUMENT_PERMISSION_LEVELS.OWNER;\n }\n\n const version = game.modules.get(\"advanced-macros\")?.version;\n const bugAdvancedMacros =\n game.modules.get(\"advanced-macros\")?.active &&\n isNewerVersion(\n version.startsWith(\"v\") ? version.slice(1) : version,\n \"1.18.2\"\n ) &&\n !isNewerVersion(\n version.startsWith(\"v\") ? version.slice(1) : version,\n \"1.19.1\"\n );\n if (bugAdvancedMacros) {\n await macro.execute([...args]);\n } else {\n await macro.execute(...args);\n }\n },\n true\n )\n );\n this.sections.push(func);\n return this;\n }\n\n /**\n * Creates an effect section. Until you call .then(), .effect(), .sound(), or .wait(), you'll be working on the Effect section.\n *\n * @param {string} [inFile] inFile\n * @returns {Section}\n */\n effect(inFile = \"\") {\n const effect = lib.section_proxy_wrap(new EffectSection(this, inFile));\n this.sections.push(effect);\n return effect;\n }\n\n /**\n * Creates a sound section. Until you call .then(), .effect(), .sound(), or .wait(), you'll be working on the Sound section.\n *\n * @param {string} [inFile] inFile\n * @returns {Section}\n */\n sound(inFile = \"\") {\n const sound = lib.section_proxy_wrap(new SoundSection(this, inFile));\n this.sections.push(sound);\n return sound;\n }\n\n /**\n * Creates an animation. Until you call .then(), .effect(), .sound(), or .wait(), you'll be working on the Animation section.\n *\n * @param {Token|Tile} [inTarget=false] inTarget\n * @returns {AnimationSection}\n */\n animation(inTarget) {\n const animation = lib.section_proxy_wrap(\n new AnimationSection(this, inTarget)\n );\n this.sections.push(animation);\n return animation;\n }\n\n /**\n * Creates a scrolling text. Until you call .then(), .effect(), .sound(), or .wait(), you'll be working on the Scrolling Text section.\n *\n * @param {Object|String|Boolean} [inTarget=false] inTarget\n * @param {String|Boolean} [inText=false] inText\n * @param {Object} [inTextOptions={}] inTextOptions\n * @returns {AnimationSection}\n */\n scrollingText(inTarget = false, inText = false, inTextOptions = {}) {\n const scrolling = lib.section_proxy_wrap(\n new ScrollingTextSection(this, inTarget, inText, inTextOptions)\n );\n this.sections.push(scrolling);\n return scrolling;\n }\n\n /**\n * Pans the canvas text. Until you call any other sections you'll be working on the Canvas Pan section.\n *\n * @param {Object|String|Boolean} [inTarget=false] inTarget\n * @param {Boolean|Number} inDuration\n * @param {Boolean|Number} inSpeed\n * @returns {AnimationSection}\n */\n canvasPan(inTarget = false, inDuration = null, inSpeed = null) {\n const panning = lib.section_proxy_wrap(\n new CanvasPanSection(this, inTarget)\n );\n this.sections.push(panning);\n return panning;\n }\n\n /**\n * Causes the sequence to wait after the last section for as many milliseconds as you pass to this method. If given\n * a second number, a random wait time between the two given numbers will be generated.\n *\n * @param {number} [msMin=1] minMs\n * @param {number} [msMax=1] maxMs\n * @returns {Sequence} this\n */\n wait(msMin = 1, msMax = 1) {\n if (msMin < 1)\n throw lib.custom_error(\n this.moduleName,\n `wait - Wait ms cannot be less than 1`\n );\n if (msMax < 1)\n throw lib.custom_error(\n this.moduleName,\n `wait - Max wait ms cannot be less than 1`\n );\n const section = lib.section_proxy_wrap(new WaitSection(this, msMin, msMax));\n this.sections.push(section);\n return this;\n }\n\n /**\n * Applies a preset to the sequence\n *\n * @param {string} presetName\n * @param {*} args\n * @returns {Sequence|FunctionSection|EffectSection|AnimationSection|SoundSection}\n */\n preset(presetName, ...args) {\n if (typeof presetName !== \"string\") {\n throw this._customError(this, \"name\", `inName must be of type string`);\n }\n const preset = SequencerPresets.get(presetName);\n if (!preset) {\n lib.custom_warning(\n \"Sequencer\",\n `preset | Could not find preset with name \"${presetName}\"`\n );\n return this;\n }\n return preset(this, ...args);\n }\n\n /**\n * Adds the sections from a given Sequence to this Sequence\n *\n * @param {Sequence|FunctionSection|EffectSection|AnimationSection|SoundSection} inSequence\n * @returns {Sequence} this\n */\n addSequence(inSequence) {\n if (inSequence instanceof Section) inSequence = inSequence.sequence;\n if (!(inSequence instanceof Sequence)) {\n throw lib.custom_error(\n this.moduleName,\n `addSequence - could not find the sequence from the given parameter`\n );\n }\n const newSections = inSequence.sections.map((section) => {\n const newSection = Object.assign(\n Object.create(Object.getPrototypeOf(section)),\n section\n );\n newSection.sequence = this;\n return newSection;\n });\n this.sections = this.sections.concat(newSections);\n return this;\n }\n\n async toJSON() {\n const data = {\n options: { moduleName: this.moduleName, softFail: this.softFail },\n sections: [],\n };\n for (const section of this.sections) {\n const sectionData = await section._serialize();\n if (!sectionData.type) {\n throw new Error(\n `Sequencer | toJson | ${section.constructor.name} does not support serialization!`\n );\n }\n data.sections.push(sectionData);\n }\n return data;\n }\n\n fromJSON(data) {\n this.moduleName = data.options.moduleName;\n this.softFail = data.options.softFail;\n this.localOnly = true;\n for (const section of data.sections) {\n this[section.type]()._deserialize(section);\n }\n return this;\n }\n\n _createCustomSection(...args) {\n const func = lib.section_proxy_wrap(\n new this.sectionToCreate(this, ...args)\n );\n this.sectionToCreate = undefined;\n this.sections.push(func);\n return func;\n }\n\n _showWarning(self, func, warning, notify) {\n lib.custom_warning(\n this.moduleName,\n `${self.constructor.name.replace(\"Section\", \"\")} | ${func} - ${warning}`,\n notify\n );\n }\n\n _customError(self, func, error) {\n return lib.custom_error(\n this.moduleName,\n `${self.constructor.name.replace(\"Section\", \"\")} | ${func} - ${error}`\n );\n }\n\n set status(inStatus) {\n this._status.update((currentStatus) => {\n if (\n currentStatus === CONSTANTS.STATUS.READY ||\n currentStatus === CONSTANTS.STATUS.RUNNING\n ) {\n return inStatus;\n }\n return currentStatus;\n });\n }\n\n get status() {\n return this._status;\n }\n\n _abort() {\n this.status = CONSTANTS.STATUS.ABORTED;\n for (const section of this.sections) {\n section._abortSection();\n }\n }\n}\n","import { sequencerSocket, SOCKET_HANDLERS } from \"../sockets.js\";\nimport SequencerFileCache from \"./sequencer-file-cache.js\";\nimport LoadingBar from \"../utils/loadingBar.js\";\nimport * as lib from \"../lib/lib.js\";\n\nconst SequencerPreloader = {\n _usersToRespond: new Set(),\n _clientsDone: [],\n _resolve: () => {},\n\n /**\n * Caches provided file(s) locally, vastly improving loading speed of those files.\n *\n * @param {Array|String} inSrcs\n * @param {Boolean} showProgressBar\n * @returns {Promise}\n */\n preload(inSrcs, showProgressBar = false) {\n if (Array.isArray(inSrcs)) {\n inSrcs.forEach((str) => {\n if (typeof str !== \"string\") {\n throw lib.custom_error(\n \"Sequencer\",\n \"preload | each entry in inSrcs must be of type string\"\n );\n }\n });\n } else if (typeof inSrcs !== \"string\") {\n throw lib.custom_error(\n \"Sequencer\",\n \"preload | inSrcs must be of type string or array of strings\"\n );\n }\n\n if (typeof showProgressBar !== \"boolean\") {\n throw lib.custom_error(\n \"Sequencer\",\n \"preload | showProgressBar must be of type of boolean\"\n );\n }\n\n const srcs = this._cleanSrcs(inSrcs);\n\n if (srcs.length === 0) return;\n\n return this._preloadLocal(srcs, showProgressBar);\n },\n\n /**\n * Causes each connected client (including the caller) to fetch and cache the provided file(s) locally, vastly\n * improving loading speed of those files.\n *\n * @param {Array|String} inSrcs\n * @param {Boolean} showProgressBar\n * @returns {Promise}\n */\n preloadForClients(inSrcs, showProgressBar = false) {\n if (Array.isArray(inSrcs)) {\n inSrcs.forEach((str) => {\n if (typeof str !== \"string\") {\n throw lib.custom_error(\n \"Sequencer\",\n \"preloadForClients | each entry in inSrcs must be of type string\"\n );\n }\n });\n } else if (typeof inSrcs !== \"string\") {\n throw lib.custom_error(\n \"Sequencer\",\n \"preloadForClients | inSrcs must be of type string or array of strings\"\n );\n }\n\n if (typeof showProgressBar !== \"boolean\") {\n throw lib.custom_error(\n \"Sequencer\",\n \"preloadForClients | showProgressBar must be of type of boolean\"\n );\n }\n\n const srcs = this._cleanSrcs(inSrcs);\n\n if (srcs.length === 0) return;\n\n if (!lib.user_can_do(\"permissions-preload\")) {\n lib.custom_warning(\n \"Sequencer\",\n \"preloadForClients - You do not have permission to force other clients to preload. Preloading locally instead.\"\n );\n return this._preloadLocal(srcs, showProgressBar);\n }\n\n const promise = new Promise((resolve) => {\n this._resolve = resolve;\n });\n\n this._usersToRespond = new Set(\n game.users.filter((user) => user.active).map((user) => user.id)\n );\n\n sequencerSocket.executeForEveryone(\n SOCKET_HANDLERS.PRELOAD,\n game.user.id,\n srcs,\n showProgressBar\n );\n\n return promise;\n },\n\n async respond(inSenderId, inSrcs, showProgressBar) {\n const numFilesFailedToLoad = await this._preloadLocal(\n inSrcs,\n showProgressBar\n );\n return sequencerSocket.executeAsUser(\n SOCKET_HANDLERS.PRELOAD_RESPONSE,\n inSenderId,\n game.user.id,\n numFilesFailedToLoad\n );\n },\n\n handleResponse(inUserId, numFilesFailedToLoad) {\n this._usersToRespond.delete(inUserId);\n this._clientsDone.push({\n userId: inUserId,\n numFilesFailedToLoad: numFilesFailedToLoad,\n });\n if (this._usersToRespond.size > 0) return;\n\n this._clientsDone.forEach((user) => {\n if (user.numFilesFailedToLoad > 0) {\n lib.debug(\n `${\n game.users.get(user.userId).name\n } preloaded files, failed to preload ${\n user.numFilesFailedToLoad\n } files`\n );\n } else {\n lib.debug(\n `${game.users.get(user.userId).name} preloaded files successfully`\n );\n }\n });\n lib.debug(`All clients responded to file preloads`);\n\n this._resolve();\n\n this._usersToRespond = new Set();\n this._clientsDone = [];\n this._resolve = () => {};\n },\n\n /**\n * Filters and cleans up file paths given to the preload methods\n *\n * @private\n */\n _cleanSrcs(inSrcs) {\n if (!Array.isArray(inSrcs)) {\n inSrcs = [inSrcs];\n }\n\n if (inSrcs.length === 0) {\n lib.custom_warning(\"Sequencer\", \"You need to provide files to preload\");\n return [];\n }\n\n inSrcs = lib\n .make_array_unique(\n inSrcs.filter(Boolean).map((src) => {\n if (Sequencer.Database.entryExists(src)) {\n return Sequencer.Database.getAllFileEntries(src);\n }\n return src;\n })\n )\n .deepFlatten();\n\n if (inSrcs.length >= 750) {\n lib.custom_warning(\n \"Sequencer\",\n \"You are preloading over 750 files, you are most likely preloading more files than the system can cache.\",\n true\n );\n }\n\n return inSrcs;\n },\n\n /**\n * The method that actually preloads files locally, with an optional progress bar\n *\n * @private\n */\n _preloadLocal(inSrcs, showProgressBar) {\n let startTime = performance.now();\n let numFilesToLoad = inSrcs.length;\n\n lib.debug(`Preloading ${numFilesToLoad} files...`);\n if (showProgressBar)\n LoadingBar.init(\n `Sequencer - Preloading ${numFilesToLoad} files`,\n numFilesToLoad\n );\n\n return new Promise(async (resolve) => {\n let numFilesFailedToLoad = 0;\n for (let src of inSrcs) {\n const blob = await SequencerFileCache.loadFile(src, true);\n if (showProgressBar) LoadingBar.incrementProgress();\n if (!blob) {\n numFilesFailedToLoad++;\n }\n }\n const timeTaken = (performance.now() - startTime) / 1000;\n let failedToLoad = ` (${numFilesFailedToLoad} failed to load)`;\n lib.debug(\n `Preloading ${numFilesToLoad} files took ${timeTaken}s` + failedToLoad\n );\n resolve(numFilesFailedToLoad);\n });\n },\n};\n\nexport default SequencerPreloader;\n","import Section from \"../sections/section.js\";\nimport * as lib from \"../lib/lib.js\";\n\nexport default class SequencerSectionManager {\n constructor() {\n this.externalSections = {};\n }\n\n /**\n * Registers a class by a name that will then be available through the Sequencer\n *\n * @param {String} inModuleName\n * @param {String} inMethodName\n * @param {Class} inClass\n * @param {Boolean} overwrite\n * @returns {Boolean} Whether the registration succeeded\n */\n registerSection(inModuleName, inMethodName, inClass, overwrite = false) {\n if (!(inClass.prototype instanceof Section)) {\n throw lib.custom_error(\n inModuleName,\n `inClass must be instance of Sequencer.BaseSection`\n );\n }\n\n let coreMethods = Object.getOwnPropertyNames(Sequence.prototype).filter(\n (method) => {\n return !method.startsWith(\"_\") && method !== \"constructor\";\n }\n );\n\n if (coreMethods.includes(inMethodName)) {\n throw lib.custom_error(\n inModuleName,\n `${inMethodName} is an existing protected method of the Sequence class - please register with another method name!`\n );\n }\n\n if (this.externalSections[inMethodName] && !overwrite) {\n throw lib.custom_error(\n inModuleName,\n `${inMethodName} is already a registered Section with the class ${this.externalSections[inMethodName].constructor.name}`\n );\n }\n\n coreMethods = coreMethods.concat(Object.keys(this.externalSections));\n\n const clashingMethods = Object.getOwnPropertyNames(\n inClass.prototype\n ).filter((method) => coreMethods.includes(method));\n\n if (clashingMethods.length) {\n let errors = clashingMethods.join(\", \");\n throw lib.custom_error(\n inModuleName,\n `${inMethodName} cannot contain the following methods: ${errors}
These methods are existing methods on the Sequence or from already registered Sections. Please rename these methods to avoid conflicts.`\n );\n }\n\n lib.debug(\n `SectionManager | Successfully registered ${inMethodName} with Sequencer!`\n );\n\n this.externalSections[inMethodName] = inClass;\n\n return true;\n }\n}\n","// SPDX-License-Identifier: MIT\n// Copyright © 2021 fvtt-lib-wrapper Rui Pinheiro\n\n\"use strict\";\n\n// A shim for the libWrapper library\nexport let libWrapper = undefined;\n\nexport const VERSIONS = [1, 12, 2];\nexport const TGT_SPLIT_RE = new RegExp(\n \"([^.[]+|\\\\[('([^'\\\\\\\\]|\\\\\\\\.)+?'|\\\"([^\\\"\\\\\\\\]|\\\\\\\\.)+?\\\")\\\\])\",\n \"g\"\n);\nexport const TGT_CLEANUP_RE = new RegExp(\"(^\\\\['|'\\\\]$|^\\\\[\\\"|\\\"\\\\]$)\", \"g\");\n\n// Main shim code\nHooks.once(\"init\", () => {\n // Check if the real module is already loaded - if so, use it\n if (globalThis.libWrapper && !(globalThis.libWrapper.is_fallback ?? true)) {\n libWrapper = globalThis.libWrapper;\n return;\n }\n\n // Fallback implementation\n libWrapper = class {\n static get is_fallback() {\n return true;\n }\n\n static get WRAPPER() {\n return \"WRAPPER\";\n }\n static get MIXED() {\n return \"MIXED\";\n }\n static get OVERRIDE() {\n return \"OVERRIDE\";\n }\n\n static register(\n package_id,\n target,\n fn,\n type = \"MIXED\",\n { chain = undefined, bind = [] } = {}\n ) {\n const is_setter = target.endsWith(\"#set\");\n target = !is_setter ? target : target.slice(0, -4);\n const split = target\n .match(TGT_SPLIT_RE)\n .map((x) => x.replace(/\\\\(.)/g, \"$1\").replace(TGT_CLEANUP_RE, \"\"));\n const root_nm = split.splice(0, 1)[0];\n\n let obj, fn_name;\n if (split.length == 0) {\n obj = globalThis;\n fn_name = root_nm;\n } else {\n const _eval = eval;\n fn_name = split.pop();\n obj = split.reduce(\n (x, y) => x[y],\n globalThis[root_nm] ?? _eval(root_nm)\n );\n }\n\n let iObj = obj;\n let descriptor = null;\n while (iObj) {\n descriptor = Object.getOwnPropertyDescriptor(iObj, fn_name);\n if (descriptor) break;\n iObj = Object.getPrototypeOf(iObj);\n }\n if (!descriptor || descriptor?.configurable === false)\n throw new Error(\n `libWrapper Shim: '${target}' does not exist, could not be found, or has a non-configurable descriptor.`\n );\n\n let original = null;\n const wrapper =\n chain ?? (type.toUpperCase?.() != \"OVERRIDE\" && type != 3)\n ? function (...args) {\n return fn.call(this, original.bind(this), ...bind, ...args);\n }\n : function (...args) {\n return fn.call(this, ...bind, ...args);\n };\n if (!is_setter) {\n if (descriptor.value) {\n original = descriptor.value;\n descriptor.value = wrapper;\n } else {\n original = descriptor.get;\n descriptor.get = wrapper;\n }\n } else {\n if (!descriptor.set)\n throw new Error(\n `libWrapper Shim: '${target}' does not have a setter`\n );\n original = descriptor.set;\n descriptor.set = wrapper;\n }\n\n descriptor.configurable = true;\n Object.defineProperty(obj, fn_name, descriptor);\n }\n };\n});\n","import CONSTANTS from \"./constants.js\";\nimport { libWrapper } from \"./lib/libWrapper/shim.js\";\n\nexport default function registerLibwrappers() {\n const override = isNewerVersion(game.version, \"11\")\n ? \"PIXI.BaseImageResource.prototype.upload\"\n : \"PIXI.resources.BaseImageResource.prototype.upload\";\n libWrapper.register(CONSTANTS.MODULE_NAME, override, PIXIUPLOAD);\n}\n\nfunction PIXIUPLOAD(wrapped, ...args) {\n let baseTexture = args[1];\n\n if (\n baseTexture.sequencer_patched ||\n !game.settings.get(CONSTANTS.MODULE_NAME, \"enable-global-pixi-fix\")\n ) {\n return wrapped(...args);\n }\n\n let source = args[3];\n source = source || this.source;\n const isVideo = !!source.videoWidth;\n if (isVideo) {\n baseTexture.alphaMode = PIXI.ALPHA_MODES.PREMULTIPLIED_ALPHA;\n baseTexture.sequencer_patched = true;\n }\n return wrapped(...args);\n}\n","import CONSTANTS from \"./constants.js\";\nimport { custom_warning } from \"./lib/lib.js\";\n\nexport default async function runMigrations() {\n const sortedMigrations = Object.entries(migrations).sort((a, b) => {\n return isNewerVersion(b[0], a[0]) ? -1 : 1;\n });\n\n for (const [version, migration] of sortedMigrations) {\n try {\n await migration(version);\n } catch (err) {\n custom_warning(\n \"Sequencer\",\n `Something went wrong when migrating to version ${version}. Please check the console for the error!`,\n true\n );\n console.error(err);\n }\n }\n}\n\nfunction getSequencerEffectTokens(version, tokenFilter = false) {\n return Array.from(game.scenes)\n .map((scene) => [\n scene,\n Array.from(scene.tokens).filter((token, index) => {\n if (tokenFilter) {\n return tokenFilter(token, index);\n }\n const effects = getProperty(token, CONSTANTS.EFFECTS_FLAG) ?? [];\n const effectsOutOfDate = effects.filter((e) =>\n isNewerVersion(version, e[1].flagVersion)\n );\n return effectsOutOfDate.length;\n }),\n ])\n .filter(([_, tokens]) => tokens.length);\n}\n\nfunction getSequencerEffectActors(version, actorFilter = false) {\n return Array.from(game.actors).filter((actor, index) => {\n if (actorFilter) {\n return actorFilter(actor, index);\n }\n const effects = getProperty(actor, CONSTANTS.EFFECTS_FLAG) ?? [];\n const effectsOutOfDate = effects.filter((e) =>\n isNewerVersion(version, e[1].flagVersion)\n );\n return effectsOutOfDate.length;\n });\n}\n\nconst migrations = {\n \"3.0.0\": async (version) => {\n const actorsToUpdate = getSequencerEffectActors(version, (actor) => {\n const effects =\n getProperty(actor, \"prototypeToken.\" + CONSTANTS.EFFECTS_FLAG) ?? [];\n const effectsOutOfDate = effects.filter((e) =>\n isNewerVersion(version, e[1].flagVersion)\n );\n return effectsOutOfDate.length;\n });\n\n const actorUpdateArray = actorsToUpdate.map((actor) => {\n const effectsToMoveFromTokenPrototype = getProperty(\n actor.prototypeToken,\n CONSTANTS.EFFECTS_FLAG\n )\n .filter(([_, effect]) => {\n return effect.persistOptions?.persistTokenPrototype;\n })\n .map(([id, effect]) => {\n effect.flagVersion = version;\n return [id, effect];\n });\n\n const effectsToKeepOnTokenPrototype = getProperty(\n actor.prototypeToken,\n CONSTANTS.EFFECTS_FLAG\n )\n .filter(([_, effect]) => {\n return !effect.persistOptions?.persistTokenPrototype;\n })\n .map(([id, effect]) => {\n effect.flagVersion = version;\n return [id, effect];\n });\n\n return {\n _id: actor.id,\n [CONSTANTS.EFFECTS_FLAG]: effectsToMoveFromTokenPrototype,\n [\"prototypeToken.\" + CONSTANTS.EFFECTS_FLAG]:\n effectsToKeepOnTokenPrototype,\n };\n });\n\n const tokensOnScenes = getSequencerEffectTokens(version, (t) => {\n let actor;\n try {\n actor = t.actor;\n } catch (err) {\n return false;\n }\n const effects = getProperty(t, CONSTANTS.EFFECTS_FLAG) ?? [];\n const prototypeTokenEffects =\n getProperty(actor, \"prototypeToken.\" + CONSTANTS.EFFECTS_FLAG) ?? [];\n const effectsOutOfDate = effects.filter((e) =>\n isNewerVersion(version, e[1].flagVersion)\n );\n const prototypeEffectsOutOfDate = prototypeTokenEffects.filter((e) =>\n isNewerVersion(version, e[1].flagVersion)\n );\n return (\n t.actorLink &&\n (effectsOutOfDate.length || prototypeEffectsOutOfDate.length)\n );\n });\n\n for (const [scene, tokens] of tokensOnScenes) {\n const updates = [];\n for (const token of tokens) {\n const effectsToKeepOnToken = getProperty(token, CONSTANTS.EFFECTS_FLAG)\n .filter(([_, effect]) => {\n return !effect.persistOptions?.persistTokenPrototype;\n })\n .map(([id, effect]) => {\n effect.flagVersion = version;\n return [id, effect];\n });\n\n updates.push({\n _id: token.id,\n [CONSTANTS.EFFECTS_FLAG]: effectsToKeepOnToken,\n });\n }\n\n if (updates.length) {\n console.log(\n `Sequencer | Updated ${updates.length} tokens' effects on scene ${scene.id} to version ${version}`\n );\n await scene.updateEmbeddedDocuments(\"Token\", updates);\n }\n }\n\n if (actorUpdateArray.length) {\n console.log(\n `Sequencer | Updated ${actorUpdateArray.length} actors' effects to version ${version}`\n );\n await Actor.updateDocuments(actorUpdateArray);\n }\n },\n};\n","import \"./styles/module.scss\";\n\nimport { registerSettings, migrateSettings } from \"./settings.js\";\nimport registerLayers from \"./layers.js\";\nimport registerHotkeys from \"./hotkeys.js\";\nimport registerTypes from \"../typings/typings.js\";\nimport { registerSocket } from \"./sockets.js\";\nimport { EASE, easeFunctions, registerEase } from \"./canvas-effects/ease.js\";\n\nimport Sequence from \"./modules/sequencer.js\";\nimport SequencerDatabase from \"./modules/sequencer-database.js\";\nimport SequencerPreloader from \"./modules/sequencer-preloader.js\";\nimport SequencerEffectManager from \"./modules/sequencer-effect-manager.js\";\nimport SequencerSectionManager from \"./modules/sequencer-section-manager.js\";\nimport {\n EffectPlayer,\n InteractionManager,\n} from \"./modules/sequencer-interaction-manager.js\";\nimport Section from \"./sections/section.js\";\nimport * as lib from \"./lib/lib.js\";\nimport { SequencerAboveUILayer } from \"./canvas-effects/effects-layer.js\";\nimport SequencerPresets from \"./modules/sequencer-presets.js\";\nimport registerLibwrappers from \"./libwrapper.js\";\nimport { DatabaseViewerApp } from \"./formapplications/database/database-viewer-app.js\";\nimport { EffectsUIApp } from \"./formapplications/effects-ui/effects-ui-app.js\";\nimport CONSTANTS from \"./constants.js\";\nimport { PlayerSettings } from \"./formapplications/effects-ui/effect-player-store.js\";\nimport runMigrations from \"./migrations.js\";\nimport SequencerFoundryReplicator from \"./modules/sequencer-foundry-replicator.js\";\n\nHooks.once(\"init\", async function () {\n if (!game.modules.get(\"socketlib\")?.active) return;\n CONSTANTS.INTEGRATIONS.ISOMETRIC.ACTIVE = false;\n // !!game.modules.get(\n // CONSTANTS.INTEGRATIONS.ISOMETRIC.MODULE_NAME\n // )?.active;\n initialize_module();\n});\n\nHooks.once(\"socketlib.ready\", () => {\n registerSocket();\n});\n\nHooks.once(\"ready\", async function () {\n if (!game.modules.get(\"socketlib\")?.active) {\n ui.notifications.error(\n \"Sequencer requires the SocketLib module to be active and will not work without it!\",\n { console: true }\n );\n return;\n }\n\n for (const [name, func] of Object.entries(easeFunctions)) {\n if (!CanvasAnimation[name]) {\n CanvasAnimation[name] = func;\n }\n }\n\n await runMigrations();\n\n PlayerSettings.migrateOldPresets();\n SequencerFoundryReplicator.registerHooks();\n\n InteractionManager.initialize();\n\n setTimeout(() => {\n console.log(\"Sequencer | Ready to go!\");\n Hooks.callAll(\"sequencer.ready\");\n Hooks.callAll(\"sequencerReady\");\n\n // setTimeout(() => {\n // EffectsUIApp.show({ tab: \"player\" });\n // }, 200)\n\n migrateSettings();\n\n SequencerEffectManager.setUpPersists();\n\n Hooks.on(\"canvasReady\", () => {\n SequencerEffectManager.setUpPersists();\n });\n }, 50);\n});\n\n/**\n * Creation & delete hooks for persistent effects\n */\nfunction initialize_module() {\n window.Sequence = Sequence;\n window.Sequencer = {\n Player: EffectPlayer,\n Presets: SequencerPresets,\n Database: SequencerDatabase,\n DatabaseViewer: DatabaseViewerApp,\n Preloader: SequencerPreloader,\n EffectManager: SequencerEffectManager,\n SectionManager: new SequencerSectionManager(),\n registerEase: registerEase,\n BaseSection: Section,\n CONSTANTS: {\n EASE,\n },\n Helpers: {\n wait: lib.wait,\n clamp: lib.clamp,\n interpolate: lib.interpolate,\n random_float_between: lib.random_float_between,\n random_int_between: lib.random_int_between,\n shuffle_array: lib.shuffle_array,\n random_array_element: lib.random_array_element,\n random_object_element: lib.random_object_element,\n make_array_unique: lib.make_array_unique,\n },\n };\n\n registerSettings();\n registerLayers();\n registerHotkeys();\n registerLibwrappers();\n\n SequencerAboveUILayer.setup();\n\n Hooks.on(\"preCreateToken\", (...args) =>\n Sequencer.EffectManager.patchCreationData(...args)\n );\n Hooks.on(\"preCreateDrawing\", (...args) =>\n Sequencer.EffectManager.patchCreationData(...args)\n );\n Hooks.on(\"preCreateTile\", (...args) =>\n Sequencer.EffectManager.patchCreationData(...args)\n );\n Hooks.on(\"preCreateMeasuredTemplate\", (...args) =>\n Sequencer.EffectManager.patchCreationData(...args)\n );\n\n Hooks.on(\"createToken\", (...args) =>\n Sequencer.EffectManager.documentCreated(...args)\n );\n Hooks.on(\"createDrawing\", (...args) =>\n Sequencer.EffectManager.documentCreated(...args)\n );\n Hooks.on(\"createTile\", (...args) =>\n Sequencer.EffectManager.documentCreated(...args)\n );\n Hooks.on(\"createMeasuredTemplate\", (...args) =>\n Sequencer.EffectManager.documentCreated(...args)\n );\n}\n\nHooks.once(\"monaco-editor.ready\", registerTypes);\n"],"names":["lib.custom_error","lib.is_function","lib.debug","is_function","wait","document","hash","now","text","element","animation","detach","create_each_block","insert","update","instance","create_fragment","debug","children","writable","subscribe","run","storage","readable","writable$2","get","derived","scale","offset","constants.animateKeys","constants.relativeRegex","interpolate","lerp","duration","ease","options","width","linear","constants.transformOriginDefault","constants.transformKeysBitwise","constants.transformKeys","s_VALIDATION_DATA","constants.transformOrigins","parent","constants.numericDefaults","constants.setNumericDefaults","rotation","promise","draggable","active","ctx","create_if_block","booleanStore","dragDefault","storeResizing","audio","lib.getFiles","lib.is_real_number","lib.random_array_element","files","lib.interpolate","module","lib.make_array_unique","lib.custom_warning","lib\n .str_to_search_regex_str","lib.flatten_object","create_if_block_1","create_if_block_2","lib.str_to_search_regex_str","key","resizeObserver","dispatch","keeps","data","selectedPackStore","packStore","visibleTreeStore","cleanSearchStore","entriesStore","DatabaseShell","lib.wait","lib.get_object_identifier","delta","lib.deep_get","lib.deep_set","getProperty","SequencerAudioHelper","lib.is_UUID","canvaslib.is_object_canvas_data","lib.get_object_from_scene","canvaslib.get_object_position","canvaslib.get_random_offset","canvaslib.rotateAroundPoint","FlagManager","canvaslib.get_object_dimensions","lib.from_uuid_fast","lib.user_can_do","filters","lib.safe_str","lib\n .get_all_documents_from_scene","lib.get_all_documents_from_scene","lib.group_by","canvaslib.rotate_coordinate","child","lib.throttled_custom_warning","canvaslib.calculate_missed_position","obj","multiplier","lib.get_hash","reject","canvaslib.validateAnimation","canvaslib.validateLoopingAnimation","canvaslib.is_position_within_bounds","layer","sprite","spriteType","canvaslib.distance_between","filter","lib.random_float_between","canvaslib.createShape","canvaslib.get_object_elevation","blurFilter","mask","canvaslib.getBezierControlPoints","scaleX","scaleY","lib.debug_error","canvaslib.align","moves","angle","x","y","align","canvaslib.get_mouse_position","canvaslib.get_closest_token","effect","users","EffectsUIShell","lib.random_int_between","lib.validate_document","lib.parseColor","canvaslib.get_object_canvas_data","canvaslib.alignments","timespan","Sequence","lib.sequence_proxy_wrap","func","lib.section_proxy_wrap","lib\n .make_array_unique","bind"],"mappings":";AAAA,MAAM,YAAY;AAAA,EAChB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,OAAO;AAAA,IACL,SAAS;AAAA,IACT,WAAW;AAAA,IACX,UAAU;AAAA,EACX;AAAA,EACD,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EACP;AAAA,EACD,YAAY,IAAI,OAAO,gBAAgB;AAAA,EACvC,aAAa,IAAI,OAAO,WAAW;AAAA,EACnC,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,SAAS;AAAA,IACT,SAAS;AAAA,EACV;AACH;AAEA,UAAU,eAAe,CAAA;AACzB,UAAU,aAAa,YAAY;AACnC,UAAU,aAAa,UAAU,SAAS;AAC1C,UAAU,aAAa,UAAU,cAAc;AAC/C,UAA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