{"version":3,"file":"sequencer.js","sources":["../src/constants.js","../src/canvas-effects/ease.js","../src/lib/lib.js","../node_modules/svelte/src/version.js","../node_modules/svelte/src/internal/disclose-version.js","../node_modules/svelte/src/internal/flags/index.js","../node_modules/svelte/src/internal/flags/legacy.js","../node_modules/svelte/src/constants.js","../node_modules/esm-env/dev-fallback.js","../node_modules/svelte/src/internal/shared/utils.js","../node_modules/svelte/src/internal/client/constants.js","../node_modules/svelte/src/internal/shared/errors.js","../node_modules/svelte/src/internal/client/errors.js","../node_modules/svelte/src/internal/client/warnings.js","../node_modules/svelte/src/internal/client/reactivity/equality.js","../node_modules/svelte/src/internal/client/dev/tracing.js","../node_modules/svelte/src/internal/shared/dev.js","../node_modules/svelte/src/internal/client/context.js","../node_modules/svelte/src/internal/client/dom/task.js","../node_modules/svelte/src/internal/client/error-handling.js","../node_modules/svelte/src/internal/client/reactivity/status.js","../node_modules/svelte/src/internal/client/reactivity/utils.js","../node_modules/svelte/src/store/utils.js","../node_modules/svelte/src/store/shared/index.js","../node_modules/svelte/src/internal/client/reactivity/store.js","../node_modules/svelte/src/internal/client/reactivity/batch.js","../node_modules/svelte/src/reactivity/create-subscriber.js","../node_modules/svelte/src/internal/client/dom/blocks/boundary.js","../node_modules/svelte/src/internal/client/reactivity/async.js","../node_modules/svelte/src/internal/client/reactivity/deriveds.js","../node_modules/svelte/src/internal/client/reactivity/sources.js","../node_modules/svelte/src/internal/client/proxy.js","../node_modules/svelte/src/internal/client/dev/equality.js","../node_modules/svelte/src/internal/client/dom/operations.js","../node_modules/svelte/src/internal/client/dom/elements/misc.js","../node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js","../node_modules/svelte/src/internal/client/reactivity/effects.js","../node_modules/svelte/src/internal/client/runtime.js","../node_modules/svelte/src/internal/client/dom/elements/events.js","../node_modules/svelte/src/internal/client/dom/reconciler.js","../node_modules/svelte/src/internal/client/dom/template.js","../node_modules/svelte/src/utils.js","../node_modules/svelte/src/internal/client/render.js","../node_modules/svelte/src/internal/client/dom/blocks/branches.js","../node_modules/svelte/src/index-client.js","../node_modules/svelte/src/internal/client/dom/blocks/if.js","../node_modules/svelte/src/internal/client/dom/blocks/each.js","../node_modules/svelte/src/internal/client/dom/blocks/html.js","../node_modules/svelte/src/internal/client/dom/blocks/slot.js","../node_modules/svelte/src/internal/client/dom/blocks/svelte-component.js","../node_modules/svelte/src/internal/client/dom/elements/actions.js","../node_modules/svelte/src/internal/shared/attributes.js","../node_modules/svelte/src/internal/client/dom/elements/class.js","../node_modules/svelte/src/internal/client/dom/elements/style.js","../node_modules/svelte/src/internal/client/dom/elements/bindings/select.js","../node_modules/svelte/src/internal/client/dom/elements/attributes.js","../node_modules/svelte/src/internal/client/dom/elements/bindings/input.js","../node_modules/svelte/src/internal/client/dom/elements/bindings/props.js","../node_modules/svelte/src/internal/client/dom/elements/bindings/this.js","../node_modules/svelte/src/internal/client/dom/legacy/lifecycle.js","../node_modules/svelte/src/internal/client/dom/legacy/misc.js","../node_modules/svelte/src/internal/client/reactivity/props.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/renderSpritesheet.js","../src/formapplications/database/DatabaseStore.js","../src/formapplications/database/DatabaseEntry.svelte","../node_modules/svelte-virtual-scroll-list/dist/virtual.js","../node_modules/svelte-virtual-scroll-list/dist/Item.svelte","../node_modules/svelte-virtual-scroll-list/dist/VirtualScroll.svelte","../src/formapplications/database/database-shell.svelte","../src/formapplications/SvelteMixin.js","../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/lib/filters/mask-filter.js","../src/modules/sequencer-animation-engine.js","../src/utils/flag-manager.js","../src/lib/sound-lib.js","../src/modules/sequencer-paste-manager.js","../src/modules/sequencer-sound-manager.js","../src/modules/sequencer-foundry-replicator.js","../src/modules/sequencer-preloader.js","../src/sockets.js","../src/modules/sequencer-effect-manager.js","../src/canvas-effects/effects-layer.js","../src/lib/filters/vision-sampler-shader.js","../src/lib/meshes/TilingSpriteMesh.js","../src/lib/meshes/AnimatedSpriteMesh.js","../src/canvas-effects/sequencer-sprite-manager.js","../src/modules/sequencer-crosshair/CrosshairsPlaceable.js","../src/utils/plugins-manager.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/components/EffectEntry.svelte","../src/formapplications/components/SoundEntry.svelte","../src/formapplications/effects-ui/Manager.svelte","../src/formapplications/components/actions.svelte.js","../src/formapplications/components/SliderInput.svelte","../src/formapplications/components/Checkbox.svelte","../src/formapplications/components/NumberInput.svelte","../src/formapplications/components/SwitchToggle.svelte","../src/formapplications/effects-ui/Player.svelte","../src/formapplications/components/SequenceStatus.svelte","../src/formapplications/components/SequenceSection.svelte","../src/formapplications/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/batchShader.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/elevation.js","../src/sections/traits/files.js","../src/sections/traits/levels.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/blendMode.js","../src/sections/traits/location.js","../src/sections/traits/offset.js","../src/sections/traits/text.js","../src/sections/traits/name.js","../src/sections/traits/_traits.js","../src/modules/sequencer-crosshair/CrosshairsDocument.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/sections/crosshair.js","../src/modules/sequencer.js","../src/modules/sequencer-section-manager.js","../src/lib/libWrapper/shim.js","../src/libwrapper.js","../src/migrations.js","../src/modules/sequencer-crosshair/TokenCrosshairsDocument.js","../src/modules/sequencer-crosshair/sequencer-crosshair.js","../src/formapplications/dialog/svelte-dialog.svelte","../src/formapplications/dialog/SvelteDialog.js","../node_modules/marked/lib/marked.esm.js","../changelog.md?raw","../src/formapplications/dialog/changelog-dialog.svelte","../src/module.js"],"sourcesContent":["const CONSTANTS = {\n  MODULE_NAME: \"sequencer\",\n  EFFECTS_FLAG_NAME: \"effects\",\n  SOUNDS_FLAG_NAME: \"sounds\",\n\tEFFECTS_LAYER: \"sequencerEffects\",\n\tDATABASE_NAME: \"sequencerDatabase\",\n\tINTERFACE_LAYER: \"sequencerInterfaceLayer\",\n\tIS_V14: false,\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\tPLACEMENT_RESTRICTIONS: {\n\t\tANYWHERE: \"anywhere\",\n\t\tLINE_OF_SIGHT: \"lineOfSight\",\n\t\tNO_COLLIDABLES: \"noCollidables\"\n\t},\n\n\tCALLBACKS: {\n\t\tSHOW: \"show\",\n\t\tMOUSE_MOVE: \"mouseMove\",\n\t\tMOVE: \"move\",\n\t\tCOLLIDE: \"collide\",\n\t\tSTOP_COLLIDING: \"stopColliding\",\n\t\tINVALID_PLACEMENT: \"invalidPlacement\",\n\t\tPLACED: \"placed\",\n\t\tCANCEL: \"cancel\"\n\t},\n\n\t/**\n\t * Map of user-friendly blend mode names to PIXI.BLEND_MODES numeric values.\n\t * Keys are lowercase, alphanumeric, and underscore-tolerant. Multiple aliases\n\t * (e.g. \"soft_light\", \"soft-light\", \"softlight\") are all accepted via the\n\t * normalization in the blendMode trait.\n\t */\n\tBLEND_MODES: {\n\t\tnormal: 0,\n\t\tadd: 1,\n\t\tmultiply: 2,\n\t\tscreen: 3,\n\t\toverlay: 4,\n\t\tdarken: 5,\n\t\tlighten: 6,\n\t\tcolor_dodge: 7,\n\t\tcolor_burn: 8,\n\t\thard_light: 9,\n\t\tsoft_light: 10,\n\t\tdifference: 11,\n\t\texclusion: 12,\n\t\thue: 13,\n\t\tsaturation: 14,\n\t\tcolor: 15,\n\t\tluminosity: 16,\n\t\tnormal_npm: 17,\n\t\tadd_npm: 18,\n\t\tscreen_npm: 19,\n\t\tnone: 20,\n\t\tsubtract: 28,\n\t\terase: 29\n\t},\n\n\t/**\n\t * Blend modes that PIXI v7 exposes by name but does not actually implement.\n\t * Their entries in PIXI's WebGL state table (mapWebGLBlendModesToPixi) are\n\t * aliased to the same [gl.ONE, gl.ONE_MINUS_SRC_ALPHA] pair as NORMAL, so\n\t * the GPU composites them as normal blending. Listed here so the blendMode\n\t * trait can warn the user when one is requested.\n\t */\n\tUNSUPPORTED_BLEND_MODES: new Set([\n\t\t4,  // overlay\n\t\t5,  // darken\n\t\t6,  // lighten\n\t\t7,  // color_dodge\n\t\t8,  // color_burn\n\t\t9,  // hard_light\n\t\t10, // soft_light\n\t\t11, // difference\n\t\t12, // exclusion\n\t\t13, // hue\n\t\t14, // saturation\n\t\t15, // color\n\t\t16  // luminosity\n\t])\n};\n\nCONSTANTS.TOOLS = {\n\tSELECT: `${CONSTANTS.MODULE_NAME}-select-effect`,\n\tPLAY: `${CONSTANTS.MODULE_NAME}-play-effect`,\n\tVIEWER: `${CONSTANTS.MODULE_NAME}-effectviewer`,\n\tDATABASE: `${CONSTANTS.MODULE_NAME}-effectdatabase`\n}\n\nCONSTANTS.EFFECTS_FLAG = `flags.${CONSTANTS.MODULE_NAME}.${CONSTANTS.EFFECTS_FLAG_NAME}`;\nCONSTANTS.REMOVE_EFFECTS_FLAG = `flags.${CONSTANTS.MODULE_NAME}.-=${CONSTANTS.EFFECTS_FLAG_NAME}`;\nCONSTANTS.SOUNDS_FLAG = `flags.${CONSTANTS.MODULE_NAME}.${CONSTANTS.SOUNDS_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\tinFile,\n\t{ applyWildCard = false, softFail = false } = {}\n) {\n\tlet source = \"data\";\n\tconst browseOptions = { wildcard: applyWildCard };\n\n\tif (/\\.s3\\./.test(inFile)) {\n\t\tsource = \"s3\";\n\t\tconst { bucket, keyPrefix } = foundry.utils.parseS3URL(inFile);\n\t\tif (bucket) {\n\t\t\tbrowseOptions.bucket = bucket;\n\t\t\tinFile = keyPrefix;\n\t\t}\n\t}\n\n\ttry {\n\t\treturn (await foundry.applications.apps.FilePicker.implementation.browse(source, inFile, browseOptions)).files;\n\t} catch (err) {\n\t\tif (softFail) return false;\n\t\tthrow custom_error(\"Sequencer\", `getFiles | ${err}`);\n\t}\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\tconst easeFunction = is_function(ease) ? ease : easeFunctions[ease];\n\treturn 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\tconst random = twister ? twister.random() : Math.random();\n\tconst _max = Math.max(max, min);\n\tconst _min = Math.min(max, min);\n\treturn 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\treturn Math.floor(random_float_between(min, max, twister));\n}\n\nexport function flip_negate(num_1, num_2) {\n\tif (num_1 > 0) {\n\t\tnum_1 -= num_2;\n\t} else {\n\t\tnum_1 += num_2;\n\t}\n\treturn num_1;\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\tlet shuffled = [...inArray];\n\tconst randomMethod = twister?.random ?? Math.random;\n\tfor (let i = shuffled.length - 1; i > 0; i--) {\n\t\tlet j = Math.floor(randomMethod() * (i + 1));\n\t\tlet temp = shuffled[i];\n\t\tshuffled[i] = shuffled[j];\n\t\tshuffled[j] = temp;\n\t}\n\treturn 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\treturn (\n\t\tinFunc &&\n\t\t({}.toString.call(inFunc) === \"[object Function]\" ||\n\t\t\t{}.toString.call(inFunc) === \"[object AsyncFunction]\")\n\t);\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\tinArray,\n\t{ recurse = false, twister = false, index = false } = {}\n) {\n\tconst chosenIndex = random_int_between(0, inArray.length, twister);\n\tlet choice = inArray[chosenIndex];\n\tif (recurse && Array.isArray(choice)) {\n\t\treturn random_array_element(choice, { recurse, twister, index });\n\t}\n\tif (index) {\n\t\treturn chosenIndex;\n\t}\n\treturn 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\tinObject,\n\t{ recurse = false, twister = false } = {}\n) {\n\tlet keys = Object.keys(inObject).filter((k) => !k.startsWith(\"_\"));\n\tlet choice = inObject[random_array_element(keys, { twister })];\n\tif (typeof choice === \"object\" && recurse) {\n\t\treturn random_object_element(choice, { recurse: true });\n\t}\n\treturn 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\treturn !isNaN(inNumber) && typeof inNumber === \"number\" && isFinite(inNumber);\n}\n\n/**\n *  Coerces a number between 0 and 1\n *\n * @param  {any}        inNumber    The parameter to test\n * @return {number | undefined}     Number normalized between 0 and 1, or undefined if inNumber is NaN\n */\nexport function normalize_alpha_number(inNumber) {\n\tif (!is_real_number(inNumber)) return undefined;\n\n\tinNumber = Math.abs(inNumber);\n\twhile (inNumber > 1) inNumber /= 10;\n\treturn 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\tif (!Array.isArray(path)) path = path.split(\".\");\n\ttry {\n\t\tlet i;\n\t\tfor (i = 0; i < path.length - 1; i++) {\n\t\t\tobj = obj[path[i]];\n\t\t}\n\t\treturn obj[path[i]];\n\t} catch (err) {\n\t}\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\tif (!Array.isArray(path)) path = path.split(\".\");\n\ttry {\n\t\tlet i;\n\t\tfor (i = 0; i < path.length - 1; i++) {\n\t\t\tobj = obj[path[i]];\n\t\t}\n\t\tif (is_function(obj[path[i]])) {\n\t\t\tobj[path[i]](value);\n\t\t} else {\n\t\t\tobj[path[i]] = value;\n\t\t}\n\t} catch (err) {\n\t}\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\tlet toReturn = [];\n\tfor (let i in obj) {\n\t\tif (i.startsWith(\"_\")) continue;\n\t\tif (!obj.hasOwnProperty(i)) continue;\n\t\tif (typeof obj[i] == \"object\") {\n\t\t\tlet flatObject = flatten_object(obj[i]);\n\t\t\tfor (let x in flatObject) {\n\t\t\t\tif (!flatObject.hasOwnProperty(x)) continue;\n\t\t\t\ttoReturn[i + \".\" + x] = flatObject[x];\n\t\t\t}\n\t\t} else {\n\t\t\ttoReturn[i] = obj[i];\n\t\t}\n\t}\n\treturn 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\treturn 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\tconst _max = Math.max(min, max);\n\tconst _min = Math.min(min, max);\n\treturn 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\treturn (\n\t\ttypeof inId === \"string\" &&\n\t\t(inId.startsWith(\"Scene\") ||\n\t\t\tinId.startsWith(\"Actor\") ||\n\t\t\tinId.startsWith(\"Item\")) &&\n\t\t(inId.match(/\\./g) || []).length &&\n\t\t!inId.endsWith(\".\")\n\t);\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\tinObjectId,\n\tinSceneId = game.user.viewedScene\n) {\n\tlet tryUUID = is_UUID(inObjectId);\n\tif (tryUUID) {\n\t\tconst obj = fromUuidSync(inObjectId);\n\t\tif (obj) return obj;\n\t\ttryUUID = false;\n\t}\n\tconst allDocs = get_all_documents_from_scene(inSceneId);\n\treturn allDocs.find((obj) => {\n\t\treturn get_object_identifier(obj, tryUUID) === inObjectId;\n\t});\n}\n\n/**\n * Gets all documents from the given scene\n *\n * @param {Boolean/String} inSceneId\n * @returns {Array<Document>}\n */\nexport function get_all_documents_from_scene(inSceneId = false) {\n\tconst scene = inSceneId\n\t\t? game.scenes.get(inSceneId)\n\t\t: game.scenes.get(game.user?.viewedScene);\n\tif (!scene) return [];\n\treturn [\n\t\t...canvas.layers.map(layer => layer?.children ?? [].concat(layer?.preview?.children ?? [])),\n\t\t...Array.from(scene?.tokens ?? []),\n\t\t...Array.from(scene?.lights ?? []),\n\t\t...Array.from(scene?.sounds ?? []),\n\t\t...Array.from(scene?.regions ?? []),\n\t\t...Array.from(scene?.tiles ?? []),\n\t\t...Array.from(scene?.walls ?? []),\n\t\t...Array.from(scene?.drawings ?? []),\n\t]\n\t\t.deepFlatten()\n\t\t.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\tconst document = inObject?.document ?? inObject;\n\treturn 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\tconst uuid = tryUUID && is_UUID(inObject?.uuid) ? inObject?.uuid : undefined;\n\treturn (\n\t\tuuid ??\n\t\tinObject?.id ??\n\t\tinObject?.document?.name ??\n\t\tinObject?.name ??\n\t\t(inObject?.tag !== \"\" ? inObject?.tag : undefined) ??\n\t\t(inObject?.label !== \"\" ? inObject?.label : undefined) ??\n\t\tinObject?.sound_id\n\t);\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\treturn Array.from(new Set(inArray));\n}\n\nexport function debug(msg, args = \"\") {\n\tif (game.settings.get(CONSTANTS.MODULE_NAME, \"debug\"))\n\t\tconsole.log(`DEBUG | Sequencer | ${msg}`, args);\n}\n\nexport function debug_error(msg, args) {\n\tif (game.settings.get(CONSTANTS.MODULE_NAME, \"debug\"))\n\t\tconsole.error(`DEBUG | Sequencer | ${msg}`, args);\n}\n\nexport function custom_warning(inClassName, warning, notify = false) {\n\tinClassName =\n\t\tinClassName !== \"Sequencer\"\n\t\t\t? \"Sequencer | Module: \" + inClassName\n\t\t\t: inClassName;\n\twarning = `${inClassName} | ${warning}`;\n\tif (notify) ui.notifications.warn(warning, { console: false });\n\tconsole.warn(warning.replace(\"<br>\", \"\\n\"));\n}\n\nconst throttledWarnings = {};\n\nexport function throttled_custom_warning(\n\tinClassName,\n\twarning,\n\tdelay = 10000,\n\tnotify = false\n) {\n\tinClassName =\n\t\tinClassName !== \"Sequencer\"\n\t\t\t? \"Sequencer | Module: \" + inClassName\n\t\t\t: inClassName;\n\twarning = `${inClassName} | ${warning}`;\n\tif (throttledWarnings[warning]) return;\n\tthrottledWarnings[warning] = true;\n\tif (notify) ui.notifications.warn(warning, { console: false });\n\tconsole.warn(warning.replace(\"<br>\", \"\\n\"));\n\tsetTimeout(() => {\n\t\tdelete throttledWarnings[warning];\n\t}, delay);\n}\n\nexport function custom_error(inClassName, error) {\n\tinClassName =\n\t\tinClassName !== \"Sequencer\"\n\t\t\t? \"Sequencer | Module: \" + inClassName\n\t\t\t: inClassName;\n\terror = `${inClassName} | ${error}`;\n\tui.notifications.error(error, { console: false });\n\treturn new Error(error.replace(\"<br>\", \"\\n\"));\n}\n\nexport function user_can_do(inSetting) {\n\treturn game.user.role > game.settings.get(CONSTANTS.MODULE_NAME, inSetting);\n}\n\nexport function group_by(xs, key) {\n\treturn xs.reduce(function (acc, obj) {\n\t\tlet property = foundry.utils.getProperty(obj, key);\n\t\tacc[property] = acc[property] || [];\n\t\tacc[property].push(obj);\n\t\treturn acc;\n\t}, {});\n}\n\nfunction objHasProperty(obj, prop) {\n\treturn obj.constructor.prototype.hasOwnProperty(prop);\n}\n\nexport function sequence_proxy_wrap(inSequence) {\n\treturn new Proxy(inSequence, {\n\t\tget: function (target, prop) {\n\t\t\tif (!objHasProperty(target, prop)) {\n\t\t\t\tif (Sequencer.SectionManager.externalSections[prop] === undefined) {\n\t\t\t\t\tconst section = target.sections[target.sections.length - 1];\n\t\t\t\t\tif (section && objHasProperty(section, prop)) {\n\t\t\t\t\t\tconst targetProperty = Reflect.get(section, prop);\n\t\t\t\t\t\treturn is_function(targetProperty)\n\t\t\t\t\t\t\t? targetProperty.bind(section)\n\t\t\t\t\t\t\t: targetProperty;\n\t\t\t\t\t}\n\t\t\t\t\treturn Reflect.get(target, prop);\n\t\t\t\t}\n\t\t\t\ttarget.sectionToCreate =\n\t\t\t\t\tSequencer.SectionManager.externalSections[prop];\n\t\t\t\treturn Reflect.get(target, \"_createCustomSection\");\n\t\t\t}\n\t\t\treturn Reflect.get(target, prop);\n\t\t},\n\t});\n}\n\nexport function section_proxy_wrap(inClass) {\n\treturn new Proxy(inClass, {\n\t\tget: function (target, prop) {\n\t\t\tif (\n\t\t\t\t!objHasProperty(target, prop) &&\n\t\t\t\tobjHasProperty(target.sequence, prop)\n\t\t\t) {\n\t\t\t\tconst targetProperty = Reflect.get(target.sequence, prop);\n\t\t\t\treturn is_function(targetProperty)\n\t\t\t\t\t? targetProperty.bind(target.sequence)\n\t\t\t\t\t: targetProperty;\n\t\t\t}\n\t\t\treturn Reflect.get(target, prop);\n\t\t},\n\t});\n}\n\nexport function str_to_search_regex_str(str) {\n\treturn str\n\t\t.trim()\n\t\t.replace(/[.+?^${}()|[\\]\\\\]/g, '\\\\$&')\n\t\t.replace(/\\*+/g, \".*?\");\n}\n\nexport function safe_str(str) {\n\treturn str.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\");\n}\n\nexport function get_hash(input) {\n\tlet hash = 0;\n\tconst len = input.length;\n\tfor (let i = 0; i < len; i++) {\n\t\thash = (hash << 5) - hash + input.charCodeAt(i);\n\t\thash |= 0; // to 32bit integer\n\t}\n\treturn hash;\n}\n\nexport function parseColor(inColor) {\n\treturn {\n\t\thexadecimal: is_real_number(inColor) ? inColor.toString(16) : inColor,\n\t\tdecimal:\n\t\t\ttypeof inColor === \"string\" && inColor.startsWith(\"#\")\n\t\t\t\t? parseInt(inColor.slice(1), 16)\n\t\t\t\t: inColor,\n\t};\n}\n\nexport function getCanvasMouse() {\n\treturn canvas?.app?.renderer?.events?.pointer ?? canvas?.app?.renderer?.plugins?.interaction?.pointer;\n}\n\nexport function createMersenneTwister(seed) {\n\tconst twister = foundry?.dice?.MersenneTwister ?? MersenneTwister;\n\treturn new twister(seed);\n}\n\nexport async function createJournalDatabase(){\n\tlet database = game.journal.getName(CONSTANTS.DATABASE_NAME);\n\tif(!database) {\n\t\tdatabase = await JournalEntry.create({\n\t\t\tname: CONSTANTS.DATABASE_NAME,\n\t\t\t\"ownership.default\": CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER\n\t\t});\n\t}\n\treturn database;\n}\n\nexport function forceDeletionKeyWrapper(updateObj, key){\n\tif(CONSTANTS.IS_V14){\n\t\tupdateObj[key.replaceAll(\"-=\", \"\")] = new foundry.data.operators.ForcedDeletion();\n\t}else {\n\t\tupdateObj[key] = null;\n\t}\n}","// generated during release, do not modify\n\n/**\n * The current version, as set in package.json.\n * @type {string}\n */\nexport const VERSION = '5.55.5';\nexport const PUBLIC_VERSION = '5';\n","import { PUBLIC_VERSION } from '../version.js';\n\nif (typeof window !== 'undefined') {\n\t// @ts-expect-error\n\t((window.__svelte ??= {}).v ??= new Set()).add(PUBLIC_VERSION);\n}\n","/** True if experimental.async=true */\nexport let async_mode_flag = false;\n/** True if we're not certain that we only have Svelte 5 code in the compilation */\nexport let legacy_mode_flag = false;\n/** True if $inspect.trace is used */\nexport let tracing_mode_flag = false;\n\nexport function enable_async_mode_flag() {\n\tasync_mode_flag = true;\n}\n\n/** ONLY USE THIS DURING TESTING */\nexport function disable_async_mode_flag() {\n\tasync_mode_flag = false;\n}\n\nexport function enable_legacy_mode_flag() {\n\tlegacy_mode_flag = true;\n}\n\nexport function enable_tracing_mode_flag() {\n\ttracing_mode_flag = true;\n}\n","import { enable_legacy_mode_flag } from './index.js';\n\nenable_legacy_mode_flag();\n","export const EACH_ITEM_REACTIVE = 1;\nexport const EACH_INDEX_REACTIVE = 1 << 1;\n/** See EachBlock interface metadata.is_controlled for an explanation what this is */\nexport const EACH_IS_CONTROLLED = 1 << 2;\nexport const EACH_IS_ANIMATED = 1 << 3;\nexport const EACH_ITEM_IMMUTABLE = 1 << 4;\n\nexport const PROPS_IS_IMMUTABLE = 1;\nexport const PROPS_IS_RUNES = 1 << 1;\nexport const PROPS_IS_UPDATED = 1 << 2;\nexport const PROPS_IS_BINDABLE = 1 << 3;\nexport const PROPS_IS_LAZY_INITIAL = 1 << 4;\n\nexport const TRANSITION_IN = 1;\nexport const TRANSITION_OUT = 1 << 1;\nexport const TRANSITION_GLOBAL = 1 << 2;\n\nexport const TEMPLATE_FRAGMENT = 1;\nexport const TEMPLATE_USE_IMPORT_NODE = 1 << 1;\nexport const TEMPLATE_USE_SVG = 1 << 2;\nexport const TEMPLATE_USE_MATHML = 1 << 3;\n\nexport const HYDRATION_START = '[';\n/** used to indicate that an `{:else}...` block was rendered */\nexport const HYDRATION_START_ELSE = '[!';\n/** used to indicate that a boundary's `failed` snippet was rendered on the server */\nexport const HYDRATION_START_FAILED = '[?';\nexport const HYDRATION_END = ']';\nexport const HYDRATION_ERROR = {};\n\nexport const ELEMENT_IS_NAMESPACED = 1;\nexport const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;\nexport const ELEMENT_IS_INPUT = 1 << 2;\n\nexport const UNINITIALIZED = Symbol();\n\n// Dev-time component properties\nexport const FILENAME = Symbol('filename');\nexport const HMR = Symbol('hmr');\n\nexport const NAMESPACE_HTML = 'http://www.w3.org/1999/xhtml';\nexport const NAMESPACE_SVG = 'http://www.w3.org/2000/svg';\nexport const NAMESPACE_MATHML = 'http://www.w3.org/1998/Math/MathML';\n\n// we use a list of ignorable runtime warnings because not every runtime warning\n// can be ignored and we want to keep the validation for svelte-ignore in place\nexport const IGNORABLE_RUNTIME_WARNINGS = /** @type {const} */ ([\n\t'await_waterfall',\n\t'await_reactivity_loss',\n\t'state_snapshot_uncloneable',\n\t'binding_property_non_reactive',\n\t'hydration_attribute_changed',\n\t'hydration_html_changed',\n\t'ownership_invalid_binding',\n\t'ownership_invalid_mutation'\n]);\n\n/**\n * Whitespace inside one of these elements will not result in\n * a whitespace node being created in any circumstances. (This\n * list is almost certainly very incomplete)\n * TODO this is currently unused\n */\nexport const ELEMENTS_WITHOUT_TEXT = ['audio', 'datalist', 'dl', 'optgroup', 'select', 'video'];\n\nexport const ATTACHMENT_KEY = '@attach';\n","const node_env = globalThis.process?.env?.NODE_ENV;\nexport default node_env && !node_env.toLowerCase().startsWith('prod');\n","// Store the references to globals in case someone tries to monkey patch these, causing the below\n// to de-opt (this occurs often when using popular extensions).\nexport var is_array = Array.isArray;\nexport var index_of = Array.prototype.indexOf;\nexport var includes = Array.prototype.includes;\nexport var array_from = Array.from;\nexport var object_keys = Object.keys;\nexport var define_property = Object.defineProperty;\nexport var get_descriptor = Object.getOwnPropertyDescriptor;\nexport var get_descriptors = Object.getOwnPropertyDescriptors;\nexport var object_prototype = Object.prototype;\nexport var array_prototype = Array.prototype;\nexport var get_prototype_of = Object.getPrototypeOf;\nexport var is_extensible = Object.isExtensible;\nexport var has_own_property = Object.prototype.hasOwnProperty;\n\n/**\n * @param {any} thing\n * @returns {thing is Function}\n */\nexport function is_function(thing) {\n\treturn typeof thing === 'function';\n}\n\nexport const noop = () => {};\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\n\n/**\n * @template [T=any]\n * @param {any} value\n * @returns {value is PromiseLike<T>}\n */\nexport function is_promise(value) {\n\treturn typeof value?.then === 'function';\n}\n\n/** @param {Function} fn */\nexport function run(fn) {\n\treturn fn();\n}\n\n/** @param {Array<() => void>} arr */\nexport function run_all(arr) {\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tarr[i]();\n\t}\n}\n\n/**\n * TODO replace with Promise.withResolvers once supported widely enough\n * @template [T=void]\n */\nexport function deferred() {\n\t/** @type {(value: T) => void} */\n\tvar resolve;\n\n\t/** @type {(reason: any) => void} */\n\tvar reject;\n\n\t/** @type {Promise<T>} */\n\tvar promise = new Promise((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\n\t// @ts-expect-error\n\treturn { promise, resolve, reject };\n}\n\n/**\n * @template V\n * @param {V} value\n * @param {V | (() => V)} fallback\n * @param {boolean} [lazy]\n * @returns {V}\n */\nexport function fallback(value, fallback, lazy = false) {\n\treturn value === undefined\n\t\t? lazy\n\t\t\t? /** @type {() => V} */ (fallback)()\n\t\t\t: /** @type {V} */ (fallback)\n\t\t: value;\n}\n\n/**\n * When encountering a situation like `let [a, b, c] = $derived(blah())`,\n * we need to stash an intermediate value that `a`, `b`, and `c` derive\n * from, in case it's an iterable\n * @template T\n * @param {ArrayLike<T> | Iterable<T>} value\n * @param {number} [n]\n * @returns {Array<T>}\n */\nexport function to_array(value, n) {\n\t// return arrays unchanged\n\tif (Array.isArray(value)) {\n\t\treturn value;\n\t}\n\n\t// if value is not iterable, or `n` is unspecified (indicates a rest\n\t// element, which means we're not concerned about unbounded iterables)\n\t// convert to an array with `Array.from`\n\tif (n === undefined || !(Symbol.iterator in value)) {\n\t\treturn Array.from(value);\n\t}\n\n\t// otherwise, populate an array with `n` values\n\n\t/** @type {T[]} */\n\tconst array = [];\n\n\tfor (const element of value) {\n\t\tarray.push(element);\n\t\tif (array.length === n) break;\n\t}\n\n\treturn array;\n}\n\n/**\n * @param {Record<string | symbol, unknown>} obj\n * @param {Array<string | symbol>} keys\n * @returns {Record<string | symbol, unknown>}\n */\nexport function exclude_from_object(obj, keys) {\n\t/** @type {Record<string | symbol, unknown>} */\n\tvar result = {};\n\n\tfor (var key in obj) {\n\t\tif (!keys.includes(key)) {\n\t\t\tresult[key] = obj[key];\n\t\t}\n\t}\n\n\tfor (var symbol of Object.getOwnPropertySymbols(obj)) {\n\t\tif (Object.propertyIsEnumerable.call(obj, symbol) && !keys.includes(symbol)) {\n\t\t\tresult[symbol] = obj[symbol];\n\t\t}\n\t}\n\n\treturn result;\n}\n","// General flags\nexport const DERIVED = 1 << 1;\nexport const EFFECT = 1 << 2;\nexport const RENDER_EFFECT = 1 << 3;\n/**\n * An effect that does not destroy its child effects when it reruns.\n * Runs as part of render effects, i.e. not eagerly as part of tree traversal or effect flushing.\n */\nexport const MANAGED_EFFECT = 1 << 24;\n/**\n * An effect that does not destroy its child effects when it reruns (like MANAGED_EFFECT).\n * Runs eagerly as part of tree traversal or effect flushing.\n */\nexport const BLOCK_EFFECT = 1 << 4;\nexport const BRANCH_EFFECT = 1 << 5;\nexport const ROOT_EFFECT = 1 << 6;\nexport const BOUNDARY_EFFECT = 1 << 7;\n/**\n * Indicates that a reaction is connected to an effect root — either it is an effect,\n * or it is a derived that is depended on by at least one effect. If a derived has\n * no dependents, we can disconnect it from the graph, allowing it to either be\n * GC'd or reconnected later if an effect comes to depend on it again\n */\nexport const CONNECTED = 1 << 9;\nexport const CLEAN = 1 << 10;\nexport const DIRTY = 1 << 11;\nexport const MAYBE_DIRTY = 1 << 12;\nexport const INERT = 1 << 13;\nexport const DESTROYED = 1 << 14;\n/** Set once a reaction has run for the first time */\nexport const REACTION_RAN = 1 << 15;\n/** Effect is in the process of getting destroyed. Can be observed in child teardown functions */\nexport const DESTROYING = 1 << 25;\n\n// Flags exclusive to effects\n/**\n * 'Transparent' effects do not create a transition boundary.\n * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned\n */\nexport const EFFECT_TRANSPARENT = 1 << 16;\nexport const EAGER_EFFECT = 1 << 17;\nexport const HEAD_EFFECT = 1 << 18;\nexport const EFFECT_PRESERVED = 1 << 19;\nexport const USER_EFFECT = 1 << 20;\nexport const EFFECT_OFFSCREEN = 1 << 25;\n\n// Flags exclusive to deriveds\n/**\n * Tells that we marked this derived and its reactions as visited during the \"mark as (maybe) dirty\"-phase.\n * Will be lifted during execution of the derived and during checking its dirty state (both are necessary\n * because a derived might be checked but not executed). This is a pure performance optimization flag and\n * should not be used for any other purpose!\n */\nexport const WAS_MARKED = 1 << 16;\n\n// Flags used for async\nexport const REACTION_IS_UPDATING = 1 << 21;\nexport const ASYNC = 1 << 22;\n\nexport const ERROR_VALUE = 1 << 23;\n\nexport const STATE_SYMBOL = Symbol('$state');\nexport const LEGACY_PROPS = Symbol('legacy props');\nexport const LOADING_ATTR_SYMBOL = Symbol('');\nexport const PROXY_PATH_SYMBOL = Symbol('proxy path');\n/** An anchor might change, via this symbol on the original anchor we can tell HMR about the updated anchor */\nexport const HMR_ANCHOR = Symbol('hmr anchor');\n\n/** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */\nexport const STALE_REACTION = new (class StaleReactionError extends Error {\n\tname = 'StaleReactionError';\n\tmessage = 'The reaction that called `getAbortSignal()` was re-run or destroyed';\n})();\n\nexport const IS_XHTML =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\t!!globalThis.document?.contentType &&\n\t/* @__PURE__ */ globalThis.document.contentType.includes('xml');\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const COMMENT_NODE = 8;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\n","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\n/**\n * Cannot use `%name%(...)` unless the `experimental.async` compiler option is `true`\n * @param {string} name\n * @returns {never}\n */\nexport function experimental_async_required(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`experimental_async_required\\nCannot use \\`${name}(...)\\` unless the \\`experimental.async\\` compiler option is \\`true\\`\\nhttps://svelte.dev/e/experimental_async_required`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/experimental_async_required`);\n\t}\n}\n\n/**\n * Cannot use `{@render children(...)}` if the parent component uses `let:` directives. Consider using a named snippet instead\n * @returns {never}\n */\nexport function invalid_default_snippet() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_default_snippet\\nCannot use \\`{@render children(...)}\\` if the parent component uses \\`let:\\` directives. Consider using a named snippet instead\\nhttps://svelte.dev/e/invalid_default_snippet`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_default_snippet`);\n\t}\n}\n\n/**\n * A snippet function was passed invalid arguments. Snippets should only be instantiated via `{@render ...}`\n * @returns {never}\n */\nexport function invalid_snippet_arguments() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_snippet_arguments\\nA snippet function was passed invalid arguments. Snippets should only be instantiated via \\`{@render ...}\\`\\nhttps://svelte.dev/e/invalid_snippet_arguments`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_snippet_arguments`);\n\t}\n}\n\n/**\n * An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: \"%message%\"\n * @param {string} message\n * @returns {never}\n */\nexport function invariant_violation(message) {\n\tif (DEV) {\n\t\tconst error = new Error(`invariant_violation\\nAn invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: \"${message}\"\\nhttps://svelte.dev/e/invariant_violation`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invariant_violation`);\n\t}\n}\n\n/**\n * `%name%(...)` can only be used during component initialisation\n * @param {string} name\n * @returns {never}\n */\nexport function lifecycle_outside_component(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`lifecycle_outside_component\\n\\`${name}(...)\\` can only be used during component initialisation\\nhttps://svelte.dev/e/lifecycle_outside_component`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/lifecycle_outside_component`);\n\t}\n}\n\n/**\n * Context was not set in a parent component\n * @returns {never}\n */\nexport function missing_context() {\n\tif (DEV) {\n\t\tconst error = new Error(`missing_context\\nContext was not set in a parent component\\nhttps://svelte.dev/e/missing_context`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/missing_context`);\n\t}\n}\n\n/**\n * Attempted to render a snippet without a `{@render}` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change `{snippet}` to `{@render snippet()}`.\n * @returns {never}\n */\nexport function snippet_without_render_tag() {\n\tif (DEV) {\n\t\tconst error = new Error(`snippet_without_render_tag\\nAttempted to render a snippet without a \\`{@render}\\` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change \\`{snippet}\\` to \\`{@render snippet()}\\`.\\nhttps://svelte.dev/e/snippet_without_render_tag`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/snippet_without_render_tag`);\n\t}\n}\n\n/**\n * `%name%` is not a store with a `subscribe` method\n * @param {string} name\n * @returns {never}\n */\nexport function store_invalid_shape(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`store_invalid_shape\\n\\`${name}\\` is not a store with a \\`subscribe\\` method\\nhttps://svelte.dev/e/store_invalid_shape`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/store_invalid_shape`);\n\t}\n}\n\n/**\n * The `this` prop on `<svelte:element>` must be a string, if defined\n * @returns {never}\n */\nexport function svelte_element_invalid_this_value() {\n\tif (DEV) {\n\t\tconst error = new Error(`svelte_element_invalid_this_value\\nThe \\`this\\` prop on \\`<svelte:element>\\` must be a string, if defined\\nhttps://svelte.dev/e/svelte_element_invalid_this_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/svelte_element_invalid_this_value`);\n\t}\n}","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nexport *  from '../shared/errors.js';\n\n/**\n * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree\n * @returns {never}\n */\nexport function async_derived_orphan() {\n\tif (DEV) {\n\t\tconst error = new Error(`async_derived_orphan\\nCannot create a \\`$derived(...)\\` with an \\`await\\` expression outside of an effect tree\\nhttps://svelte.dev/e/async_derived_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/async_derived_orphan`);\n\t}\n}\n\n/**\n * Using `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\n * @returns {never}\n */\nexport function bind_invalid_checkbox_value() {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_checkbox_value\\nUsing \\`bind:value\\` together with a checkbox input is not allowed. Use \\`bind:checked\\` instead\\nhttps://svelte.dev/e/bind_invalid_checkbox_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_checkbox_value`);\n\t}\n}\n\n/**\n * Component %component% has an export named `%key%` that a consumer component is trying to access using `bind:%key%`, which is disallowed. Instead, use `bind:this` (e.g. `<%name% bind:this={component} />`) and then access the property on the bound component instance (e.g. `component.%key%`)\n * @param {string} component\n * @param {string} key\n * @param {string} name\n * @returns {never}\n */\nexport function bind_invalid_export(component, key, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_export\\nComponent ${component} has an export named \\`${key}\\` that a consumer component is trying to access using \\`bind:${key}\\`, which is disallowed. Instead, use \\`bind:this\\` (e.g. \\`<${name} bind:this={component} />\\`) and then access the property on the bound component instance (e.g. \\`component.${key}\\`)\\nhttps://svelte.dev/e/bind_invalid_export`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_export`);\n\t}\n}\n\n/**\n * A component is attempting to bind to a non-bindable property `%key%` belonging to %component% (i.e. `<%name% bind:%key%={...}>`). To mark a property as bindable: `let { %key% = $bindable() } = $props()`\n * @param {string} key\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function bind_not_bindable(key, component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_not_bindable\\nA component is attempting to bind to a non-bindable property \\`${key}\\` belonging to ${component} (i.e. \\`<${name} bind:${key}={...}>\\`). To mark a property as bindable: \\`let { ${key} = $bindable() } = $props()\\`\\nhttps://svelte.dev/e/bind_not_bindable`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_not_bindable`);\n\t}\n}\n\n/**\n * Calling `%method%` on a component instance (of %component%) is no longer valid in Svelte 5\n * @param {string} method\n * @param {string} component\n * @returns {never}\n */\nexport function component_api_changed(method, component) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_changed\\nCalling \\`${method}\\` on a component instance (of ${component}) is no longer valid in Svelte 5\\nhttps://svelte.dev/e/component_api_changed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_changed`);\n\t}\n}\n\n/**\n * Attempted to instantiate %component% with `new %name%`, which is no longer valid in Svelte 5. If this component is not under your control, set the `compatibility.componentApi` compiler option to `4` to keep it working.\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function component_api_invalid_new(component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_invalid_new\\nAttempted to instantiate ${component} with \\`new ${name}\\`, which is no longer valid in Svelte 5. If this component is not under your control, set the \\`compatibility.componentApi\\` compiler option to \\`4\\` to keep it working.\\nhttps://svelte.dev/e/component_api_invalid_new`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_invalid_new`);\n\t}\n}\n\n/**\n * A derived value cannot reference itself recursively\n * @returns {never}\n */\nexport function derived_references_self() {\n\tif (DEV) {\n\t\tconst error = new Error(`derived_references_self\\nA derived value cannot reference itself recursively\\nhttps://svelte.dev/e/derived_references_self`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/derived_references_self`);\n\t}\n}\n\n/**\n * Keyed each block has duplicate key `%value%` at indexes %a% and %b%\n * @param {string} a\n * @param {string} b\n * @param {string | undefined | null} [value]\n * @returns {never}\n */\nexport function each_key_duplicate(a, b, value) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_duplicate\\n${value\n\t\t\t? `Keyed each block has duplicate key \\`${value}\\` at indexes ${a} and ${b}`\n\t\t\t: `Keyed each block has duplicate key at indexes ${a} and ${b}`}\\nhttps://svelte.dev/e/each_key_duplicate`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_duplicate`);\n\t}\n}\n\n/**\n * Keyed each block has key that is not idempotent — the key for item at index %index% was `%a%` but is now `%b%`. Keys must be the same each time for a given item\n * @param {string} index\n * @param {string} a\n * @param {string} b\n * @returns {never}\n */\nexport function each_key_volatile(index, a, b) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_volatile\\nKeyed each block has key that is not idempotent — the key for item at index ${index} was \\`${a}\\` but is now \\`${b}\\`. Keys must be the same each time for a given item\\nhttps://svelte.dev/e/each_key_volatile`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_volatile`);\n\t}\n}\n\n/**\n * `%rune%` cannot be used inside an effect cleanup function\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_in_teardown(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_teardown\\n\\`${rune}\\` cannot be used inside an effect cleanup function\\nhttps://svelte.dev/e/effect_in_teardown`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_teardown`);\n\t}\n}\n\n/**\n * Effect cannot be created inside a `$derived` value that was not itself created inside an effect\n * @returns {never}\n */\nexport function effect_in_unowned_derived() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_unowned_derived\\nEffect cannot be created inside a \\`$derived\\` value that was not itself created inside an effect\\nhttps://svelte.dev/e/effect_in_unowned_derived`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_unowned_derived`);\n\t}\n}\n\n/**\n * `%rune%` can only be used inside an effect (e.g. during component initialisation)\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_orphan(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_orphan\\n\\`${rune}\\` can only be used inside an effect (e.g. during component initialisation)\\nhttps://svelte.dev/e/effect_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_orphan`);\n\t}\n}\n\n/**\n * `$effect.pending()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function effect_pending_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_pending_outside_reaction\\n\\`$effect.pending()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/effect_pending_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_pending_outside_reaction`);\n\t}\n}\n\n/**\n * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\n * @returns {never}\n */\nexport function effect_update_depth_exceeded() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_update_depth_exceeded\\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\\nhttps://svelte.dev/e/effect_update_depth_exceeded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);\n\t}\n}\n\n/**\n * Cannot use `flushSync` inside an effect\n * @returns {never}\n */\nexport function flush_sync_in_effect() {\n\tif (DEV) {\n\t\tconst error = new Error(`flush_sync_in_effect\\nCannot use \\`flushSync\\` inside an effect\\nhttps://svelte.dev/e/flush_sync_in_effect`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/flush_sync_in_effect`);\n\t}\n}\n\n/**\n * Cannot commit a fork that was already discarded\n * @returns {never}\n */\nexport function fork_discarded() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_discarded\\nCannot commit a fork that was already discarded\\nhttps://svelte.dev/e/fork_discarded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_discarded`);\n\t}\n}\n\n/**\n * Cannot create a fork inside an effect or when state changes are pending\n * @returns {never}\n */\nexport function fork_timing() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_timing\\nCannot create a fork inside an effect or when state changes are pending\\nhttps://svelte.dev/e/fork_timing`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_timing`);\n\t}\n}\n\n/**\n * `getAbortSignal()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function get_abort_signal_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`get_abort_signal_outside_reaction\\n\\`getAbortSignal()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/get_abort_signal_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/get_abort_signal_outside_reaction`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n * @returns {never}\n */\nexport function hydratable_missing_but_required(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`hydratable_missing_but_required\\nExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_required`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydratable_missing_but_required`);\n\t}\n}\n\n/**\n * Failed to hydrate the application\n * @returns {never}\n */\nexport function hydration_failed() {\n\tif (DEV) {\n\t\tconst error = new Error(`hydration_failed\\nFailed to hydrate the application\\nhttps://svelte.dev/e/hydration_failed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydration_failed`);\n\t}\n}\n\n/**\n * Could not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\n * @returns {never}\n */\nexport function invalid_snippet() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_snippet\\nCould not \\`{@render}\\` snippet due to the expression being \\`null\\` or \\`undefined\\`. Consider using optional chaining \\`{@render snippet?.()}\\`\\nhttps://svelte.dev/e/invalid_snippet`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_snippet`);\n\t}\n}\n\n/**\n * `%name%(...)` cannot be used in runes mode\n * @param {string} name\n * @returns {never}\n */\nexport function lifecycle_legacy_only(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`lifecycle_legacy_only\\n\\`${name}(...)\\` cannot be used in runes mode\\nhttps://svelte.dev/e/lifecycle_legacy_only`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/lifecycle_legacy_only`);\n\t}\n}\n\n/**\n * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value\n * @param {string} key\n * @returns {never}\n */\nexport function props_invalid_value(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_invalid_value\\nCannot do \\`bind:${key}={undefined}\\` when \\`${key}\\` has a fallback value\\nhttps://svelte.dev/e/props_invalid_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_invalid_value`);\n\t}\n}\n\n/**\n * Rest element properties of `$props()` such as `%property%` are readonly\n * @param {string} property\n * @returns {never}\n */\nexport function props_rest_readonly(property) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_rest_readonly\\nRest element properties of \\`$props()\\` such as \\`${property}\\` are readonly\\nhttps://svelte.dev/e/props_rest_readonly`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_rest_readonly`);\n\t}\n}\n\n/**\n * The `%rune%` rune is only available inside `.svelte` and `.svelte.js/ts` files\n * @param {string} rune\n * @returns {never}\n */\nexport function rune_outside_svelte(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`rune_outside_svelte\\nThe \\`${rune}\\` rune is only available inside \\`.svelte\\` and \\`.svelte.js/ts\\` files\\nhttps://svelte.dev/e/rune_outside_svelte`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/rune_outside_svelte`);\n\t}\n}\n\n/**\n * `setContext` must be called when a component first initializes, not in a subsequent effect or after an `await` expression\n * @returns {never}\n */\nexport function set_context_after_init() {\n\tif (DEV) {\n\t\tconst error = new Error(`set_context_after_init\\n\\`setContext\\` must be called when a component first initializes, not in a subsequent effect or after an \\`await\\` expression\\nhttps://svelte.dev/e/set_context_after_init`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/set_context_after_init`);\n\t}\n}\n\n/**\n * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\n * @returns {never}\n */\nexport function state_descriptors_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_descriptors_fixed\\nProperty descriptors defined on \\`$state\\` objects must contain \\`value\\` and always be \\`enumerable\\`, \\`configurable\\` and \\`writable\\`.\\nhttps://svelte.dev/e/state_descriptors_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_descriptors_fixed`);\n\t}\n}\n\n/**\n * Cannot set prototype of `$state` object\n * @returns {never}\n */\nexport function state_prototype_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_prototype_fixed\\nCannot set prototype of \\`$state\\` object\\nhttps://svelte.dev/e/state_prototype_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_prototype_fixed`);\n\t}\n}\n\n/**\n * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\n * @returns {never}\n */\nexport function state_unsafe_mutation() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_unsafe_mutation\\nUpdating state inside \\`$derived(...)\\`, \\`$inspect(...)\\` or a template expression is forbidden. If the value should not be reactive, declare it without \\`$state\\`\\nhttps://svelte.dev/e/state_unsafe_mutation`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_unsafe_mutation`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\n * @returns {never}\n */\nexport function svelte_boundary_reset_onerror() {\n\tif (DEV) {\n\t\tconst error = new Error(`svelte_boundary_reset_onerror\\nA \\`<svelte:boundary>\\` \\`reset\\` function cannot be called while an error is still being handled\\nhttps://svelte.dev/e/svelte_boundary_reset_onerror`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);\n\t}\n}","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nvar bold = 'font-weight: bold';\nvar normal = 'font-weight: normal';\n\n/**\n * Assignment to `%property%` property (%location%) will evaluate to the right-hand side, not the value of `%property%` following the assignment. This may result in unexpected behaviour.\n * @param {string} property\n * @param {string} location\n */\nexport function assignment_value_stale(property, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] assignment_value_stale\\n%cAssignment to \\`${property}\\` property (${location}) will evaluate to the right-hand side, not the value of \\`${property}\\` following the assignment. This may result in unexpected behaviour.\\nhttps://svelte.dev/e/assignment_value_stale`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/assignment_value_stale`);\n\t}\n}\n\n/**\n * Detected reactivity loss when reading `%name%`. This happens when state is read in an async function after an earlier `await`\n * @param {string} name\n */\nexport function await_reactivity_loss(name) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_reactivity_loss\\n%cDetected reactivity loss when reading \\`${name}\\`. This happens when state is read in an async function after an earlier \\`await\\`\\nhttps://svelte.dev/e/await_reactivity_loss`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_reactivity_loss`);\n\t}\n}\n\n/**\n * An async derived, `%name%` (%location%) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\n * @param {string} name\n * @param {string} location\n */\nexport function await_waterfall(name, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_waterfall\\n%cAn async derived, \\`${name}\\` (${location}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\\nhttps://svelte.dev/e/await_waterfall`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_waterfall`);\n\t}\n}\n\n/**\n * `%binding%` (%location%) is binding to a non-reactive property\n * @param {string} binding\n * @param {string | undefined | null} [location]\n */\nexport function binding_property_non_reactive(binding, location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] binding_property_non_reactive\\n%c${location\n\t\t\t\t? `\\`${binding}\\` (${location}) is binding to a non-reactive property`\n\t\t\t\t: `\\`${binding}\\` is binding to a non-reactive property`}\\nhttps://svelte.dev/e/binding_property_non_reactive`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/binding_property_non_reactive`);\n\t}\n}\n\n/**\n * Your `console.%method%` contained `$state` proxies. Consider using `$inspect(...)` or `$state.snapshot(...)` instead\n * @param {string} method\n */\nexport function console_log_state(method) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] console_log_state\\n%cYour \\`console.${method}\\` contained \\`$state\\` proxies. Consider using \\`$inspect(...)\\` or \\`$state.snapshot(...)\\` instead\\nhttps://svelte.dev/e/console_log_state`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/console_log_state`);\n\t}\n}\n\n/**\n * Reading a derived belonging to a now-destroyed effect may result in stale values\n */\nexport function derived_inert() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] derived_inert\\n%cReading a derived belonging to a now-destroyed effect may result in stale values\\nhttps://svelte.dev/e/derived_inert`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/derived_inert`);\n\t}\n}\n\n/**\n * %handler% should be a function. Did you mean to %suggestion%?\n * @param {string} handler\n * @param {string} suggestion\n */\nexport function event_handler_invalid(handler, suggestion) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] event_handler_invalid\\n%c${handler} should be a function. Did you mean to ${suggestion}?\\nhttps://svelte.dev/e/event_handler_invalid`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/event_handler_invalid`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n */\nexport function hydratable_missing_but_expected(key) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydratable_missing_but_expected\\n%cExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_expected`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydratable_missing_but_expected`);\n\t}\n}\n\n/**\n * The `%attribute%` attribute on `%html%` changed its value between server and client renders. The client value, `%value%`, will be ignored in favour of the server value\n * @param {string} attribute\n * @param {string} html\n * @param {string} value\n */\nexport function hydration_attribute_changed(attribute, html, value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydration_attribute_changed\\n%cThe \\`${attribute}\\` attribute on \\`${html}\\` changed its value between server and client renders. The client value, \\`${value}\\`, will be ignored in favour of the server value\\nhttps://svelte.dev/e/hydration_attribute_changed`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_attribute_changed`);\n\t}\n}\n\n/**\n * The value of an `{@html ...}` block %location% changed between server and client renders. The client value will be ignored in favour of the server value\n * @param {string | undefined | null} [location]\n */\nexport function hydration_html_changed(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_html_changed\\n%c${location\n\t\t\t\t? `The value of an \\`{@html ...}\\` block ${location} changed between server and client renders. The client value will be ignored in favour of the server value`\n\t\t\t\t: 'The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value'}\\nhttps://svelte.dev/e/hydration_html_changed`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_html_changed`);\n\t}\n}\n\n/**\n * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%\n * @param {string | undefined | null} [location]\n */\nexport function hydration_mismatch(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_mismatch\\n%c${location\n\t\t\t\t? `Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${location}`\n\t\t\t\t: 'Hydration failed because the initial UI does not match what was rendered on the server'}\\nhttps://svelte.dev/e/hydration_mismatch`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_mismatch`);\n\t}\n}\n\n/**\n * The `render` function passed to `createRawSnippet` should return HTML for a single element\n */\nexport function invalid_raw_snippet_render() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] invalid_raw_snippet_render\\n%cThe \\`render\\` function passed to \\`createRawSnippet\\` should return HTML for a single element\\nhttps://svelte.dev/e/invalid_raw_snippet_render`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/invalid_raw_snippet_render`);\n\t}\n}\n\n/**\n * Detected a migrated `$:` reactive block in `%filename%` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an `$effect`.\n * @param {string} filename\n */\nexport function legacy_recursive_reactive_block(filename) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] legacy_recursive_reactive_block\\n%cDetected a migrated \\`$:\\` reactive block in \\`${filename}\\` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an \\`$effect\\`.\\nhttps://svelte.dev/e/legacy_recursive_reactive_block`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/legacy_recursive_reactive_block`);\n\t}\n}\n\n/**\n * Tried to unmount a component that was not mounted\n */\nexport function lifecycle_double_unmount() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] lifecycle_double_unmount\\n%cTried to unmount a component that was not mounted\\nhttps://svelte.dev/e/lifecycle_double_unmount`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/lifecycle_double_unmount`);\n\t}\n}\n\n/**\n * %parent% passed property `%prop%` to %child% with `bind:`, but its parent component %owner% did not declare `%prop%` as a binding. Consider creating a binding between %owner% and %parent% (e.g. `bind:%prop%={...}` instead of `%prop%={...}`)\n * @param {string} parent\n * @param {string} prop\n * @param {string} child\n * @param {string} owner\n */\nexport function ownership_invalid_binding(parent, prop, child, owner) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_binding\\n%c${parent} passed property \\`${prop}\\` to ${child} with \\`bind:\\`, but its parent component ${owner} did not declare \\`${prop}\\` as a binding. Consider creating a binding between ${owner} and ${parent} (e.g. \\`bind:${prop}={...}\\` instead of \\`${prop}={...}\\`)\\nhttps://svelte.dev/e/ownership_invalid_binding`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_binding`);\n\t}\n}\n\n/**\n * Mutating unbound props (`%name%`, at %location%) is strongly discouraged. Consider using `bind:%prop%={...}` in %parent% (or using a callback) instead\n * @param {string} name\n * @param {string} location\n * @param {string} prop\n * @param {string} parent\n */\nexport function ownership_invalid_mutation(name, location, prop, parent) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_mutation\\n%cMutating unbound props (\\`${name}\\`, at ${location}) is strongly discouraged. Consider using \\`bind:${prop}={...}\\` in ${parent} (or using a callback) instead\\nhttps://svelte.dev/e/ownership_invalid_mutation`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_mutation`);\n\t}\n}\n\n/**\n * The `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\n */\nexport function select_multiple_invalid_value() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] select_multiple_invalid_value\\n%cThe \\`value\\` property of a \\`<select multiple>\\` element should be an array, but it received a non-array value. The selection will be kept as is.\\nhttps://svelte.dev/e/select_multiple_invalid_value`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/select_multiple_invalid_value`);\n\t}\n}\n\n/**\n * Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `%operator%` will produce unexpected results\n * @param {string} operator\n */\nexport function state_proxy_equality_mismatch(operator) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] state_proxy_equality_mismatch\\n%cReactive \\`$state(...)\\` proxies and the values they proxy have different identities. Because of this, comparisons with \\`${operator}\\` will produce unexpected results\\nhttps://svelte.dev/e/state_proxy_equality_mismatch`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/state_proxy_equality_mismatch`);\n\t}\n}\n\n/**\n * Tried to unmount a state proxy, rather than a component\n */\nexport function state_proxy_unmount() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] state_proxy_unmount\\n%cTried to unmount a state proxy, rather than a component\\nhttps://svelte.dev/e/state_proxy_unmount`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/state_proxy_unmount`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\n */\nexport function svelte_boundary_reset_noop() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] svelte_boundary_reset_noop\\n%cA \\`<svelte:boundary>\\` \\`reset\\` function only resets the boundary the first time it is called\\nhttps://svelte.dev/e/svelte_boundary_reset_noop`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);\n\t}\n}\n\n/**\n * The `slide` transition does not work correctly for elements with `display: %value%`\n * @param {string} value\n */\nexport function transition_slide_display(value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] transition_slide_display\\n%cThe \\`slide\\` transition does not work correctly for elements with \\`display: ${value}\\`\\nhttps://svelte.dev/e/transition_slide_display`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/transition_slide_display`);\n\t}\n}","/** @import { Equals } from '#client' */\n\n/** @type {Equals} */\nexport function equals(value) {\n\treturn value === this.v;\n}\n\n/**\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nexport function safe_not_equal(a, b) {\n\treturn a != a\n\t\t? b == b\n\t\t: a !== b || (a !== null && typeof a === 'object') || typeof a === 'function';\n}\n\n/**\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nexport function not_equal(a, b) {\n\treturn a !== b;\n}\n\n/** @type {Equals} */\nexport function safe_equals(value) {\n\treturn !safe_not_equal(value, this.v);\n}\n","/** @import { Derived, Reaction, Value } from '#client' */\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { snapshot } from '../../shared/clone.js';\nimport { DERIVED, ASYNC, PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';\nimport { effect_tracking } from '../reactivity/effects.js';\nimport { active_reaction, untrack } from '../runtime.js';\n\n/**\n * @typedef {{\n *   traces: Error[];\n * }} TraceEntry\n */\n\n/** @type {{ reaction: Reaction | null, entries: Map<Value, TraceEntry> } | null} */\nexport let tracing_expressions = null;\n\n/**\n * @param {Value} signal\n * @param {TraceEntry} [entry]\n */\nfunction log_entry(signal, entry) {\n\tconst value = signal.v;\n\n\tif (value === UNINITIALIZED) {\n\t\treturn;\n\t}\n\n\tconst type = get_type(signal);\n\tconst current_reaction = /** @type {Reaction} */ (active_reaction);\n\tconst dirty = signal.wv > current_reaction.wv || current_reaction.wv === 0;\n\tconst style = dirty\n\t\t? 'color: CornflowerBlue; font-weight: bold'\n\t\t: 'color: grey; font-weight: normal';\n\n\t// eslint-disable-next-line no-console\n\tconsole.groupCollapsed(\n\t\tsignal.label ? `%c${type}%c ${signal.label}` : `%c${type}%c`,\n\t\tstyle,\n\t\tdirty ? 'font-weight: normal' : style,\n\t\ttypeof value === 'object' && value !== null && STATE_SYMBOL in value\n\t\t\t? snapshot(value, true)\n\t\t\t: value\n\t);\n\n\tif (type === '$derived') {\n\t\tconst deps = new Set(/** @type {Derived} */ (signal).deps);\n\t\tfor (const dep of deps) {\n\t\t\tlog_entry(dep);\n\t\t}\n\t}\n\n\tif (signal.created) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(signal.created);\n\t}\n\n\tif (dirty && signal.updated) {\n\t\tfor (const updated of signal.updated.values()) {\n\t\t\tif (updated.error) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(updated.error);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (entry) {\n\t\tfor (var trace of entry.traces) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(trace);\n\t\t}\n\t}\n\n\t// eslint-disable-next-line no-console\n\tconsole.groupEnd();\n}\n\n/**\n * @param {Value} signal\n * @returns {'$state' | '$derived' | 'store'}\n */\nfunction get_type(signal) {\n\tif ((signal.f & (DERIVED | ASYNC)) !== 0) return '$derived';\n\treturn signal.label?.startsWith('$') ? 'store' : '$state';\n}\n\n/**\n * @template T\n * @param {() => string} label\n * @param {() => T} fn\n */\nexport function trace(label, fn) {\n\tvar previously_tracing_expressions = tracing_expressions;\n\n\ttry {\n\t\ttracing_expressions = { entries: new Map(), reaction: active_reaction };\n\n\t\tvar start = performance.now();\n\t\tvar value = fn();\n\t\tvar time = (performance.now() - start).toFixed(2);\n\n\t\tvar prefix = untrack(label);\n\n\t\tif (!effect_tracking()) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(`${prefix} %cran outside of an effect (${time}ms)`, 'color: grey');\n\t\t} else if (tracing_expressions.entries.size === 0) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(`${prefix} %cno reactive dependencies (${time}ms)`, 'color: grey');\n\t\t} else {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.group(`${prefix} %c(${time}ms)`, 'color: grey');\n\n\t\t\tvar entries = tracing_expressions.entries;\n\n\t\t\tuntrack(() => {\n\t\t\t\tfor (const [signal, traces] of entries) {\n\t\t\t\t\tlog_entry(signal, traces);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\ttracing_expressions = null;\n\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.groupEnd();\n\t\t}\n\n\t\treturn value;\n\t} finally {\n\t\ttracing_expressions = previously_tracing_expressions;\n\t}\n}\n\n/**\n * @param {Value} source\n * @param {string} label\n */\nexport function tag(source, label) {\n\tsource.label = label;\n\ttag_proxy(source.v, label);\n\n\treturn source;\n}\n\n/**\n * @param {unknown} value\n * @param {string} label\n */\nexport function tag_proxy(value, label) {\n\t// @ts-expect-error\n\tvalue?.[PROXY_PATH_SYMBOL]?.(label);\n\treturn value;\n}\n\n/**\n * @param {unknown} value\n */\nexport function label(value) {\n\tif (typeof value === 'symbol') return `Symbol(${value.description})`;\n\tif (typeof value === 'function') return '<function>';\n\tif (typeof value === 'object' && value) return '<object>';\n\treturn String(value);\n}\n","import { DEV } from 'esm-env';\nimport { define_property } from './utils.js';\nimport * as e from './errors.js';\n\n/**\n * @param {string} label\n * @returns {Error & { stack: string } | null}\n */\nexport function get_error(label) {\n\tconst error = new Error();\n\tconst stack = get_stack();\n\n\tif (stack.length === 0) {\n\t\treturn null;\n\t}\n\n\tstack.unshift('\\n');\n\n\tdefine_property(error, 'stack', {\n\t\tvalue: stack.join('\\n')\n\t});\n\n\tdefine_property(error, 'name', {\n\t\tvalue: label\n\t});\n\n\treturn /** @type {Error & { stack: string }} */ (error);\n}\n\n/**\n * @returns {string[]}\n */\nexport function get_stack() {\n\t// @ts-ignore - doesn't exist everywhere\n\tconst limit = Error.stackTraceLimit;\n\t// @ts-ignore - doesn't exist everywhere\n\tError.stackTraceLimit = Infinity;\n\tconst stack = new Error().stack;\n\t// @ts-ignore - doesn't exist everywhere\n\tError.stackTraceLimit = limit;\n\n\tif (!stack) return [];\n\n\tconst lines = stack.split('\\n');\n\tconst new_lines = [];\n\n\tfor (let i = 0; i < lines.length; i++) {\n\t\tconst line = lines[i];\n\t\tconst posixified = line.replaceAll('\\\\', '/');\n\n\t\tif (line.trim() === 'Error') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (line.includes('validate_each_keys')) {\n\t\t\treturn [];\n\t\t}\n\n\t\tif (posixified.includes('svelte/src/internal') || posixified.includes('node_modules/.vite')) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tnew_lines.push(line);\n\t}\n\n\treturn new_lines;\n}\n\n/**\n * @param {boolean} condition\n * @param {string} message\n */\nexport function invariant(condition, message) {\n\tif (!DEV) {\n\t\tthrow new Error('invariant(...) was not guarded by if (DEV)');\n\t}\n\n\tif (!condition) e.invariant_violation(message);\n}\n","/** @import { ComponentContext, DevStackEntry, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport * as e from './errors.js';\nimport { active_effect, active_reaction } from './runtime.js';\nimport { create_user_effect } from './reactivity/effects.js';\nimport { async_mode_flag, legacy_mode_flag } from '../flags/index.js';\nimport { FILENAME } from '../../constants.js';\nimport { BRANCH_EFFECT } from './constants.js';\n\n/** @type {ComponentContext | null} */\nexport let component_context = null;\n\n/** @param {ComponentContext | null} context */\nexport function set_component_context(context) {\n\tcomponent_context = context;\n}\n\n/** @type {DevStackEntry | null} */\nexport let dev_stack = null;\n\n/** @param {DevStackEntry | null} stack */\nexport function set_dev_stack(stack) {\n\tdev_stack = stack;\n}\n\n/**\n * Execute a callback with a new dev stack entry\n * @param {() => any} callback - Function to execute\n * @param {DevStackEntry['type']} type - Type of block/component\n * @param {any} component - Component function\n * @param {number} line - Line number\n * @param {number} column - Column number\n * @param {Record<string, any>} [additional] - Any additional properties to add to the dev stack entry\n * @returns {any}\n */\nexport function add_svelte_meta(callback, type, component, line, column, additional) {\n\tconst parent = dev_stack;\n\n\tdev_stack = {\n\t\ttype,\n\t\tfile: component[FILENAME],\n\t\tline,\n\t\tcolumn,\n\t\tparent,\n\t\t...additional\n\t};\n\n\ttry {\n\t\treturn callback();\n\t} finally {\n\t\tdev_stack = parent;\n\t}\n}\n\n/**\n * The current component function. Different from current component context:\n * ```html\n * <!-- App.svelte -->\n * <Foo>\n *   <Bar /> <!-- context == Foo.svelte, function == App.svelte -->\n * </Foo>\n * ```\n * @type {ComponentContext['function']}\n */\nexport let dev_current_component_function = null;\n\n/** @param {ComponentContext['function']} fn */\nexport function set_dev_current_component_function(fn) {\n\tdev_current_component_function = fn;\n}\n\n/**\n * Returns a `[get, set]` pair of functions for working with context in a type-safe way.\n *\n * `get` will throw an error if no parent component called `set`.\n *\n * @template T\n * @returns {[() => T, (context: T) => T]}\n * @since 5.40.0\n */\nexport function createContext() {\n\tconst key = {};\n\n\treturn [\n\t\t() => {\n\t\t\tif (!hasContext(key)) {\n\t\t\t\te.missing_context();\n\t\t\t}\n\n\t\t\treturn getContext(key);\n\t\t},\n\t\t(context) => setContext(key, context)\n\t];\n}\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 * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @returns {T}\n */\nexport function getContext(key) {\n\tconst context_map = get_or_init_context_map('getContext');\n\tconst result = /** @type {T} */ (context_map.get(key));\n\treturn result;\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 * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @param {T} context\n * @returns {T}\n */\nexport function setContext(key, context) {\n\tconst context_map = get_or_init_context_map('setContext');\n\n\tif (async_mode_flag) {\n\t\tvar flags = /** @type {Effect} */ (active_effect).f;\n\t\tvar valid =\n\t\t\t!active_reaction &&\n\t\t\t(flags & BRANCH_EFFECT) !== 0 &&\n\t\t\t// pop() runs synchronously, so this indicates we're setting context after an await\n\t\t\t!(/** @type {ComponentContext} */ (component_context).i);\n\n\t\tif (!valid) {\n\t\t\te.set_context_after_init();\n\t\t}\n\t}\n\n\tcontext_map.set(key, context);\n\treturn context;\n}\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 * @param {any} key\n * @returns {boolean}\n */\nexport function hasContext(key) {\n\tconst context_map = get_or_init_context_map('hasContext');\n\treturn context_map.has(key);\n}\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 * @template {Map<any, any>} [T=Map<any, any>]\n * @returns {T}\n */\nexport function getAllContexts() {\n\tconst context_map = get_or_init_context_map('getAllContexts');\n\treturn /** @type {T} */ (context_map);\n}\n\n/**\n * @param {Record<string, unknown>} props\n * @param {any} runes\n * @param {Function} [fn]\n * @returns {void}\n */\nexport function push(props, runes = false, fn) {\n\tcomponent_context = {\n\t\tp: component_context,\n\t\ti: false,\n\t\tc: null,\n\t\te: null,\n\t\ts: props,\n\t\tx: null,\n\t\tr: /** @type {Effect} */ (active_effect),\n\t\tl: legacy_mode_flag && !runes ? { s: null, u: null, $: [] } : null\n\t};\n\n\tif (DEV) {\n\t\t// component function\n\t\tcomponent_context.function = fn;\n\t\tdev_current_component_function = fn;\n\t}\n}\n\n/**\n * @template {Record<string, any>} T\n * @param {T} [component]\n * @returns {T}\n */\nexport function pop(component) {\n\tvar context = /** @type {ComponentContext} */ (component_context);\n\tvar effects = context.e;\n\n\tif (effects !== null) {\n\t\tcontext.e = null;\n\n\t\tfor (var fn of effects) {\n\t\t\tcreate_user_effect(fn);\n\t\t}\n\t}\n\n\tif (component !== undefined) {\n\t\tcontext.x = component;\n\t}\n\n\tcontext.i = true;\n\n\tcomponent_context = context.p;\n\n\tif (DEV) {\n\t\tdev_current_component_function = component_context?.function ?? null;\n\t}\n\n\treturn component ?? /** @type {T} */ ({});\n}\n\n/** @returns {boolean} */\nexport function is_runes() {\n\treturn !legacy_mode_flag || (component_context !== null && component_context.l === null);\n}\n\n/**\n * @param {string} name\n * @returns {Map<unknown, unknown>}\n */\nfunction get_or_init_context_map(name) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component(name);\n\t}\n\n\treturn (component_context.c ??= new Map(get_parent_context(component_context) || undefined));\n}\n\n/**\n * @param {ComponentContext} component_context\n * @returns {Map<unknown, unknown> | null}\n */\nfunction get_parent_context(component_context) {\n\tlet parent = component_context.p;\n\twhile (parent !== null) {\n\t\tconst context_map = parent.c;\n\t\tif (context_map !== null) {\n\t\t\treturn context_map;\n\t\t}\n\t\tparent = parent.p;\n\t}\n\treturn null;\n}\n","import { run_all } from '../../shared/utils.js';\nimport { is_flushing_sync } from '../reactivity/batch.js';\n\n/** @type {Array<() => void>} */\nlet micro_tasks = [];\n\nfunction run_micro_tasks() {\n\tvar tasks = micro_tasks;\n\tmicro_tasks = [];\n\trun_all(tasks);\n}\n\n/**\n * @param {() => void} fn\n */\nexport function queue_micro_task(fn) {\n\tif (micro_tasks.length === 0 && !is_flushing_sync) {\n\t\tvar tasks = micro_tasks;\n\t\tqueueMicrotask(() => {\n\t\t\t// If this is false, a flushSync happened in the meantime. Do _not_ run new scheduled microtasks in that case\n\t\t\t// as the ordering of microtasks would be broken at that point - consider this case:\n\t\t\t// - queue_micro_task schedules microtask A to flush task X\n\t\t\t// - synchronously after, flushSync runs, processing task X\n\t\t\t// - synchronously after, some other microtask B is scheduled, but not through queue_micro_task but for example a Promise.resolve() in user code\n\t\t\t// - synchronously after, queue_micro_task schedules microtask C to flush task Y\n\t\t\t// - one tick later, microtask A now resolves, flushing task Y before microtask B, which is incorrect\n\t\t\t// This if check prevents that race condition (that realistically will only happen in tests)\n\t\t\tif (tasks === micro_tasks) run_micro_tasks();\n\t\t});\n\t}\n\n\tmicro_tasks.push(fn);\n}\n\n/**\n * Synchronously run any queued tasks.\n */\nexport function flush_tasks() {\n\twhile (micro_tasks.length > 0) {\n\t\trun_micro_tasks();\n\t}\n}\n","/** @import { Derived, Effect } from '#client' */\n/** @import { Boundary } from './dom/blocks/boundary.js' */\nimport { DEV } from 'esm-env';\nimport { FILENAME } from '../../constants.js';\nimport { is_firefox } from './dom/operations.js';\nimport { ERROR_VALUE, BOUNDARY_EFFECT, REACTION_RAN, EFFECT } from './constants.js';\nimport { define_property, get_descriptor } from '../shared/utils.js';\nimport { active_effect, active_reaction } from './runtime.js';\n\nconst adjustments = new WeakMap();\n\n/**\n * @param {unknown} error\n */\nexport function handle_error(error) {\n\tvar effect = active_effect;\n\n\t// for unowned deriveds, don't throw until we read the value\n\tif (effect === null) {\n\t\t/** @type {Derived} */ (active_reaction).f |= ERROR_VALUE;\n\t\treturn error;\n\t}\n\n\tif (DEV && error instanceof Error && !adjustments.has(error)) {\n\t\tadjustments.set(error, get_adjustments(error, effect));\n\t}\n\n\t// if the error occurred while creating this subtree, we let it\n\t// bubble up until it hits a boundary that can handle it, unless\n\t// it's an $effect in which case it doesn't run immediately\n\tif ((effect.f & REACTION_RAN) === 0 && (effect.f & EFFECT) === 0) {\n\t\tif (DEV && !effect.parent && error instanceof Error) {\n\t\t\tapply_adjustments(error);\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\t// otherwise we bubble up the effect tree ourselves\n\tinvoke_error_boundary(error, effect);\n}\n\n/**\n * @param {unknown} error\n * @param {Effect | null} effect\n */\nexport function invoke_error_boundary(error, effect) {\n\twhile (effect !== null) {\n\t\tif ((effect.f & BOUNDARY_EFFECT) !== 0) {\n\t\t\tif ((effect.f & REACTION_RAN) === 0) {\n\t\t\t\t// we are still creating the boundary effect\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t/** @type {Boundary} */ (effect.b).error(error);\n\t\t\t\treturn;\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\n\t\teffect = effect.parent;\n\t}\n\n\tif (DEV && error instanceof Error) {\n\t\tapply_adjustments(error);\n\t}\n\n\tthrow error;\n}\n\n/**\n * Add useful information to the error message/stack in development\n * @param {Error} error\n * @param {Effect} effect\n */\nfunction get_adjustments(error, effect) {\n\tconst message_descriptor = get_descriptor(error, 'message');\n\n\t// if the message was already changed and it's not configurable we can't change it\n\t// or it will throw a different error swallowing the original error\n\tif (message_descriptor && !message_descriptor.configurable) return;\n\n\tvar indent = is_firefox ? '  ' : '\\t';\n\tvar component_stack = `\\n${indent}in ${effect.fn?.name || '<unknown>'}`;\n\tvar context = effect.ctx;\n\n\twhile (context !== null) {\n\t\tcomponent_stack += `\\n${indent}in ${context.function?.[FILENAME].split('/').pop()}`;\n\t\tcontext = context.p;\n\t}\n\n\treturn {\n\t\tmessage: error.message + `\\n${component_stack}\\n`,\n\t\tstack: error.stack\n\t\t\t?.split('\\n')\n\t\t\t.filter((line) => !line.includes('svelte/src/internal'))\n\t\t\t.join('\\n')\n\t};\n}\n\n/**\n * @param {Error} error\n */\nfunction apply_adjustments(error) {\n\tconst adjusted = adjustments.get(error);\n\n\tif (adjusted) {\n\t\tdefine_property(error, 'message', {\n\t\t\tvalue: adjusted.message\n\t\t});\n\n\t\tdefine_property(error, 'stack', {\n\t\t\tvalue: adjusted.stack\n\t\t});\n\t}\n}\n","/** @import { Derived, Signal } from '#client' */\nimport { CLEAN, CONNECTED, DIRTY, MAYBE_DIRTY } from '#client/constants';\n\nconst STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);\n\n/**\n * @param {Signal} signal\n * @param {number} status\n */\nexport function set_signal_status(signal, status) {\n\tsignal.f = (signal.f & STATUS_MASK) | status;\n}\n\n/**\n * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.\n * @param {Derived} derived\n */\nexport function update_derived_status(derived) {\n\t// Only mark as MAYBE_DIRTY if disconnected and has dependencies.\n\tif ((derived.f & CONNECTED) !== 0 || derived.deps === null) {\n\t\tset_signal_status(derived, CLEAN);\n\t} else {\n\t\tset_signal_status(derived, MAYBE_DIRTY);\n\t}\n}\n","/** @import { Derived, Effect, Value } from '#client' */\nimport { CLEAN, DERIVED, DIRTY, MAYBE_DIRTY, WAS_MARKED } from '#client/constants';\nimport { set_signal_status } from './status.js';\n\n/**\n * @param {Value[] | null} deps\n */\nfunction clear_marked(deps) {\n\tif (deps === null) return;\n\n\tfor (const dep of deps) {\n\t\tif ((dep.f & DERIVED) === 0 || (dep.f & WAS_MARKED) === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tdep.f ^= WAS_MARKED;\n\n\t\tclear_marked(/** @type {Derived} */ (dep).deps);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Set<Effect>} dirty_effects\n * @param {Set<Effect>} maybe_dirty_effects\n */\nexport function defer_effect(effect, dirty_effects, maybe_dirty_effects) {\n\tif ((effect.f & DIRTY) !== 0) {\n\t\tdirty_effects.add(effect);\n\t} else if ((effect.f & MAYBE_DIRTY) !== 0) {\n\t\tmaybe_dirty_effects.add(effect);\n\t}\n\n\t// Since we're not executing these effects now, we need to clear any WAS_MARKED flags\n\t// so that other batches can correctly reach these effects during their own traversal\n\tclear_marked(effect.deps);\n\n\t// mark as clean so they get scheduled if they depend on pending async state\n\tset_signal_status(effect, CLEAN);\n}\n","/** @import { Readable } from './public' */\nimport { untrack } from '../internal/client/runtime.js';\nimport { noop } from '../internal/shared/utils.js';\n\n/**\n * @template T\n * @param {Readable<T> | null | undefined} store\n * @param {(value: T) => void} run\n * @param {(value: T) => void} [invalidate]\n * @returns {() => void}\n */\nexport function subscribe_to_store(store, run, invalidate) {\n\tif (store == null) {\n\t\t// @ts-expect-error\n\t\trun(undefined);\n\n\t\t// @ts-expect-error\n\t\tif (invalidate) invalidate(undefined);\n\n\t\treturn noop;\n\t}\n\n\t// Svelte store takes a private second argument\n\t// StartStopNotifier could mutate state, and we want to silence the corresponding validation error\n\tconst unsub = untrack(() =>\n\t\tstore.subscribe(\n\t\t\trun,\n\t\t\t// @ts-expect-error\n\t\t\tinvalidate\n\t\t)\n\t);\n\n\t// Also support RxJS\n\t// @ts-expect-error TODO fix this in the types?\n\treturn unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\n","/** @import { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable } from '../public.js' */\n/** @import { Stores, StoresValues, SubscribeInvalidateTuple } from '../private.js' */\nimport { noop, run_all } from '../../internal/shared/utils.js';\nimport { safe_not_equal } from '../../internal/client/reactivity/equality.js';\nimport { subscribe_to_store } from '../utils.js';\n\n/**\n * @type {Array<SubscribeInvalidateTuple<any> | any>}\n */\nconst subscriber_queue = [];\n\n/**\n * Creates a `Readable` store that allows reading by subscription.\n *\n * @template T\n * @param {T} [value] initial value\n * @param {StartStopNotifier<T>} [start]\n * @returns {Readable<T>}\n */\nexport function readable(value, start) {\n\treturn {\n\t\tsubscribe: writable(value, start).subscribe\n\t};\n}\n\n/**\n * Create a `Writable` store that allows both updating and reading by subscription.\n *\n * @template T\n * @param {T} [value] initial value\n * @param {StartStopNotifier<T>} [start]\n * @returns {Writable<T>}\n */\nexport function writable(value, start = noop) {\n\t/** @type {Unsubscriber | null} */\n\tlet stop = null;\n\n\t/** @type {Set<SubscribeInvalidateTuple<T>>} */\n\tconst subscribers = new Set();\n\n\t/**\n\t * @param {T} new_value\n\t * @returns {void}\n\t */\n\tfunction set(new_value) {\n\t\tif (safe_not_equal(value, new_value)) {\n\t\t\tvalue = new_value;\n\t\t\tif (stop) {\n\t\t\t\t// store is ready\n\t\t\t\tconst run_queue = !subscriber_queue.length;\n\t\t\t\tfor (const subscriber of subscribers) {\n\t\t\t\t\tsubscriber[1]();\n\t\t\t\t\tsubscriber_queue.push(subscriber, value);\n\t\t\t\t}\n\t\t\t\tif (run_queue) {\n\t\t\t\t\tfor (let i = 0; i < subscriber_queue.length; i += 2) {\n\t\t\t\t\t\tsubscriber_queue[i][0](subscriber_queue[i + 1]);\n\t\t\t\t\t}\n\t\t\t\t\tsubscriber_queue.length = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Updater<T>} fn\n\t * @returns {void}\n\t */\n\tfunction update(fn) {\n\t\tset(fn(/** @type {T} */ (value)));\n\t}\n\n\t/**\n\t * @param {Subscriber<T>} run\n\t * @param {() => void} [invalidate]\n\t * @returns {Unsubscriber}\n\t */\n\tfunction subscribe(run, invalidate = noop) {\n\t\t/** @type {SubscribeInvalidateTuple<T>} */\n\t\tconst subscriber = [run, invalidate];\n\t\tsubscribers.add(subscriber);\n\t\tif (subscribers.size === 1) {\n\t\t\tstop = start(set, update) || noop;\n\t\t}\n\t\trun(/** @type {T} */ (value));\n\t\treturn () => {\n\t\t\tsubscribers.delete(subscriber);\n\t\t\tif (subscribers.size === 0 && stop) {\n\t\t\t\tstop();\n\t\t\t\tstop = null;\n\t\t\t}\n\t\t};\n\t}\n\treturn { set, update, subscribe };\n}\n\n/**\n * Derived value store by synchronizing one or more readable stores and\n * applying an aggregation function over its input values.\n *\n * @template {Stores} S\n * @template T\n * @overload\n * @param {S} stores\n * @param {(values: StoresValues<S>, set: (value: T) => void, update: (fn: Updater<T>) => void) => Unsubscriber | void} fn\n * @param {T} [initial_value]\n * @returns {Readable<T>}\n */\n/**\n * Derived value store by synchronizing one or more readable stores and\n * applying an aggregation function over its input values.\n *\n * @template {Stores} S\n * @template T\n * @overload\n * @param {S} stores\n * @param {(values: StoresValues<S>) => T} fn\n * @param {T} [initial_value]\n * @returns {Readable<T>}\n */\n/**\n * @template {Stores} S\n * @template T\n * @param {S} stores\n * @param {Function} fn\n * @param {T} [initial_value]\n * @returns {Readable<T>}\n */\nexport function derived(stores, fn, initial_value) {\n\tconst single = !Array.isArray(stores);\n\t/** @type {Array<Readable<any>>} */\n\tconst stores_array = single ? [stores] : stores;\n\tif (!stores_array.every(Boolean)) {\n\t\tthrow new Error('derived() expects stores as input, got a falsy value');\n\t}\n\tconst auto = fn.length < 2;\n\treturn readable(initial_value, (set, update) => {\n\t\tlet started = false;\n\t\t/** @type {T[]} */\n\t\tconst values = [];\n\t\tlet pending = 0;\n\t\tlet cleanup = noop;\n\t\tconst sync = () => {\n\t\t\tif (pending) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcleanup();\n\t\t\tconst result = fn(single ? values[0] : values, set, update);\n\t\t\tif (auto) {\n\t\t\t\tset(result);\n\t\t\t} else {\n\t\t\t\tcleanup = typeof result === 'function' ? result : noop;\n\t\t\t}\n\t\t};\n\t\tconst unsubscribers = stores_array.map((store, i) =>\n\t\t\tsubscribe_to_store(\n\t\t\t\tstore,\n\t\t\t\t(value) => {\n\t\t\t\t\tvalues[i] = value;\n\t\t\t\t\tpending &= ~(1 << i);\n\t\t\t\t\tif (started) {\n\t\t\t\t\t\tsync();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tpending |= 1 << i;\n\t\t\t\t}\n\t\t\t)\n\t\t);\n\t\tstarted = true;\n\t\tsync();\n\t\treturn function stop() {\n\t\t\trun_all(unsubscribers);\n\t\t\tcleanup();\n\t\t\t// We need to set this to false because callbacks can still happen despite having unsubscribed:\n\t\t\t// Callbacks might already be placed in the queue which doesn't know it should no longer\n\t\t\t// invoke this derived store.\n\t\t\tstarted = false;\n\t\t};\n\t});\n}\n\n/**\n * Takes a store and returns a new one derived from the old one that is readable.\n *\n * @template T\n * @param {Readable<T>} store  - store to make readonly\n * @returns {Readable<T>}\n */\nexport function readonly(store) {\n\treturn {\n\t\t// @ts-expect-error TODO i suspect the bind is unnecessary\n\t\tsubscribe: store.subscribe.bind(store)\n\t};\n}\n\n/**\n * Get the current value from a store by subscribing and immediately unsubscribing.\n *\n * @template T\n * @param {Readable<T>} store\n * @returns {T}\n */\nexport function get(store) {\n\tlet value;\n\tsubscribe_to_store(store, (_) => (value = _))();\n\t// @ts-expect-error\n\treturn value;\n}\n","/** @import { StoreReferencesContainer } from '#client' */\n/** @import { Store } from '#shared' */\nimport { subscribe_to_store } from '../../../store/utils.js';\nimport { get as get_store } from '../../../store/shared/index.js';\nimport { define_property, noop } from '../../shared/utils.js';\nimport { get } from '../runtime.js';\nimport { teardown } from './effects.js';\nimport { mutable_source, set } from './sources.js';\nimport { DEV } from 'esm-env';\n\n/**\n * We set this to `true` when updating a store so that we correctly\n * schedule effects if the update takes place inside a `$:` effect\n */\nexport let legacy_is_updating_store = false;\n\n/**\n * Whether or not the prop currently being read is a store binding, as in\n * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in\n * runes mode, and skip `binding_property_non_reactive` validation\n */\nlet is_store_binding = false;\n\nlet IS_UNMOUNTED = Symbol();\n\n/**\n * Gets the current value of a store. If the store isn't subscribed to yet, it will create a proxy\n * signal that will be updated when the store is. The store references container is needed to\n * track reassignments to stores and to track the correct component context.\n * @template V\n * @param {Store<V> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n * @returns {V}\n */\nexport function store_get(store, store_name, stores) {\n\tconst entry = (stores[store_name] ??= {\n\t\tstore: null,\n\t\tsource: mutable_source(undefined),\n\t\tunsubscribe: noop\n\t});\n\n\tif (DEV) {\n\t\tentry.source.label = store_name;\n\t}\n\n\t// if the component that setup this is already unmounted we don't want to register a subscription\n\tif (entry.store !== store && !(IS_UNMOUNTED in stores)) {\n\t\tentry.unsubscribe();\n\t\tentry.store = store ?? null;\n\n\t\tif (store == null) {\n\t\t\tentry.source.v = undefined; // see synchronous callback comment below\n\t\t\tentry.unsubscribe = noop;\n\t\t} else {\n\t\t\tvar is_synchronous_callback = true;\n\n\t\t\tentry.unsubscribe = subscribe_to_store(store, (v) => {\n\t\t\t\tif (is_synchronous_callback) {\n\t\t\t\t\t// If the first updates to the store value (possibly multiple of them) are synchronously\n\t\t\t\t\t// inside a derived, we will hit the `state_unsafe_mutation` error if we `set` the value\n\t\t\t\t\tentry.source.v = v;\n\t\t\t\t} else {\n\t\t\t\t\tset(entry.source, v);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tis_synchronous_callback = false;\n\t\t}\n\t}\n\n\t// if the component that setup this stores is already unmounted the source will be out of sync\n\t// so we just use the `get` for the stores, less performant but it avoids to create a memory leak\n\t// and it will keep the value consistent\n\tif (store && IS_UNMOUNTED in stores) {\n\t\treturn get_store(store);\n\t}\n\n\treturn get(entry.source);\n}\n\n/**\n * Unsubscribe from a store if it's not the same as the one in the store references container.\n * We need this in addition to `store_get` because someone could unsubscribe from a store but\n * then never subscribe to the new one (if any), causing the subscription to stay open wrongfully.\n * @param {Store<any> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n */\nexport function store_unsub(store, store_name, stores) {\n\t/** @type {StoreReferencesContainer[''] | undefined} */\n\tlet entry = stores[store_name];\n\n\tif (entry && entry.store !== store) {\n\t\t// Don't reset store yet, so that store_get above can resubscribe to new store if necessary\n\t\tentry.unsubscribe();\n\t\tentry.unsubscribe = noop;\n\t}\n\n\treturn store;\n}\n\n/**\n * Sets the new value of a store and returns that value.\n * @template V\n * @param {Store<V>} store\n * @param {V} value\n * @returns {V}\n */\nexport function store_set(store, value) {\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * @param {StoreReferencesContainer} stores\n * @param {string} store_name\n */\nexport function invalidate_store(stores, store_name) {\n\tvar entry = stores[store_name];\n\tif (entry.store !== null) {\n\t\tstore_set(entry.store, entry.source.v);\n\t}\n}\n\n/**\n * Unsubscribes from all auto-subscribed stores on destroy\n * @returns {[StoreReferencesContainer, ()=>void]}\n */\nexport function setup_stores() {\n\t/** @type {StoreReferencesContainer} */\n\tconst stores = {};\n\n\tfunction cleanup() {\n\t\tteardown(() => {\n\t\t\tfor (var store_name in stores) {\n\t\t\t\tconst ref = stores[store_name];\n\t\t\t\tref.unsubscribe();\n\t\t\t}\n\t\t\tdefine_property(stores, IS_UNMOUNTED, {\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: true\n\t\t\t});\n\t\t});\n\t}\n\n\treturn [stores, cleanup];\n}\n\n/**\n * @param {Store<V>} store\n * @param {V} value\n * @template V\n */\nfunction update_with_flag(store, value) {\n\tlegacy_is_updating_store = true;\n\n\ttry {\n\t\tstore.set(value);\n\t} finally {\n\t\tlegacy_is_updating_store = false;\n\t}\n}\n\n/**\n * Updates a store with a new value.\n * @param {Store<V>} store  the store to update\n * @param {any} expression  the expression that mutates the store\n * @param {V} new_value  the new store value\n * @template V\n */\nexport function store_mutate(store, expression, new_value) {\n\tupdate_with_flag(store, new_value);\n\treturn expression;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_store(store, store_value, d = 1) {\n\tupdate_with_flag(store, store_value + d);\n\treturn store_value;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_store(store, store_value, d = 1) {\n\tconst value = store_value + d;\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * Called inside prop getters to communicate that the prop is a store binding\n */\nexport function mark_store_binding() {\n\tis_store_binding = true;\n}\n\n/**\n * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.\n * Used to prevent `binding_property_non_reactive` validation false positives and\n * ensure that these props are treated as mutable even in runes mode\n * @template T\n * @param {() => T} fn\n * @returns {[T, boolean]}\n */\nexport function capture_store_binding(fn) {\n\tvar previous_is_store_binding = is_store_binding;\n\n\ttry {\n\t\tis_store_binding = false;\n\t\treturn [fn(), is_store_binding];\n\t} finally {\n\t\tis_store_binding = previous_is_store_binding;\n\t}\n}\n","/** @import { Fork } from 'svelte' */\n/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\nimport {\n\tBLOCK_EFFECT,\n\tBRANCH_EFFECT,\n\tCLEAN,\n\tDESTROYED,\n\tDIRTY,\n\tEFFECT,\n\tASYNC,\n\tINERT,\n\tRENDER_EFFECT,\n\tROOT_EFFECT,\n\tMAYBE_DIRTY,\n\tDERIVED,\n\tEAGER_EFFECT,\n\tERROR_VALUE,\n\tMANAGED_EFFECT,\n\tREACTION_RAN\n} from '#client/constants';\nimport { async_mode_flag } from '../../flags/index.js';\nimport { deferred, define_property, includes } from '../../shared/utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tincrement_write_version,\n\tis_dirty,\n\tupdate_effect\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { flush_tasks, queue_micro_task } from '../dom/task.js';\nimport { DEV } from 'esm-env';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport { flush_eager_effects, old_values, set_eager_effects, source, update } from './sources.js';\nimport { eager_effect, unlink_effect } from './effects.js';\nimport { defer_effect } from './utils.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { set_signal_status } from './status.js';\nimport { legacy_is_updating_store } from './store.js';\nimport { invariant } from '../../shared/dev.js';\nimport { log_effect_tree } from '../dev/debug.js';\n\n/** @type {Set<Batch>} */\nconst batches = new Set();\n\n/** @type {Batch | null} */\nexport let current_batch = null;\n\n/**\n * This is needed to avoid overwriting inputs\n * @type {Batch | null}\n */\nexport let previous_batch = null;\n\n/**\n * When time travelling (i.e. working in one batch, while other batches\n * still have ongoing work), we ignore the real values of affected\n * signals in favour of their values within the batch\n * @type {Map<Value, any> | null}\n */\nexport let batch_values = null;\n\n/** @type {Effect | null} */\nlet last_scheduled_effect = null;\n\nexport let is_flushing_sync = false;\nlet is_processing = false;\n\n/**\n * During traversal, this is an array. Newly created effects are (if not immediately\n * executed) pushed to this array, rather than going through the scheduling\n * rigamarole that would cause another turn of the flush loop.\n * @type {Effect[] | null}\n */\nexport let collected_effects = null;\n\n/**\n * An array of effects that are marked during traversal as a result of a `set`\n * (not `internal_set`) call. These will be added to the next batch and\n * trigger another `batch.process()`\n * @type {Effect[] | null}\n * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n */\nexport let legacy_updates = null;\n\nvar flush_count = 0;\nvar source_stacks = DEV ? new Set() : null;\n\nlet uid = 1;\n\nexport class Batch {\n\tid = uid++;\n\n\t/**\n\t * The current values of any signals that are updated in this batch.\n\t * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)\n\t * They keys of this map are identical to `this.#previous`\n\t * @type {Map<Value, [any, boolean]>}\n\t */\n\tcurrent = new Map();\n\n\t/**\n\t * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.\n\t * They keys of this map are identical to `this.#current`\n\t * @type {Map<Value, any>}\n\t */\n\tprevious = new Map();\n\n\t/**\n\t * When the batch is committed (and the DOM is updated), we need to remove old branches\n\t * and append new ones by calling the functions added inside (if/each/key/etc) blocks\n\t * @type {Set<(batch: Batch) => void>}\n\t */\n\t#commit_callbacks = new Set();\n\n\t/**\n\t * If a fork is discarded, we need to destroy any effects that are no longer needed\n\t * @type {Set<(batch: Batch) => void>}\n\t */\n\t#discard_callbacks = new Set();\n\n\t/**\n\t * Callbacks that should run only when a fork is committed.\n\t * @type {Set<(batch: Batch) => void>}\n\t */\n\t#fork_commit_callbacks = new Set();\n\n\t/**\n\t * Async effects that are currently in flight\n\t * @type {Map<Effect, number>}\n\t */\n\t#pending = new Map();\n\n\t/**\n\t * Async effects that are currently in flight, _not_ inside a pending boundary\n\t * @type {Map<Effect, number>}\n\t */\n\t#blocking_pending = new Map();\n\n\t/**\n\t * A deferred that resolves when the batch is committed, used with `settled()`\n\t * TODO replace with Promise.withResolvers once supported widely enough\n\t * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}\n\t */\n\t#deferred = null;\n\n\t/**\n\t * The root effects that need to be flushed\n\t * @type {Effect[]}\n\t */\n\t#roots = [];\n\n\t/**\n\t * Effects created while this batch was active.\n\t * @type {Effect[]}\n\t */\n\t#new_effects = [];\n\n\t/**\n\t * Deferred effects (which run after async work has completed) that are DIRTY\n\t * @type {Set<Effect>}\n\t */\n\t#dirty_effects = new Set();\n\n\t/**\n\t * Deferred effects that are MAYBE_DIRTY\n\t * @type {Set<Effect>}\n\t */\n\t#maybe_dirty_effects = new Set();\n\n\t/**\n\t * A map of branches that still exist, but will be destroyed when this batch\n\t * is committed — we skip over these during `process`.\n\t * The value contains child effects that were dirty/maybe_dirty before being reset,\n\t * so they can be rescheduled if the branch survives.\n\t * @type {Map<Effect, { d: Effect[], m: Effect[] }>}\n\t */\n\t#skipped_branches = new Map();\n\n\t/**\n\t * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing\n\t * @type {Set<Effect>}\n\t */\n\t#unskipped_branches = new Set();\n\n\tis_fork = false;\n\n\t#decrement_queued = false;\n\n\t/** @type {Set<Batch>} */\n\t#blockers = new Set();\n\n\t#is_deferred() {\n\t\treturn this.is_fork || this.#blocking_pending.size > 0;\n\t}\n\n\t#is_blocked() {\n\t\tfor (const batch of this.#blockers) {\n\t\t\tfor (const effect of batch.#blocking_pending.keys()) {\n\t\t\t\tvar skipped = false;\n\t\t\t\tvar e = effect;\n\n\t\t\t\twhile (e.parent !== null) {\n\t\t\t\t\tif (this.#skipped_branches.has(e)) {\n\t\t\t\t\t\tskipped = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\te = e.parent;\n\t\t\t\t}\n\n\t\t\t\tif (!skipped) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Add an effect to the #skipped_branches map and reset its children\n\t * @param {Effect} effect\n\t */\n\tskip_effect(effect) {\n\t\tif (!this.#skipped_branches.has(effect)) {\n\t\t\tthis.#skipped_branches.set(effect, { d: [], m: [] });\n\t\t}\n\t\tthis.#unskipped_branches.delete(effect);\n\t}\n\n\t/**\n\t * Remove an effect from the #skipped_branches map and reschedule\n\t * any tracked dirty/maybe_dirty child effects\n\t * @param {Effect} effect\n\t * @param {(e: Effect) => void} callback\n\t */\n\tunskip_effect(effect, callback = (e) => this.schedule(e)) {\n\t\tvar tracked = this.#skipped_branches.get(effect);\n\t\tif (tracked) {\n\t\t\tthis.#skipped_branches.delete(effect);\n\n\t\t\tfor (var e of tracked.d) {\n\t\t\t\tset_signal_status(e, DIRTY);\n\t\t\t\tcallback(e);\n\t\t\t}\n\n\t\t\tfor (e of tracked.m) {\n\t\t\t\tset_signal_status(e, MAYBE_DIRTY);\n\t\t\t\tcallback(e);\n\t\t\t}\n\t\t}\n\t\tthis.#unskipped_branches.add(effect);\n\t}\n\n\t#process() {\n\t\tif (flush_count++ > 1000) {\n\t\t\tbatches.delete(this);\n\t\t\tinfinite_loop_guard();\n\t\t}\n\n\t\t// we only reschedule previously-deferred effects if we expect\n\t\t// to be able to run them after processing the batch\n\t\tif (!this.#is_deferred()) {\n\t\t\tfor (const e of this.#dirty_effects) {\n\t\t\t\tthis.#maybe_dirty_effects.delete(e);\n\t\t\t\tset_signal_status(e, DIRTY);\n\t\t\t\tthis.schedule(e);\n\t\t\t}\n\n\t\t\tfor (const e of this.#maybe_dirty_effects) {\n\t\t\t\tset_signal_status(e, MAYBE_DIRTY);\n\t\t\t\tthis.schedule(e);\n\t\t\t}\n\t\t}\n\n\t\tconst roots = this.#roots;\n\t\tthis.#roots = [];\n\n\t\tthis.apply();\n\n\t\t/** @type {Effect[]} */\n\t\tvar effects = (collected_effects = []);\n\n\t\t/** @type {Effect[]} */\n\t\tvar render_effects = [];\n\n\t\t/**\n\t\t * @type {Effect[]}\n\t\t * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n\t\t */\n\t\tvar updates = (legacy_updates = []);\n\n\t\tfor (const root of roots) {\n\t\t\ttry {\n\t\t\t\tthis.#traverse(root, effects, render_effects);\n\t\t\t} catch (e) {\n\t\t\t\treset_all(root);\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\t// any writes should take effect in a subsequent batch\n\t\tcurrent_batch = null;\n\n\t\tif (updates.length > 0) {\n\t\t\tvar batch = Batch.ensure();\n\t\t\tfor (const e of updates) {\n\t\t\t\tbatch.schedule(e);\n\t\t\t}\n\t\t}\n\n\t\tcollected_effects = null;\n\t\tlegacy_updates = null;\n\n\t\tif (this.#is_deferred() || this.#is_blocked()) {\n\t\t\tthis.#defer_effects(render_effects);\n\t\t\tthis.#defer_effects(effects);\n\n\t\t\tfor (const [e, t] of this.#skipped_branches) {\n\t\t\t\treset_branch(e, t);\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.#pending.size === 0) {\n\t\t\t\tbatches.delete(this);\n\t\t\t}\n\n\t\t\t// clear effects. Those that are still needed will be rescheduled through unskipping the skipped branches.\n\t\t\tthis.#dirty_effects.clear();\n\t\t\tthis.#maybe_dirty_effects.clear();\n\n\t\t\t// append/remove branches\n\t\t\tfor (const fn of this.#commit_callbacks) fn(this);\n\t\t\tthis.#commit_callbacks.clear();\n\n\t\t\tprevious_batch = this;\n\t\t\tflush_queued_effects(render_effects);\n\t\t\tflush_queued_effects(effects);\n\t\t\tprevious_batch = null;\n\n\t\t\tthis.#deferred?.resolve();\n\t\t}\n\n\t\tvar next_batch = /** @type {Batch | null} */ (/** @type {unknown} */ (current_batch));\n\n\t\t// Edge case: During traversal new branches might create effects that run immediately and set state,\n\t\t// causing an effect and therefore a root to be scheduled again. We need to traverse the current batch\n\t\t// once more in that case - most of the time this will just clean up dirty branches.\n\t\tif (this.#roots.length > 0) {\n\t\t\tconst batch = (next_batch ??= this);\n\t\t\tbatch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));\n\t\t}\n\n\t\tif (next_batch !== null) {\n\t\t\tbatches.add(next_batch);\n\n\t\t\tif (DEV) {\n\t\t\t\tfor (const source of this.current.keys()) {\n\t\t\t\t\t/** @type {Set<Source>} */ (source_stacks).add(source);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnext_batch.#process();\n\t\t}\n\n\t\t// In sync mode flushSync can cause #commit to wrongfully think that there needs to be a rebase, so we only do it in async mode\n\t\t// TODO fix the underlying cause, otherwise this will likely regress when non-async mode is removed\n\t\tif (async_mode_flag && !batches.has(this)) {\n\t\t\tthis.#commit();\n\t\t}\n\t}\n\n\t/**\n\t * Traverse the effect tree, executing effects or stashing\n\t * them for later execution as appropriate\n\t * @param {Effect} root\n\t * @param {Effect[]} effects\n\t * @param {Effect[]} render_effects\n\t */\n\t#traverse(root, effects, render_effects) {\n\t\troot.f ^= CLEAN;\n\n\t\tvar effect = root.first;\n\n\t\twhile (effect !== null) {\n\t\t\tvar flags = effect.f;\n\t\t\tvar is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;\n\t\t\tvar is_skippable_branch = is_branch && (flags & CLEAN) !== 0;\n\n\t\t\tvar skip = is_skippable_branch || (flags & INERT) !== 0 || this.#skipped_branches.has(effect);\n\n\t\t\tif (!skip && effect.fn !== null) {\n\t\t\t\tif (is_branch) {\n\t\t\t\t\teffect.f ^= CLEAN;\n\t\t\t\t} else if ((flags & EFFECT) !== 0) {\n\t\t\t\t\teffects.push(effect);\n\t\t\t\t} else if (async_mode_flag && (flags & (RENDER_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\t\t\trender_effects.push(effect);\n\t\t\t\t} else if (is_dirty(effect)) {\n\t\t\t\t\tif ((flags & BLOCK_EFFECT) !== 0) this.#maybe_dirty_effects.add(effect);\n\t\t\t\t\tupdate_effect(effect);\n\t\t\t\t}\n\n\t\t\t\tvar child = effect.first;\n\n\t\t\t\tif (child !== null) {\n\t\t\t\t\teffect = child;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile (effect !== null) {\n\t\t\t\tvar next = effect.next;\n\n\t\t\t\tif (next !== null) {\n\t\t\t\t\teffect = next;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\teffect = effect.parent;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Effect[]} effects\n\t */\n\t#defer_effects(effects) {\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tdefer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);\n\t\t}\n\t}\n\n\t/**\n\t * Associate a change to a given source with the current\n\t * batch, noting its previous and current values\n\t * @param {Value} source\n\t * @param {any} value\n\t * @param {boolean} [is_derived]\n\t */\n\tcapture(source, value, is_derived = false) {\n\t\tif (source.v !== UNINITIALIZED && !this.previous.has(source)) {\n\t\t\tthis.previous.set(source, source.v);\n\t\t}\n\n\t\t// Don't save errors in `batch_values`, or they won't be thrown in `runtime.js#get`\n\t\tif ((source.f & ERROR_VALUE) === 0) {\n\t\t\tthis.current.set(source, [value, is_derived]);\n\t\t\tbatch_values?.set(source, value);\n\t\t}\n\n\t\tif (!this.is_fork) {\n\t\t\tsource.v = value;\n\t\t}\n\t}\n\n\tactivate() {\n\t\tcurrent_batch = this;\n\t}\n\n\tdeactivate() {\n\t\tcurrent_batch = null;\n\t\tbatch_values = null;\n\t}\n\n\tflush() {\n\t\tvar source_stacks = DEV ? new Set() : null;\n\n\t\ttry {\n\t\t\tis_processing = true;\n\t\t\tcurrent_batch = this;\n\n\t\t\tthis.#process();\n\t\t} finally {\n\t\t\tflush_count = 0;\n\t\t\tlast_scheduled_effect = null;\n\t\t\tcollected_effects = null;\n\t\t\tlegacy_updates = null;\n\t\t\tis_processing = false;\n\n\t\t\tcurrent_batch = null;\n\t\t\tbatch_values = null;\n\n\t\t\told_values.clear();\n\n\t\t\tif (DEV) {\n\t\t\t\tfor (const source of /** @type {Set<Source>} */ (source_stacks)) {\n\t\t\t\t\tsource.updated = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdiscard() {\n\t\tfor (const fn of this.#discard_callbacks) fn(this);\n\t\tthis.#discard_callbacks.clear();\n\t\tthis.#fork_commit_callbacks.clear();\n\n\t\tbatches.delete(this);\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t */\n\tregister_created_effect(effect) {\n\t\tthis.#new_effects.push(effect);\n\t}\n\n\t#commit() {\n\t\t// If there are other pending batches, they now need to be 'rebased' —\n\t\t// in other words, we re-run block/async effects with the newly\n\t\t// committed state, unless the batch in question has a more\n\t\t// recent value for a given source\n\t\tfor (const batch of batches) {\n\t\t\tvar is_earlier = batch.id < this.id;\n\n\t\t\t/** @type {Source[]} */\n\t\t\tvar sources = [];\n\n\t\t\tfor (const [source, [value, is_derived]] of this.current) {\n\t\t\t\tif (batch.current.has(source)) {\n\t\t\t\t\tvar batch_value = /** @type {[any, boolean]} */ (batch.current.get(source))[0]; // faster than destructuring\n\n\t\t\t\t\tif (is_earlier && value !== batch_value) {\n\t\t\t\t\t\t// bring the value up to date\n\t\t\t\t\t\tbatch.current.set(source, [value, is_derived]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// same value or later batch has more recent value,\n\t\t\t\t\t\t// no need to re-run these effects\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsources.push(source);\n\t\t\t}\n\n\t\t\t// Re-run async/block effects that depend on distinct values changed in both batches\n\t\t\tvar others = [...batch.current.keys()].filter((s) => !this.current.has(s));\n\n\t\t\tif (others.length === 0) {\n\t\t\t\tif (is_earlier) {\n\t\t\t\t\t// this batch is now obsolete and can be discarded\n\t\t\t\t\tbatch.discard();\n\t\t\t\t}\n\t\t\t} else if (sources.length > 0) {\n\t\t\t\tif (DEV) {\n\t\t\t\t\tinvariant(batch.#roots.length === 0, 'Batch has scheduled roots');\n\t\t\t\t}\n\n\t\t\t\t// A batch was unskipped in a later batch -> tell prior batches to unskip it, too\n\t\t\t\tif (is_earlier) {\n\t\t\t\t\tfor (const unskipped of this.#unskipped_branches) {\n\t\t\t\t\t\tbatch.unskip_effect(unskipped, (e) => {\n\t\t\t\t\t\t\tif ((e.f & (BLOCK_EFFECT | ASYNC)) !== 0) {\n\t\t\t\t\t\t\t\tbatch.schedule(e);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbatch.#defer_effects([e]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.activate();\n\n\t\t\t\t/** @type {Set<Value>} */\n\t\t\t\tvar marked = new Set();\n\n\t\t\t\t/** @type {Map<Reaction, boolean>} */\n\t\t\t\tvar checked = new Map();\n\n\t\t\t\tfor (var source of sources) {\n\t\t\t\t\tmark_effects(source, others, marked, checked);\n\t\t\t\t}\n\n\t\t\t\tchecked = new Map();\n\t\t\t\tvar current_unequal = [...batch.current.keys()].filter((c) =>\n\t\t\t\t\tthis.current.has(c) ? /** @type {[any, boolean]} */ (this.current.get(c))[0] !== c : true\n\t\t\t\t);\n\n\t\t\t\tfor (const effect of this.#new_effects) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t(effect.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 &&\n\t\t\t\t\t\tdepends_on(effect, current_unequal, checked)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ((effect.f & (ASYNC | BLOCK_EFFECT)) !== 0) {\n\t\t\t\t\t\t\tset_signal_status(effect, DIRTY);\n\t\t\t\t\t\t\tbatch.schedule(effect);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbatch.#dirty_effects.add(effect);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Only apply and traverse when we know we triggered async work with marking the effects\n\t\t\t\tif (batch.#roots.length > 0) {\n\t\t\t\t\tbatch.apply();\n\n\t\t\t\t\tfor (var root of batch.#roots) {\n\t\t\t\t\t\tbatch.#traverse(root, [], []);\n\t\t\t\t\t}\n\n\t\t\t\t\tbatch.#roots = [];\n\t\t\t\t}\n\n\t\t\t\tbatch.deactivate();\n\t\t\t}\n\t\t}\n\n\t\tfor (const batch of batches) {\n\t\t\tif (batch.#blockers.has(this)) {\n\t\t\t\tbatch.#blockers.delete(this);\n\n\t\t\t\tif (batch.#blockers.size === 0 && !batch.#is_deferred()) {\n\t\t\t\t\tbatch.activate();\n\t\t\t\t\tbatch.#process();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {boolean} blocking\n\t * @param {Effect} effect\n\t */\n\tincrement(blocking, effect) {\n\t\tlet pending_count = this.#pending.get(effect) ?? 0;\n\t\tthis.#pending.set(effect, pending_count + 1);\n\n\t\tif (blocking) {\n\t\t\tlet blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;\n\t\t\tthis.#blocking_pending.set(effect, blocking_pending_count + 1);\n\t\t}\n\t}\n\n\t/**\n\t * @param {boolean} blocking\n\t * @param {Effect} effect\n\t * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)\n\t */\n\tdecrement(blocking, effect, skip) {\n\t\tlet pending_count = this.#pending.get(effect) ?? 0;\n\n\t\tif (pending_count === 1) {\n\t\t\tthis.#pending.delete(effect);\n\t\t} else {\n\t\t\tthis.#pending.set(effect, pending_count - 1);\n\t\t}\n\n\t\tif (blocking) {\n\t\t\tlet blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;\n\n\t\t\tif (blocking_pending_count === 1) {\n\t\t\t\tthis.#blocking_pending.delete(effect);\n\t\t\t} else {\n\t\t\t\tthis.#blocking_pending.set(effect, blocking_pending_count - 1);\n\t\t\t}\n\t\t}\n\n\t\tif (this.#decrement_queued || skip) return;\n\t\tthis.#decrement_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#decrement_queued = false;\n\t\t\tthis.flush();\n\t\t});\n\t}\n\n\t/**\n\t * @param {Set<Effect>} dirty_effects\n\t * @param {Set<Effect>} maybe_dirty_effects\n\t */\n\ttransfer_effects(dirty_effects, maybe_dirty_effects) {\n\t\tfor (const e of dirty_effects) {\n\t\t\tthis.#dirty_effects.add(e);\n\t\t}\n\n\t\tfor (const e of maybe_dirty_effects) {\n\t\t\tthis.#maybe_dirty_effects.add(e);\n\t\t}\n\n\t\tdirty_effects.clear();\n\t\tmaybe_dirty_effects.clear();\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\toncommit(fn) {\n\t\tthis.#commit_callbacks.add(fn);\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\tondiscard(fn) {\n\t\tthis.#discard_callbacks.add(fn);\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\ton_fork_commit(fn) {\n\t\tthis.#fork_commit_callbacks.add(fn);\n\t}\n\n\trun_fork_commit_callbacks() {\n\t\tfor (const fn of this.#fork_commit_callbacks) fn(this);\n\t\tthis.#fork_commit_callbacks.clear();\n\t}\n\n\tsettled() {\n\t\treturn (this.#deferred ??= deferred()).promise;\n\t}\n\n\tstatic ensure() {\n\t\tif (current_batch === null) {\n\t\t\tconst batch = (current_batch = new Batch());\n\n\t\t\tif (!is_processing) {\n\t\t\t\tbatches.add(current_batch);\n\n\t\t\t\tif (!is_flushing_sync) {\n\t\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\t\tif (current_batch !== batch) {\n\t\t\t\t\t\t\t// a flushSync happened in the meantime\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbatch.flush();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn current_batch;\n\t}\n\n\tapply() {\n\t\tif (!async_mode_flag || (!this.is_fork && batches.size === 1)) {\n\t\t\tbatch_values = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// if there are multiple batches, we are 'time travelling' —\n\t\t// we need to override values with the ones in this batch...\n\t\tbatch_values = new Map();\n\t\tfor (const [source, [value]] of this.current) {\n\t\t\tbatch_values.set(source, value);\n\t\t}\n\n\t\t// ...and undo changes belonging to other batches unless they block this one\n\t\tfor (const batch of batches) {\n\t\t\tif (batch === this || batch.is_fork) continue;\n\n\t\t\t// A batch is blocked on an earlier batch if it overlaps with the earlier batch's changes but is not a superset\n\t\t\tvar intersects = false;\n\t\t\tvar differs = false;\n\n\t\t\tif (batch.id < this.id) {\n\t\t\t\tfor (const [source, [, is_derived]] of batch.current) {\n\t\t\t\t\t// Derived values don't partake in the blocking mechanism, because a derived could\n\t\t\t\t\t// be triggered in one batch already but not the other one yet, causing a false-positive\n\t\t\t\t\tif (is_derived) continue;\n\n\t\t\t\t\tintersects ||= this.current.has(source);\n\t\t\t\t\tdiffers ||= !this.current.has(source);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (intersects && differs) {\n\t\t\t\tthis.#blockers.add(batch);\n\t\t\t} else {\n\t\t\t\tfor (const [source, previous] of batch.previous) {\n\t\t\t\t\tif (!batch_values.has(source)) {\n\t\t\t\t\t\tbatch_values.set(source, previous);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Effect} effect\n\t */\n\tschedule(effect) {\n\t\tlast_scheduled_effect = effect;\n\n\t\t// defer render effects inside a pending boundary\n\t\t// TODO the `REACTION_RAN` check is only necessary because of legacy `$:` effects AFAICT — we can remove later\n\t\tif (\n\t\t\teffect.b?.is_pending &&\n\t\t\t(effect.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 &&\n\t\t\t(effect.f & REACTION_RAN) === 0\n\t\t) {\n\t\t\teffect.b.defer_effect(effect);\n\t\t\treturn;\n\t\t}\n\n\t\tvar e = effect;\n\n\t\twhile (e.parent !== null) {\n\t\t\te = e.parent;\n\t\t\tvar flags = e.f;\n\n\t\t\t// if the effect is being scheduled because a parent (each/await/etc) block\n\t\t\t// updated an internal source, or because a branch is being unskipped,\n\t\t\t// bail out or we'll cause a second flush\n\t\t\tif (collected_effects !== null && e === active_effect) {\n\t\t\t\tif (async_mode_flag) return;\n\n\t\t\t\t// in sync mode, render effects run during traversal. in an extreme edge case\n\t\t\t\t// — namely that we're setting a value inside a derived read during traversal —\n\t\t\t\t// they can be made dirty after they have already been visited, in which\n\t\t\t\t// case we shouldn't bail out. we also shouldn't bail out if we're\n\t\t\t\t// updating a store inside a `$:`, since this might invalidate\n\t\t\t\t// effects that were already visited\n\t\t\t\tif (\n\t\t\t\t\t(active_reaction === null || (active_reaction.f & DERIVED) === 0) &&\n\t\t\t\t\t!legacy_is_updating_store\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {\n\t\t\t\tif ((flags & CLEAN) === 0) {\n\t\t\t\t\t// branch is already dirty, bail\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.f ^= CLEAN;\n\t\t\t}\n\t\t}\n\n\t\tthis.#roots.push(e);\n\t}\n}\n\n// TODO Svelte@6 think about removing the callback argument.\n/**\n * Synchronously flush any pending updates.\n * Returns void if no callback is provided, otherwise returns the result of calling the callback.\n * @template [T=void]\n * @param {(() => T) | undefined} [fn]\n * @returns {T}\n */\nexport function flushSync(fn) {\n\tvar was_flushing_sync = is_flushing_sync;\n\tis_flushing_sync = true;\n\n\ttry {\n\t\tvar result;\n\n\t\tif (fn) {\n\t\t\tif (current_batch !== null && !current_batch.is_fork) {\n\t\t\t\tcurrent_batch.flush();\n\t\t\t}\n\n\t\t\tresult = fn();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tflush_tasks();\n\n\t\t\tif (current_batch === null) {\n\t\t\t\treturn /** @type {T} */ (result);\n\t\t\t}\n\n\t\t\tcurrent_batch.flush();\n\t\t}\n\t} finally {\n\t\tis_flushing_sync = was_flushing_sync;\n\t}\n}\n\nfunction infinite_loop_guard() {\n\tif (DEV) {\n\t\tvar updates = new Map();\n\n\t\tfor (const source of /** @type {Batch} */ (current_batch).current.keys()) {\n\t\t\tfor (const [stack, update] of source.updated ?? []) {\n\t\t\t\tvar entry = updates.get(stack);\n\n\t\t\t\tif (!entry) {\n\t\t\t\t\tentry = { error: update.error, count: 0 };\n\t\t\t\t\tupdates.set(stack, entry);\n\t\t\t\t}\n\n\t\t\t\tentry.count += update.count;\n\t\t\t}\n\t\t}\n\n\t\tfor (const update of updates.values()) {\n\t\t\tif (update.error) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error(update.error);\n\t\t\t}\n\t\t}\n\t}\n\n\ttry {\n\t\te.effect_update_depth_exceeded();\n\t} catch (error) {\n\t\tif (DEV) {\n\t\t\t// stack contains no useful information, replace it\n\t\t\tdefine_property(error, 'stack', { value: '' });\n\t\t}\n\n\t\t// Best effort: invoke the boundary nearest the most recent\n\t\t// effect and hope that it's relevant to the infinite loop\n\t\tinvoke_error_boundary(error, last_scheduled_effect);\n\t}\n}\n\n/** @type {Set<Effect> | null} */\nexport let eager_block_effects = null;\n\n/**\n * @param {Array<Effect>} effects\n * @returns {void}\n */\nfunction flush_queued_effects(effects) {\n\tvar length = effects.length;\n\tif (length === 0) return;\n\n\tvar i = 0;\n\n\twhile (i < length) {\n\t\tvar effect = effects[i++];\n\n\t\tif ((effect.f & (DESTROYED | INERT)) === 0 && is_dirty(effect)) {\n\t\t\teager_block_effects = new Set();\n\n\t\t\tupdate_effect(effect);\n\n\t\t\t// Effects with no dependencies or teardown do not get added to the effect tree.\n\t\t\t// Deferred effects (e.g. `$effect(...)`) _are_ added to the tree because we\n\t\t\t// don't know if we need to keep them until they are executed. Doing the check\n\t\t\t// here (rather than in `update_effect`) allows us to skip the work for\n\t\t\t// immediate effects.\n\t\t\tif (\n\t\t\t\teffect.deps === null &&\n\t\t\t\teffect.first === null &&\n\t\t\t\teffect.nodes === null &&\n\t\t\t\teffect.teardown === null &&\n\t\t\t\teffect.ac === null\n\t\t\t) {\n\t\t\t\t// remove this effect from the graph\n\t\t\t\tunlink_effect(effect);\n\t\t\t}\n\n\t\t\t// If update_effect() has a flushSync() in it, we may have flushed another flush_queued_effects(),\n\t\t\t// which already handled this logic and did set eager_block_effects to null.\n\t\t\tif (eager_block_effects?.size > 0) {\n\t\t\t\told_values.clear();\n\n\t\t\t\tfor (const e of eager_block_effects) {\n\t\t\t\t\t// Skip eager effects that have already been unmounted\n\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0) continue;\n\n\t\t\t\t\t// Run effects in order from ancestor to descendant, else we could run into nullpointers\n\t\t\t\t\t/** @type {Effect[]} */\n\t\t\t\t\tconst ordered_effects = [e];\n\t\t\t\t\tlet ancestor = e.parent;\n\t\t\t\t\twhile (ancestor !== null) {\n\t\t\t\t\t\tif (eager_block_effects.has(ancestor)) {\n\t\t\t\t\t\t\teager_block_effects.delete(ancestor);\n\t\t\t\t\t\t\tordered_effects.push(ancestor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tancestor = ancestor.parent;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (let j = ordered_effects.length - 1; j >= 0; j--) {\n\t\t\t\t\t\tconst e = ordered_effects[j];\n\t\t\t\t\t\t// Skip eager effects that have already been unmounted\n\t\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0) continue;\n\t\t\t\t\t\tupdate_effect(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\teager_block_effects.clear();\n\t\t\t}\n\t\t}\n\t}\n\n\teager_block_effects = null;\n}\n\n/**\n * This is similar to `mark_reactions`, but it only marks async/block effects\n * depending on `value` and at least one of the other `sources`, so that\n * these effects can re-run after another batch has been committed\n * @param {Value} value\n * @param {Source[]} sources\n * @param {Set<Value>} marked\n * @param {Map<Reaction, boolean>} checked\n */\nfunction mark_effects(value, sources, marked, checked) {\n\tif (marked.has(value)) return;\n\tmarked.add(value);\n\n\tif (value.reactions !== null) {\n\t\tfor (const reaction of value.reactions) {\n\t\t\tconst flags = reaction.f;\n\n\t\t\tif ((flags & DERIVED) !== 0) {\n\t\t\t\tmark_effects(/** @type {Derived} */ (reaction), sources, marked, checked);\n\t\t\t} else if (\n\t\t\t\t(flags & (ASYNC | BLOCK_EFFECT)) !== 0 &&\n\t\t\t\t(flags & DIRTY) === 0 &&\n\t\t\t\tdepends_on(reaction, sources, checked)\n\t\t\t) {\n\t\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\t\tschedule_effect(/** @type {Effect} */ (reaction));\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * When committing a fork, we need to trigger eager effects so that\n * any `$state.eager(...)` expressions update immediately. This\n * function allows us to discover them\n * @param {Value} value\n * @param {Set<Effect>} effects\n */\nfunction mark_eager_effects(value, effects) {\n\tif (value.reactions === null) return;\n\n\tfor (const reaction of value.reactions) {\n\t\tconst flags = reaction.f;\n\n\t\tif ((flags & DERIVED) !== 0) {\n\t\t\tmark_eager_effects(/** @type {Derived} */ (reaction), effects);\n\t\t} else if ((flags & EAGER_EFFECT) !== 0) {\n\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\teffects.add(/** @type {Effect} */ (reaction));\n\t\t}\n\t}\n}\n\n/**\n * @param {Reaction} reaction\n * @param {Source[]} sources\n * @param {Map<Reaction, boolean>} checked\n */\nfunction depends_on(reaction, sources, checked) {\n\tconst depends = checked.get(reaction);\n\tif (depends !== undefined) return depends;\n\n\tif (reaction.deps !== null) {\n\t\tfor (const dep of reaction.deps) {\n\t\t\tif (includes.call(sources, dep)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif ((dep.f & DERIVED) !== 0 && depends_on(/** @type {Derived} */ (dep), sources, checked)) {\n\t\t\t\tchecked.set(/** @type {Derived} */ (dep), true);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\tchecked.set(reaction, false);\n\n\treturn false;\n}\n\n/**\n * @param {Effect} effect\n * @returns {void}\n */\nexport function schedule_effect(effect) {\n\t/** @type {Batch} */ (current_batch).schedule(effect);\n}\n\n/** @type {Source<number>[]} */\nlet eager_versions = [];\n\nfunction eager_flush() {\n\tflushSync(() => {\n\t\tconst eager = eager_versions;\n\t\teager_versions = [];\n\t\tfor (const version of eager) {\n\t\t\tupdate(version);\n\t\t}\n\t});\n}\n\n/**\n * Implementation of `$state.eager(fn())`\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function eager(fn) {\n\tvar version = source(0);\n\tvar initial = true;\n\tvar value = /** @type {T} */ (undefined);\n\n\tget(version);\n\n\teager_effect(() => {\n\t\tif (initial) {\n\t\t\t// the first time this runs, we create an eager effect\n\t\t\t// that will run eagerly whenever the expression changes\n\t\t\tvar previous_batch_values = batch_values;\n\n\t\t\ttry {\n\t\t\t\tbatch_values = null;\n\t\t\t\tvalue = fn();\n\t\t\t} finally {\n\t\t\t\tbatch_values = previous_batch_values;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// the second time this effect runs, it's to schedule a\n\t\t// `version` update. since this will recreate the effect,\n\t\t// we don't need to evaluate the expression here\n\t\tif (eager_versions.length === 0) {\n\t\t\tqueue_micro_task(eager_flush);\n\t\t}\n\n\t\teager_versions.push(version);\n\t});\n\n\tinitial = false;\n\n\treturn value;\n}\n\n/**\n * Mark all the effects inside a skipped branch CLEAN, so that\n * they can be correctly rescheduled later. Tracks dirty and maybe_dirty\n * effects so they can be rescheduled if the branch survives.\n * @param {Effect} effect\n * @param {{ d: Effect[], m: Effect[] }} tracked\n */\nfunction reset_branch(effect, tracked) {\n\t// clean branch = nothing dirty inside, no need to traverse further\n\tif ((effect.f & BRANCH_EFFECT) !== 0 && (effect.f & CLEAN) !== 0) {\n\t\treturn;\n\t}\n\n\tif ((effect.f & DIRTY) !== 0) {\n\t\ttracked.d.push(effect);\n\t} else if ((effect.f & MAYBE_DIRTY) !== 0) {\n\t\ttracked.m.push(effect);\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar e = effect.first;\n\twhile (e !== null) {\n\t\treset_branch(e, tracked);\n\t\te = e.next;\n\t}\n}\n\n/**\n * Mark an entire effect tree clean following an error\n * @param {Effect} effect\n */\nfunction reset_all(effect) {\n\tset_signal_status(effect, CLEAN);\n\n\tvar e = effect.first;\n\twhile (e !== null) {\n\t\treset_all(e);\n\t\te = e.next;\n\t}\n}\n\n/**\n * Creates a 'fork', in which state changes are evaluated but not applied to the DOM.\n * This is useful for speculatively loading data (for example) when you suspect that\n * the user is about to take some action.\n *\n * Frameworks like SvelteKit can use this to preload data when the user touches or\n * hovers over a link, making any subsequent navigation feel instantaneous.\n *\n * The `fn` parameter is a synchronous function that modifies some state. The\n * state changes will be reverted after the fork is initialised, then reapplied\n * if and when the fork is eventually committed.\n *\n * When it becomes clear that a fork will _not_ be committed (e.g. because the\n * user navigated elsewhere), it must be discarded to avoid leaking memory.\n *\n * @param {() => void} fn\n * @returns {Fork}\n * @since 5.42\n */\nexport function fork(fn) {\n\tif (!async_mode_flag) {\n\t\te.experimental_async_required('fork');\n\t}\n\n\tif (current_batch !== null) {\n\t\te.fork_timing();\n\t}\n\n\tvar batch = Batch.ensure();\n\tbatch.is_fork = true;\n\tbatch_values = new Map();\n\n\tvar committed = false;\n\tvar settled = batch.settled();\n\n\tflushSync(fn);\n\n\treturn {\n\t\tcommit: async () => {\n\t\t\tif (committed) {\n\t\t\t\tawait settled;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!batches.has(batch)) {\n\t\t\t\te.fork_discarded();\n\t\t\t}\n\n\t\t\tcommitted = true;\n\n\t\t\tbatch.is_fork = false;\n\n\t\t\t// apply changes and update write versions so deriveds see the change\n\t\t\tfor (var [source, [value]] of batch.current) {\n\t\t\t\tsource.v = value;\n\t\t\t\tsource.wv = increment_write_version();\n\t\t\t}\n\n\t\t\tbatch.activate();\n\t\t\tbatch.run_fork_commit_callbacks();\n\t\t\tbatch.deactivate();\n\n\t\t\t// trigger any `$state.eager(...)` expressions with the new state.\n\t\t\t// eager effects don't get scheduled like other effects, so we\n\t\t\t// can't just encounter them during traversal, we need to\n\t\t\t// proactively flush them\n\t\t\t// TODO maybe there's a better implementation?\n\t\t\tflushSync(() => {\n\t\t\t\t/** @type {Set<Effect>} */\n\t\t\t\tvar eager_effects = new Set();\n\n\t\t\t\tfor (var source of batch.current.keys()) {\n\t\t\t\t\tmark_eager_effects(source, eager_effects);\n\t\t\t\t}\n\n\t\t\t\tset_eager_effects(eager_effects);\n\t\t\t\tflush_eager_effects();\n\t\t\t});\n\n\t\t\tbatch.flush();\n\t\t\tawait settled;\n\t\t},\n\t\tdiscard: () => {\n\t\t\t// cause any MAYBE_DIRTY deriveds to update\n\t\t\t// if they depend on things thath changed\n\t\t\t// inside the discarded fork\n\t\t\tfor (var source of batch.current.keys()) {\n\t\t\t\tsource.wv = increment_write_version();\n\t\t\t}\n\n\t\t\tif (!committed && batches.has(batch)) {\n\t\t\t\tbatch.discard();\n\t\t\t}\n\t\t}\n\t};\n}\n\n/**\n * Forcibly remove all current batches, to prevent cross-talk between tests\n */\nexport function clear() {\n\tbatches.clear();\n}\n","import { get, tick, untrack } from '../internal/client/runtime.js';\nimport { effect_tracking, render_effect } from '../internal/client/reactivity/effects.js';\nimport { source, increment } from '../internal/client/reactivity/sources.js';\nimport { tag } from '../internal/client/dev/tracing.js';\nimport { DEV } from 'esm-env';\nimport { queue_micro_task } from '../internal/client/dom/task.js';\n\n/**\n * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.\n * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.\n *\n * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),\n * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.\n *\n * If `start` returns a cleanup function, it will be called when the effect is destroyed.\n *\n * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects\n * are active, and the returned teardown function will only be called when all effects are destroyed.\n *\n * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):\n *\n * ```js\n * import { createSubscriber } from 'svelte/reactivity';\n * import { on } from 'svelte/events';\n *\n * export class MediaQuery {\n * \t#query;\n * \t#subscribe;\n *\n * \tconstructor(query) {\n * \t\tthis.#query = window.matchMedia(`(${query})`);\n *\n * \t\tthis.#subscribe = createSubscriber((update) => {\n * \t\t\t// when the `change` event occurs, re-run any effects that read `this.current`\n * \t\t\tconst off = on(this.#query, 'change', update);\n *\n * \t\t\t// stop listening when all the effects are destroyed\n * \t\t\treturn () => off();\n * \t\t});\n * \t}\n *\n * \tget current() {\n * \t\t// This makes the getter reactive, if read in an effect\n * \t\tthis.#subscribe();\n *\n * \t\t// Return the current state of the query, whether or not we're in an effect\n * \t\treturn this.#query.matches;\n * \t}\n * }\n * ```\n * @param {(update: () => void) => (() => void) | void} start\n * @since 5.7.0\n */\nexport function createSubscriber(start) {\n\tlet subscribers = 0;\n\tlet version = source(0);\n\t/** @type {(() => void) | void} */\n\tlet stop;\n\n\tif (DEV) {\n\t\ttag(version, 'createSubscriber version');\n\t}\n\n\treturn () => {\n\t\tif (effect_tracking()) {\n\t\t\tget(version);\n\n\t\t\trender_effect(() => {\n\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\tstop = untrack(() => start(() => increment(version)));\n\t\t\t\t}\n\n\t\t\t\tsubscribers += 1;\n\n\t\t\t\treturn () => {\n\t\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\t\t// Only count down after a microtask, else we would reach 0 before our own render effect reruns,\n\t\t\t\t\t\t// but reach 1 again when the tick callback of the prior teardown runs. That would mean we\n\t\t\t\t\t\t// re-subcribe unnecessarily and create a memory leak because the old subscription is never cleaned up.\n\t\t\t\t\t\tsubscribers -= 1;\n\n\t\t\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\t\t\tstop?.();\n\t\t\t\t\t\t\tstop = undefined;\n\t\t\t\t\t\t\t// Increment the version to ensure any dependent deriveds are marked dirty when the subscription is picked up again later.\n\t\t\t\t\t\t\t// If we didn't do this then the comparison of write versions would determine that the derived has a later version than\n\t\t\t\t\t\t\t// the subscriber, and it would not be re-run.\n\t\t\t\t\t\t\tincrement(version);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t};\n}\n","/** @import { Effect, Source, TemplateNode, } from '#client' */\nimport {\n\tBOUNDARY_EFFECT,\n\tDIRTY,\n\tEFFECT_PRESERVED,\n\tEFFECT_TRANSPARENT,\n\tMAYBE_DIRTY\n} from '#client/constants';\nimport { HYDRATION_START_ELSE, HYDRATION_START_FAILED } from '../../../../constants.js';\nimport { component_context, set_component_context } from '../../context.js';\nimport { handle_error, invoke_error_boundary } from '../../error-handling.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect\n} from '../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tnext,\n\tskip_nodes,\n\tset_hydrate_node\n} from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport * as e from '../../errors.js';\nimport * as w from '../../warnings.js';\nimport { DEV } from 'esm-env';\nimport { Batch, current_batch, previous_batch, schedule_effect } from '../../reactivity/batch.js';\nimport { internal_set, source } from '../../reactivity/sources.js';\nimport { tag } from '../../dev/tracing.js';\nimport { createSubscriber } from '../../../../reactivity/create-subscriber.js';\nimport { create_text } from '../operations.js';\nimport { defer_effect } from '../../reactivity/utils.js';\nimport { set_signal_status } from '../../reactivity/status.js';\n\n/**\n * @typedef {{\n * \t onerror?: (error: unknown, reset: () => void) => void;\n *   failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;\n *   pending?: (anchor: Node) => void;\n * }} BoundaryProps\n */\n\nvar flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;\n\n/**\n * @param {TemplateNode} node\n * @param {BoundaryProps} props\n * @param {((anchor: Node) => void)} children\n * @param {((error: unknown) => unknown) | undefined} [transform_error]\n * @returns {void}\n */\nexport function boundary(node, props, children, transform_error) {\n\tnew Boundary(node, props, children, transform_error);\n}\n\nexport class Boundary {\n\t/** @type {Boundary | null} */\n\tparent;\n\n\tis_pending = false;\n\n\t/**\n\t * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.\n\t * Inherited from parent boundary, or defaults to identity.\n\t * @type {(error: unknown) => unknown}\n\t */\n\ttransform_error;\n\n\t/** @type {TemplateNode} */\n\t#anchor;\n\n\t/** @type {TemplateNode | null} */\n\t#hydrate_open = hydrating ? hydrate_node : null;\n\n\t/** @type {BoundaryProps} */\n\t#props;\n\n\t/** @type {((anchor: Node) => void)} */\n\t#children;\n\n\t/** @type {Effect} */\n\t#effect;\n\n\t/** @type {Effect | null} */\n\t#main_effect = null;\n\n\t/** @type {Effect | null} */\n\t#pending_effect = null;\n\n\t/** @type {Effect | null} */\n\t#failed_effect = null;\n\n\t/** @type {DocumentFragment | null} */\n\t#offscreen_fragment = null;\n\n\t#local_pending_count = 0;\n\t#pending_count = 0;\n\t#pending_count_update_queued = false;\n\n\t/** @type {Set<Effect>} */\n\t#dirty_effects = new Set();\n\n\t/** @type {Set<Effect>} */\n\t#maybe_dirty_effects = new Set();\n\n\t/**\n\t * A source containing the number of pending async deriveds/expressions.\n\t * Only created if `$effect.pending()` is used inside the boundary,\n\t * otherwise updating the source results in needless `Batch.ensure()`\n\t * calls followed by no-op flushes\n\t * @type {Source<number> | null}\n\t */\n\t#effect_pending = null;\n\n\t#effect_pending_subscriber = createSubscriber(() => {\n\t\tthis.#effect_pending = source(this.#local_pending_count);\n\n\t\tif (DEV) {\n\t\t\ttag(this.#effect_pending, '$effect.pending()');\n\t\t}\n\n\t\treturn () => {\n\t\t\tthis.#effect_pending = null;\n\t\t};\n\t});\n\n\t/**\n\t * @param {TemplateNode} node\n\t * @param {BoundaryProps} props\n\t * @param {((anchor: Node) => void)} children\n\t * @param {((error: unknown) => unknown) | undefined} [transform_error]\n\t */\n\tconstructor(node, props, children, transform_error) {\n\t\tthis.#anchor = node;\n\t\tthis.#props = props;\n\n\t\tthis.#children = (anchor) => {\n\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\teffect.b = this;\n\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\tchildren(anchor);\n\t\t};\n\n\t\tthis.parent = /** @type {Effect} */ (active_effect).b;\n\n\t\t// Inherit transform_error from parent boundary, or use the provided one, or default to identity\n\t\tthis.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);\n\n\t\tthis.#effect = block(() => {\n\t\t\tif (hydrating) {\n\t\t\t\tconst comment = /** @type {Comment} */ (this.#hydrate_open);\n\t\t\t\thydrate_next();\n\n\t\t\t\tconst server_rendered_pending = comment.data === HYDRATION_START_ELSE;\n\t\t\t\tconst server_rendered_failed = comment.data.startsWith(HYDRATION_START_FAILED);\n\n\t\t\t\tif (server_rendered_failed) {\n\t\t\t\t\t// Server rendered the failed snippet - hydrate it.\n\t\t\t\t\t// The serialized error is embedded in the comment: <!--[?<json>-->\n\t\t\t\t\tconst serialized_error = JSON.parse(comment.data.slice(HYDRATION_START_FAILED.length));\n\t\t\t\t\tthis.#hydrate_failed_content(serialized_error);\n\t\t\t\t} else if (server_rendered_pending) {\n\t\t\t\t\tthis.#hydrate_pending_content();\n\t\t\t\t} else {\n\t\t\t\t\tthis.#hydrate_resolved_content();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.#render();\n\t\t\t}\n\t\t}, flags);\n\n\t\tif (hydrating) {\n\t\t\tthis.#anchor = hydrate_node;\n\t\t}\n\t}\n\n\t#hydrate_resolved_content() {\n\t\ttry {\n\t\t\tthis.#main_effect = branch(() => this.#children(this.#anchor));\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {unknown} error The deserialized error from the server's hydration comment\n\t */\n\t#hydrate_failed_content(error) {\n\t\tconst failed = this.#props.failed;\n\t\tif (!failed) return;\n\n\t\tthis.#failed_effect = branch(() => {\n\t\t\tfailed(\n\t\t\t\tthis.#anchor,\n\t\t\t\t() => error,\n\t\t\t\t() => () => {}\n\t\t\t);\n\t\t});\n\t}\n\n\t#hydrate_pending_content() {\n\t\tconst pending = this.#props.pending;\n\t\tif (!pending) return;\n\n\t\tthis.is_pending = true;\n\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\n\t\tqueue_micro_task(() => {\n\t\t\tvar fragment = (this.#offscreen_fragment = document.createDocumentFragment());\n\t\t\tvar anchor = create_text();\n\n\t\t\tfragment.append(anchor);\n\n\t\t\tthis.#main_effect = this.#run(() => {\n\t\t\t\treturn branch(() => this.#children(anchor));\n\t\t\t});\n\n\t\t\tif (this.#pending_count === 0) {\n\t\t\t\tthis.#anchor.before(fragment);\n\t\t\t\tthis.#offscreen_fragment = null;\n\n\t\t\t\tpause_effect(/** @type {Effect} */ (this.#pending_effect), () => {\n\t\t\t\t\tthis.#pending_effect = null;\n\t\t\t\t});\n\n\t\t\t\tthis.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t}\n\t\t});\n\t}\n\n\t#render() {\n\t\ttry {\n\t\t\tthis.is_pending = this.has_pending_snippet();\n\t\t\tthis.#pending_count = 0;\n\t\t\tthis.#local_pending_count = 0;\n\n\t\t\tthis.#main_effect = branch(() => {\n\t\t\t\tthis.#children(this.#anchor);\n\t\t\t});\n\n\t\t\tif (this.#pending_count > 0) {\n\t\t\t\tvar fragment = (this.#offscreen_fragment = document.createDocumentFragment());\n\t\t\t\tmove_effect(this.#main_effect, fragment);\n\n\t\t\t\tconst pending = /** @type {(anchor: Node) => void} */ (this.#props.pending);\n\t\t\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\t\t\t} else {\n\t\t\t\tthis.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#resolve(batch) {\n\t\tthis.is_pending = false;\n\n\t\t// any effects that were previously deferred should be transferred\n\t\t// to the batch, which will flush in the next microtask\n\t\tbatch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);\n\t}\n\n\t/**\n\t * Defer an effect inside a pending boundary until the boundary resolves\n\t * @param {Effect} effect\n\t */\n\tdefer_effect(effect) {\n\t\tdefer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);\n\t}\n\n\t/**\n\t * Returns `false` if the effect exists inside a boundary whose pending snippet is shown\n\t * @returns {boolean}\n\t */\n\tis_rendered() {\n\t\treturn !this.is_pending && (!this.parent || this.parent.is_rendered());\n\t}\n\n\thas_pending_snippet() {\n\t\treturn !!this.#props.pending;\n\t}\n\n\t/**\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\t#run(fn) {\n\t\tvar previous_effect = active_effect;\n\t\tvar previous_reaction = active_reaction;\n\t\tvar previous_ctx = component_context;\n\n\t\tset_active_effect(this.#effect);\n\t\tset_active_reaction(this.#effect);\n\t\tset_component_context(this.#effect.ctx);\n\n\t\ttry {\n\t\t\tBatch.ensure();\n\t\t\treturn fn();\n\t\t} catch (e) {\n\t\t\thandle_error(e);\n\t\t\treturn null;\n\t\t} finally {\n\t\t\tset_active_effect(previous_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t\tset_component_context(previous_ctx);\n\t\t}\n\t}\n\n\t/**\n\t * Updates the pending count associated with the currently visible pending snippet,\n\t * if any, such that we can replace the snippet with content once work is done\n\t * @param {1 | -1} d\n\t * @param {Batch} batch\n\t */\n\t#update_pending_count(d, batch) {\n\t\tif (!this.has_pending_snippet()) {\n\t\t\tif (this.parent) {\n\t\t\t\tthis.parent.#update_pending_count(d, batch);\n\t\t\t}\n\n\t\t\t// if there's no parent, we're in a scope with no pending snippet\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#pending_count += d;\n\n\t\tif (this.#pending_count === 0) {\n\t\t\tthis.#resolve(batch);\n\n\t\t\tif (this.#pending_effect) {\n\t\t\t\tpause_effect(this.#pending_effect, () => {\n\t\t\t\t\tthis.#pending_effect = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (this.#offscreen_fragment) {\n\t\t\t\tthis.#anchor.before(this.#offscreen_fragment);\n\t\t\t\tthis.#offscreen_fragment = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Update the source that powers `$effect.pending()` inside this boundary,\n\t * and controls when the current `pending` snippet (if any) is removed.\n\t * Do not call from inside the class\n\t * @param {1 | -1} d\n\t * @param {Batch} batch\n\t */\n\tupdate_pending_count(d, batch) {\n\t\tthis.#update_pending_count(d, batch);\n\n\t\tthis.#local_pending_count += d;\n\n\t\tif (!this.#effect_pending || this.#pending_count_update_queued) return;\n\t\tthis.#pending_count_update_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#pending_count_update_queued = false;\n\t\t\tif (this.#effect_pending) {\n\t\t\t\tinternal_set(this.#effect_pending, this.#local_pending_count);\n\t\t\t}\n\t\t});\n\t}\n\n\tget_effect_pending() {\n\t\tthis.#effect_pending_subscriber();\n\t\treturn get(/** @type {Source<number>} */ (this.#effect_pending));\n\t}\n\n\t/** @param {unknown} error */\n\terror(error) {\n\t\t// If we have nothing to capture the error, or if we hit an error while\n\t\t// rendering the fallback, re-throw for another boundary to handle\n\t\tif (!this.#props.onerror && !this.#props.failed) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (current_batch?.is_fork) {\n\t\t\tif (this.#main_effect) current_batch.skip_effect(this.#main_effect);\n\t\t\tif (this.#pending_effect) current_batch.skip_effect(this.#pending_effect);\n\t\t\tif (this.#failed_effect) current_batch.skip_effect(this.#failed_effect);\n\n\t\t\tcurrent_batch.on_fork_commit(() => {\n\t\t\t\tthis.#handle_error(error);\n\t\t\t});\n\t\t} else {\n\t\t\tthis.#handle_error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {unknown} error\n\t */\n\t#handle_error(error) {\n\t\tif (this.#main_effect) {\n\t\t\tdestroy_effect(this.#main_effect);\n\t\t\tthis.#main_effect = null;\n\t\t}\n\n\t\tif (this.#pending_effect) {\n\t\t\tdestroy_effect(this.#pending_effect);\n\t\t\tthis.#pending_effect = null;\n\t\t}\n\n\t\tif (this.#failed_effect) {\n\t\t\tdestroy_effect(this.#failed_effect);\n\t\t\tthis.#failed_effect = null;\n\t\t}\n\n\t\tif (hydrating) {\n\t\t\tset_hydrate_node(/** @type {TemplateNode} */ (this.#hydrate_open));\n\t\t\tnext();\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tvar onerror = this.#props.onerror;\n\t\tlet failed = this.#props.failed;\n\t\tvar did_reset = false;\n\t\tvar calling_on_error = false;\n\n\t\tconst reset = () => {\n\t\t\tif (did_reset) {\n\t\t\t\tw.svelte_boundary_reset_noop();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdid_reset = true;\n\n\t\t\tif (calling_on_error) {\n\t\t\t\te.svelte_boundary_reset_onerror();\n\t\t\t}\n\n\t\t\tif (this.#failed_effect !== null) {\n\t\t\t\tpause_effect(this.#failed_effect, () => {\n\t\t\t\t\tthis.#failed_effect = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.#run(() => {\n\t\t\t\tthis.#render();\n\t\t\t});\n\t\t};\n\n\t\t/** @param {unknown} transformed_error */\n\t\tconst handle_error_result = (transformed_error) => {\n\t\t\ttry {\n\t\t\t\tcalling_on_error = true;\n\t\t\t\tonerror?.(transformed_error, reset);\n\t\t\t\tcalling_on_error = false;\n\t\t\t} catch (error) {\n\t\t\t\tinvoke_error_boundary(error, this.#effect && this.#effect.parent);\n\t\t\t}\n\n\t\t\tif (failed) {\n\t\t\t\tthis.#failed_effect = this.#run(() => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn branch(() => {\n\t\t\t\t\t\t\t// errors in `failed` snippets cause the boundary to error again\n\t\t\t\t\t\t\t// TODO Svelte 6: revisit this decision, most likely better to go to parent boundary instead\n\t\t\t\t\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\t\t\t\t\teffect.b = this;\n\t\t\t\t\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\t\t\t\t\tfailed(\n\t\t\t\t\t\t\t\tthis.#anchor,\n\t\t\t\t\t\t\t\t() => transformed_error,\n\t\t\t\t\t\t\t\t() => reset\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tinvoke_error_boundary(error, /** @type {Effect} */ (this.#effect.parent));\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tqueue_micro_task(() => {\n\t\t\t// Run the error through the API-level transformError transform (e.g. SvelteKit's handleError)\n\t\t\t/** @type {unknown} */\n\t\t\tvar result;\n\t\t\ttry {\n\t\t\t\tresult = this.transform_error(error);\n\t\t\t} catch (e) {\n\t\t\t\tinvoke_error_boundary(e, this.#effect && this.#effect.parent);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tresult !== null &&\n\t\t\t\ttypeof result === 'object' &&\n\t\t\t\ttypeof (/** @type {any} */ (result).then) === 'function'\n\t\t\t) {\n\t\t\t\t// transformError returned a Promise — wait for it\n\t\t\t\t/** @type {any} */ (result).then(\n\t\t\t\t\thandle_error_result,\n\t\t\t\t\t/** @param {unknown} e */\n\t\t\t\t\t(e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Synchronous result — handle immediately\n\t\t\t\thandle_error_result(result);\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function pending() {\n\tif (active_effect === null) {\n\t\te.effect_pending_outside_reaction();\n\t}\n\n\tvar boundary = active_effect.b;\n\n\tif (boundary === null) {\n\t\treturn 0; // TODO eventually we will need this to be global\n\t}\n\n\treturn boundary.get_effect_pending();\n}\n","/** @import { Blocker, Effect, Value } from '#client' */\nimport { DESTROYED, STALE_REACTION } from '#client/constants';\nimport { DEV } from 'esm-env';\nimport {\n\tcomponent_context,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_stack\n} from '../context.js';\nimport { Boundary } from '../dom/blocks/boundary.js';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../runtime.js';\nimport { Batch, current_batch } from './batch.js';\nimport {\n\tasync_derived,\n\treactivity_loss_tracker,\n\tderived,\n\tderived_safe_equal,\n\tset_reactivity_loss_tracker\n} from './deriveds.js';\nimport { aborted } from './effects.js';\n\n/**\n * @param {Blocker[]} blockers\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {(values: Value[]) => any} fn\n */\nexport function flatten(blockers, sync, async, fn) {\n\tconst d = is_runes() ? derived : derived_safe_equal;\n\n\t// Filter out already-settled blockers - no need to wait for them\n\tvar pending = blockers.filter((b) => !b.settled);\n\n\tif (async.length === 0 && pending.length === 0) {\n\t\tfn(sync.map(d));\n\t\treturn;\n\t}\n\n\tvar parent = /** @type {Effect} */ (active_effect);\n\n\tvar restore = capture();\n\tvar blocker_promise =\n\t\tpending.length === 1\n\t\t\t? pending[0].promise\n\t\t\t: pending.length > 1\n\t\t\t\t? Promise.all(pending.map((b) => b.promise))\n\t\t\t\t: null;\n\n\t/** @param {Value[]} values */\n\tfunction finish(values) {\n\t\trestore();\n\n\t\ttry {\n\t\t\tfn(values);\n\t\t} catch (error) {\n\t\t\tif ((parent.f & DESTROYED) === 0) {\n\t\t\t\tinvoke_error_boundary(error, parent);\n\t\t\t}\n\t\t}\n\n\t\tunset_context();\n\t}\n\n\t// Fast path: blockers but no async expressions\n\tif (async.length === 0) {\n\t\t/** @type {Promise<any>} */ (blocker_promise).then(() => finish(sync.map(d)));\n\t\treturn;\n\t}\n\n\tvar decrement_pending = increment_pending();\n\n\t// Full path: has async expressions\n\tfunction run() {\n\t\tPromise.all(async.map((expression) => async_derived(expression)))\n\t\t\t.then((result) => finish([...sync.map(d), ...result]))\n\t\t\t.catch((error) => invoke_error_boundary(error, parent))\n\t\t\t.finally(() => decrement_pending());\n\t}\n\n\tif (blocker_promise) {\n\t\tblocker_promise.then(() => {\n\t\t\trestore();\n\t\t\trun();\n\t\t\tunset_context();\n\t\t});\n\t} else {\n\t\trun();\n\t}\n}\n\n/**\n * @param {Blocker[]} blockers\n * @param {(values: Value[]) => any} fn\n */\nexport function run_after_blockers(blockers, fn) {\n\tflatten(blockers, [], [], fn);\n}\n\n/**\n * Captures the current effect context so that we can restore it after\n * some asynchronous work has happened (so that e.g. `await a + b`\n * causes `b` to be registered as a dependency).\n */\nexport function capture() {\n\tvar previous_effect = /** @type {Effect} */ (active_effect);\n\tvar previous_reaction = active_reaction;\n\tvar previous_component_context = component_context;\n\tvar previous_batch = /** @type {Batch} */ (current_batch);\n\n\tif (DEV) {\n\t\tvar previous_dev_stack = dev_stack;\n\t}\n\n\treturn function restore(activate_batch = true) {\n\t\tset_active_effect(previous_effect);\n\t\tset_active_reaction(previous_reaction);\n\t\tset_component_context(previous_component_context);\n\n\t\tif (activate_batch && (previous_effect.f & DESTROYED) === 0) {\n\t\t\t// TODO we only need optional chaining here because `{#await ...}` blocks\n\t\t\t// are anomalous. Once we retire them we can get rid of it\n\t\t\tprevious_batch?.activate();\n\t\t\tprevious_batch?.apply();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\tset_reactivity_loss_tracker(null);\n\t\t\tset_dev_stack(previous_dev_stack);\n\t\t}\n\t};\n}\n\n/**\n * Wraps an `await` expression in such a way that the effect context that was\n * active before the expression evaluated can be reapplied afterwards —\n * `await a + b` becomes `(await $.save(a))() + b`\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function save(promise) {\n\tvar restore = capture();\n\tvar value = await promise;\n\n\treturn () => {\n\t\trestore();\n\t\treturn value;\n\t};\n}\n\n/**\n * Reset `current_async_effect` after the `promise` resolves, so\n * that we can emit `await_reactivity_loss` warnings\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function track_reactivity_loss(promise) {\n\tvar previous_async_effect = reactivity_loss_tracker;\n\t// Ensure that unrelated reads after an async operation is kicked off don't cause false positives\n\tqueueMicrotask(() => {\n\t\tif (reactivity_loss_tracker === previous_async_effect) {\n\t\t\tset_reactivity_loss_tracker(null);\n\t\t}\n\t});\n\n\tvar value = await promise;\n\n\treturn () => {\n\t\tset_reactivity_loss_tracker(previous_async_effect);\n\t\t// While this can result in false negatives it also guards against the more important\n\t\t// false positives that would occur if this is the last in a chain of async operations,\n\t\t// and the reactivity_loss_tracker would then stay around until the next async operation happens.\n\t\tqueueMicrotask(() => {\n\t\t\tif (reactivity_loss_tracker === previous_async_effect) {\n\t\t\t\tset_reactivity_loss_tracker(null);\n\t\t\t}\n\t\t});\n\n\t\treturn value;\n\t};\n}\n\n/**\n * Used in `for await` loops in DEV, so\n * that we can emit `await_reactivity_loss` warnings\n * after each `async_iterator` result resolves and\n * after the `async_iterator` return resolves (if it runs)\n * @template T\n * @template TReturn\n * @param {Iterable<T> | AsyncIterable<T>} iterable\n * @returns {AsyncGenerator<T, TReturn | undefined>}\n */\nexport async function* for_await_track_reactivity_loss(iterable) {\n\t// This is based on the algorithms described in ECMA-262:\n\t// ForIn/OfBodyEvaluation\n\t// https://tc39.es/ecma262/multipage/ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset\n\t// AsyncIteratorClose\n\t// https://tc39.es/ecma262/multipage/abstract-operations.html#sec-asynciteratorclose\n\n\t/** @type {AsyncIterator<T, TReturn>} */\n\t// @ts-ignore\n\tconst iterator = iterable[Symbol.asyncIterator]?.() ?? iterable[Symbol.iterator]?.();\n\n\tif (iterator === undefined) {\n\t\tthrow new TypeError('value is not async iterable');\n\t}\n\n\t/** Whether the completion of the iterator was \"normal\", meaning it wasn't ended via `break` or a similar method */\n\tlet normal_completion = false;\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = (await track_reactivity_loss(iterator.next()))();\n\t\t\tif (done) {\n\t\t\t\tnormal_completion = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar prev = reactivity_loss_tracker;\n\t\t\tyield value;\n\t\t\tset_reactivity_loss_tracker(prev);\n\t\t}\n\t} finally {\n\t\t// If the iterator had an abrupt completion and `return` is defined on the iterator, call it and return the value\n\t\tif (!normal_completion && iterator.return !== undefined) {\n\t\t\t// eslint-disable-next-line no-unsafe-finally\n\t\t\treturn /** @type {TReturn} */ ((await track_reactivity_loss(iterator.return()))().value);\n\t\t}\n\t}\n}\n\nexport function unset_context(deactivate_batch = true) {\n\tset_active_effect(null);\n\tset_active_reaction(null);\n\tset_component_context(null);\n\tif (deactivate_batch) current_batch?.deactivate();\n\n\tif (DEV) {\n\t\tset_reactivity_loss_tracker(null);\n\t\tset_dev_stack(null);\n\t}\n}\n\n/**\n * @param {Array<() => void | Promise<void>>} thunks\n */\nexport function run(thunks) {\n\tconst restore = capture();\n\n\tconst decrement_pending = increment_pending();\n\n\tvar active = /** @type {Effect} */ (active_effect);\n\n\t/** @type {null | { error: any }} */\n\tvar errored = null;\n\n\t/** @param {any} error */\n\tconst handle_error = (error) => {\n\t\terrored = { error }; // wrap in object in case a promise rejects with a falsy value\n\n\t\tif (!aborted(active)) {\n\t\t\tinvoke_error_boundary(error, active);\n\t\t}\n\t};\n\n\tvar promise = Promise.resolve(thunks[0]()).catch(handle_error);\n\n\t/** @type {Blocker} */\n\tvar blocker = { promise, settled: false };\n\tvar blockers = [blocker];\n\n\tpromise.finally(() => {\n\t\tblocker.settled = true;\n\t\tunset_context();\n\t});\n\n\tfor (const fn of thunks.slice(1)) {\n\t\tpromise = promise\n\t\t\t.then(() => {\n\t\t\t\trestore();\n\n\t\t\t\tif (errored) {\n\t\t\t\t\tthrow errored.error;\n\t\t\t\t}\n\n\t\t\t\tif (aborted(active)) {\n\t\t\t\t\tthrow STALE_REACTION;\n\t\t\t\t}\n\n\t\t\t\treturn fn();\n\t\t\t})\n\t\t\t.catch(handle_error);\n\n\t\tconst blocker = { promise, settled: false };\n\t\tblockers.push(blocker);\n\n\t\tpromise.finally(() => {\n\t\t\tblocker.settled = true;\n\t\t\tunset_context();\n\t\t});\n\t}\n\n\tpromise\n\t\t// wait one more tick, so that template effects are\n\t\t// guaranteed to run before `$effect(...)`\n\t\t.then(() => Promise.resolve())\n\t\t.finally(() => decrement_pending());\n\n\treturn blockers;\n}\n\n/**\n * @param {Blocker[]} blockers\n */\nexport function wait(blockers) {\n\treturn Promise.all(blockers.map((b) => b.promise));\n}\n\n/**\n * @returns {(skip?: boolean) => void}\n */\nexport function increment_pending() {\n\tvar effect = /** @type {Effect} */ (active_effect);\n\tvar boundary = /** @type {Boundary} */ (effect.b);\n\tvar batch = /** @type {Batch} */ (current_batch);\n\tvar blocking = boundary.is_rendered();\n\n\tboundary.update_pending_count(1, batch);\n\tbatch.increment(blocking, effect);\n\n\treturn (skip = false) => {\n\t\tboundary.update_pending_count(-1, batch);\n\t\tbatch.decrement(blocking, effect, skip);\n\t};\n}\n","/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\n/** @import { Batch } from './batch.js'; */\n/** @import { Boundary } from '../dom/blocks/boundary.js'; */\nimport { DEV } from 'esm-env';\nimport {\n\tERROR_VALUE,\n\tDERIVED,\n\tDIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tASYNC,\n\tWAS_MARKED,\n\tDESTROYED,\n\tCLEAN,\n\tREACTION_RAN,\n\tINERT\n} from '#client/constants';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tupdate_reaction,\n\tincrement_write_version,\n\tset_active_effect,\n\tpush_reaction_value,\n\tis_destroying_effect,\n\tupdate_effect,\n\tremove_reactions,\n\tskipped_deps,\n\tnew_deps\n} from '../runtime.js';\nimport { equals, safe_equals } from './equality.js';\nimport * as e from '../errors.js';\nimport * as w from '../warnings.js';\nimport {\n\tasync_effect,\n\tdestroy_effect,\n\tdestroy_effect_children,\n\teffect_tracking,\n\tteardown\n} from './effects.js';\nimport { eager_effects, internal_set, set_eager_effects, source } from './sources.js';\nimport { get_error } from '../../shared/dev.js';\nimport { async_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { component_context } from '../context.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { batch_values, current_batch } from './batch.js';\nimport { increment_pending, unset_context } from './async.js';\nimport { deferred, includes, noop } from '../../shared/utils.js';\nimport { set_signal_status, update_derived_status } from './status.js';\n\n/**\n * This allows us to track 'reactivity loss' that occurs when signals\n * are read after a non-context-restoring `await`. Dev-only\n * @type {{ effect: Effect, effect_deps: Set<Value>, warned: boolean } | null}\n */\nexport let reactivity_loss_tracker = null;\n\n/** @param {{ effect: Effect, effect_deps: Set<Value>, warned: boolean } | null} v */\nexport function set_reactivity_loss_tracker(v) {\n\treactivity_loss_tracker = v;\n}\n\nexport const recent_async_deriveds = new Set();\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived(fn) {\n\tvar flags = DERIVED | DIRTY;\n\n\tif (active_effect !== null) {\n\t\t// Since deriveds are evaluated lazily, any effects created inside them are\n\t\t// created too late to ensure that the parent effect is added to the tree\n\t\tactive_effect.f |= EFFECT_PRESERVED;\n\t}\n\n\t/** @type {Derived<V>} */\n\tconst signal = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\teffects: null,\n\t\tequals,\n\t\tf: flags,\n\t\tfn,\n\t\treactions: null,\n\t\trv: 0,\n\t\tv: /** @type {V} */ (UNINITIALIZED),\n\t\twv: 0,\n\t\tparent: active_effect,\n\t\tac: null\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = get_error('created at');\n\t}\n\n\treturn signal;\n}\n\n/**\n * @template V\n * @param {() => V | Promise<V>} fn\n * @param {string} [label]\n * @param {string} [location] If provided, print a warning if the value is not read immediately after update\n * @returns {Promise<Source<V>>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function async_derived(fn, label, location) {\n\tlet parent = /** @type {Effect | null} */ (active_effect);\n\n\tif (parent === null) {\n\t\te.async_derived_orphan();\n\t}\n\n\tvar promise = /** @type {Promise<V>} */ (/** @type {unknown} */ (undefined));\n\tvar signal = source(/** @type {V} */ (UNINITIALIZED));\n\n\tif (DEV) signal.label = label;\n\n\t// only suspend in async deriveds created on initialisation\n\tvar should_suspend = !active_reaction;\n\n\t/** @type {Map<Batch, ReturnType<typeof deferred<V>>>} */\n\tvar deferreds = new Map();\n\n\tasync_effect(() => {\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\tif (DEV) {\n\t\t\treactivity_loss_tracker = { effect, effect_deps: new Set(), warned: false };\n\t\t}\n\n\t\t/** @type {ReturnType<typeof deferred<V>>} */\n\t\tvar d = deferred();\n\t\tpromise = d.promise;\n\n\t\ttry {\n\t\t\t// If this code is changed at some point, make sure to still access the then property\n\t\t\t// of fn() to read any signals it might access, so that we track them as dependencies.\n\t\t\t// We call `unset_context` to undo any `save` calls that happen inside `fn()`\n\t\t\tPromise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);\n\t\t} catch (error) {\n\t\t\td.reject(error);\n\t\t\tunset_context();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\tif (reactivity_loss_tracker) {\n\t\t\t\t// Reused deps from previous run (indices 0 to skipped_deps-1)\n\t\t\t\t// We deliberately only track direct dependencies of the async expression to encourage\n\t\t\t\t// dependencies being directly visible at the point of the expression\n\t\t\t\tif (effect.deps !== null) {\n\t\t\t\t\tfor (let i = 0; i < skipped_deps; i += 1) {\n\t\t\t\t\t\treactivity_loss_tracker.effect_deps.add(effect.deps[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// New deps discovered this run\n\t\t\t\tif (new_deps !== null) {\n\t\t\t\t\tfor (let i = 0; i < new_deps.length; i += 1) {\n\t\t\t\t\t\treactivity_loss_tracker.effect_deps.add(new_deps[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treactivity_loss_tracker = null;\n\t\t}\n\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\n\t\tif (should_suspend) {\n\t\t\t// we only increment the batch's pending state for updates, not creation, otherwise\n\t\t\t// we will decrement to zero before the work that depends on this promise (e.g. a\n\t\t\t// template effect) has initialized, causing the batch to resolve prematurely\n\t\t\tif ((effect.f & REACTION_RAN) !== 0) {\n\t\t\t\tvar decrement_pending = increment_pending();\n\t\t\t}\n\n\t\t\tif (/** @type {Boundary} */ (parent.b).is_rendered()) {\n\t\t\t\tdeferreds.get(batch)?.reject(STALE_REACTION);\n\t\t\t\tdeferreds.delete(batch); // delete to ensure correct order in Map iteration below\n\t\t\t} else {\n\t\t\t\t// While the boundary is still showing pending, a new run supersedes all older in-flight runs\n\t\t\t\t// for this async expression. Cancel eagerly so resolution cannot commit stale values.\n\t\t\t\tfor (const d of deferreds.values()) {\n\t\t\t\t\td.reject(STALE_REACTION);\n\t\t\t\t}\n\t\t\t\tdeferreds.clear();\n\t\t\t}\n\n\t\t\tdeferreds.set(batch, d);\n\t\t}\n\n\t\t/**\n\t\t * @param {any} value\n\t\t * @param {unknown} error\n\t\t */\n\t\tconst handler = (value, error = undefined) => {\n\t\t\tif (DEV) {\n\t\t\t\treactivity_loss_tracker = null;\n\t\t\t}\n\n\t\t\tif (decrement_pending) {\n\t\t\t\t// don't trigger an update if we're only here because\n\t\t\t\t// the promise was superseded before it could resolve\n\t\t\t\tvar skip = error === STALE_REACTION;\n\t\t\t\tdecrement_pending(skip);\n\t\t\t}\n\n\t\t\tif (error === STALE_REACTION || (effect.f & DESTROYED) !== 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tbatch.activate();\n\n\t\t\tif (error) {\n\t\t\t\tsignal.f |= ERROR_VALUE;\n\n\t\t\t\t// @ts-expect-error the error is the wrong type, but we don't care\n\t\t\t\tinternal_set(signal, error);\n\t\t\t} else {\n\t\t\t\tif ((signal.f & ERROR_VALUE) !== 0) {\n\t\t\t\t\tsignal.f ^= ERROR_VALUE;\n\t\t\t\t}\n\n\t\t\t\tinternal_set(signal, value);\n\n\t\t\t\t// All prior async derived runs are now stale\n\t\t\t\tfor (const [b, d] of deferreds) {\n\t\t\t\t\tdeferreds.delete(b);\n\t\t\t\t\tif (b === batch) break;\n\t\t\t\t\td.reject(STALE_REACTION);\n\t\t\t\t}\n\n\t\t\t\tif (DEV && location !== undefined) {\n\t\t\t\t\trecent_async_deriveds.add(signal);\n\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (recent_async_deriveds.has(signal)) {\n\t\t\t\t\t\t\tw.await_waterfall(/** @type {string} */ (signal.label), location);\n\t\t\t\t\t\t\trecent_async_deriveds.delete(signal);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch.deactivate();\n\t\t};\n\n\t\td.promise.then(handler, (e) => handler(null, e || 'unknown'));\n\t});\n\n\tteardown(() => {\n\t\tfor (const d of deferreds.values()) {\n\t\t\td.reject(STALE_REACTION);\n\t\t}\n\t});\n\n\tif (DEV) {\n\t\t// add a flag that lets this be printed as a derived\n\t\t// when using `$inspect.trace()`\n\t\tsignal.f |= ASYNC;\n\t}\n\n\treturn new Promise((fulfil) => {\n\t\t/** @param {Promise<V>} p */\n\t\tfunction next(p) {\n\t\t\tfunction go() {\n\t\t\t\tif (p === promise) {\n\t\t\t\t\tfulfil(signal);\n\t\t\t\t} else {\n\t\t\t\t\t// if the effect re-runs before the initial promise\n\t\t\t\t\t// resolves, delay resolution until we have a value\n\t\t\t\t\tnext(promise);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tp.then(go, go);\n\t\t}\n\n\t\tnext(promise);\n\t});\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function user_derived(fn) {\n\tconst d = derived(fn);\n\n\tif (!async_mode_flag) push_reaction_value(d);\n\n\treturn d;\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived_safe_equal(fn) {\n\tconst signal = derived(fn);\n\tsignal.equals = safe_equals;\n\treturn signal;\n}\n\n/**\n * @param {Derived} derived\n * @returns {void}\n */\nexport function destroy_derived_effects(derived) {\n\tvar effects = derived.effects;\n\n\tif (effects !== null) {\n\t\tderived.effects = null;\n\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tdestroy_effect(/** @type {Effect} */ (effects[i]));\n\t\t}\n\t}\n}\n\n/**\n * The currently updating deriveds, used to detect infinite recursion\n * in dev mode and provide a nicer error than 'too much recursion'\n * @type {Derived[]}\n */\nlet stack = [];\n\n/**\n * @template T\n * @param {Derived} derived\n * @returns {T}\n */\nexport function execute_derived(derived) {\n\tvar value;\n\tvar prev_active_effect = active_effect;\n\tvar parent = derived.parent;\n\n\tif (!is_destroying_effect && parent !== null && (parent.f & (DESTROYED | INERT)) !== 0) {\n\t\tw.derived_inert();\n\n\t\treturn derived.v;\n\t}\n\n\tset_active_effect(parent);\n\n\tif (DEV) {\n\t\tlet prev_eager_effects = eager_effects;\n\t\tset_eager_effects(new Set());\n\t\ttry {\n\t\t\tif (includes.call(stack, derived)) {\n\t\t\t\te.derived_references_self();\n\t\t\t}\n\n\t\t\tstack.push(derived);\n\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t\tdestroy_derived_effects(derived);\n\t\t\tvalue = update_reaction(derived);\n\t\t} finally {\n\t\t\tset_active_effect(prev_active_effect);\n\t\t\tset_eager_effects(prev_eager_effects);\n\t\t\tstack.pop();\n\t\t}\n\t} else {\n\t\ttry {\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t\tdestroy_derived_effects(derived);\n\t\t\tvalue = update_reaction(derived);\n\t\t} finally {\n\t\t\tset_active_effect(prev_active_effect);\n\t\t}\n\t}\n\n\treturn value;\n}\n\n/**\n * @param {Derived} derived\n * @returns {void}\n */\nexport function update_derived(derived) {\n\tvar value = execute_derived(derived);\n\n\tif (!derived.equals(value)) {\n\t\tderived.wv = increment_write_version();\n\n\t\t// in a fork, we don't update the underlying value, just `batch_values`.\n\t\t// the underlying value will be updated when the fork is committed.\n\t\t// otherwise, the next time we get here after a 'real world' state\n\t\t// change, `derived.equals` may incorrectly return `true`\n\t\tif (!current_batch?.is_fork || derived.deps === null) {\n\t\t\tif (current_batch !== null) {\n\t\t\t\tcurrent_batch.capture(derived, value, true);\n\t\t\t} else {\n\t\t\t\tderived.v = value;\n\t\t\t}\n\n\t\t\t// deriveds without dependencies should never be recomputed\n\t\t\tif (derived.deps === null) {\n\t\t\t\tset_signal_status(derived, CLEAN);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\t// don't mark derived clean if we're reading it inside a\n\t// cleanup function, or it will cache a stale value\n\tif (is_destroying_effect) {\n\t\treturn;\n\t}\n\n\t// During time traveling we don't want to reset the status so that\n\t// traversal of the graph in the other batches still happens\n\tif (batch_values !== null) {\n\t\t// only cache the value if we're in a tracking context, otherwise we won't\n\t\t// clear the cache in `mark_reactions` when dependencies are updated\n\t\tif (effect_tracking() || current_batch?.is_fork) {\n\t\t\tbatch_values.set(derived, value);\n\t\t}\n\t} else {\n\t\tupdate_derived_status(derived);\n\t}\n}\n\n/**\n * @param {Derived} derived\n */\nexport function freeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect has a teardown function or abort signal, call it\n\t\tif (e.teardown || e.ac) {\n\t\t\te.teardown?.();\n\t\t\te.ac?.abort(STALE_REACTION);\n\n\t\t\t// make it a noop so it doesn't get called again if the derived\n\t\t\t// is unfrozen. we don't set it to `null`, because the existence\n\t\t\t// of a teardown function is what determines whether the\n\t\t\t// effect runs again during unfreezing\n\t\t\te.teardown = noop;\n\t\t\te.ac = null;\n\n\t\t\tremove_reactions(e, 0);\n\t\t\tdestroy_effect_children(e);\n\t\t}\n\t}\n}\n\n/**\n * @param {Derived} derived\n */\nexport function unfreeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect was previously frozen — indicated by the presence\n\t\t// of a teardown function — unfreeze it\n\t\tif (e.teardown) {\n\t\t\tupdate_effect(e);\n\t\t}\n\t}\n}\n","/** @import { Derived, Effect, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tuntracked_writes,\n\tget,\n\tset_untracked_writes,\n\tuntrack,\n\tincrement_write_version,\n\tupdate_effect,\n\tcurrent_sources,\n\tis_dirty,\n\tuntracking,\n\tis_destroying_effect,\n\tpush_reaction_value\n} from '../runtime.js';\nimport { equals, safe_equals } from './equality.js';\nimport {\n\tCLEAN,\n\tDERIVED,\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tEAGER_EFFECT,\n\tMAYBE_DIRTY,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tASYNC,\n\tWAS_MARKED,\n\tCONNECTED,\n\tREACTION_IS_UPDATING\n} from '#client/constants';\nimport * as e from '../errors.js';\nimport { legacy_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { includes } from '../../shared/utils.js';\nimport { tag_proxy } from '../dev/tracing.js';\nimport { get_error } from '../../shared/dev.js';\nimport { component_context, is_runes } from '../context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\teager_block_effects,\n\tschedule_effect,\n\tlegacy_updates\n} from './batch.js';\nimport { proxy } from '../proxy.js';\nimport { execute_derived } from './deriveds.js';\nimport { set_signal_status, update_derived_status } from './status.js';\n\n/** @type {Set<any>} */\nexport let eager_effects = new Set();\n\n/** @type {Map<Source, any>} */\nexport const old_values = new Map();\n\n/**\n * @param {Set<any>} v\n */\nexport function set_eager_effects(v) {\n\teager_effects = v;\n}\n\nlet eager_effects_deferred = false;\n\nexport function set_eager_effects_deferred() {\n\teager_effects_deferred = true;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n * @returns {Source<V>}\n */\n// TODO rename this to `state` throughout the codebase\nexport function source(v, stack) {\n\t/** @type {Value} */\n\tvar signal = {\n\t\tf: 0, // TODO ideally we could skip this altogether, but it causes type errors\n\t\tv,\n\t\treactions: null,\n\t\tequals,\n\t\trv: 0,\n\t\twv: 0\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = stack ?? get_error('created at');\n\t\tsignal.updated = null;\n\t\tsignal.set_during_effect = false;\n\t\tsignal.trace = null;\n\t}\n\n\treturn signal;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function state(v, stack) {\n\tconst s = source(v, stack);\n\n\tpush_reaction_value(s);\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {V} initial_value\n * @param {boolean} [immutable]\n * @returns {Source<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function mutable_source(initial_value, immutable = false, trackable = true) {\n\tconst s = source(initial_value);\n\tif (!immutable) {\n\t\ts.equals = safe_equals;\n\t}\n\n\t// bind the signal to the component context, in case we need to\n\t// track updates to trigger beforeUpdate/afterUpdate callbacks\n\tif (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {\n\t\t(component_context.l.s ??= []).push(s);\n\t}\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {Value<V>} source\n * @param {V} value\n */\nexport function mutate(source, value) {\n\tset(\n\t\tsource,\n\t\tuntrack(() => get(source))\n\t);\n\treturn value;\n}\n\n/**\n * @template V\n * @param {Source<V>} source\n * @param {V} value\n * @param {boolean} [should_proxy]\n * @returns {V}\n */\nexport function set(source, value, should_proxy = false) {\n\tif (\n\t\tactive_reaction !== null &&\n\t\t// since we are untracking the function inside `$inspect.with` we need to add this check\n\t\t// to ensure we error if state is set inside an inspect effect\n\t\t(!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) &&\n\t\tis_runes() &&\n\t\t(active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 &&\n\t\t(current_sources === null || !includes.call(current_sources, source))\n\t) {\n\t\te.state_unsafe_mutation();\n\t}\n\n\tlet new_value = should_proxy ? proxy(value) : value;\n\n\tif (DEV) {\n\t\ttag_proxy(new_value, /** @type {string} */ (source.label));\n\t}\n\n\treturn internal_set(source, new_value, legacy_updates);\n}\n\n/**\n * @template V\n * @param {Source<V>} source\n * @param {V} value\n * @param {Effect[] | null} [updated_during_traversal]\n * @returns {V}\n */\nexport function internal_set(source, value, updated_during_traversal = null) {\n\tif (!source.equals(value)) {\n\t\told_values.set(source, is_destroying_effect ? value : source.v);\n\n\t\tvar batch = Batch.ensure();\n\t\tbatch.capture(source, value);\n\n\t\tif (DEV) {\n\t\t\tif (tracing_mode_flag || active_effect !== null) {\n\t\t\t\tsource.updated ??= new Map();\n\n\t\t\t\t// For performance reasons, when not using $inspect.trace, we only start collecting stack traces\n\t\t\t\t// after the same source has been updated more than 5 times in the same flush cycle.\n\t\t\t\tconst count = (source.updated.get('')?.count ?? 0) + 1;\n\t\t\t\tsource.updated.set('', { error: /** @type {any} */ (null), count });\n\n\t\t\t\tif (tracing_mode_flag || count > 5) {\n\t\t\t\t\tconst error = get_error('updated at');\n\n\t\t\t\t\tif (error !== null) {\n\t\t\t\t\t\tlet entry = source.updated.get(error.stack);\n\n\t\t\t\t\t\tif (!entry) {\n\t\t\t\t\t\t\tentry = { error, count: 0 };\n\t\t\t\t\t\t\tsource.updated.set(error.stack, entry);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tentry.count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (active_effect !== null) {\n\t\t\t\tsource.set_during_effect = true;\n\t\t\t}\n\t\t}\n\n\t\tif ((source.f & DERIVED) !== 0) {\n\t\t\tconst derived = /** @type {Derived} */ (source);\n\n\t\t\t// if we are assigning to a dirty derived we set it to clean/maybe dirty but we also eagerly execute it to track the dependencies\n\t\t\tif ((source.f & DIRTY) !== 0) {\n\t\t\t\texecute_derived(derived);\n\t\t\t}\n\n\t\t\t// During time traveling we don't want to reset the status so that\n\t\t\t// traversal of the graph in the other batches still happens\n\t\t\tif (batch_values === null) {\n\t\t\t\tupdate_derived_status(derived);\n\t\t\t}\n\t\t}\n\n\t\tsource.wv = increment_write_version();\n\n\t\t// For debugging, in case you want to know which reactions are being scheduled:\n\t\t// log_reactions(source);\n\t\tmark_reactions(source, DIRTY, updated_during_traversal);\n\n\t\t// It's possible that the current reaction might not have up-to-date dependencies\n\t\t// whilst it's actively running. So in the case of ensuring it registers the reaction\n\t\t// properly for itself, we need to ensure the current effect actually gets\n\t\t// scheduled. i.e: `$effect(() => x++)`\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tactive_effect !== null &&\n\t\t\t(active_effect.f & CLEAN) !== 0 &&\n\t\t\t(active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0\n\t\t) {\n\t\t\tif (untracked_writes === null) {\n\t\t\t\tset_untracked_writes([source]);\n\t\t\t} else {\n\t\t\t\tuntracked_writes.push(source);\n\t\t\t}\n\t\t}\n\n\t\tif (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) {\n\t\t\tflush_eager_effects();\n\t\t}\n\t}\n\n\treturn value;\n}\n\nexport function flush_eager_effects() {\n\teager_effects_deferred = false;\n\n\tfor (const effect of eager_effects) {\n\t\t// Mark clean inspect-effects as maybe dirty and then check their dirtiness\n\t\t// instead of just updating the effects - this way we avoid overfiring.\n\t\tif ((effect.f & CLEAN) !== 0) {\n\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t}\n\n\t\tif (is_dirty(effect)) {\n\t\t\tupdate_effect(effect);\n\t\t}\n\t}\n\n\teager_effects.clear();\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update(source, d = 1) {\n\tvar value = get(source);\n\tvar result = d === 1 ? value++ : value--;\n\n\tset(source, value);\n\n\t// @ts-expect-error\n\treturn result;\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update_pre(source, d = 1) {\n\tvar value = get(source);\n\n\t// @ts-expect-error\n\t// eslint-disable-next-line no-useless-assignment -- `++`/`--` used for return value, not side effect on `value`\n\treturn set(source, d === 1 ? ++value : --value);\n}\n\n/**\n * Silently (without using `get`) increment a source\n * @param {Source<number>} source\n */\nexport function increment(source) {\n\tset(source, source.v + 1);\n}\n\n/**\n * @param {Value} signal\n * @param {number} status should be DIRTY or MAYBE_DIRTY\n * @param {Effect[] | null} updated_during_traversal\n * @returns {void}\n */\nfunction mark_reactions(signal, status, updated_during_traversal) {\n\tvar reactions = signal.reactions;\n\tif (reactions === null) return;\n\n\tvar runes = is_runes();\n\tvar length = reactions.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tvar reaction = reactions[i];\n\t\tvar flags = reaction.f;\n\n\t\t// In legacy mode, skip the current effect to prevent infinite loops\n\t\tif (!runes && reaction === active_effect) continue;\n\n\t\t// Inspect effects need to run immediately, so that the stack trace makes sense\n\t\tif (DEV && (flags & EAGER_EFFECT) !== 0) {\n\t\t\teager_effects.add(reaction);\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar not_dirty = (flags & DIRTY) === 0;\n\n\t\t// don't set a DIRTY reaction to MAYBE_DIRTY\n\t\tif (not_dirty) {\n\t\t\tset_signal_status(reaction, status);\n\t\t}\n\n\t\tif ((flags & DERIVED) !== 0) {\n\t\t\tvar derived = /** @type {Derived} */ (reaction);\n\n\t\t\tbatch_values?.delete(derived);\n\n\t\t\tif ((flags & WAS_MARKED) === 0) {\n\t\t\t\t// Only connected deriveds being executed outside the update cycle can be reliably unmarked right away\n\t\t\t\tif (\n\t\t\t\t\tflags & CONNECTED &&\n\t\t\t\t\t(active_effect === null || (active_effect.f & REACTION_IS_UPDATING) === 0)\n\t\t\t\t) {\n\t\t\t\t\treaction.f |= WAS_MARKED;\n\t\t\t\t}\n\n\t\t\t\tmark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);\n\t\t\t}\n\t\t} else if (not_dirty) {\n\t\t\tvar effect = /** @type {Effect} */ (reaction);\n\n\t\t\tif ((flags & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {\n\t\t\t\teager_block_effects.add(effect);\n\t\t\t}\n\n\t\t\tif (updated_during_traversal !== null) {\n\t\t\t\tupdated_during_traversal.push(effect);\n\t\t\t} else {\n\t\t\t\tschedule_effect(effect);\n\t\t\t}\n\t\t}\n\t}\n}\n","/** @import { Source } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tget,\n\tactive_effect,\n\tupdate_version,\n\tactive_reaction,\n\tset_update_version,\n\tset_active_reaction\n} from './runtime.js';\nimport {\n\tarray_prototype,\n\tget_descriptor,\n\tget_prototype_of,\n\tis_array,\n\tobject_prototype\n} from '../shared/utils.js';\nimport {\n\tstate as source,\n\tset,\n\tincrement,\n\tflush_eager_effects,\n\tset_eager_effects_deferred\n} from './reactivity/sources.js';\nimport { PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';\nimport { UNINITIALIZED } from '../../constants.js';\nimport * as e from './errors.js';\nimport { tag } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport { tracing_mode_flag } from '../flags/index.js';\n\n// TODO move all regexes into shared module?\nconst regex_is_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;\n\n/**\n * @template T\n * @param {T} value\n * @returns {T}\n */\nexport function proxy(value) {\n\t// if non-proxyable, or is already a proxy, return `value`\n\tif (typeof value !== 'object' || value === null || STATE_SYMBOL in value) {\n\t\treturn value;\n\t}\n\n\tconst prototype = get_prototype_of(value);\n\n\tif (prototype !== object_prototype && prototype !== array_prototype) {\n\t\treturn value;\n\t}\n\n\t/** @type {Map<any, Source<any>>} */\n\tvar sources = new Map();\n\tvar is_proxied_array = is_array(value);\n\tvar version = source(0);\n\n\tvar stack = DEV && tracing_mode_flag ? get_error('created at') : null;\n\tvar parent_version = update_version;\n\n\t/**\n\t * Executes the proxy in the context of the reaction it was originally created in, if any\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\tvar with_parent = (fn) => {\n\t\tif (update_version === parent_version) {\n\t\t\treturn fn();\n\t\t}\n\n\t\t// child source is being created after the initial proxy —\n\t\t// prevent it from being associated with the current reaction\n\t\tvar reaction = active_reaction;\n\t\tvar version = update_version;\n\n\t\tset_active_reaction(null);\n\t\tset_update_version(parent_version);\n\n\t\tvar result = fn();\n\n\t\tset_active_reaction(reaction);\n\t\tset_update_version(version);\n\n\t\treturn result;\n\t};\n\n\tif (is_proxied_array) {\n\t\t// We need to create the length source eagerly to ensure that\n\t\t// mutations to the array are properly synced with our proxy\n\t\tsources.set('length', source(/** @type {any[]} */ (value).length, stack));\n\t\tif (DEV) {\n\t\t\tvalue = /** @type {any} */ (inspectable_array(/** @type {any[]} */ (value)));\n\t\t}\n\t}\n\n\t/** Used in dev for $inspect.trace() */\n\tvar path = '';\n\tlet updating = false;\n\t/** @param {string} new_path */\n\tfunction update_path(new_path) {\n\t\tif (updating) return;\n\t\tupdating = true;\n\t\tpath = new_path;\n\n\t\ttag(version, `${path} version`);\n\n\t\t// rename all child sources and child proxies\n\t\tfor (const [prop, source] of sources) {\n\t\t\ttag(source, get_label(path, prop));\n\t\t}\n\t\tupdating = false;\n\t}\n\n\treturn new Proxy(/** @type {any} */ (value), {\n\t\tdefineProperty(_, prop, descriptor) {\n\t\t\tif (\n\t\t\t\t!('value' in descriptor) ||\n\t\t\t\tdescriptor.configurable === false ||\n\t\t\t\tdescriptor.enumerable === false ||\n\t\t\t\tdescriptor.writable === false\n\t\t\t) {\n\t\t\t\t// we disallow non-basic descriptors, because unless they are applied to the\n\t\t\t\t// target object — which we avoid, so that state can be forked — we will run\n\t\t\t\t// afoul of the various invariants\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getOwnPropertyDescriptor#invariants\n\t\t\t\te.state_descriptors_fixed();\n\t\t\t}\n\t\t\tvar s = sources.get(prop);\n\t\t\tif (s === undefined) {\n\t\t\t\twith_parent(() => {\n\t\t\t\t\tvar s = source(descriptor.value, stack);\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tif (DEV && typeof prop === 'string') {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tset(s, descriptor.value, true);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tdeleteProperty(target, prop) {\n\t\t\tvar s = sources.get(prop);\n\n\t\t\tif (s === undefined) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tincrement(version);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tset(s, UNINITIALIZED);\n\t\t\t\tincrement(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tget(target, prop, receiver) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tif (DEV && prop === PROXY_PATH_SYMBOL) {\n\t\t\t\treturn update_path;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar exists = prop in target;\n\n\t\t\t// create a source, but only if it's an own property and not a prototype property\n\t\t\tif (s === undefined && (!exists || get_descriptor(target, prop)?.writable)) {\n\t\t\t\ts = with_parent(() => {\n\t\t\t\t\tvar p = proxy(exists ? target[prop] : UNINITIALIZED);\n\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\n\t\t\t\tsources.set(prop, s);\n\t\t\t}\n\n\t\t\tif (s !== undefined) {\n\t\t\t\tvar v = get(s);\n\t\t\t\treturn v === UNINITIALIZED ? undefined : v;\n\t\t\t}\n\n\t\t\treturn Reflect.get(target, prop, receiver);\n\t\t},\n\n\t\tgetOwnPropertyDescriptor(target, prop) {\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\n\t\t\tif (descriptor && 'value' in descriptor) {\n\t\t\t\tvar s = sources.get(prop);\n\t\t\t\tif (s) descriptor.value = get(s);\n\t\t\t} else if (descriptor === undefined) {\n\t\t\t\tvar source = sources.get(prop);\n\t\t\t\tvar value = source?.v;\n\n\t\t\t\tif (source !== undefined && value !== UNINITIALIZED) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\twritable: true\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn descriptor;\n\t\t},\n\n\t\thas(target, prop) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = (s !== undefined && s.v !== UNINITIALIZED) || Reflect.has(target, prop);\n\n\t\t\tif (\n\t\t\t\ts !== undefined ||\n\t\t\t\t(active_effect !== null && (!has || get_descriptor(target, prop)?.writable))\n\t\t\t) {\n\t\t\t\tif (s === undefined) {\n\t\t\t\t\ts = with_parent(() => {\n\t\t\t\t\t\tvar p = has ? proxy(target[prop]) : UNINITIALIZED;\n\t\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn s;\n\t\t\t\t\t});\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\n\t\t\t\tvar value = get(s);\n\t\t\t\tif (value === UNINITIALIZED) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn has;\n\t\t},\n\n\t\tset(target, prop, value, receiver) {\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = prop in target;\n\n\t\t\t// variable.length = value -> clear all signals with index >= value\n\t\t\tif (is_proxied_array && prop === 'length') {\n\t\t\t\tfor (var i = value; i < /** @type {Source<number>} */ (s).v; i += 1) {\n\t\t\t\t\tvar other_s = sources.get(i + '');\n\t\t\t\t\tif (other_s !== undefined) {\n\t\t\t\t\t\tset(other_s, UNINITIALIZED);\n\t\t\t\t\t} else if (i in target) {\n\t\t\t\t\t\t// If the item exists in the original, we need to create an uninitialized source,\n\t\t\t\t\t\t// else a later read of the property would result in a source being created with\n\t\t\t\t\t\t// the value of the original item at that index.\n\t\t\t\t\t\tother_s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\t\tsources.set(i + '', other_s);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(other_s, get_label(path, i));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we haven't yet created a source for this property, we need to ensure\n\t\t\t// we do so otherwise if we read it later, then the write won't be tracked and\n\t\t\t// the heuristics of effects will be different vs if we had read the proxied\n\t\t\t// object property before writing to that property.\n\t\t\tif (s === undefined) {\n\t\t\t\tif (!has || get_descriptor(target, prop)?.writable) {\n\t\t\t\t\ts = with_parent(() => source(undefined, stack));\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\tset(s, proxy(value));\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thas = s.v !== UNINITIALIZED;\n\n\t\t\t\tvar p = with_parent(() => proxy(value));\n\t\t\t\tset(s, p);\n\t\t\t}\n\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\n\t\t\t// Set the new value before updating any signals so that any listeners get the new value\n\t\t\tif (descriptor?.set) {\n\t\t\t\tdescriptor.set.call(receiver, value);\n\t\t\t}\n\n\t\t\tif (!has) {\n\t\t\t\t// If we have mutated an array directly, we might need to\n\t\t\t\t// signal that length has also changed. Do it before updating metadata\n\t\t\t\t// to ensure that iterating over the array as a result of a metadata update\n\t\t\t\t// will not cause the length to be out of sync.\n\t\t\t\tif (is_proxied_array && typeof prop === 'string') {\n\t\t\t\t\tvar ls = /** @type {Source<number>} */ (sources.get('length'));\n\t\t\t\t\tvar n = Number(prop);\n\n\t\t\t\t\tif (Number.isInteger(n) && n >= ls.v) {\n\t\t\t\t\t\tset(ls, n + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tincrement(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\townKeys(target) {\n\t\t\tget(version);\n\n\t\t\tvar own_keys = Reflect.ownKeys(target).filter((key) => {\n\t\t\t\tvar source = sources.get(key);\n\t\t\t\treturn source === undefined || source.v !== UNINITIALIZED;\n\t\t\t});\n\n\t\t\tfor (var [key, source] of sources) {\n\t\t\t\tif (source.v !== UNINITIALIZED && !(key in target)) {\n\t\t\t\t\town_keys.push(key);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn own_keys;\n\t\t},\n\n\t\tsetPrototypeOf() {\n\t\t\te.state_prototype_fixed();\n\t\t}\n\t});\n}\n\n/**\n * @param {string} path\n * @param {string | symbol} prop\n */\nfunction get_label(path, prop) {\n\tif (typeof prop === 'symbol') return `${path}[Symbol(${prop.description ?? ''})]`;\n\tif (regex_is_valid_identifier.test(prop)) return `${path}.${prop}`;\n\treturn /^\\d+$/.test(prop) ? `${path}[${prop}]` : `${path}['${prop}']`;\n}\n\n/**\n * @param {any} value\n */\nexport function get_proxied_value(value) {\n\ttry {\n\t\tif (value !== null && typeof value === 'object' && STATE_SYMBOL in value) {\n\t\t\treturn value[STATE_SYMBOL];\n\t\t}\n\t} catch {\n\t\t// the above if check can throw an error if the value in question\n\t\t// is the contentWindow of an iframe on another domain, in which\n\t\t// case we want to just return the value (because it's definitely\n\t\t// not a proxied value) so we don't break any JavaScript interacting\n\t\t// with that iframe (such as various payment companies client side\n\t\t// JavaScript libraries interacting with their iframes on the same\n\t\t// domain)\n\t}\n\n\treturn value;\n}\n\n/**\n * @param {any} a\n * @param {any} b\n */\nexport function is(a, b) {\n\treturn Object.is(get_proxied_value(a), get_proxied_value(b));\n}\n\nconst ARRAY_MUTATING_METHODS = new Set([\n\t'copyWithin',\n\t'fill',\n\t'pop',\n\t'push',\n\t'reverse',\n\t'shift',\n\t'sort',\n\t'splice',\n\t'unshift'\n]);\n\n/**\n * Wrap array mutating methods so $inspect is triggered only once and\n * to prevent logging an array in intermediate state (e.g. with an empty slot)\n * @param {any[]} array\n */\nfunction inspectable_array(array) {\n\treturn new Proxy(array, {\n\t\tget(target, prop, receiver) {\n\t\t\tvar value = Reflect.get(target, prop, receiver);\n\t\t\tif (!ARRAY_MUTATING_METHODS.has(/** @type {string} */ (prop))) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @this {any[]}\n\t\t\t * @param {any[]} args\n\t\t\t */\n\t\t\treturn function (...args) {\n\t\t\t\tset_eager_effects_deferred();\n\t\t\t\tvar result = value.apply(this, args);\n\t\t\t\tflush_eager_effects();\n\t\t\t\treturn result;\n\t\t\t};\n\t\t}\n\t});\n}\n","import * as w from '../warnings.js';\nimport { get_proxied_value } from '../proxy.js';\n\nexport function init_array_prototype_warnings() {\n\tconst array_prototype = Array.prototype;\n\t// The REPL ends up here over and over, and this prevents it from adding more and more patches\n\t// of the same kind to the prototype, which would slow down everything over time.\n\t// @ts-expect-error\n\tconst cleanup = Array.__svelte_cleanup;\n\tif (cleanup) {\n\t\tcleanup();\n\t}\n\n\tconst { indexOf, lastIndexOf, includes } = array_prototype;\n\n\tarray_prototype.indexOf = function (item, from_index) {\n\t\tconst index = indexOf.call(this, item, from_index);\n\n\t\tif (index === -1) {\n\t\t\tfor (let i = from_index ?? 0; i < this.length; i += 1) {\n\t\t\t\tif (get_proxied_value(this[i]) === item) {\n\t\t\t\t\tw.state_proxy_equality_mismatch('array.indexOf(...)');\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn index;\n\t};\n\n\tarray_prototype.lastIndexOf = function (item, from_index) {\n\t\t// we need to specify this.length - 1 because it's probably using something like\n\t\t// `arguments` inside so passing undefined is different from not passing anything\n\t\tconst index = lastIndexOf.call(this, item, from_index ?? this.length - 1);\n\n\t\tif (index === -1) {\n\t\t\tfor (let i = 0; i <= (from_index ?? this.length - 1); i += 1) {\n\t\t\t\tif (get_proxied_value(this[i]) === item) {\n\t\t\t\t\tw.state_proxy_equality_mismatch('array.lastIndexOf(...)');\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn index;\n\t};\n\n\tarray_prototype.includes = function (item, from_index) {\n\t\tconst has = includes.call(this, item, from_index);\n\n\t\tif (!has) {\n\t\t\tfor (let i = 0; i < this.length; i += 1) {\n\t\t\t\tif (get_proxied_value(this[i]) === item) {\n\t\t\t\t\tw.state_proxy_equality_mismatch('array.includes(...)');\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn has;\n\t};\n\n\t// @ts-expect-error\n\tArray.__svelte_cleanup = () => {\n\t\tarray_prototype.indexOf = indexOf;\n\t\tarray_prototype.lastIndexOf = lastIndexOf;\n\t\tarray_prototype.includes = includes;\n\t};\n}\n\n/**\n * @param {any} a\n * @param {any} b\n * @param {boolean} equal\n * @returns {boolean}\n */\nexport function strict_equals(a, b, equal = true) {\n\t// try-catch needed because this tries to read properties of `a` and `b`,\n\t// which could be disallowed for example in a secure context\n\ttry {\n\t\tif ((a === b) !== (get_proxied_value(a) === get_proxied_value(b))) {\n\t\t\tw.state_proxy_equality_mismatch(equal ? '===' : '!==');\n\t\t}\n\t} catch {}\n\n\treturn (a === b) === equal;\n}\n\n/**\n * @param {any} a\n * @param {any} b\n * @param {boolean} equal\n * @returns {boolean}\n */\nexport function equals(a, b, equal = true) {\n\tif ((a == b) !== (get_proxied_value(a) == get_proxied_value(b))) {\n\t\tw.state_proxy_equality_mismatch(equal ? '==' : '!=');\n\t}\n\n\treturn (a == b) === equal;\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { hydrate_node, hydrating, set_hydrate_node } from './hydration.js';\nimport { DEV } from 'esm-env';\nimport { init_array_prototype_warnings } from '../dev/equality.js';\nimport { get_descriptor, is_extensible } from '../../shared/utils.js';\nimport { active_effect } from '../runtime.js';\nimport { async_mode_flag } from '../../flags/index.js';\nimport { TEXT_NODE, REACTION_RAN } from '#client/constants';\nimport { eager_block_effects } from '../reactivity/batch.js';\nimport { NAMESPACE_HTML } from '../../../constants.js';\n\n// export these for reference in the compiled code, making global name deduplication unnecessary\n/** @type {Window} */\nexport var $window;\n\n/** @type {Document} */\nexport var $document;\n\n/** @type {boolean} */\nexport var is_firefox;\n\n/** @type {() => Node | null} */\nvar first_child_getter;\n/** @type {() => Node | null} */\nvar next_sibling_getter;\n\n/**\n * Initialize these lazily to avoid issues when using the runtime in a server context\n * where these globals are not available while avoiding a separate server entry point\n */\nexport function init_operations() {\n\tif ($window !== undefined) {\n\t\treturn;\n\t}\n\n\t$window = window;\n\t$document = document;\n\tis_firefox = /Firefox/.test(navigator.userAgent);\n\n\tvar element_prototype = Element.prototype;\n\tvar node_prototype = Node.prototype;\n\tvar text_prototype = Text.prototype;\n\n\t// @ts-ignore\n\tfirst_child_getter = get_descriptor(node_prototype, 'firstChild').get;\n\t// @ts-ignore\n\tnext_sibling_getter = get_descriptor(node_prototype, 'nextSibling').get;\n\n\tif (is_extensible(element_prototype)) {\n\t\t// the following assignments improve perf of lookups on DOM nodes\n\t\t// @ts-expect-error\n\t\telement_prototype.__click = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__className = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__attributes = null;\n\t\t// @ts-expect-error\n\t\telement_prototype.__style = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__e = undefined;\n\t}\n\n\tif (is_extensible(text_prototype)) {\n\t\t// @ts-expect-error\n\t\ttext_prototype.__t = undefined;\n\t}\n\n\tif (DEV) {\n\t\t// @ts-expect-error\n\t\telement_prototype.__svelte_meta = null;\n\n\t\tinit_array_prototype_warnings();\n\t}\n}\n\n/**\n * @param {string} value\n * @returns {Text}\n */\nexport function create_text(value = '') {\n\treturn document.createTextNode(value);\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_first_child(node) {\n\treturn /** @type {TemplateNode | null} */ (first_child_getter.call(node));\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_next_sibling(node) {\n\treturn /** @type {TemplateNode | null} */ (next_sibling_getter.call(node));\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @template {Node} N\n * @param {N} node\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function child(node, is_text) {\n\tif (!hydrating) {\n\t\treturn get_first_child(node);\n\t}\n\n\tvar child = get_first_child(hydrate_node);\n\n\t// Child can be null if we have an element with a single child, like `<p>{text}</p>`, where `text` is empty\n\tif (child === null) {\n\t\tchild = hydrate_node.appendChild(create_text());\n\t} else if (is_text && child.nodeType !== TEXT_NODE) {\n\t\tvar text = create_text();\n\t\tchild?.before(text);\n\t\tset_hydrate_node(text);\n\t\treturn text;\n\t}\n\n\tif (is_text) {\n\t\tmerge_text_nodes(/** @type {Text} */ (child));\n\t}\n\n\tset_hydrate_node(child);\n\treturn child;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {boolean} [is_text]\n * @returns {TemplateNode | null}\n */\nexport function first_child(node, is_text = false) {\n\tif (!hydrating) {\n\t\tvar first = get_first_child(node);\n\n\t\t// TODO prevent user comments with the empty string when preserveComments is true\n\t\tif (first instanceof Comment && first.data === '') return get_next_sibling(first);\n\n\t\treturn first;\n\t}\n\n\tif (is_text) {\n\t\t// if an {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (hydrate_node?.nodeType !== TEXT_NODE) {\n\t\t\tvar text = create_text();\n\n\t\t\thydrate_node?.before(text);\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (hydrate_node));\n\t}\n\n\treturn hydrate_node;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {number} count\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function sibling(node, count = 1, is_text = false) {\n\tlet next_sibling = hydrating ? hydrate_node : node;\n\tvar last_sibling;\n\n\twhile (count--) {\n\t\tlast_sibling = next_sibling;\n\t\tnext_sibling = /** @type {TemplateNode} */ (get_next_sibling(next_sibling));\n\t}\n\n\tif (!hydrating) {\n\t\treturn next_sibling;\n\t}\n\n\tif (is_text) {\n\t\t// if a sibling {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (next_sibling?.nodeType !== TEXT_NODE) {\n\t\t\tvar text = create_text();\n\t\t\t// If the next sibling is `null` and we're handling text then it's because\n\t\t\t// the SSR content was empty for the text, so we need to generate a new text\n\t\t\t// node and insert it after the last sibling\n\t\t\tif (next_sibling === null) {\n\t\t\t\tlast_sibling?.after(text);\n\t\t\t} else {\n\t\t\t\tnext_sibling.before(text);\n\t\t\t}\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (next_sibling));\n\t}\n\n\tset_hydrate_node(next_sibling);\n\treturn next_sibling;\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n * @returns {void}\n */\nexport function clear_text_content(node) {\n\tnode.textContent = '';\n}\n\n/**\n * Returns `true` if we're updating the current block, for example `condition` in\n * an `{#if condition}` block just changed. In this case, the branch should be\n * appended (or removed) at the same time as other updates within the\n * current `<svelte:boundary>`\n */\nexport function should_defer_append() {\n\tif (!async_mode_flag) return false;\n\tif (eager_block_effects !== null) return false;\n\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\treturn (flags & REACTION_RAN) !== 0;\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap | string} T\n * @param {T} tag\n * @param {string} [namespace]\n * @param {string} [is]\n * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}\n */\nexport function create_element(tag, namespace, is) {\n\tlet options = is ? { is } : undefined;\n\treturn /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (\n\t\tdocument.createElementNS(namespace ?? NAMESPACE_HTML, tag, options)\n\t);\n}\n\nexport function create_fragment() {\n\treturn document.createDocumentFragment();\n}\n\n/**\n * @param {string} data\n * @returns\n */\nexport function create_comment(data = '') {\n\treturn document.createComment(data);\n}\n\n/**\n * @param {Element} element\n * @param {string} key\n * @param {string} value\n * @returns\n */\nexport function set_attribute(element, key, value = '') {\n\tif (key.startsWith('xlink:')) {\n\t\telement.setAttributeNS('http://www.w3.org/1999/xlink', key, value);\n\t\treturn;\n\t}\n\treturn element.setAttribute(key, value);\n}\n\n/**\n * Browsers split text nodes larger than 65536 bytes when parsing.\n * For hydration to succeed, we need to stitch them back together\n * @param {Text} text\n */\nexport function merge_text_nodes(text) {\n\tif (/** @type {string} */ (text.nodeValue).length < 65536) {\n\t\treturn;\n\t}\n\n\tlet next = text.nextSibling;\n\n\twhile (next !== null && next.nodeType === TEXT_NODE) {\n\t\tnext.remove();\n\n\t\t/** @type {string} */ (text.nodeValue) += /** @type {string} */ (next.nodeValue);\n\n\t\tnext = text.nextSibling;\n\t}\n}\n","import { hydrating } from '../hydration.js';\nimport { clear_text_content, get_first_child } from '../operations.js';\nimport { queue_micro_task } from '../task.js';\n\n/**\n * @param {HTMLElement} dom\n * @param {boolean} value\n * @returns {void}\n */\nexport function autofocus(dom, value) {\n\tif (value) {\n\t\tconst body = document.body;\n\t\tdom.autofocus = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tif (document.activeElement === body) {\n\t\t\t\tdom.focus();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * The child of a textarea actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLTextAreaElement} dom\n * @returns {void}\n */\nexport function remove_textarea_child(dom) {\n\tif (hydrating && get_first_child(dom) !== null) {\n\t\tclear_text_content(dom);\n\t}\n}\n\nlet listening_to_form_reset = false;\n\nexport function add_form_reset_listener() {\n\tif (!listening_to_form_reset) {\n\t\tlistening_to_form_reset = true;\n\t\tdocument.addEventListener(\n\t\t\t'reset',\n\t\t\t(evt) => {\n\t\t\t\t// Needs to happen one tick later or else the dom properties of the form\n\t\t\t\t// elements have not updated to their reset values yet\n\t\t\t\tPromise.resolve().then(() => {\n\t\t\t\t\tif (!evt.defaultPrevented) {\n\t\t\t\t\t\tfor (const e of /**@type {HTMLFormElement} */ (evt.target).elements) {\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\te.__on_r?.();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\t// In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)\n\t\t\t{ capture: true }\n\t\t);\n\t}\n}\n","import { teardown } from '../../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../../runtime.js';\nimport { add_form_reset_listener } from '../misc.js';\n\n/**\n * Fires the handler once immediately (unless corresponding arg is set to `false`),\n * then listens to the given events until the render effect context is destroyed\n * @param {EventTarget} target\n * @param {Array<string>} events\n * @param {(event?: Event) => void} handler\n * @param {any} call_handler_immediately\n */\nexport function listen(target, events, handler, call_handler_immediately = true) {\n\tif (call_handler_immediately) {\n\t\thandler();\n\t}\n\n\tfor (var name of events) {\n\t\ttarget.addEventListener(name, handler);\n\t}\n\n\tteardown(() => {\n\t\tfor (var name of events) {\n\t\t\ttarget.removeEventListener(name, handler);\n\t\t}\n\t});\n}\n\n/**\n * @template T\n * @param {() => T} fn\n */\nexport function without_reactive_context(fn) {\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * Listen to the given event, and then instantiate a global form reset listener if not already done,\n * to notify all bindings when the form is reset\n * @param {HTMLElement} element\n * @param {string} event\n * @param {(is_reset?: true) => void} handler\n * @param {(is_reset?: true) => void} [on_reset]\n */\nexport function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {\n\telement.addEventListener(event, () => without_reactive_context(handler));\n\t// @ts-expect-error\n\tconst prev = element.__on_r;\n\tif (prev) {\n\t\t// special case for checkbox that can have multiple binds (group & checked)\n\t\t// @ts-expect-error\n\t\telement.__on_r = () => {\n\t\t\tprev();\n\t\t\ton_reset(true);\n\t\t};\n\t} else {\n\t\t// @ts-expect-error\n\t\telement.__on_r = () => on_reset(true);\n\t}\n\n\tadd_form_reset_listener();\n}\n","/** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */\nimport {\n\tis_dirty,\n\tactive_effect,\n\tactive_reaction,\n\tupdate_effect,\n\tget,\n\tis_destroying_effect,\n\tremove_reactions,\n\tset_active_reaction,\n\tset_is_destroying_effect,\n\tuntrack,\n\tuntracking,\n\tset_active_effect\n} from '../runtime.js';\nimport {\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tRENDER_EFFECT,\n\tEFFECT,\n\tDESTROYED,\n\tINERT,\n\tREACTION_RAN,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tEFFECT_TRANSPARENT,\n\tDERIVED,\n\tCLEAN,\n\tEAGER_EFFECT,\n\tHEAD_EFFECT,\n\tMAYBE_DIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tUSER_EFFECT,\n\tASYNC,\n\tCONNECTED,\n\tMANAGED_EFFECT,\n\tDESTROYING\n} from '#client/constants';\nimport * as e from '../errors.js';\nimport { DEV } from 'esm-env';\nimport { define_property } from '../../shared/utils.js';\nimport { get_next_sibling } from '../dom/operations.js';\nimport { component_context, dev_current_component_function, dev_stack } from '../context.js';\nimport { Batch, collected_effects, current_batch } from './batch.js';\nimport { flatten, increment_pending } from './async.js';\nimport { without_reactive_context } from '../dom/elements/bindings/shared.js';\nimport { set_signal_status } from './status.js';\n\n/**\n * @param {'$effect' | '$effect.pre' | '$inspect'} rune\n */\nexport function validate_effect(rune) {\n\tif (active_effect === null) {\n\t\tif (active_reaction === null) {\n\t\t\te.effect_orphan(rune);\n\t\t}\n\n\t\te.effect_in_unowned_derived();\n\t}\n\n\tif (is_destroying_effect) {\n\t\te.effect_in_teardown(rune);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect} parent_effect\n */\nfunction push_effect(effect, parent_effect) {\n\tvar parent_last = parent_effect.last;\n\tif (parent_last === null) {\n\t\tparent_effect.last = parent_effect.first = effect;\n\t} else {\n\t\tparent_last.next = effect;\n\t\teffect.prev = parent_last;\n\t\tparent_effect.last = effect;\n\t}\n}\n\n/**\n * @param {number} type\n * @param {null | (() => void | (() => void))} fn\n * @returns {Effect}\n */\nfunction create_effect(type, fn) {\n\tvar parent = active_effect;\n\n\tif (DEV) {\n\t\t// Ensure the parent is never an inspect effect\n\t\twhile (parent !== null && (parent.f & EAGER_EFFECT) !== 0) {\n\t\t\tparent = parent.parent;\n\t\t}\n\t}\n\n\tif (parent !== null && (parent.f & INERT) !== 0) {\n\t\ttype |= INERT;\n\t}\n\n\t/** @type {Effect} */\n\tvar effect = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\tnodes: null,\n\t\tf: type | DIRTY | CONNECTED,\n\t\tfirst: null,\n\t\tfn,\n\t\tlast: null,\n\t\tnext: null,\n\t\tparent,\n\t\tb: parent && parent.b,\n\t\tprev: null,\n\t\tteardown: null,\n\t\twv: 0,\n\t\tac: null\n\t};\n\n\tif (DEV) {\n\t\teffect.component_function = dev_current_component_function;\n\t}\n\n\tcurrent_batch?.register_created_effect(effect);\n\n\t/** @type {Effect | null} */\n\tvar e = effect;\n\n\tif ((type & EFFECT) !== 0) {\n\t\tif (collected_effects !== null) {\n\t\t\t// created during traversal — collect and run afterwards\n\t\t\tcollected_effects.push(effect);\n\t\t} else {\n\t\t\t// schedule for later\n\t\t\tBatch.ensure().schedule(effect);\n\t\t}\n\t} else if (fn !== null) {\n\t\ttry {\n\t\t\tupdate_effect(effect);\n\t\t} catch (e) {\n\t\t\tdestroy_effect(effect);\n\t\t\tthrow e;\n\t\t}\n\n\t\t// if an effect doesn't need to be kept in the tree (because it\n\t\t// won't re-run, has no DOM, and has no teardown etc)\n\t\t// then we skip it and go to its child (if any)\n\t\tif (\n\t\t\te.deps === null &&\n\t\t\te.teardown === null &&\n\t\t\te.nodes === null &&\n\t\t\te.first === e.last && // either `null`, or a singular child\n\t\t\t(e.f & EFFECT_PRESERVED) === 0\n\t\t) {\n\t\t\te = e.first;\n\t\t\tif ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {\n\t\t\t\te.f |= EFFECT_TRANSPARENT;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (e !== null) {\n\t\te.parent = parent;\n\n\t\tif (parent !== null) {\n\t\t\tpush_effect(e, parent);\n\t\t}\n\n\t\t// if we're in a derived, add the effect there too\n\t\tif (\n\t\t\tactive_reaction !== null &&\n\t\t\t(active_reaction.f & DERIVED) !== 0 &&\n\t\t\t(type & ROOT_EFFECT) === 0\n\t\t) {\n\t\t\tvar derived = /** @type {Derived} */ (active_reaction);\n\t\t\t(derived.effects ??= []).push(e);\n\t\t}\n\t}\n\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect.tracking()`\n * @returns {boolean}\n */\nexport function effect_tracking() {\n\treturn active_reaction !== null && !untracking;\n}\n\n/**\n * @param {() => void} fn\n */\nexport function teardown(fn) {\n\tconst effect = create_effect(RENDER_EFFECT, null);\n\tset_signal_status(effect, CLEAN);\n\teffect.teardown = fn;\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect(...)`\n * @param {() => void | (() => void)} fn\n */\nexport function user_effect(fn) {\n\tvalidate_effect('$effect');\n\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect'\n\t\t});\n\t}\n\n\t// Non-nested `$effect(...)` in a component should be deferred\n\t// until the component is mounted\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\tvar defer = !active_reaction && (flags & BRANCH_EFFECT) !== 0 && (flags & REACTION_RAN) === 0;\n\n\tif (defer) {\n\t\t// Top-level `$effect(...)` in an unmounted component — defer until mount\n\t\tvar context = /** @type {ComponentContext} */ (component_context);\n\t\t(context.e ??= []).push(fn);\n\t} else {\n\t\t// Everything else — create immediately\n\t\treturn create_user_effect(fn);\n\t}\n}\n\n/**\n * @param {() => void | (() => void)} fn\n */\nexport function create_user_effect(fn) {\n\treturn create_effect(EFFECT | USER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.pre(...)`\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function user_pre_effect(fn) {\n\tvalidate_effect('$effect.pre');\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect.pre'\n\t\t});\n\t}\n\treturn create_effect(RENDER_EFFECT | USER_EFFECT, fn);\n}\n\n/** @param {() => void | (() => void)} fn */\nexport function eager_effect(fn) {\n\treturn create_effect(EAGER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.root(...)`\n * @param {() => void | (() => void)} fn\n * @returns {() => void}\n */\nexport function effect_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn () => {\n\t\tdestroy_effect(effect);\n\t};\n}\n\n/**\n * An effect root whose children can transition out\n * @param {() => void} fn\n * @returns {(options?: { outro?: boolean }) => Promise<void>}\n */\nexport function component_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn (options = {}) => {\n\t\treturn new Promise((fulfil) => {\n\t\t\tif (options.outro) {\n\t\t\t\tpause_effect(effect, () => {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t\tfulfil(undefined);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdestroy_effect(effect);\n\t\t\t\tfulfil(undefined);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function effect(fn) {\n\treturn create_effect(EFFECT, fn);\n}\n\n/**\n * Internal representation of `$: ..`\n * @param {() => any} deps\n * @param {() => void | (() => void)} fn\n */\nexport function legacy_pre_effect(deps, fn) {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\t/** @type {{ effect: null | Effect, ran: boolean, deps: () => any }} */\n\tvar token = { effect: null, ran: false, deps };\n\n\tcontext.l.$.push(token);\n\n\ttoken.effect = render_effect(() => {\n\t\tdeps();\n\n\t\t// If this legacy pre effect has already run before the end of the reset, then\n\t\t// bail out to emulate the same behavior.\n\t\tif (token.ran) return;\n\n\t\ttoken.ran = true;\n\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t// here, we lie: by setting `active_effect` to be the parent branch, any writes\n\t\t// that happen inside `fn` will _not_ cause an unnecessary reschedule, because\n\t\t// the affected effects will be children of `active_effect`. this is safe\n\t\t// because these effects are known to run in the correct order\n\t\ttry {\n\t\t\tset_active_effect(effect.parent);\n\t\t\tuntrack(fn);\n\t\t} finally {\n\t\t\tset_active_effect(effect);\n\t\t}\n\t});\n}\n\nexport function legacy_pre_effect_reset() {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\trender_effect(() => {\n\t\t// Run dirty `$:` statements\n\t\tfor (var token of context.l.$) {\n\t\t\ttoken.deps();\n\n\t\t\tvar effect = token.effect;\n\n\t\t\t// If the effect is CLEAN, then make it MAYBE_DIRTY. This ensures we traverse through\n\t\t\t// the effects dependencies and correctly ensure each dependency is up-to-date.\n\t\t\tif ((effect.f & CLEAN) !== 0 && effect.deps !== null) {\n\t\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t\t}\n\n\t\t\tif (is_dirty(effect)) {\n\t\t\t\tupdate_effect(effect);\n\t\t\t}\n\n\t\t\ttoken.ran = false;\n\t\t}\n\t});\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function async_effect(fn) {\n\treturn create_effect(ASYNC | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function render_effect(fn, flags = 0) {\n\treturn create_effect(RENDER_EFFECT | flags, fn);\n}\n\n/**\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function template_effect(fn, sync = [], async = [], blockers = []) {\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(RENDER_EFFECT, () => fn(...values.map(get)));\n\t});\n}\n\n/**\n * Like `template_effect`, but with an effect which is deferred until the batch commits\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function deferred_template_effect(fn, sync = [], async = [], blockers = []) {\n\tif (async.length > 0 || blockers.length > 0) {\n\t\tvar decrement_pending = increment_pending();\n\t}\n\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(EFFECT, () => fn(...values.map(get)));\n\n\t\tif (decrement_pending) {\n\t\t\tdecrement_pending();\n\t\t}\n\t});\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function block(fn, flags = 0) {\n\tvar effect = create_effect(BLOCK_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function managed(fn, flags = 0) {\n\tvar effect = create_effect(MANAGED_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n */\nexport function branch(fn) {\n\treturn create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {Effect} effect\n */\nexport function execute_effect_teardown(effect) {\n\tvar teardown = effect.teardown;\n\tif (teardown !== null) {\n\t\tconst previously_destroying_effect = is_destroying_effect;\n\t\tconst previous_reaction = active_reaction;\n\t\tset_is_destroying_effect(true);\n\t\tset_active_reaction(null);\n\t\ttry {\n\t\t\tteardown.call(null);\n\t\t} finally {\n\t\t\tset_is_destroying_effect(previously_destroying_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t}\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @param {boolean} remove_dom\n * @returns {void}\n */\nexport function destroy_effect_children(signal, remove_dom = false) {\n\tvar effect = signal.first;\n\tsignal.first = signal.last = null;\n\n\twhile (effect !== null) {\n\t\tconst controller = effect.ac;\n\n\t\tif (controller !== null) {\n\t\t\twithout_reactive_context(() => {\n\t\t\t\tcontroller.abort(STALE_REACTION);\n\t\t\t});\n\t\t}\n\n\t\tvar next = effect.next;\n\n\t\tif ((effect.f & ROOT_EFFECT) !== 0) {\n\t\t\t// this is now an independent root\n\t\t\teffect.parent = null;\n\t\t} else {\n\t\t\tdestroy_effect(effect, remove_dom);\n\t\t}\n\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @returns {void}\n */\nexport function destroy_block_effect_children(signal) {\n\tvar effect = signal.first;\n\n\twhile (effect !== null) {\n\t\tvar next = effect.next;\n\t\tif ((effect.f & BRANCH_EFFECT) === 0) {\n\t\t\tdestroy_effect(effect);\n\t\t}\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} [remove_dom]\n * @returns {void}\n */\nexport function destroy_effect(effect, remove_dom = true) {\n\tvar removed = false;\n\n\tif (\n\t\t(remove_dom || (effect.f & HEAD_EFFECT) !== 0) &&\n\t\teffect.nodes !== null &&\n\t\teffect.nodes.end !== null\n\t) {\n\t\tremove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));\n\t\tremoved = true;\n\t}\n\n\tset_signal_status(effect, DESTROYING);\n\tdestroy_effect_children(effect, remove_dom && !removed);\n\tremove_reactions(effect, 0);\n\n\tvar transitions = effect.nodes && effect.nodes.t;\n\n\tif (transitions !== null) {\n\t\tfor (const transition of transitions) {\n\t\t\ttransition.stop();\n\t\t}\n\t}\n\n\texecute_effect_teardown(effect);\n\n\teffect.f ^= DESTROYING;\n\teffect.f |= DESTROYED;\n\n\tvar parent = effect.parent;\n\n\t// If the parent doesn't have any children, then skip this work altogether\n\tif (parent !== null && parent.first !== null) {\n\t\tunlink_effect(effect);\n\t}\n\n\tif (DEV) {\n\t\teffect.component_function = null;\n\t}\n\n\t// `first` and `child` are nulled out in destroy_effect_children\n\t// we don't null out `parent` so that error propagation can work correctly\n\teffect.next =\n\t\teffect.prev =\n\t\teffect.teardown =\n\t\teffect.ctx =\n\t\teffect.deps =\n\t\teffect.fn =\n\t\teffect.nodes =\n\t\teffect.ac =\n\t\teffect.b =\n\t\t\tnull;\n}\n\n/**\n *\n * @param {TemplateNode | null} node\n * @param {TemplateNode} end\n */\nexport function remove_effect_dom(node, end) {\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tnode.remove();\n\t\tnode = next;\n\t}\n}\n\n/**\n * Detach an effect from the effect tree, freeing up memory and\n * reducing the amount of work that happens on subsequent traversals\n * @param {Effect} effect\n */\nexport function unlink_effect(effect) {\n\tvar parent = effect.parent;\n\tvar prev = effect.prev;\n\tvar next = effect.next;\n\n\tif (prev !== null) prev.next = next;\n\tif (next !== null) next.prev = prev;\n\n\tif (parent !== null) {\n\t\tif (parent.first === effect) parent.first = next;\n\t\tif (parent.last === effect) parent.last = prev;\n\t}\n}\n\n/**\n * When a block effect is removed, we don't immediately destroy it or yank it\n * out of the DOM, because it might have transitions. Instead, we 'pause' it.\n * It stays around (in memory, and in the DOM) until outro transitions have\n * completed, and if the state change is reversed then we _resume_ it.\n * A paused effect does not update, and the DOM subtree becomes inert.\n * @param {Effect} effect\n * @param {() => void} [callback]\n * @param {boolean} [destroy]\n */\nexport function pause_effect(effect, callback, destroy = true) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\n\tpause_children(effect, transitions, true);\n\n\tvar fn = () => {\n\t\tif (destroy) destroy_effect(effect);\n\t\tif (callback) callback();\n\t};\n\n\tvar remaining = transitions.length;\n\tif (remaining > 0) {\n\t\tvar check = () => --remaining || fn();\n\t\tfor (var transition of transitions) {\n\t\t\ttransition.out(check);\n\t\t}\n\t} else {\n\t\tfn();\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {TransitionManager[]} transitions\n * @param {boolean} local\n */\nfunction pause_children(effect, transitions, local) {\n\tif ((effect.f & INERT) !== 0) return;\n\teffect.f ^= INERT;\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransitions.push(transition);\n\t\t\t}\n\t\t}\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\n\t\t// If this child is a root effect, then it will become an independent root when its parent\n\t\t// is destroyed, it should therefore not become inert nor partake in transitions.\n\t\tif ((child.f & ROOT_EFFECT) === 0) {\n\t\t\tvar transparent =\n\t\t\t\t(child.f & EFFECT_TRANSPARENT) !== 0 ||\n\t\t\t\t// If this is a branch effect without a block effect parent,\n\t\t\t\t// it means the parent block effect was pruned. In that case,\n\t\t\t\t// transparency information was transferred to the branch effect.\n\t\t\t\t((child.f & BRANCH_EFFECT) !== 0 && (effect.f & BLOCK_EFFECT) !== 0);\n\t\t\t// TODO we don't need to call pause_children recursively with a linked list in place\n\t\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t\t// through the tree.\n\t\t\tpause_children(child, transitions, transparent ? local : false);\n\t\t}\n\n\t\tchild = sibling;\n\t}\n}\n\n/**\n * The opposite of `pause_effect`. We call this if (for example)\n * `x` becomes falsy then truthy: `{#if x}...{/if}`\n * @param {Effect} effect\n */\nexport function resume_effect(effect) {\n\tresume_children(effect, true);\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} local\n */\nfunction resume_children(effect, local) {\n\tif ((effect.f & INERT) === 0) return;\n\teffect.f ^= INERT;\n\n\t// If a dependency of this effect changed while it was paused,\n\t// schedule the effect to update. we don't use `is_dirty`\n\t// here because we don't want to eagerly recompute a derived like\n\t// `{#if foo}{foo.bar()}{/if}` if `foo` is now `undefined\n\tif ((effect.f & CLEAN) === 0) {\n\t\tset_signal_status(effect, DIRTY);\n\t\tBatch.ensure().schedule(effect); // Assumption: This happens during the commit phase of the batch, causing another flush, but it's safe\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\t\tvar transparent = (child.f & EFFECT_TRANSPARENT) !== 0 || (child.f & BRANCH_EFFECT) !== 0;\n\t\t// TODO we don't need to call resume_children recursively with a linked list in place\n\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t// through the tree.\n\t\tresume_children(child, transparent ? local : false);\n\t\tchild = sibling;\n\t}\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransition.in();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function aborted(effect = /** @type {Effect} */ (active_effect)) {\n\treturn (effect.f & DESTROYED) !== 0;\n}\n\n/**\n * @param {Effect} effect\n * @param {DocumentFragment} fragment\n */\nexport function move_effect(effect, fragment) {\n\tif (!effect.nodes) return;\n\n\t/** @type {TemplateNode | null} */\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tfragment.append(node);\n\t\tnode = next;\n\t}\n}\n","/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport { get_descriptors, get_prototype_of, includes, index_of } from '../shared/utils.js';\nimport {\n\tdestroy_block_effect_children,\n\tdestroy_effect_children,\n\teffect_tracking,\n\texecute_effect_teardown\n} from './reactivity/effects.js';\nimport {\n\tDIRTY,\n\tMAYBE_DIRTY,\n\tCLEAN,\n\tDERIVED,\n\tDESTROYED,\n\tBRANCH_EFFECT,\n\tSTATE_SYMBOL,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tCONNECTED,\n\tREACTION_IS_UPDATING,\n\tSTALE_REACTION,\n\tERROR_VALUE,\n\tWAS_MARKED,\n\tMANAGED_EFFECT,\n\tREACTION_RAN\n} from './constants.js';\nimport { old_values } from './reactivity/sources.js';\nimport {\n\treactivity_loss_tracker,\n\texecute_derived,\n\tfreeze_derived_effects,\n\trecent_async_deriveds,\n\tunfreeze_derived_effects,\n\tupdate_derived\n} from './reactivity/deriveds.js';\nimport { async_mode_flag, tracing_mode_flag } from '../flags/index.js';\nimport { tracing_expressions } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport {\n\tcomponent_context,\n\tdev_current_component_function,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_current_component_function,\n\tset_dev_stack\n} from './context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\tcurrent_batch,\n\tflushSync,\n\tschedule_effect\n} from './reactivity/batch.js';\nimport { handle_error } from './error-handling.js';\nimport { UNINITIALIZED } from '../../constants.js';\nimport { captured_signals } from './legacy.js';\nimport { without_reactive_context } from './dom/elements/bindings/shared.js';\nimport { set_signal_status, update_derived_status } from './reactivity/status.js';\nimport * as w from './warnings.js';\n\nlet is_updating_effect = false;\n\nexport let is_destroying_effect = false;\n\n/** @param {boolean} value */\nexport function set_is_destroying_effect(value) {\n\tis_destroying_effect = value;\n}\n\n/** @type {null | Reaction} */\nexport let active_reaction = null;\n\nexport let untracking = false;\n\n/** @param {null | Reaction} reaction */\nexport function set_active_reaction(reaction) {\n\tactive_reaction = reaction;\n}\n\n/** @type {null | Effect} */\nexport let active_effect = null;\n\n/** @param {null | Effect} effect */\nexport function set_active_effect(effect) {\n\tactive_effect = effect;\n}\n\n/**\n * When sources are created within a reaction, reading and writing\n * them within that reaction should not cause a re-run\n * @type {null | Source[]}\n */\nexport let current_sources = null;\n\n/** @param {Value} value */\nexport function push_reaction_value(value) {\n\tif (active_reaction !== null && (!async_mode_flag || (active_reaction.f & DERIVED) !== 0)) {\n\t\tif (current_sources === null) {\n\t\t\tcurrent_sources = [value];\n\t\t} else {\n\t\t\tcurrent_sources.push(value);\n\t\t}\n\t}\n}\n\n/**\n * The dependencies of the reaction that is currently being executed. In many cases,\n * the dependencies are unchanged between runs, and so this will be `null` unless\n * and until a new dependency is accessed — we track this via `skipped_deps`\n * @type {null | Value[]}\n */\nexport let new_deps = null;\n\nexport let skipped_deps = 0;\n\n/**\n * Tracks writes that the effect it's executed in doesn't listen to yet,\n * so that the dependency can be added to the effect later on if it then reads it\n * @type {null | Source[]}\n */\nexport let untracked_writes = null;\n\n/** @param {null | Source[]} value */\nexport function set_untracked_writes(value) {\n\tuntracked_writes = value;\n}\n\n/**\n * @type {number} Used by sources and deriveds for handling updates.\n * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing\n **/\nexport let write_version = 1;\n\n/** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */\nlet read_version = 0;\n\nexport let update_version = read_version;\n\n/** @param {number} value */\nexport function set_update_version(value) {\n\tupdate_version = value;\n}\n\nexport function increment_write_version() {\n\treturn ++write_version;\n}\n\n/**\n * Determines whether a derived or effect is dirty.\n * If it is MAYBE_DIRTY, will set the status to CLEAN\n * @param {Reaction} reaction\n * @returns {boolean}\n */\nexport function is_dirty(reaction) {\n\tvar flags = reaction.f;\n\n\tif ((flags & DIRTY) !== 0) {\n\t\treturn true;\n\t}\n\n\tif (flags & DERIVED) {\n\t\treaction.f &= ~WAS_MARKED;\n\t}\n\n\tif ((flags & MAYBE_DIRTY) !== 0) {\n\t\tvar dependencies = /** @type {Value[]} */ (reaction.deps);\n\t\tvar length = dependencies.length;\n\n\t\tfor (var i = 0; i < length; i++) {\n\t\t\tvar dependency = dependencies[i];\n\n\t\t\tif (is_dirty(/** @type {Derived} */ (dependency))) {\n\t\t\t\tupdate_derived(/** @type {Derived} */ (dependency));\n\t\t\t}\n\n\t\t\tif (dependency.wv > reaction.wv) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t(flags & CONNECTED) !== 0 &&\n\t\t\t// During time traveling we don't want to reset the status so that\n\t\t\t// traversal of the graph in the other batches still happens\n\t\t\tbatch_values === null\n\t\t) {\n\t\t\tset_signal_status(reaction, CLEAN);\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * @param {Value} signal\n * @param {Effect} effect\n * @param {boolean} [root]\n */\nfunction schedule_possible_effect_self_invalidation(signal, effect, root = true) {\n\tvar reactions = signal.reactions;\n\tif (reactions === null) return;\n\n\tif (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) {\n\t\treturn;\n\t}\n\n\tfor (var i = 0; i < reactions.length; i++) {\n\t\tvar reaction = reactions[i];\n\n\t\tif ((reaction.f & DERIVED) !== 0) {\n\t\t\tschedule_possible_effect_self_invalidation(/** @type {Derived} */ (reaction), effect, false);\n\t\t} else if (effect === reaction) {\n\t\t\tif (root) {\n\t\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\t} else if ((reaction.f & CLEAN) !== 0) {\n\t\t\t\tset_signal_status(reaction, MAYBE_DIRTY);\n\t\t\t}\n\t\t\tschedule_effect(/** @type {Effect} */ (reaction));\n\t\t}\n\t}\n}\n\n/** @param {Reaction} reaction */\nexport function update_reaction(reaction) {\n\tvar previous_deps = new_deps;\n\tvar previous_skipped_deps = skipped_deps;\n\tvar previous_untracked_writes = untracked_writes;\n\tvar previous_reaction = active_reaction;\n\tvar previous_sources = current_sources;\n\tvar previous_component_context = component_context;\n\tvar previous_untracking = untracking;\n\tvar previous_update_version = update_version;\n\n\tvar flags = reaction.f;\n\n\tnew_deps = /** @type {null | Value[]} */ (null);\n\tskipped_deps = 0;\n\tuntracked_writes = null;\n\tactive_reaction = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;\n\n\tcurrent_sources = null;\n\tset_component_context(reaction.ctx);\n\tuntracking = false;\n\tupdate_version = ++read_version;\n\n\tif (reaction.ac !== null) {\n\t\twithout_reactive_context(() => {\n\t\t\t/** @type {AbortController} */ (reaction.ac).abort(STALE_REACTION);\n\t\t});\n\n\t\treaction.ac = null;\n\t}\n\n\ttry {\n\t\treaction.f |= REACTION_IS_UPDATING;\n\t\tvar fn = /** @type {Function} */ (reaction.fn);\n\t\tvar result = fn();\n\t\treaction.f |= REACTION_RAN;\n\t\tvar deps = reaction.deps;\n\n\t\t// Don't remove reactions during fork;\n\t\t// they must remain for when fork is discarded\n\t\tvar is_fork = current_batch?.is_fork;\n\n\t\tif (new_deps !== null) {\n\t\t\tvar i;\n\n\t\t\tif (!is_fork) {\n\t\t\t\tremove_reactions(reaction, skipped_deps);\n\t\t\t}\n\n\t\t\tif (deps !== null && skipped_deps > 0) {\n\t\t\t\tdeps.length = skipped_deps + new_deps.length;\n\t\t\t\tfor (i = 0; i < new_deps.length; i++) {\n\t\t\t\t\tdeps[skipped_deps + i] = new_deps[i];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treaction.deps = deps = new_deps;\n\t\t\t}\n\n\t\t\tif (effect_tracking() && (reaction.f & CONNECTED) !== 0) {\n\t\t\t\tfor (i = skipped_deps; i < deps.length; i++) {\n\t\t\t\t\t(deps[i].reactions ??= []).push(reaction);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (!is_fork && deps !== null && skipped_deps < deps.length) {\n\t\t\tremove_reactions(reaction, skipped_deps);\n\t\t\tdeps.length = skipped_deps;\n\t\t}\n\n\t\t// If we're inside an effect and we have untracked writes, then we need to\n\t\t// ensure that if any of those untracked writes result in re-invalidation\n\t\t// of the current effect, then that happens accordingly\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tuntracked_writes !== null &&\n\t\t\t!untracking &&\n\t\t\tdeps !== null &&\n\t\t\t(reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0\n\t\t) {\n\t\t\tfor (i = 0; i < /** @type {Source[]} */ (untracked_writes).length; i++) {\n\t\t\t\tschedule_possible_effect_self_invalidation(\n\t\t\t\t\tuntracked_writes[i],\n\t\t\t\t\t/** @type {Effect} */ (reaction)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// If we are returning to an previous reaction then\n\t\t// we need to increment the read version to ensure that\n\t\t// any dependencies in this reaction aren't marked with\n\t\t// the same version\n\t\tif (previous_reaction !== null && previous_reaction !== reaction) {\n\t\t\tread_version++;\n\n\t\t\t// update the `rv` of the previous reaction's deps — both existing and new —\n\t\t\t// so that they are not added again\n\t\t\tif (previous_reaction.deps !== null) {\n\t\t\t\tfor (let i = 0; i < previous_skipped_deps; i += 1) {\n\t\t\t\t\tprevious_reaction.deps[i].rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (previous_deps !== null) {\n\t\t\t\tfor (const dep of previous_deps) {\n\t\t\t\t\tdep.rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (untracked_writes !== null) {\n\t\t\t\tif (previous_untracked_writes === null) {\n\t\t\t\t\tprevious_untracked_writes = untracked_writes;\n\t\t\t\t} else {\n\t\t\t\t\tprevious_untracked_writes.push(.../** @type {Source[]} */ (untracked_writes));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ((reaction.f & ERROR_VALUE) !== 0) {\n\t\t\treaction.f ^= ERROR_VALUE;\n\t\t}\n\n\t\treturn result;\n\t} catch (error) {\n\t\treturn handle_error(error);\n\t} finally {\n\t\treaction.f ^= REACTION_IS_UPDATING;\n\t\tnew_deps = previous_deps;\n\t\tskipped_deps = previous_skipped_deps;\n\t\tuntracked_writes = previous_untracked_writes;\n\t\tactive_reaction = previous_reaction;\n\t\tcurrent_sources = previous_sources;\n\t\tset_component_context(previous_component_context);\n\t\tuntracking = previous_untracking;\n\t\tupdate_version = previous_update_version;\n\t}\n}\n\n/**\n * @template V\n * @param {Reaction} signal\n * @param {Value<V>} dependency\n * @returns {void}\n */\nfunction remove_reaction(signal, dependency) {\n\tlet reactions = dependency.reactions;\n\tif (reactions !== null) {\n\t\tvar index = index_of.call(reactions, signal);\n\t\tif (index !== -1) {\n\t\t\tvar new_length = reactions.length - 1;\n\t\t\tif (new_length === 0) {\n\t\t\t\treactions = dependency.reactions = null;\n\t\t\t} else {\n\t\t\t\t// Swap with last element and then remove.\n\t\t\t\treactions[index] = reactions[new_length];\n\t\t\t\treactions.pop();\n\t\t\t}\n\t\t}\n\t}\n\n\t// If the derived has no reactions, then we can disconnect it from the graph,\n\t// allowing it to either reconnect in the future, or be GC'd by the VM.\n\tif (\n\t\treactions === null &&\n\t\t(dependency.f & DERIVED) !== 0 &&\n\t\t// Destroying a child effect while updating a parent effect can cause a dependency to appear\n\t\t// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`\n\t\t// allows us to skip the expensive work of disconnecting and immediately reconnecting it\n\t\t(new_deps === null || !includes.call(new_deps, dependency))\n\t) {\n\t\tvar derived = /** @type {Derived} */ (dependency);\n\n\t\t// If we are working with a derived that is owned by an effect, then mark it as being\n\t\t// disconnected and remove the mark flag, as it cannot be reliably removed otherwise\n\t\tif ((derived.f & CONNECTED) !== 0) {\n\t\t\tderived.f ^= CONNECTED;\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t}\n\n\t\t// In a fork it's possible that a derived is executed and gets reactions, then commits, but is\n\t\t// never re-executed. This is possible when the derived is only executed once in the context\n\t\t// of a new branch which happens before fork.commit() runs. In this case, the derived still has\n\t\t// UNINITIALIZED as its value, and then when it's loosing its reactions we need to ensure it stays\n\t\t// DIRTY so it is reexecuted once someone wants its value again.\n\t\tif (derived.v !== UNINITIALIZED) {\n\t\t\tupdate_derived_status(derived);\n\t\t}\n\n\t\t// freeze any effects inside this derived\n\t\tfreeze_derived_effects(derived);\n\n\t\t// Disconnect any reactions owned by this reaction\n\t\tremove_reactions(derived, 0);\n\t}\n}\n\n/**\n * @param {Reaction} signal\n * @param {number} start_index\n * @returns {void}\n */\nexport function remove_reactions(signal, start_index) {\n\tvar dependencies = signal.deps;\n\tif (dependencies === null) return;\n\n\tfor (var i = start_index; i < dependencies.length; i++) {\n\t\tremove_reaction(signal, dependencies[i]);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @returns {void}\n */\nexport function update_effect(effect) {\n\tvar flags = effect.f;\n\n\tif ((flags & DESTROYED) !== 0) {\n\t\treturn;\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar previous_effect = active_effect;\n\tvar was_updating_effect = is_updating_effect;\n\n\tactive_effect = effect;\n\tis_updating_effect = true;\n\n\tif (DEV) {\n\t\tvar previous_component_fn = dev_current_component_function;\n\t\tset_dev_current_component_function(effect.component_function);\n\t\tvar previous_stack = /** @type {any} */ (dev_stack);\n\t\t// only block effects have a dev stack, keep the current one otherwise\n\t\tset_dev_stack(effect.dev_stack ?? dev_stack);\n\t}\n\n\ttry {\n\t\tif ((flags & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\tdestroy_block_effect_children(effect);\n\t\t} else {\n\t\t\tdestroy_effect_children(effect);\n\t\t}\n\n\t\texecute_effect_teardown(effect);\n\t\tvar teardown = update_reaction(effect);\n\t\teffect.teardown = typeof teardown === 'function' ? teardown : null;\n\t\teffect.wv = write_version;\n\n\t\t// In DEV, increment versions of any sources that were written to during the effect,\n\t\t// so that they are correctly marked as dirty when the effect re-runs\n\t\tif (DEV && tracing_mode_flag && (effect.f & DIRTY) !== 0 && effect.deps !== null) {\n\t\t\tfor (var dep of effect.deps) {\n\t\t\t\tif (dep.set_during_effect) {\n\t\t\t\t\tdep.wv = increment_write_version();\n\t\t\t\t\tdep.set_during_effect = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} finally {\n\t\tis_updating_effect = was_updating_effect;\n\t\tactive_effect = previous_effect;\n\n\t\tif (DEV) {\n\t\t\tset_dev_current_component_function(previous_component_fn);\n\t\t\tset_dev_stack(previous_stack);\n\t\t}\n\t}\n}\n\n/**\n * Returns a promise that resolves once any pending state changes have been applied.\n * @returns {Promise<void>}\n */\nexport async function tick() {\n\tif (async_mode_flag) {\n\t\treturn new Promise((f) => {\n\t\t\t// Race them against each other - in almost all cases requestAnimationFrame will fire first,\n\t\t\t// but e.g. in case the window is not focused or a view transition happens, requestAnimationFrame\n\t\t\t// will be delayed and setTimeout helps us resolve fast enough in that case\n\t\t\trequestAnimationFrame(() => f());\n\t\t\tsetTimeout(() => f());\n\t\t});\n\t}\n\n\tawait Promise.resolve();\n\n\t// By calling flushSync we guarantee that any pending state changes are applied after one tick.\n\t// TODO look into whether we can make flushing subsequent updates synchronously in the future.\n\tflushSync();\n}\n\n/**\n * Returns a promise that resolves once any state changes, and asynchronous work resulting from them,\n * have resolved and the DOM has been updated\n * @returns {Promise<void>}\n * @since 5.36\n */\nexport function settled() {\n\treturn Batch.ensure().settled();\n}\n\n/**\n * @template V\n * @param {Value<V>} signal\n * @returns {V}\n */\nexport function get(signal) {\n\tvar flags = signal.f;\n\tvar is_derived = (flags & DERIVED) !== 0;\n\n\tcaptured_signals?.add(signal);\n\n\t// Register the dependency on the current reaction signal.\n\tif (active_reaction !== null && !untracking) {\n\t\t// if we're in a derived that is being read inside an _async_ derived,\n\t\t// it's possible that the effect was already destroyed. In this case,\n\t\t// we don't add the dependency, because that would create a memory leak\n\t\tvar destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;\n\n\t\tif (!destroyed && (current_sources === null || !includes.call(current_sources, signal))) {\n\t\t\tvar deps = active_reaction.deps;\n\n\t\t\tif ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {\n\t\t\t\t// we're in the effect init/update cycle\n\t\t\t\tif (signal.rv < read_version) {\n\t\t\t\t\tsignal.rv = read_version;\n\n\t\t\t\t\t// If the signal is accessing the same dependencies in the same\n\t\t\t\t\t// order as it did last time, increment `skipped_deps`\n\t\t\t\t\t// rather than updating `new_deps`, which creates GC cost\n\t\t\t\t\tif (new_deps === null && deps !== null && deps[skipped_deps] === signal) {\n\t\t\t\t\t\tskipped_deps++;\n\t\t\t\t\t} else if (new_deps === null) {\n\t\t\t\t\t\tnew_deps = [signal];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnew_deps.push(signal);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// we're adding a dependency outside the init/update cycle\n\t\t\t\t// (i.e. after an `await`)\n\t\t\t\t(active_reaction.deps ??= []).push(signal);\n\n\t\t\t\tvar reactions = signal.reactions;\n\n\t\t\t\tif (reactions === null) {\n\t\t\t\t\tsignal.reactions = [active_reaction];\n\t\t\t\t} else if (!includes.call(reactions, active_reaction)) {\n\t\t\t\t\treactions.push(active_reaction);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (DEV) {\n\t\tif (\n\t\t\t!untracking &&\n\t\t\treactivity_loss_tracker &&\n\t\t\t!reactivity_loss_tracker.warned &&\n\t\t\t(reactivity_loss_tracker.effect.f & REACTION_IS_UPDATING) === 0 &&\n\t\t\t!reactivity_loss_tracker.effect_deps.has(signal)\n\t\t) {\n\t\t\treactivity_loss_tracker.warned = true;\n\n\t\t\tw.await_reactivity_loss(/** @type {string} */ (signal.label));\n\n\t\t\tvar trace = get_error('traced at');\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tif (trace) console.warn(trace);\n\t\t}\n\n\t\trecent_async_deriveds.delete(signal);\n\n\t\tif (\n\t\t\ttracing_mode_flag &&\n\t\t\t!untracking &&\n\t\t\ttracing_expressions !== null &&\n\t\t\tactive_reaction !== null &&\n\t\t\ttracing_expressions.reaction === active_reaction\n\t\t) {\n\t\t\t// Used when mapping state between special blocks like `each`\n\t\t\tif (signal.trace) {\n\t\t\t\tsignal.trace();\n\t\t\t} else {\n\t\t\t\ttrace = get_error('traced at');\n\n\t\t\t\tif (trace) {\n\t\t\t\t\tvar entry = tracing_expressions.entries.get(signal);\n\n\t\t\t\t\tif (entry === undefined) {\n\t\t\t\t\t\tentry = { traces: [] };\n\t\t\t\t\t\ttracing_expressions.entries.set(signal, entry);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar last = entry.traces[entry.traces.length - 1];\n\n\t\t\t\t\t// traces can be duplicated, e.g. by `snapshot` invoking both\n\t\t\t\t\t// both `getOwnPropertyDescriptor` and `get` traps at once\n\t\t\t\t\tif (trace.stack !== last?.stack) {\n\t\t\t\t\t\tentry.traces.push(trace);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_destroying_effect && old_values.has(signal)) {\n\t\treturn old_values.get(signal);\n\t}\n\n\tif (is_derived) {\n\t\tvar derived = /** @type {Derived} */ (signal);\n\n\t\tif (is_destroying_effect) {\n\t\t\tvar value = derived.v;\n\n\t\t\t// if the derived is dirty and has reactions, or depends on the values that just changed, re-execute\n\t\t\t// (a derived can be maybe_dirty due to the effect destroy removing its last reaction)\n\t\t\tif (\n\t\t\t\t((derived.f & CLEAN) === 0 && derived.reactions !== null) ||\n\t\t\t\tdepends_on_old_values(derived)\n\t\t\t) {\n\t\t\t\tvalue = execute_derived(derived);\n\t\t\t}\n\n\t\t\told_values.set(derived, value);\n\n\t\t\treturn value;\n\t\t}\n\n\t\t// connect disconnected deriveds if we are reading them inside an effect,\n\t\t// or inside another derived that is already connected\n\t\tvar should_connect =\n\t\t\t(derived.f & CONNECTED) === 0 &&\n\t\t\t!untracking &&\n\t\t\tactive_reaction !== null &&\n\t\t\t(is_updating_effect || (active_reaction.f & CONNECTED) !== 0);\n\n\t\tvar is_new = (derived.f & REACTION_RAN) === 0;\n\n\t\tif (is_dirty(derived)) {\n\t\t\tif (should_connect) {\n\t\t\t\t// set the flag before `update_derived`, so that the derived\n\t\t\t\t// is added as a reaction to its dependencies\n\t\t\t\tderived.f |= CONNECTED;\n\t\t\t}\n\n\t\t\tupdate_derived(derived);\n\t\t}\n\n\t\tif (should_connect && !is_new) {\n\t\t\tunfreeze_derived_effects(derived);\n\t\t\treconnect(derived);\n\t\t}\n\t}\n\n\tif (batch_values?.has(signal)) {\n\t\treturn batch_values.get(signal);\n\t}\n\n\tif ((signal.f & ERROR_VALUE) !== 0) {\n\t\tthrow signal.v;\n\t}\n\n\treturn signal.v;\n}\n\n/**\n * (Re)connect a disconnected derived, so that it is notified\n * of changes in `mark_reactions`\n * @param {Derived} derived\n */\nfunction reconnect(derived) {\n\tderived.f |= CONNECTED;\n\n\tif (derived.deps === null) return;\n\n\tfor (const dep of derived.deps) {\n\t\t(dep.reactions ??= []).push(derived);\n\n\t\tif ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {\n\t\t\tunfreeze_derived_effects(/** @type {Derived} */ (dep));\n\t\t\treconnect(/** @type {Derived} */ (dep));\n\t\t}\n\t}\n}\n\n/** @param {Derived} derived */\nfunction depends_on_old_values(derived) {\n\tif (derived.v === UNINITIALIZED) return true; // we don't know, so assume the worst\n\tif (derived.deps === null) return false;\n\n\tfor (const dep of derived.deps) {\n\t\tif (old_values.has(dep)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ((dep.f & DERIVED) !== 0 && depends_on_old_values(/** @type {Derived} */ (dep))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Like `get`, but checks for `undefined`. Used for `var` declarations because they can be accessed before being declared\n * @template V\n * @param {Value<V> | undefined} signal\n * @returns {V | undefined}\n */\nexport function safe_get(signal) {\n\treturn signal && get(signal);\n}\n\n/**\n * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),\n * any state read inside `fn` will not be treated as a dependency.\n *\n * ```ts\n * $effect(() => {\n *   // this will run when `data` changes, but not when `time` changes\n *   save(data, {\n *     timestamp: untrack(() => time)\n *   });\n * });\n * ```\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function untrack(fn) {\n\tvar previous_untracking = untracking;\n\ttry {\n\t\tuntracking = true;\n\t\treturn fn();\n\t} finally {\n\t\tuntracking = previous_untracking;\n\t}\n}\n\n/**\n * Possibly traverse an object and read all its properties so that they're all reactive in case this is `$state`.\n * Does only check first level of an object for performance reasons (heuristic should be good for 99% of all cases).\n * @param {any} value\n * @returns {void}\n */\nexport function deep_read_state(value) {\n\tif (typeof value !== 'object' || !value || value instanceof EventTarget) {\n\t\treturn;\n\t}\n\n\tif (STATE_SYMBOL in value) {\n\t\tdeep_read(value);\n\t} else if (!Array.isArray(value)) {\n\t\tfor (let key in value) {\n\t\t\tconst prop = value[key];\n\t\t\tif (typeof prop === 'object' && prop && STATE_SYMBOL in prop) {\n\t\t\t\tdeep_read(prop);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Deeply traverse an object and read all its properties\n * so that they're all reactive in case this is `$state`\n * @param {any} value\n * @param {Set<any>} visited\n * @returns {void}\n */\nexport function deep_read(value, visited = new Set()) {\n\tif (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t// We don't want to traverse DOM elements\n\t\t!(value instanceof EventTarget) &&\n\t\t!visited.has(value)\n\t) {\n\t\tvisited.add(value);\n\t\t// When working with a possible SvelteDate, this\n\t\t// will ensure we capture changes to it.\n\t\tif (value instanceof Date) {\n\t\t\tvalue.getTime();\n\t\t}\n\t\tfor (let key in value) {\n\t\t\ttry {\n\t\t\t\tdeep_read(value[key], visited);\n\t\t\t} catch (e) {\n\t\t\t\t// continue\n\t\t\t}\n\t\t}\n\t\tconst proto = get_prototype_of(value);\n\t\tif (\n\t\t\tproto !== Object.prototype &&\n\t\t\tproto !== Array.prototype &&\n\t\t\tproto !== Map.prototype &&\n\t\t\tproto !== Set.prototype &&\n\t\t\tproto !== Date.prototype\n\t\t) {\n\t\t\tconst descriptors = get_descriptors(proto);\n\t\t\tfor (let key in descriptors) {\n\t\t\t\tconst get = descriptors[key].get;\n\t\t\t\tif (get) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tget.call(value);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t// continue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { teardown } from '../../reactivity/effects.js';\nimport { define_property } from '../../../shared/utils.js';\nimport { hydrating } from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport { FILENAME } from '../../../../constants.js';\nimport * as w from '../../warnings.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { without_reactive_context } from './bindings/shared.js';\n\n/**\n * Used on elements, as a map of event type -> event handler,\n * and on events themselves to track which element handled an event\n */\nexport const event_symbol = Symbol('events');\n\n/** @type {Set<string>} */\nexport const all_registered_events = new Set();\n\n/** @type {Set<(events: Array<string>) => void>} */\nexport const root_event_handles = new Set();\n\n/**\n * SSR adds onload and onerror attributes to catch those events before the hydration.\n * This function detects those cases, removes the attributes and replays the events.\n * @param {HTMLElement} dom\n */\nexport function replay_events(dom) {\n\tif (!hydrating) return;\n\n\tdom.removeAttribute('onload');\n\tdom.removeAttribute('onerror');\n\t// @ts-expect-error\n\tconst event = dom.__e;\n\tif (event !== undefined) {\n\t\t// @ts-expect-error\n\t\tdom.__e = undefined;\n\t\tqueueMicrotask(() => {\n\t\t\tif (dom.isConnected) {\n\t\t\t\tdom.dispatchEvent(event);\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {EventTarget} dom\n * @param {EventListener} [handler]\n * @param {AddEventListenerOptions} [options]\n */\nexport function create_event(event_name, dom, handler, options = {}) {\n\t/**\n\t * @this {EventTarget}\n\t */\n\tfunction target_handler(/** @type {Event} */ event) {\n\t\tif (!options.capture) {\n\t\t\t// Only call in the bubble phase, else delegated events would be called before the capturing events\n\t\t\thandle_event_propagation.call(dom, event);\n\t\t}\n\t\tif (!event.cancelBubble) {\n\t\t\treturn without_reactive_context(() => {\n\t\t\t\treturn handler?.call(this, event);\n\t\t\t});\n\t\t}\n\t}\n\n\t// Chrome has a bug where pointer events don't work when attached to a DOM element that has been cloned\n\t// with cloneNode() and the DOM element is disconnected from the document. To ensure the event works, we\n\t// defer the attachment till after it's been appended to the document. TODO: remove this once Chrome fixes\n\t// this bug. The same applies to wheel events and touch events.\n\tif (\n\t\tevent_name.startsWith('pointer') ||\n\t\tevent_name.startsWith('touch') ||\n\t\tevent_name === 'wheel'\n\t) {\n\t\tqueue_micro_task(() => {\n\t\t\tdom.addEventListener(event_name, target_handler, options);\n\t\t});\n\t} else {\n\t\tdom.addEventListener(event_name, target_handler, options);\n\t}\n\n\treturn target_handler;\n}\n\n/**\n * Attaches an event handler to an element and returns a function that removes the handler. Using this\n * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively\n * (with attributes like `onclick`), which use event delegation for performance reasons\n *\n * @param {EventTarget} element\n * @param {string} type\n * @param {EventListener} handler\n * @param {AddEventListenerOptions} [options]\n */\nexport function on(element, type, handler, options = {}) {\n\tvar target_handler = create_event(type, element, handler, options);\n\n\treturn () => {\n\t\telement.removeEventListener(type, target_handler, options);\n\t};\n}\n\n/**\n * @param {string} event_name\n * @param {Element} dom\n * @param {EventListener} [handler]\n * @param {boolean} [capture]\n * @param {boolean} [passive]\n * @returns {void}\n */\nexport function event(event_name, dom, handler, capture, passive) {\n\tvar options = { capture, passive };\n\tvar target_handler = create_event(event_name, dom, handler, options);\n\n\tif (\n\t\tdom === document.body ||\n\t\t// @ts-ignore\n\t\tdom === window ||\n\t\t// @ts-ignore\n\t\tdom === document ||\n\t\t// Firefox has quirky behavior, it can happen that we still get \"canplay\" events when the element is already removed\n\t\tdom instanceof HTMLMediaElement\n\t) {\n\t\tteardown(() => {\n\t\t\tdom.removeEventListener(event_name, target_handler, options);\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {Element} element\n * @param {EventListener} [handler]\n * @returns {void}\n */\nexport function delegated(event_name, element, handler) {\n\t// @ts-expect-error\n\t(element[event_symbol] ??= {})[event_name] = handler;\n}\n\n/**\n * @param {Array<string>} events\n * @returns {void}\n */\nexport function delegate(events) {\n\tfor (var i = 0; i < events.length; i++) {\n\t\tall_registered_events.add(events[i]);\n\t}\n\n\tfor (var fn of root_event_handles) {\n\t\tfn(events);\n\t}\n}\n\n// used to store the reference to the currently propagated event\n// to prevent garbage collection between microtasks in Firefox\n// If the event object is GCed too early, the expando __root property\n// set on the event object is lost, causing the event delegation\n// to process the event twice\nlet last_propagated_event = null;\n\n/**\n * @this {EventTarget}\n * @param {Event} event\n * @returns {void}\n */\nexport function handle_event_propagation(event) {\n\tvar handler_element = this;\n\tvar owner_document = /** @type {Node} */ (handler_element).ownerDocument;\n\tvar event_name = event.type;\n\tvar path = event.composedPath?.() || [];\n\tvar current_target = /** @type {null | Element} */ (path[0] || event.target);\n\n\tlast_propagated_event = event;\n\n\t// composedPath contains list of nodes the event has propagated through.\n\t// We check `event_symbol` to skip all nodes below it in case this is a\n\t// parent of the `event_symbol` node, which indicates that there's nested\n\t// mounted apps. In this case we don't want to trigger events multiple times.\n\tvar path_idx = 0;\n\n\t// the `last_propagated_event === event` check is redundant, but\n\t// without it the variable will be DCE'd and things will\n\t// fail mysteriously in Firefox\n\t// @ts-expect-error is added below\n\tvar handled_at = last_propagated_event === event && event[event_symbol];\n\n\tif (handled_at) {\n\t\tvar at_idx = path.indexOf(handled_at);\n\t\tif (\n\t\t\tat_idx !== -1 &&\n\t\t\t(handler_element === document || handler_element === /** @type {any} */ (window))\n\t\t) {\n\t\t\t// This is the fallback document listener or a window listener, but the event was already handled\n\t\t\t// -> ignore, but set handle_at to document/window so that we're resetting the event\n\t\t\t// chain in case someone manually dispatches the same event object again.\n\t\t\t// @ts-expect-error\n\t\t\tevent[event_symbol] = handler_element;\n\t\t\treturn;\n\t\t}\n\n\t\t// We're deliberately not skipping if the index is higher, because\n\t\t// someone could create an event programmatically and emit it multiple times,\n\t\t// in which case we want to handle the whole propagation chain properly each time.\n\t\t// (this will only be a false negative if the event is dispatched multiple times and\n\t\t// the fallback document listener isn't reached in between, but that's super rare)\n\t\tvar handler_idx = path.indexOf(handler_element);\n\t\tif (handler_idx === -1) {\n\t\t\t// handle_idx can theoretically be -1 (happened in some JSDOM testing scenarios with an event listener on the window object)\n\t\t\t// so guard against that, too, and assume that everything was handled at this point.\n\t\t\treturn;\n\t\t}\n\n\t\tif (at_idx <= handler_idx) {\n\t\t\tpath_idx = at_idx;\n\t\t}\n\t}\n\n\tcurrent_target = /** @type {Element} */ (path[path_idx] || event.target);\n\t// there can only be one delegated event per element, and we either already handled the current target,\n\t// or this is the very first target in the chain which has a non-delegated listener, in which case it's safe\n\t// to handle a possible delegated event on it later (through the root delegation listener for example).\n\tif (current_target === handler_element) return;\n\n\t// Proxy currentTarget to correct target\n\tdefine_property(event, 'currentTarget', {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\treturn current_target || owner_document;\n\t\t}\n\t});\n\n\t// This started because of Chromium issue https://chromestatus.com/feature/5128696823545856,\n\t// where removal or moving of of the DOM can cause sync `blur` events to fire, which can cause logic\n\t// to run inside the current `active_reaction`, which isn't what we want at all. However, on reflection,\n\t// it's probably best that all event handled by Svelte have this behaviour, as we don't really want\n\t// an event handler to run in the context of another reaction or effect.\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\t/**\n\t\t * @type {unknown}\n\t\t */\n\t\tvar throw_error;\n\t\t/**\n\t\t * @type {unknown[]}\n\t\t */\n\t\tvar other_errors = [];\n\n\t\twhile (current_target !== null) {\n\t\t\t/** @type {null | Element} */\n\t\t\tvar parent_element =\n\t\t\t\tcurrent_target.assignedSlot ||\n\t\t\t\tcurrent_target.parentNode ||\n\t\t\t\t/** @type {any} */ (current_target).host ||\n\t\t\t\tnull;\n\n\t\t\ttry {\n\t\t\t\t// @ts-expect-error\n\t\t\t\tvar delegated = current_target[event_symbol]?.[event_name];\n\n\t\t\t\tif (\n\t\t\t\t\tdelegated != null &&\n\t\t\t\t\t(!(/** @type {any} */ (current_target).disabled) ||\n\t\t\t\t\t\t// DOM could've been updated already by the time this is reached, so we check this as well\n\t\t\t\t\t\t// -> the target could not have been disabled because it emits the event in the first place\n\t\t\t\t\t\tevent.target === current_target)\n\t\t\t\t) {\n\t\t\t\t\tdelegated.call(current_target, event);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (throw_error) {\n\t\t\t\t\tother_errors.push(error);\n\t\t\t\t} else {\n\t\t\t\t\tthrow_error = error;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (event.cancelBubble || parent_element === handler_element || parent_element === null) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcurrent_target = parent_element;\n\t\t}\n\n\t\tif (throw_error) {\n\t\t\tfor (let error of other_errors) {\n\t\t\t\t// Throw the rest of the errors, one-by-one on a microtask\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow throw_error;\n\t\t}\n\t} finally {\n\t\t// @ts-expect-error is used above\n\t\tevent[event_symbol] = handler_element;\n\t\t// @ts-ignore remove proxy on currentTarget\n\t\tdelete event.currentTarget;\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * In dev, warn if an event handler is not a function, as it means the\n * user probably called the handler or forgot to add a `() =>`\n * @param {() => (event: Event, ...args: any) => void} thunk\n * @param {EventTarget} element\n * @param {[Event, ...any]} args\n * @param {any} component\n * @param {[number, number]} [loc]\n * @param {boolean} [remove_parens]\n */\nexport function apply(\n\tthunk,\n\telement,\n\targs,\n\tcomponent,\n\tloc,\n\thas_side_effects = false,\n\tremove_parens = false\n) {\n\tlet handler;\n\tlet error;\n\n\ttry {\n\t\thandler = thunk();\n\t} catch (e) {\n\t\terror = e;\n\t}\n\n\tif (typeof handler !== 'function' && (has_side_effects || handler != null || error)) {\n\t\tconst filename = component?.[FILENAME];\n\t\tconst location = loc ? ` at ${filename}:${loc[0]}:${loc[1]}` : ` in ${filename}`;\n\t\tconst phase = args[0]?.eventPhase < Event.BUBBLING_PHASE ? 'capture' : '';\n\t\tconst event_name = args[0]?.type + phase;\n\t\tconst description = `\\`${event_name}\\` handler${location}`;\n\t\tconst suggestion = remove_parens ? 'remove the trailing `()`' : 'add a leading `() =>`';\n\n\t\tw.event_handler_invalid(description, suggestion);\n\n\t\tif (error) {\n\t\t\tthrow error;\n\t\t}\n\t}\n\thandler?.apply(element, args);\n}\n","import { create_element } from './operations.js';\n\nconst policy =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\tglobalThis?.window?.trustedTypes &&\n\t/* @__PURE__ */ globalThis.window.trustedTypes.createPolicy('svelte-trusted-html', {\n\t\t/** @param {string} html */\n\t\tcreateHTML: (html) => {\n\t\t\treturn html;\n\t\t}\n\t});\n\n/** @param {string} html */\nexport function create_trusted_html(html) {\n\treturn /** @type {string} */ (policy?.createHTML(html) ?? html);\n}\n\n/**\n * @param {string} html\n */\nexport function create_fragment_from_html(html) {\n\tvar elem = create_element('template');\n\telem.innerHTML = create_trusted_html(html.replaceAll('<!>', '<!---->')); // XHTML compliance\n\treturn elem.content;\n}\n","/** @import { Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { TemplateStructure } from './types' */\nimport { hydrate_next, hydrate_node, hydrating, set_hydrate_node } from './hydration.js';\nimport {\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tis_firefox,\n\tcreate_element,\n\tcreate_fragment,\n\tcreate_comment,\n\tset_attribute,\n\tmerge_text_nodes\n} from './operations.js';\nimport { create_fragment_from_html } from './reconciler.js';\nimport { active_effect } from '../runtime.js';\nimport {\n\tNAMESPACE_MATHML,\n\tNAMESPACE_SVG,\n\tTEMPLATE_FRAGMENT,\n\tTEMPLATE_USE_IMPORT_NODE,\n\tTEMPLATE_USE_MATHML,\n\tTEMPLATE_USE_SVG\n} from '../../../constants.js';\nimport {\n\tCOMMENT_NODE,\n\tDOCUMENT_FRAGMENT_NODE,\n\tIS_XHTML,\n\tREACTION_RAN,\n\tTEXT_NODE\n} from '#client/constants';\n\nconst TEMPLATE_TAG = IS_XHTML ? 'template' : 'TEMPLATE';\nconst SCRIPT_TAG = IS_XHTML ? 'script' : 'SCRIPT';\n\n/**\n * @param {TemplateNode} start\n * @param {TemplateNode | null} end\n */\nexport function assign_nodes(start, end) {\n\tvar effect = /** @type {Effect} */ (active_effect);\n\tif (effect.nodes === null) {\n\t\teffect.nodes = { start, end, a: null, t: null };\n\t}\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_html(content, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\t/** @type {Node} */\n\tvar node;\n\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (node === undefined) {\n\t\t\tnode = create_fragment_from_html(has_start ? content : '<!>' + content);\n\t\t\tif (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (\n\t\t\tuse_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)\n\t\t);\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @param {'svg' | 'math'} ns\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nfunction from_namespace(content, flags, ns = 'svg') {\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar wrapped = `<${ns}>${has_start ? content : '<!>' + content}</${ns}>`;\n\n\t/** @type {Element | DocumentFragment} */\n\tvar node;\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (!node) {\n\t\t\tvar fragment = /** @type {DocumentFragment} */ (create_fragment_from_html(wrapped));\n\t\t\tvar root = /** @type {Element} */ (get_first_child(fragment));\n\n\t\t\tif (is_fragment) {\n\t\t\t\tnode = document.createDocumentFragment();\n\t\t\t\twhile (get_first_child(root)) {\n\t\t\t\t\tnode.appendChild(/** @type {TemplateNode} */ (get_first_child(root)));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnode = /** @type {Element} */ (get_first_child(root));\n\t\t\t}\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (node.cloneNode(true));\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_svg(content, flags) {\n\treturn from_namespace(content, flags, 'svg');\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_mathml(content, flags) {\n\treturn from_namespace(content, flags, 'math');\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {typeof NAMESPACE_SVG | typeof NAMESPACE_MATHML | undefined} [ns]\n */\nfunction fragment_from_tree(structure, ns) {\n\tvar fragment = create_fragment();\n\n\tfor (var item of structure) {\n\t\tif (typeof item === 'string') {\n\t\t\tfragment.append(create_text(item));\n\t\t\tcontinue;\n\t\t}\n\n\t\t// if `preserveComments === true`, comments are represented as `['// <data>']`\n\t\tif (item === undefined || item[0][0] === '/') {\n\t\t\tfragment.append(create_comment(item ? item[0].slice(3) : ''));\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst [name, attributes, ...children] = item;\n\n\t\tconst namespace = name === 'svg' ? NAMESPACE_SVG : name === 'math' ? NAMESPACE_MATHML : ns;\n\n\t\tvar element = create_element(name, namespace, attributes?.is);\n\n\t\tfor (var key in attributes) {\n\t\t\tset_attribute(element, key, attributes[key]);\n\t\t}\n\n\t\tif (children.length > 0) {\n\t\t\tvar target =\n\t\t\t\telement.nodeName === TEMPLATE_TAG\n\t\t\t\t\t? /** @type {HTMLTemplateElement} */ (element).content\n\t\t\t\t\t: element;\n\n\t\t\ttarget.append(\n\t\t\t\tfragment_from_tree(children, element.nodeName === 'foreignObject' ? undefined : namespace)\n\t\t\t);\n\t\t}\n\n\t\tfragment.append(element);\n\t}\n\n\treturn fragment;\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_tree(structure, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\t/** @type {Node} */\n\tvar node;\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (node === undefined) {\n\t\t\tconst ns =\n\t\t\t\t(flags & TEMPLATE_USE_SVG) !== 0\n\t\t\t\t\t? NAMESPACE_SVG\n\t\t\t\t\t: (flags & TEMPLATE_USE_MATHML) !== 0\n\t\t\t\t\t\t? NAMESPACE_MATHML\n\t\t\t\t\t\t: undefined;\n\n\t\t\tnode = fragment_from_tree(structure, ns);\n\t\t\tif (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (\n\t\t\tuse_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)\n\t\t);\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {() => Element | DocumentFragment} fn\n */\nexport function with_script(fn) {\n\treturn () => run_scripts(fn());\n}\n\n/**\n * Creating a document fragment from HTML that contains script tags will not execute\n * the scripts. We need to replace the script tags with new ones so that they are executed.\n * @param {Element | DocumentFragment} node\n * @returns {Node | Node[]}\n */\nfunction run_scripts(node) {\n\t// scripts were SSR'd, in which case they will run\n\tif (hydrating) return node;\n\n\tconst is_fragment = node.nodeType === DOCUMENT_FRAGMENT_NODE;\n\tconst scripts =\n\t\t/** @type {HTMLElement} */ (node).nodeName === SCRIPT_TAG\n\t\t\t? [/** @type {HTMLScriptElement} */ (node)]\n\t\t\t: node.querySelectorAll('script');\n\n\tconst effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\tfor (const script of scripts) {\n\t\tconst clone = create_element('script');\n\t\tfor (var attribute of script.attributes) {\n\t\t\tclone.setAttribute(attribute.name, attribute.value);\n\t\t}\n\n\t\tclone.textContent = script.textContent;\n\n\t\t// The script has changed - if it's at the edges, the effect now points at dead nodes\n\t\tif (is_fragment ? node.firstChild === script : node === script) {\n\t\t\teffect.nodes.start = clone;\n\t\t}\n\t\tif (is_fragment ? node.lastChild === script : node === script) {\n\t\t\teffect.nodes.end = clone;\n\t\t}\n\n\t\tscript.replaceWith(clone);\n\t}\n\treturn node;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {any} value\n */\nexport function text(value = '') {\n\tif (!hydrating) {\n\t\tvar t = create_text(value + '');\n\t\tassign_nodes(t, t);\n\t\treturn t;\n\t}\n\n\tvar node = hydrate_node;\n\n\tif (node.nodeType !== TEXT_NODE) {\n\t\t// if an {expression} is empty during SSR, we need to insert an empty text node\n\t\tnode.before((node = create_text()));\n\t\tset_hydrate_node(node);\n\t} else {\n\t\tmerge_text_nodes(/** @type {Text} */ (node));\n\t}\n\n\tassign_nodes(node, node);\n\treturn node;\n}\n\n/**\n * @returns {TemplateNode | DocumentFragment}\n */\nexport function comment() {\n\t// we're not delegating to `template` here for performance reasons\n\tif (hydrating) {\n\t\tassign_nodes(hydrate_node, null);\n\t\treturn hydrate_node;\n\t}\n\n\tvar frag = document.createDocumentFragment();\n\tvar start = document.createComment('');\n\tvar anchor = create_text();\n\tfrag.append(start, anchor);\n\n\tassign_nodes(start, anchor);\n\n\treturn frag;\n}\n\n/**\n * Assign the created (or in hydration mode, traversed) dom elements to the current block\n * and insert the elements into the dom (in client mode).\n * @param {Text | Comment | Element} anchor\n * @param {DocumentFragment | Element} dom\n */\nexport function append(anchor, dom) {\n\tif (hydrating) {\n\t\tvar effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\t\t// When hydrating and outer component and an inner component is async, i.e. blocked on a promise,\n\t\t// then by the time the inner resolves we have already advanced to the end of the hydrated nodes\n\t\t// of the parent component. Check for defined for that reason to avoid rewinding the parent's end marker.\n\t\tif ((effect.f & REACTION_RAN) === 0 || effect.nodes.end === null) {\n\t\t\teffect.nodes.end = hydrate_node;\n\t\t}\n\n\t\thydrate_next();\n\t\treturn;\n\t}\n\n\tif (anchor === null) {\n\t\t// edge case — void `<svelte:element>` with content\n\t\treturn;\n\t}\n\n\tanchor.before(/** @type {Node} */ (dom));\n}\n\n/**\n * Create (or hydrate) an unique UID for the component instance.\n */\nexport function props_id() {\n\tif (\n\t\thydrating &&\n\t\thydrate_node &&\n\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\thydrate_node.textContent?.startsWith(`$`)\n\t) {\n\t\tconst id = hydrate_node.textContent.substring(1);\n\t\thydrate_next();\n\t\treturn id;\n\t}\n\n\t// @ts-expect-error This way we ensure the id is unique even across Svelte runtimes\n\t(window.__svelte ??= {}).uid ??= 1;\n\n\t// @ts-expect-error\n\treturn `c${window.__svelte.uid++}`;\n}\n","const regex_return_characters = /\\r/g;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nexport function hash(str) {\n\tstr = str.replace(regex_return_characters, '');\n\tlet hash = 5381;\n\tlet i = str.length;\n\n\twhile (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i);\n\treturn (hash >>> 0).toString(36);\n}\n\nconst VOID_ELEMENT_NAMES = [\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr'\n];\n\n/**\n * Returns `true` if `name` is of a void element\n * @param {string} name\n */\nexport function is_void(name) {\n\treturn VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === '!doctype';\n}\n\nconst RESERVED_WORDS = [\n\t'arguments',\n\t'await',\n\t'break',\n\t'case',\n\t'catch',\n\t'class',\n\t'const',\n\t'continue',\n\t'debugger',\n\t'default',\n\t'delete',\n\t'do',\n\t'else',\n\t'enum',\n\t'eval',\n\t'export',\n\t'extends',\n\t'false',\n\t'finally',\n\t'for',\n\t'function',\n\t'if',\n\t'implements',\n\t'import',\n\t'in',\n\t'instanceof',\n\t'interface',\n\t'let',\n\t'new',\n\t'null',\n\t'package',\n\t'private',\n\t'protected',\n\t'public',\n\t'return',\n\t'static',\n\t'super',\n\t'switch',\n\t'this',\n\t'throw',\n\t'true',\n\t'try',\n\t'typeof',\n\t'var',\n\t'void',\n\t'while',\n\t'with',\n\t'yield'\n];\n\n/**\n * Returns `true` if `word` is a reserved JavaScript keyword\n * @param {string} word\n */\nexport function is_reserved(word) {\n\treturn RESERVED_WORDS.includes(word);\n}\n\n/**\n * @param {string} name\n */\nexport function is_capture_event(name) {\n\treturn name.endsWith('capture') && name !== 'gotpointercapture' && name !== 'lostpointercapture';\n}\n\n/** List of Element events that will be delegated */\nconst DELEGATED_EVENTS = [\n\t'beforeinput',\n\t'click',\n\t'change',\n\t'dblclick',\n\t'contextmenu',\n\t'focusin',\n\t'focusout',\n\t'input',\n\t'keydown',\n\t'keyup',\n\t'mousedown',\n\t'mousemove',\n\t'mouseout',\n\t'mouseover',\n\t'mouseup',\n\t'pointerdown',\n\t'pointermove',\n\t'pointerout',\n\t'pointerover',\n\t'pointerup',\n\t'touchend',\n\t'touchmove',\n\t'touchstart'\n];\n\n/**\n * Returns `true` if `event_name` is a delegated event\n * @param {string} event_name\n */\nexport function can_delegate_event(event_name) {\n\treturn DELEGATED_EVENTS.includes(event_name);\n}\n\n/**\n * Attributes that are boolean, i.e. they are present or not present.\n */\nconst DOM_BOOLEAN_ATTRIBUTES = [\n\t'allowfullscreen',\n\t'async',\n\t'autofocus',\n\t'autoplay',\n\t'checked',\n\t'controls',\n\t'default',\n\t'disabled',\n\t'formnovalidate',\n\t'indeterminate',\n\t'inert',\n\t'ismap',\n\t'loop',\n\t'multiple',\n\t'muted',\n\t'nomodule',\n\t'novalidate',\n\t'open',\n\t'playsinline',\n\t'readonly',\n\t'required',\n\t'reversed',\n\t'seamless',\n\t'selected',\n\t'webkitdirectory',\n\t'defer',\n\t'disablepictureinpicture',\n\t'disableremoteplayback'\n];\n\n/**\n * Returns `true` if `name` is a boolean attribute\n * @param {string} name\n */\nexport function is_boolean_attribute(name) {\n\treturn DOM_BOOLEAN_ATTRIBUTES.includes(name);\n}\n\n/**\n * @type {Record<string, string>}\n * List of attribute names that should be aliased to their property names\n * because they behave differently between setting them as an attribute and\n * setting them as a property.\n */\nconst ATTRIBUTE_ALIASES = {\n\t// no `class: 'className'` because we handle that separately\n\tformnovalidate: 'formNoValidate',\n\tismap: 'isMap',\n\tnomodule: 'noModule',\n\tplaysinline: 'playsInline',\n\treadonly: 'readOnly',\n\tdefaultvalue: 'defaultValue',\n\tdefaultchecked: 'defaultChecked',\n\tsrcobject: 'srcObject',\n\tnovalidate: 'noValidate',\n\tallowfullscreen: 'allowFullscreen',\n\tdisablepictureinpicture: 'disablePictureInPicture',\n\tdisableremoteplayback: 'disableRemotePlayback'\n};\n\n/**\n * @param {string} name\n */\nexport function normalize_attribute(name) {\n\tname = name.toLowerCase();\n\treturn ATTRIBUTE_ALIASES[name] ?? name;\n}\n\nconst DOM_PROPERTIES = [\n\t...DOM_BOOLEAN_ATTRIBUTES,\n\t'formNoValidate',\n\t'isMap',\n\t'noModule',\n\t'playsInline',\n\t'readOnly',\n\t'value',\n\t'volume',\n\t'defaultValue',\n\t'defaultChecked',\n\t'srcObject',\n\t'noValidate',\n\t'allowFullscreen',\n\t'disablePictureInPicture',\n\t'disableRemotePlayback'\n];\n\n/**\n * @param {string} name\n */\nexport function is_dom_property(name) {\n\treturn DOM_PROPERTIES.includes(name);\n}\n\nconst NON_STATIC_PROPERTIES = ['autofocus', 'muted', 'defaultValue', 'defaultChecked'];\n\n/**\n * Returns `true` if the given attribute cannot be set through the template\n * string, i.e. needs some kind of JavaScript handling to work.\n * @param {string} name\n */\nexport function cannot_be_set_statically(name) {\n\treturn NON_STATIC_PROPERTIES.includes(name);\n}\n\n/**\n * Subset of delegated events which should be passive by default.\n * These two are already passive via browser defaults on window, document and body.\n * But since\n * - we're delegating them\n * - they happen often\n * - they apply to mobile which is generally less performant\n * we're marking them as passive by default for other elements, too.\n */\nconst PASSIVE_EVENTS = ['touchstart', 'touchmove'];\n\n/**\n * Returns `true` if `name` is a passive event\n * @param {string} name\n */\nexport function is_passive_event(name) {\n\treturn PASSIVE_EVENTS.includes(name);\n}\n\nconst CONTENT_EDITABLE_BINDINGS = ['textContent', 'innerHTML', 'innerText'];\n\n/** @param {string} name */\nexport function is_content_editable_binding(name) {\n\treturn CONTENT_EDITABLE_BINDINGS.includes(name);\n}\n\nconst LOAD_ERROR_ELEMENTS = [\n\t'body',\n\t'embed',\n\t'iframe',\n\t'img',\n\t'link',\n\t'object',\n\t'script',\n\t'style',\n\t'track'\n];\n\n/**\n * Returns `true` if the element emits `load` and `error` events\n * @param {string} name\n */\nexport function is_load_error_element(name) {\n\treturn LOAD_ERROR_ELEMENTS.includes(name);\n}\n\nconst SVG_ELEMENTS = [\n\t'altGlyph',\n\t'altGlyphDef',\n\t'altGlyphItem',\n\t'animate',\n\t'animateColor',\n\t'animateMotion',\n\t'animateTransform',\n\t'circle',\n\t'clipPath',\n\t'color-profile',\n\t'cursor',\n\t'defs',\n\t'desc',\n\t'discard',\n\t'ellipse',\n\t'feBlend',\n\t'feColorMatrix',\n\t'feComponentTransfer',\n\t'feComposite',\n\t'feConvolveMatrix',\n\t'feDiffuseLighting',\n\t'feDisplacementMap',\n\t'feDistantLight',\n\t'feDropShadow',\n\t'feFlood',\n\t'feFuncA',\n\t'feFuncB',\n\t'feFuncG',\n\t'feFuncR',\n\t'feGaussianBlur',\n\t'feImage',\n\t'feMerge',\n\t'feMergeNode',\n\t'feMorphology',\n\t'feOffset',\n\t'fePointLight',\n\t'feSpecularLighting',\n\t'feSpotLight',\n\t'feTile',\n\t'feTurbulence',\n\t'filter',\n\t'font',\n\t'font-face',\n\t'font-face-format',\n\t'font-face-name',\n\t'font-face-src',\n\t'font-face-uri',\n\t'foreignObject',\n\t'g',\n\t'glyph',\n\t'glyphRef',\n\t'hatch',\n\t'hatchpath',\n\t'hkern',\n\t'image',\n\t'line',\n\t'linearGradient',\n\t'marker',\n\t'mask',\n\t'mesh',\n\t'meshgradient',\n\t'meshpatch',\n\t'meshrow',\n\t'metadata',\n\t'missing-glyph',\n\t'mpath',\n\t'path',\n\t'pattern',\n\t'polygon',\n\t'polyline',\n\t'radialGradient',\n\t'rect',\n\t'set',\n\t'solidcolor',\n\t'stop',\n\t'svg',\n\t'switch',\n\t'symbol',\n\t'text',\n\t'textPath',\n\t'tref',\n\t'tspan',\n\t'unknown',\n\t'use',\n\t'view',\n\t'vkern'\n];\n\n/** @param {string} name */\nexport function is_svg(name) {\n\treturn SVG_ELEMENTS.includes(name);\n}\n\nconst MATHML_ELEMENTS = [\n\t'annotation',\n\t'annotation-xml',\n\t'maction',\n\t'math',\n\t'merror',\n\t'mfrac',\n\t'mi',\n\t'mmultiscripts',\n\t'mn',\n\t'mo',\n\t'mover',\n\t'mpadded',\n\t'mphantom',\n\t'mprescripts',\n\t'mroot',\n\t'mrow',\n\t'ms',\n\t'mspace',\n\t'msqrt',\n\t'mstyle',\n\t'msub',\n\t'msubsup',\n\t'msup',\n\t'mtable',\n\t'mtd',\n\t'mtext',\n\t'mtr',\n\t'munder',\n\t'munderover',\n\t'semantics'\n];\n\n/** @param {string} name */\nexport function is_mathml(name) {\n\treturn MATHML_ELEMENTS.includes(name);\n}\n\nconst STATE_CREATION_RUNES = /** @type {const} */ ([\n\t'$state',\n\t'$state.raw',\n\t'$derived',\n\t'$derived.by'\n]);\n\nconst RUNES = /** @type {const} */ ([\n\t...STATE_CREATION_RUNES,\n\t'$state.eager',\n\t'$state.snapshot',\n\t'$props',\n\t'$props.id',\n\t'$bindable',\n\t'$effect',\n\t'$effect.pre',\n\t'$effect.tracking',\n\t'$effect.root',\n\t'$effect.pending',\n\t'$inspect',\n\t'$inspect().with',\n\t'$inspect.trace',\n\t'$host'\n]);\n\n/** @typedef {typeof RUNES[number]} RuneName */\n\n/**\n * @param {string} name\n * @returns {name is RuneName}\n */\nexport function is_rune(name) {\n\treturn RUNES.includes(/** @type {RuneName} */ (name));\n}\n\n/** @typedef {typeof STATE_CREATION_RUNES[number]} StateCreationRuneName */\n\n/**\n * @param {string} name\n * @returns {name is StateCreationRuneName}\n */\nexport function is_state_creation_rune(name) {\n\treturn STATE_CREATION_RUNES.includes(/** @type {StateCreationRuneName} */ (name));\n}\n\n/** List of elements that require raw contents and should not have SSR comments put in them */\nconst RAW_TEXT_ELEMENTS = /** @type {const} */ (['textarea', 'script', 'style', 'title']);\n\n/** @param {string} name */\nexport function is_raw_text_element(name) {\n\treturn RAW_TEXT_ELEMENTS.includes(/** @type {typeof RAW_TEXT_ELEMENTS[number]} */ (name));\n}\n\n// Matches valid HTML/SVG/MathML element names and custom element names.\n// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n//\n// Standard elements: ASCII alpha start, followed by ASCII alphanumerics.\n// Custom elements: ASCII alpha start, followed by any mix of PCENChar (which\n// includes ASCII alphanumerics, `-`, `.`, `_`, and specified Unicode ranges),\n// with at least one hyphen required somewhere after the first character.\n//\n// Rejects strings containing whitespace, quotes, angle brackets, slashes, equals,\n// or other characters that could break out of a tag-name token and enable markup injection.\nexport const REGEX_VALID_TAG_NAME =\n\t/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\\-_\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}]+)*$/u;\n\n/**\n * Prevent devtools trying to make `location` a clickable link by inserting a zero-width space\n * @template {string | undefined} T\n * @param {T} location\n * @returns {T};\n */\nexport function sanitize_location(location) {\n\treturn /** @type {T} */ (location?.replace(/\\//g, '/\\u200b'));\n}\n","/** @import { ComponentContext, Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { Component, ComponentType, SvelteComponent, MountOptions } from '../../index.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tinit_operations\n} from './dom/operations.js';\nimport { HYDRATION_END, HYDRATION_ERROR, HYDRATION_START } from '../../constants.js';\nimport { active_effect } from './runtime.js';\nimport { push, pop, component_context } from './context.js';\nimport { component_root } from './reactivity/effects.js';\nimport { hydrate_node, hydrating, set_hydrate_node, set_hydrating } from './dom/hydration.js';\nimport { array_from } from '../shared/utils.js';\nimport {\n\tall_registered_events,\n\thandle_event_propagation,\n\troot_event_handles\n} from './dom/elements/events.js';\nimport * as w from './warnings.js';\nimport * as e from './errors.js';\nimport { assign_nodes } from './dom/template.js';\nimport { is_passive_event } from '../../utils.js';\nimport { COMMENT_NODE, STATE_SYMBOL } from './constants.js';\nimport { boundary } from './dom/blocks/boundary.js';\n\n/**\n * This is normally true — block effects should run their intro transitions —\n * but is false during hydration (unless `options.intro` is `true`) and\n * when creating the children of a `<svelte:element>` that just changed tag\n */\nexport let should_intro = true;\n\n/** @param {boolean} value */\nexport function set_should_intro(value) {\n\tshould_intro = value;\n}\n\n/**\n * @param {Element} text\n * @param {string} value\n * @returns {void}\n */\nexport function set_text(text, value) {\n\t// For objects, we apply string coercion (which might make things like $state array references in the template reactive) before diffing\n\tvar str = value == null ? '' : typeof value === 'object' ? `${value}` : value;\n\t// @ts-expect-error\n\tif (str !== (text.__t ??= text.nodeValue)) {\n\t\t// @ts-expect-error\n\t\ttext.__t = str;\n\t\ttext.nodeValue = `${str}`;\n\t}\n}\n\n/**\n * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.\n * Transitions will play during the initial render unless the `intro` option is set to `false`.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {MountOptions<Props>} options\n * @returns {Exports}\n */\nexport function mount(component, options) {\n\treturn _mount(component, options);\n}\n\n/**\n * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {{} extends Props ? {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops?: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n *  \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t} : {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n *  \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t}} options\n * @returns {Exports}\n */\nexport function hydrate(component, options) {\n\tinit_operations();\n\toptions.intro = options.intro ?? false;\n\tconst target = options.target;\n\tconst was_hydrating = hydrating;\n\tconst previous_hydrate_node = hydrate_node;\n\n\ttry {\n\t\tvar anchor = get_first_child(target);\n\n\t\twhile (\n\t\t\tanchor &&\n\t\t\t(anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */ (anchor).data !== HYDRATION_START)\n\t\t) {\n\t\t\tanchor = get_next_sibling(anchor);\n\t\t}\n\n\t\tif (!anchor) {\n\t\t\tthrow HYDRATION_ERROR;\n\t\t}\n\n\t\tset_hydrating(true);\n\t\tset_hydrate_node(/** @type {Comment} */ (anchor));\n\n\t\tconst instance = _mount(component, { ...options, anchor });\n\n\t\tset_hydrating(false);\n\n\t\treturn /**  @type {Exports} */ (instance);\n\t} catch (error) {\n\t\t// re-throw Svelte errors - they are certainly not related to hydration\n\t\tif (\n\t\t\terror instanceof Error &&\n\t\t\terror.message.split('\\n').some((line) => line.startsWith('https://svelte.dev/e/'))\n\t\t) {\n\t\t\tthrow error;\n\t\t}\n\t\tif (error !== HYDRATION_ERROR) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn('Failed to hydrate: ', error);\n\t\t}\n\n\t\tif (options.recover === false) {\n\t\t\te.hydration_failed();\n\t\t}\n\n\t\t// If an error occurred above, the operations might not yet have been initialised.\n\t\tinit_operations();\n\t\tclear_text_content(target);\n\n\t\tset_hydrating(false);\n\t\treturn mount(component, options);\n\t} finally {\n\t\tset_hydrating(was_hydrating);\n\t\tset_hydrate_node(previous_hydrate_node);\n\t}\n}\n\n/** @type {Map<EventTarget, Map<string, number>>} */\nconst listeners = new Map();\n\n/**\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<any>> | Component<any>} Component\n * @param {MountOptions} options\n * @returns {Exports}\n */\nfunction _mount(\n\tComponent,\n\t{ target, anchor, props = {}, events, context, intro = true, transformError }\n) {\n\tinit_operations();\n\n\t/** @type {Exports} */\n\t// @ts-expect-error will be defined because the render effect runs synchronously\n\tvar component = undefined;\n\n\tvar unmount = component_root(() => {\n\t\tvar anchor_node = anchor ?? target.appendChild(create_text());\n\n\t\tboundary(\n\t\t\t/** @type {TemplateNode} */ (anchor_node),\n\t\t\t{\n\t\t\t\tpending: () => {}\n\t\t\t},\n\t\t\t(anchor_node) => {\n\t\t\t\tpush({});\n\t\t\t\tvar ctx = /** @type {ComponentContext} */ (component_context);\n\t\t\t\tif (context) ctx.c = context;\n\n\t\t\t\tif (events) {\n\t\t\t\t\t// We can't spread the object or else we'd lose the state proxy stuff, if it is one\n\t\t\t\t\t/** @type {any} */ (props).$$events = events;\n\t\t\t\t}\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\tassign_nodes(/** @type {TemplateNode} */ (anchor_node), null);\n\t\t\t\t}\n\n\t\t\t\tshould_intro = intro;\n\t\t\t\t// @ts-expect-error the public typings are not what the actual function looks like\n\t\t\t\tcomponent = Component(anchor_node, props) || {};\n\t\t\t\tshould_intro = true;\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\t/** @type {Effect & { nodes: EffectNodes }} */ (active_effect).nodes.end = hydrate_node;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\thydrate_node === null ||\n\t\t\t\t\t\thydrate_node.nodeType !== COMMENT_NODE ||\n\t\t\t\t\t\t/** @type {Comment} */ (hydrate_node).data !== HYDRATION_END\n\t\t\t\t\t) {\n\t\t\t\t\t\tw.hydration_mismatch();\n\t\t\t\t\t\tthrow HYDRATION_ERROR;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tpop();\n\t\t\t},\n\t\t\ttransformError\n\t\t);\n\n\t\t// Setup event delegation _after_ component is mounted - if an error would happen during mount, it would otherwise not be cleaned up\n\t\t/** @type {Set<string>} */\n\t\tvar registered_events = new Set();\n\n\t\t/** @param {Array<string>} events */\n\t\tvar event_handle = (events) => {\n\t\t\tfor (var i = 0; i < events.length; i++) {\n\t\t\t\tvar event_name = events[i];\n\n\t\t\t\tif (registered_events.has(event_name)) continue;\n\t\t\t\tregistered_events.add(event_name);\n\n\t\t\t\tvar passive = is_passive_event(event_name);\n\n\t\t\t\t// Add the event listener to both the container and the document.\n\t\t\t\t// The container listener ensures we catch events from within in case\n\t\t\t\t// the outer content stops propagation of the event.\n\t\t\t\t//\n\t\t\t\t// The document listener ensures we catch events that originate from elements that were\n\t\t\t\t// manually moved outside of the container (e.g. via manual portals).\n\t\t\t\tfor (const node of [target, document]) {\n\t\t\t\t\tvar counts = listeners.get(node);\n\n\t\t\t\t\tif (counts === undefined) {\n\t\t\t\t\t\tcounts = new Map();\n\t\t\t\t\t\tlisteners.set(node, counts);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar count = counts.get(event_name);\n\n\t\t\t\t\tif (count === undefined) {\n\t\t\t\t\t\tnode.addEventListener(event_name, handle_event_propagation, { passive });\n\t\t\t\t\t\tcounts.set(event_name, 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcounts.set(event_name, count + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tevent_handle(array_from(all_registered_events));\n\t\troot_event_handles.add(event_handle);\n\n\t\treturn () => {\n\t\t\tfor (var event_name of registered_events) {\n\t\t\t\tfor (const node of [target, document]) {\n\t\t\t\t\tvar counts = /** @type {Map<string, number>} */ (listeners.get(node));\n\t\t\t\t\tvar count = /** @type {number} */ (counts.get(event_name));\n\n\t\t\t\t\tif (--count == 0) {\n\t\t\t\t\t\tnode.removeEventListener(event_name, handle_event_propagation);\n\t\t\t\t\t\tcounts.delete(event_name);\n\n\t\t\t\t\t\tif (counts.size === 0) {\n\t\t\t\t\t\t\tlisteners.delete(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcounts.set(event_name, count);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\troot_event_handles.delete(event_handle);\n\n\t\t\tif (anchor_node !== anchor) {\n\t\t\t\tanchor_node.parentNode?.removeChild(anchor_node);\n\t\t\t}\n\t\t};\n\t});\n\n\tmounted_components.set(component, unmount);\n\treturn component;\n}\n\n/**\n * References of the components that were mounted or hydrated.\n * Uses a `WeakMap` to avoid memory leaks.\n */\nlet mounted_components = new WeakMap();\n\n/**\n * Unmounts a component that was previously mounted using `mount` or `hydrate`.\n *\n * Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM.\n *\n * Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`).\n *\n * ```js\n * import { mount, unmount } from 'svelte';\n * import App from './App.svelte';\n *\n * const app = mount(App, { target: document.body });\n *\n * // later...\n * unmount(app, { outro: true });\n * ```\n * @param {Record<string, any>} component\n * @param {{ outro?: boolean }} [options]\n * @returns {Promise<void>}\n */\nexport function unmount(component, options) {\n\tconst fn = mounted_components.get(component);\n\n\tif (fn) {\n\t\tmounted_components.delete(component);\n\t\treturn fn(options);\n\t}\n\n\tif (DEV) {\n\t\tif (STATE_SYMBOL in component) {\n\t\t\tw.state_proxy_unmount();\n\t\t} else {\n\t\t\tw.lifecycle_double_unmount();\n\t\t}\n\t}\n\n\treturn Promise.resolve();\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { Batch, current_batch } from '../../reactivity/batch.js';\nimport {\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { HMR_ANCHOR } from '../../constants.js';\nimport { hydrate_node, hydrating } from '../hydration.js';\nimport { create_text, should_defer_append } from '../operations.js';\nimport { DEV } from 'esm-env';\n\n/**\n * @typedef {{ effect: Effect, fragment: DocumentFragment }} Branch\n */\n\n/**\n * @template Key\n */\nexport class BranchManager {\n\t/** @type {TemplateNode} */\n\tanchor;\n\n\t/** @type {Map<Batch, Key>} */\n\t#batches = new Map();\n\n\t/**\n\t * Map of keys to effects that are currently rendered in the DOM.\n\t * These effects are visible and actively part of the document tree.\n\t * Example:\n\t * ```\n\t * {#if condition}\n\t * \tfoo\n\t * {:else}\n\t * \tbar\n\t * {/if}\n\t * ```\n\t * Can result in the entries `true->Effect` and `false->Effect`\n\t * @type {Map<Key, Effect>}\n\t */\n\t#onscreen = new Map();\n\n\t/**\n\t * Similar to #onscreen with respect to the keys, but contains branches that are not yet\n\t * in the DOM, because their insertion is deferred.\n\t * @type {Map<Key, Branch>}\n\t */\n\t#offscreen = new Map();\n\n\t/**\n\t * Keys of effects that are currently outroing\n\t * @type {Set<Key>}\n\t */\n\t#outroing = new Set();\n\n\t/**\n\t * Whether to pause (i.e. outro) on change, or destroy immediately.\n\t * This is necessary for `<svelte:element>`\n\t */\n\t#transition = true;\n\n\t/**\n\t * @param {TemplateNode} anchor\n\t * @param {boolean} transition\n\t */\n\tconstructor(anchor, transition = true) {\n\t\tthis.anchor = anchor;\n\t\tthis.#transition = transition;\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#commit = (batch) => {\n\t\t// if this batch was made obsolete, bail\n\t\tif (!this.#batches.has(batch)) return;\n\n\t\tvar key = /** @type {Key} */ (this.#batches.get(batch));\n\n\t\tvar onscreen = this.#onscreen.get(key);\n\n\t\tif (onscreen) {\n\t\t\t// effect is already in the DOM — abort any current outro\n\t\t\tresume_effect(onscreen);\n\t\t\tthis.#outroing.delete(key);\n\t\t} else {\n\t\t\t// effect is currently offscreen. put it in the DOM\n\t\t\tvar offscreen = this.#offscreen.get(key);\n\n\t\t\tif (offscreen) {\n\t\t\t\tthis.#onscreen.set(key, offscreen.effect);\n\t\t\t\tthis.#offscreen.delete(key);\n\n\t\t\t\tif (DEV) {\n\t\t\t\t\t// Tell hmr.js about the anchor it should use for updates,\n\t\t\t\t\t// since the initial one will be removed\n\t\t\t\t\t/** @type {any} */ (offscreen.fragment.lastChild)[HMR_ANCHOR] = this.anchor;\n\t\t\t\t}\n\n\t\t\t\t// remove the anchor...\n\t\t\t\t/** @type {TemplateNode} */ (offscreen.fragment.lastChild).remove();\n\n\t\t\t\t// ...and append the fragment\n\t\t\t\tthis.anchor.before(offscreen.fragment);\n\t\t\t\tonscreen = offscreen.effect;\n\t\t\t}\n\t\t}\n\n\t\tfor (const [b, k] of this.#batches) {\n\t\t\tthis.#batches.delete(b);\n\n\t\t\tif (b === batch) {\n\t\t\t\t// keep values for newer batches\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst offscreen = this.#offscreen.get(k);\n\n\t\t\tif (offscreen) {\n\t\t\t\t// for older batches, destroy offscreen effects\n\t\t\t\t// as they will never be committed\n\t\t\t\tdestroy_effect(offscreen.effect);\n\t\t\t\tthis.#offscreen.delete(k);\n\t\t\t}\n\t\t}\n\n\t\t// outro/destroy all onscreen effects...\n\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t// ...except the one that was just committed\n\t\t\t//    or those that are already outroing (else the transition is aborted and the effect destroyed right away)\n\t\t\tif (k === key || this.#outroing.has(k)) continue;\n\n\t\t\tconst on_destroy = () => {\n\t\t\t\tconst keys = Array.from(this.#batches.values());\n\n\t\t\t\tif (keys.includes(k)) {\n\t\t\t\t\t// keep the effect offscreen, as another batch will need it\n\t\t\t\t\tvar fragment = document.createDocumentFragment();\n\t\t\t\t\tmove_effect(effect, fragment);\n\n\t\t\t\t\tfragment.append(create_text()); // TODO can we avoid this?\n\n\t\t\t\t\tthis.#offscreen.set(k, { effect, fragment });\n\t\t\t\t} else {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t}\n\n\t\t\t\tthis.#outroing.delete(k);\n\t\t\t\tthis.#onscreen.delete(k);\n\t\t\t};\n\n\t\t\tif (this.#transition || !onscreen) {\n\t\t\t\tthis.#outroing.add(k);\n\t\t\t\tpause_effect(effect, on_destroy, false);\n\t\t\t} else {\n\t\t\t\ton_destroy();\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#discard = (batch) => {\n\t\tthis.#batches.delete(batch);\n\n\t\tconst keys = Array.from(this.#batches.values());\n\n\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\tif (!keys.includes(k)) {\n\t\t\t\tdestroy_effect(branch.effect);\n\t\t\t\tthis.#offscreen.delete(k);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t *\n\t * @param {any} key\n\t * @param {null | ((target: TemplateNode) => void)} fn\n\t */\n\tensure(key, fn) {\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tif (fn && !this.#onscreen.has(key) && !this.#offscreen.has(key)) {\n\t\t\tif (defer) {\n\t\t\t\tvar fragment = document.createDocumentFragment();\n\t\t\t\tvar target = create_text();\n\n\t\t\t\tfragment.append(target);\n\n\t\t\t\tthis.#offscreen.set(key, {\n\t\t\t\t\teffect: branch(() => fn(target)),\n\t\t\t\t\tfragment\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.#onscreen.set(\n\t\t\t\t\tkey,\n\t\t\t\t\tbranch(() => fn(this.anchor))\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis.#batches.set(batch, key);\n\n\t\tif (defer) {\n\t\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(branch.effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(branch.effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch.oncommit(this.#commit);\n\t\t\tbatch.ondiscard(this.#discard);\n\t\t} else {\n\t\t\tif (hydrating) {\n\t\t\t\tthis.anchor = hydrate_node;\n\t\t\t}\n\n\t\t\tthis.#commit(batch);\n\t\t}\n\t}\n}\n","/** @import { ComponentContext, ComponentContextLegacy } from '#client' */\n/** @import { EventDispatcher } from './index.js' */\n/** @import { NotFunction } from './internal/types.js' */\nimport { active_reaction, untrack } from './internal/client/runtime.js';\nimport { is_array } from './internal/shared/utils.js';\nimport { user_effect } from './internal/client/index.js';\nimport * as e from './internal/client/errors.js';\nimport { legacy_mode_flag } from './internal/flags/index.js';\nimport { component_context } from './internal/client/context.js';\nimport { DEV } from 'esm-env';\n\nif (DEV) {\n\t/**\n\t * @param {string} rune\n\t */\n\tfunction throw_rune_error(rune) {\n\t\tif (!(rune in globalThis)) {\n\t\t\t// TODO if people start adjusting the \"this can contain runes\" config through v-p-s more, adjust this message\n\t\t\t/** @type {any} */\n\t\t\tlet value; // let's hope noone modifies this global, but belts and braces\n\t\t\tObject.defineProperty(globalThis, rune, {\n\t\t\t\tconfigurable: true,\n\t\t\t\t// eslint-disable-next-line getter-return\n\t\t\t\tget: () => {\n\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\treturn value;\n\t\t\t\t\t}\n\n\t\t\t\t\te.rune_outside_svelte(rune);\n\t\t\t\t},\n\t\t\t\tset: (v) => {\n\t\t\t\t\tvalue = v;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tthrow_rune_error('$state');\n\tthrow_rune_error('$effect');\n\tthrow_rune_error('$derived');\n\tthrow_rune_error('$inspect');\n\tthrow_rune_error('$props');\n\tthrow_rune_error('$bindable');\n}\n\n/**\n * Returns an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that aborts when the current [derived](https://svelte.dev/docs/svelte/$derived) or [effect](https://svelte.dev/docs/svelte/$effect) re-runs or is destroyed.\n *\n * Must be called while a derived or effect is running.\n *\n * ```svelte\n * <script>\n * \timport { getAbortSignal } from 'svelte';\n *\n * \tlet { id } = $props();\n *\n * \tasync function getData(id) {\n * \t\tconst response = await fetch(`/items/${id}`, {\n * \t\t\tsignal: getAbortSignal()\n * \t\t});\n *\n * \t\treturn await response.json();\n * \t}\n *\n * \tconst data = $derived(await getData(id));\n * </script>\n * ```\n */\nexport function getAbortSignal() {\n\tif (active_reaction === null) {\n\t\te.get_abort_signal_outside_reaction();\n\t}\n\n\treturn (active_reaction.ac ??= new AbortController()).signal;\n}\n\n/**\n * `onMount`, like [`$effect`](https://svelte.dev/docs/svelte/$effect), schedules a function to run as soon as the component has been mounted to the DOM.\n * Unlike `$effect`, the provided function only runs once.\n *\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). If a function is returned _synchronously_ from `onMount`,\n * it will be called when the component is unmounted.\n *\n * `onMount` functions do not run during [server-side rendering](https://svelte.dev/docs/svelte/svelte-server#render).\n *\n * @template T\n * @param {() => NotFunction<T> | Promise<NotFunction<T>> | (() => any)} fn\n * @returns {void}\n */\nexport function onMount(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('onMount');\n\t}\n\n\tif (legacy_mode_flag && component_context.l !== null) {\n\t\tinit_update_callbacks(component_context).m.push(fn);\n\t} else {\n\t\tuser_effect(() => {\n\t\t\tconst cleanup = untrack(fn);\n\t\t\tif (typeof cleanup === 'function') return /** @type {() => void} */ (cleanup);\n\t\t});\n\t}\n}\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 * @param {() => any} fn\n * @returns {void}\n */\nexport function onDestroy(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('onDestroy');\n\t}\n\n\tonMount(() => () => untrack(fn));\n}\n\n/**\n * @template [T=any]\n * @param {string} type\n * @param {T} [detail]\n * @param {any}params_0\n * @returns {CustomEvent<T>}\n */\nfunction create_custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n\treturn new CustomEvent(type, { detail, bubbles, cancelable });\n}\n\n/**\n * Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs/svelte/legacy-on#Component-events).\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 * The event dispatcher can be typed to narrow the allowed event names and the type of the `detail` argument:\n * ```ts\n * const dispatch = createEventDispatcher<{\n *  loaded: null; // does not take a detail argument\n *  change: string; // takes a detail argument of type string, which is required\n *  optional: number | null; // takes an optional detail argument of type number\n * }>();\n * ```\n *\n * @deprecated Use callback props and/or the `$host()` rune instead — see [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Event-changes-Component-events)\n * @template {Record<string, any>} [EventMap = any]\n * @returns {EventDispatcher<EventMap>}\n */\nexport function createEventDispatcher() {\n\tconst active_component_context = component_context;\n\tif (active_component_context === null) {\n\t\te.lifecycle_outside_component('createEventDispatcher');\n\t}\n\n\t/**\n\t * @param [detail]\n\t * @param [options]\n\t */\n\treturn (type, detail, options) => {\n\t\tconst events = /** @type {Record<string, Function | Function[]>} */ (\n\t\t\tactive_component_context.s.$$events\n\t\t)?.[/** @type {string} */ (type)];\n\n\t\tif (events) {\n\t\t\tconst callbacks = is_array(events) ? events.slice() : [events];\n\t\t\t// TODO are there situations where events could be dispatched\n\t\t\t// in a server (non-DOM) environment?\n\t\t\tconst event = create_custom_event(/** @type {string} */ (type), detail, options);\n\t\t\tfor (const fn of callbacks) {\n\t\t\t\tfn.call(active_component_context.x, event);\n\t\t\t}\n\t\t\treturn !event.defaultPrevented;\n\t\t}\n\n\t\treturn true;\n\t};\n}\n\n// TODO mark beforeUpdate and afterUpdate as deprecated in Svelte 6\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 * In runes mode use `$effect.pre` instead.\n *\n * @deprecated Use [`$effect.pre`](https://svelte.dev/docs/svelte/$effect#$effect.pre) instead\n * @param {() => void} fn\n * @returns {void}\n */\nexport function beforeUpdate(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('beforeUpdate');\n\t}\n\n\tif (component_context.l === null) {\n\t\te.lifecycle_legacy_only('beforeUpdate');\n\t}\n\n\tinit_update_callbacks(component_context).b.push(fn);\n}\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 *\n * In runes mode use `$effect` instead.\n *\n * @deprecated Use [`$effect`](https://svelte.dev/docs/svelte/$effect) instead\n * @param {() => void} fn\n * @returns {void}\n */\nexport function afterUpdate(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('afterUpdate');\n\t}\n\n\tif (component_context.l === null) {\n\t\te.lifecycle_legacy_only('afterUpdate');\n\t}\n\n\tinit_update_callbacks(component_context).a.push(fn);\n}\n\n/**\n * Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate\n * @param {ComponentContext} context\n */\nfunction init_update_callbacks(context) {\n\tvar l = /** @type {ComponentContextLegacy} */ (context).l;\n\treturn (l.u ??= { a: [], b: [], m: [] });\n}\n\nexport { flushSync, fork } from './internal/client/reactivity/batch.js';\nexport {\n\tcreateContext,\n\tgetContext,\n\tgetAllContexts,\n\thasContext,\n\tsetContext\n} from './internal/client/context.js';\nexport { hydratable } from './internal/client/hydratable.js';\nexport { hydrate, mount, unmount } from './internal/client/render.js';\nexport { tick, untrack, settled } from './internal/client/runtime.js';\nexport { createRawSnippet } from './internal/client/dom/blocks/snippet.js';\n","/** @import { TemplateNode } from '#client' */\nimport { EFFECT_TRANSPARENT } from '#client/constants';\nimport {\n\thydrate_next,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating,\n\thydrate_node\n} from '../hydration.js';\nimport { block } from '../../reactivity/effects.js';\nimport { BranchManager } from './branches.js';\n\n/**\n * @param {TemplateNode} node\n * @param {(branch: (fn: (anchor: Node) => void, key?: number | false) => void) => void} fn\n * @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'\n * @returns {void}\n */\nexport function if_block(node, fn, elseif = false) {\n\t/** @type {TemplateNode | undefined} */\n\tvar marker;\n\tif (hydrating) {\n\t\tmarker = hydrate_node;\n\t\thydrate_next();\n\t}\n\n\tvar branches = new BranchManager(node);\n\tvar flags = elseif ? EFFECT_TRANSPARENT : 0;\n\n\t/**\n\t * @param {number | false} key\n\t * @param {null | ((anchor: Node) => void)} fn\n\t */\n\tfunction update_branch(key, fn) {\n\t\tif (hydrating) {\n\t\t\tvar data = read_hydration_instruction(/** @type {TemplateNode} */ (marker));\n\n\t\t\t// \"[n\" = branch n, \"[-1\" = else\n\t\t\tif (key !== parseInt(data.substring(1))) {\n\t\t\t\t// Hydration mismatch: remove everything inside the anchor and start fresh.\n\t\t\t\t// This could happen with `{#if browser}...{/if}`, for example\n\t\t\t\tvar anchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tbranches.anchor = anchor;\n\n\t\t\t\tset_hydrating(false);\n\t\t\t\tbranches.ensure(key, fn);\n\t\t\t\tset_hydrating(true);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tbranches.ensure(key, fn);\n\t}\n\n\tblock(() => {\n\t\tvar has_branch = false;\n\n\t\tfn((fn, key = 0) => {\n\t\t\thas_branch = true;\n\t\t\tupdate_branch(key, fn);\n\t\t});\n\n\t\tif (!has_branch) {\n\t\t\tupdate_branch(-1, null);\n\t\t}\n\t}, flags);\n}\n","/** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */\n/** @import { Batch } from '../../reactivity/batch.js'; */\nimport {\n\tEACH_INDEX_REACTIVE,\n\tEACH_IS_ANIMATED,\n\tEACH_IS_CONTROLLED,\n\tEACH_ITEM_IMMUTABLE,\n\tEACH_ITEM_REACTIVE,\n\tHYDRATION_END,\n\tHYDRATION_START_ELSE\n} from '../../../../constants.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating\n} from '../hydration.js';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tshould_defer_append\n} from '../operations.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { source, mutable_source, internal_set } from '../../reactivity/sources.js';\nimport { array_from, is_array } from '../../../shared/utils.js';\nimport { BRANCH_EFFECT, COMMENT_NODE, DESTROYED, EFFECT_OFFSCREEN, INERT } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { get } from '../../runtime.js';\nimport { DEV } from 'esm-env';\nimport { derived_safe_equal } from '../../reactivity/deriveds.js';\nimport { current_batch } from '../../reactivity/batch.js';\nimport * as e from '../../errors.js';\nimport { tag } from '../../dev/tracing.js';\n\n// When making substantive changes to this file, validate them with the each block stress test:\n// https://svelte.dev/playground/1972b2cf46564476ad8c8c6405b23b7b\n// This test also exists in this repo, as `packages/svelte/tests/manual/each-stress-test`\n\n/**\n * @param {any} _\n * @param {number} i\n */\nexport function index(_, i) {\n\treturn i;\n}\n\n/**\n * Pause multiple effects simultaneously, and coordinate their\n * subsequent destruction. Used in each blocks\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {null | Node} controlled_anchor\n */\nfunction pause_effects(state, to_destroy, controlled_anchor) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\tvar length = to_destroy.length;\n\n\t/** @type {EachOutroGroup} */\n\tvar group;\n\tvar remaining = to_destroy.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tlet effect = to_destroy[i];\n\n\t\tpause_effect(\n\t\t\teffect,\n\t\t\t() => {\n\t\t\t\tif (group) {\n\t\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\t\tgroup.done.add(effect);\n\n\t\t\t\t\tif (group.pending.size === 0) {\n\t\t\t\t\t\tvar groups = /** @type {Set<EachOutroGroup>} */ (state.outrogroups);\n\n\t\t\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\t\t\tgroups.delete(group);\n\n\t\t\t\t\t\tif (groups.size === 0) {\n\t\t\t\t\t\t\tstate.outrogroups = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tremaining -= 1;\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\t}\n\n\tif (remaining === 0) {\n\t\t// If we're in a controlled each block (i.e. the block is the only child of an\n\t\t// element), and we are removing all items, _and_ there are no out transitions,\n\t\t// we can use the fast path — emptying the element and replacing the anchor\n\t\tvar fast_path = transitions.length === 0 && controlled_anchor !== null;\n\n\t\tif (fast_path) {\n\t\t\tvar anchor = /** @type {Element} */ (controlled_anchor);\n\t\t\tvar parent_node = /** @type {Element} */ (anchor.parentNode);\n\n\t\t\tclear_text_content(parent_node);\n\t\t\tparent_node.append(anchor);\n\n\t\t\tstate.items.clear();\n\t\t}\n\n\t\tdestroy_effects(state, to_destroy, !fast_path);\n\t} else {\n\t\tgroup = {\n\t\t\tpending: new Set(to_destroy),\n\t\t\tdone: new Set()\n\t\t};\n\n\t\t(state.outrogroups ??= new Set()).add(group);\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {boolean} remove_dom\n */\nfunction destroy_effects(state, to_destroy, remove_dom = true) {\n\t/** @type {Set<Effect> | undefined} */\n\tvar preserved_effects;\n\n\t// The loop-in-a-loop isn't ideal, but we should only hit this in relatively rare cases\n\tif (state.pending.size > 0) {\n\t\tpreserved_effects = new Set();\n\n\t\tfor (const keys of state.pending.values()) {\n\t\t\tfor (const key of keys) {\n\t\t\t\tpreserved_effects.add(/** @type {EachItem} */ (state.items.get(key)).e);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var i = 0; i < to_destroy.length; i++) {\n\t\tvar e = to_destroy[i];\n\n\t\tif (preserved_effects?.has(e)) {\n\t\t\te.f |= EFFECT_OFFSCREEN;\n\n\t\t\tconst fragment = document.createDocumentFragment();\n\t\t\tmove_effect(e, fragment);\n\t\t} else {\n\t\t\tdestroy_effect(to_destroy[i], remove_dom);\n\t\t}\n\t}\n}\n\n/** @type {TemplateNode} */\nvar offscreen_anchor;\n\n/**\n * @template V\n * @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @param {(value: V, index: number) => any} get_key\n * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn\n * @param {null | ((anchor: Node) => void)} fallback_fn\n * @returns {void}\n */\nexport function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {\n\tvar anchor = node;\n\n\t/** @type {Map<any, EachItem>} */\n\tvar items = new Map();\n\n\tvar is_controlled = (flags & EACH_IS_CONTROLLED) !== 0;\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tanchor = hydrating\n\t\t\t? set_hydrate_node(get_first_child(parent_node))\n\t\t\t: parent_node.appendChild(create_text());\n\t}\n\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\t/** @type {Effect | null} */\n\tvar fallback = null;\n\n\t// TODO: ideally we could use derived for runes mode but because of the ability\n\t// to use a store which can be mutated, we can't do that here as mutating a store\n\t// will still result in the collection array being the same from the store\n\tvar each_array = derived_safe_equal(() => {\n\t\tvar collection = get_collection();\n\n\t\treturn is_array(collection) ? collection : collection == null ? [] : array_from(collection);\n\t});\n\n\tif (DEV) {\n\t\ttag(each_array, '{#each ...}');\n\t}\n\n\t/** @type {V[]} */\n\tvar array;\n\n\t/** @type {Map<Batch, Set<any>>} */\n\tvar pending = new Map();\n\n\tvar first_run = true;\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction commit(batch) {\n\t\tif ((state.effect.f & DESTROYED) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tstate.pending.delete(batch);\n\n\t\tstate.fallback = fallback;\n\t\treconcile(state, array, anchor, flags, get_key);\n\n\t\tif (fallback !== null) {\n\t\t\tif (array.length === 0) {\n\t\t\t\tif ((fallback.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\t\tresume_effect(fallback);\n\t\t\t\t} else {\n\t\t\t\t\tfallback.f ^= EFFECT_OFFSCREEN;\n\t\t\t\t\tmove(fallback, null, anchor);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpause_effect(fallback, () => {\n\t\t\t\t\t// TODO only null out if no pending batch needs it,\n\t\t\t\t\t// otherwise re-add `fallback.fragment` and move the\n\t\t\t\t\t// effect into it\n\t\t\t\t\tfallback = null;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction discard(batch) {\n\t\tstate.pending.delete(batch);\n\t}\n\n\tvar effect = block(() => {\n\t\tarray = /** @type {V[]} */ (get(each_array));\n\t\tvar length = array.length;\n\n\t\t/** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */\n\t\tlet mismatch = false;\n\n\t\tif (hydrating) {\n\t\t\tvar is_else = read_hydration_instruction(anchor) === HYDRATION_START_ELSE;\n\n\t\t\tif (is_else !== (length === 0)) {\n\t\t\t\t// hydration mismatch — remove the server-rendered DOM and start over\n\t\t\t\tanchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tset_hydrating(false);\n\t\t\t\tmismatch = true;\n\t\t\t}\n\t\t}\n\n\t\tvar keys = new Set();\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tfor (var index = 0; index < length; index += 1) {\n\t\t\tif (\n\t\t\t\thydrating &&\n\t\t\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\t\t\t/** @type {Comment} */ (hydrate_node).data === HYDRATION_END\n\t\t\t) {\n\t\t\t\t// The server rendered fewer items than expected,\n\t\t\t\t// so break out and continue appending non-hydrated items\n\t\t\t\tanchor = /** @type {Comment} */ (hydrate_node);\n\t\t\t\tmismatch = true;\n\t\t\t\tset_hydrating(false);\n\t\t\t}\n\n\t\t\tvar value = array[index];\n\t\t\tvar key = get_key(value, index);\n\n\t\t\tif (DEV) {\n\t\t\t\t// Check that the key function is idempotent (returns the same value when called twice)\n\t\t\t\tvar key_again = get_key(value, index);\n\t\t\t\tif (key !== key_again) {\n\t\t\t\t\te.each_key_volatile(String(index), String(key), String(key_again));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar item = first_run ? null : items.get(key);\n\n\t\t\tif (item) {\n\t\t\t\t// update before reconciliation, to trigger any async updates\n\t\t\t\tif (item.v) internal_set(item.v, value);\n\t\t\t\tif (item.i) internal_set(item.i, index);\n\n\t\t\t\tif (defer) {\n\t\t\t\t\tbatch.unskip_effect(item.e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\titem = create_item(\n\t\t\t\t\titems,\n\t\t\t\t\tfirst_run ? anchor : (offscreen_anchor ??= create_text()),\n\t\t\t\t\tvalue,\n\t\t\t\t\tkey,\n\t\t\t\t\tindex,\n\t\t\t\t\trender_fn,\n\t\t\t\t\tflags,\n\t\t\t\t\tget_collection\n\t\t\t\t);\n\n\t\t\t\tif (!first_run) {\n\t\t\t\t\titem.e.f |= EFFECT_OFFSCREEN;\n\t\t\t\t}\n\n\t\t\t\titems.set(key, item);\n\t\t\t}\n\n\t\t\tkeys.add(key);\n\t\t}\n\n\t\tif (length === 0 && fallback_fn && !fallback) {\n\t\t\tif (first_run) {\n\t\t\t\tfallback = branch(() => fallback_fn(anchor));\n\t\t\t} else {\n\t\t\t\tfallback = branch(() => fallback_fn((offscreen_anchor ??= create_text())));\n\t\t\t\tfallback.f |= EFFECT_OFFSCREEN;\n\t\t\t}\n\t\t}\n\n\t\tif (length > keys.size) {\n\t\t\tif (DEV) {\n\t\t\t\tvalidate_each_keys(array, get_key);\n\t\t\t} else {\n\t\t\t\t// in prod, the additional information isn't printed, so don't bother computing it\n\t\t\t\te.each_key_duplicate('', '', '');\n\t\t\t}\n\t\t}\n\n\t\t// remove excess nodes\n\t\tif (hydrating && length > 0) {\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tif (!first_run) {\n\t\t\tpending.set(batch, keys);\n\n\t\t\tif (defer) {\n\t\t\t\tfor (const [key, item] of items) {\n\t\t\t\t\tif (!keys.has(key)) {\n\t\t\t\t\t\tbatch.skip_effect(item.e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.oncommit(commit);\n\t\t\t\tbatch.ondiscard(discard);\n\t\t\t} else {\n\t\t\t\tcommit(batch);\n\t\t\t}\n\t\t}\n\n\t\tif (mismatch) {\n\t\t\t// continue in hydration mode\n\t\t\tset_hydrating(true);\n\t\t}\n\n\t\t// When we mount the each block for the first time, the collection won't be\n\t\t// connected to this effect as the effect hasn't finished running yet and its deps\n\t\t// won't be assigned. However, it's possible that when reconciling the each block\n\t\t// that a mutation occurred and it's made the collection MAYBE_DIRTY, so reading the\n\t\t// collection again can provide consistency to the reactive graph again as the deriveds\n\t\t// will now be `CLEAN`.\n\t\tget(each_array);\n\t});\n\n\t/** @type {EachState} */\n\tvar state = { effect, flags, items, pending, outrogroups: null, fallback };\n\n\tfirst_run = false;\n\n\tif (hydrating) {\n\t\tanchor = hydrate_node;\n\t}\n}\n\n/**\n * Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect\n * @param {Effect | null} effect\n * @returns {Effect | null}\n */\nfunction skip_to_branch(effect) {\n\twhile (effect !== null && (effect.f & BRANCH_EFFECT) === 0) {\n\t\teffect = effect.next;\n\t}\n\treturn effect;\n}\n\n/**\n * Add, remove, or reorder items output by an each block as its input changes\n * @template V\n * @param {EachState} state\n * @param {Array<V>} array\n * @param {Element | Comment | Text} anchor\n * @param {number} flags\n * @param {(value: V, index: number) => any} get_key\n * @returns {void}\n */\nfunction reconcile(state, array, anchor, flags, get_key) {\n\tvar is_animated = (flags & EACH_IS_ANIMATED) !== 0;\n\n\tvar length = array.length;\n\tvar items = state.items;\n\tvar current = skip_to_branch(state.effect.first);\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar seen;\n\n\t/** @type {Effect | null} */\n\tvar prev = null;\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar to_animate;\n\n\t/** @type {Effect[]} */\n\tvar matched = [];\n\n\t/** @type {Effect[]} */\n\tvar stashed = [];\n\n\t/** @type {V} */\n\tvar value;\n\n\t/** @type {any} */\n\tvar key;\n\n\t/** @type {Effect | undefined} */\n\tvar effect;\n\n\t/** @type {number} */\n\tvar i;\n\n\tif (is_animated) {\n\t\tfor (i = 0; i < length; i += 1) {\n\t\t\tvalue = array[i];\n\t\t\tkey = get_key(value, i);\n\t\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\t\t// offscreen == coming in now, no animation in that case,\n\t\t\t// else this would happen https://github.com/sveltejs/svelte/issues/17181\n\t\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\teffect.nodes?.a?.measure();\n\t\t\t\t(to_animate ??= new Set()).add(effect);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < length; i += 1) {\n\t\tvalue = array[i];\n\t\tkey = get_key(value, i);\n\n\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\tif (state.outrogroups !== null) {\n\t\t\tfor (const group of state.outrogroups) {\n\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\tgroup.done.delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & INERT) !== 0) {\n\t\t\tresume_effect(effect);\n\t\t\tif (is_animated) {\n\t\t\t\teffect.nodes?.a?.unfix();\n\t\t\t\t(to_animate ??= new Set()).delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) !== 0) {\n\t\t\teffect.f ^= EFFECT_OFFSCREEN;\n\n\t\t\tif (effect === current) {\n\t\t\t\tmove(effect, null, anchor);\n\t\t\t} else {\n\t\t\t\tvar next = prev ? prev.next : current;\n\n\t\t\t\tif (effect === state.effect.last) {\n\t\t\t\t\tstate.effect.last = effect.prev;\n\t\t\t\t}\n\n\t\t\t\tif (effect.prev) effect.prev.next = effect.next;\n\t\t\t\tif (effect.next) effect.next.prev = effect.prev;\n\t\t\t\tlink(state, prev, effect);\n\t\t\t\tlink(state, effect, next);\n\n\t\t\t\tmove(effect, next, anchor);\n\t\t\t\tprev = effect;\n\n\t\t\t\tmatched = [];\n\t\t\t\tstashed = [];\n\n\t\t\t\tcurrent = skip_to_branch(prev.next);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (effect !== current) {\n\t\t\tif (seen !== undefined && seen.has(effect)) {\n\t\t\t\tif (matched.length < stashed.length) {\n\t\t\t\t\t// more efficient to move later items to the front\n\t\t\t\t\tvar start = stashed[0];\n\t\t\t\t\tvar j;\n\n\t\t\t\t\tprev = start.prev;\n\n\t\t\t\t\tvar a = matched[0];\n\t\t\t\t\tvar b = matched[matched.length - 1];\n\n\t\t\t\t\tfor (j = 0; j < matched.length; j += 1) {\n\t\t\t\t\t\tmove(matched[j], start, anchor);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (j = 0; j < stashed.length; j += 1) {\n\t\t\t\t\t\tseen.delete(stashed[j]);\n\t\t\t\t\t}\n\n\t\t\t\t\tlink(state, a.prev, b.next);\n\t\t\t\t\tlink(state, prev, a);\n\t\t\t\t\tlink(state, b, start);\n\n\t\t\t\t\tcurrent = start;\n\t\t\t\t\tprev = b;\n\t\t\t\t\ti -= 1;\n\n\t\t\t\t\tmatched = [];\n\t\t\t\t\tstashed = [];\n\t\t\t\t} else {\n\t\t\t\t\t// more efficient to move earlier items to the back\n\t\t\t\t\tseen.delete(effect);\n\t\t\t\t\tmove(effect, current, anchor);\n\n\t\t\t\t\tlink(state, effect.prev, effect.next);\n\t\t\t\t\tlink(state, effect, prev === null ? state.effect.first : prev.next);\n\t\t\t\t\tlink(state, prev, effect);\n\n\t\t\t\t\tprev = effect;\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tmatched = [];\n\t\t\tstashed = [];\n\n\t\t\twhile (current !== null && current !== effect) {\n\t\t\t\t(seen ??= new Set()).add(current);\n\t\t\t\tstashed.push(current);\n\t\t\t\tcurrent = skip_to_branch(current.next);\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\tmatched.push(effect);\n\t\t}\n\n\t\tprev = effect;\n\t\tcurrent = skip_to_branch(effect.next);\n\t}\n\n\tif (state.outrogroups !== null) {\n\t\tfor (const group of state.outrogroups) {\n\t\t\tif (group.pending.size === 0) {\n\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\tstate.outrogroups?.delete(group);\n\t\t\t}\n\t\t}\n\n\t\tif (state.outrogroups.size === 0) {\n\t\t\tstate.outrogroups = null;\n\t\t}\n\t}\n\n\tif (current !== null || seen !== undefined) {\n\t\t/** @type {Effect[]} */\n\t\tvar to_destroy = [];\n\n\t\tif (seen !== undefined) {\n\t\t\tfor (effect of seen) {\n\t\t\t\tif ((effect.f & INERT) === 0) {\n\t\t\t\t\tto_destroy.push(effect);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile (current !== null) {\n\t\t\t// If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished\n\t\t\tif ((current.f & INERT) === 0 && current !== state.fallback) {\n\t\t\t\tto_destroy.push(current);\n\t\t\t}\n\n\t\t\tcurrent = skip_to_branch(current.next);\n\t\t}\n\n\t\tvar destroy_length = to_destroy.length;\n\n\t\tif (destroy_length > 0) {\n\t\t\tvar controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;\n\n\t\t\tif (is_animated) {\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.measure();\n\t\t\t\t}\n\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.fix();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpause_effects(state, to_destroy, controlled_anchor);\n\t\t}\n\t}\n\n\tif (is_animated) {\n\t\tqueue_micro_task(() => {\n\t\t\tif (to_animate === undefined) return;\n\t\t\tfor (effect of to_animate) {\n\t\t\t\teffect.nodes?.a?.apply();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @template V\n * @param {Map<any, EachItem>} items\n * @param {Node} anchor\n * @param {V} value\n * @param {unknown} key\n * @param {number} index\n * @param {(anchor: Node, item: V | Source<V>, index: number | Value<number>, collection: () => V[]) => void} render_fn\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @returns {EachItem}\n */\nfunction create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {\n\tvar v =\n\t\t(flags & EACH_ITEM_REACTIVE) !== 0\n\t\t\t? (flags & EACH_ITEM_IMMUTABLE) === 0\n\t\t\t\t? mutable_source(value, false, false)\n\t\t\t\t: source(value)\n\t\t\t: null;\n\n\tvar i = (flags & EACH_INDEX_REACTIVE) !== 0 ? source(index) : null;\n\n\tif (DEV && v) {\n\t\t// For tracing purposes, we need to link the source signal we create with the\n\t\t// collection + index so that tracing works as intended\n\t\tv.trace = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\t\t\tget_collection()[i?.v ?? index];\n\t\t};\n\t}\n\n\treturn {\n\t\tv,\n\t\ti,\n\t\te: branch(() => {\n\t\t\trender_fn(anchor, v ?? value, i ?? index, get_collection);\n\n\t\t\treturn () => {\n\t\t\t\titems.delete(key);\n\t\t\t};\n\t\t})\n\t};\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect | null} next\n * @param {Text | Element | Comment} anchor\n */\nfunction move(effect, next, anchor) {\n\tif (!effect.nodes) return;\n\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\tvar dest =\n\t\tnext && (next.f & EFFECT_OFFSCREEN) === 0\n\t\t\t? /** @type {EffectNodes} */ (next.nodes).start\n\t\t\t: anchor;\n\n\twhile (node !== null) {\n\t\tvar next_node = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\tdest.before(node);\n\n\t\tif (node === end) {\n\t\t\treturn;\n\t\t}\n\n\t\tnode = next_node;\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect | null} prev\n * @param {Effect | null} next\n */\nfunction link(state, prev, next) {\n\tif (prev === null) {\n\t\tstate.effect.first = next;\n\t} else {\n\t\tprev.next = next;\n\t}\n\n\tif (next === null) {\n\t\tstate.effect.last = prev;\n\t} else {\n\t\tnext.prev = prev;\n\t}\n}\n\n/**\n * @param {Array<any>} array\n * @param {(item: any, index: number) => string} key_fn\n * @returns {void}\n */\nfunction validate_each_keys(array, key_fn) {\n\tconst keys = new Map();\n\tconst length = array.length;\n\n\tfor (let i = 0; i < length; i++) {\n\t\tconst key = key_fn(array[i], i);\n\n\t\tif (keys.has(key)) {\n\t\t\tconst a = String(keys.get(key));\n\t\t\tconst b = String(i);\n\n\t\t\t/** @type {string | null} */\n\t\t\tlet k = String(key);\n\t\t\tif (k.startsWith('[object ')) k = null;\n\n\t\t\te.each_key_duplicate(a, b, k);\n\t\t}\n\n\t\tkeys.set(key, i);\n\t}\n}\n","/** @import { Effect, TemplateNode } from '#client' */\n/** @import {} from 'trusted-types' */\nimport {\n\tFILENAME,\n\tHYDRATION_ERROR,\n\tNAMESPACE_SVG,\n\tNAMESPACE_MATHML\n} from '../../../../constants.js';\nimport { remove_effect_dom, template_effect } from '../../reactivity/effects.js';\nimport { hydrate_next, hydrate_node, hydrating, set_hydrate_node } from '../hydration.js';\n\nimport { assign_nodes } from '../template.js';\nimport * as w from '../../warnings.js';\nimport { hash, sanitize_location } from '../../../../utils.js';\nimport { DEV } from 'esm-env';\nimport { dev_current_component_function } from '../../context.js';\nimport { create_element, get_first_child, get_next_sibling } from '../operations.js';\nimport { active_effect } from '../../runtime.js';\nimport { COMMENT_NODE } from '#client/constants';\n\n/**\n * @param {Element} element\n * @param {string | null} server_hash\n * @param {string | TrustedHTML} value\n */\nfunction check_hash(element, server_hash, value) {\n\tif (!server_hash || server_hash === hash(String(value ?? ''))) return;\n\n\tlet location;\n\n\t// @ts-expect-error\n\tconst loc = element.__svelte_meta?.loc;\n\tif (loc) {\n\t\tlocation = `near ${loc.file}:${loc.line}:${loc.column}`;\n\t} else if (dev_current_component_function?.[FILENAME]) {\n\t\tlocation = `in ${dev_current_component_function[FILENAME]}`;\n\t}\n\n\tw.hydration_html_changed(sanitize_location(location));\n}\n\n/**\n * @param {Element | Text | Comment} node\n * @param {() => string | TrustedHTML} get_value\n * @param {boolean} [is_controlled]\n * @param {boolean} [svg]\n * @param {boolean} [mathml]\n * @param {boolean} [skip_warning]\n * @returns {void}\n */\nexport function html(\n\tnode,\n\tget_value,\n\tis_controlled = false,\n\tsvg = false,\n\tmathml = false,\n\tskip_warning = false\n) {\n\tvar anchor = node;\n\n\t/** @type {string | TrustedHTML} */\n\tvar value = '';\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tif (hydrating) {\n\t\t\tanchor = set_hydrate_node(get_first_child(parent_node));\n\t\t}\n\t}\n\n\ttemplate_effect(() => {\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\tif (value === (value = get_value() ?? '')) {\n\t\t\tif (hydrating) hydrate_next();\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_controlled && !hydrating) {\n\t\t\t// When @html is the only child, use innerHTML directly.\n\t\t\t// This also handles contenteditable, where the user may delete the anchor comment.\n\t\t\teffect.nodes = null;\n\t\t\tparent_node.innerHTML = /** @type {string} */ (value);\n\n\t\t\tif (value !== '') {\n\t\t\t\tassign_nodes(\n\t\t\t\t\t/** @type {TemplateNode} */ (get_first_child(parent_node)),\n\t\t\t\t\t/** @type {TemplateNode} */ (parent_node.lastChild)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (effect.nodes !== null) {\n\t\t\tremove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));\n\t\t\teffect.nodes = null;\n\t\t}\n\n\t\tif (value === '') return;\n\n\t\tif (hydrating) {\n\t\t\t// We're deliberately not trying to repair mismatches between server and client,\n\t\t\t// as it's costly and error-prone (and it's an edge case to have a mismatch anyway)\n\t\t\tvar hash = /** @type {Comment} */ (hydrate_node).data;\n\n\t\t\t/** @type {TemplateNode | null} */\n\t\t\tvar next = hydrate_next();\n\t\t\tvar last = next;\n\n\t\t\twhile (\n\t\t\t\tnext !== null &&\n\t\t\t\t(next.nodeType !== COMMENT_NODE || /** @type {Comment} */ (next).data !== '')\n\t\t\t) {\n\t\t\t\tlast = next;\n\t\t\t\tnext = get_next_sibling(next);\n\t\t\t}\n\n\t\t\tif (next === null) {\n\t\t\t\tw.hydration_mismatch();\n\t\t\t\tthrow HYDRATION_ERROR;\n\t\t\t}\n\n\t\t\tif (DEV && !skip_warning) {\n\t\t\t\tcheck_hash(/** @type {Element} */ (next.parentNode), hash, value);\n\t\t\t}\n\n\t\t\tassign_nodes(hydrate_node, last);\n\t\t\tanchor = set_hydrate_node(next);\n\t\t\treturn;\n\t\t}\n\n\t\t// Don't use create_fragment_with_script_from_html here because that would mean script tags are executed.\n\t\t// @html is basically `.innerHTML = ...` and that doesn't execute scripts either due to security reasons.\n\t\t// Use a <template>, <svg>, or <math> wrapper depending on context. If value is a TrustedHTML object,\n\t\t// it will be assigned directly to innerHTML without coercion — this allows {@html policy.createHTML(...)} to work.\n\t\tvar ns = svg ? NAMESPACE_SVG : mathml ? NAMESPACE_MATHML : undefined;\n\t\tvar wrapper = /** @type {HTMLTemplateElement | SVGElement | MathMLElement} */ (\n\t\t\tcreate_element(svg ? 'svg' : mathml ? 'math' : 'template', ns)\n\t\t);\n\t\twrapper.innerHTML = /** @type {any} */ (value);\n\n\t\t/** @type {DocumentFragment | Element} */\n\t\tvar node = svg || mathml ? wrapper : /** @type {HTMLTemplateElement} */ (wrapper).content;\n\n\t\tassign_nodes(\n\t\t\t/** @type {TemplateNode} */ (get_first_child(node)),\n\t\t\t/** @type {TemplateNode} */ (node.lastChild)\n\t\t);\n\n\t\tif (svg || mathml) {\n\t\t\twhile (get_first_child(node)) {\n\t\t\t\tanchor.before(/** @type {TemplateNode} */ (get_first_child(node)));\n\t\t\t}\n\t\t} else {\n\t\t\tanchor.before(node);\n\t\t}\n\t});\n}\n","import { hydrate_next, hydrating } from '../hydration.js';\n\n/**\n * @param {Comment} anchor\n * @param {Record<string, any>} $$props\n * @param {string} name\n * @param {Record<string, unknown>} slot_props\n * @param {null | ((anchor: Comment) => void)} fallback_fn\n */\nexport function slot(anchor, $$props, name, slot_props, fallback_fn) {\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\tvar slot_fn = $$props.$$slots?.[name];\n\t// Interop: Can use snippets to fill slots\n\tvar is_interop = false;\n\tif (slot_fn === true) {\n\t\tslot_fn = $$props[name === 'default' ? 'children' : name];\n\t\tis_interop = true;\n\t}\n\n\tif (slot_fn === undefined) {\n\t\tif (fallback_fn !== null) {\n\t\t\tfallback_fn(anchor);\n\t\t}\n\t} else {\n\t\tslot_fn(anchor, is_interop ? () => slot_props : slot_props);\n\t}\n}\n\n/**\n * @param {Record<string, any>} props\n * @returns {Record<string, boolean>}\n */\nexport function sanitize_slots(props) {\n\t/** @type {Record<string, boolean>} */\n\tconst sanitized = {};\n\tif (props.children) sanitized.default = true;\n\tfor (const key in props.$$slots) {\n\t\tsanitized[key] = true;\n\t}\n\treturn sanitized;\n}\n","/** @import { TemplateNode, Dom } from '#client' */\nimport { EFFECT_TRANSPARENT } from '#client/constants';\nimport { block } from '../../reactivity/effects.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tread_hydration_instruction,\n\tset_hydrate_node,\n\tset_hydrating,\n\tskip_nodes\n} from '../hydration.js';\nimport { BranchManager } from './branches.js';\nimport { HYDRATION_START, HYDRATION_START_ELSE } from '../../../../constants.js';\n\n/**\n * @template P\n * @template {(props: P) => void} C\n * @param {TemplateNode} node\n * @param {() => C} get_component\n * @param {(anchor: TemplateNode, component: C) => Dom | void} render_fn\n * @returns {void}\n */\nexport function component(node, get_component, render_fn) {\n\t/** @type {TemplateNode | undefined} */\n\tvar hydration_start_node;\n\n\tif (hydrating) {\n\t\thydration_start_node = hydrate_node;\n\t\thydrate_next();\n\t}\n\n\tvar branches = new BranchManager(node);\n\n\tblock(() => {\n\t\tvar component = get_component() ?? null;\n\n\t\tif (hydrating) {\n\t\t\tvar data = read_hydration_instruction(/** @type {TemplateNode} */ (hydration_start_node));\n\n\t\t\tvar server_had_component = data === HYDRATION_START;\n\t\t\tvar client_has_component = component !== null;\n\n\t\t\tif (server_had_component !== client_has_component) {\n\t\t\t\t// Hydration mismatch: skip the server-rendered nodes and render fresh\n\t\t\t\tvar anchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tbranches.anchor = anchor;\n\n\t\t\t\tset_hydrating(false);\n\t\t\t\tbranches.ensure(component, component && ((target) => render_fn(target, component)));\n\t\t\t\tset_hydrating(true);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tbranches.ensure(component, component && ((target) => render_fn(target, component)));\n\t}, EFFECT_TRANSPARENT);\n}\n","/** @import { ActionPayload } from '#client' */\nimport { effect, render_effect } from '../../reactivity/effects.js';\nimport { safe_not_equal } from '../../reactivity/equality.js';\nimport { deep_read_state, untrack } from '../../runtime.js';\n\n/**\n * @template P\n * @param {Element} dom\n * @param {(dom: Element, value?: P) => ActionPayload<P>} action\n * @param {() => P} [get_value]\n * @returns {void}\n */\nexport function action(dom, action, get_value) {\n\teffect(() => {\n\t\tvar payload = untrack(() => action(dom, get_value?.()) || {});\n\n\t\tif (get_value && payload?.update) {\n\t\t\tvar inited = false;\n\t\t\t/** @type {P} */\n\t\t\tvar prev = /** @type {any} */ ({}); // initialize with something so it's never equal on first run\n\n\t\t\trender_effect(() => {\n\t\t\t\tvar value = get_value();\n\n\t\t\t\t// Action's update method is coarse-grained, i.e. when anything in the passed value changes, update.\n\t\t\t\t// This works in legacy mode because of mutable_source being updated as a whole, but when using $state\n\t\t\t\t// together with actions and mutation, it wouldn't notice the change without a deep read.\n\t\t\t\tdeep_read_state(value);\n\n\t\t\t\tif (inited && safe_not_equal(prev, value)) {\n\t\t\t\t\tprev = value;\n\t\t\t\t\t/** @type {Function} */ (payload.update)(value);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tinited = true;\n\t\t}\n\n\t\tif (payload?.destroy) {\n\t\t\treturn () => /** @type {Function} */ (payload.destroy)();\n\t\t}\n\t});\n}\n","import { escape_html } from '../../escaping.js';\nimport { clsx as _clsx } from 'clsx';\nimport { has_own_property } from './utils.js';\n\n/**\n * `<div translate={false}>` should be rendered as `<div translate=\"no\">` and _not_\n * `<div translate=\"false\">`, which is equivalent to `<div translate=\"yes\">`. There\n * may be other odd cases that need to be added to this list in future\n * @type {Record<string, Map<any, string>>}\n */\nconst replacements = {\n\ttranslate: new Map([\n\t\t[true, 'yes'],\n\t\t[false, 'no']\n\t])\n};\n\n/**\n * @template V\n * @param {string} name\n * @param {V} value\n * @param {boolean} [is_boolean]\n * @returns {string}\n */\nexport function attr(name, value, is_boolean = false) {\n\t// attribute hidden for values other than \"until-found\" behaves like a boolean attribute\n\tif (name === 'hidden' && value !== 'until-found') {\n\t\tis_boolean = true;\n\t}\n\tif (value == null || (!value && is_boolean)) return '';\n\tconst normalized =\n\t\t(has_own_property.call(replacements, name) && replacements[name].get(value)) || value;\n\tconst assignment = is_boolean ? `=\"\"` : `=\"${escape_html(normalized, true)}\"`;\n\treturn ` ${name}${assignment}`;\n}\n\n/**\n * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.\n * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)\n * @param  {any} value\n */\nexport function clsx(value) {\n\tif (typeof value === 'object') {\n\t\treturn _clsx(value);\n\t} else {\n\t\treturn value ?? '';\n\t}\n}\n\nconst whitespace = [...' \\t\\n\\r\\f\\u00a0\\u000b\\ufeff'];\n\n/**\n * @param {any} value\n * @param {string | null} [hash]\n * @param {Record<string, boolean>} [directives]\n * @returns {string | null}\n */\nexport function to_class(value, hash, directives) {\n\tvar classname = value == null ? '' : '' + value;\n\n\tif (hash) {\n\t\tclassname = classname ? classname + ' ' + hash : hash;\n\t}\n\n\tif (directives) {\n\t\tfor (var key of Object.keys(directives)) {\n\t\t\tif (directives[key]) {\n\t\t\t\tclassname = classname ? classname + ' ' + key : key;\n\t\t\t} else if (classname.length) {\n\t\t\t\tvar len = key.length;\n\t\t\t\tvar a = 0;\n\n\t\t\t\twhile ((a = classname.indexOf(key, a)) >= 0) {\n\t\t\t\t\tvar b = a + len;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t(a === 0 || whitespace.includes(classname[a - 1])) &&\n\t\t\t\t\t\t(b === classname.length || whitespace.includes(classname[b]))\n\t\t\t\t\t) {\n\t\t\t\t\t\tclassname = (a === 0 ? '' : classname.substring(0, a)) + classname.substring(b + 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ta = b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn classname === '' ? null : classname;\n}\n\n/**\n *\n * @param {Record<string,any>} styles\n * @param {boolean} important\n */\nfunction append_styles(styles, important = false) {\n\tvar separator = important ? ' !important;' : ';';\n\tvar css = '';\n\n\tfor (var key of Object.keys(styles)) {\n\t\tvar value = styles[key];\n\t\tif (value != null && value !== '') {\n\t\t\tcss += ' ' + key + ': ' + value + separator;\n\t\t}\n\t}\n\n\treturn css;\n}\n\n/**\n * @param {string} name\n * @returns {string}\n */\nfunction to_css_name(name) {\n\tif (name[0] !== '-' || name[1] !== '-') {\n\t\treturn name.toLowerCase();\n\t}\n\treturn name;\n}\n\n/**\n * @param {any} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]\n * @returns {string | null}\n */\nexport function to_style(value, styles) {\n\tif (styles) {\n\t\tvar new_style = '';\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar normal_styles;\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar important_styles;\n\n\t\tif (Array.isArray(styles)) {\n\t\t\tnormal_styles = styles[0];\n\t\t\timportant_styles = styles[1];\n\t\t} else {\n\t\t\tnormal_styles = styles;\n\t\t}\n\n\t\tif (value) {\n\t\t\tvalue = String(value)\n\t\t\t\t.replaceAll(/\\s*\\/\\*.*?\\*\\/\\s*/g, '')\n\t\t\t\t.trim();\n\n\t\t\t/** @type {boolean | '\"' | \"'\"} */\n\t\t\tvar in_str = false;\n\t\t\tvar in_apo = 0;\n\t\t\tvar in_comment = false;\n\n\t\t\tvar reserved_names = [];\n\n\t\t\tif (normal_styles) {\n\t\t\t\treserved_names.push(...Object.keys(normal_styles).map(to_css_name));\n\t\t\t}\n\t\t\tif (important_styles) {\n\t\t\t\treserved_names.push(...Object.keys(important_styles).map(to_css_name));\n\t\t\t}\n\n\t\t\tvar start_index = 0;\n\t\t\tvar name_index = -1;\n\n\t\t\tconst len = value.length;\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tvar c = value[i];\n\n\t\t\t\tif (in_comment) {\n\t\t\t\t\tif (c === '/' && value[i - 1] === '*') {\n\t\t\t\t\t\tin_comment = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (in_str) {\n\t\t\t\t\tif (in_str === c) {\n\t\t\t\t\t\tin_str = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (c === '/' && value[i + 1] === '*') {\n\t\t\t\t\tin_comment = true;\n\t\t\t\t} else if (c === '\"' || c === \"'\") {\n\t\t\t\t\tin_str = c;\n\t\t\t\t} else if (c === '(') {\n\t\t\t\t\tin_apo++;\n\t\t\t\t} else if (c === ')') {\n\t\t\t\t\tin_apo--;\n\t\t\t\t}\n\n\t\t\t\tif (!in_comment && in_str === false && in_apo === 0) {\n\t\t\t\t\tif (c === ':' && name_index === -1) {\n\t\t\t\t\t\tname_index = i;\n\t\t\t\t\t} else if (c === ';' || i === len - 1) {\n\t\t\t\t\t\tif (name_index !== -1) {\n\t\t\t\t\t\t\tvar name = to_css_name(value.substring(start_index, name_index).trim());\n\n\t\t\t\t\t\t\tif (!reserved_names.includes(name)) {\n\t\t\t\t\t\t\t\tif (c !== ';') {\n\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvar property = value.substring(start_index, i).trim();\n\t\t\t\t\t\t\t\tnew_style += ' ' + property + ';';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart_index = i + 1;\n\t\t\t\t\t\tname_index = -1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (normal_styles) {\n\t\t\tnew_style += append_styles(normal_styles);\n\t\t}\n\n\t\tif (important_styles) {\n\t\t\tnew_style += append_styles(important_styles, true);\n\t\t}\n\n\t\tnew_style = new_style.trim();\n\t\treturn new_style === '' ? null : new_style;\n\t}\n\n\treturn value == null ? null : String(value);\n}\n","import { to_class } from '../../../shared/attributes.js';\nimport { hydrating } from '../hydration.js';\n\n/**\n * @param {Element} dom\n * @param {boolean | number} is_html\n * @param {string | null} value\n * @param {string} [hash]\n * @param {Record<string, any>} [prev_classes]\n * @param {Record<string, any>} [next_classes]\n * @returns {Record<string, boolean> | undefined}\n */\nexport function set_class(dom, is_html, value, hash, prev_classes, next_classes) {\n\t// @ts-expect-error need to add __className to patched prototype\n\tvar prev = dom.__className;\n\n\tif (\n\t\thydrating ||\n\t\tprev !== value ||\n\t\tprev === undefined // for edge case of `class={undefined}`\n\t) {\n\t\tvar next_class_name = to_class(value, hash, next_classes);\n\n\t\tif (!hydrating || next_class_name !== dom.getAttribute('class')) {\n\t\t\t// Removing the attribute when the value is only an empty string causes\n\t\t\t// performance issues vs simply making the className an empty string. So\n\t\t\t// we should only remove the class if the value is nullish\n\t\t\t// and there no hash/directives :\n\t\t\tif (next_class_name == null) {\n\t\t\t\tdom.removeAttribute('class');\n\t\t\t} else if (is_html) {\n\t\t\t\tdom.className = next_class_name;\n\t\t\t} else {\n\t\t\t\tdom.setAttribute('class', next_class_name);\n\t\t\t}\n\t\t}\n\n\t\t// @ts-expect-error need to add __className to patched prototype\n\t\tdom.__className = value;\n\t} else if (next_classes && prev_classes !== next_classes) {\n\t\tfor (var key in next_classes) {\n\t\t\tvar is_present = !!next_classes[key];\n\n\t\t\tif (prev_classes == null || is_present !== !!prev_classes[key]) {\n\t\t\t\tdom.classList.toggle(key, is_present);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn next_classes;\n}\n","import { to_style } from '../../../shared/attributes.js';\nimport { hydrating } from '../hydration.js';\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {Record<string, any>} prev\n * @param {Record<string, any>} next\n * @param {string} [priority]\n */\nfunction update_styles(dom, prev = {}, next, priority) {\n\tfor (var key in next) {\n\t\tvar value = next[key];\n\n\t\tif (prev[key] !== value) {\n\t\t\tif (next[key] == null) {\n\t\t\t\tdom.style.removeProperty(key);\n\t\t\t} else {\n\t\t\t\tdom.style.setProperty(key, value, priority);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {string | null} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [prev_styles]\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [next_styles]\n */\nexport function set_style(dom, value, prev_styles, next_styles) {\n\t// @ts-expect-error\n\tvar prev = dom.__style;\n\n\tif (hydrating || prev !== value) {\n\t\tvar next_style_attr = to_style(value, next_styles);\n\n\t\tif (!hydrating || next_style_attr !== dom.getAttribute('style')) {\n\t\t\tif (next_style_attr == null) {\n\t\t\t\tdom.removeAttribute('style');\n\t\t\t} else {\n\t\t\t\tdom.style.cssText = next_style_attr;\n\t\t\t}\n\t\t}\n\n\t\t// @ts-expect-error\n\t\tdom.__style = value;\n\t} else if (next_styles) {\n\t\tif (Array.isArray(next_styles)) {\n\t\t\tupdate_styles(dom, prev_styles?.[0], next_styles[0]);\n\t\t\tupdate_styles(dom, prev_styles?.[1], next_styles[1], 'important');\n\t\t} else {\n\t\t\tupdate_styles(dom, prev_styles, next_styles);\n\t\t}\n\t}\n\n\treturn next_styles;\n}\n","import { effect, teardown } from '../../../reactivity/effects.js';\nimport { listen_to_event_and_reset_event } from './shared.js';\nimport { is } from '../../../proxy.js';\nimport { is_array } from '../../../../shared/utils.js';\nimport * as w from '../../../warnings.js';\nimport { Batch, current_batch, previous_batch } from '../../../reactivity/batch.js';\nimport { async_mode_flag } from '../../../../flags/index.js';\n\n/**\n * Selects the correct option(s) (depending on whether this is a multiple select)\n * @template V\n * @param {HTMLSelectElement} select\n * @param {V} value\n * @param {boolean} mounting\n */\nexport function select_option(select, value, mounting = false) {\n\tif (select.multiple) {\n\t\t// If value is null or undefined, keep the selection as is\n\t\tif (value == undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If not an array, warn and keep the selection as is\n\t\tif (!is_array(value)) {\n\t\t\treturn w.select_multiple_invalid_value();\n\t\t}\n\n\t\t// Otherwise, update the selection\n\t\tfor (var option of select.options) {\n\t\t\toption.selected = value.includes(get_option_value(option));\n\t\t}\n\n\t\treturn;\n\t}\n\n\tfor (option of select.options) {\n\t\tvar option_value = get_option_value(option);\n\t\tif (is(option_value, value)) {\n\t\t\toption.selected = true;\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (!mounting || value !== undefined) {\n\t\tselect.selectedIndex = -1; // no option should be selected\n\t}\n}\n\n/**\n * Selects the correct option(s) if `value` is given,\n * and then sets up a mutation observer to sync the\n * current selection to the dom when it changes. Such\n * changes could for example occur when options are\n * inside an `#each` block.\n * @param {HTMLSelectElement} select\n */\nexport function init_select(select) {\n\tvar observer = new MutationObserver(() => {\n\t\t// @ts-ignore\n\t\tselect_option(select, select.__value);\n\t\t// Deliberately don't update the potential binding value,\n\t\t// the model should be preserved unless explicitly changed\n\t});\n\n\tobserver.observe(select, {\n\t\t// Listen to option element changes\n\t\tchildList: true,\n\t\tsubtree: true, // because of <optgroup>\n\t\t// Listen to option element value attribute changes\n\t\t// (doesn't get notified of select value changes,\n\t\t// because that property is not reflected as an attribute)\n\t\tattributes: true,\n\t\tattributeFilter: ['value']\n\t});\n\n\tteardown(() => {\n\t\tobserver.disconnect();\n\t});\n}\n\n/**\n * @param {HTMLSelectElement} select\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_select_value(select, get, set = get) {\n\tvar batches = new WeakSet();\n\tvar mounting = true;\n\n\tlisten_to_event_and_reset_event(select, 'change', (is_reset) => {\n\t\tvar query = is_reset ? '[selected]' : ':checked';\n\t\t/** @type {unknown} */\n\t\tvar value;\n\n\t\tif (select.multiple) {\n\t\t\tvalue = [].map.call(select.querySelectorAll(query), get_option_value);\n\t\t} else {\n\t\t\t/** @type {HTMLOptionElement | null} */\n\t\t\tvar selected_option =\n\t\t\t\tselect.querySelector(query) ??\n\t\t\t\t// will fall back to first non-disabled option if no option is selected\n\t\t\t\tselect.querySelector('option:not([disabled])');\n\t\t\tvalue = selected_option && get_option_value(selected_option);\n\t\t}\n\n\t\tset(value);\n\n\t\t// @ts-ignore\n\t\tselect.__value = value;\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\t});\n\n\t// Needs to be an effect, not a render_effect, so that in case of each loops the logic runs after the each block has updated\n\teffect(() => {\n\t\tvar value = get();\n\n\t\tif (select === document.activeElement) {\n\t\t\t// In sync mode render effects are executed during tree traversal -> needs current_batch\n\t\t\t// In async mode render effects are flushed once batch resolved, at which point current_batch is null -> needs previous_batch\n\t\t\tvar batch = /** @type {Batch} */ (async_mode_flag ? previous_batch : current_batch);\n\n\t\t\t// Don't update the <select> if it is focused. We can get here if, for example,\n\t\t\t// an update is deferred because of async work depending on the select:\n\t\t\t//\n\t\t\t// <select bind:value={selected}>...</select>\n\t\t\t// <p>{await find(selected)}</p>\n\t\t\tif (batches.has(batch)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tselect_option(select, value, mounting);\n\n\t\t// Mounting and value undefined -> take selection from dom\n\t\tif (mounting && value === undefined) {\n\t\t\t/** @type {HTMLOptionElement | null} */\n\t\t\tvar selected_option = select.querySelector(':checked');\n\t\t\tif (selected_option !== null) {\n\t\t\t\tvalue = get_option_value(selected_option);\n\t\t\t\tset(value);\n\t\t\t}\n\t\t}\n\n\t\t// @ts-ignore\n\t\tselect.__value = value;\n\t\tmounting = false;\n\t});\n\n\tinit_select(select);\n}\n\n/** @param {HTMLOptionElement} option */\nfunction get_option_value(option) {\n\t// __value only exists if the <option> has a value attribute\n\tif ('__value' in option) {\n\t\treturn option.__value;\n\t} else {\n\t\treturn option.value;\n\t}\n}\n","/** @import { Blocker, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport { hydrating, set_hydrating } from '../hydration.js';\nimport { get_descriptors, get_prototype_of } from '../../../shared/utils.js';\nimport { create_event, delegate, delegated, event, event_symbol } from './events.js';\nimport { add_form_reset_listener, autofocus } from './misc.js';\nimport * as w from '../../warnings.js';\nimport { IS_XHTML, LOADING_ATTR_SYMBOL } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { is_capture_event, can_delegate_event, normalize_attribute } from '../../../../utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { attach } from './attachments.js';\nimport { clsx } from '../../../shared/attributes.js';\nimport { set_class } from './class.js';\nimport { set_style } from './style.js';\nimport { ATTACHMENT_KEY, NAMESPACE_HTML, UNINITIALIZED } from '../../../../constants.js';\nimport { branch, destroy_effect, effect, managed } from '../../reactivity/effects.js';\nimport { init_select, select_option } from './bindings/select.js';\nimport { flatten } from '../../reactivity/async.js';\n\nexport const CLASS = Symbol('class');\nexport const STYLE = Symbol('style');\n\nconst IS_CUSTOM_ELEMENT = Symbol('is custom element');\nconst IS_HTML = Symbol('is html');\n\nconst LINK_TAG = IS_XHTML ? 'link' : 'LINK';\nconst INPUT_TAG = IS_XHTML ? 'input' : 'INPUT';\nconst OPTION_TAG = IS_XHTML ? 'option' : 'OPTION';\nconst SELECT_TAG = IS_XHTML ? 'select' : 'SELECT';\nconst PROGRESS_TAG = IS_XHTML ? 'progress' : 'PROGRESS';\n\n/**\n * The value/checked attribute in the template actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLInputElement} input\n * @returns {void}\n */\nexport function remove_input_defaults(input) {\n\tif (!hydrating) return;\n\n\tvar already_removed = false;\n\n\t// We try and remove the default attributes later, rather than sync during hydration.\n\t// Doing it sync during hydration has a negative impact on performance, but deferring the\n\t// work in an idle task alleviates this greatly. If a form reset event comes in before\n\t// the idle callback, then we ensure the input defaults are cleared just before.\n\tvar remove_defaults = () => {\n\t\tif (already_removed) return;\n\t\talready_removed = true;\n\n\t\t// Remove the attributes but preserve the values\n\t\tif (input.hasAttribute('value')) {\n\t\t\tvar value = input.value;\n\t\t\tset_attribute(input, 'value', null);\n\t\t\tinput.value = value;\n\t\t}\n\n\t\tif (input.hasAttribute('checked')) {\n\t\t\tvar checked = input.checked;\n\t\t\tset_attribute(input, 'checked', null);\n\t\t\tinput.checked = checked;\n\t\t}\n\t};\n\n\t// @ts-expect-error\n\tinput.__on_r = remove_defaults;\n\tqueue_micro_task(remove_defaults);\n\tadd_form_reset_listener();\n}\n\n/**\n * @param {Element} element\n * @param {any} value\n */\nexport function set_value(element, value) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.value ===\n\t\t\t(attributes.value =\n\t\t\t\t// treat null and undefined the same for the initial value\n\t\t\t\tvalue ?? undefined) ||\n\t\t// @ts-expect-error\n\t\t// `progress` elements always need their value set when it's `0`\n\t\t(element.value === value && (value !== 0 || element.nodeName !== PROGRESS_TAG))\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.value = value ?? '';\n}\n\n/**\n * @param {Element} element\n * @param {boolean} checked\n */\nexport function set_checked(element, checked) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.checked ===\n\t\t(attributes.checked =\n\t\t\t// treat null and undefined the same for the initial value\n\t\t\tchecked ?? undefined)\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.checked = checked;\n}\n\n/**\n * Sets the `selected` attribute on an `option` element.\n * Not set through the property because that doesn't reflect to the DOM,\n * which means it wouldn't be taken into account when a form is reset.\n * @param {HTMLOptionElement} element\n * @param {boolean} selected\n */\nexport function set_selected(element, selected) {\n\tif (selected) {\n\t\t// The selected option could've changed via user selection, and\n\t\t// setting the value without this check would set it back.\n\t\tif (!element.hasAttribute('selected')) {\n\t\t\telement.setAttribute('selected', '');\n\t\t}\n\t} else {\n\t\telement.removeAttribute('selected');\n\t}\n}\n\n/**\n * Applies the default checked property without influencing the current checked property.\n * @param {HTMLInputElement} element\n * @param {boolean} checked\n */\nexport function set_default_checked(element, checked) {\n\tconst existing_value = element.checked;\n\telement.defaultChecked = checked;\n\telement.checked = existing_value;\n}\n\n/**\n * Applies the default value property without influencing the current value property.\n * @param {HTMLInputElement | HTMLTextAreaElement} element\n * @param {string} value\n */\nexport function set_default_value(element, value) {\n\tconst existing_value = element.value;\n\telement.defaultValue = value;\n\telement.value = existing_value;\n}\n\n/**\n * @param {Element} element\n * @param {string} attribute\n * @param {string | null} value\n * @param {boolean} [skip_warning]\n */\nexport function set_attribute(element, attribute, value, skip_warning) {\n\tvar attributes = get_attributes(element);\n\n\tif (hydrating) {\n\t\tattributes[attribute] = element.getAttribute(attribute);\n\n\t\tif (\n\t\t\tattribute === 'src' ||\n\t\t\tattribute === 'srcset' ||\n\t\t\t(attribute === 'href' && element.nodeName === LINK_TAG)\n\t\t) {\n\t\t\tif (!skip_warning) {\n\t\t\t\tcheck_src_in_dev_hydration(element, attribute, value ?? '');\n\t\t\t}\n\n\t\t\t// If we reset these attributes, they would result in another network request, which we want to avoid.\n\t\t\t// We assume they are the same between client and server as checking if they are equal is expensive\n\t\t\t// (we can't just compare the strings as they can be different between client and server but result in the\n\t\t\t// same url, so we would need to create hidden anchor elements to compare them)\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (attributes[attribute] === (attributes[attribute] = value)) return;\n\n\tif (attribute === 'loading') {\n\t\t// @ts-expect-error\n\t\telement[LOADING_ATTR_SYMBOL] = value;\n\t}\n\n\tif (value == null) {\n\t\telement.removeAttribute(attribute);\n\t} else if (typeof value !== 'string' && get_setters(element).includes(attribute)) {\n\t\t// @ts-ignore\n\t\telement[attribute] = value;\n\t} else {\n\t\telement.setAttribute(attribute, value);\n\t}\n}\n\n/**\n * @param {Element} dom\n * @param {string} attribute\n * @param {string} value\n */\nexport function set_xlink_attribute(dom, attribute, value) {\n\tdom.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @param {string} prop\n * @param {any} value\n */\nexport function set_custom_element_data(node, prop, value) {\n\t// We need to ensure that setting custom element props, which can\n\t// invoke lifecycle methods on other custom elements, does not also\n\t// associate those lifecycle methods with the current active reaction\n\t// or effect\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet was_hydrating = hydrating;\n\tif (hydrating) {\n\t\tset_hydrating(false);\n\t}\n\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\tif (\n\t\t\t// `style` should use `set_attribute` rather than the setter\n\t\t\tprop !== 'style' &&\n\t\t\t// Don't compute setters for custom elements while they aren't registered yet,\n\t\t\t// because during their upgrade/instantiation they might add more setters.\n\t\t\t// Instead, fall back to a simple \"an object, then set as property\" heuristic.\n\t\t\t(setters_cache.has(node.getAttribute('is') || node.nodeName) ||\n\t\t\t// customElements may not be available in browser extension contexts\n\t\t\t!customElements ||\n\t\t\tcustomElements.get(node.getAttribute('is') || node.nodeName.toLowerCase())\n\t\t\t\t? get_setters(node).includes(prop)\n\t\t\t\t: value && typeof value === 'object')\n\t\t) {\n\t\t\t// @ts-expect-error\n\t\t\tnode[prop] = value;\n\t\t} else {\n\t\t\t// We did getters etc checks already, stringify before passing to set_attribute\n\t\t\t// to ensure it doesn't invoke the same logic again, and potentially populating\n\t\t\t// the setters cache too early.\n\t\t\tset_attribute(node, prop, value == null ? value : String(value));\n\t\t}\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t\tif (was_hydrating) {\n\t\t\tset_hydrating(true);\n\t\t}\n\t}\n}\n\n/**\n * Spreads attributes onto a DOM element, taking into account the currently set attributes\n * @param {Element & ElementCSSInlineStyle} element\n * @param {Record<string | symbol, any> | undefined} prev\n * @param {Record<string | symbol, any>} next New attributes - this function mutates this object\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n * @returns {Record<string, any>}\n */\nfunction set_attributes(\n\telement,\n\tprev,\n\tnext,\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tif (hydrating && should_remove_defaults && element.nodeName === INPUT_TAG) {\n\t\tvar input = /** @type {HTMLInputElement} */ (element);\n\t\tvar attribute = input.type === 'checkbox' ? 'defaultChecked' : 'defaultValue';\n\n\t\tif (!(attribute in next)) {\n\t\t\tremove_input_defaults(input);\n\t\t}\n\t}\n\n\tvar attributes = get_attributes(element);\n\n\tvar is_custom_element = attributes[IS_CUSTOM_ELEMENT];\n\tvar preserve_attribute_case = !attributes[IS_HTML];\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet is_hydrating_custom_element = hydrating && is_custom_element;\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(false);\n\t}\n\n\tvar current = prev || {};\n\tvar is_option_element = element.nodeName === OPTION_TAG;\n\n\tfor (var key in prev) {\n\t\tif (!(key in next)) {\n\t\t\tnext[key] = null;\n\t\t}\n\t}\n\n\tif (next.class) {\n\t\tnext.class = clsx(next.class);\n\t} else if (css_hash || next[CLASS]) {\n\t\tnext.class = null; /* force call to set_class() */\n\t}\n\n\tif (next[STYLE]) {\n\t\tnext.style ??= null; /* force call to set_style() */\n\t}\n\n\tvar setters = get_setters(element);\n\n\t// since key is captured we use const\n\tfor (const key in next) {\n\t\t// let instead of var because referenced in a closure\n\t\tlet value = next[key];\n\n\t\t// Up here because we want to do this for the initial value, too, even if it's undefined,\n\t\t// and this wouldn't be reached in case of undefined because of the equality check below\n\t\tif (is_option_element && key === 'value' && value == null) {\n\t\t\t// The <option> element is a special case because removing the value attribute means\n\t\t\t// the value is set to the text content of the option element, and setting the value\n\t\t\t// to null or undefined means the value is set to the string \"null\" or \"undefined\".\n\t\t\t// To align with how we handle this case in non-spread-scenarios, this logic is needed.\n\t\t\t// There's a super-edge-case bug here that is left in in favor of smaller code size:\n\t\t\t// Because of the \"set missing props to null\" logic above, we can't differentiate\n\t\t\t// between a missing value and an explicitly set value of null or undefined. That means\n\t\t\t// that once set, the value attribute of an <option> element can't be removed. This is\n\t\t\t// a very rare edge case, and removing the attribute altogether isn't possible either\n\t\t\t// for the <option value={undefined}> case, so we're not losing any functionality here.\n\t\t\t// @ts-ignore\n\t\t\telement.value = element.__value = '';\n\t\t\tcurrent[key] = value;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'class') {\n\t\t\tvar is_html = element.namespaceURI === 'http://www.w3.org/1999/xhtml';\n\t\t\tset_class(element, is_html, value, css_hash, prev?.[CLASS], next[CLASS]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[CLASS] = next[CLASS];\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'style') {\n\t\t\tset_style(element, value, prev?.[STYLE], next[STYLE]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[STYLE] = next[STYLE];\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar prev_value = current[key];\n\n\t\t// Skip if value is unchanged, unless it's `undefined` and the element still has the attribute\n\t\tif (value === prev_value && !(value === undefined && element.hasAttribute(key))) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tcurrent[key] = value;\n\n\t\tvar prefix = key[0] + key[1]; // this is faster than key.slice(0, 2)\n\t\tif (prefix === '$$') continue;\n\n\t\tif (prefix === 'on') {\n\t\t\t/** @type {{ capture?: true }} */\n\t\t\tconst opts = {};\n\t\t\tconst event_handle_key = '$$' + key;\n\t\t\tlet event_name = key.slice(2);\n\t\t\tvar is_delegated = can_delegate_event(event_name);\n\n\t\t\tif (is_capture_event(event_name)) {\n\t\t\t\tevent_name = event_name.slice(0, -7);\n\t\t\t\topts.capture = true;\n\t\t\t}\n\n\t\t\tif (!is_delegated && prev_value) {\n\t\t\t\t// Listening to same event but different handler -> our handle function below takes care of this\n\t\t\t\t// If we were to remove and add listeners in this case, it could happen that the event is \"swallowed\"\n\t\t\t\t// (the browser seems to not know yet that a new one exists now) and doesn't reach the handler\n\t\t\t\t// https://github.com/sveltejs/svelte/issues/11903\n\t\t\t\tif (value != null) continue;\n\n\t\t\t\telement.removeEventListener(event_name, current[event_handle_key], opts);\n\t\t\t\tcurrent[event_handle_key] = null;\n\t\t\t}\n\n\t\t\tif (is_delegated) {\n\t\t\t\tdelegated(event_name, element, value);\n\t\t\t\tdelegate([event_name]);\n\t\t\t} else if (value != null) {\n\t\t\t\t/**\n\t\t\t\t * @this {any}\n\t\t\t\t * @param {Event} evt\n\t\t\t\t */\n\t\t\t\tfunction handle(evt) {\n\t\t\t\t\tcurrent[key].call(this, evt);\n\t\t\t\t}\n\n\t\t\t\tcurrent[event_handle_key] = create_event(event_name, element, handle, opts);\n\t\t\t}\n\t\t} else if (key === 'style') {\n\t\t\t// avoid using the setter\n\t\t\tset_attribute(element, key, value);\n\t\t} else if (key === 'autofocus') {\n\t\t\tautofocus(/** @type {HTMLElement} */ (element), Boolean(value));\n\t\t} else if (!is_custom_element && (key === '__value' || (key === 'value' && value != null))) {\n\t\t\t// @ts-ignore We're not running this for custom elements because __value is actually\n\t\t\t// how Lit stores the current value on the element, and messing with that would break things.\n\t\t\telement.value = element.__value = value;\n\t\t} else if (key === 'selected' && is_option_element) {\n\t\t\tset_selected(/** @type {HTMLOptionElement} */ (element), value);\n\t\t} else {\n\t\t\tvar name = key;\n\t\t\tif (!preserve_attribute_case) {\n\t\t\t\tname = normalize_attribute(name);\n\t\t\t}\n\n\t\t\tvar is_default = name === 'defaultValue' || name === 'defaultChecked';\n\n\t\t\tif (value == null && !is_custom_element && !is_default) {\n\t\t\t\tattributes[key] = null;\n\n\t\t\t\tif (name === 'value' || name === 'checked') {\n\t\t\t\t\t// removing value/checked also removes defaultValue/defaultChecked — preserve\n\t\t\t\t\tlet input = /** @type {HTMLInputElement} */ (element);\n\t\t\t\t\tconst use_default = prev === undefined;\n\t\t\t\t\tif (name === 'value') {\n\t\t\t\t\t\tlet previous = input.defaultValue;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultValue = previous;\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tinput.value = input.__value = use_default ? previous : null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet previous = input.defaultChecked;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultChecked = previous;\n\t\t\t\t\t\tinput.checked = use_default ? previous : false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\telement.removeAttribute(key);\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tis_default ||\n\t\t\t\t(setters.includes(name) && (is_custom_element || typeof value !== 'string'))\n\t\t\t) {\n\t\t\t\t// @ts-ignore\n\t\t\t\telement[name] = value;\n\t\t\t\t// remove it from attributes's cache\n\t\t\t\tif (name in attributes) attributes[name] = UNINITIALIZED;\n\t\t\t} else if (typeof value !== 'function') {\n\t\t\t\tset_attribute(element, name, value, skip_warning);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(true);\n\t}\n\n\treturn current;\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} element\n * @param {(...expressions: any) => Record<string | symbol, any>} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n */\nexport function attribute_effect(\n\telement,\n\tfn,\n\tsync = [],\n\tasync = [],\n\tblockers = [],\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tflatten(blockers, sync, async, (values) => {\n\t\t/** @type {Record<string | symbol, any> | undefined} */\n\t\tvar prev = undefined;\n\n\t\t/** @type {Record<symbol, Effect>} */\n\t\tvar effects = {};\n\n\t\tvar is_select = element.nodeName === SELECT_TAG;\n\t\tvar inited = false;\n\n\t\tmanaged(() => {\n\t\t\tvar next = fn(...values.map(get));\n\t\t\t/** @type {Record<string | symbol, any>} */\n\t\t\tvar current = set_attributes(\n\t\t\t\telement,\n\t\t\t\tprev,\n\t\t\t\tnext,\n\t\t\t\tcss_hash,\n\t\t\t\tshould_remove_defaults,\n\t\t\t\tskip_warning\n\t\t\t);\n\n\t\t\tif (inited && is_select && 'value' in next) {\n\t\t\t\tselect_option(/** @type {HTMLSelectElement} */ (element), next.value);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(effects)) {\n\t\t\t\tif (!next[symbol]) destroy_effect(effects[symbol]);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(next)) {\n\t\t\t\tvar n = next[symbol];\n\n\t\t\t\tif (symbol.description === ATTACHMENT_KEY && (!prev || n !== prev[symbol])) {\n\t\t\t\t\tif (effects[symbol]) destroy_effect(effects[symbol]);\n\t\t\t\t\teffects[symbol] = branch(() => attach(element, () => n));\n\t\t\t\t}\n\n\t\t\t\tcurrent[symbol] = n;\n\t\t\t}\n\n\t\t\tprev = current;\n\t\t});\n\n\t\tif (is_select) {\n\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\teffect(() => {\n\t\t\t\tselect_option(select, /** @type {Record<string | symbol, any>} */ (prev).value, true);\n\t\t\t\tinit_select(select);\n\t\t\t});\n\t\t}\n\n\t\tinited = true;\n\t});\n}\n\n/**\n *\n * @param {Element} element\n */\nfunction get_attributes(element) {\n\treturn /** @type {Record<string | symbol, unknown>} **/ (\n\t\t// @ts-expect-error\n\t\telement.__attributes ??= {\n\t\t\t[IS_CUSTOM_ELEMENT]: element.nodeName.includes('-'),\n\t\t\t[IS_HTML]: element.namespaceURI === NAMESPACE_HTML\n\t\t}\n\t);\n}\n\n/** @type {Map<string, string[]>} */\nvar setters_cache = new Map();\n\n/** @param {Element} element */\nfunction get_setters(element) {\n\tvar cache_key = element.getAttribute('is') || element.nodeName;\n\tvar setters = setters_cache.get(cache_key);\n\tif (setters) return setters;\n\tsetters_cache.set(cache_key, (setters = []));\n\n\tvar descriptors;\n\tvar proto = element; // In the case of custom elements there might be setters on the instance\n\tvar element_proto = Element.prototype;\n\n\t// Stop at Element, from there on there's only unnecessary setters we're not interested in\n\t// Do not use contructor.name here as that's unreliable in some browser environments\n\twhile (element_proto !== proto) {\n\t\tdescriptors = get_descriptors(proto);\n\n\t\tfor (var key in descriptors) {\n\t\t\tif (descriptors[key].set) {\n\t\t\t\tsetters.push(key);\n\t\t\t}\n\t\t}\n\n\t\tproto = get_prototype_of(proto);\n\t}\n\n\treturn setters;\n}\n\n/**\n * @param {any} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction check_src_in_dev_hydration(element, attribute, value) {\n\tif (!DEV) return;\n\tif (attribute === 'srcset' && srcset_url_equal(element, value)) return;\n\tif (src_url_equal(element.getAttribute(attribute) ?? '', value)) return;\n\n\tw.hydration_attribute_changed(\n\t\tattribute,\n\t\telement.outerHTML.replace(element.innerHTML, element.innerHTML && '...'),\n\t\tString(value)\n\t);\n}\n\n/**\n * @param {string} element_src\n * @param {string} url\n * @returns {boolean}\n */\nfunction src_url_equal(element_src, url) {\n\tif (element_src === url) return true;\n\treturn new URL(element_src, document.baseURI).href === new URL(url, document.baseURI).href;\n}\n\n/** @param {string} srcset */\nfunction split_srcset(srcset) {\n\treturn srcset.split(',').map((src) => src.trim().split(' ').filter(Boolean));\n}\n\n/**\n * @param {HTMLSourceElement | HTMLImageElement} element\n * @param {string} srcset\n * @returns {boolean}\n */\nfunction srcset_url_equal(element, srcset) {\n\tvar element_urls = split_srcset(element.srcset);\n\tvar urls = split_srcset(srcset);\n\n\treturn (\n\t\turls.length === element_urls.length &&\n\t\turls.every(\n\t\t\t([url, width], i) =>\n\t\t\t\twidth === element_urls[i][1] &&\n\t\t\t\t// We need to test both ways because Vite will create an a full URL with\n\t\t\t\t// `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the\n\t\t\t\t// relative URLs inside srcset are not automatically resolved to absolute URLs by\n\t\t\t\t// browsers (in contrast to img.src). This means both SSR and DOM code could\n\t\t\t\t// contain relative or absolute URLs.\n\t\t\t\t(src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0]))\n\t\t)\n\t);\n}\n","/** @import { Batch } from '../../../reactivity/batch.js' */\nimport { DEV } from 'esm-env';\nimport { render_effect, teardown } from '../../../reactivity/effects.js';\nimport { listen_to_event_and_reset_event } from './shared.js';\nimport * as e from '../../../errors.js';\nimport { is } from '../../../proxy.js';\nimport { queue_micro_task } from '../../task.js';\nimport { hydrating } from '../../hydration.js';\nimport { tick, untrack } from '../../../runtime.js';\nimport { is_runes } from '../../../context.js';\nimport { current_batch, previous_batch } from '../../../reactivity/batch.js';\nimport { async_mode_flag } from '../../../../flags/index.js';\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_value(input, get, set = get) {\n\tvar batches = new WeakSet();\n\n\tlisten_to_event_and_reset_event(input, 'input', async (is_reset) => {\n\t\tif (DEV && input.type === 'checkbox') {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.bind_invalid_checkbox_value();\n\t\t}\n\n\t\t/** @type {any} */\n\t\tvar value = is_reset ? input.defaultValue : input.value;\n\t\tvalue = is_numberlike_input(input) ? to_number(value) : value;\n\t\tset(value);\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\n\t\t// Because `{#each ...}` blocks work by updating sources inside the flush,\n\t\t// we need to wait a tick before checking to see if we should forcibly\n\t\t// update the input and reset the selection state\n\t\tawait tick();\n\n\t\t// Respect any validation in accessors\n\t\tif (value !== (value = get())) {\n\t\t\tvar start = input.selectionStart;\n\t\t\tvar end = input.selectionEnd;\n\t\t\tvar length = input.value.length;\n\n\t\t\t// the value is coerced on assignment\n\t\t\tinput.value = value ?? '';\n\n\t\t\t// Restore selection\n\t\t\tif (end !== null) {\n\t\t\t\tvar new_length = input.value.length;\n\t\t\t\t// If cursor was at end and new input is longer, move cursor to new end\n\t\t\t\tif (start === end && end === length && new_length > length) {\n\t\t\t\t\tinput.selectionStart = new_length;\n\t\t\t\t\tinput.selectionEnd = new_length;\n\t\t\t\t} else {\n\t\t\t\t\tinput.selectionStart = start;\n\t\t\t\t\tinput.selectionEnd = Math.min(end, new_length);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the updated value from the input instead.\n\t\t(hydrating && input.defaultValue !== input.value) ||\n\t\t// If defaultValue is set, then value == defaultValue\n\t\t// TODO Svelte 6: remove input.value check and set to empty string?\n\t\t(untrack(get) == null && input.value)\n\t) {\n\t\tset(is_numberlike_input(input) ? to_number(input.value) : input.value);\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\t}\n\n\trender_effect(() => {\n\t\tif (DEV && input.type === 'checkbox') {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.bind_invalid_checkbox_value();\n\t\t}\n\n\t\tvar value = get();\n\n\t\tif (input === document.activeElement) {\n\t\t\t// In sync mode render effects are executed during tree traversal -> needs current_batch\n\t\t\t// In async mode render effects are flushed once batch resolved, at which point current_batch is null -> needs previous_batch\n\t\t\tvar batch = /** @type {Batch} */ (async_mode_flag ? previous_batch : current_batch);\n\n\t\t\t// Never rewrite the contents of a focused input. We can get here if, for example,\n\t\t\t// an update is deferred because of async work depending on the input:\n\t\t\t//\n\t\t\t// <input bind:value={query}>\n\t\t\t// <p>{await find(query)}</p>\n\t\t\tif (batches.has(batch)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (is_numberlike_input(input) && value === to_number(input.value)) {\n\t\t\t// handles 0 vs 00 case (see https://github.com/sveltejs/svelte/issues/9959)\n\t\t\treturn;\n\t\t}\n\n\t\tif (input.type === 'date' && !value && !input.value) {\n\t\t\t// Handles the case where a temporarily invalid date is set (while typing, for example with a leading 0 for the day)\n\t\t\t// and prevents this state from clearing the other parts of the date input (see https://github.com/sveltejs/svelte/issues/7897)\n\t\t\treturn;\n\t\t}\n\n\t\t// don't set the value of the input if it's the same to allow\n\t\t// minlength to work properly\n\t\tif (value !== input.value) {\n\t\t\t// @ts-expect-error the value is coerced on assignment\n\t\t\tinput.value = value ?? '';\n\t\t}\n\t});\n}\n\n/** @type {Set<HTMLInputElement[]>} */\nconst pending = new Set();\n\n/**\n * @param {HTMLInputElement[]} inputs\n * @param {null | [number]} group_index\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_group(inputs, group_index, input, get, set = get) {\n\tvar is_checkbox = input.getAttribute('type') === 'checkbox';\n\tvar binding_group = inputs;\n\n\t// needs to be let or related code isn't treeshaken out if it's always false\n\tlet hydration_mismatch = false;\n\n\tif (group_index !== null) {\n\t\tfor (var index of group_index) {\n\t\t\t// @ts-expect-error\n\t\t\tbinding_group = binding_group[index] ??= [];\n\t\t}\n\t}\n\n\tbinding_group.push(input);\n\n\tlisten_to_event_and_reset_event(\n\t\tinput,\n\t\t'change',\n\t\t() => {\n\t\t\t// @ts-ignore\n\t\t\tvar value = input.__value;\n\n\t\t\tif (is_checkbox) {\n\t\t\t\tvalue = get_binding_group_value(binding_group, value, input.checked);\n\t\t\t}\n\n\t\t\tset(value);\n\t\t},\n\t\t// TODO better default value handling\n\t\t() => set(is_checkbox ? [] : null)\n\t);\n\n\trender_effect(() => {\n\t\tvar value = get();\n\n\t\t// If we are hydrating and the value has since changed, then use the update value\n\t\t// from the input instead.\n\t\tif (hydrating && input.defaultChecked !== input.checked) {\n\t\t\thydration_mismatch = true;\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_checkbox) {\n\t\t\tvalue = value || [];\n\t\t\t// @ts-ignore\n\t\t\tinput.checked = value.includes(input.__value);\n\t\t} else {\n\t\t\t// @ts-ignore\n\t\t\tinput.checked = is(input.__value, value);\n\t\t}\n\t});\n\n\tteardown(() => {\n\t\tvar index = binding_group.indexOf(input);\n\n\t\tif (index !== -1) {\n\t\t\tbinding_group.splice(index, 1);\n\t\t}\n\t});\n\n\tif (!pending.has(binding_group)) {\n\t\tpending.add(binding_group);\n\n\t\tqueue_micro_task(() => {\n\t\t\t// necessary to maintain binding group order in all insertion scenarios\n\t\t\tbinding_group.sort((a, b) => (a.compareDocumentPosition(b) === 4 ? -1 : 1));\n\t\t\tpending.delete(binding_group);\n\t\t});\n\t}\n\n\tqueue_micro_task(() => {\n\t\tif (hydration_mismatch) {\n\t\t\tvar value;\n\n\t\t\tif (is_checkbox) {\n\t\t\t\tvalue = get_binding_group_value(binding_group, value, input.checked);\n\t\t\t} else {\n\t\t\t\tvar hydration_input = binding_group.find((input) => input.checked);\n\t\t\t\t// @ts-ignore\n\t\t\t\tvalue = hydration_input?.__value;\n\t\t\t}\n\n\t\t\tset(value);\n\t\t}\n\t});\n}\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_checked(input, get, set = get) {\n\tlisten_to_event_and_reset_event(input, 'change', (is_reset) => {\n\t\tvar value = is_reset ? input.defaultChecked : input.checked;\n\t\tset(value);\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the update value from the input instead.\n\t\t(hydrating && input.defaultChecked !== input.checked) ||\n\t\t// If defaultChecked is set, then checked == defaultChecked\n\t\tuntrack(get) == null\n\t) {\n\t\tset(input.checked);\n\t}\n\n\trender_effect(() => {\n\t\tvar value = get();\n\t\tinput.checked = Boolean(value);\n\t});\n}\n\n/**\n * @template V\n * @param {Array<HTMLInputElement>} group\n * @param {V} __value\n * @param {boolean} checked\n * @returns {V[]}\n */\nfunction get_binding_group_value(group, __value, checked) {\n\t/** @type {Set<V>} */\n\tvar value = new Set();\n\n\tfor (var i = 0; i < group.length; i += 1) {\n\t\tif (group[i].checked) {\n\t\t\t// @ts-ignore\n\t\t\tvalue.add(group[i].__value);\n\t\t}\n\t}\n\n\tif (!checked) {\n\t\tvalue.delete(__value);\n\t}\n\n\treturn Array.from(value);\n}\n\n/**\n * @param {HTMLInputElement} input\n */\nfunction is_numberlike_input(input) {\n\tvar type = input.type;\n\treturn type === 'number' || type === 'range';\n}\n\n/**\n * @param {string} value\n */\nfunction to_number(value) {\n\treturn value === '' ? null : +value;\n}\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => FileList | null} get\n * @param {(value: FileList | null) => void} set\n */\nexport function bind_files(input, get, set = get) {\n\tlisten_to_event_and_reset_event(input, 'change', () => {\n\t\tset(input.files);\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the updated value from the input instead.\n\t\thydrating &&\n\t\tinput.files\n\t) {\n\t\tset(input.files);\n\t}\n\n\trender_effect(() => {\n\t\tinput.files = get();\n\t});\n}\n","import { teardown } from '../../../reactivity/effects.js';\nimport { get_descriptor } from '../../../../shared/utils.js';\n\n/**\n * Makes an `export`ed (non-prop) variable available on the `$$props` object\n * so that consumers can do `bind:x` on the component.\n * @template V\n * @param {Record<string, unknown>} props\n * @param {string} prop\n * @param {V} value\n * @returns {void}\n */\nexport function bind_prop(props, prop, value) {\n\tvar desc = get_descriptor(props, prop);\n\n\tif (desc && desc.set) {\n\t\tprops[prop] = value;\n\t\tteardown(() => {\n\t\t\tprops[prop] = null;\n\t\t});\n\t}\n}\n","/** @import { ComponentContext, Effect } from '#client' */\nimport { DESTROYING, STATE_SYMBOL } from '#client/constants';\nimport { component_context } from '../../../context.js';\nimport { effect, render_effect } from '../../../reactivity/effects.js';\nimport { active_effect, untrack } from '../../../runtime.js';\n\n/**\n * @param {any} bound_value\n * @param {Element} element_or_component\n * @returns {boolean}\n */\nfunction is_bound_this(bound_value, element_or_component) {\n\treturn (\n\t\tbound_value === element_or_component || bound_value?.[STATE_SYMBOL] === element_or_component\n\t);\n}\n\n/**\n * @param {any} element_or_component\n * @param {(value: unknown, ...parts: unknown[]) => void} update\n * @param {(...parts: unknown[]) => unknown} get_value\n * @param {() => unknown[]} [get_parts] Set if the this binding is used inside an each block,\n * \t\t\t\t\t\t\t\t\t\treturns all the parts of the each block context that are used in the expression\n * @returns {void}\n */\nexport function bind_this(element_or_component = {}, update, get_value, get_parts) {\n\tvar component_effect = /** @type {ComponentContext} */ (component_context).r;\n\tvar parent = /** @type {Effect} */ (active_effect);\n\n\teffect(() => {\n\t\t/** @type {unknown[]} */\n\t\tvar old_parts;\n\n\t\t/** @type {unknown[]} */\n\t\tvar parts;\n\n\t\trender_effect(() => {\n\t\t\told_parts = parts;\n\t\t\t// We only track changes to the parts, not the value itself to avoid unnecessary reruns.\n\t\t\tparts = get_parts?.() || [];\n\n\t\t\tuntrack(() => {\n\t\t\t\tif (element_or_component !== get_value(...parts)) {\n\t\t\t\t\tupdate(element_or_component, ...parts);\n\t\t\t\t\t// If this is an effect rerun (cause: each block context changes), then nullify the binding at\n\t\t\t\t\t// the previous position if it isn't already taken over by a different effect.\n\t\t\t\t\tif (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) {\n\t\t\t\t\t\tupdate(null, ...old_parts);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\treturn () => {\n\t\t\t// When the bind:this effect is destroyed, we go up the effect parent chain until we find the last parent effect that is destroyed,\n\t\t\t// or the effect containing the component bind:this is in (whichever comes first). That way we can time the nulling of the binding\n\t\t\t// as close to user/developer expectation as possible.\n\t\t\t// TODO Svelte 6: Decide if we want to keep this logic or just always null the binding in the component effect's teardown\n\t\t\t// (which would be simpler, but less intuitive in some cases, and breaks the `ondestroy-before-cleanup` test)\n\t\t\tlet p = parent;\n\t\t\twhile (p !== component_effect && p.parent !== null && p.parent.f & DESTROYING) {\n\t\t\t\tp = p.parent;\n\t\t\t}\n\t\t\tconst teardown = () => {\n\t\t\t\tif (parts && is_bound_this(get_value(...parts), element_or_component)) {\n\t\t\t\t\tupdate(null, ...parts);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst original_teardown = p.teardown;\n\t\t\tp.teardown = () => {\n\t\t\t\tteardown();\n\t\t\t\toriginal_teardown?.();\n\t\t\t};\n\t\t};\n\t});\n\n\treturn element_or_component;\n}\n","/** @import { ComponentContextLegacy } from '#client' */\nimport { run, run_all } from '../../../shared/utils.js';\nimport { component_context } from '../../context.js';\nimport { derived } from '../../reactivity/deriveds.js';\nimport { user_pre_effect, user_effect } from '../../reactivity/effects.js';\nimport { deep_read_state, get, untrack } from '../../runtime.js';\n\n/**\n * Legacy-mode only: Call `onMount` callbacks and set up `beforeUpdate`/`afterUpdate` effects\n * @param {boolean} [immutable]\n */\nexport function init(immutable = false) {\n\tconst context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\tconst callbacks = context.l.u;\n\tif (!callbacks) return;\n\n\tlet props = () => deep_read_state(context.s);\n\n\tif (immutable) {\n\t\tlet version = 0;\n\t\tlet prev = /** @type {Record<string, any>} */ ({});\n\n\t\t// In legacy immutable mode, before/afterUpdate only fire if the object identity of a prop changes\n\t\tconst d = derived(() => {\n\t\t\tlet changed = false;\n\t\t\tconst props = context.s;\n\t\t\tfor (const key in props) {\n\t\t\t\tif (props[key] !== prev[key]) {\n\t\t\t\t\tprev[key] = props[key];\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (changed) version++;\n\t\t\treturn version;\n\t\t});\n\n\t\tprops = () => get(d);\n\t}\n\n\t// beforeUpdate\n\tif (callbacks.b.length) {\n\t\tuser_pre_effect(() => {\n\t\t\tobserve_all(context, props);\n\t\t\trun_all(callbacks.b);\n\t\t});\n\t}\n\n\t// onMount (must run before afterUpdate)\n\tuser_effect(() => {\n\t\tconst fns = untrack(() => callbacks.m.map(run));\n\t\treturn () => {\n\t\t\tfor (const fn of fns) {\n\t\t\t\tif (typeof fn === 'function') {\n\t\t\t\t\tfn();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t});\n\n\t// afterUpdate\n\tif (callbacks.a.length) {\n\t\tuser_effect(() => {\n\t\t\tobserve_all(context, props);\n\t\t\trun_all(callbacks.a);\n\t\t});\n\t}\n}\n\n/**\n * Invoke the getter of all signals associated with a component\n * so they can be registered to the effect this function is called in.\n * @param {ComponentContextLegacy} context\n * @param {(() => void)} props\n */\nfunction observe_all(context, props) {\n\tif (context.l.s) {\n\t\tfor (const signal of context.l.s) get(signal);\n\t}\n\n\tprops();\n}\n","import { set, source } from '../../reactivity/sources.js';\nimport { get } from '../../runtime.js';\nimport { is_array } from '../../../shared/utils.js';\n\n/**\n * Under some circumstances, imports may be reactive in legacy mode. In that case,\n * they should be using `reactive_import` as part of the transformation\n * @param {() => any} fn\n */\nexport function reactive_import(fn) {\n\tvar s = source(0);\n\n\treturn function () {\n\t\tif (arguments.length === 1) {\n\t\t\tset(s, get(s) + 1);\n\t\t\treturn arguments[0];\n\t\t} else {\n\t\t\tget(s);\n\t\t\treturn fn();\n\t\t}\n\t};\n}\n\n/**\n * @this {any}\n * @param {Record<string, unknown>} $$props\n * @param {Event} event\n * @returns {void}\n */\nexport function bubble_event($$props, event) {\n\tvar events = /** @type {Record<string, Function[] | Function>} */ ($$props.$$events)?.[\n\t\tevent.type\n\t];\n\n\tvar callbacks = is_array(events) ? events.slice() : events == null ? [] : [events];\n\n\tfor (var fn of callbacks) {\n\t\t// Preserve \"this\" context\n\t\tfn.call(this, event);\n\t}\n}\n\n/**\n * Used to simulate `$on` on a component instance when `compatibility.componentApi === 4`\n * @param {Record<string, any>} $$props\n * @param {string} event_name\n * @param {Function} event_callback\n */\nexport function add_legacy_event_listener($$props, event_name, event_callback) {\n\t$$props.$$events ||= {};\n\t$$props.$$events[event_name] ||= [];\n\t$$props.$$events[event_name].push(event_callback);\n}\n\n/**\n * Used to simulate `$set` on a component instance when `compatibility.componentApi === 4`.\n * Needs component accessors so that it can call the setter of the prop. Therefore doesn't\n * work for updating props in `$$props` or `$$restProps`.\n * @this {Record<string, any>}\n * @param {Record<string, any>} $$new_props\n */\nexport function update_legacy_props($$new_props) {\n\tfor (var key in $$new_props) {\n\t\tif (key in this) {\n\t\t\tthis[key] = $$new_props[key];\n\t\t}\n\t}\n}\n","/** @import { Effect, Source } from './types.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tPROPS_IS_BINDABLE,\n\tPROPS_IS_IMMUTABLE,\n\tPROPS_IS_LAZY_INITIAL,\n\tPROPS_IS_RUNES,\n\tPROPS_IS_UPDATED\n} from '../../../constants.js';\nimport { get_descriptor, is_function } from '../../shared/utils.js';\nimport { set, source, update } from './sources.js';\nimport { derived, derived_safe_equal } from './deriveds.js';\nimport {\n\tactive_effect,\n\tget,\n\tis_destroying_effect,\n\tset_active_effect,\n\tuntrack\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { DESTROYED, LEGACY_PROPS, STATE_SYMBOL } from '#client/constants';\nimport { proxy } from '../proxy.js';\nimport { capture_store_binding } from './store.js';\nimport { legacy_mode_flag } from '../../flags/index.js';\nimport { effect, render_effect } from './effects.js';\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_prop(fn, d = 1) {\n\tconst value = fn();\n\tfn(value + d);\n\treturn value;\n}\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_prop(fn, d = 1) {\n\tconst value = fn() + d;\n\tfn(value);\n\treturn value;\n}\n\n/**\n * The proxy handler for rest props (i.e. `const { x, ...rest } = $props()`).\n * Is passed the full `$$props` object and excludes the named props.\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, name?: string }>}}\n */\nconst rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\treturn target.props[key];\n\t},\n\tset(target, key) {\n\t\tif (DEV) {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.props_rest_readonly(`${target.name}.${String(key)}`);\n\t\t}\n\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.includes(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {string[]} exclude\n * @param {string} [name]\n * @returns {Record<string, unknown>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function rest_props(props, exclude, name) {\n\treturn new Proxy(\n\t\tDEV ? { props, exclude, name, other: {}, to_proxy: [] } : { props, exclude },\n\t\trest_props_handler\n\t);\n}\n\n/**\n * The proxy handler for legacy $$restProps and $$props\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, special: Record<string | symbol, (v?: unknown) => unknown>, version: Source<number>, parent_effect: Effect }>}}\n */\nconst legacy_rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tget(target.version);\n\t\treturn key in target.special ? target.special[key]() : target.props[key];\n\t},\n\tset(target, key, value) {\n\t\tif (!(key in target.special)) {\n\t\t\tvar previous_effect = active_effect;\n\n\t\t\ttry {\n\t\t\t\tset_active_effect(target.parent_effect);\n\n\t\t\t\t// Handle props that can temporarily get out of sync with the parent\n\t\t\t\t/** @type {Record<string, (v?: unknown) => unknown>} */\n\t\t\t\ttarget.special[key] = prop(\n\t\t\t\t\t{\n\t\t\t\t\t\tget [key]() {\n\t\t\t\t\t\t\treturn target.props[key];\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t/** @type {string} */ (key),\n\t\t\t\t\tPROPS_IS_UPDATED\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tset_active_effect(previous_effect);\n\t\t\t}\n\t\t}\n\n\t\ttarget.special[key](value);\n\t\tupdate(target.version); // $$props is coarse-grained: when $$props.x is updated, usages of $$props.y etc are also rerun\n\t\treturn true;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\tdeleteProperty(target, key) {\n\t\t// Svelte 4 allowed for deletions on $$restProps\n\t\tif (target.exclude.includes(key)) return true;\n\t\ttarget.exclude.push(key);\n\t\tupdate(target.version);\n\t\treturn true;\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.includes(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {string[]} exclude\n * @returns {Record<string, unknown>}\n */\nexport function legacy_rest_props(props, exclude) {\n\treturn new Proxy(\n\t\t{\n\t\t\tprops,\n\t\t\texclude,\n\t\t\tspecial: {},\n\t\t\tversion: source(0),\n\t\t\t// TODO this is only necessary because we need to track component\n\t\t\t// destruction inside `prop`, because of `bind:this`, but it\n\t\t\t// seems likely that we can simplify `bind:this` instead\n\t\t\tparent_effect: /** @type {Effect} */ (active_effect)\n\t\t},\n\t\tlegacy_rest_props_handler\n\t);\n}\n\n/**\n * The proxy handler for spread props. Handles the incoming array of props\n * that looks like `() => { dynamic: props }, { static: prop }, ..` and wraps\n * them so that the whole thing is passed to the component as the `$$props` argument.\n * @type {ProxyHandler<{ props: Array<Record<string | symbol, unknown> | (() => Record<string | symbol, unknown>)> }>}}\n */\nconst spread_props_handler = {\n\tget(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) return p[key];\n\t\t}\n\t},\n\tset(target, key, value) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tconst desc = get_descriptor(p, key);\n\t\t\tif (desc && desc.set) {\n\t\t\t\tdesc.set(value);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) {\n\t\t\t\tconst descriptor = get_descriptor(p, key);\n\t\t\t\tif (descriptor && !descriptor.configurable) {\n\t\t\t\t\t// Prevent a \"Non-configurability Report Error\": The target is an array, it does\n\t\t\t\t\t// not actually contain this property. If it is now described as non-configurable,\n\t\t\t\t\t// the proxy throws a validation error. Setting it to true avoids that.\n\t\t\t\t\tdescriptor.configurable = true;\n\t\t\t\t}\n\t\t\t\treturn descriptor;\n\t\t\t}\n\t\t}\n\t},\n\thas(target, key) {\n\t\t// To prevent a false positive `is_entry_props` in the `prop` function\n\t\tif (key === STATE_SYMBOL || key === LEGACY_PROPS) return false;\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (p != null && key in p) return true;\n\t\t}\n\n\t\treturn false;\n\t},\n\townKeys(target) {\n\t\t/** @type {Array<string | symbol>} */\n\t\tconst keys = [];\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (!p) continue;\n\n\t\t\tfor (const key in p) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\n\t\t\tfor (const key of Object.getOwnPropertySymbols(p)) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\t\t}\n\n\t\treturn keys;\n\t}\n};\n\n/**\n * @param {Array<Record<string, unknown> | (() => Record<string, unknown>)>} props\n * @returns {any}\n */\nexport function spread_props(...props) {\n\treturn new Proxy({ props }, spread_props_handler);\n}\n\n/**\n * This function is responsible for synchronizing a possibly bound prop with the inner component state.\n * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.\n * @template V\n * @param {Record<string, unknown>} props\n * @param {string} key\n * @param {number} flags\n * @param {V | (() => V)} [fallback]\n * @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))}\n */\nexport function prop(props, key, flags, fallback) {\n\tvar runes = !legacy_mode_flag || (flags & PROPS_IS_RUNES) !== 0;\n\tvar bindable = (flags & PROPS_IS_BINDABLE) !== 0;\n\tvar lazy = (flags & PROPS_IS_LAZY_INITIAL) !== 0;\n\n\tvar fallback_value = /** @type {V} */ (fallback);\n\tvar fallback_dirty = true;\n\n\tvar get_fallback = () => {\n\t\tif (fallback_dirty) {\n\t\t\tfallback_dirty = false;\n\n\t\t\tfallback_value = lazy\n\t\t\t\t? untrack(/** @type {() => V} */ (fallback))\n\t\t\t\t: /** @type {V} */ (fallback);\n\t\t}\n\n\t\treturn fallback_value;\n\t};\n\n\t/** @type {((v: V) => void) | undefined} */\n\tlet setter;\n\n\tif (bindable) {\n\t\t// Can be the case when someone does `mount(Component, props)` with `let props = $state({...})`\n\t\t// or `createClassComponent(Component, props)`\n\t\tvar is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;\n\n\t\tsetter =\n\t\t\tget_descriptor(props, key)?.set ??\n\t\t\t(is_entry_props && key in props ? (v) => (props[key] = v) : undefined);\n\t}\n\n\t/** @type {V} */\n\tvar initial_value;\n\tvar is_store_sub = false;\n\n\tif (bindable) {\n\t\t[initial_value, is_store_sub] = capture_store_binding(() => /** @type {V} */ (props[key]));\n\t} else {\n\t\tinitial_value = /** @type {V} */ (props[key]);\n\t}\n\n\tif (initial_value === undefined && fallback !== undefined) {\n\t\tinitial_value = get_fallback();\n\n\t\tif (setter) {\n\t\t\tif (runes) e.props_invalid_value(key);\n\t\t\tsetter(initial_value);\n\t\t}\n\t}\n\n\t/** @type {() => V} */\n\tvar getter;\n\n\tif (runes) {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\t\t\tif (value === undefined) return get_fallback();\n\t\t\tfallback_dirty = true;\n\t\t\treturn value;\n\t\t};\n\t} else {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\n\t\t\tif (value !== undefined) {\n\t\t\t\t// in legacy mode, we don't revert to the fallback value\n\t\t\t\t// if the prop goes from defined to undefined. The easiest\n\t\t\t\t// way to model this is to make the fallback undefined\n\t\t\t\t// as soon as the prop has a value\n\t\t\t\tfallback_value = /** @type {V} */ (undefined);\n\t\t\t}\n\n\t\t\treturn value === undefined ? fallback_value : value;\n\t\t};\n\t}\n\n\t// prop is never written to — we only need a getter\n\tif (runes && (flags & PROPS_IS_UPDATED) === 0) {\n\t\treturn getter;\n\t}\n\n\t// prop is written to, but the parent component had `bind:foo` which\n\t// means we can just call `$$props.foo = value` directly\n\tif (setter) {\n\t\tvar legacy_parent = props.$$legacy;\n\t\treturn /** @type {() => V} */ (\n\t\t\tfunction (/** @type {V} */ value, /** @type {boolean} */ mutation) {\n\t\t\t\tif (arguments.length > 0) {\n\t\t\t\t\t// We don't want to notify if the value was mutated and the parent is in runes mode.\n\t\t\t\t\t// In that case the state proxy (if it exists) should take care of the notification.\n\t\t\t\t\t// If the parent is not in runes mode, we need to notify on mutation, too, that the prop\n\t\t\t\t\t// has changed because the parent will not be able to detect the change otherwise.\n\t\t\t\t\tif (!runes || !mutation || legacy_parent || is_store_sub) {\n\t\t\t\t\t\t/** @type {Function} */ (setter)(mutation ? getter() : value);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\n\t\t\t\treturn getter();\n\t\t\t}\n\t\t);\n\t}\n\n\t// Either prop is written to, but there's no binding, which means we\n\t// create a derived that we can write to locally.\n\t// Or we are in legacy mode where we always create a derived to replicate that\n\t// Svelte 4 did not trigger updates when a primitive value was updated to the same value.\n\tvar overridden = false;\n\n\tvar d = ((flags & PROPS_IS_IMMUTABLE) !== 0 ? derived : derived_safe_equal)(() => {\n\t\toverridden = false;\n\t\treturn getter();\n\t});\n\n\tif (DEV) {\n\t\td.label = key;\n\t}\n\n\t// Capture the initial value if it's bindable\n\tif (bindable) get(d);\n\n\tvar parent_effect = /** @type {Effect} */ (active_effect);\n\n\treturn /** @type {() => V} */ (\n\t\tfunction (/** @type {any} */ value, /** @type {boolean} */ mutation) {\n\t\t\tif (arguments.length > 0) {\n\t\t\t\tconst new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;\n\n\t\t\t\tset(d, new_value);\n\t\t\t\toverridden = true;\n\n\t\t\t\tif (fallback_value !== undefined) {\n\t\t\t\t\tfallback_value = new_value;\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t// special case — avoid recalculating the derived if we're in a\n\t\t\t// teardown function and the prop was overridden locally, or the\n\t\t\t// component was already destroyed (people could access props in a timeout)\n\t\t\tif ((is_destroying_effect && overridden) || (parent_effect.f & DESTROYED) !== 0) {\n\t\t\t\treturn d.v;\n\t\t\t}\n\n\t\t\treturn get(d);\n\t\t}\n\t);\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    this.bar = null;\n  }\n\n  init(context, total) {\n    this.bar?.remove();\n    this.context = context;\n    this.total = total;\n    this.current = 0;\n    this.lastPct = 0;\n    this.bar = ui.notifications.info(this.context, { progress: true });\n    this.bar.update({ pct: 0.01 });\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      this.bar?.update({ message: this.context, pct: pct / 100 });\n    }\n    this.lastPct = pct;\n    if (this.current >= this.total) {\n      this.bar?.remove();\n      this.bar = null;\n    }\n  }\n}\n\nconst LoadingBar = new loading_bar();\n\nexport default LoadingBar;\n","import CONSTANTS from \"../constants.js\"\nimport { debug } from \"../lib/lib.js\"\n\nconst SequencerFileCache = {\n  /** @type {Map<string, { blob: Blob }>} */\n  _videos: new Map(),\n  _preloadedFiles: new Set(),\n  _totalCacheSize: 0,\n  _validTypes: [\"video/webm\", \"video/x-webm\", \"application/octet-stream\", \"binary/octet-stream\"],\n  /** @type {Map<string, PIXI.Spritesheet>} */\n  _spritesheets: new Map(),\n  /** @type {Map<string, Promise<{spritesheet: PIXI.Spritesheet, scale: number}> | null>} */\n  _generateSpritesheetJobs: new Map(),\n\n  /** @type {Promise<import(\"../lib/spritesheets/SpritesheetGenerator.js\").SpritesheetGenerator> | null} */\n  _spritesheetGenerator: null,\n\n  /**\n   *\n   * @param {string} inSrc\n   * @returns {Promise<Blob>} the video blob\n   */\n  async loadVideo(inSrc) {\n    let entry = this._videos.get(inSrc)\n    if (!entry) {\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 && this._videos.size > 0) {\n        const oldSrc = this._videos.keys().next().value\n        this._totalCacheSize -= this._videos.get(oldSrc).blob.size\n        this._preloadedFiles.delete(oldSrc)\n        this._videos.delete(oldSrc)\n      }\n\n      this._totalCacheSize += blob.size\n      this._preloadedFiles.add(inSrc)\n      entry = { blob }\n      this._videos.set(inSrc, entry)\n    } else {\n      this._videos.delete(inSrc)\n      this._videos.set(inSrc, entry)\n    }\n\n    return entry.blob\n  },\n\n  srcExists(inSrc) {\n    if (this._preloadedFiles.has(inSrc)) {\n      return true\n    }\n    return foundry.utils.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 (foundry.audio.AudioHelper.hasAudioExtension(inSrc)) {\n      try {\n        const audio = await foundry.audio.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 foundry.canvas.loadTexture(inSrc)\n    if (texture) {\n      this._preloadedFiles.add(inSrc)\n    }\n    return texture\n  },\n\n  /**\n   * @param {string} inSrc\n   * @param {Object} options\n   * @param {number} options.minimumScale\n   * @return {Promise<PIXI.Spritesheet | undefined>} the compiled spritesheet or\n   * undefined if it cannot be generated\n   */\n  async requestCompiledSpritesheet(inSrc, { minimumScale }) {\n    if (!inSrc.toLowerCase().endsWith(\".webm\")) {\n      return\n    }\n    if (this._spritesheetGenerator == null) {\n      this._spritesheetGenerator = import(\n        \"../lib/spritesheets/SpritesheetGenerator.js\"\n      ).then((m) => m.SpritesheetGenerator.create())\n    }\n    const generator = await this._spritesheetGenerator\n    if (!generator) {\n      return\n    }\n    let job = this._generateSpritesheetJobs.get(inSrc)\n    if (!job) {\n      job = new Promise(async (resolve) => {\n        const timeStart = Date.now()\n\n        debug(\n          `Spritesheets | generating ${inSrc}. Required scale ${minimumScale}`,\n        )\n        const blob = await this.loadVideo(inSrc)\n        const buffer = await blob.arrayBuffer()\n        /** @type {PIXI.Spritesheet | null} */\n        let spritesheet = null\n        let scale = 1\n        try {\n          const result = await generator.spritesheetFromBuffer({\n            buffer,\n            id: inSrc,\n            minimumScale,\n          })\n          spritesheet = result.spritesheet\n          scale = result.scale\n        } catch (error) {\n          console.warn(error)\n          resolve(null)\n          return\n        }\n        const w = spritesheet.baseTexture.width\n        const h = spritesheet.baseTexture.height\n        const megaBytes =\n          Math.round(\n            spritesheet.baseTexture.resource._levelBuffers.reduce(\n              (acc, cur) => acc + cur.levelBuffer.byteLength,\n              0,\n            ) / 100_000,\n          ) / 10\n        const time = Math.round((Date.now() - timeStart) / 100) / 10\n        debug(\n          `Spritesheets | ${inSrc} generated in ${time}s. ${w}x${h} ${megaBytes}mb`,\n        )\n        resolve({ spritesheet, scale })\n      })\n      this._generateSpritesheetJobs.set(inSrc, job)\n    }\n\n    const result = await job\n    if (result && result.scale < minimumScale) {\n      debug(\n        `Spritesheets | ${inSrc} minimum scale of ${minimumScale} requested but only scale ${result.scale} is available`,\n      )\n      return undefined\n    }\n    return result?.spritesheet\n  },\n\n  registerSpritesheet(inSrc, inSpriteSheet) {\n    const existingSheetRef = this._spritesheets.get(inSrc)\n    if (existingSheetRef) {\n      existingSheetRef[1] += 1\n    } else {\n      this._spritesheets.set(inSrc, [inSpriteSheet, 1])\n    }\n  },\n\n  /**\n   *\n   * @param {string} inSrc\n   * @returns {void}\n   */\n  async unloadSpritesheet(inSrc) {\n    const existingSheetRef = this._spritesheets.get(inSrc)\n    if (!existingSheetRef) {\n      console.error(\"trying to unlaod spritesheet that was not loaded:\", inSrc)\n      return\n    }\n    existingSheetRef[1] -= 1\n    if (existingSheetRef[1] > 0) {\n      return\n    }\n    this._generateSpritesheetJobs.delete(inSrc)\n    this._spritesheets.delete(inSrc)\n    /** @type {PIXI.Spritesheet} */\n    const sheet = existingSheetRef[0]\n    const relatedPacks = sheet.data?.meta?.related_multi_packs ?? []\n    const relatedSheets = sheet.linkedSheets\n    // const packsSize = Math.max(relatedPacks.length, relatedSheets.length)\n    // clean up related sheets starting with the last (leaf)\n\n    const cacheKeys = [\n      get_sheet_image_url(inSrc, sheet),\n      foundry.utils.getRoute(inSrc),\n    ]\n    await PIXI.Assets.unload(cacheKeys.filter((src) => !!src))\n\t\tif (sheet.textures) {\n\t\t\tObject.values(sheet.textures).forEach((t) => t.destroy())\n\t\t}\n    sheet.baseTexture?.destroy()\n  },\n}\n\n/**\n * @param {PIXI.Spritesheet} sheet\n */\nfunction get_sheet_image_url(inSrc, sheet) {\n  const imageName = sheet?.data?.meta?.image\n  if (!imageName) {\n    return\n  }\n  const srcPrefix = inSrc.split(\"/\").slice(0, -1).join(\"/\")\n  const sheetSrc = `${srcPrefix}/${imageName}`\n  return foundry.utils.getRoute(sheetSrc)\n}\nfunction get_sheet_source_url(inSrc, sheetFilename) {\n  const srcPrefix = inSrc.split(\"/\").slice(0, -1).join(\"/\")\n  const sheetSrc = `${srcPrefix}/${sheetFilename}`\n  return foundry.utils.getRoute(sheetSrc)\n}\n\n// TODO: video base textures need to be cleaned up...\n// We should introduce manual reference counting like with spritesheet textures.\nasync function get_video_texture(inBlob) {\n  return new Promise(async (resolve, reject) => {\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-fix-pixi\")) {\n        baseTexture.alphaMode = PIXI.ALPHA_MODES.PREMULTIPLIED_ALPHA\n      }\n\n      const texture = new PIXI.Texture(baseTexture)\n\n      resolve(texture)\n      video.oncanplay = null\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\nexport class SequencerFileBase {\n  static make(inData, inDBPath, inMetadata) {\n    if (typeof inData === 'string' && !inDBPath && !inMetadata) {\n      return new SequencerFilePlain(inData)\n    }\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 SequencerFilePlain extends SequencerFileBase {\n  #file\n  rangeFind = false;\n\n  constructor(inData) {\n    super();\n    this.#file = inData\n  }\n\n  getFileForDistance() {\n    return this.getFile()\n  }\n\n  getFile() {\n    return this.#file\n  }\n  getAllFiles() {\n    return [this.#file]\n  }\n  async validate() {\n    return Promise.resolve(!!this.#file)\n  }\n\n  clone() {\n    return new SequencerFilePlain(this.#file)\n  }\n\n  getTimestamps() {\n    return undefined\n  }\n}\n\n\nexport class SequencerFile extends SequencerFileBase {\n  rangeFind = false;\n\n  get isFlipbook() {\n    return this.originalMetadata?.flipbook\n  }\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    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  getFileForDistance() {\n    return this.getFile()\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 = '15ft') {\n    if (inFt && this.file[inFt]) {\n      if (Array.isArray(this.file[inFt])) {\n        const fileIndex = lib.is_real_number(this.fileIndex)\n          ? Math.min(this.file[inFt].length - 1, 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  _getMatchingDistance(inEntry) {\n    return SequencerFileRangeFind.ftToDistanceMap[inEntry] / this._gridSizeDiff;\n  }\n\n  getFileForDistance(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","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  flattenedEntriesAdvanced = [];\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  get publicFlattenedEntriesAdvanced() {\n    return this.flattenedEntriesAdvanced.filter((entry) => {\n      return this.privateModules.indexOf(entry.path.split(\".\")[0]) === -1;\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   * @param  {boolean}     override      Whether to ignore existing entries and completely override the module's previous entries\n   * @return {boolean}\n   */\n  registerEntries(inModuleName, inEntries, isPrivate = false, override = false) {\n    if (inModuleName.includes(\".\"))\n      return this._throwError(\n        \"registerEntries\",\n        \"module name must not contain periods\"\n      );\n    if (this.entries[inModuleName] && !override)\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    if (override) {\n      if (isPrivate) { \n        this.privateModules.push(inModuleName); \n      } else {\n        this.privateModules = this.privateModules.filter(mod => mod !== inModuleName);\n      }\n      this.entries[inModuleName] = processedEntries;\n    } else {\n      if (isPrivate) this.privateModules.push(inModuleName);\n      this.entries = foundry.utils.mergeObject(this.entries, {\n        [inModuleName]: processedEntries,\n      });\n    }\n    lib.debug(\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    const match = this.flattenedEntries.find((entry) => entry.startsWith(inString));\n    if (match && match !== inString && !match.startsWith(inString + \".\")) {\n      lib.custom_warning(\n        \"Sequencer\",\n        `entryExists | \"${inString}\" matched via partial segment prefix (\"${match}\"). This behavior will be removed in a future version. Use the full entry path or a dot-delimited prefix instead.`\n      );\n    }\n    return !!match;\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    {\n      ranges = false,\n      arrays = false,\n      match = false,\n      fullyQualified = false,\n    } = {}\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    const 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) => (!fullyQualified ? e.split(inPath)[1] : e))\n        .map((e) => (!fullyQualified ? (e ? e.split(\".\")[1] : \"\") : e))\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.flattenedEntriesAdvanced = lib.make_array_unique(\n      this.flattenedEntriesAdvanced.concat(\n        Object.entries(flattened).map(([path, file]) => ({\n          path: path.split(\".file\")[0],\n          file,\n          isAudio: file.endsWith(\"ogg\")\n            || file.endsWith(\"mp3\")\n            || file.endsWith(\"wav\")\n        }))\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      .concat(['json']);\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 = foundry.utils.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 = foundry.utils.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          const sequencerFile = this.getEntry(data);\n          const clone = sequencerFile.clone();\n          clone.dbPath = wholeDBPath;\n          clone.metadata = foundry.utils.mergeObject(\n            clone.metadata ?? {},\n            metadata ?? {}\n          );\n          moduleEntries.push(clone);\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","<script>\r\n\r\n  import { databaseStore } from \"./DatabaseStore.js\";\r\n\r\n  export let data;\r\n\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n\r\n  const searchRegex = databaseStore.searchRegex;\r\n\r\n  let flashFilePath = false;\r\n  let flashDBPath = false;\r\n\r\n  $: highlight = data.path.replace(\r\n    $searchRegex,\r\n    \"<mark>$&</mark>\"\r\n  );\r\n\r\n</script>\r\n\r\n<div class=\"database-entry\" style=\"margin-left:{data.depth * 15}px;\">\r\n\t<div class=\"database-entry-text-container\">\r\n\t\t{#if data.hasChildren}\r\n\t\t\t<a on:click={(e) => {\r\n\t\t\t\tdatabaseStore.openTreePath(data.fullPath, !data.open, e.ctrlKey);\r\n\t\t\t}}>\r\n\t\t\t\t<i class=\"fas\" class:fa-angle-down={data.open} class:fa-angle-right={!data.open}></i>\r\n\t\t\t</a>\r\n\t\t{/if}\r\n\t\t{#if data.fullPath.includes(\".\")}\r\n\t\t\t{#if !data.hasChildren}\r\n\t\t\t\t<a class=\"database-entry-button\" title=\"{localize('SEQUENCER.Database.CopyFilePath')}\" on:click={(e) => {\r\n\t\t\t\t\tdatabaseStore.copyPath(data.fullPath, true, e.ctrlKey)\r\n\t\t\t\t\tflashFilePath = true;\r\n\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\tflashFilePath = false\r\n\t\t\t\t\t}, 400);\r\n\t\t\t\t}}>\r\n\t\t\t\t\t<i class=\"fas fa-file\" class:flash-it={flashFilePath}></i>\r\n\t\t\t\t</a>\r\n\t\t\t{/if}\r\n\t\t\t<a class=\"database-entry-button\" title=\"{localize('SEQUENCER.Database.CopyDatabasePath')}\" on:click={(e) => {\r\n\t\t\t\tdatabaseStore.copyPath(data.fullPath, false, e.ctrlKey)\r\n\t\t\t\tflashDBPath = true;\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tflashDBPath = false\r\n\t\t\t\t}, 400);\r\n\t\t\t}}>\r\n\t\t\t\t<i class=\"fas fa-database\" class:flash-it={flashDBPath}></i>\r\n\t\t\t</a>\r\n\t\t\t<a class=\"database-entry-button\" title=\"{localize('SEQUENCER.Database.PlayPreview')}\" on:click={() => {\r\n\t\t\t\tdatabaseStore.playFile(data.fullPath)\r\n\t\t\t}}>\r\n\t\t\t\t<i class=\"fas fa-play\"></i>\r\n\t\t\t</a>\r\n\t\t{/if}\r\n\t\t<div class=\"database-entry-text\" title=\"{data.path}\">\r\n\t\t\t<div class=\"database-entry-text-highlight\">{@html highlight}</div>\r\n\t\t\t{data.path}\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n  .database-entry {\r\n    flex: 1 0 auto;\r\n\r\n    .database-entry-text-container {\r\n      flex: 1;\r\n      display: flex;\r\n      align-items: center;\r\n\r\n      .database-entry-button {\r\n        padding: 0 0 0 3px;\r\n        font-size: 0.7rem;\r\n        line-height: normal;\r\n        cursor: pointer;\r\n      }\r\n\r\n      a {\r\n        display: flex;\r\n        align-items: center;\r\n        justify-content: center;\r\n        max-width: 15px;\r\n      }\r\n\r\n      a > i {\r\n        flex: 0 0 15px;\r\n        min-width: 15px;\r\n      }\r\n    }\r\n  }\r\n\r\n  .database-entry > button > i {\r\n    font-size: 0.7rem;\r\n  }\r\n\r\n  .sub-leaves {\r\n    padding-left: 1rem;\r\n    padding-bottom: 0.25rem;\r\n    display: flex;\r\n    flex-direction: column;\r\n  }\r\n\r\n  .database-entry-text {\r\n    position: relative;\r\n    margin-left: 5px;\r\n  }\r\n\r\n  .database-entry-text-highlight {\r\n    pointer-events: none;\r\n    color: transparent;\r\n    position: absolute;\r\n    top: 0;\r\n    left: 0;\r\n    width: 100%;\r\n    height: 100%;\r\n    overflow: hidden;\r\n  }\r\n\r\n  .flash-it {\r\n    -webkit-animation: flash linear 400ms forwards;\r\n    animation: flash linear 400ms forwards;\r\n  }\r\n\r\n  @keyframes flash {\r\n    0% {\r\n      opacity: 1;\r\n    }\r\n    25% {\r\n      opacity: .1;\r\n    }\r\n    50% {\r\n      opacity: 1;\r\n    }\r\n    75% {\r\n      opacity: .1;\r\n    }\r\n    100% {\r\n      opacity: 1;\r\n    }\r\n  }\r\n</style>\r\n","<script>\r\n\texport let data;\r\n</script>\r\n\r\n<div style=\"margin-bottom: 0.3rem;\"></div>\r\n","import SequencerFileCache from \"../../modules/sequencer-file-cache\";\n\nconst viewSize = 320;\nlet animatedSprite;\nlet offscreenApp;\nlet canvas;\nlet offscreenCanvas;\nlet oldImageSrcs = new Map();\n\nfunction initOffscreenApp(databaseStore) {\n\tif (offscreenApp) {\n\t\treturn;\n\t}\n\tcanvas = document.createElement(\"canvas\");\n\tcanvas.style.display = \"none\";\n\toffscreenCanvas = canvas.transferControlToOffscreen();\n\tconst backgroundColor = \n\toffscreenApp = new PIXI.Application({ autoStart: false, view: offscreenCanvas, backgroundColor: 0x999999, sharedTicker: false });\n\toffscreenApp.ticker.stop();\n\t// worker thread would be nice, but then we would need the webworker version of pixi.js too...\n\tdocument.body.appendChild(canvas);\n\t// workaround to fix errors when destroying the offscreen app\n\toffscreenCanvas.style = {}\n\toffscreenCanvas.width = viewSize;\n\toffscreenCanvas.height = viewSize;\n}\n\nexport async function playSpritesheet(file, databaseStore) {\n\tinitOffscreenApp(databaseStore);\n\tconst sheet = await SequencerFileCache.loadFile(file);\n\tif (!sheet) {\n\t\treturn;\n\t}\n\tSequencerFileCache.registerSpritesheet(file, sheet);\n\tconst frames = Object.values(sheet.animations)?.[0];\n\tif (!frames) {\n\t\treturn;\n\t}\n\tconst framerate = sheet.data?.meta?.framerate ?? 30;\n\tconst frametime = (1 / framerate) * 1000;\n\tdatabaseStore.metadata.set({\n\t\ttype: \"Spritesheet\",\n\t\tduration: Math.round(frametime * frames.length) + \"ms\",\n\t});\n\tif (!animatedSprite) {\n\t\tanimatedSprite = new PIXI.AnimatedSprite(frames, true);\n\t\tanimatedSprite.anchor.set(0.5);\n\t\tanimatedSprite.x = viewSize / 2;\n\t\tanimatedSprite.y = viewSize / 2;\n\t\toffscreenApp.stage.addChild(animatedSprite);\n\t}\n\tlet queuedFrame;\n\tlet renderedFrame;\n\tanimatedSprite.onFrameChange = async (frame) => {\n\t\t// rendering operation is async. If we're currently still rendering\n\t\t// the previous frame, don't even try to render the current one\n\t\tif (queuedFrame !== renderedFrame) {\n\t\t\treturn;\n\t\t}\n\t\tlet curerntImageSrc = oldImageSrcs.get(frame);\n\t\tif (!curerntImageSrc) {\n\t\t\tqueuedFrame = frame;\n\t\t\toffscreenApp.render()\n\t\t\tconst imageBlob = await offscreenCanvas.convertToBlob();\n\t\t\tcurerntImageSrc = URL.createObjectURL(imageBlob);\n\t\t\toldImageSrcs.set(frame, curerntImageSrc);\n\t\t\trenderedFrame = frame;\n\t\t}\n\t\tdatabaseStore.elements.image.src = curerntImageSrc;\n\t};\n\tanimatedSprite.textures = frames;\n\tanimatedSprite.scale.set(viewSize / Math.max(frames[0].width, frames[0].height));\n\tanimatedSprite.file = file;\n\tanimatedSprite.play();\n}\n\nexport async function cleanupSpritesheet(destroy = false) {\n\tif (!animatedSprite) {\n\t\treturn;\n\t}\n\tanimatedSprite.stop();\n\tanimatedSprite.onFrameChange = null;\n\tif (animatedSprite.file) {\n\t\tawait SequencerFileCache.unloadSpritesheet(animatedSprite.file);\n\t\tanimatedSprite.file = null;\n\t}\n\n\tfor (const objectUrl of oldImageSrcs.values()) {\n\t\tURL.revokeObjectURL(objectUrl);\n\t}\n\toldImageSrcs.clear();\n\tif (destroy) {\n\t\tanimatedSprite.destroy();\n\t\tanimatedSprite = null;\n\t\toffscreenApp.destroy();\n\t\tcanvas.remove()\n\t\toffscreenCanvas = null;\n\t\toffscreenApp = undefined;\n\t}\n}\n","import { get, writable } from \"svelte/store\";\nimport CONSTANTS from \"../../constants.js\";\nimport * as lib from \"../../lib/lib.js\";\nimport SequencerDatabase from \"../../modules/sequencer-database.js\";\nimport { SequencerFileBase } from \"../../modules/sequencer-file.js\";\nimport TreeViewEntry from \"./TreeViewEntry.svelte\";\nimport TreeViewSeparator from \"./TreeViewSeparator.svelte\";\nimport { cleanupSpritesheet, playSpritesheet } from \"./renderSpritesheet.js\";\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 isSpritesheet = lowerCaseEntry.endsWith(\"json\");\n  const isImage = !lowerCaseEntry.endsWith(\"webm\") && !isAudio && !isSpritesheet;\n  const isVideo = !isAudio && !isImage && !isSpritesheet;\n  const icon = previewFile\n    ? isVideo || isSpritesheet\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      : isSpritesheet\n        ? \"Spritesheet\"\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    isSpritesheet,\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    if (Array.isArray(entry)) {\n      entry = lib.random_array_element(entry);\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\tui.notifications.info(getFilepath ? \"Copied filepath to clipboard!\" : \"Copied database path to clipboard!\");\n}\n\nasync function playFile(entry) {\n  await cleanupSpritesheet()\n  const { file, isAudio, isImage, isVideo, isSpritesheet } = getFileData(entry);\n  databaseStore.elements.audio.classList.toggle(\"hidden\", !isAudio);\n  databaseStore.elements.image.classList.toggle(\"hidden\", !isImage && !isSpritesheet);\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  if (isSpritesheet) {\n    playSpritesheet(file, databaseStore);\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\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  fileTypes: writable(\"all\"),\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  cleanupSpritesheet() { cleanupSpritesheet(true) },\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 (!foundry.utils.getProperty(acc, path)) {\n          foundry.utils.setProperty(\n            acc,\n            path,\n            foundry.utils.mergeObject(\n              {\n                path: part,\n                fullPath,\n                open: false,\n                children: {},\n              },\n              foundry.utils.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 = foundry.utils.getProperty(tree, fullTreePath);\n    foundry.utils.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: foundry.utils.randomID(),\n        class: TreeViewSeparator,\n      });\n    }\n    return leaf;\n  });\n}\n\nexport { databaseStore };\n","<script>\r\n\r\n\r\n  import { createEventDispatcher } from \"svelte\";\r\n  import { databaseStore } from \"./DatabaseStore.js\";\r\n\r\n\tlet localize = game.i18n.localize.bind(game.i18n);\r\n\r\n  const dispatch = createEventDispatcher();\r\n\r\n\texport let entry;\r\n\r\n  const searchRegex = databaseStore.searchRegex;\r\n\r\n  let flashFilePath = false;\r\n  let flashDBPath = false;\r\n\r\n  $: highlight = entry.replace(\r\n    $searchRegex,\r\n\t\t\"<mark>$&</mark>\"\r\n\t);\r\n\r\n</script>\r\n\r\n<div\r\n\tclass=\"database-entry\"\r\n\tdata-id=\"{entry}\"\r\n>\r\n\t<button type=\"button\" class=\"btn_play\" title=\"{localize('SEQUENCER.Database.PlayPreview')}\" on:click={() => {\r\n    databaseStore.playFile(entry)\r\n  }}>\r\n\t\t<i class=\"fas fa-play\"></i>\r\n\t</button>\r\n\t<button type=\"button\" class=\"btn_copy_filepath\" title=\"{localize('SEQUENCER.Database.CopyFilePath')}\" on:click={(e) => {\r\n    databaseStore.copyPath(entry, true, e.ctrlKey)\r\n    flashFilePath = true;\r\n    setTimeout(() => {\r\n      flashFilePath = false\r\n    }, 400);\r\n    }}>\r\n\t\t<i class:flash-it={flashFilePath} class=\"fas fa-file\"></i>\r\n\t</button>\r\n\t<button type=\"button\" class=\"btn_copy_databasepath\" title=\"{localize('SEQUENCER.Database.CopyDatabasePath')}\" on:click={(e) => {\r\n    databaseStore.copyPath(entry, false, e.ctrlKey)\r\n    flashDBPath = true;\r\n    setTimeout(() => {\r\n      flashDBPath = false\r\n    }, 400);\r\n  }}>\r\n\t\t<i class:flash-it={flashDBPath} class=\"fas fa-database\"></i>\r\n\t</button>\r\n\r\n\t<div class=\"database-entry-text\" title=\"{entry}\">\r\n\t\t<div class=\"database-entry-text-highlight\">{@html highlight}</div>\r\n\t\t{entry}\r\n\t</div>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n  .database-entry{\r\n    display:flex;\r\n\t  flex-direction: row;\r\n    flex: 1 0 auto;\r\n  }\r\n\r\n  select, input {\r\n    color: black !important;\r\n    background: rgba(255, 255, 255, 0.5) !important;\r\n    margin-right: 0.25rem;\r\n  }\r\n\r\n  .database-entry > button{\r\n\t\tpadding-top: 3px;\r\n    font-size: 0.7rem !important;\r\n    min-height: 20px;\r\n    max-height: 20px;\r\n    min-width: 20px;\r\n    max-width: 20px;\r\n    line-height: normal;\r\n    margin-right: 2px !important;\r\n  }\r\n\r\n  .database-entry > button > i {\r\n    font-size: 0.7rem;\r\n  }\r\n\r\n  .btn_play * {\r\n    pointer-events: none;\r\n  }\r\n\r\n  .btn_copy_filepath, .btn_copy_databasepath{\r\n    min-width: 1.5rem;\r\n    padding: 0;\r\n  }\r\n\r\n  .database-entry > div{\r\n    flex: 1;\r\n    line-height:1.25rem;\r\n  }\r\n\r\n  .database-entry-text {\r\n    position: relative;\r\n\t\tmargin-left: 5px;\r\n  }\r\n\r\n  .database-entry-text-highlight {\r\n    pointer-events: none;\r\n    color: transparent;\r\n    position: absolute;\r\n    top: 0;\r\n    left: 0;\r\n    width: 100%;\r\n    height: 100%;\r\n    overflow: hidden;\r\n  }\r\n\r\n  .flash-it {\r\n    -webkit-animation: flash linear 400ms forwards;\r\n    animation: flash linear 400ms forwards;\r\n  }\r\n\r\n  @keyframes flash {\r\n    0% {\r\n      opacity: 1;\r\n    }\r\n    25% {\r\n      opacity: .1;\r\n    }\r\n    50% {\r\n      opacity: 1;\r\n    }\r\n    75% {\r\n      opacity: .1;\r\n    }\r\n    100% {\r\n      opacity: 1;\r\n    }\r\n  }\r\n\r\n</style>\r\n","/**\n * virtual list core calculating center\n */\n\nconst DIRECTION_TYPE = {\n    FRONT: \"FRONT\", // scroll up or left\n    BEHIND: \"BEHIND\", // scroll down or right\n}\nconst CALC_TYPE = {\n    INIT: \"INIT\",\n    FIXED: \"FIXED\",\n    DYNAMIC: \"DYNAMIC\",\n}\nconst LEADING_BUFFER = 2\n\nexport default class {\n    param\n    callUpdate\n    firstRangeTotalSize = 0\n    firstRangeAverageSize = 0\n    lastCalcIndex = 0\n    fixedSizeValue = 0\n    calcType = CALC_TYPE.INIT\n    offset = 0\n    direction = \"\"\n    range\n\n    constructor(param, callUpdate) {\n        this.init(param, callUpdate)\n    }\n\n    init(param, callUpdate) {\n        // param data\n        this.param = param\n        this.callUpdate = callUpdate\n\n        // size data\n        this.sizes = new Map()\n        this.firstRangeTotalSize = 0\n        this.firstRangeAverageSize = 0\n        this.fixedSizeValue = 0\n        this.calcType = CALC_TYPE.INIT\n\n        // scroll data\n        this.offset = 0\n        this.direction = \"\"\n\n        // range data\n        this.range = Object.create(null)\n        if (param) {\n            this.checkRange(0, param.keeps - 1)\n        }\n\n        // benchmark example data\n        // this.__bsearchCalls = 0\n        // this.__getIndexOffsetCalls = 0\n    }\n\n    destroy() {\n        this.init(null, null)\n    }\n\n    // return current render range\n    getRange() {\n        const range = Object.create(null)\n        range.start = this.range.start\n        range.end = this.range.end\n        range.padFront = this.range.padFront\n        range.padBehind = this.range.padBehind\n        return range\n    }\n\n    isBehind() {\n        return this.direction === DIRECTION_TYPE.BEHIND\n    }\n\n    isFront() {\n        return this.direction === DIRECTION_TYPE.FRONT\n    }\n\n    // return start index offset\n    getOffset(start) {\n        return (start < 1 ? 0 : this.getIndexOffset(start)) + this.param.slotHeaderSize\n    }\n\n    updateParam(key, value) {\n        if (this.param && (key in this.param)) {\n            // if uniqueIds change, find out deleted id and remove from size map\n            if (key === \"uniqueIds\") {\n                this.sizes.forEach((v, key) => {\n                    if (!value.includes(key)) {\n                        this.sizes.delete(key)\n                    }\n                })\n            }\n            this.param[key] = value\n        }\n    }\n\n    // save each size map by id\n    saveSize(id, size) {\n        this.sizes.set(id, size)\n\n        // we assume size type is fixed at the beginning and remember first size value\n        // if there is no size value different from this at next coming saving\n        // we think it's a fixed size list, otherwise is dynamic size list\n        if (this.calcType === CALC_TYPE.INIT) {\n            this.fixedSizeValue = size\n            this.calcType = CALC_TYPE.FIXED\n        } else if (this.calcType === CALC_TYPE.FIXED && this.fixedSizeValue !== size) {\n            this.calcType = CALC_TYPE.DYNAMIC\n            // it's no use at all\n            delete this.fixedSizeValue\n        }\n\n        // calculate the average size only in the first range\n        if (this.calcType !== CALC_TYPE.FIXED && typeof this.firstRangeTotalSize !== \"undefined\") {\n            if (this.sizes.size < Math.min(this.param.keeps, this.param.uniqueIds.length)) {\n                this.firstRangeTotalSize = [...this.sizes.values()].reduce((acc, val) => acc + val, 0)\n                this.firstRangeAverageSize = Math.round(this.firstRangeTotalSize / this.sizes.size)\n            } else {\n                // it's done using\n                delete this.firstRangeTotalSize\n            }\n        }\n    }\n\n    // in some special situation (e.g. length change) we need to update in a row\n    // try going to render next range by a leading buffer according to current direction\n    handleDataSourcesChange() {\n        let start = this.range.start\n\n        if (this.isFront()) {\n            start = start - LEADING_BUFFER\n        } else if (this.isBehind()) {\n            start = start + LEADING_BUFFER\n        }\n\n        start = Math.max(start, 0)\n\n        this.updateRange(this.range.start, this.getEndByStart(start))\n    }\n\n    // when slot size change, we also need force update\n    handleSlotSizeChange() {\n        this.handleDataSourcesChange()\n    }\n\n    // calculating range on scroll\n    handleScroll(offset) {\n        this.direction = offset < this.offset ? DIRECTION_TYPE.FRONT : DIRECTION_TYPE.BEHIND\n        this.offset = offset\n\n        if (!this.param) {\n            return\n        }\n\n        if (this.direction === DIRECTION_TYPE.FRONT) {\n            this.handleFront()\n        } else if (this.direction === DIRECTION_TYPE.BEHIND) {\n            this.handleBehind()\n        }\n    }\n\n    // ----------- public method end -----------\n\n    handleFront() {\n        const overs = this.getScrollOvers()\n        // should not change range if start doesn't exceed overs\n        if (overs > this.range.start) {\n            return\n        }\n\n        // move up start by a buffer length, and make sure its safety\n        const start = Math.max(overs - this.param.buffer, 0)\n        this.checkRange(start, this.getEndByStart(start))\n    }\n\n    handleBehind() {\n        const overs = this.getScrollOvers()\n        // range should not change if scroll overs within buffer\n        if (overs < this.range.start + this.param.buffer) {\n            return\n        }\n\n        this.checkRange(overs, this.getEndByStart(overs))\n    }\n\n    // return the pass overs according to current scroll offset\n    getScrollOvers() {\n        // if slot header exist, we need subtract its size\n        const offset = this.offset - this.param.slotHeaderSize\n        if (offset <= 0) {\n            return 0\n        }\n\n        // if is fixed type, that can be easily\n        if (this.isFixedType()) {\n            return Math.floor(offset / this.fixedSizeValue)\n        }\n\n        let low = 0\n        let middle = 0\n        let middleOffset = 0\n        let high = this.param.uniqueIds.length\n\n        while (low <= high) {\n            // this.__bsearchCalls++\n            middle = low + Math.floor((high - low) / 2)\n            middleOffset = this.getIndexOffset(middle)\n\n            if (middleOffset === offset) {\n                return middle\n            } else if (middleOffset < offset) {\n                low = middle + 1\n            } else if (middleOffset > offset) {\n                high = middle - 1\n            }\n        }\n\n        return low > 0 ? --low : 0\n    }\n\n    // return a scroll offset from given index, can efficiency be improved more here?\n    // although the call frequency is very high, its only a superposition of numbers\n    getIndexOffset(givenIndex) {\n        if (!givenIndex) {\n            return 0\n        }\n\n        let offset = 0\n        let indexSize = 0\n        for (let index = 0; index < givenIndex; index++) {\n            // this.__getIndexOffsetCalls++\n            indexSize = this.sizes.get(this.param.uniqueIds[index])\n            offset = offset + (typeof indexSize === \"number\" ? indexSize : this.getEstimateSize())\n        }\n\n        // remember last calculate index\n        this.lastCalcIndex = Math.max(this.lastCalcIndex, givenIndex - 1)\n        this.lastCalcIndex = Math.min(this.lastCalcIndex, this.getLastIndex())\n\n        return offset\n    }\n\n    // is fixed size type\n    isFixedType() {\n        return this.calcType === CALC_TYPE.FIXED\n    }\n\n    // return the real last index\n    getLastIndex() {\n        return this.param.uniqueIds.length - 1\n    }\n\n    // in some conditions range is broke, we need correct it\n    // and then decide whether need update to next range\n    checkRange(start, end) {\n        const keeps = this.param.keeps\n        const total = this.param.uniqueIds.length\n\n        // data less than keeps, render all\n        if (total <= keeps) {\n            start = 0\n            end = this.getLastIndex()\n        } else if (end - start < keeps - 1) {\n            // if range length is less than keeps, correct it base on end\n            start = end - keeps + 1\n        }\n\n        if (this.range.start !== start) {\n            this.updateRange(start, end)\n        }\n    }\n\n    // setting to a new range and rerender\n    updateRange(start, end) {\n        this.range.start = start\n        this.range.end = end\n        this.range.padFront = this.getPadFront()\n        this.range.padBehind = this.getPadBehind()\n        this.callUpdate(this.getRange())\n    }\n\n    // return end base on start\n    getEndByStart(start) {\n        const theoryEnd = start + this.param.keeps - 1\n        const truelyEnd = Math.min(theoryEnd, this.getLastIndex())\n        return truelyEnd\n    }\n\n    // return total front offset\n    getPadFront() {\n        if (this.isFixedType()) {\n            return this.fixedSizeValue * this.range.start\n        } else {\n            return this.getIndexOffset(this.range.start)\n        }\n    }\n\n    // return total behind offset\n    getPadBehind() {\n        const end = this.range.end\n        const lastIndex = this.getLastIndex()\n\n        if (this.isFixedType()) {\n            return (lastIndex - end) * this.fixedSizeValue\n        }\n\n        // if it's all calculated, return the exactly offset\n        if (this.lastCalcIndex === lastIndex) {\n            return this.getIndexOffset(lastIndex) - this.getIndexOffset(end)\n        } else {\n            // if not, use a estimated value\n            return (lastIndex - end) * this.getEstimateSize()\n        }\n    }\n\n    // get the item estimate size\n    getEstimateSize() {\n        return this.isFixedType() ? this.fixedSizeValue : (this.firstRangeAverageSize || this.param.estimateSize)\n    }\n}\n\nexport function isBrowser() {\n    return typeof document !== \"undefined\"\n}","<script>\n    import {afterUpdate, createEventDispatcher, onDestroy, onMount} from \"svelte\"\n\n    export let horizontal = false\n    export let uniqueKey\n    export let type = \"item\"\n\n    let resizeObserver\n    let itemDiv\n    let previousSize\n\n    const dispatch = createEventDispatcher()\n    const shapeKey = horizontal ? \"offsetWidth\" : \"offsetHeight\"\n\n    onMount(() => {\n        if (typeof ResizeObserver !== \"undefined\") {\n            resizeObserver = new ResizeObserver(dispatchSizeChange)\n            resizeObserver.observe(itemDiv)\n        }\n    })\n    afterUpdate(dispatchSizeChange)\n    onDestroy(() => {\n        if (resizeObserver) {\n            resizeObserver.disconnect()\n            resizeObserver = null\n        }\n    })\n\n    function dispatchSizeChange() {\n        const size = itemDiv ? itemDiv[shapeKey] : 0\n        if (size === previousSize) return\n        previousSize = size\n        dispatch(\"resize\", {id: uniqueKey, size, type})\n    }\n</script>\n\n<div bind:this={itemDiv} class=\"virtual-scroll-item\">\n    <slot/>\n</div>\n","<script>\n    import Virtual, {isBrowser} from \"./virtual\"\n    import Item from \"./Item.svelte\"\n    import {createEventDispatcher, onDestroy, onMount} from \"svelte\"\n\n    /**\n     * Unique key for getting data from `data`\n     * @type {string}\n     */\n    export let key = \"id\"\n    /**\n     * Source for list\n     * @type {Array<any>}\n     */\n    export let data\n    /**\n     * Count of rendered items\n     * @type {number}\n     */\n    export let keeps = 30\n    /**\n     * Estimate size of each item, needs for smooth scrollbar\n     * @type {number}\n     */\n    export let estimateSize = 50\n    /**\n     * Scroll direction\n     * @type {boolean}\n     */\n    export let isHorizontal = false\n    /**\n     * scroll position start index\n     */\n    export let start = 0\n    /**\n     * scroll position offset\n     */\n    export let offset = 0\n    /**\n     * Let virtual list using global document to scroll through the list\n     * @type {boolean}\n     */\n    export let pageMode = false\n    /**\n     * The threshold to emit `top` event, attention to multiple calls.\n     * @type {number}\n     */\n    export let topThreshold = 0\n    /**\n     * The threshold to emit `bottom` event, attention to multiple calls.\n     * @type {number}\n     */\n    export let bottomThreshold = 0\n\n    let displayItems = []\n    let paddingStyle\n    let directionKey = isHorizontal ? \"scrollLeft\" : \"scrollTop\"\n    let range = null\n    let virtual = new Virtual({\n        slotHeaderSize: 0,\n        slotFooterSize: 0,\n        keeps: keeps,\n        estimateSize: estimateSize,\n        buffer: Math.round(keeps / 3), // recommend for a third of keeps\n        uniqueIds: getUniqueIdFromDataSources(),\n    }, onRangeChanged)\n    let root\n    let shepherd\n    const dispatch = createEventDispatcher()\n\n    /**\n     * @type {(id: number) => number}\n     */\n    export function getSize(id) {\n        return virtual.sizes.get(id)\n    }\n\n    /**\n     * Count of items\n     * @type {() => number}\n     */\n    export function getSizes() {\n        return virtual.sizes.size\n    }\n\n    /**\n     * @type {() => number}\n     */\n    export function getOffset() {\n        if (pageMode && isBrowser()) {\n            return document.documentElement[directionKey] || document.body[directionKey]\n        } else {\n            return root ? Math.ceil(root[directionKey]) : 0\n        }\n    }\n\n    /**\n     * @type {() => number}\n     */\n    export function getClientSize() {\n        const key = isHorizontal ? \"clientWidth\" : \"clientHeight\"\n        if (pageMode && isBrowser()) {\n            return document.documentElement[key] || document.body[key]\n        } else {\n            return root ? Math.ceil(root[key]) : 0\n        }\n    }\n\n    /**\n     * @type {() => number}\n     */\n    export function getScrollSize() {\n        const key = isHorizontal ? \"scrollWidth\" : \"scrollHeight\"\n        if (pageMode && isBrowser()) {\n            return document.documentElement[key] || document.body[key]\n        } else {\n            return root ? Math.ceil(root[key]) : 0\n        }\n    }\n\n    /**\n     * @type {() => void}\n     */\n    export function updatePageModeFront() {\n        if (root && isBrowser()) {\n            const rect = root.getBoundingClientRect()\n            const {defaultView} = root.ownerDocument\n            const offsetFront = isHorizontal ? (rect.left + defaultView.pageXOffset) : (rect.top + defaultView.pageYOffset)\n            virtual.updateParam(\"slotHeaderSize\", offsetFront)\n        }\n    }\n\n    /**\n     * @type {(offset: number) => void}\n     */\n    export function scrollToOffset(offset) {\n        if (!isBrowser()) return\n        if (pageMode) {\n            document.body[directionKey] = offset\n            document.documentElement[directionKey] = offset\n        } else if (root) {\n            root[directionKey] = offset\n        }\n    }\n\n    /**\n     * @type {(index: number) => void}\n     */\n    export function scrollToIndex(index) {\n        if (index >= data.length - 1) {\n            scrollToBottom()\n        } else {\n            const offset = virtual.getOffset(index)\n            scrollToOffset(offset)\n        }\n    }\n\n    /**\n     * @type {() => void}\n     */\n    export function scrollToBottom() {\n        if (shepherd) {\n            const offset = shepherd[isHorizontal ? \"offsetLeft\" : \"offsetTop\"]\n            scrollToOffset(offset)\n\n            // check if it's really scrolled to the bottom\n            // maybe list doesn't render and calculate to last range,\n            // so we need retry in next event loop until it really at bottom\n            setTimeout(() => {\n                if (getOffset() + getClientSize() + 1 < getScrollSize()) {\n                    scrollToBottom()\n                }\n            }, 3)\n        }\n    }\n\n    onMount(() => {\n        if (start) {\n            scrollToIndex(start)\n        } else if (offset) {\n            scrollToOffset(offset)\n        }\n\n        if (pageMode) {\n            updatePageModeFront()\n\n            document.addEventListener(\"scroll\", onScroll, {\n                passive: false,\n            })\n        }\n    })\n\n    onDestroy(() => {\n        virtual.destroy()\n        if (pageMode && isBrowser()) {\n            document.removeEventListener(\"scroll\", onScroll)\n        }\n    })\n\n    function getUniqueIdFromDataSources() {\n        return data.map((dataSource) => dataSource[key])\n    }\n\n    function onItemResized(event) {\n        const {id, size, type} = event.detail\n        if (type === \"item\")\n            virtual.saveSize(id, size)\n        else if (type === \"slot\") {\n            if (id === \"header\")\n                virtual.updateParam(\"slotHeaderSize\", size)\n            else if (id === \"footer\")\n                virtual.updateParam(\"slotFooterSize\", size)\n\n            // virtual.handleSlotSizeChange()\n        }\n    }\n\n    function onRangeChanged(range_) {\n        range = range_\n        paddingStyle = paddingStyle = isHorizontal ? `0px ${range.padBehind}px 0px ${range.padFront}px` : `${range.padFront}px 0px ${range.padBehind}px`\n        displayItems = data.slice(range.start, range.end + 1)\n    }\n\n    function onScroll(event) {\n        const offset = getOffset()\n        const clientSize = getClientSize()\n        const scrollSize = getScrollSize()\n\n        // \biOS scroll-spring-back behavior will make direction mistake\n        if (offset < 0 || (offset + clientSize > scrollSize) || !scrollSize) {\n            return\n        }\n\n        virtual.handleScroll(offset)\n        emitEvent(offset, clientSize, scrollSize, event)\n    }\n\n    function emitEvent(offset, clientSize, scrollSize, event) {\n        dispatch(\"scroll\", {event, range: virtual.getRange()})\n\n        if (virtual.isFront() && !!data.length && (offset - topThreshold <= 0)) {\n            dispatch(\"top\")\n        } else if (virtual.isBehind() && (offset + clientSize + bottomThreshold >= scrollSize)) {\n            dispatch(\"bottom\")\n        }\n    }\n\n    $: scrollToOffset(offset)\n    $: scrollToIndex(start)\n    $: handleKeepsChange(keeps)\n\n    function handleKeepsChange(keeps) {\n        virtual.updateParam(\"keeps\", keeps)\n        virtual.handleSlotSizeChange()\n    }\n\n    $: handleDataSourcesChange(data)\n\n    async function handleDataSourcesChange(data) {\n        virtual.updateParam(\"uniqueIds\", getUniqueIdFromDataSources())\n        virtual.handleDataSourcesChange()\n    }\n</script>\n\n<div bind:this={root} on:scroll={onScroll} style=\"overflow-y: auto; height: inherit\" class=\"virtual-scroll-root\">\n    {#if $$slots.header}\n        <Item on:resize={onItemResized} type=\"slot\" uniqueKey=\"header\">\n            <slot name=\"header\"/>\n        </Item>\n    {/if}\n    <div style=\"padding: {paddingStyle}\" class=\"virtual-scroll-wrapper\">\n        {#each displayItems as dataItem, dataIndex (dataItem[key])}\n            <Item\n                    on:resize={onItemResized}\n                    uniqueKey={dataItem[key]}\n                    horizontal={isHorizontal}\n                    type=\"item\">\n                <slot data={dataItem} index={dataIndex} />\n            </Item>\n        {/each}\n    </div>\n    {#if $$slots.footer}\n        <Item on:resize={onItemResized} type=\"slot\" uniqueKey=\"footer\">\n            <slot name=\"footer\"/>\n        </Item>\n    {/if}\n    <div bind:this={shepherd} class=\"shepherd\"\n         style=\"width: {isHorizontal ? '0px' : '100%'};height: {isHorizontal ? '100%' : '0px'}\"></div>\n</div>\n","<script>\r\n\r\n  import { onDestroy } from \"svelte\";\r\n\r\n  import DatabaseEntry from \"./DatabaseEntry.svelte\";\r\n  import VirtualScroll from \"svelte-virtual-scroll-list\";\r\n\r\n  import SequencerDatabase from \"../../modules/sequencer-database.js\";\r\n  import { databaseStore } from \"./DatabaseStore.js\";\r\n  import * as lib from \"../../lib/lib.js\";\r\n  import CONSTANTS from \"../../constants.js\";\r\n\r\n\tlet localize = game.i18n.localize.bind(game.i18n);\r\n\r\n  let entries = [];\r\n\r\n  let filteredEntries = [];\r\n\r\n  const selectedPackStore = databaseStore.selectedPackStore;\r\n  const packStore = databaseStore.packStore;\r\n  const fileTypes = databaseStore.fileTypes;\r\n  const metadata = databaseStore.metadata;\r\n  const allRanges = databaseStore.allRanges;\r\n  const subLists = databaseStore.subLists;\r\n  const listView = databaseStore.listView;\r\n  const visibleTreeStore = databaseStore.visibleTreeStore;\r\n  const search = databaseStore.search;\r\n  const cleanSearchStore = databaseStore.cleanSearchStore;\r\n  const searchRegex = databaseStore.searchRegex;\r\n  const entriesStore = SequencerDatabase.entriesStore;\r\n\r\n  listView.set(game.settings.get(CONSTANTS.MODULE_NAME, \"db-list-view\"));\r\n\r\n  $: game.settings.set(CONSTANTS.MODULE_NAME, \"db-list-view\", $listView);\r\n\r\n  $: {\r\n    $entriesStore;\r\n    const specificRanges = $allRanges\r\n    ? Sequencer.Database.publicFlattenedEntriesAdvanced\r\n    : Sequencer.Database.publicFlattenedSimpleEntries;\r\n    entries = specificRanges.map(\r\n      (entry) => {\r\n        if (typeof entry === \"string\"){\r\n        return {\r\n          pack: entry.split(\".\")[0],\r\n          entry: entry,\r\n        };\r\n      } else {\r\n        return {\r\n          pack: entry.path.split(\".\")[0],\r\n          entry: entry.path,\r\n          isAudio: entry.isAudio,\r\n        };\r\n        }\r\n      }\r\n    );\r\n  }\r\n\r\n  $: {\r\n    if (!$allRanges) $fileTypes = \"all\"\r\n  }\r\n\r\n  $: {\r\n    const searchParts = $cleanSearchStore.split('|');\r\n    filteredEntries = entries.filter((part) => {\r\n      const matchParts = lib.make_array_unique(part.entry.match($searchRegex) || []);\r\n      return (\r\n        ($selectedPackStore === \"all\" || $selectedPackStore === part.pack) &&\r\n        ($search === \"\" || matchParts.length >= searchParts.length) &&\r\n        (\r\n          $fileTypes === \"all\"\r\n          || ($fileTypes === \"video\" && !part.isAudio)\r\n          || ($fileTypes === \"sound\" && part.isAudio)\r\n        )\r\n      );\r\n    });\r\n  }\r\n\r\n  onDestroy(() => databaseStore.cleanupSpritesheet());\r\n</script>\r\n\r\n<div class=\"sequencer-database-content\">\r\n\r\n\t<div class=\"sequencer-database-header\">\r\n\t\t<select bind:value={$selectedPackStore} name=\"pack-select\">\r\n\t\t\t<option value=\"all\">{localize(\"SEQUENCER.Database.AllPacks\")}</option>\r\n\t\t\t{#each $packStore as pack, index}\r\n\t\t\t\t<option>{ pack }</option>\r\n\t\t\t{/each}\r\n\t\t</select>\r\n    <select name=\"file-select\" disabled={!$allRanges} title={$allRanges ? \"\" : localize(\"SEQUENCER.Database.FileTypePredicate\")} bind:value={$fileTypes}>\r\n\t\t\t<option value=\"all\">{localize(\"SEQUENCER.Database.All\")}</option>\r\n\t\t\t<option value=\"video\">{localize(\"SEQUENCER.Database.Video\")}</option>\r\n\t\t\t<option value=\"sound\">{localize(\"SEQUENCER.Database.Sound\")}</option>\r\n\t\t</select>\r\n\t\t<input bind:value={$search} class=\"ml-2\" placeholder='{localize(\"SEQUENCER.Database.Search\")}' type=\"text\">\r\n\t\t<input bind:checked={$allRanges} class=\"ml-2\" id=\"database-all-ranges\" type=\"checkbox\">\r\n\t\t<label class=\"all-ranges-label\" for=\"database-all-ranges\">{localize(\"SEQUENCER.Database.ShowAllRanges\")}</label>\r\n\t\t<input bind:checked={$subLists} class=\"ml-2\" id=\"include-sub-lists\" type=\"checkbox\">\r\n\t\t<label class=\"all-ranges-label\" for=\"include-sub-lists\">{localize(\"SEQUENCER.Database.ShowSubLists\")}</label>\r\n\t\t<input bind:checked={$listView} class=\"ml-2\" id=\"treeview\" type=\"checkbox\">\r\n\t\t<label class=\"all-ranges-label\" for=\"treeview\">{localize(\"SEQUENCER.Database.ListView\")}</label>\r\n\t</div>\r\n\r\n\t<div class=\"sequencer-database-entries-container\">\r\n\r\n\t\t{#if $listView}\r\n      <div class=\"sequencer-database-entries\">\r\n        <VirtualScroll\r\n          data={filteredEntries}\r\n          key=\"entry\"\r\n          let:data\r\n        >\r\n          <DatabaseEntry entry={data.entry}/>\r\n        </VirtualScroll>\r\n      </div>\r\n\t\t{:else}\r\n      <div class=\"sequencer-database-entries-tree\">\r\n        <VirtualScroll\r\n          data={$visibleTreeStore}\r\n          key=\"fullPath\"\r\n          let:data\r\n        >\r\n          <svelte:component this={data.class} {data}/>\r\n        </VirtualScroll>\r\n      </div>\r\n\t\t{/if}\r\n\r\n\t\t<div class=\"sequencer-database-player-container\">\r\n      <div class=\"sequencer-database-player-content\">\r\n\t\t\t<video autoplay bind:this={databaseStore.elements.player} class=\"database-player\" crossorigin=\"anonymous\" height=\"335\" loop\r\n\t\t\t\t\t\t on:mouseenter={() => { databaseStore.elements.player.controls = true; }}\r\n\t\t\t\t\t\t on:mouseleave={() => { databaseStore.elements.player.controls = false; }}\r\n\t\t\t\t\t\t preload\r\n\t\t\t\t\t\t width=\"335\"\r\n\t\t\t>\r\n\t\t\t</video>\r\n\t\t\t<img bind:this={databaseStore.elements.image} class=\"database-image hidden\">\r\n\t\t\t<audio controls autoplay bind:this={databaseStore.elements.audio} class=\"database-audio hidden\">\r\n\t\t\t\t<source type=\"audio\">\r\n\t\t\t</audio>\r\n    </div>\r\n\t\t\t<div class=\"sequencer-database-metadata-footer\">\r\n\t\t\t\t{#if $metadata}\r\n\t\t\t\t\tType: {$metadata.type} | Duration: {$metadata.duration}\r\n\t\t\t\t{:else}\r\n\t\t\t\t\tNo file loaded...\r\n\t\t\t\t{/if}\r\n\t\t\t</div>\r\n\t\t</div>\r\n\r\n\t</div>\r\n\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n  .sequencer-database {\r\n    &-content {\r\n      display: flex;\r\n      flex-direction: column;\r\n    }\r\n\r\n    &-header {\r\n      display: flex;\r\n      align-items: center;\r\n      flex-direction: row;\r\n\r\n      > select {\r\n\t\t\t\tflex: 0 1 auto;\r\n        border-radius: 5px 0 0 5px;\r\n        border-right: 1px solid #282828;\r\n        height: 28px;\r\n\r\n        & + select {\r\n          border-radius: 0 0 0 0;\r\n        }\r\n\r\n\t      &:not(:first-child) {\r\n\t\t      border-left: 0;\r\n        }\r\n      }\r\n\r\n      > input[type=\"text\"] {\r\n        border-radius: 0 5px 5px 0;\r\n        padding-left: 0.5rem;\r\n\t      border-left: 0;\r\n        height: 28px;\r\n      }\r\n\r\n\t\t\t> label {\r\n\t\t\t\tflex: 1 0 auto;\r\n        padding-right: 0.25rem;\r\n\t\t\t}\r\n    }\r\n\r\n    &-entries-container {\r\n      padding-top: 0.5rem;\r\n      max-height: calc(420px - 5rem);\r\n      display: flex;\r\n    }\r\n\r\n    &-entries {\r\n      height: 339px;\r\n      flex: 1;\r\n      margin-right: 0.5rem;\r\n\r\n\t\t\t& :global(.virtual-scroll-item) {\r\n        padding: 2px;\r\n        margin-right: 5px;\r\n        border-radius: 4px;\r\n      }\r\n\r\n      & :global(.virtual-scroll-item):nth-child(odd) {\r\n        background-color: rgba(0, 0, 0, 0.1);\r\n      }\r\n    }\r\n\r\n    &-entries-tree {\r\n      height: 339px;\r\n      flex: 1;\r\n      margin-right: 0.5rem;\r\n\r\n      & :global(.virtual-scroll-item) {\r\n        padding: 2px;\r\n        margin-right: 5px;\r\n        border-radius: 4px;\r\n        min-height: 0px;\r\n        max-height: 17px;\r\n        height: auto;\r\n      }\r\n    }\r\n\r\n    &-player-container {\r\n      display: flex;\r\n      flex-direction: column;\r\n      align-items: center;\r\n      width: 335px;\r\n      height: 342.5px;\r\n    }\r\n\r\n    &-player-content {\r\n      display: flex;\r\n      flex: 1;\r\n      vertical-align: middle;\r\n\r\n      width: 320px;\r\n      height: 320px;\r\n      max-width: 320px;\r\n      max-height: 320px;\r\n      border-radius: 5px;\r\n    }\r\n\r\n    &-metadata-footer {\r\n      text-align: center;\r\n      margin-top: 5px;\r\n      flex: 0;\r\n    }\r\n  }\r\n\r\n  .hidden {\r\n    display: none;\r\n  }\r\n\r\n  .database-player-container {\r\n    padding: 5px;\r\n    width: 355px;\r\n    height: 355px;\r\n  }\r\n\r\n  .database-player {\r\n    background-color: #999999;\r\n    padding: 10px;\r\n    max-width: 320px;\r\n    height: 320px;\r\n    max-height: 320px;\r\n\t\tmin-height: 320px;\r\n  }\r\n\r\n  .database-image {\r\n    max-width: 320px;\r\n    height: 320px;\r\n    max-height: 320px;\r\n    min-height: 320px;\r\n  }\r\n\r\n  .database-audio {\r\n    margin: auto;\r\n  }\r\n\r\n</style>\r\n","import { mount, unmount } from 'svelte';\r\nimport { writable } from \"svelte/store\";\r\n\r\n/**\r\n * Mixin that adds a Svelte root component to a Foundry V2 application.\r\n * @param {typeof foundry.applications.api.ApplicationV2} Base\r\n */\r\nfunction SvelteApplicationMixin(Base) {\r\n\tclass SvelteApplication extends Base {\r\n\t\tstatic DEFAULT_OPTIONS = {\r\n\t\t\tclasses: [],\r\n\t\t};\r\n\r\n\t\t/** Root Svelte component (set this in your subclass) */\r\n\t\t// root\r\n\r\n\t\t/** State data tracked by the root component */\r\n\t\t$state = writable({});\r\n\r\n\t\t/** The mounted root component, saved to be unmounted on application close */\r\n\t\t#mount = {};\r\n\r\n\t\troot = null;\r\n\r\n\t\tasync _renderHTML(context) {\r\n\t\t\treturn context;\r\n\t\t}\r\n\r\n\t\tasync _prepareContext() {\r\n\t\t\treturn {\r\n\t\t\t\t...this.options,\r\n\t\t\t\tfoundryApp: this\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t_replaceHTML(result, content, options) {\r\n\t\t\tthis.$state.update((s) => ({ ...s, ...(result.state ?? {}) }));\r\n\t\t\tif (options.isFirstRender) {\r\n\t\t\t\tthis.#mount = mount(this.root, { target: content, props: { ...result, ...options, state: this.$state } });\r\n\t\t\t}\r\n\t\t\tthis.updateElementProps(result, options);\r\n\t\t}\r\n\r\n\t\tupdateElementProps(result, options) {\r\n\t\t\tif (!this.#mount) return;\r\n\r\n\t\t\t// Set props as properties on the custom element\r\n\t\t\tObject.assign(this.#mount, {\r\n\t\t\t\t...result,\r\n\t\t\t\t...options,\r\n\t\t\t\tstate: this.$state,\r\n\t\t\t\tfoundryApp: this,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t_onClose(options) {\r\n\t\t\tsuper._onClose(options);\r\n\t\t\tunmount(this.#mount);\r\n\t\t}\r\n\r\n\t\tstatic getActiveApp() {\r\n\t\t\tconst app_v1s = Object.values(ui.windows);\r\n\t\t\tlet all_apps = app_v1s.concat(\r\n\t\t\t\tfoundry?.applications?.instances\r\n\t\t\t\t\t? Array.from(foundry?.applications?.instances.values())\r\n\t\t\t\t\t: []\r\n\t\t\t)\r\n\t\t\treturn all_apps.find((app) => {\r\n\t\t\t\treturn (\r\n\t\t\t\t\tapp instanceof this && app.state > Application.RENDER_STATES.CLOSED\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tstatic async show(options = {}) {\r\n\t\t\tconst existingApp = this.getActiveApp();\r\n\t\t\tif (existingApp) return existingApp.render({ ...options, force: true, focus: true });\r\n\t\t\treturn new this(options).render({ force: true, focus: true });\r\n\t\t}\r\n\t}\r\n\r\n\treturn SvelteApplication;\r\n}\r\n\r\nexport { SvelteApplicationMixin };","import DatabaseShell from \"./database-shell.svelte\";\nimport { SvelteApplicationMixin } from \"../SvelteMixin.js\";\n\nconst PATREON_URL = \"https://patreon.com/cw/fantasycomputerworks\";\n\nexport class DatabaseViewerApp extends SvelteApplicationMixin(foundry.applications.api.ApplicationV2) {\n\n\tstatic DEFAULT_OPTIONS = {\n\t\tclasses: [\"dialog\"],\n\t\tposition: {\n\t\t\twidth: 900,\n\t\t\theight: 450,\n\t\t},\n\t\tactions: {\n\t\t\topenSequencerChangelog: () => {\n\t\t\t\tif (window.Sequencer?.showChangelog) window.Sequencer.showChangelog();\n\t\t\t},\n\t\t\topenSequencerPatreon: () => {\n\t\t\t\twindow.open(PATREON_URL, \"_blank\", \"noopener\");\n\t\t\t},\n\t\t},\n\t\twindow: {\n\t\t\ttitle: \"SEQUENCER.Database.Title\",\n\t\t\ticon: \"fa-solid fa-archive\",\n\t\t\tresizable: true,\n\t\t\tcontrols: [\n\t\t\t\t{\n\t\t\t\t\taction: \"openSequencerChangelog\",\n\t\t\t\t\ticon: \"fa-solid fa-clipboard-list\",\n\t\t\t\t\tlabel: \"Changelog\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\taction: \"openSequencerPatreon\",\n\t\t\t\t\ticon: \"fa-brands fa-patreon\",\n\t\t\t\t\tlabel: \"Support Sequencer\",\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t};\n\n\troot = DatabaseShell;\n}\n","<script>\r\n\tlet localize = game.i18n.localize.bind(game.i18n);\r\n\timport * as lib from \"../../lib/lib.js\"\r\n\r\n\tasync function openSettings() {\r\n\r\n\t\tconst settings = new foundry.applications.settings.SettingsConfig({ initialCategory: \"sequencer\" });\r\n\r\n\t\tawait settings.render(true)\r\n\r\n\t\tawait lib.wait(75);\r\n\r\n\t\tconst focusElement = settings.element.querySelector('select[name=\"sequencer.permissions-effect-create\"]');\r\n\r\n\t\tconst scrollable = settings.element.querySelector(\"section.tab.scrollable.active\")\r\n\r\n\t\tscrollable.scrollTo({ top: focusElement.offsetTop - 100, behavior: \"smooth\" });\r\n\r\n\t\tawait lib.wait(250);\r\n\r\n\t\tfocusElement.parentNode.parentNode.style.transition = \"box-shadow 0.5s ease-in-out\";\r\n\t\tfocusElement.parentNode.parentNode.style.boxShadow = \"rgba(200, 64, 67, 0.75) inset 0 0 10px, rgba(200, 64, 67, 0.75) 0 0 10px\";\r\n\r\n\t\tawait lib.wait(5000);\r\n\r\n\t\tfocusElement.parentNode.parentNode.style.boxShadow = \"none\";\r\n\r\n\t\tawait lib.wait(500);\r\n\r\n\t\tfocusElement.parentNode.parentNode.style.transition = \"none\";\r\n\r\n\t}\r\n\r\n</script>\r\n\r\n<div class=\"howto-container\">\r\n\t<p>{@html localize(\"SEQUENCER.HowTo.Welcome\")}</p>\r\n\t<p>{@html localize(\"SEQUENCER.HowTo.Explanation\")}</p>\r\n\t{#if game.user.isGM}\r\n\t\t<p>{@html localize(\"SEQUENCER.HowTo.PermissionsExplanation\")}</p>\r\n\t\t<button type=\"button\" class=\"w-100 open-module-settings\" on:click={openSettings}>\r\n\t\t\t<i class=\"fas fa-plug\"></i> {@html localize(\"SEQUENCER.HowTo.OpenModuleSettings\")}\r\n\t\t</button>\r\n\t{/if}\r\n\t<p>{@html localize(\"SEQUENCER.HowTo.PlayerExplanation\")}</p>\r\n\t<p>{@html localize(\"SEQUENCER.HowTo.LayerExplanation\")}</p>\r\n\t<ol>\r\n\t\t<li>\r\n\t\t\t<strong>{@html localize(\"SEQUENCER.HowTo.Click\")}</strong><br>\r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.ClickLabel\")}\r\n\t\t</li>\r\n\t\t<li>\r\n\t\t\t<strong>{@html localize(\"SEQUENCER.HowTo.ClickDrag\")}</strong><br>\r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.ClickDragLabel\")}\r\n\t\t</li>\r\n\t\t<li>\r\n\t\t\t<strong>{@html localize(\"SEQUENCER.HowTo.Shift\")}</strong><br>\r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.ShiftLabel\")}\r\n\t\t</li>\r\n\t\t<li>\r\n\t\t\t<strong>{@html localize(\"SEQUENCER.HowTo.ShiftControl\")}</strong><br>\r\n\t\t\t{@html localize(\"SEQUENCER.HowTo.ShiftControlLabel\")}\r\n\t\t</li>\r\n\t\t<li>\r\n\t\t\t<strong>{@html localize(\"SEQUENCER.HowTo.MoreToCome\")}</strong>\r\n\t\t</li>\r\n\t</ol>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n  .howto-container {\r\n    min-width: 320px;\r\n    max-width: 320px;\r\n    min-height: 563px;\r\n\r\n    li {\r\n      list-style: none;\r\n      margin-bottom: 0.5rem;\r\n    }\r\n  }\r\n\r\n</style>\r\n","<script>\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n\r\n  export let activeTab;\r\n  export let tabs;\r\n  export let underscore = false;\r\n  export let separateElements = false;\r\n\r\n</script>\r\n\r\n<nav class=\"tabs\" data-group=\"primary\" style={$$props.style}>\r\n\t{#each tabs.filter(tab => !tab.hidden) as tab, index (tab.value)}\r\n\t\t{#if separateElements && index > 0}\r\n\t\t\t<div style=\"border-right: 1px solid rgba(0,0,0,0.5); margin: 0 10px;\"></div>\r\n\t\t{/if}\r\n\t\t<div on:click={() => { activeTab = tab.value}}\r\n\t\t\t\t class=\"item item-piles-flexrow item-piles-clickable-link\"\r\n\t\t\t\t class:underscore={underscore}\r\n\t\t\t\t class:active={activeTab === tab.value}\r\n\t\t\t\t data-tab=\"rest\">\r\n\t\t\t{#if tab.icon} <i class=\"icon {tab.icon}\"></i> {/if}\r\n\t\t\t{localize(tab.label)}\r\n\t\t</div>\r\n\t{/each}\r\n</nav>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n  .tabs {\r\n\t\tflex: 0;\r\n    border-bottom: 1px solid rgba(0, 0, 0, 0.25);\r\n    margin-bottom: 0.5rem;\r\n    padding-bottom: 0.5rem;\r\n  }\r\n\r\n  .item {\r\n    display: flex;\r\n    flex-direction: row;\r\n    align-items: center;\r\n    border-bottom: 2px solid transparent;\r\n\r\n    &.active {\r\n      text-shadow: 0 0 10px rgba(255,0,0,1);\r\n\r\n      &.underscore {\r\n        text-shadow: none;\r\n        border-bottom: 2px solid rgba(125, 0, 0, 0.5);\r\n      }\r\n    }\r\n  }\r\n\r\n  .icon {\r\n    margin-right: 0.25rem;\r\n  }\r\n\r\n</style>\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((sounds) => {\n    sounds[id] = data;\n    return sounds;\n  });\n};\n\nSequenceManager.RunningSounds.delete = (id) => {\n  SequenceManager.RunningSounds.update((sounds) => {\n    delete sounds[id];\n    return sounds;\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        sequence.status === CONSTANTS.STATUS.COMPLETE ||\n        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.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 = new Map();\n    for (let [key, value] of Object.entries(inData)) {\n      if (value === undefined || value === null) continue;\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      super[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  get hue() {\n    return this.values?.hue ?? 0\n  }\n  set hue(value) {\n    this.values.hue = value\n    super.hue(value)\n    this.setOthers('hue')\n  }\n\n\n  get contrast() {\n    return this.values?.contrast ?? 0\n  }\n  set contrast(value) {\n    this.values.contrast = value\n    super.contrast(value)\n  }\n\n\n  get brightness() {\n    return this.values?.brightness ?? 0\n  }\n  set brightness(value) {\n    this.values.brightness = value\n    super.brightness(value)\n  }\n\n  get saturate() {\n    return this.values?.saturate ?? 0\n  }\n  set saturate(value) {\n    this.values.saturate = value\n    super.saturate(value)\n  }\n\n  setOthers(ignoreKey) {\n    for (let [key, value] of this.values.entries) {\n      if (key === ignoreKey) continue\n      this.setValue(key, value)\n    }\n  }\n}\n","export default class BlurFilter extends globalThis.PIXI.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.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.Filter {\n\n\tstatic defaults = {\n\t\tdistance: 10,\n\t\touterStrength: 4,\n\t\tinnerStrength: 0,\n\t\tcolor: 0xffffff,\n\t\tquality: 0.1,\n\t\tknockout: false,\n\t\talpha: 1,\n\t}\n\n\n\tconstructor(options) {\n\n\t\tconst opts = Object.assign({}, GlowFilter.defaults, options);\n\t\tconst {\n\t\t\touterStrength,\n\t\t\tinnerStrength,\n\t\t\tcolor,\n\t\t\tknockout,\n\t\t\tquality,\n\t\t\talpha\n\t\t} = opts;\n\n\t\tconst distance = Math.round(opts.distance);\n\n\t\tsuper(vertex, frag\n\t\t\t.replace(/__ANGLE_STEP_SIZE__/gi, `${(1 / quality / distance).toFixed(7)}`)\n\t\t\t.replace(/__DIST__/gi, `${distance.toFixed(0)}.0`));\n\n\t\tthis.uniforms.glowColor = new Float32Array([0, 0, 0, 1]);\n\t\tthis.uniforms.alpha = 1;\n\n\t\tObject.assign(this, {\n\t\t\tcolor,\n\t\t\touterStrength,\n\t\t\tinnerStrength,\n\t\t\tpadding: distance,\n\t\t\tknockout,\n\t\t\talpha,\n\t\t});\n\n\t\tthis.isValid = true;\n\t}\n\n\t/**\n\t * The color of the glow.\n\t * @default 0xFFFFFF\n\t */\n\tget color()\n\t{\n\t\treturn PIXI.utils.rgb2hex(this.uniforms.glowColor);\n\t}\n\tset color(value)\n\t{\n\t\tPIXI.utils.hex2rgb(value, this.uniforms.glowColor);\n\t}\n\n\t/**\n\t * The strength of the glow outward from the edge of the sprite.\n\t * @default 4\n\t */\n\tget outerStrength()\n\t{\n\t\treturn this.uniforms.outerStrength;\n\t}\n\tset outerStrength(value)\n\t{\n\t\tthis.uniforms.outerStrength = value;\n\t}\n\n\t/**\n\t * The strength of the glow inward from the edge of the sprite.\n\t * @default 0\n\t */\n\tget innerStrength()\n\t{\n\t\treturn this.uniforms.innerStrength;\n\t}\n\tset innerStrength(value)\n\t{\n\t\tthis.uniforms.innerStrength = value;\n\t}\n\n\t/**\n\t * Only draw the glow, not the texture itself\n\t * @default false\n\t */\n\tget knockout()\n\t{\n\t\treturn this.uniforms.knockout;\n\t}\n\tset knockout(value)\n\t{\n\t\tthis.uniforms.knockout = value;\n\t}\n\n\t/**\n\t * The alpha value of the glow\n\t * @default 1\n\t */\n\tget alpha()\n\t{\n\t\treturn this.uniforms.alpha;\n\t}\n\tset alpha(value)\n\t{\n\t\tthis.uniforms.alpha = value;\n\t}\n}\n\nconst frag = `varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nuniform float outerStrength;\nuniform float innerStrength;\n\nuniform vec4 glowColor;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform bool knockout;\nuniform float alpha;\n\nconst float PI = 3.14159265358979323846264;\n\nconst float DIST = __DIST__;\nconst float ANGLE_STEP_SIZE = min(__ANGLE_STEP_SIZE__, PI * 2.0);\nconst float ANGLE_STEP_NUM = ceil(PI * 2.0 / ANGLE_STEP_SIZE);\n\nconst float MAX_TOTAL_ALPHA = ANGLE_STEP_NUM * DIST * (DIST + 1.0) / 2.0;\n\nvoid main(void) {\n    vec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n\n    float totalAlpha = 0.0;\n\n    vec2 direction;\n    vec2 displaced;\n    vec4 curColor;\n\n    for (float angle = 0.0; angle < PI * 2.0; angle += ANGLE_STEP_SIZE) {\n       direction = vec2(cos(angle), sin(angle)) * px;\n\n       for (float curDistance = 0.0; curDistance < DIST; curDistance++) {\n           displaced = clamp(vTextureCoord + direction * \n                   (curDistance + 1.0), filterClamp.xy, filterClamp.zw);\n\n           curColor = texture2D(uSampler, displaced);\n\n           totalAlpha += (DIST - curDistance) * curColor.a;\n       }\n    }\n    \n    curColor = texture2D(uSampler, vTextureCoord);\n\n    float alphaRatio = (totalAlpha / MAX_TOTAL_ALPHA);\n\n    float innerGlowAlpha = (1.0 - alphaRatio) * innerStrength * curColor.a;\n    float innerGlowStrength = min(1.0, innerGlowAlpha);\n    \n    vec4 innerColor = mix(curColor, glowColor, innerGlowStrength);\n\n    float outerGlowAlpha = alphaRatio * outerStrength * (1. - curColor.a);\n    float outerGlowStrength = min(1.0 - innerColor.a, outerGlowAlpha);\n\n    if (knockout) {\n      float resultAlpha = (outerGlowAlpha + innerGlowAlpha) * alpha;\n      gl_FragColor = vec4(glowColor.rgb * resultAlpha, resultAlpha);\n    }\n    else {\n      vec4 outerGlowColor = outerGlowStrength * glowColor.rgba * alpha;\n      gl_FragColor = innerColor + outerGlowColor;\n    }\n}`;\n\nconst vertex = `attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n    vTextureCoord = aTextureCoord;\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","\nlet fragmentShader = `\\\n        varying vec2 vTextureCoord;\n\n        uniform sampler2D uSampler;\n        uniform sampler2D uMaskSampler;\n\n        void main(void) {\n            gl_FragColor = texture2D(uSampler, vTextureCoord)\n                * texture2D(uMaskSampler, vTextureCoord).a;\n        }`;\n\nexport default class MaskFilter extends foundry.canvas.rendering.filters.AbstractBaseFilter {\n\n  /** @override */\n  static defaultUniforms = { uMaskSampler: null };\n\n  /** @override */\n  static fragmentShader = fragmentShader;\n\n  /** @type {DisplayObject[]|null} */\n  masks = [];\n\n\tstatic _createFragmentShader() {\n\t\treturn fragmentShader;\n\t}\n\n  /** @override */\n  apply(filterManager, input, output, clearMode, currentState) {\n    const maskFilterTexture = filterManager.getFilterTexture();\n    const originalFilterTexture = this.#push(\n      filterManager,\n      currentState,\n      maskFilterTexture\n    );\n    const renderer = filterManager.renderer;\n\n    for (const mask of this.masks) {\n      if (mask?.obj?.destroyed) continue;\n      const renderable = mask.renderable;\n      mask.renderable = true;\n      mask.render(renderer);\n      mask.renderable = renderable;\n    }\n\n    renderer.batch.flush();\n\n    this.#pop(filterManager, currentState, originalFilterTexture);\n    this.uniforms.uMaskSampler = maskFilterTexture;\n    filterManager.applyFilter(this, input, output, clearMode);\n    filterManager.returnFilterTexture(maskFilterTexture);\n  }\n\n  #push(filterManager, currentState, maskFilterTexture) {\n    const originalFilterTexture = currentState.renderTexture;\n\n    currentState.renderTexture = maskFilterTexture;\n    filterManager.defaultFilterStack.push(currentState);\n    filterManager.bindAndClear(maskFilterTexture);\n\n    return originalFilterTexture;\n  }\n\n  #pop(filterManager, currentState, originalFilterTexture) {\n    currentState.renderTexture = originalFilterTexture;\n    filterManager.defaultFilterStack.pop();\n\n    if (filterManager.activeState === currentState) {\n      return;\n    }\n\n    filterManager.activeState = currentState;\n\n    const globalUniforms = filterManager.globalUniforms.uniforms;\n\n    globalUniforms.outputFrame = currentState.sourceFrame;\n    globalUniforms.resolution = currentState.resolution;\n\n    const inputSize = globalUniforms.inputSize;\n    const inputPixel = globalUniforms.inputPixel;\n    const inputClamp = globalUniforms.inputClamp;\n\n    inputSize[0] = currentState.destinationFrame.width;\n    inputSize[1] = currentState.destinationFrame.height;\n    inputSize[2] = 1.0 / inputSize[0];\n    inputSize[3] = 1.0 / inputSize[1];\n\n    inputPixel[0] = Math.round(inputSize[0] * currentState.resolution);\n    inputPixel[1] = Math.round(inputSize[1] * currentState.resolution);\n    inputPixel[2] = 1.0 / inputPixel[0];\n    inputPixel[3] = 1.0 / inputPixel[1];\n\n    inputClamp[0] = 0.5 * inputPixel[2];\n    inputClamp[1] = 0.5 * inputPixel[3];\n    inputClamp[2] =\n      currentState.sourceFrame.width * inputSize[2] - 0.5 * inputPixel[2];\n    inputClamp[3] =\n      currentState.sourceFrame.height * inputSize[3] - 0.5 * inputPixel[3];\n\n    if (currentState.legacy) {\n      const filterArea = globalUniforms.filterArea;\n\n      filterArea[0] = currentState.destinationFrame.width;\n      filterArea[1] = currentState.destinationFrame.height;\n      filterArea[2] = currentState.sourceFrame.x;\n      filterArea[3] = currentState.sourceFrame.y;\n\n      globalUniforms.filterClamp = globalUniforms.inputClamp;\n    }\n\n    filterManager.globalUniforms.update();\n  }\n}\n","import * as lib from \"../lib/lib.js\";\n\nconst SequencerAnimationEngine = {\n\t_animations: [],\n\t_debug: undefined,\n\t_deltas: [],\n\n\tticker: false,\n\tdt: 0,\n\n\tisRunning: false,\n\n\taddAnimation(origin, attributes = [], timeDifference = 0) {\n\t\tif (!Array.isArray(attributes)) attributes = [attributes];\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis._animations.push({\n\t\t\t\torigin,\n\t\t\t\tattributes: attributes.map((attribute) => {\n\t\t\t\t\tattribute.targetId = lib.get_object_identifier(attribute.target) + \"-\" + attribute.propertyName;\n\t\t\t\t\tattribute.id = foundry.utils.randomID();\n\t\t\t\t\tattribute.started = false;\n\t\t\t\t\tattribute.initialized = false;\n\t\t\t\t\tattribute.finishing = false;\n\t\t\t\t\tattribute.complete = false;\n\t\t\t\t\tattribute.previousValue = null;\n\t\t\t\t\tattribute.progress = 0;\n\t\t\t\t\tattribute.value = 0;\n\t\t\t\t\tattribute.coreValue = 0;\n\t\t\t\t\tattribute.isFunkyProperty = attribute.propertyName.startsWith(\"scale.\");\n\n\t\t\t\t\tattribute.duration = attribute.duration ?? 0;\n\t\t\t\t\tattribute.durationDone = timeDifference ?? 0;\n\n\t\t\t\t\tif (attribute?.looping) {\n\t\t\t\t\t\tattribute.loopDuration = attribute.loopDuration ?? attribute.duration ?? 0;\n\t\t\t\t\t\tattribute.loopDurationDone = timeDifference % attribute.loopDuration ?? 0;\n\t\t\t\t\t\tattribute.loops = attribute.loops ?? 0;\n\t\t\t\t\t\tattribute.loopsDone = Math.floor(\n\t\t\t\t\t\t\tattribute.durationDone / attribute.duration\n\t\t\t\t\t\t);\n\t\t\t\t\t\tattribute.index = attribute.loopsDone % attribute.values.length;\n\t\t\t\t\t\tattribute.nextIndex =\n\t\t\t\t\t\t\t(attribute.loopsDone + 1) % attribute.values.length;\n\t\t\t\t\t\tif (!attribute.pingPong && attribute.nextIndex === 0) {\n\t\t\t\t\t\t\tattribute.index = 0;\n\t\t\t\t\t\t\tattribute.nextIndex = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn attribute;\n\t\t\t\t}),\n\t\t\t\tcomplete: false,\n\t\t\t\ttotalDt: timeDifference,\n\t\t\t\tresolve: resolve,\n\t\t\t});\n\n\t\t\tthis._animations.sort((a, b) => {\n\t\t\t\tconst aNumAbsolute = a.attributes.filter(attr => !attr.complete && attr.absolute).length;\n\t\t\t\tconst bNumAbsolute = b.attributes.filter(attr => !attr.complete && attr.absolute).length;\n\t\t\t\treturn bNumAbsolute - aNumAbsolute;\n\t\t\t});\n\n\t\t\tif (!this.ticker) {\n\t\t\t\tthis.start();\n\t\t\t}\n\n\t\t\tlib.debug(`Added animations to Animation Engine`);\n\t\t});\n\t},\n\n\tendAnimations(target) {\n\t\tthis._animations = this._animations.filter(\n\t\t\t(animation) => animation.origin !== target\n\t\t);\n\t},\n\n\tupdateStartValues(target, propertyName) {\n\t\tconst targetId = lib.get_object_identifier(target) + \"-\" + propertyName;\n\t\tif (targetId in this._coreValues) {\n\t\t\tthis._coreValues[targetId].value = lib.deep_get(target, propertyName);\n\t\t}\n\t},\n\n\tstart() {\n\t\tif (!this.ticker) {\n\t\t\tlib.debug(`Animation Engine Started`);\n\t\t\tthis.ticker = foundry.canvas.animation.CanvasAnimation.ticker;\n\t\t\tthis.ticker.add(this.nextFrame.bind(this));\n\t\t}\n\t},\n\n\tnextFrame() {\n\t\tif (this._animations.length === 0) {\n\t\t\tthis._coreValues = {};\n\t\t\treturn;\n\t\t}\n\n\t\tthis._storedValues = {};\n\n\t\tthis._animations.forEach((animation) => this._animate(animation));\n\n\t\tfor (let delta of Object.values(this._storedValues)) {\n\t\t\ttry {\n\t\t\t\tlib.deep_set(delta.target, delta.propertyName, delta.value);\n\t\t\t} catch (err) {\n\t\t\t}\n\t\t}\n\n\t\tthis._animations = this._animations.filter((animation) => !animation.complete);\n\n\t},\n\n\t_coreValues: {},\n\t_storedValues: {},\n\n\t_animate(animation) {\n\t\tanimation.totalDt += this.ticker.elapsedMS;\n\n\t\tanimation.attributes.filter((attribute) => {\n\t\t\treturn !attribute.complete && animation.totalDt >= attribute.delay;\n\t\t}).forEach((attr) => {\n\t\t\tthis._animateAttribute(attr);\n\t\t\tif(attr.finishing){\n\t\t\t\tattr.complete = true;\n\t\t\t\tif (this._coreValues[attr.targetId]) {\n\t\t\t\t\tdelete this._coreValues[attr.targetId];\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tanimation.complete = animation.attributes.filter((attribute) => !attribute.complete).length === 0;\n\n\t\tif (animation.complete) {\n\t\t\tanimation.resolve();\n\t\t}\n\t},\n\n\t_animateAttribute(attribute) {\n\n\t\tif (this._coreValues[attribute.targetId] === undefined) {\n\t\t\tthis._coreValues[attribute.targetId] = {\n\t\t\t\tid: attribute.id,\n\t\t\t\tvalue: lib.deep_get(attribute.target, attribute.propertyName)\n\t\t\t};\n\t\t}\n\n\t\tif (this._storedValues[attribute.targetId] === undefined) {\n\t\t\tthis._storedValues[attribute.targetId] = {\n\t\t\t\tvalue: this._coreValues[attribute.targetId].value,\n\t\t\t\ttarget: attribute.target,\n\t\t\t\tpropertyName: attribute.propertyName,\n\t\t\t\ttargetId: attribute.targetId\n\t\t\t};\n\t\t}\n\n\t\tif (attribute?.looping && attribute?.indefinite) {\n\t\t\tthis._handleIndefiniteLoop(attribute);\n\t\t} else if (attribute?.looping) {\n\t\t\tthis._handleLoops(attribute);\n\t\t} else {\n\t\t\tthis._handleDefault(attribute);\n\t\t}\n\n\t\t// This is absolutely horrendous, but 50% of the time, it works 90% of the time.\n\t\tif (attribute.absolute) {\n\t\t\tthis._coreValues[attribute.targetId].value = attribute.value;\n\t\t\tconst delta = this._coreValues[attribute.targetId].value - this._storedValues[attribute.targetId].value;\n\t\t\tthis._storedValues[attribute.targetId].value += delta;\n\t\t} else {\n\t\t\tif (attribute.isFunkyProperty) {\n\t\t\t\tconst coreValue = this._coreValues[attribute.targetId].value;\n\t\t\t\tattribute.delta = (coreValue * attribute.value) - coreValue;\n\t\t\t\tthis._storedValues[attribute.targetId].value += attribute.delta;\n\t\t\t} else {\n\t\t\t\tthis._storedValues[attribute.targetId].value += attribute.value;\n\t\t\t}\n\t\t}\n\n\t},\n\n\t_handleBaseLoop(attribute) {\n\t\tif (!attribute.initialized) {\n\t\t\tif (attribute.values.length === 1) {\n\t\t\t\tattribute.values.unshift(this._coreValues[attribute.targetId].value);\n\t\t\t}\n\t\t\tattribute.initialized = true;\n\t\t}\n\n\t\tattribute.loopDurationDone += this.ticker.deltaMS;\n\t\tattribute.progress = attribute.loopDurationDone / attribute.loopDuration;\n\n\t\tattribute.value = lib.interpolate(\n\t\t\tattribute.values[attribute.index],\n\t\t\tattribute.values[attribute.nextIndex],\n\t\t\tattribute.progress,\n\t\t\tattribute.ease\n\t\t);\n\n\t\tif (attribute.progress >= 1.0) {\n\t\t\tattribute.loopDurationDone -= attribute.loopDuration;\n\n\t\t\tattribute.index = (attribute.index + 1) % attribute.values.length;\n\t\t\tattribute.nextIndex = (attribute.nextIndex + 1) % attribute.values.length;\n\n\t\t\tif (!attribute.pingPong && attribute.nextIndex === 0) {\n\t\t\t\tattribute.index = 0;\n\t\t\t\tattribute.nextIndex = 1;\n\t\t\t}\n\n\t\t\tattribute.loopsDone++;\n\n\t\t\tattribute.value = lib.interpolate(\n\t\t\t\tattribute.values[attribute.index],\n\t\t\t\tattribute.values[attribute.nextIndex],\n\t\t\t\tattribute.progress % 1.0,\n\t\t\t\tattribute.ease\n\t\t\t);\n\t\t}\n\t},\n\n\t_handleIndefiniteLoop(attribute) {\n\t\treturn this._handleBaseLoop(attribute);\n\t},\n\n\t_handleLoops(attribute) {\n\t\tthis._handleBaseLoop(attribute);\n\n\t\tattribute.durationDone += this.ticker.deltaMS;\n\t\tattribute.overallProgress = attribute.durationDone / attribute.duration;\n\n\t\tif (\n\t\t\tattribute.progress >= 1.0 &&\n\t\t\tattribute.loopsDone === attribute.loops * 2\n\t\t) {\n\t\t\tattribute.finishing = true;\n\t\t\tattribute.value = attribute.values[attribute.index];\n\t\t}\n\n\t\tif (attribute.overallProgress >= 1.0) {\n\t\t\tattribute.finishing = true;\n\t\t}\n\t},\n\n\t_handleDefault(attribute) {\n\t\tif (!attribute.initialized) {\n\t\t\tif (attribute.from === undefined) {\n\t\t\t\tattribute.from = this._coreValues[attribute.targetId].value;\n\t\t\t}\n\t\t\tattribute.initialized = true;\n\t\t}\n\n\t\tattribute.durationDone += this.ticker.deltaMS;\n\t\tattribute.progress = attribute.durationDone / attribute.duration;\n\n\t\tattribute.value = lib.interpolate(\n\t\t\tattribute.from,\n\t\t\tattribute.to,\n\t\t\tlib.clamp(attribute.progress, 0.0, 1.0),\n\t\t\tattribute.ease\n\t\t);\n\n\t\tif (attribute.progress >= 1.0) {\n\t\t\tattribute.value = attribute.to;\n\t\t\tattribute.finishing = true;\n\t\t}\n\t},\n};\n\nexport default SequencerAnimationEngine;\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\tflagAddBuffer: new Map(),\n\tflagRemoveBuffer: new Map(),\n\t_latestFlagVersion: false,\n\t_databaseId: null,\n\n\tget database(){\n\t\tif (this._databaseId) {\n\t\t\tconst cached = game.journal.get(this._databaseId);\n\t\t\tif (cached) return cached;\n\t\t\tthis._databaseId = null;\n\t\t}\n\t\tconst database = game.journal.getName(CONSTANTS.DATABASE_NAME);\n\t\tif (database) {\n\t\t\tthis._databaseId = database.id;\n\t\t}\n\t\treturn database;\n\t},\n\n\tsetup() {\n\t\tHooks.on(\"renderJournalDirectory\", async (app) => {\n\t\t\tlet database = this.database;\n\t\t\tif(!database) return;\n\t\t\tlet element = app.element.querySelector(`[data-entry-id=\"${database.id}\"]`);\n\t\t\tif(element){\n\t\t\t\telement.remove();\n\t\t\t}\n\t\t});\n\t\tHooks.on(\"preDeleteJournalEntry\", (doc) => {\n\t\t\tlet database = this.database;\n\t\t\tif(!database) return;\n\t\t\treturn doc !== database;\n\t\t})\n\t},\n\n\t_getDatabaseData(flag) {\n\t\tlet database = this.database;\n\t\tif(!database){\n\t\t\treturn {};\n\t\t}\n\t\tlet flagData = {};\n\t\tlet flags = foundry.utils.getProperty(database, flag) ?? {};\n\t\tfor (let [uuid, data] of Object.entries(flags)) {\n\t\t\tlet newUuid = uuid.replaceAll(\"-\", \".\");\n\t\t\tflagData[newUuid] ??= []\n\t\t\tflagData[newUuid] = flagData[newUuid].concat(data);\n\t\t}\n\t\treturn flagData;\n\t},\n\n\tgetDatabaseFlags() {\n\t\treturn {\n\t\t\teffects: this._getDatabaseData(CONSTANTS.EFFECTS_FLAG),\n\t\t\tsounds: this._getDatabaseData(CONSTANTS.SOUNDS_FLAG)\n\t\t};\n\t},\n\n\tget latestFlagVersion() {\n\t\tif (!this._latestFlagVersion) {\n\t\t\tconst versions = Object.keys(this.effectMigrations);\n\t\t\tversions.sort((a, b) => {\n\t\t\t\treturn foundry.utils.isNewerVersion(a, b) ? -1 : 1;\n\t\t\t});\n\t\t\tthis._latestFlagVersion = versions[0];\n\t\t}\n\t\treturn this._latestFlagVersion;\n\t},\n\n\t/**\n\t * Sanitizes the effect data, accounting for changes to the structure in previous versions\n\t *\n\t * @param inDocument\n\t * @returns {array}\n\t */\n\tgetEffectFlags(inDocument) {\n\n\t\tif(!inDocument?.uuid) return [];\n\n\t\tlet effects = this.getDatabaseFlags().effects[inDocument.uuid] ?? []\n\n\t\tif (!effects?.length) return [];\n\n\t\teffects = foundry.utils.deepClone(effects);\n\n\t\tconst changes = [];\n\t\tfor (let [effectId, effectData] of effects) {\n\t\t\tlet effectVersion = effectData?.flagVersion ?? \"1.0.0\";\n\n\t\t\tlet changesAdded = false;\n\n\t\t\tif (effectData._id !== effectId) {\n\t\t\t\tchangesAdded = true;\n\t\t\t\teffectData._id = effectId;\n\t\t\t\tchanges.push(effectData);\n\n\t\t\t\tlib.debug(\n\t\t\t\t\t`Fixed effect with broken ID ${effectId}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (effectData.flagVersion === this.latestFlagVersion) continue;\n\n\t\t\tfor (let [version, migration] of Object.entries(this.effectMigrations)) {\n\t\t\t\tif (!foundry.utils.isNewerVersion(version, effectVersion)) continue;\n\n\t\t\t\teffectData = migration(inDocument, effectData);\n\t\t\t}\n\n\t\t\tlib.debug(\n\t\t\t\t`Migrated effect with ID ${effectId} from version ${effectVersion} to version ${this.latestFlagVersion}`,\n\t\t\t);\n\n\t\t\teffectData.flagVersion = this.latestFlagVersion;\n\n\t\t\tif (!changesAdded) changes.push(effectData);\n\t\t}\n\n\t\tif (changes.length) {\n\t\t\tflagManager.addFlags(inDocument.uuid, { effects: changes });\n\t\t}\n\n\t\treturn effects;\n\t},\n\n\teffectMigrations: {\n\t\t\"2.0.0\": (inDocument, effectData) => {\n\t\t\teffectData._id = effectData.id;\n\t\t\teffectData.creationTimestamp = effectData.timestamp;\n\n\t\t\tif (effectData.template) {\n\t\t\t\teffectData.template = {\n\t\t\t\t\tgridSize: effectData.template[0],\n\t\t\t\t\tstartPoint: effectData.template[1],\n\t\t\t\t\tendPoint: effectData.template[2],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (effectData.attachTo) {\n\t\t\t\teffectData.attachTo = {\n\t\t\t\t\tactive: true,\n\t\t\t\t\talign: \"center\",\n\t\t\t\t\trotation: true,\n\t\t\t\t\tbindVisibility: true,\n\t\t\t\t\tbindAlpha: true,\n\t\t\t\t};\n\t\t\t\teffectData.source = inDocument.uuid;\n\t\t\t\tconst objectSize = canvaslib.get_object_dimensions(inDocument, true);\n\t\t\t\teffectData.offset = {\n\t\t\t\t\tx: effectData.position.x - objectSize.width,\n\t\t\t\t\ty: effectData.position.y - objectSize.height,\n\t\t\t\t};\n\t\t\t} else if (effectData.position) {\n\t\t\t\teffectData.source = effectData.position;\n\t\t\t}\n\n\t\t\tif (effectData.reachTowards) {\n\t\t\t\teffectData.stretchTo = {\n\t\t\t\t\tattachTo: false,\n\t\t\t\t\tonlyX: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (effectData.filters) {\n\t\t\t\teffectData.filters = Object.entries(effectData.filters).map((entry) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclassName: entry[0],\n\t\t\t\t\t\t...entry[1],\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}\n\n\t\t\teffectData.moveSpeed = effectData.speed;\n\n\t\t\teffectData.target = null;\n\t\t\teffectData.forcedIndex = null;\n\t\t\teffectData.flipX = false;\n\t\t\teffectData.flipY = false;\n\t\t\teffectData.nameOffsetMap = {};\n\t\t\teffectData.sequenceId = 0;\n\n\t\t\tdelete effectData.id;\n\t\t\tdelete effectData.timestamp;\n\t\t\tdelete effectData.position;\n\t\t\tdelete effectData.reachTowards;\n\t\t\tdelete effectData.speed;\n\t\t\tdelete effectData.audioVolume;\n\t\t\tdelete effectData.gridSizeDifference;\n\t\t\tdelete effectData.template;\n\n\t\t\tif (effectData.animatedProperties) {\n\t\t\t\tdelete effectData.animatedProperties.fadeInAudio;\n\t\t\t\tdelete effectData.animatedProperties.fadeOutAudio;\n\t\t\t}\n\n\t\t\teffectData = foundry.utils.mergeObject(\n\t\t\t\teffectData,\n\t\t\t\teffectData.animatedProperties,\n\t\t\t);\n\n\t\t\tdelete effectData.animatedProperties;\n\n\t\t\treturn effectData;\n\t\t},\n\n\t\t\"2.0.6\": (inDocument, effectData) => {\n\t\t\teffectData.private = null;\n\n\t\t\treturn effectData;\n\t\t},\n\n\t\t\"2.0.8\": (inDocument, effectData) => {\n\t\t\tif (effectData.stretchTo) {\n\t\t\t\teffectData.stretchTo.tiling = false;\n\t\t\t}\n\n\t\t\treturn effectData;\n\t\t},\n\n\t\t\"2.0.9\": (inDocument, effectData) => {\n\t\t\teffectData.tilingTexture = false;\n\n\t\t\tif (effectData.stretchTo?.tiling !== undefined) {\n\t\t\t\tif (effectData.stretchTo.tiling) {\n\t\t\t\t\teffectData.tilingTexture = {\n\t\t\t\t\t\tscale: { x: 1, y: 1 },\n\t\t\t\t\t\tposition: { x: 0, y: 0 },\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tdelete effectData.stretchTo.tiling;\n\t\t\t}\n\n\t\t\treturn effectData;\n\t\t},\n\n\t\t\"2.1.0\": (inDocument, effectData) => {\n\t\t\tif (effectData.randomOffset) {\n\t\t\t\teffectData.randomOffset = {\n\t\t\t\t\tsource: !effectData.target ? effectData.randomOffset : false,\n\t\t\t\t\ttarget: !!effectData.target ? effectData.randomOffset : false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (effectData.nameOffsetMap) {\n\t\t\t\tObject.values(effectData.nameOffsetMap).forEach((offsetMap) => {\n\t\t\t\t\tif (offsetMap.randomOffset) {\n\t\t\t\t\t\toffsetMap.randomOffset = {\n\t\t\t\t\t\t\tsource: !offsetMap.target ? offsetMap.randomOffset : false,\n\t\t\t\t\t\t\ttarget: !!offsetMap.target ? offsetMap.randomOffset : false,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn effectData;\n\t\t},\n\n\t\t\"3.2.0\": (inDocument, effectData) => {\n\t\t\tif (effectData.attachTo?.followRotation !== undefined) {\n\t\t\t\teffectData.attachTo.bindRotation = effectData.attachTo.followRotation;\n\t\t\t\tdelete effectData.attachTo.followRotation;\n\t\t\t}\n\t\t\tif (effectData.scaleToObject) {\n\t\t\t\tif (effectData.attachTo?.active) {\n\t\t\t\t\teffectData.attachTo.bindScale = true;\n\t\t\t\t} else if (!effectData.attachTo?.active && !effectData.attachTo?.bindScale) {\n\t\t\t\t\teffectData.scaleToObject = false;\n\t\t\t\t\teffectData.size = canvaslib.get_object_dimensions(inDocument);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn effectData;\n\t\t},\n\n\t\t\"3.2.1\": (inDocument, effectData) => {\n\t\t\tif (effectData.noLoop !== undefined) {\n\t\t\t\teffectData.loopOptions = {\n\t\t\t\t\tloops: 1,\n\t\t\t\t\tloopDelay: 0,\n\t\t\t\t\tendOnLastLoop: false\n\t\t\t\t}\n\t\t\t\tdelete effectData.noLoop;\n\t\t\t}\n\t\t\treturn effectData;\n\t\t}\n\t},\n\n\t/**\n\t * Adds effects and/or sounds to a given document\n\t *\n\t * @param inObjectUUID\n\t * @param effects\n\t * @param sounds\n\t */\n\taddFlags: (inObjectUUID, { effects = [], sounds = [] }={}) => {\n\t\tif (!Array.isArray(effects)) effects = [effects];\n\t\tif (!Array.isArray(sounds)) sounds = [sounds];\n\t\tsequencerSocket.executeAsMainUser(\n\t\t\tSOCKET_HANDLERS.ADD_FLAGS,\n\t\t\tinObjectUUID,\n\t\t\teffects,\n\t\t\tsounds\n\t\t);\n\t},\n\n\t/**\n\t * Removes effects and/or sounds from a given document\n\t *\n\t * @param inObjectUUID\n\t * @param effects\n\t * @param removeAllEffects\n\t * @param sounds\n\t * @param removeAllSounds\n\t */\n\tremoveFlags: (inObjectUUID, { effects=[], removeAllEffects = false, sounds=[], removeAllSounds = false}=[]) => {\n\t\tif (!Array.isArray(effects)) effects = [effects];\n\t\tif (!Array.isArray(sounds)) sounds = [sounds];\n\t\tsequencerSocket.executeAsMainUser(\n\t\t\tSOCKET_HANDLERS.REMOVE_FLAGS,\n\t\t\tinObjectUUID,\n\t\t\t{ effects, removeAllEffects, sounds, removeAllSounds }\n\t\t);\n\t},\n\n\t_addFlags: (inObjectUUID, effects, sounds) => {\n\t\tif (!Array.isArray(effects)) effects = [effects];\n\t\tif (!Array.isArray(sounds)) sounds = [sounds];\n\n\t\tlet flagsToSet = flagManager.flagAddBuffer.get(inObjectUUID) ?? {\n\t\t\teffects: [],\n\t\t\tsounds: [],\n\t\t};\n\n\t\tflagsToSet.effects.push(...effects);\n\t\tflagsToSet.sounds.push(...sounds);\n\n\t\tflagManager.flagAddBuffer.set(inObjectUUID, flagsToSet);\n\n\t\tflagManager.updateFlags();\n\t},\n\n\t_removeFlags: (inObjectUUID, { effects=[], removeAllEffects = false, sounds=[], removeAllSounds=false}) => {\n\t\tif (effects && !Array.isArray(effects)) effects = [effects];\n\t\tif (sounds && !Array.isArray(sounds)) sounds = [sounds];\n\n\t\tlet flagsToSet = flagManager.flagRemoveBuffer.get(inObjectUUID) ?? {\n\t\t\teffects: [],\n\t\t\tsounds: [],\n\t\t\tremoveAllEffects: removeAllEffects,\n\t\t\tremoveAllSounds: removeAllSounds,\n\t\t};\n\n\t\tif (effects) flagsToSet.effects.push(...effects);\n\t\tif (sounds) flagsToSet.sounds.push(...sounds);\n\n\t\tflagManager.flagRemoveBuffer.set(inObjectUUID, flagsToSet);\n\n\t\tflagManager.updateFlags();\n\t},\n\n\tupdateFlags: foundry.utils.debounce(async () => {\n\t\tlet database = flagManager.database;\n\t\tif(!database) return;\n\n\t\tlet flagsToAdd = Array.from(flagManager.flagAddBuffer);\n\t\tlet flagsToRemove = Array.from(flagManager.flagRemoveBuffer);\n\n\t\tif(flagsToAdd.length === 0 && flagsToRemove.length === 0) return;\n\n\t\tflagManager.flagAddBuffer.clear();\n\t\tflagManager.flagRemoveBuffer.clear();\n\n\t\tflagsToAdd.forEach((entry) => (entry[1].original = true));\n\t\tflagsToRemove.forEach((entry) => (entry[1].original = true));\n\n\t\tconst objects = new Set([\n\t\t\t...flagsToAdd.map((effect) => effect[0]).filter(Boolean),\n\t\t\t...flagsToRemove.map((effect) => effect[0]).filter(Boolean),\n\t\t]);\n\n\t\tflagsToAdd = new Map(flagsToAdd);\n\t\tflagsToRemove = new Map(flagsToRemove);\n\n\t\tconst effectUpdate = {};\n\t\tconst soundUpdate = {};\n\n\t\tconst allEffectFlags = flagManager.getDatabaseFlags().effects;\n\t\tconst allSoundFlags = flagManager.getDatabaseFlags().sounds;\n\n\t\tfor (let objectUUID of objects) {\n\t\t\tlet object = fromUuidSync(objectUUID);\n\n\t\t\tif (!object) {\n\t\t\t\tlib.forceDeletionKeyWrapper(effectUpdate, \"-=\" + objectUUID.replaceAll(\".\", \"-\"))\n\t\t\t\tlib.forceDeletionKeyWrapper(soundUpdate, \"-=\" + objectUUID.replaceAll(\".\", \"-\"))\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst isLinkedToken = object instanceof TokenDocument && object.actorLink;\n\t\t\tconst isLinkedActor = object instanceof Actor && object.prototypeToken.actorLink;\n\n\t\t\tlet toAdd = flagsToAdd.get(objectUUID) ?? { effects: [], sounds: [] };\n\t\t\tlet toRemove = flagsToRemove.get(objectUUID) ?? {\n\t\t\t\teffects: [],\n\t\t\t\tremoveAllEffects: false,\n\t\t\t\tsounds: [],\n\t\t\t\tremoveAllSounds: false,\n\t\t\t};\n\n\t\t\tlet origExistingEffectFlags = allEffectFlags[object.uuid] ?? [];\n\t\t\tif (isLinkedToken) {\n\t\t\t\torigExistingEffectFlags = origExistingEffectFlags.concat(allEffectFlags[object?.actor?.uuid] ?? []);\n\t\t\t}\n\t\t\tconst existingEffectFlags = new Map(origExistingEffectFlags);\n\n\t\t\tlet origExistingSoundFlags = allSoundFlags[object.uuid] ?? [];\n\t\t\tif (isLinkedToken) {\n\t\t\t\torigExistingSoundFlags = origExistingSoundFlags.concat(allSoundFlags[object?.actor?.uuid] ?? []);\n\t\t\t}\n\t\t\tconst existingSoundFlags = new Map(origExistingSoundFlags);\n\n\t\t\tif (toRemove?.removeAllEffects) {\n\t\t\t\ttoRemove.effects = Array.from(existingEffectFlags).map((entry) => entry[0]);\n\t\t\t}\n\n\t\t\tif (toRemove?.removeAllSounds) {\n\t\t\t\ttoRemove.sounds = Array.from(existingSoundFlags).map((entry) => entry[0]);\n\t\t\t}\n\n\t\t\tfor (let effect of toAdd.effects) {\n\t\t\t\tif (typeof effect === \"string\") {\n\t\t\t\t\teffect = existingEffectFlags.get(effect);\n\t\t\t\t\tif (!effect) continue;\n\t\t\t\t}\n\t\t\t\texistingEffectFlags.set(effect._id, effect);\n\t\t\t}\n\n\t\t\tfor (let sound of toAdd.sounds) {\n\t\t\t\tif (typeof sound === \"string\") {\n\t\t\t\t\tsound = existingSoundFlags.get(sound);\n\t\t\t\t\tif (!sound) continue;\n\t\t\t\t}\n\t\t\t\texistingSoundFlags.set(sound._id, sound);\n\t\t\t}\n\n\t\t\tfor (let effect of toRemove.effects) {\n\t\t\t\tif (typeof effect === \"string\") {\n\t\t\t\t\teffect = existingEffectFlags.get(effect);\n\t\t\t\t\tif (!effect) continue;\n\t\t\t\t}\n\t\t\t\texistingEffectFlags.delete(effect._id);\n\t\t\t}\n\n\t\t\tfor (let sound of toRemove.sounds) {\n\t\t\t\tif (typeof sound === \"string\") {\n\t\t\t\t\tsound = existingSoundFlags.get(sound);\n\t\t\t\t\tif (!sound) continue;\n\t\t\t\t}\n\t\t\t\texistingSoundFlags.delete(sound._id);\n\t\t\t}\n\n\t\t\tlet effectFlagsToSet = Array.from(existingEffectFlags);\n\t\t\tlet soundFlagsToSet = Array.from(existingSoundFlags);\n\n\t\t\tlet actorEffectFlags = [];\n\t\t\tlet actorSoundFlags = [];\n\t\t\tlet actor = object?.actor ?? object;\n\t\t\tif (\n\t\t\t\tactor instanceof foundry.documents.Actor &&\n\t\t\t\t(isLinkedToken || isLinkedActor) &&\n\t\t\t\t(toAdd.original || toRemove.original)\n\t\t\t) {\n\t\t\t\tactorEffectFlags = effectFlagsToSet.filter(\n\t\t\t\t\t(effect) => lib.is_UUID(effect[1]?.source) && effect[1]?.attachTo?.active && effect[1]?.persistOptions?.persistTokenPrototype,\n\t\t\t\t);\n\t\t\t\teffectFlagsToSet = effectFlagsToSet.filter(\n\t\t\t\t\t(effect) => !effect[1]?.persistOptions?.persistTokenPrototype || !lib.is_UUID(effect[1]?.source) || !effect[1]?.attachTo?.active,\n\t\t\t\t);\n\t\t\t\t\n\t\t\t\tactorSoundFlags = soundFlagsToSet.filter(\n\t\t\t\t\t(sound) => lib.is_UUID(sound[1]?.source) && sound[1]?.attachTo?.active && sound[1]?.persistOptions?.persistTokenPrototype,\n\t\t\t\t);\n\t\t\t\tsoundFlagsToSet = soundFlagsToSet.filter(\n\t\t\t\t\t(sound) => !sound[1]?.persistOptions?.persistTokenPrototype || !lib.is_UUID(sound[1]?.source) || !sound[1]?.attachTo?.active,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tlet objectSanitizedUuid = object.uuid.replaceAll(\".\", \"-\");\n\t\t\tif(effectFlagsToSet.length) {\n\t\t\t\teffectUpdate[objectSanitizedUuid] = effectFlagsToSet;\n\t\t\t}else{\n\t\t\t\tlib.forceDeletionKeyWrapper(effectUpdate, \"-=\" + objectSanitizedUuid)\n\t\t\t}\n\t\t\t\n\t\t\tif(soundFlagsToSet.length) {\n\t\t\t\tsoundUpdate[objectSanitizedUuid] = soundFlagsToSet;\n\t\t\t}else{\n\t\t\t\tlib.forceDeletionKeyWrapper(soundUpdate, \"-=\" + objectSanitizedUuid)\n\t\t\t}\n\n\t\t\tif(actor instanceof foundry.documents.Actor) {\n\t\t\t\tlet actorSanitizedUuid = actor.uuid.replaceAll(\".\", \"-\");\n\t\t\t\tif (actorEffectFlags.length) {\n\t\t\t\t\teffectUpdate[actorSanitizedUuid] = actorEffectFlags;\n\t\t\t\t} else {\n\t\t\t\t\tlib.forceDeletionKeyWrapper(effectUpdate, \"-=\" + actorSanitizedUuid)\n\t\t\t\t}\n\t\t\t\tif (actorSoundFlags.length) {\n\t\t\t\t\tsoundUpdate[actorSanitizedUuid] = actorSoundFlags;\n\t\t\t\t} else {\n\t\t\t\t\tlib.forceDeletionKeyWrapper(soundUpdate, \"-=\" + actorSanitizedUuid)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait database.update({\n\t\t\t[CONSTANTS.EFFECTS_FLAG]: effectUpdate,\n\t\t\t[CONSTANTS.SOUNDS_FLAG]: soundUpdate\n\t\t});\n\t}, 250),\n\n\tsoundMigrations: {},\n\n\t/**\n\t * Sanitizes the sound data, accounting for changes to the structure in previous versions\n\t *\n\t * @param inDocument\n\t * @returns {array}\n\t */\n\tgetSoundFlags(inDocument) {\n\n\t\tif(!inDocument?.uuid) return [];\n\n\t\tlet sounds = this.getDatabaseFlags().sounds[inDocument.uuid] ?? []\n\n\t\tif (!sounds?.length) return [];\n\n\t\tsounds = foundry.utils.deepClone(sounds);\n\n\t\tconst changes = [];\n\t\tfor (let [soundId, soundData] of sounds) {\n\t\t\tlet soundVersion = soundData?.flagVersion ?? \"1.0.0\";\n\n\t\t\tif (soundData.flagVersion === this.latestFlagVersion) continue;\n\n\t\t\tfor (let [version, migration] of Object.entries(this.soundMigrations)) {\n\t\t\t\tif (!foundry.utils.isNewerVersion(version, soundVersion)) continue;\n\n\t\t\t\tsoundData = migration(inDocument, soundData);\n\t\t\t}\n\n\t\t\tlib.debug(\n\t\t\t\t`Migrated sound with ID ${soundId} from version ${soundVersion} to version ${this.latestFlagVersion}`,\n\t\t\t);\n\n\t\t\tsoundData.flagVersion = this.latestFlagVersion;\n\n\t\t\tchanges.push(soundData);\n\t\t}\n\n\t\tif (changes.length) {\n\t\t\tflagManager.addFlags(inDocument.uuid, { sounds: changes });\n\t\t}\n\n\t\treturn sounds;\n\t},\n\n};\n\nexport default flagManager;\n","import { clamp } from \"./lib.js\";\r\n\r\nexport function smoothstep(edge_0, edge_1, value) {\r\n\tconst t = clamp((value - edge_0) / (edge_1 - edge_0), 0, 1);\r\n\treturn t * t * (3 - 2 * t);\r\n}\r\n\r\nexport function ease_pan_value(pan_value, power) {\r\n\tconst sign = Math.sign(pan_value);\r\n\tconst absolute_value = Math.min(1, Math.abs(pan_value));\r\n\treturn sign * Math.pow(absolute_value, power);\r\n}\r\n\r\nexport function calculate_pan_factor(ray_distance_pixels, inner_radius_pixels, outer_radius_pixels) {\r\n\tif ((inner_radius_pixels > 0 && ray_distance_pixels <= inner_radius_pixels) || outer_radius_pixels <= inner_radius_pixels) {\r\n\t\treturn 0;\r\n\t}\r\n\tconst t = (ray_distance_pixels - inner_radius_pixels) / (outer_radius_pixels - inner_radius_pixels);\r\n\treturn smoothstep(0, 1, t);\r\n}","const PASTE_BATCH_STALE_MS = 5000;\n\nconst PasteManager = {\n\n\tuserId: null,\n\tdocumentName: null,\n\tsourceUuids: null,\n\tcursor: 0,\n\tcapturedAt: 0,\n\tconsumed: new WeakMap(),\n\n\tsetup() {\n\t\tfor (const documentName of [\"Token\", \"Drawing\", \"Tile\", \"MeasuredTemplate\", \"Region\"]) {\n\t\t\tHooks.on(`paste${documentName}`, (objects, data, opts) => {\n\t\t\t\tif (opts?.cut) return;\n\t\t\t\tthis.capture(documentName, objects.map((o) => o.document.uuid));\n\t\t\t});\n\t\t}\n\t},\n\n\t/**\n\t * Records the source UUIDs of a paste operation on the originating client, keyed by document type and\n\t * cursor position. Consumed in lockstep order by the matching createDocumentName hook handlers.\n\t *\n\t * @param {string} documentName\n\t * @param {string[]} sourceUuids\n\t */\n\tcapture(documentName, sourceUuids) {\n\t\tthis.userId = game.user.id;\n\t\tthis.documentName = documentName;\n\t\tthis.sourceUuids = sourceUuids;\n\t\tthis.cursor = 0;\n\t\tthis.capturedAt = Date.now();\n\t},\n\n\t/**\n\t * Returns the source UUID corresponding to the given newly-created document, or null if no paste batch is\n\t * available for this client and document type. The result is memoized per document instance, so multiple\n\t * managers (effect and sound) hooking the same createDocumentName event resolve to the same source UUID.\n\t *\n\t * @param {foundry.abstract.Document} inDocument\n\t * @returns {string|null}\n\t */\n\tconsume(inDocument) {\n\t\tif (this.consumed.has(inDocument)) return this.consumed.get(inDocument);\n\t\tif (!this.sourceUuids) return null;\n\t\tif (this.userId !== game.user.id) return null;\n\t\tif (this.documentName !== inDocument.documentName) return null;\n\t\tif (Date.now() - this.capturedAt > PASTE_BATCH_STALE_MS) {\n\t\t\tthis.sourceUuids = null;\n\t\t\treturn null;\n\t\t}\n\t\tif (this.cursor >= this.sourceUuids.length) {\n\t\t\tthis.sourceUuids = null;\n\t\t\treturn null;\n\t\t}\n\t\tconst sourceUuid = this.sourceUuids[this.cursor++];\n\t\tthis.consumed.set(inDocument, sourceUuid);\n\t\treturn sourceUuid;\n\t},\n\n};\n\nexport default PasteManager;\n","import { sequencerSocket, SOCKET_HANDLERS } from \"../sockets.js\";\r\nimport SequencerAnimationEngine from \"./sequencer-animation-engine.js\";\r\nimport * as lib from \"../lib/lib.js\";\r\nimport SequenceManager from \"./sequence-manager.js\";\r\nimport { EffectsUIApp } from \"../formapplications/effects-ui/effects-ui-app.js\";\r\nimport * as canvaslib from \"../lib/canvas-lib.js\";\r\nimport * as soundlib from \"../lib/sound-lib.js\";\r\nimport { SequencerFileBase } from \"./sequencer-file.js\";\r\nimport CONSTANTS from \"../constants.js\";\r\nimport flagManager from \"../utils/flag-manager.js\";\r\nimport PasteManager from \"./sequencer-paste-manager.js\";\r\n\r\n\r\nconst SOUND_STATES = {\r\n\tSTARTING: 0,\r\n\tPLAYING: 1,\r\n\tENDING: 2,\r\n\tENDED: 3\r\n}\r\n\r\nconst global_sound_mixin = (base_class) =>\r\n\tclass extends base_class {\r\n\t\tget playData() {\r\n\t\t\treturn {\r\n\t\t\t\t...this.data.locationOptions,\r\n\t\t\t\t...this.playbackOptions,\r\n\t\t\t\tvolume: this.data.fadeIn ? 0 : this.data.volume,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tasync playSound(){\r\n\t\t\tthis.sound.play(this.playData);\r\n\t\t}\r\n\t}\r\n\r\nconst placed_sound_mixin = (base_class) =>\r\n\tclass extends base_class {\r\n\r\n\t\tmovementDuration = 0;\r\n\r\n\t\tconstructor(...args) {\r\n\t\t\tsuper(...args);\r\n\t\t\tif (this.isSourceDestroyed) {\r\n\t\t\t\tthis.stop();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tget volume_property() {\r\n\t\t\treturn \"volume_multiplier\";\r\n\t\t}\r\n\r\n\t\tasync load(){\r\n\t\t\tawait super.load();\r\n\t\t\tthis.movementDuration = this.totalDuration;\r\n\t\t\tif(this.moveTowards) {\r\n\t\t\t\tif (this.data.moveSpeed) {\r\n\t\t\t\t\tconst distance = canvaslib.distance_between(\r\n\t\t\t\t\t\tthis.sourcePosition,\r\n\t\t\t\t\t\tthis.targetPosition\r\n\t\t\t\t\t);\r\n\t\t\t\t\tthis.movementDuration = (distance / this.data.moveSpeed) * 1000;\r\n\t\t\t\t}\r\n\t\t\t\tif (this.creationTimeDelta > this.movementDuration) {\r\n\t\t\t\t\tthis.position = this.targetPosition;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tasync playSound() {\r\n\t\t\tawait this.sound.playAtPosition(this.position, this.data.locationOptions?.radius || 1, this.playData);\r\n\t\t}\r\n\r\n\t\tupdate() {\r\n\t\t\tif (this.state !== SOUND_STATES.PLAYING) return;\r\n\r\n\t\t\tlet volume = this.data.volume ?? 0.8;\r\n\r\n\t\t\tlet {\r\n\t\t\t\teasing = true,\r\n\t\t\t\twalls = false,\r\n\t\t\t\tgmAlways = false,\r\n\t\t\t\tsourceData,\r\n\t\t\t\tradius = 1,\r\n\t\t\t\tmuffledEffect = { type: \"lowpass\", intensity: 5 }\r\n\t\t\t} = this.data.locationOptions ?? {};\r\n\r\n\t\t\tlet sourcePosition = this.sourcePosition;\r\n\r\n\t\t\t// Reuse a single empty fallback so the per-frame cache in\r\n\t\t\t// _resolveLevelForSourceData stays hot.\r\n\t\t\tsourceData ??= (this._emptySourceData ??= {});\r\n\t\t\tconst resolvedSourceData = this._resolveLevelForSourceData(sourceData, sourcePosition);\r\n\r\n\t\t\tconst source = new CONFIG.Canvas.soundSourceClass({ object: null });\r\n\t\t\tsource.initialize({\r\n\t\t\t\tx: sourcePosition.x,\r\n\t\t\t\ty: sourcePosition.y,\r\n\t\t\t\televation: sourcePosition.elevation ?? 0,\r\n\t\t\t\tradius: canvas.dimensions.distancePixels * radius,\r\n\t\t\t\twalls,\r\n\t\t\t\t...resolvedSourceData\r\n\t\t\t});\r\n\r\n\t\t\tconst config = { sound: this.sound, source, listener: undefined, volume: 0, walls, muffled: false, pan: 0 };\r\n\r\n\t\t\t// Configure playback volume using the closest listener position\r\n\t\t\tconst listeners = (gmAlways && game.user.isGM) ? [sourcePosition] : canvas.sounds.getListenerPositions();\r\n\t\t\tfor (const l of listeners) {\r\n\t\t\t\tconst v = volume * source.getVolumeMultiplier(l, { easing });\r\n\t\t\t\tObject.assign(config, { listener: l, volume: v });\r\n\t\t\t\tlet ray = new foundry.canvas.geometry.Ray(l, sourcePosition)\r\n\t\t\t\tif(this.data.panSound?.active && ray.distance > 0) {\r\n\t\t\t\t\tconst normalized_x = ray.dx / ray.distance; // -1..1\r\n\r\n\t\t\t\t\tconst panned_value = soundlib.ease_pan_value(normalized_x, 1.6);\r\n\t\t\t\t\tlet pan_ease_factor = 1.0;\r\n\r\n\t\t\t\t\tif(this.data.panSound?.innerEaseDistance > 0) {\r\n\t\t\t\t\t\tconst inner_ease_distance = this.data.panSound?.innerEaseDistance || 0;\r\n\t\t\t\t\t\tconst outer_ease_distance = (\r\n\t\t\t\t\t\t\tthis.data.panSound?.outerEaseDistance || Math.min(inner_ease_distance * 2, this.data.locationOptions?.radius ?? 1)\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t\tconst inner_ease_distance_pixels = (inner_ease_distance / canvas.grid.distance) * canvas.grid.size;\r\n\t\t\t\t\t\tconst outer_ease_distance_pixels = (outer_ease_distance / canvas.grid.distance) * canvas.grid.size;\r\n\t\t\t\t\t\tpan_ease_factor = soundlib.calculate_pan_factor(ray.distance, inner_ease_distance_pixels, outer_ease_distance_pixels);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Within the ease distance => closer to 0, beyond it => full pan\r\n\t\t\t\t\tconfig.pan = panned_value * pan_ease_factor;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tcanvas.sounds._configurePlayback(config);\r\n\r\n\t\t\tlet applyEffect = false;\r\n\t\t\tlet hasMuffledEffect = this.sound.effects.findIndex(e => e.type === muffledEffect.type);\r\n\r\n\t\t\tif (hasMuffledEffect > -1 && !config.muffled) {\r\n\t\t\t\tthis.sound.effects[hasMuffledEffect].disconnect();\r\n\t\t\t\tthis.sound.effects.splice(hasMuffledEffect, 1);\r\n\t\t\t\tapplyEffect = true;\r\n\t\t\t} else if (hasMuffledEffect === -1 && config.muffled) {\r\n\t\t\t\tconst sfx = CONFIG.soundEffects;\r\n\t\t\t\tlet effect;\r\n\t\t\t\tif (config.muffled && (muffledEffect?.type in sfx)) {\r\n\t\t\t\t\tconst muffledCfg = sfx[muffledEffect.type];\r\n\t\t\t\t\teffect = new muffledCfg.effectClass(this.sound.context, muffledEffect);\r\n\t\t\t\t\tthis.sound.effects.push(effect);\r\n\t\t\t\t}\r\n\t\t\t\tapplyEffect = true;\r\n\t\t\t}\r\n\r\n\t\t\tlet hasPanner = this.sound.effects.findIndex(e => e.type === \"panner\");\r\n\t\t\tif(this.data.panSound) {\r\n\t\t\t\tthis.panner ||= this.sound.context.createStereoPanner();\r\n\t\t\t\tthis.panner.type = \"panner\"\r\n\t\t\t\tif (hasPanner === -1) {\r\n\t\t\t\t\tthis.sound.effects.push(this.panner);\r\n\t\t\t\t\tapplyEffect = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(applyEffect) {\r\n\t\t\t\tthis.sound.applyEffects(this.sound.effects);\r\n\t\t\t}\r\n\r\n\t\t\tif (this.data.attachTo?.active) {\r\n\t\t\t\tif (this.sourceDocument.hidden) {\r\n\t\t\t\t\tconfig.volume = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis.sound.volume = config.volume * this.sound.volume_multiplier;\r\n\r\n\t\t\tif(this.data.panSound) {\r\n\t\t\t\tconst t = this.sound.context.currentTime;\r\n\t\t\t\tthis.panner.pan.cancelScheduledValues(t);\r\n\t\t\t\tthis.panner.pan.setValueAtTime(this.panner.pan.value, t);\r\n\t\t\t\tthis.panner.pan.linearRampToValueAtTime(config.pan, t + 0.03);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tget playData() {\r\n\t\t\tlet volume = this.data.volume ?? 0.8;\r\n\t\t\tif (this.data.attachTo?.active) {\r\n\t\t\t\tif (this.sourceDocument.hidden) {\r\n\t\t\t\t\tvolume = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// `sourceData ??= {}` would alloc a fresh empty object every\r\n\t\t\t// call and defeat the per-frame memoization in\r\n\t\t\t// _resolveLevelForSourceData. Reuse a single empty fallback.\r\n\t\t\tconst baseSourceData = this.data.locationOptions?.sourceData\r\n\t\t\t\t?? (this._emptySourceData ??= {});\r\n\t\t\tconst sourceData = this._resolveLevelForSourceData(baseSourceData, this.sourcePosition);\r\n\t\t\treturn {\r\n\t\t\t\teasing: true,\r\n\t\t\t\twalls: false,\r\n\t\t\t\tgmAlways: false,\r\n\t\t\t\tradius: 1,\r\n\t\t\t\tmuffledEffect: { type: \"lowpass\", intensity: 5 },\r\n\t\t\t\t...this.data.locationOptions,\r\n\t\t\t\tsourceData,\r\n\t\t\t\tplaybackOptions: this.playbackOptions,\r\n\t\t\t\tvolume\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Merge a scene level id into the PointSoundSource init payload\r\n\t\t * so Foundry's cross-level attenuation works. Honors `.onLevels()`.\r\n\t\t *\r\n\t\t * Called per frame for moving sounds via the update ticker, so\r\n\t\t * the result is memoized on `(baseSourceData ref, elevation)`.\r\n\t\t * The `.onLevels()` restriction Set is built once and resolves\r\n\t\t * names against the scene the sound is playing in.\r\n\t\t *\r\n\t\t * @param {object} baseSourceData\r\n\t\t * @param {{elevation?: number}|undefined} position\r\n\t\t * @returns {object}\r\n\t\t * @private\r\n\t\t */\r\n\t\t_resolveLevelForSourceData(baseSourceData, position) {\r\n\t\t\tif (!CONSTANTS.IS_V14) return baseSourceData;\r\n\t\t\tif (baseSourceData?.level !== undefined) return baseSourceData;\r\n\t\t\tif (typeof canvas?.inferLevelFromElevation !== \"function\") return baseSourceData;\r\n\t\t\tconst elevation = position?.elevation ?? 0;\r\n\t\t\tif (this._levelResolvedSourceData\r\n\t\t\t\t&& this._levelResolvedBase === baseSourceData\r\n\t\t\t\t&& this._levelResolvedElevation === elevation) {\r\n\t\t\t\treturn this._levelResolvedSourceData;\r\n\t\t\t}\r\n\t\t\tif (this._levelRestrictionSet === undefined) {\r\n\t\t\t\tthis._levelRestrictionSet = this._buildLevelRestrictionSet();\r\n\t\t\t}\r\n\t\t\tconst level = canvas.inferLevelFromElevation(elevation, {\r\n\t\t\t\tlevels: this._levelRestrictionSet || undefined\r\n\t\t\t});\r\n\t\t\tconst resolved = level ? { ...baseSourceData, level: level.id } : baseSourceData;\r\n\t\t\tthis._levelResolvedBase = baseSourceData;\r\n\t\t\tthis._levelResolvedElevation = elevation;\r\n\t\t\tthis._levelResolvedSourceData = resolved;\r\n\t\t\treturn resolved;\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Resolve `.onLevels()` entries (ids or names) to a Set of ids\r\n\t\t * against the scene the sound is playing in. Returns null when\r\n\t\t * no restriction is set, an empty Set when entries were given\r\n\t\t * but none resolved (so Foundry sees no allowed levels).\r\n\t\t *\r\n\t\t * @returns {Set<string>|null}\r\n\t\t * @private\r\n\t\t */\r\n\t\t_buildLevelRestrictionSet() {\r\n\t\t\tconst entries = this.data.levels;\r\n\t\t\tif (!entries?.length) return null;\r\n\t\t\tconst sceneLevels = canvas?.scene?.levels;\r\n\t\t\tconst ids = new Set();\r\n\t\t\tfor (const entry of entries) {\r\n\t\t\t\tif (sceneLevels?.get(entry)) {\r\n\t\t\t\t\tids.add(entry);\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tconst byName = sceneLevels?.getName?.(entry);\r\n\t\t\t\tif (byName) ids.add(byName.id);\r\n\t\t\t}\r\n\t\t\treturn ids;\r\n\t\t}\r\n\r\n\t\tanimate() {\r\n\t\t\tsuper.animate();\r\n\t\t\tcanvas.app.ticker.add(this.update, this);\r\n\r\n\t\t\tif (this.data.moveTowards && this.creationTimeDelta <= this.movementDuration) {\r\n\t\t\t\tconst sourcePos = this.sourcePosition;\r\n\t\t\t\tconst targetPos = this.targetPosition;\r\n\r\n\t\t\t\tSequencerAnimationEngine.addAnimation(this.data._id, {\r\n\t\t\t\t\ttarget: this,\r\n\t\t\t\t\tpropertyName: \"position.x\",\r\n\t\t\t\t\tfrom: sourcePos.x,\r\n\t\t\t\t\tto: targetPos.x,\r\n\t\t\t\t\tduration: this.movementDuration,\r\n\t\t\t\t\tease: this.data.moveTowards.ease ?? \"linear\",\r\n\t\t\t\t\tdelay: 0,\r\n\t\t\t\t\tabsolute: true\r\n\t\t\t\t});\r\n\r\n\t\t\t\tSequencerAnimationEngine.addAnimation(this.data._id, {\r\n\t\t\t\t\ttarget: this,\r\n\t\t\t\t\tpropertyName: \"position.y\",\r\n\t\t\t\t\tfrom: sourcePos.y,\r\n\t\t\t\t\tto: targetPos.y,\r\n\t\t\t\t\tduration: this.movementDuration,\r\n\t\t\t\t\tease: this.data.moveTowards.ease ?? \"linear\",\r\n\t\t\t\t\tdelay: 0,\r\n\t\t\t\t\tabsolute: true\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tstop() {\r\n\t\t\tcanvas.app.ticker.remove(this.update, this);\r\n\t\t\tif (this.panner) {\r\n\t\t\t\tthis.panner.disconnect();\r\n\t\t\t}\r\n\t\t\tsuper.stop();\r\n\t\t}\r\n\t};\r\n\r\nconst persistent_sound_mixin = (base_class) =>\r\n\tclass extends base_class {\r\n\t\tstop() {\r\n\t\t\tflagManager.removeFlags(this.context.uuid, {\r\n\t\t\t\tsounds: this.data\r\n\t\t\t});\r\n\t\t\tlet extraEndDuration = this.data.extraEndDuration ?? 0;\r\n\t\t\tlet endDuration = extraEndDuration + this.fadeOut();\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tSequenceManager.RunningSounds.delete(this.id);\r\n\t\t\t\tsuper.stop();\r\n\t\t\t}, endDuration);\r\n\t\t}\r\n\r\n\t\tfadeIn() {\r\n\t\t\tlet fadeInDuration = Math.min(this.data.fadeIn.duration, this.totalDuration)\r\n\t\t\tif (this.creationTimeDelta <= fadeInDuration) {\r\n\t\t\t\tsuper.fadeIn();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tget startOffset() {\r\n\t\t\tlet offset = (this.startTime ?? 0);\r\n\t\t\tif (this.creationTimeDelta > this.soundDuration && this.state === SOUND_STATES.STARTING) {\r\n\t\t\t\toffset += this.creationTimeDelta % this.duration;\r\n\t\t\t}\r\n\t\t\treturn offset;\r\n\t\t}\r\n\r\n\t\tget loopDuration() {\r\n\t\t\tif (this.state === SOUND_STATES.STARTING) {\r\n\t\t\t\treturn super.loopDuration -  this.startOffset;\r\n\t\t\t}\r\n\t\t\treturn super.loopDuration;\r\n\t\t}\r\n\r\n\t\tget isLoopingSound() {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\r\nclass SequencerSound {\r\n\r\n\t/**\r\n\t * @property {string} id - Unique identifier for the sound.\r\n\t */\r\n\tid;\r\n\r\n\t/**\r\n\t * @property {Object} data - The data associated with the sound.\r\n\t */\r\n\tdata;\r\n\r\n\t/**\r\n\t * @property {Object} twister - Mersenne Twister instance for random number generation.\r\n\t */\r\n\ttwister;\r\n\r\n\t/**\r\n\t * @property {number} actualCreationTime - The actual creation time of the sound.\r\n\t */\r\n\tactualCreationTime;\r\n\r\n\t/**\r\n\t * @property {number} creationTimeDelta - The difference in time since the sound was created and when it started playing.\r\n\t */\r\n\tcreationTimeDelta;\r\n\r\n\t/**\r\n\t * @property {number} state - The current state of the sound.\r\n\t * Possible values are:\r\n\t * - 0: STARTING - The sound is in the process of starting.\r\n\t * - 1: PLAYING - The sound is currently playing.\r\n\t * - 2: ENDING - The sound is in the process of ending.\r\n\t * - 3: ENDED - The sound has finished playing.\r\n\t */\r\n\tstate;\r\n\r\n\t/**\r\n\t * @property {Object|null} sound - The sound object instance.\r\n\t */\r\n\tsound;\r\n\r\n\t/**\r\n\t * @property {number|null} totalDuration - The total playback duration of the sound.\r\n\t */\r\n\ttotalDuration;\r\n\r\n\t/**\r\n\t * @property {number|null} soundDuration - The duration of the actual sound file.\r\n\t */\r\n\tsoundDuration;\r\n\r\n\t/**\r\n\t * @property {number|null} startTime - The start time of the sound in milliseconds.\r\n\t */\r\n\tstartTime;\r\n\r\n\t/**\r\n\t * @property {number|null} endTime - The end time of the sound in milliseconds.\r\n\t */\r\n\tendTime;\r\n\r\n\t/**\r\n\t * @private\r\n\t * @property {Object|null} #file - The file metadata associated with the sound.\r\n\t */\r\n\t#file;\r\n\r\n\t/**\r\n\t * @property {boolean} shouldPlaySound - Whether the sound should play based on user settings.\r\n\t */\r\n\tshouldPlaySound;\r\n\r\n\t/**\r\n\t * @property {Object|null} panner - Stereo panner node for sound effects.\r\n\t */\r\n\tpanner;\r\n\r\n\t/**\r\n\t * @property {number} loops - Number of loops the sound is configured to play.\r\n\t */\r\n\tloops;\r\n\r\n\t/**\r\n\t * @property {number} loopDelay - Delay between loops in milliseconds.\r\n\t */\r\n\tloopDelay;\r\n\r\n\t/**\r\n\t * @property {number} currentLoop - The current loop count.\r\n\t */\r\n\tcurrentLoop = 1;\r\n\r\n\t/**\r\n\t * @property {Object|null} _sourcePosition - The source position of the sound on canvas.\r\n\t */\r\n\t_sourcePosition;\r\n\r\n\t/**\r\n\t * @property {Object|null} _targetPosition - The target position of the sound on canvas.\r\n\t */\r\n\t_targetPosition;\r\n\r\n\t/**\r\n\t * @property {Object|null} loopTimes - Information about the loop's start and end times.\r\n\t */\r\n\tloopTimes;\r\n\r\n\t/**\r\n\t * @property {Object|null} position - The current playback position of the sound.\r\n\t */\r\n\tposition;\r\n\r\n\t/**\r\n\t * The resolve method for the promise of the sound finishing;\r\n\t */\r\n\t#resolve;\r\n\r\n\tconstructor(data) {\r\n\t\tthis.id = data._id\r\n\t\tthis.data = data;\r\n\t\tthis.twister = lib.createMersenneTwister(data.seed);\r\n\t\tthis.actualCreationTime = (+new Date());\r\n\t\tthis.creationTimeDelta = this.actualCreationTime - this.data.creationTimestamp;\r\n\t\tthis.state = SOUND_STATES.STARTING;\r\n\t\tthis.shouldPlaySound = game.settings.get(\"sequencer\", \"soundsEnabled\") &&\r\n\t\t\tgame.user.viewedScene === data.sceneId &&\r\n\t\t\t(!data?.users?.length || data?.users?.includes(game.userId));\r\n\t\tthis.panner = null;\r\n\t\tthis.totalLoops = this.data.loopOptions.loops ?? 0;\r\n\t\tthis.delayBetweenLoops = this.data.loopOptions.loopDelay ?? 0;\r\n\t\tthis.position = this.sourcePosition;\r\n\t}\r\n\r\n\tstatic make(data) {\r\n\t\tif (data.persist && data.source && !data.global) {\r\n\t\t\treturn new SequencerPersistentPlacedSound(data);\r\n\t\t} else if (data.source && !data.global) {\r\n\t\t\treturn new SequencerPlacedSound(data);\r\n\t\t} else if (data.persist) {\r\n\t\t\treturn new SequencerPersistentGlobalSound(data);\r\n\t\t}\r\n\t\treturn new SequencerGlobalSound(data);\r\n\t}\r\n\r\n\tget sourcePosition() {\r\n\t\tif (this.data.attachTo?.active) {\r\n\t\t\tif (!this.isSourceDestroyed) {\r\n\t\t\t\tlet position = canvaslib.get_object_position(this.source);\r\n\t\t\t\tlet offset = canvaslib.getOffsetFromData(this.data, { type: \"source\", twister: this.twister });\r\n\t\t\t\tlet elevation = this.data.attachTo.bindElevation ? (position.elevation ?? 0) : 0;\r\n\t\t\t\tthis._sourcePosition = {\r\n\t\t\t\t\tx: position.x - offset.x,\r\n\t\t\t\t\ty: position.y - offset.y,\r\n\t\t\t\t\televation: this._applyElevationOverride(elevation),\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t} else if (!this._sourcePosition) {\r\n\t\t\tconst fromData = this.data.source ? canvaslib.getPositionFromData(this.data, \"source\", this.twister) : false;\r\n\t\t\tif (fromData) {\r\n\t\t\t\tfromData.elevation = this._applyElevationOverride(fromData.elevation ?? 0);\r\n\t\t\t}\r\n\t\t\tthis._sourcePosition = fromData;\r\n\t\t}\r\n\t\treturn this._sourcePosition;\r\n\t}\r\n\r\n\t_applyElevationOverride(baseElevation) {\r\n\t\tconst override = this.data.elevation;\r\n\t\tif (!override) return baseElevation;\r\n\t\tif (override.absolute) return override.elevation ?? 0;\r\n\t\treturn baseElevation + (override.elevation ?? 0);\r\n\t}\r\n\r\n\tget targetPosition() {\r\n\t\tif (!this._targetPosition) {\r\n\t\t\tthis._targetPosition = this.data.target ? canvaslib.getPositionFromData(this.data, \"target\", this.twister) : false;\r\n\t\t}\r\n\t\treturn this._targetPosition;\r\n\t}\r\n\r\n\t_validateObject(inObject) {\r\n\t\tif (lib.is_UUID(inObject) || !canvaslib.is_object_canvas_data(inObject)) {\r\n\t\t\tinObject = lib.get_object_from_scene(inObject, this.data.sceneId);\r\n\t\t\tinObject = inObject?._object ?? inObject;\r\n\t\t}\r\n\t\treturn inObject;\r\n\t}\r\n\r\n\t_getObjectByID(inIdentifier, specific = false, returnSource = false) {\r\n\t\tlet source = inIdentifier;\r\n\t\tlet offsetMap = this._nameOffsetMap?.[inIdentifier];\r\n\t\tif (offsetMap) {\r\n\t\t\tif (specific) {\r\n\t\t\t\tsource = (returnSource\r\n\t\t\t\t\t\t? offsetMap?.sourceObj || offsetMap?.targetObj\r\n\t\t\t\t\t\t: offsetMap?.targetObj || offsetMap?.sourceObj\r\n\t\t\t\t) || source;\r\n\t\t\t} else {\r\n\t\t\t\tsource = offsetMap?.targetObj || offsetMap?.sourceObj || source;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tsource = this._validateObject(source);\r\n\t\t}\r\n\t\treturn source;\r\n\t}\r\n\r\n\t/**\r\n\t * Whether the source of this sound has been destroyed\r\n\t *\r\n\t * @returns {boolean}\r\n\t */\r\n\tget isSourceDestroyed() {\r\n\t\treturn (\r\n\t\t\tthis.source && this.source?.destroyed && (!this.sourceDocument?.object || this.sourceDocument?.object?.destroyed || this.source.constructor.name === \"Crosshairs\")\r\n\t\t);\r\n\t}\r\n\r\n\tget source() {\r\n\t\tif (!this._source && this.data.source) {\r\n\t\t\tconst getDifferentTarget = this.data.source === this.data.target;\r\n\t\t\tthis._source = this._getObjectByID(this.data.source?.uuid ?? this.data.source, getDifferentTarget, true) ?? this.data.source;\r\n\t\t\tthis._source = this._source?._object ?? this._source;\r\n\t\t}\r\n\t\treturn this._source;\r\n\t}\r\n\r\n\tget sourceDocument() {\r\n\t\treturn this.source?.document ?? this.source;\r\n\t}\r\n\r\n\tget target() {\r\n\t\tif (!this._target && this.data.target) {\r\n\t\t\tconst getDifferentTarget = this.data.source === this.data.target;\r\n\t\t\tthis._target = this._getObjectByID(this.data.target?.uuid ?? this.data.target, getDifferentTarget, false) ?? this.data.target;\r\n\t\t\tthis._target = this._target?._object ?? this._target;\r\n\t\t}\r\n\t\treturn this._target;\r\n\t}\r\n\r\n\tget targetDocument() {\r\n\t\treturn this.target?.document ?? this.target;\r\n\t}\r\n\r\n\tget context() {\r\n\t\treturn this.data.attachTo?.active && this.sourceDocument\r\n\t\t\t? this.sourceDocument\r\n\t\t\t: game.scenes.get(this.data.sceneId);\r\n\t}\r\n\r\n\tstatic checkShouldPlay(data) {\r\n\t\treturn !data.local || data.creatorUserId === game.user.id;\r\n\t}\r\n\r\n\tstatic checkValid(data) {\r\n\t\tif (data.delete) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tlet sourceExists = true;\r\n\t\tlet targetExists = true;\r\n\t\tif (data.source && lib.is_UUID(data.source)) {\r\n\t\t\tsourceExists = fromUuidSync(data.source);\r\n\t\t}\r\n\t\tif (data.target && lib.is_UUID(data.target)) {\r\n\t\t\ttargetExists = fromUuidSync(data.target);\r\n\t\t}\r\n\t\tfor (let tiedDocumentUuid of data?.tiedDocuments ?? []) {\r\n\t\t\tif (tiedDocumentUuid && lib.is_UUID(tiedDocumentUuid)) {\r\n\t\t\t\tlet tiedDocumentExists = fromUuidSync(tiedDocumentUuid);\r\n\t\t\t\tif (!tiedDocumentExists) return false;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (\r\n\t\t\tdata.source &&\r\n\t\t\tlib.is_UUID(data.source) &&\r\n\t\t\tdata.target &&\r\n\t\t\tlib.is_UUID(data.target)\r\n\t\t) {\r\n\t\t\tconst sourceScene = data.source.split(\".\")[1];\r\n\t\t\tconst targetScene = data.target.split(\".\")[1];\r\n\t\t\tif (sourceScene !== targetScene || sourceScene !== data.sceneId)\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\treturn sourceExists && targetExists;\r\n\t}\r\n\r\n\tget startOffset() {\r\n\t\treturn (this.startTime ?? 0)\r\n\t}\r\n\r\n\tget isLoopingSound() {\r\n\t\treturn this.loopTimes !== undefined || (this.totalLoops && this.currentLoop < this.totalLoops);\r\n\t}\r\n\r\n\tget looping() {\r\n\t\treturn this.isLoopingSound && this.state === SOUND_STATES.PLAYING;\r\n\t}\r\n\r\n\tget playbackOptions() {\r\n\t\tlet loopStart = (this.startTime ?? 0);\r\n\t\tlet loopEnd = (this.endTime ?? 0);\r\n\t\tlet offset = this.startOffset / 1000;\r\n\t\tlib.debug(\"SOUND DEBUG\", [this, this.currentLoop, Object.keys(SOUND_STATES)[this.state]])\r\n\t\tif(this.loopTimes && this.isLoopingSound){\r\n\t\t\tif(this.state === SOUND_STATES.PLAYING){\r\n\t\t\t\tloopStart = this.loopTimes.loopStart;\r\n\t\t\t\toffset = this.loopTimes.loopStart;\r\n\t\t\t}\r\n\t\t\tif(this.state === SOUND_STATES.STARTING || this.state === SOUND_STATES.PLAYING){\r\n\t\t\t\tloopEnd = this.loopTimes.loopEnd;\r\n\t\t\t}\r\n\t\t\tif(this.state === SOUND_STATES.ENDING){\r\n\t\t\t\tloopStart = this.loopTimes.forcedEnd || this.loopTimes.loopEnd;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn {\r\n\t\t\toffset,\r\n\t\t\tloop: this.looping,\r\n\t\t\tloopStart: loopStart / 1000,\r\n\t\t\tloopEnd: loopEnd / 1000,\r\n\t\t\tchannel: this.data.channel || \"interface\",\r\n\t\t\tdelay: 0\r\n\t\t};\r\n\t}\r\n\r\n\tasync load() {\r\n\t\tif (!this.sound) {\r\n\t\t\tlet placedOnCanvas = this.data.source && !this.data.global;\r\n\t\t\tlet sound = new foundry.audio.Sound(this.getFile(), {\r\n\t\t\t\tcontext: placedOnCanvas ? game.audio.environment : game.audio.interface\r\n\t\t\t});\r\n\t\t\tawait sound.load();\r\n\t\t\tthis.sound = sound;\r\n\t\t}\r\n\t\tthis.soundDuration = this.sound.duration * 1000;\r\n\r\n\t\tthis.startTime = 0;\r\n\t\tthis.endTime = this.soundDuration;\r\n\r\n\t\tif (this.data.time?.start) {\r\n\t\t\tif (this.data.time.start.isPerc) {\r\n\t\t\t\tthis.startTime = this.data.time.start.value * this.soundDuration;\r\n\t\t\t} else {\r\n\t\t\t\tthis.startTime = this.data.time.start.value;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (this.data.time?.end) {\r\n\t\t\tif (this.data.time.end.isPerc) {\r\n\t\t\t\tthis.endTime = this.soundDuration - (this.soundDuration * this.data.time.end.value);\r\n\t\t\t} else {\r\n\t\t\t\tthis.endTime = this.data.time.isRange\r\n\t\t\t\t\t? this.data.time.end.value\r\n\t\t\t\t\t: this.soundDuration - this.data.time.end.value;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.duration = this.data.duration === false\r\n\t\t\t? this.endTime - this.startTime\r\n\t\t\t: this.data.duration;\r\n\r\n\t\tthis.totalDuration = this.duration;\r\n\r\n\t\tif (this.totalLoops && !this.data.duration) {\r\n\t\t\tthis.totalDuration += this.delayBetweenLoops;\r\n\t\t\tthis.totalDuration *= this.totalLoops + 1;\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tthis.file?.markers &&\r\n\t\t\tthis.startTime === 0 &&\r\n\t\t\tthis.endTime === this.duration\r\n\t\t) {\r\n\t\t\tthis.loopTimes = {\r\n\t\t\t\tloopStart: this.file.markers.loop.start,\r\n\t\t\t\tloopEnd: this.file.markers.loop.end,\r\n\t\t\t\tforcedEnd: this.file.markers.forcedEnd,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tthis.sound.data = this.data;\r\n\t\tthis.sound.sound_id = this.data._id;\r\n\t\tthis.sound.loop = this.totalDuration > this.soundDuration && !(this.totalLoops && this.delayBetweenLoops);\r\n\t\tthis.sound.volume_multiplier = 1.0;\r\n\t\tthis.sound.volume = this.data.volume * this.sound.volume_multiplier;\r\n\t}\r\n\r\n\tget volume_property() {\r\n\t\treturn \"volume\";\r\n\t}\r\n\r\n\tget file() {\r\n\t\tif (this.#file){\r\n\t\t\treturn this.#file;\r\n\t\t}\r\n\t\tlet file;\r\n\r\n\t\tif (this.data.customRange) {\r\n\t\t\tconst template = this.data.template\r\n\t\t\t\t? [this.data.template.gridSize, this.data.template.startPoint, this.data.template.endPoint]\r\n\t\t\t\t: [100, 0, 0];\r\n\t\t\tfile = SequencerFileBase.make(\r\n\t\t\t\tthis.data.file,\r\n\t\t\t\t\"temporary.range.file\",\r\n\t\t\t\t{ template },\r\n\t\t\t);\r\n\t\t} else if (Sequencer.Database.entryExists(this.data.file)) {\r\n\t\t\tfile = Sequencer.Database.getEntry(this.data.file).clone();\r\n\t\t} else {\r\n\t\t\tfile = SequencerFileBase.make(this.data.file);\r\n\t\t}\r\n\r\n\t\tif (lib.is_real_number(this.data.forcedIndex)) {\r\n\t\t\tfile.fileIndex = this.data.forcedIndex;\r\n\t\t}\r\n\t\tthis.#file = file;\r\n\t\treturn file;\r\n\t}\r\n\r\n\tgetFile() {\r\n\t\tif (this.file.rangeFind && this.source && this.target){\r\n\t\t\tlet distance = (new foundry.canvas.geometry.Ray(this.sourcePosition, this.targetPosition)).distance;\r\n\t\t\treturn this.file.getFileForDistance(distance);\r\n\t\t}\r\n\t\treturn this.file.getFile();\r\n\t}\r\n\r\n\tasync playSound(){\r\n\t\tthrow new Error(\"NotImplementedError: playSound() must be implemented by a subclass of SequencerSound.\");\r\n\t}\r\n\r\n\tstartPlay() {\r\n\t\tlet { promise, resolve } = Promise.withResolvers();\r\n\t\tthis.#resolve = resolve;\r\n\t\tthis.play();\r\n\t\treturn promise;\r\n\t}\r\n\r\n\tasync play() {\r\n\r\n\t\tif (this.state === SOUND_STATES.ENDED){\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!this.shouldPlaySound) {\r\n\t\t\tthis.state = SOUND_STATES.ENDED;\r\n\t\t\tthis.#resolve();\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (this.totalLoops && this.currentLoop > this.totalLoops) {\r\n\t\t\treturn this.stop();\r\n\t\t}\r\n\r\n\t\tif(this.currentLoop === this.totalLoops){\r\n\t\t\tthis.state = SOUND_STATES.ENDING;\r\n\t\t}\r\n\r\n\t\tif (game.audio.locked) {\r\n\t\t\tsetTimeout(() => this.play(), 100);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tawait this.sound.stop();\r\n\t\tawait this.playSound();\r\n\r\n\t\tif (!this.sound.gain) {\r\n\t\t\tsetTimeout(() => this.play(), 100);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (this.state === SOUND_STATES.STARTING) {\r\n\t\t\tthis.animate();\r\n\t\t}\r\n\r\n\t\tif(this.isLoopingSound) {\r\n\t\t\tif(this.totalLoops) {\r\n\t\t\t\tthis.currentLoop += 1;\r\n\t\t\t}\r\n\t\t\tsetTimeout(this.play.bind(this), this.loopDuration);\r\n\t\t}else{\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.stop();\r\n\t\t\t}, this.duration);\r\n\t\t}\r\n\r\n\t\tif(this.state === SOUND_STATES.STARTING){\r\n\t\t\tthis.state = SOUND_STATES.PLAYING;\r\n\t\t}\r\n\t}\r\n\r\n\tget loopDuration() {\r\n\t\tlet duration = this.duration;\r\n\t\tif (this.loopTimes){\r\n\t\t\tif(this.state === SOUND_STATES.STARTING){\r\n\t\t\t\tduration = this.loopTimes.loopEnd;\r\n\t\t\t} else if (this.state === SOUND_STATES.PLAYING) {\r\n\t\t\t\tduration = this.loopTimes.loopEnd - this.loopTimes.loopStart;\r\n\t\t\t} else if(this.state === SOUND_STATES.ENDING){\r\n\t\t\t\tduration = this.soundDuration - this.loopTimes.loopEnd;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn duration;\r\n\t}\r\n\r\n\tanimate() {\r\n\t\tif (!this.shouldPlaySound) return;\r\n\r\n\t\tif (this.data.fadeIn) {\r\n\t\t\tthis.fadeIn();\r\n\t\t}\r\n\r\n\t\tif (this.data.fadeOut) {\r\n\t\t\tthis.fadeOut();\r\n\t\t}\r\n\t}\r\n\r\n\tstop() {\r\n\t\tif(this.loopTimes && this.state !== SOUND_STATES.ENDED){\r\n\t\t\tthis.state = SOUND_STATES.ENDING;\r\n\r\n\t\t\tlet currentTime = this.sound.currentTime * 1000;\r\n\r\n\t\t\tlet lastLoopWaitDuration = currentTime > this.loopTimes.loopStart\r\n\t\t\t\t? this.loopTimes.loopEnd - currentTime\r\n\t\t\t\t: this.loopTimes.loopStart - currentTime;\r\n\r\n\t\t\tif(this.loopTimes.forcedEnd) {\r\n\t\t\t\tthis.play();\r\n\t\t\t}else{\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\tthis.play();\r\n\t\t\t\t}, lastLoopWaitDuration);\r\n\t\t\t}\r\n\t\t\tlet stopWaitDuration = this.loopTimes.forcedEnd\r\n\t\t\t\t? this.duration - this.loopTimes.forcedEnd\r\n\t\t\t\t: lastLoopWaitDuration + (this.duration - this.loopTimes.loopEnd);\r\n\t\t\treturn setTimeout(() => {\r\n\t\t\t\tthis.state = SOUND_STATES.ENDED;\r\n\t\t\t\tthis.sound.stop();\r\n\t\t\t\tthis.#resolve();\r\n\t\t\t}, stopWaitDuration);\r\n\t\t}\r\n\t\tthis.state = SOUND_STATES.ENDED;\r\n\t\tthis.sound.stop();\r\n\t\tthis.#resolve();\r\n\t}\r\n\r\n\tfadeIn() {\r\n\t\tthis.sound.volume = 0.0;\r\n\t\tSequencerAnimationEngine.addAnimation(this.data._id, {\r\n\t\t\ttarget: this.sound,\r\n\t\t\tpropertyName: this.volume_property,\r\n\t\t\tfrom: 0.0,\r\n\t\t\tto: 1.0,\r\n\t\t\tduration: Math.min(this.data.fadeIn.duration, this.duration),\r\n\t\t\tease: this.data.fadeIn.ease,\r\n\t\t\tdelay: Math.min(this.data.fadeIn.delay, this.duration),\r\n\t\t\tabsolute: true\r\n\t\t});\r\n\t}\r\n\r\n\tfadeOut(immediate = false) {\r\n\t\tif (!this.data.fadeOut) return 0;\r\n\r\n\t\tlet duration = Math.min(this.data.fadeOut.duration, this.duration);\r\n\t\tlet delay = lib.is_real_number(immediate)\r\n\t\t\t? Math.max(immediate - this.data.fadeOut.duration + this.data.fadeOut.delay, 0)\r\n\t\t\t: Math.max(this.totalDuration - this.data.fadeOut.duration + this.data.fadeOut.delay, 0);\r\n\r\n\t\tSequencerAnimationEngine.addAnimation(this.data._id, {\r\n\t\t\ttarget: this.sound,\r\n\t\t\tpropertyName: this.volume_property,\r\n\t\t\tfrom: 1.0,\r\n\t\t\tto: 0.0,\r\n\t\t\tduration,\r\n\t\t\tease: this.data.fadeOut.ease,\r\n\t\t\tdelay,\r\n\t\t\tabsolute: true\r\n\t\t});\r\n\r\n\t\treturn duration + delay;\r\n\t}\r\n\r\n\taddFlags() {\r\n\t\tlet uuid = this.context?.uuid;\r\n\t\tif (uuid) {\r\n\t\t\tflagManager.addFlags(uuid, { sounds: this.data });\r\n\t\t}\r\n\t}\r\n}\r\n\r\nclass SequencerGlobalSound extends global_sound_mixin(SequencerSound) {}\r\nclass SequencerPersistentGlobalSound extends global_sound_mixin(persistent_sound_mixin(SequencerSound)) {}\r\nclass SequencerPlacedSound extends placed_sound_mixin(SequencerSound) {}\r\nclass SequencerPersistentPlacedSound extends placed_sound_mixin(persistent_sound_mixin(SequencerSound)) {}\r\n\r\nexport default class SequencerSoundManager {\r\n\r\n\tstatic states = SOUND_STATES;\r\n\r\n\tstatic setup() {\r\n\t\tHooks.on(\"createToken\", this._documentCreated.bind(this));\r\n\t\tHooks.on(\"createDrawing\", this._documentCreated.bind(this));\r\n\t\tHooks.on(\"createTile\", this._documentCreated.bind(this));\r\n\t\tHooks.on(\"createMeasuredTemplate\", this._documentCreated.bind(this));\r\n\t\tHooks.on(\"createRegion\", this._documentCreated.bind(this));\r\n\t}\r\n\r\n\tstatic _patchSoundDataForDocument(inDocumentUuid, sounds) {\r\n\t\treturn sounds.map((sound) => {\r\n\t\t\tsound[0] = foundry.utils.randomID();\r\n\t\t\tconst soundData = sound[1];\r\n\t\t\tsoundData._id = sound[0];\r\n\t\t\tif (lib.is_UUID(soundData.source)) {\r\n\t\t\t\tsoundData.source = inDocumentUuid;\r\n\t\t\t}\r\n\t\t\tsoundData.sceneId = inDocumentUuid.split(\".\")[1];\r\n\t\t\treturn sound;\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Plays the sounds of a given document on creation\r\n\t *\r\n\t * @param inDocument\r\n\t * @returns {*}\r\n\t */\r\n\tstatic async _documentCreated(inDocument) {\r\n\t\tlet sounds = flagManager.getSoundFlags(inDocument);\r\n\t\tif (inDocument instanceof TokenDocument && inDocument?.actorLink) {\r\n\t\t\tlet actorSounds = flagManager.getSoundFlags(inDocument?.actor);\r\n\t\t\tif (actorSounds.length) {\r\n\t\t\t\tactorSounds = this._patchSoundDataForDocument(\r\n\t\t\t\t\tinDocument.uuid,\r\n\t\t\t\t\tactorSounds\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tsounds = sounds.concat(actorSounds);\r\n\t\t}\r\n\t\tconst sourceUuid = PasteManager.consume(inDocument);\r\n\t\tif (sourceUuid) {\r\n\t\t\tconst sourceSounds = flagManager.getSoundFlags({ uuid: sourceUuid });\r\n\t\t\tif (sourceSounds.length) {\r\n\t\t\t\tconst rekeyed = this._patchSoundDataForDocument(inDocument.uuid, sourceSounds);\r\n\t\t\t\tconst soundDatas = rekeyed.map(([, data]) => data);\r\n\t\t\t\tflagManager.addFlags(inDocument.uuid, { sounds: soundDatas });\r\n\t\t\t\tfor (const soundData of soundDatas) {\r\n\t\t\t\t\tsequencerSocket.executeForOthers(SOCKET_HANDLERS.PLAY_SOUND, soundData, false);\r\n\t\t\t\t}\r\n\t\t\t\tsounds = sounds.concat(rekeyed);\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (!sounds?.length) return;\r\n\t\treturn this._playSoundsMap(sounds, inDocument);\r\n\t}\r\n\r\n\t/**\r\n\t * Sets up persisting sounds when the scene is first loaded\r\n\t *\r\n\t * @returns {promise}\r\n\t */\r\n\tstatic async initializePersistentSounds() {\r\n\t\tawait this.tearDownPersistentSounds();\r\n\t\tlet docSoundsMap = {};\r\n\t\tlet soundsToRemove = {};\r\n\t\tlet databaseSounds = foundry.utils.deepClone(flagManager.getDatabaseFlags().sounds);\r\n\t\tfor (let [uuid, sounds] of Object.entries(databaseSounds)) {\r\n\t\t\tlet doc = fromUuidSync(uuid);\r\n\t\t\tif (doc instanceof foundry.documents.Actor && doc.prototypeToken.actorLink) {\r\n\t\t\t\tfor (let token of doc.getActiveTokens()) {\r\n\t\t\t\t\tlet tokenSounds = foundry.utils.deepClone(sounds);\r\n\t\t\t\t\tdocSoundsMap[token.document.uuid] = tokenSounds.map(([id, sound]) => {\r\n\t\t\t\t\t\tif (lib.is_UUID(sound.source)) {\r\n\t\t\t\t\t\t\tsound.source = token.document.uuid;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tsound.sceneId = canvas.scene.id;\r\n\t\t\t\t\t\treturn [id, sound];\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t} else if (doc) {\r\n\t\t\t\tdocSoundsMap[uuid] = sounds;\r\n\t\t\t} else {\r\n\t\t\t\tsoundsToRemove[uuid] = sounds;\r\n\t\t\t}\r\n\t\t}\r\n\t\tconst promises = Object.entries(docSoundsMap)\r\n\t\t\t.map(([uuid, sounds]) => {\r\n\t\t\t\treturn this._playSoundsMap(sounds, fromUuidSync(uuid));\r\n\t\t\t})\r\n\t\t\t.flat();\r\n\t\tfor (let [uuid, sounds] of Object.entries(soundsToRemove)) {\r\n\t\t\tflagManager.removeFlags(uuid, {\r\n\t\t\t\tsounds, removeAllSounds: true\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn Promise.all(promises).then(() => {\r\n\t\t\tHooks.callAll(\"sequencerSoundManagerReady\");\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Tears down persisting sounds when the scene is unloaded\r\n\t */\r\n\tstatic tearDownPersistentSounds() {\r\n\t\treturn Promise.allSettled(\r\n\t\t\tthis.sounds.map((sound) => {\r\n\t\t\t\tSequenceManager.RunningSounds.delete(sound._id);\r\n\t\t\t\treturn sound.stop();\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Plays multiple sounds at the same time\r\n\t *\r\n\t * @param inSounds\r\n\t * @param inDocument\r\n\t * @returns {Promise<{duration: Promise<number>, promise: Promise<void>}[]>}\r\n\t * @private\r\n\t */\r\n\tstatic _playSoundsMap(inSounds, inDocument) {\r\n\t\tif (inSounds instanceof Map) inSounds = Array.from(inSounds);\r\n\t\treturn Promise.all(\r\n\t\t\tinSounds.map((sound) => {\r\n\t\t\t\tif (!SequencerSound.checkShouldPlay(sound[1])) return;\r\n\t\t\t\tif (!SequencerSound.checkValid(sound[1])) {\r\n\t\t\t\t\tif (!game.user.isGM) return;\r\n\t\t\t\t\tlib.custom_warning(\r\n\t\t\t\t\t\t`Sequencer`,\r\n\t\t\t\t\t\t`Removed sound from ${inDocument.uuid} as it no longer had a valid source or target`\r\n\t\t\t\t\t);\r\n\t\t\t\t\treturn flagManager.removeFlags(inDocument.uuid, { sounds: sound });\r\n\t\t\t\t}\r\n\t\t\t\treturn this._playSound(sound[1], false)\r\n\t\t\t\t\t.then((result) => {\r\n\t\t\t\t\t\tif (!result) {\r\n\t\t\t\t\t\t\tlib.debug(\"Error playing sound\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.catch((err) => {\r\n\t\t\t\t\t\tlib.debug(\"Error playing sound:\", err);\r\n\t\t\t\t\t});\r\n\t\t\t})\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Returns all the currently running sounds\r\n\t *\r\n\t * @returns {Array}\r\n\t */\r\n\tstatic get sounds() {\r\n\t\treturn Array.from(SequenceManager.RunningSounds.values());\r\n\t}\r\n\r\n\t/**\r\n\t * Opens the Sequencer Manager with the sounds tab open\r\n\t */\r\n\tstatic show() {\r\n\t\treturn EffectsUIApp.show({ tab: \"manager\" });\r\n\t}\r\n\r\n\t/**\r\n\t * Play an audio file.\r\n\t *\r\n\t * @param {Object} data The data that describes the audio to play.\r\n\t * @param {boolean} [push=false] A flag indicating whether to make other clients play the audio, too.\r\n\t * @returns {Number} A promise that resolves when the audio file has finished playing.\r\n\t */\r\n\tstatic async play(data, push = true) {\r\n\t\tif (push)\r\n\t\t\tsequencerSocket.executeForOthers(SOCKET_HANDLERS.PLAY_SOUND, data);\r\n\t\treturn this._playSound(data);\r\n\t}\r\n\r\n\t/**\r\n\t * @param {Object} data\r\n\t * @param {Boolean} setFlags\r\n\t * @returns {Number}\r\n\t * @private\r\n\t */\r\n\tstatic async _playSound(data, setFlags = true) {\r\n\r\n\t\tif (data.delete) return false;\r\n\r\n\t\tHooks.callAll(\"createSequencerSound\", data);\r\n\r\n\t\tlib.debug(`Playing sound:`, data);\r\n\r\n\t\tlet sequencerSound = SequencerSound.make(data);\r\n\r\n\t\tawait sequencerSound.load();\r\n\r\n\t\tSequenceManager.RunningSounds.add(sequencerSound.id, sequencerSound);\r\n\r\n\t\tlet promise = sequencerSound.startPlay();\r\n\r\n\t\tpromise.then(() => {\r\n\t\t\tSequenceManager.RunningSounds.delete(sequencerSound.id);\r\n\t\t\tHooks.callAll(\"endedSequencerSound\", data);\r\n\t\t});\r\n\r\n\t\tif (data.persist) {\r\n\t\t\tlet responsibleUser = game.users.getDesignatedUser((user) => user.active);\r\n\t\t\tif (responsibleUser === game.user && setFlags) {\r\n\t\t\t\tsequencerSound.addFlags();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn sequencerSound.duration;\r\n\t}\r\n\r\n\tstatic _validateFilters(inFilter) {\r\n\r\n\t\tif (inFilter?.sounds) {\r\n\t\t\tif (!Array.isArray(inFilter.sounds)) {\r\n\t\t\t\tinFilter.sounds = [inFilter.sounds];\r\n\t\t\t}\r\n\t\t\tinFilter.sounds = inFilter.sounds.map((sound) => {\r\n\t\t\t\tif (!(typeof sound === \"string\" || sound instanceof SequencerSound))\r\n\t\t\t\t\tthrow lib.custom_error(\r\n\t\t\t\t\t\t\"Sequencer\",\r\n\t\t\t\t\t\t\"SoundManager | collections in inFilter.sounds must be of type string or SequencerSound\",\r\n\t\t\t\t\t);\r\n\t\t\t\tif (sound instanceof SequencerSound) return sound.data._id;\r\n\t\t\t\treturn sound;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (inFilter?.name && typeof inFilter?.name !== \"string\")\r\n\t\t\tthrow lib.custom_error(\r\n\t\t\t\t\"Sequencer\",\r\n\t\t\t\t\"SoundManager | inFilter.name must be of type string\",\r\n\t\t\t);\r\n\r\n\t\tif (inFilter?.sceneId) {\r\n\t\t\tif (typeof inFilter.sceneId !== \"string\")\r\n\t\t\t\tthrow lib.custom_error(\r\n\t\t\t\t\t\"Sequencer\",\r\n\t\t\t\t\t\"SoundManager | inFilter.sceneId must be of type string\",\r\n\t\t\t\t);\r\n\t\t\tif (!game.scenes.get(inFilter.sceneId))\r\n\t\t\t\tthrow lib.custom_error(\r\n\t\t\t\t\t\"Sequencer\",\r\n\t\t\t\t\t\"SoundManager | inFilter.sceneId must be a valid scene id (could not find scene)\",\r\n\t\t\t\t);\r\n\t\t} else {\r\n\t\t\tinFilter.sceneId = game.user.viewedScene;\r\n\t\t}\r\n\r\n\t\tif (inFilter?.origin && typeof inFilter?.origin !== \"string\")\r\n\t\t\tthrow lib.custom_error(\r\n\t\t\t\t\"Sequencer\",\r\n\t\t\t\t\"SoundManager | inFilter.origin must be of type string\",\r\n\t\t\t);\r\n\r\n\t\tif (\r\n\t\t\t!inFilter.sounds &&\r\n\t\t\t!inFilter.name &&\r\n\t\t\t!inFilter.sceneId &&\r\n\t\t\t!inFilter.origin\r\n\t\t) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\treturn foundry.utils.mergeObject(\r\n\t\t\t{\r\n\t\t\t\tsounds: null,\r\n\t\t\t\tname: null,\r\n\t\t\t\tsceneId: null,\r\n\t\t\t\torigin: null,\r\n\t\t\t},\r\n\t\t\tinFilter,\r\n\t\t);\r\n\t}\r\n\r\n\tstatic _filterSounds(inFilter) {\r\n\t\tif (inFilter.name) {\r\n\t\t\tinFilter.name = new RegExp(\r\n\t\t\t\t\"^\" + lib.str_to_search_regex_str(lib.safe_str(inFilter.name)) + \"$\",\r\n\t\t\t\t\"gu\",\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn this.sounds.filter((sound) => {\r\n\t\t\treturn (\r\n\t\t\t\t(inFilter.sounds === null || inFilter.sounds.includes(sound.data._id)) &&\r\n\t\t\t\t(inFilter.name === null || (sound.data.name && inFilter.name && sound.data.name.match(inFilter.name)?.length)) &&\r\n\t\t\t\t(inFilter.sceneId === null || (sound.data.sceneId === inFilter.sceneId)) &&\r\n\t\t\t\t(inFilter.origin === null || inFilter.origin === sound.data.origin)\r\n\t\t\t)\r\n\t\t});\r\n\t}\r\n\r\n\tstatic getSounds(inFilter = {}) {\r\n\t\tconst filters = this._validateFilters(inFilter);\r\n\t\tif (!inFilter)\r\n\t\t\tthrow lib.custom_error(\r\n\t\t\t\t\"Sequencer\",\r\n\t\t\t\t\"SoundManager | getSounds | Incorrect or incomplete parameters provided\",\r\n\t\t\t);\r\n\t\treturn this._filterSounds(filters);\r\n\t}\r\n\r\n\tstatic endSounds(inFilter, push = true) {\r\n\t\tconst filters = this._validateFilters(inFilter);\r\n\t\tconst sounds = this._filterSounds(filters);\r\n\t\tif (!sounds?.length) return;\r\n\t\tconst ids = sounds.map(sound => sound.data._id);\r\n\t\tif (push) {\r\n\t\t\tsequencerSocket.executeForOthers(SOCKET_HANDLERS.END_SOUNDS, ids);\r\n\t\t}\r\n\t\treturn this._endSounds(ids);\r\n\t}\r\n\r\n\t/**\r\n\t * @param inSoundIds\r\n\t * @private\r\n\t */\r\n\tstatic _endSounds(inSoundIds) {\r\n\t\tconst actorSoundsToEnd = this.sounds.filter((sound) => {\r\n\t\t\treturn (\r\n\t\t\t\tsound.context?.actorLink &&\r\n\t\t\t\tinSoundIds.includes(sound.data?.persistOptions?.id)\r\n\t\t\t);\r\n\t\t});\r\n\t\tconst soundsByActorUuid = Object.values(\r\n\t\t\tlib.group_by(actorSoundsToEnd, \"context.actor.uuid\")\r\n\t\t);\r\n\r\n\t\tconst regularSoundsToEnd = this.sounds.filter((sound) => {\r\n\t\t\treturn (\r\n\t\t\t\tinSoundIds.includes(sound.id) ||\r\n\t\t\t\t(!sound.context?.actorLink &&\r\n\t\t\t\t\tinSoundIds.includes(sound.data?.persistOptions?.id))\r\n\t\t\t);\r\n\t\t});\r\n\t\tconst soundsByContextUuid = Object.values(\r\n\t\t\tlib.group_by(regularSoundsToEnd, \"context.uuid\")\r\n\t\t);\r\n\r\n\t\tsoundsByContextUuid.forEach((sounds) => {\r\n\t\t\tsounds = sounds.filter(\r\n\t\t\t\t(sound) => sound.data.persist && !sound.data.temporary\r\n\t\t\t);\r\n\t\t\tif (!sounds.length) return;\r\n\t\t\tconst soundData = sounds.map((sound) => sound.data);\r\n\t\t\tflagManager.removeFlags(\r\n\t\t\t\tsounds[0].context.uuid,\r\n\t\t\t\t{ sounds: soundData, removeAllSounds: !inSoundIds }\r\n\t\t\t);\r\n\t\t});\r\n\r\n\t\tsoundsByActorUuid.forEach((sounds) => {\r\n\t\t\tsounds = sounds.filter(\r\n\t\t\t\t(sound) => sound.data.persist && !sound.data.temporary\r\n\t\t\t);\r\n\t\t\tif (!sounds.length) return;\r\n\r\n\t\t\tconst soundContext = sounds[0].context;\r\n\t\t\tconst soundData = sounds.map((sound) => sound.data);\r\n\r\n\t\t\tif (\r\n\t\t\t\t!(\r\n\t\t\t\t\tsoundContext instanceof TokenDocument &&\r\n\t\t\t\t\tsoundContext.actorLink &&\r\n\t\t\t\t\tsoundContext.actor?.prototypeToken?.actorLink\r\n\t\t\t\t)\r\n\t\t\t) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst persistentSoundData = soundData.filter(\r\n\t\t\t\t(data) => lib.is_UUID(data?.source) && data?.persistOptions?.persistTokenPrototype\r\n\t\t\t);\r\n\t\t\tif (!persistentSoundData.length) return;\r\n\r\n\t\t\tconst actorSounds = flagManager.getSoundFlags(soundContext.actor);\r\n\t\t\tconst applicableActorSounds = actorSounds\r\n\t\t\t\t.filter((sound) => {\r\n\t\t\t\t\treturn (\r\n\t\t\t\t\t\tlib.is_UUID(sound[1]?.source) &&\r\n\t\t\t\t\t\tsound[1]?.persistOptions?.persistTokenPrototype &&\r\n\t\t\t\t\t\tpersistentSoundData.some(\r\n\t\t\t\t\t\t\t(persistentSound) =>\r\n\t\t\t\t\t\t\t\tpersistentSound.persistOptions.id ===\r\n\t\t\t\t\t\t\t\tsound[1]?.persistOptions?.id\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t);\r\n\t\t\t\t})\r\n\t\t\t\t.map((e) => e[0]);\r\n\r\n\t\t\tflagManager.removeFlags(\r\n\t\t\t\tsoundContext.actor.uuid,\r\n\t\t\t\t{ sounds: applicableActorSounds, removeAllSounds: !inSoundIds }\r\n\t\t\t);\r\n\t\t});\r\n\r\n\t\tconst soundsToEnd = soundsByContextUuid\r\n\t\t\t.concat(soundsByActorUuid)\r\n\t\t\t.deepFlatten();\r\n\r\n\t\treturn Promise.allSettled(\r\n\t\t\tsoundsToEnd.map((sound) => this._removeSound(sound))\r\n\t\t);\r\n\t}\r\n\r\n\tstatic _removeSound(sound) {\r\n\t\tSequenceManager.RunningSounds.delete(sound.id);\r\n\t\treturn sound.stop();\r\n\t}\r\n\r\n\tstatic endAllSounds(push = true) {\r\n\t\tconst ids = SequenceManager.RunningSounds.keys();\r\n\t\tif (push) {\r\n\t\t\tsequencerSocket.executeForOthers(SOCKET_HANDLERS.END_SOUNDS, ids);\r\n\t\t}\r\n\t\treturn this._endSounds(ids);\r\n\t}\r\n}\r\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 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 (Array.isArray(data.users) && data.users.length && !data.users.includes(game.userId)) return;\n\n    canvas.interface.createScrollingText(\n      canvaslib.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(SOCKET_HANDLERS.PAN_CANVAS, data);\n    }\n\n    return this._panCanvas(data);\n  }\n\n  static _panCanvas(data) {\n    if (game.user.viewedScene !== data.sceneId) return;\n    if (Array.isArray(data.users) && data.users.length && !data.users.includes(game.userId)) return;\n\n    if (data.source) {\n      const position = canvaslib.getPositionFromData(data);\n\n      if (data.speed) {\n        const ray = new foundry.canvas.geometry.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      canvas.animatePan({\n        x: position.x,\n        y: position.y,\n        scale: data.scale,\n        duration: data.duration,\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    } else {\n      data.duration = 0;\n    }\n\n    if (data.shake) {\n      setTimeout(() => {\n        this._shake(data.shake);\n      }, data.duration);\n    }\n\n    return (\n      data.duration + Math.max(data.lockView ?? 0, data.shake?.duration ?? 0)\n    );\n  }\n\n  static _shake(shakeData) {\n\n\t  if(!shakeData.duration || !shakeData.frequency) return;\n\n    let x = lib.random_float_between(-1, 1);\n    let y = lib.random_float_between(-1, 1);\n    let rot = shakeData.rotation ? lib.random_float_between(-1, 1) : 0;\n    let positions = [{ x, y, rot }];\n\n\t\tfor (\n\t\t\tlet index = 0;\n\t\t\tindex < Math.floor(shakeData.duration / shakeData.frequency);\n\t\t\tindex++\n\t\t) {\n\t\t\tx = lib.flip_negate(x, Math.random());\n\t\t\ty = lib.flip_negate(y, Math.random());\n\t\t\trot = shakeData.rotation ? lib.flip_negate(rot, Math.random()) : 0;\n\t\t\tpositions.push({ x, y, rot });\n\t\t}\n\n    let currentDuration = 0;\n    positions = positions.map((pos) => {\n      let fadeStrength = 1;\n      if (\n        shakeData.fadeInDuration &&\n        currentDuration <= shakeData.fadeInDuration\n      ) {\n        fadeStrength = Math.max(\n          0,\n          Math.min(1, currentDuration / shakeData.fadeInDuration)\n        );\n      }\n      if (\n        shakeData.fadeOutDuration &&\n        currentDuration >= shakeData.duration - shakeData.fadeOutDuration\n      ) {\n        fadeStrength = Math.max(\n          0,\n          Math.min(\n            1,\n            (shakeData.duration - currentDuration) / shakeData.fadeOutDuration\n          )\n        );\n      }\n      pos.x *= shakeData.strength * fadeStrength;\n      pos.y *= shakeData.strength * fadeStrength;\n      if (shakeData.rotation) {\n        pos.rot *= (shakeData.strength / 7.5) * fadeStrength;\n      } else {\n        pos.rot = 0;\n      }\n      currentDuration += shakeData.frequency;\n      return {\n        transform: `translate(${pos.x}px, ${pos.y}px) rotate(${pos.rot}deg)`,\n      };\n    });\n\n    document.getElementById(\"board\").animate(positions, {\n      duration: shakeData.duration,\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 PING_INTERVAL_MS = 5000;\nconst PING_TIMEOUT_MS = 3000;\n\nconst SequencerPreloader = {\n  _activeRequests: new Map(),\n  _disconnectHookId: null,\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<void>}\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<void>}\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 requestId = foundry.utils.randomID();\n\n    const request = {\n      id: requestId,\n      resolve: null,\n      usersToRespond: new Set(\n        game.users.filter((user) => user.active).map((user) => user.id)\n      ),\n      clientsDone: [],\n      pingInterval: null,\n    };\n\n    const promise = new Promise((resolve) => {\n      request.resolve = resolve;\n    });\n\n    this._activeRequests.set(requestId, request);\n    this._ensureDisconnectHook();\n\n    sequencerSocket.executeForEveryone(\n      SOCKET_HANDLERS.PRELOAD,\n      requestId,\n      game.user.id,\n      srcs,\n      showProgressBar\n    );\n\n    request.pingInterval = setInterval(() => {\n      this._pingUnresponsiveClients(requestId);\n    }, PING_INTERVAL_MS);\n\n    return promise;\n  },\n\n  /**\n   * Pings clients that haven't responded yet. If they don't respond to the\n   * ping within PING_TIMEOUT_MS, assume they are unreachable and remove them.\n   *\n   * @private\n   */\n  _pingUnresponsiveClients(requestId) {\n    const request = this._activeRequests.get(requestId);\n    if (!request || request.usersToRespond.size === 0) return;\n\n    for (const userId of request.usersToRespond) {\n      if (userId === game.user.id) continue;\n\n      const user = game.users.get(userId);\n      if (!user?.active) {\n        this._removeUserFromRequest(requestId, userId, \"disconnected\");\n        continue;\n      }\n\n      const pingId = foundry.utils.randomID();\n\n      if (!request.pendingPings) request.pendingPings = new Map();\n\n      const pingTimeout = setTimeout(() => {\n        request.pendingPings?.delete(pingId);\n        if (request.usersToRespond.has(userId)) {\n          this._removeUserFromRequest(requestId, userId, \"unresponsive to ping\");\n        }\n      }, PING_TIMEOUT_MS);\n\n      request.pendingPings.set(pingId, { userId, timeout: pingTimeout });\n\n      sequencerSocket.executeAsUser(\n        SOCKET_HANDLERS.PING,\n        userId,\n        requestId,\n        pingId,\n        game.user.id\n      );\n    }\n  },\n\n  /**\n   * Handles an incoming ping request by immediately responding with a pong.\n   */\n  respondToPing(requestId, pingId, senderId) {\n    sequencerSocket.executeAsUser(\n      SOCKET_HANDLERS.PONG,\n      senderId,\n      requestId,\n      pingId\n    );\n  },\n\n  /**\n   * Handles a pong response, confirming the client is still alive.\n   */\n  handlePong(requestId, pingId) {\n    const request = this._activeRequests.get(requestId);\n    if (!request?.pendingPings) return;\n\n    const pingData = request.pendingPings.get(pingId);\n    if (pingData) {\n      clearTimeout(pingData.timeout);\n      request.pendingPings.delete(pingId);\n    }\n  },\n\n  /**\n   * Removes a user from a request's wait set and checks if the request is complete.\n   *\n   * @private\n   */\n  _removeUserFromRequest(requestId, userId, reason) {\n    const request = this._activeRequests.get(requestId);\n    if (!request) return;\n\n    if (!request.usersToRespond.has(userId)) return;\n\n    request.usersToRespond.delete(userId);\n\n    const userName = game.users.get(userId)?.name ?? userId;\n    lib.debug(`Client \"${userName}\" removed from preload request (${reason})`);\n\n    if (request.usersToRespond.size === 0) {\n      this._resolveRequest(requestId);\n    }\n  },\n\n  /**\n   * Ensures the disconnect hook is registered.\n   *\n   * @private\n   */\n  _ensureDisconnectHook() {\n    if (this._disconnectHookId !== null) return;\n    this._disconnectHookId = Hooks.on(\"userConnected\", (user, connected) => {\n      if (connected) return;\n      for (const [requestId] of this._activeRequests) {\n        this._removeUserFromRequest(requestId, user.id, \"disconnected\");\n      }\n    });\n  },\n\n  async respond(requestId, 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      requestId,\n      game.user.id,\n      numFilesFailedToLoad\n    );\n  },\n\n  handleResponse(requestId, inUserId, numFilesFailedToLoad) {\n    const request = this._activeRequests.get(requestId);\n    if (!request) return;\n\n    request.usersToRespond.delete(inUserId);\n    request.clientsDone.push({\n      userId: inUserId,\n      numFilesFailedToLoad: numFilesFailedToLoad,\n    });\n\n    if (request.usersToRespond.size > 0) return;\n\n    this._resolveRequest(requestId);\n  },\n\n  /**\n   * Resolves a preload request, cleans up state, and logs results.\n   *\n   * @private\n   */\n  _resolveRequest(requestId) {\n    const request = this._activeRequests.get(requestId);\n    if (!request) return;\n\n    if (request.pingInterval) {\n      clearInterval(request.pingInterval);\n    }\n\n    if (request.pendingPings) {\n      for (const [, pingData] of request.pendingPings) {\n        clearTimeout(pingData.timeout);\n      }\n      request.pendingPings.clear();\n    }\n\n    request.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    request.resolve();\n    this._activeRequests.delete(requestId);\n\n    if (this._activeRequests.size === 0 && this._disconnectHookId !== null) {\n      Hooks.off(\"userConnected\", this._disconnectHookId);\n      this._disconnectHookId = null;\n    }\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        .deepFlatten()\n      );\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\t    LoadingBar.init(\n\t\t    `Sequencer - Preloading ${numFilesToLoad} files`,\n\t\t    numFilesToLoad\n\t    );\n    }\n\n    return new Promise(async (resolve) => {\n      let numFilesFailedToLoad = 0;\n      const loadingPromises = inSrcs.map(async (src) => {\n        const blob = await SequencerFileCache.loadFile(src, true);\n        if (showProgressBar) LoadingBar.incrementProgress();\n        if (!blob) {\n          numFilesFailedToLoad++;\n        }\n      })\n      await Promise.allSettled(loadingPromises)\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 CONSTANTS from \"./constants.js\";\nimport * as lib from \"./lib/lib.js\";\nimport FlagManager from \"./utils/flag-manager.js\";\nimport SequencerSoundManager from \"./modules/sequencer-sound-manager.js\";\nimport SequencerEffectManager from \"./modules/sequencer-effect-manager.js\";\nimport SequencerFoundryReplicator from \"./modules/sequencer-foundry-replicator.js\";\nimport SequencerPreloader from './modules/sequencer-preloader.js'\n\n\nconst RECIPIENT_TYPES = {\n\tGM: 0,\n\tSUPERUSER: 1,\n\tALL: 2,\n\tUSER: 3\n};\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  END_SOUNDS: \"endSounds\",\n  PRELOAD: \"preload\",\n  PRELOAD_RESPONSE: \"preloadResponse\",\n  PING: \"ping\",\n  PONG: \"pong\",\n  UPDATE_DOCUMENT: \"updateDocument\",\n  ADD_FLAGS: \"addFlags\",\n  REMOVE_FLAGS: \"removeFlags\",\n  UPDATE_EFFECT_POSITION: \"updateEffectPosition\",\n  ADD_SOUND_FLAGS: \"addSoundFlags\",\n  REMOVE_SOUND_FLAGS: \"removeSoundFlags\",\n  UPDATE_SOUND_POSITION: \"updateSoundPosition\",\n  CREATE_SCROLLING_TEXT: \"createScrollingText\",\n  CREATE_LIGHT_SOURCE: \"createLightSource\",\n  PAN_CANVAS: \"panCanvas\",\n  RUN_SEQUENCE_LOCALLY: \"runSequenceLocally\",\n};\n\nconst SOCKET_CALLBACKS = {\n\t[SOCKET_HANDLERS.PLAY_EFFECT]: (data) => {\n\t\treturn SequencerEffectManager._playEffect(...data.payload);\n\t},\n\t[SOCKET_HANDLERS.END_EFFECTS]: (data) => {\n\t\treturn SequencerEffectManager._endManyEffects(...data.payload);\n\t},\n\t[SOCKET_HANDLERS.UPDATE_EFFECT]: (data) => {\n\t\treturn SequencerEffectManager._updateEffect(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.ADD_EFFECT_ANIMATIONS]: (data) => {\n\t\treturn SequencerEffectManager._addEffectAnimations(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.PLAY_SOUND]: (data) => {\n\t\treturn SequencerSoundManager._playSound(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.END_SOUNDS]: (data) => {\n\t\treturn SequencerSoundManager._endSounds(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.PRELOAD]: (data) => {\n\t\treturn SequencerPreloader.respond(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.PRELOAD_RESPONSE]: (data) => {\n\t\treturn SequencerPreloader.handleResponse(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.PING]: (data) => {\n\t\treturn SequencerPreloader.respondToPing(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.PONG]: (data) => {\n\t\treturn SequencerPreloader.handlePong(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.UPDATE_DOCUMENT]: async (data) => {\n\t\tlet [documentUuid, updates, animate] = data.payload;\n\t\tconst document = await fromUuid(documentUuid);\n\t\tif(!document) {\n\t\t\treturn;\n\t\t}\n\t\treturn document.update(updates, animate);\n\t},\n\t[SOCKET_HANDLERS.ADD_FLAGS]: (data) => {\n\t\treturn FlagManager._addFlags(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.REMOVE_FLAGS]: (data) => {\n\t\treturn FlagManager._removeFlags(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.UPDATE_EFFECT_POSITION]: (data) => {\n\t\treturn SequencerEffectManager._updatePosition(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.ADD_SOUND_FLAGS]: (data) => {\n\t\treturn FlagManager._addFlags(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.REMOVE_SOUND_FLAGS]: (data) => {\n\t\treturn FlagManager._removeFlags(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.CREATE_SCROLLING_TEXT]: (data) => {\n\t\treturn SequencerFoundryReplicator._playScrollingText(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.PAN_CANVAS]: (data) => {\n\t\treturn SequencerFoundryReplicator._panCanvas(...data.payload)\n\t},\n\t[SOCKET_HANDLERS.RUN_SEQUENCE_LOCALLY]: (data) => {\n\t\tlib.debug(\"Playing remote Sequence\");\n\t\tnew Sequence().fromJSON(data.payload).play();\n\t},\n}\n\nexport class SequencerSocket {\n\n\tconstructor() {\n\t\tgame.socket.on(`module.${CONSTANTS.MODULE_NAME}`, this._executeSocket.bind(this));\n\t}\n\n\texecuteAsGM(type, ...args) {\n\t\tlet data = { senderId: game.user.id, sendType: RECIPIENT_TYPES.GM, type, payload: args };\n\t\tif(game.user.isGM){\n\t\t\treturn this._executeSocket(data);\n\t\t}\n\t\tif(!game.users.activeGM){\n\t\t\tlib.custom_warning(\"Sequencer\", \"executeAsGM | No active GM is connected to handle this request\");\n\t\t\treturn data;\n\t\t}\n\t\tgame.socket.emit(`module.${CONSTANTS.MODULE_NAME}`, data);\n\t\treturn data;\n\t}\n\n\texecuteForOthers(type, ...args) {\n\t\tlet data = { senderId: game.user.id, sendType: RECIPIENT_TYPES.ALL, type, payload: args };\n\t\tgame.socket.emit(`module.${CONSTANTS.MODULE_NAME}`, data);\n\t\treturn data;\n\t}\n\n\texecuteForEveryone(type, ...args) {\n\t\tlet data = { senderId: game.user.id, sendType: RECIPIENT_TYPES.ALL, type, payload: args };\n\t\tgame.socket.emit(`module.${CONSTANTS.MODULE_NAME}`, data);\n\t\treturn this._executeSocket(data);\n\t}\n\n\texecuteAsUser(type, receiverId, ...args) {\n\t\tlet data = { senderId: game.user.id, receiverId, sendType: RECIPIENT_TYPES.USER, type, payload: args };\n\t\tif(receiverId === game.user.id){\n\t\t\treturn this._executeSocket(data);\n\t\t}\n\t\tgame.socket.emit(`module.${CONSTANTS.MODULE_NAME}`, data);\n\t\treturn data;\n\t}\n\n\texecuteAsMainUser(type, ...args) {\n\t\tlet data = { senderId: game.user.id, sendType: RECIPIENT_TYPES.SUPERUSER, type, payload: args };\n\t\tlet targetUser = game.users.getDesignatedUser((user) => user.active);\n\t\tif(!targetUser){\n\t\t\tlib.custom_warning(\"Sequencer\", \"executeAsMainUser | No active user is eligible to handle this request\");\n\t\t\treturn data;\n\t\t}\n\t\tif(game.user.id === targetUser.id){\n\t\t\treturn this._executeSocket(data);\n\t\t}\n\t\tgame.socket.emit(`module.${CONSTANTS.MODULE_NAME}`, data);\n\t\treturn data;\n\t}\n\n\t_executeSocket(data) {\n\t\tconst handler = SOCKET_CALLBACKS[data.type];\n\t\tif (!handler) {\n\t\t\treturn false;\n\t\t}\n\n\t\tswitch(data.sendType){\n\t\t\tcase RECIPIENT_TYPES.SUPERUSER:\n\t\t\t\tlet user = game.users.getDesignatedUser((user) => user.active);\n\t\t\t\tif(user !== game.user){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase RECIPIENT_TYPES.GM:\n\t\t\t\tif(data.sendType === RECIPIENT_TYPES.GM && !game.user.isActiveGM){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase RECIPIENT_TYPES.USER:\n\t\t\t\tif(data.sendType === RECIPIENT_TYPES.USER && game.user.id !== data.receiverId){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn handler(data);\n\t}\n}\n\n\nexport let sequencerSocket = false;\n\nexport function registerSocket() {\n  sequencerSocket = new SequencerSocket();\n}\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\";\nimport PasteManager from \"./sequencer-paste-manager.js\";\n\nconst PositionContainer = new Map();\nconst TemporaryPositionsContainer = new Map();\n\nexport default class SequencerEffectManager {\n\t/**\n\t * Returns all the currently running effects on the canvas\n\t *\n\t * @returns {Array}\n\t */\n\tstatic get effects() {\n\t\treturn Array.from(SequenceManager.VisibleEffects.values());\n\t}\n\n\tstatic _updatePosition(uuid, position) {\n\t\tTemporaryPositionsContainer.set(uuid, position);\n\t}\n\n\tstatic getPositionForUUID(uuid) {\n\t\treturn TemporaryPositionsContainer.get(uuid);\n\t}\n\n\t/**\n\t * Opens the Sequencer Manager UI with the effects tab open\n\t */\n\tstatic show() {\n\t\treturn EffectsUIApp.show({ tab: \"manager\" });\n\t}\n\n\t/**\n\t * Play an effect on the canvas.\n\t *\n\t * @param {object} data The data that describes the audio to play\n\t * @param {boolean} [push=true] A flag indicating whether or not to make other clients play the effect\n\t * @returns {CanvasEffect} A CanvasEffect object\n\t */\n\tstatic async play(data, push = true) {\n\t\tif (!lib.user_can_do(\"permissions-effect-create\")) {\n\t\t\tlib.custom_warning(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"EffectManager | play | Players do not have permissions to play effects. This can be configured in Sequencer's module settings.\"\n\t\t\t);\n\t\t\treturn { duration: Promise.resolve(0), promise: Promise.resolve() };\n\t\t}\n\t\tif (push) sequencerSocket.executeForOthers(SOCKET_HANDLERS.PLAY_EFFECT, data);\n\t\treturn this._playEffect(data);\n\t}\n\n\t/**\n\t * Get effects that are playing on the canvas based on a set of filters\n\t *\n\t * @param {object} inFilter An object containing filters that determine which effects to return\n\t *                             - object: An ID or a PlaceableObject\n\t *                             - name: The name of the effect\n\t *                             - sceneId: the ID of the scene to search within\n\t * @returns {Array} An array containing effects that match the given filter\n\t */\n\tstatic getEffects(inFilter = {}) {\n\t\tconst filters = this._validateFilters(inFilter);\n\t\tif (!inFilter)\n\t\t\tthrow lib.custom_error(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"EffectManager | getEffects | Incorrect or incomplete parameters provided\"\n\t\t\t);\n\t\treturn this._filterEffects(filters);\n\t}\n\n\t/**\n\t * Updates effects based on a set of filters\n\t *\n\t * @param {object} inFilter An object containing filters that determine which effects to return\n\t *                             - object: An ID or a PlaceableObject\n\t *                             - name: The name of the effect\n\t *                             - sceneId: the ID of the scene to search within\n\t *                             - effects: a single CanvasEffect or its ID, or an array of such\n\t * @param {object} inUpdates\n\t * @returns {promise}\n\t */\n\tstatic updateEffects(inFilter, inUpdates) {\n\t\tinFilter = this._validateFilters(inFilter);\n\t\tif (!inFilter)\n\t\t\tthrow lib.custom_error(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"EffectManager | updateEffects | Incorrect or incomplete parameters provided\"\n\t\t\t);\n\n\t\tCanvasEffect.validateUpdate(inUpdates);\n\n\t\tconst effectsToUpdate = this._filterEffects(inFilter).filter(\n\t\t\t(effect) => effect.userCanUpdate\n\t\t);\n\n\t\treturn Promise.allSettled(\n\t\t\teffectsToUpdate.map((effect) => effect.update(inUpdates))\n\t\t);\n\t}\n\n\t/**\n\t * End effects that are playing on the canvas based on a set of filters\n\t *\n\t * @param {object} inFilter An object containing filters that determine which effects to end\n\t *                             - object: An ID or a PlaceableObject\n\t *                             - name: The name of the effect\n\t *                             - sceneId: the ID of the scene to search within\n\t *                             - effects: a single CanvasEffect or its ID, or an array of such\n\t * @param {boolean} [push=true] A flag indicating whether or not to make other clients end the effects\n\t * @returns {promise} A promise that resolves when the effects have ended\n\t */\n\tstatic async endEffects(inFilter = {}, push = true) {\n\t\tinFilter = this._validateFilters(inFilter);\n\t\tif (!inFilter)\n\t\t\tthrow lib.custom_error(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"EffectManager | endEffects | Incorrect or incomplete parameters provided\"\n\t\t\t);\n\t\tconst effectsToEnd = this._getEffectsByFilter(inFilter);\n\t\tif (!effectsToEnd.length) return;\n\t\tif (push)\n\t\t\tsequencerSocket.executeForOthers(\n\t\t\t\tSOCKET_HANDLERS.END_EFFECTS,\n\t\t\t\teffectsToEnd\n\t\t\t);\n\t\treturn this._endManyEffects(effectsToEnd);\n\t}\n\n\t/**\n\t * End all effects that are playing on the canvas\n\t *\n\t * @param {string} [inSceneId] A parameter which determines which scene to end all effects on, defaults to current viewed scene\n\t * @param {boolean} [push=true] A flag indicating whether or not to make other clients end all effects\n\t * @returns {promise} A promise that resolves when all of the effects have _ended\n\t */\n\tstatic async endAllEffects(inSceneId = game.user.viewedScene, push = true) {\n\t\tconst inFilter = this._validateFilters({ sceneId: inSceneId });\n\t\tif (!inFilter)\n\t\t\tthrow lib.custom_error(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"EffectManager | endAllEffects | Incorrect or incomplete parameters provided\"\n\t\t\t);\n\t\tconst effectsToEnd = this._getEffectsByFilter(inFilter);\n\t\tif (!effectsToEnd.length) return;\n\t\tif (push)\n\t\t\tsequencerSocket.executeForOthers(\n\t\t\t\tSOCKET_HANDLERS.END_EFFECTS,\n\t\t\t\teffectsToEnd\n\t\t\t);\n\t\treturn this._endManyEffects(effectsToEnd);\n\t}\n\n\tstatic _getEffectsByFilter(inFilter) {\n\t\treturn lib.make_array_unique(\n\t\t\tthis._filterEffects(inFilter)\n\t\t\t\t.filter((effect) => effect.userCanDelete)\n\t\t\t\t.map((effect) => {\n\t\t\t\t\treturn effect.data?.persistOptions?.persistTokenPrototype && lib.is_UUID(effect?.data.source) && effect.data?.attachTo?.active\n\t\t\t\t\t\t? effect.data?.persistOptions?.id ?? effect.id\n\t\t\t\t\t\t: effect.id;\n\t\t\t\t})\n\t\t);\n\t}\n\n\t/**\n\t * If an effect has been named its position will be cached, which can be retrieved with this method\n\t *\n\t * @param {string} inName\n\t * @returns {object|boolean}\n\t * @private\n\t */\n\tstatic getEffectPositionByName(inName) {\n\t\tif (!(typeof inName === \"string\"))\n\t\t\tthrow lib.custom_error(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"EffectManager | getEffectPositionByName | inName must be of type string\"\n\t\t\t);\n\t\treturn PositionContainer.get(inName) ?? false;\n\t}\n\n\t/**\n\t * Filters the existing effects based on the given filter\n\t *\n\t * @param inFilter\n\t * @returns {array}\n\t * @private\n\t */\n\tstatic _filterEffects(inFilter) {\n\t\tif (inFilter.name) {\n\t\t\tinFilter.name = new RegExp(\n\t\t\t\t\"^\" + lib.str_to_search_regex_str(lib.safe_str(inFilter.name)) + \"$\",\n\t\t\t\t\"gu\"\n\t\t\t);\n\t\t}\n\t\treturn this.effects.filter((effect) => {\n\t\t\treturn (\n\t\t\t\t(!inFilter.effects || inFilter.effects.includes(effect.id)) &&\n\t\t\t\t(!inFilter.name || (effect.data.name && effect.data.name.match(inFilter.name)?.length)) &&\n\t\t\t\t(!inFilter.source || inFilter.source === effect.data.source) &&\n\t\t\t\t(!inFilter.target || inFilter.target === effect.data.target) &&\n\t\t\t\t(!inFilter.origin || inFilter.origin === effect.data.origin)\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Validates an object actually exists, and gets its UUID\n\t *\n\t * @param object\n\t * @param sceneId\n\t * @returns {string}\n\t * @private\n\t */\n\tstatic _validateObject(object, sceneId) {\n\t\tif (\n\t\t\t!(\n\t\t\t\tobject instanceof foundry.abstract.Document ||\n\t\t\t\tobject instanceof foundry.canvas.placeables.PlaceableObject ||\n\t\t\t\ttypeof object === \"string\"\n\t\t\t)\n\t\t) {\n\t\t\tthrow lib.custom_error(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"EffectManager | object must be instance of PlaceableObject or of type string\"\n\t\t\t);\n\t\t} else if (\n\t\t\tobject instanceof foundry.canvas.placeables.PlaceableObject ||\n\t\t\tobject instanceof foundry.abstract.Document\n\t\t) {\n\t\t\tobject = lib.get_object_identifier(object?.document ?? object);\n\t\t} else if (typeof object === \"string\") {\n\t\t\tconst actualObject = lib.get_object_from_scene(object, sceneId);\n\t\t\tif (!actualObject) {\n\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\t\"Sequencer\",\n\t\t\t\t\t`EffectManager | could not find object with ID: ${object}`\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst uuid = lib.get_object_identifier(actualObject);\n\t\t\tif (!uuid) {\n\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\t\"Sequencer\",\n\t\t\t\t\t`EffectManager | could could not establish identifier of object with ID: ${object}`\n\t\t\t\t);\n\t\t\t}\n\t\t\tobject = uuid;\n\t\t}\n\n\t\treturn object;\n\t}\n\n\t/**\n\t * Validates the filter given to any of the above public methods\n\t *\n\t * @param inFilter\n\t * @returns {boolean}\n\t * @private\n\t */\n\tstatic _validateFilters(inFilter) {\n\t\tif (inFilter?.sceneId) {\n\t\t\tif (typeof inFilter.sceneId !== \"string\")\n\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\t\"Sequencer\",\n\t\t\t\t\t\"EffectManager | inFilter.sceneId must be of type string\"\n\t\t\t\t);\n\t\t\tif (!game.scenes.get(inFilter.sceneId))\n\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\t\"Sequencer\",\n\t\t\t\t\t\"EffectManager | inFilter.sceneId must be a valid scene id (could not find scene)\"\n\t\t\t\t);\n\t\t} else {\n\t\t\tinFilter.sceneId = game.user.viewedScene;\n\t\t}\n\n\t\tif (inFilter?.object) {\n\t\t\tinFilter.source = this._validateObject(inFilter.object, inFilter.sceneId);\n\t\t\tdelete inFilter.object;\n\t\t}\n\n\t\tif (inFilter?.source) {\n\t\t\tinFilter.source = this._validateObject(inFilter.source, inFilter.sceneId);\n\t\t}\n\n\t\tif (inFilter?.target) {\n\t\t\tinFilter.target = this._validateObject(inFilter.target, inFilter.sceneId);\n\t\t}\n\n\t\tif (inFilter?.name && typeof inFilter?.name !== \"string\")\n\t\t\tthrow lib.custom_error(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"EffectManager | inFilter.name must be of type string\"\n\t\t\t);\n\t\tif (inFilter?.origin && typeof inFilter?.origin !== \"string\")\n\t\t\tthrow lib.custom_error(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"EffectManager | inFilter.origin must be of type string\"\n\t\t\t);\n\n\t\tif (inFilter?.effects) {\n\t\t\tif (!Array.isArray(inFilter.effects))\n\t\t\t\tinFilter.effects = [inFilter.effects];\n\t\t\tinFilter.effects = inFilter.effects.map((effect) => {\n\t\t\t\tif (!(typeof effect === \"string\" || effect instanceof CanvasEffect))\n\t\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\t\t\"Sequencer\",\n\t\t\t\t\t\t\"EffectManager | collections in inFilter.effects must be of type string or CanvasEffect\"\n\t\t\t\t\t);\n\t\t\t\tif (effect instanceof CanvasEffect) return effect.id;\n\t\t\t\treturn effect;\n\t\t\t});\n\t\t}\n\n\t\tif (\n\t\t\t!inFilter.name &&\n\t\t\t!inFilter.origin &&\n\t\t\t!inFilter.target &&\n\t\t\t!inFilter.sceneId &&\n\t\t\t!inFilter.effects &&\n\t\t\t!inFilter.origin\n\t\t)\n\t\t\treturn false;\n\n\t\treturn foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\teffects: false,\n\t\t\t\tname: false,\n\t\t\t\tsource: false,\n\t\t\t\ttarget: false,\n\t\t\t\tsceneId: false,\n\t\t\t\torigin: false,\n\t\t\t},\n\t\t\tinFilter\n\t\t);\n\t}\n\n\t/**\n\t * Actually plays the effect on the canvas\n\t *\n\t * @param data\n\t * @param setFlags\n\t * @returns {Promise<{duration: Promise<number>, promise: Promise<void>}>}\n\t * @private\n\t */\n\tstatic async _playEffect(data, setFlags = true) {\n\t\tconst effect = CanvasEffect.make(data);\n\t\tif (\n\t\t\tdata.persist &&\n\t\t\tsetFlags &&\n\t\t\teffect.context &&\n\t\t\teffect.owner &&\n\t\t\t!effect.isSourceTemporary &&\n\t\t\t!data.temporary &&\n\t\t\t!data.remote\n\t\t) {\n\t\t\tflagManager.addFlags(effect.context.uuid, { effects: effect.data });\n\t\t}\n\n\t\tif (!effect.shouldPlay) {\n\t\t\treturn { duration: Promise.resolve(0), promise: Promise.resolve() };\n\t\t}\n\n\t\tconst playData = effect.play();\n\n\t\tSequenceManager.VisibleEffects.add(effect.id, effect);\n\t\tif (effect.data.name) {\n\t\t\teffect._addToTicker(() => {\n\t\t\t\tif (effect.isDestroyed) return;\n\t\t\t\tPositionContainer.set(effect.data.name, {\n\t\t\t\t\tstart: effect.sourcePosition,\n\t\t\t\t\tend: effect.targetPosition,\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tif (data.temporary && effect.owner) {\n\t\t\tlet lastSource = null;\n\t\t\tlet lastTarget = null;\n\t\t\teffect._addToTicker(() => {\n\t\t\t\tif (effect.source && !effect.isSourceDestroyed) {\n\t\t\t\t\tconst sourceData = effect.getSourceData();\n\t\t\t\t\tconst pos = sourceData.position;\n\t\t\t\t\tif (\n\t\t\t\t\t\t!lastSource\n\t\t\t\t\t\t|| lastSource.x !== pos?.x\n\t\t\t\t\t\t|| lastSource.y !== pos?.y\n\t\t\t\t\t\t|| lastSource.elevation !== pos?.elevation\n\t\t\t\t\t\t|| lastSource.width !== sourceData.width\n\t\t\t\t\t\t|| lastSource.height !== sourceData.height\n\t\t\t\t\t\t|| lastSource.rotation !== sourceData.rotation\n\t\t\t\t\t\t|| lastSource.alpha !== sourceData.alpha\n\t\t\t\t\t) {\n\t\t\t\t\t\tsequencerSocket.executeForOthers(\n\t\t\t\t\t\t\tSOCKET_HANDLERS.UPDATE_EFFECT_POSITION,\n\t\t\t\t\t\t\tdata.source,\n\t\t\t\t\t\t\tsourceData\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlastSource = {\n\t\t\t\t\t\t\tx: pos?.x,\n\t\t\t\t\t\t\ty: pos?.y,\n\t\t\t\t\t\t\televation: pos?.elevation,\n\t\t\t\t\t\t\twidth: sourceData.width,\n\t\t\t\t\t\t\theight: sourceData.height,\n\t\t\t\t\t\t\trotation: sourceData.rotation,\n\t\t\t\t\t\t\talpha: sourceData.alpha,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (effect.target && !effect.isTargetDestroyed) {\n\t\t\t\t\tconst targetData = effect.getTargetData();\n\t\t\t\t\tconst pos = targetData.position;\n\t\t\t\t\tif (\n\t\t\t\t\t\t!lastTarget\n\t\t\t\t\t\t|| lastTarget.x !== pos?.x\n\t\t\t\t\t\t|| lastTarget.y !== pos?.y\n\t\t\t\t\t\t|| lastTarget.elevation !== pos?.elevation\n\t\t\t\t\t\t|| lastTarget.width !== targetData.width\n\t\t\t\t\t\t|| lastTarget.height !== targetData.height\n\t\t\t\t\t\t|| lastTarget.rotation !== targetData.rotation\n\t\t\t\t\t\t|| lastTarget.alpha !== targetData.alpha\n\t\t\t\t\t) {\n\t\t\t\t\t\tsequencerSocket.executeForOthers(\n\t\t\t\t\t\t\tSOCKET_HANDLERS.UPDATE_EFFECT_POSITION,\n\t\t\t\t\t\t\tdata.target,\n\t\t\t\t\t\t\ttargetData\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlastTarget = {\n\t\t\t\t\t\t\tx: pos?.x,\n\t\t\t\t\t\t\ty: pos?.y,\n\t\t\t\t\t\t\televation: pos?.elevation,\n\t\t\t\t\t\t\twidth: targetData.width,\n\t\t\t\t\t\t\theight: targetData.height,\n\t\t\t\t\t\t\trotation: targetData.rotation,\n\t\t\t\t\t\t\talpha: targetData.alpha,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tif (!data.persist) {\n\t\t\tplayData.promise.then(() => this._removeEffect(effect));\n\t\t}\n\n\t\treturn playData;\n\t}\n\n\t/**\n\t * Updates a single effect with the given data\n\t *\n\t * @param inEffectId\n\t * @param inUpdates\n\t * @returns {promise|boolean}\n\t * @private\n\t */\n\tstatic _updateEffect(inEffectId, inUpdates) {\n\t\tconst effect = SequenceManager.VisibleEffects.get(inEffectId);\n\t\tif (!effect) return false;\n\t\treturn effect._update(inUpdates);\n\t}\n\n\t/**\n\t * Updates a single effect with new animations\n\t *\n\t * @param inEffectId\n\t * @param inAnimations\n\t * @param inLoopingAnimations\n\t * @returns {promise|boolean}\n\t * @private\n\t */\n\tstatic _addEffectAnimations(inEffectId, inAnimations, inLoopingAnimations) {\n\t\tconst effect = SequenceManager.VisibleEffects.get(inEffectId);\n\t\tif (!effect) return false;\n\t\treturn effect._addAnimations(inAnimations, inLoopingAnimations);\n\t}\n\n\t/**\n\t * Sets up persisting effects when the scene is first loaded\n\t *\n\t * @returns {promise}\n\t */\n\tstatic async initializePersistentEffects() {\n\t\tawait this.tearDownPersistentEffects();\n\t\tlet docEffectsMap = {};\n\t\tlet databaseEffects = foundry.utils.deepClone(flagManager.getDatabaseFlags().effects);\n\t\tlet effectsToRemove = {}\n\t\tfor (let [uuid, effects] of Object.entries(databaseEffects)) {\n\t\t\tlet doc = fromUuidSync(uuid);\n\t\t\tif (doc instanceof foundry.documents.Actor && doc.prototypeToken.actorLink) {\n\t\t\t\tfor (let token of doc.getActiveTokens()) {\n\t\t\t\t\tlet tokenEffects = foundry.utils.deepClone(effects);\n\t\t\t\t\tdocEffectsMap[token.document.uuid] = tokenEffects.map(([id, effect]) => {\n\t\t\t\t\t\tif (lib.is_UUID(effect.source)) {\n\t\t\t\t\t\t\teffect.source = token.document.uuid;\n\t\t\t\t\t\t}\n\t\t\t\t\t\teffect.sceneId = canvas.scene.id;\n\t\t\t\t\t\treturn [id, effect];\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t} else if (doc) {\n\t\t\t\tdocEffectsMap[uuid] = effects;\n\t\t\t} else {\n\t\t\t\teffectsToRemove[uuid] = effects;\n\t\t\t}\n\t\t}\n\t\tconst promises = Object.entries(docEffectsMap)\n\t\t\t.map(([uuid, effects]) => {\n\t\t\t\treturn this._playEffectMap(effects, fromUuidSync(uuid));\n\t\t\t})\n\t\t\t.flat();\n\t\tfor (let [uuid, effects] of Object.entries(effectsToRemove)) {\n\t\t\tflagManager.removeFlags(uuid, {\n\t\t\t\teffects, removeAllEffects: true\n\t\t\t});\n\t\t}\n\t\treturn Promise.all(promises).then(() => {\n\t\t\tHooks.callAll(\"sequencerEffectManagerReady\");\n\t\t});\n\t}\n\n\t/**\n\t * Tears down persisting effects when the scene is unloaded\n\t */\n\tstatic tearDownPersistentEffects() {\n\t\treturn Promise.allSettled(\n\t\t\tthis.effects.map((effect) => {\n\t\t\t\tSequenceManager.VisibleEffects.delete(effect.id);\n\t\t\t\treturn effect.destroy();\n\t\t\t})\n\t\t);\n\t}\n\n\tstatic setup() {\n\t\tHooks.on(\"createToken\", this._documentCreated.bind(this));\n\t\tHooks.on(\"createDrawing\", this._documentCreated.bind(this));\n\t\tHooks.on(\"createTile\", this._documentCreated.bind(this));\n\t\tHooks.on(\"createMeasuredTemplate\", this._documentCreated.bind(this));\n\t\tHooks.on(\"createRegion\", this._documentCreated.bind(this));\n\t}\n\n\tstatic _patchEffectDataForDocument(inDocumentUuid, effects) {\n\t\treturn effects.map((effect) => {\n\t\t\teffect[0] = foundry.utils.randomID();\n\t\t\tconst effectData = effect[1];\n\t\t\teffectData._id = effect[0];\n\t\t\tif (lib.is_UUID(effectData.source)) {\n\t\t\t\tif (effectData.masks.includes(effectData.source)) {\n\t\t\t\t\tconst index = effectData.masks.indexOf(effectData.source);\n\t\t\t\t\teffectData.masks[index] = inDocumentUuid;\n\t\t\t\t}\n\t\t\t\teffectData.source = inDocumentUuid;\n\t\t\t}\n\t\t\teffectData.sceneId = inDocumentUuid.split(\".\")[1];\n\t\t\treturn effect;\n\t\t});\n\t}\n\n\t/**\n\t * Plays the effects of a given document on creation\n\t *\n\t * @param inDocument\n\t * @returns {*}\n\t */\n\tstatic async _documentCreated(inDocument) {\n\t\tlet effects = flagManager.getEffectFlags(inDocument);\n\t\tif (inDocument instanceof TokenDocument && inDocument?.actorLink) {\n\t\t\tlet actorEffects = flagManager.getEffectFlags(inDocument?.actor);\n\t\t\tif (actorEffects.length) {\n\t\t\t\tactorEffects = this._patchEffectDataForDocument(\n\t\t\t\t\tinDocument.uuid,\n\t\t\t\t\tactorEffects\n\t\t\t\t);\n\t\t\t}\n\t\t\teffects = effects.concat(actorEffects);\n\t\t}\n\t\tconst sourceUuid = PasteManager.consume(inDocument);\n\t\tif (sourceUuid) {\n\t\t\tconst sourceEffects = flagManager.getEffectFlags({ uuid: sourceUuid });\n\t\t\tif (sourceEffects.length) {\n\t\t\t\tconst rekeyed = this._patchEffectDataForDocument(inDocument.uuid, sourceEffects);\n\t\t\t\tconst effectDatas = rekeyed.map(([, data]) => data);\n\t\t\t\tflagManager.addFlags(inDocument.uuid, { effects: effectDatas });\n\t\t\t\tfor (const effectData of effectDatas) {\n\t\t\t\t\tsequencerSocket.executeForOthers(SOCKET_HANDLERS.PLAY_EFFECT, effectData, false);\n\t\t\t\t}\n\t\t\t\teffects = effects.concat(rekeyed);\n\t\t\t}\n\t\t}\n\t\tif (!effects?.length) return;\n\t\treturn this._playEffectMap(effects, inDocument);\n\t}\n\n\t/**\n\t * Plays multiple effects at the same time\n\t *\n\t * @param inEffects\n\t * @param inDocument\n\t * @returns {Promise<{duration: Promise<number>, promise: Promise<void>}[]>}\n\t * @private\n\t */\n\tstatic _playEffectMap(inEffects, inDocument) {\n\t\tif (inEffects instanceof Map) inEffects = Array.from(inEffects);\n\t\treturn Promise.all(\n\t\t\tinEffects.map((effect) => {\n\t\t\t\tif (!CanvasEffect.checkShouldPlay(effect[1])) return;\n\t\t\t\tif (!CanvasEffect.checkValid(effect[1])) {\n\t\t\t\t\tif (!game.user.isGM) return;\n\t\t\t\t\tlib.custom_warning(\n\t\t\t\t\t\t`Sequencer`,\n\t\t\t\t\t\t`Removed effect from ${inDocument.uuid} as it no longer had a valid source or target`\n\t\t\t\t\t);\n\t\t\t\t\treturn flagManager.removeFlags(inDocument.uuid, { effects: effect });\n\t\t\t\t}\n\t\t\t\treturn this._playEffect(effect[1], false)\n\t\t\t\t\t.then((result) => {\n\t\t\t\t\t\tif (!result) {\n\t\t\t\t\t\t\tlib.debug(\"Error playing effect\");\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.catch((err) => {\n\t\t\t\t\t\tlib.debug(\"Error playing effect:\", err);\n\t\t\t\t\t});\n\t\t\t})\n\t\t);\n\t}\n\n\t/**\n\t * Ends one or many effects at the same time, returning a promise that resolves once every effect has fully ended\n\t *\n\t * @param inEffectIds\n\t * @returns {Promise}\n\t * @private\n\t */\n\tstatic async _endManyEffects(inEffectIds = false) {\n\t\tconst actorEffectsToEnd = this.effects.filter((effect) => {\n\t\t\treturn (\n\t\t\t\teffect.context?.actorLink &&\n\t\t\t\teffect.context?.actor &&\n\t\t\t\tinEffectIds.includes(effect.data?.persistOptions?.id)\n\t\t\t);\n\t\t});\n\t\tconst effectsByActorUuid = Object.values(\n\t\t\tlib.group_by(actorEffectsToEnd, \"context.actor.uuid\")\n\t\t);\n\n\t\tconst regularEffectsToEnd = this.effects.filter((effect) => {\n\t\t\treturn (\n\t\t\t\tinEffectIds.includes(effect.id) ||\n\t\t\t\t(!(effect.context?.actorLink && effect.context?.actor) &&\n\t\t\t\t\tinEffectIds.includes(effect.data?.persistOptions?.id))\n\t\t\t);\n\t\t});\n\t\tconst effectsByContextUuid = Object.values(\n\t\t\tlib.group_by(regularEffectsToEnd, \"context.uuid\")\n\t\t);\n\n\t\teffectsByContextUuid.forEach((effects) => {\n\t\t\teffects = effects.filter(\n\t\t\t\t(effect) => effect.data.persist && !effect.data.temporary\n\t\t\t);\n\t\t\tif (!effects.length) return;\n\t\t\tconst effectData = effects.map((effect) => effect.data);\n\t\t\tflagManager.removeFlags(\n\t\t\t\teffects[0].context.uuid,\n\t\t\t\t{ effects: effectData, removeAllEffects: !inEffectIds }\n\t\t\t);\n\t\t});\n\n\t\teffectsByActorUuid.forEach((effects) => {\n\t\t\teffects = effects.filter(\n\t\t\t\t(effect) => effect.data.persist && !effect.data.temporary\n\t\t\t);\n\t\t\tif (!effects.length) return;\n\n\t\t\tconst effectContext = effects[0].context;\n\t\t\tconst effectData = effects.map((effect) => effect.data);\n\n\t\t\tif (\n\t\t\t\t!(\n\t\t\t\t\teffectContext instanceof TokenDocument &&\n\t\t\t\t\teffectContext.actorLink &&\n\t\t\t\t\teffectContext.actor &&\n\t\t\t\t\teffectContext.actor?.prototypeToken?.actorLink\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst persistentEffectData = effectData.filter(\n\t\t\t\t(data) => lib.is_UUID(data?.source) && data?.persistOptions?.persistTokenPrototype\n\t\t\t);\n\t\t\tif (!persistentEffectData.length) return;\n\n\t\t\tconst actorEffects = flagManager.getEffectFlags(effectContext.actor);\n\t\t\tconst applicableActorEffects = actorEffects\n\t\t\t\t.filter((effect) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tlib.is_UUID(effect[1]?.source) &&\n\t\t\t\t\t\teffect[1]?.persistOptions?.persistTokenPrototype &&\n\t\t\t\t\t\tpersistentEffectData.some(\n\t\t\t\t\t\t\t(persistentEffect) =>\n\t\t\t\t\t\t\t\tpersistentEffect.persistOptions.id ===\n\t\t\t\t\t\t\t\teffect[1]?.persistOptions?.id\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t\t.map((e) => e[0]);\n\n\t\t\tflagManager.removeFlags(\n\t\t\t\teffectContext.actor.uuid,\n\t\t\t\t{ effects: applicableActorEffects, removeAllEffects: !inEffectIds }\n\t\t\t);\n\t\t});\n\n\t\tconst effectsToEnd = effectsByContextUuid\n\t\t\t.concat(effectsByActorUuid)\n\t\t\t.deepFlatten();\n\n\t\treturn Promise.allSettled(\n\t\t\teffectsToEnd.map((effect) => this._removeEffect(effect))\n\t\t);\n\t}\n\n\tstatic _effectContextFilter(inUUID, effectData) {\n\t\treturn (\n\t\t\teffectData?.source === inUUID ||\n\t\t\teffectData?.target === inUUID ||\n\t\t\t(effectData?.tiedDocuments ?? []).indexOf(inUUID) > -1\n\t\t);\n\t}\n\n\t/**\n\t * Handles the deletion of objects that effects are attached to\n\t *\n\t * @param inUUID\n\t * @returns {Promise}\n\t */\n\tstatic objectDeleted(inUUID) {\n\t\tconst databaseEffects = flagManager.getDatabaseFlags().effects;\n\t\tconst flagRemovals = [];\n\t\tfor (const [ownerUuid, effects] of Object.entries(databaseEffects)) {\n\t\t\tconst idsToEnd = effects\n\t\t\t\t.filter(([, effectData]) => this._effectContextFilter(inUUID, effectData))\n\t\t\t\t.map(([effectId]) => effectId);\n\t\t\tif (idsToEnd.length) {\n\t\t\t\tflagRemovals.push(flagManager.removeFlags(ownerUuid, { effects: idsToEnd }));\n\t\t\t}\n\t\t}\n\n\t\tconst visibleEffectsToEnd = this.effects\n\t\t\t.filter((effect) => this._effectContextFilter(inUUID, effect.data))\n\t\t\t.map((e) => e.id);\n\n\t\treturn Promise.allSettled([\n\t\t\tthis._endManyEffects(visibleEffectsToEnd),\n\t\t\t...flagRemovals,\n\t\t]);\n\t}\n\n\t/**\n\t * Removes the effect from the manager and ends it, returning a promise that resolves once the effect has fully _ended\n\t *\n\t * @param effect\n\t * @returns {Promise}\n\t * @private\n\t */\n\tstatic _removeEffect(effect) {\n\t\tSequenceManager.VisibleEffects.delete(effect.id);\n\t\tTemporaryPositionsContainer.delete(effect.data.source);\n\t\tTemporaryPositionsContainer.delete(effect.data.target);\n\t\treturn effect.endEffect();\n\t}\n}\n","import { EffectPlayer, InteractionManager, SelectionManager, } from \"../modules/sequencer-interaction-manager.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport * as lib from \"../lib/lib.js\";\nimport CONSTANTS from \"../constants.js\";\nimport SequencerSoundManager from \"../modules/sequencer-sound-manager.js\";\n\n/**\n * Inert compatibility layer.\n *\n * Prior to Foundry v14 this layer was the default render target for\n * Sequencer effects via `canvas.sequencerEffects`. Default effects now\n * render inside `canvas.primary` so that they participate in elevation /\n * sortLayer ordering with tokens, tiles, drawings, and weather (see\n * CanvasEffect._addToContainer). The layer remains registered solely for\n * backward compatibility with external modules or macros that reference\n * `canvas.sequencerEffects` directly.\n */\nexport class BaseEffectsLayer extends foundry.canvas.layers.InteractionLayer {\n\tstatic get layerOptions() {\n\t\treturn foundry.utils.mergeObject(super.layerOptions, {\n\t\t\tname: CONSTANTS.EFFECTS_LAYER,\n\t\t});\n\t}\n}\n\nexport class SequencerInterfaceLayer extends foundry.canvas.layers.InteractionLayer {\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t}\n\n\tisActive = false;\n\n\tstatic get layerOptions() {\n\t\treturn foundry.utils.mergeObject(super.layerOptions, {\n\t\t\televation: 100000000,\n\t\t\tname: CONSTANTS.INTERFACE_LAYER,\n\t\t});\n\t}\n\n\tactivate(...args) {\n\t\tconst result = super.activate(...args);\n\t\tthis.isActive = true;\n\t\treturn result;\n\t}\n\n\tdeactivate() {\n\t\tsuper.deactivate();\n\t\tif (!this.isActive) return;\n\t\tthis._clearChildren();\n\t\tthis.isActive = false;\n\t\tInteractionManager.tearDown();\n\t}\n\n\t_setup() {\n\t\tif (!this.UIContainer || this.UIContainer._destroyed) {\n\t\t\tthis.UIContainer = new PIXI.Container();\n\t\t\tthis.UIContainer.sortableChildren = true;\n\t\t\tthis.UIContainer.parentName = \"sequencerUIContainer\";\n\t\t\tthis.UIContainer.zIndex = 10000000000000;\n\t\t\tthis.addChild(this.UIContainer);\n\n\t\t\tthis.visualizedSound = this.UIContainer.addChild(new PIXI.Graphics());\n\n\t\t\tthis.linePoint = this.UIContainer.addChild(new PIXI.Graphics());\n\t\t\tthis.line = this.UIContainer.addChild(new PIXI.Graphics());\n\t\t\tthis.lineHead = this.UIContainer.addChild(new PIXI.Graphics());\n\t\t\tthis.suggestionPoint = this.UIContainer.addChild(new PIXI.Graphics());\n\t\t\tthis.effectHoverBoxes = this.UIContainer.addChild(new PIXI.Graphics());\n\t\t\tthis.effectSelectionBorder = this.UIContainer.addChild(\n\t\t\t\tnew PIXI.Graphics()\n\t\t\t);\n\t\t\tthis.effectSourcePosition = this.UIContainer.addChild(\n\t\t\t\tnew PIXI.Graphics()\n\t\t\t);\n\t\t\tthis.effectTargetPosition = this.UIContainer.addChild(\n\t\t\t\tnew PIXI.Graphics()\n\t\t\t);\n\n\t\t\tthis.suggestionPoint.filters = [new PIXI.AlphaFilter(0.75)];\n\t\t\tthis.effectSourcePosition.filters = [new PIXI.AlphaFilter(0.75)];\n\t\t\tthis.effectTargetPosition.filters = [new PIXI.AlphaFilter(0.75)];\n\n\t\t\tthis.effectSelectionBorder.zIndex = 1;\n\n\t\t\tthis.effectSourcePosition.interactive = true;\n\t\t\tthis.effectSourcePosition.on(\"mousedown\", () => {\n\t\t\t\tSelectionManager.sourcePointSelected();\n\t\t\t});\n\n\t\t\tthis.effectTargetPosition.interactive = true;\n\t\t\tthis.effectTargetPosition.on(\"mousedown\", () => {\n\t\t\t\tSelectionManager.targetPointSelected();\n\t\t\t});\n\t\t}\n\t}\n\n\tasync _draw(...args) {\n\t}\n\n\trender(...args) {\n\t\tsuper.render(...args);\n\t\tthis._setup();\n\t\tthis._clearChildren();\n\t\tthis._drawHoveredEffectElements();\n\t\tthis._drawVisualizedSounds();\n\t\tif (!this.isActive) return;\n\t\tthis._drawLine();\n\t\tthis._drawPoints();\n\t\tthis._drawSelectedEffectElements();\n\t\tthis._drawSuggestionPoint();\n\t}\n\n\t_drawVisualizedSounds() {\n\t\tlet sound = SelectionManager.hoveredSoundUI;\n\t\tif (!sound || sound.status === SequencerSoundManager.states.ENDED || !sound.data.source) return;\n\n\t\tconst baseRadius = sound.data.locationOptions?.radius;\n\t\tif (!lib.is_real_number(baseRadius)) return;\n\n\t\tconst sourcePos = sound.sourcePosition;\n\t\tlet radius = (baseRadius / canvas.grid.distance) * canvas.grid.size;\n\t\tlet data = {\n\t\t\tposition: {\n\t\t\t\tx: sourcePos.x,\n\t\t\t\ty: sourcePos.y\n\t\t\t},\n\t\t\tradius: radius,\n\t\t\tshape: foundry.canvas.geometry.ClockwiseSweepPolygon.create(sourcePos, {\n\t\t\t\ttype: \"sound\",\n\t\t\t\tradius: radius\n\t\t\t})\n\t\t};\n\n\t\tfor (let constraint of data.shape.config.boundaryShapes) {\n\t\t\tthis.visualizedSound.lineStyle(2, 0xFF4444, 1.0);\n\t\t\tthis.visualizedSound.beginFill(0xFF4444, 0.10);\n\t\t\tthis.visualizedSound.drawShape(constraint);\n\t\t\tthis.visualizedSound.endFill();\n\t\t}\n\n\t\tthis.visualizedSound.beginFill(CONSTANTS.COLOR.PRIMARY, 0.5);\n\t\tthis.visualizedSound.lineStyle(2, CONSTANTS.COLOR.PRIMARY, 1.0);\n\t\tthis.visualizedSound.drawCircle(data.position.x, data.position.y, canvas.grid.size / 4);\n\t\tthis.visualizedSound.endFill();\n\n\t\tthis.visualizedSound.beginFill(0x00AAFF, 0.25);\n\t\tthis.visualizedSound.drawShape(data.shape);\n\t\tthis.visualizedSound.endFill();\n\t}\n\n\t_clearChildren() {\n\t\tif (!this.UIContainer) return;\n\t\tthis.UIContainer.children.forEach((child) => {\n\t\t\tchild.clear();\n\t\t});\n\t}\n\n\t_drawLine() {\n\t\tif (\n\t\t\t!EffectPlayer.startPos ||\n\t\t\t!EffectPlayer.endPos ||\n\t\t\tgame?.activeTool !== CONSTANTS.TOOLS.PLAY\n\t\t)\n\t\t\treturn;\n\n\t\tthis.line.lineStyle(3, CONSTANTS.COLOR.PRIMARY, 1);\n\t\t// If line already present then set its position only\n\t\tthis.line.moveTo(EffectPlayer.startPos.x, EffectPlayer.startPos.y);\n\t\tthis.line.lineTo(EffectPlayer.endPos.x, EffectPlayer.endPos.y);\n\t}\n\n\t_drawPoints() {\n\t\tif (game?.activeTool !== CONSTANTS.TOOLS.PLAY) return;\n\n\t\tconst startPos = EffectPlayer.startPos || EffectPlayer.cursorPos;\n\n\t\tthis.linePoint.beginFill(CONSTANTS.COLOR.PRIMARY);\n\t\tthis.linePoint.drawCircle(startPos.x, startPos.y, 5);\n\n\t\tif (EffectPlayer.sourceAttachFound) {\n\t\t\tthis._drawCrossAtPosition(this.linePoint, startPos);\n\t\t}\n\n\t\tif (!EffectPlayer.endPos) return;\n\n\t\tconst angle = new foundry.canvas.geometry.Ray(startPos, EffectPlayer.endPos).angle;\n\n\t\tthis.lineHead.beginFill(CONSTANTS.COLOR.PRIMARY);\n\t\tthis.lineHead.moveTo(0, -5);\n\t\tthis.lineHead.lineTo(-15, 30);\n\t\tthis.lineHead.lineTo(15, 30);\n\t\tthis.lineHead.endFill();\n\t\tthis.lineHead.rotation = angle + Math.PI / 2;\n\t\tthis.lineHead.position.set(EffectPlayer.endPos.x, EffectPlayer.endPos.y);\n\n\t\tif (EffectPlayer.targetAttachFound) {\n\t\t\tthis.linePoint.beginFill(CONSTANTS.COLOR.SECONDARY);\n\t\t\tthis._drawCrossAtPosition(this.linePoint, EffectPlayer.endPos);\n\t\t}\n\t}\n\n\t_drawHoveredEffectElements() {\n\t\tconst effects = new Set(SelectionManager.hoveredEffects);\n\t\tif (SelectionManager.hoveredEffectUI)\n\t\t\teffects.add(SelectionManager.hoveredEffectUI);\n\t\tfor (const effect of effects) {\n\t\t\tif (\n\t\t\t\t!effect ||\n\t\t\t\teffect === SelectionManager.selectedEffect ||\n\t\t\t\teffect.data.screenSpace ||\n\t\t\t\teffect._isEnding\n\t\t\t)\n\t\t\t\tcontinue;\n\t\t\tthis._drawBoxAroundEffect(this.effectHoverBoxes, effect);\n\t\t}\n\t}\n\n\t_drawSelectedEffectElements() {\n\t\tif (!SelectionManager.selectedEffect) return;\n\t\tthis._drawBoxAroundEffect(\n\t\t\tthis.effectSelectionBorder,\n\t\t\tSelectionManager.selectedEffect,\n\t\t\ttrue\n\t\t);\n\t\tthis._drawEffectStartEndPoints(SelectionManager.selectedEffect);\n\t}\n\n\t_drawBoxAroundEffect(graphic, effect, selected = false) {\n\t\tif (\n\t\t\t!effect ||\n\t\t\teffect._destroyed ||\n\t\t\t!effect.spriteContainer ||\n\t\t\t!effect.ready\n\t\t)\n\t\t\treturn;\n\n\t\tgraphic.lineStyle(3, selected ? CONSTANTS.COLOR.PRIMARY : 0xffffff, 0.9);\n\n\t\tlet boundingBox = effect.sprite.getLocalBounds();\n\n\t\tlet dimensions = {\n\t\t\tx: effect.position.x + boundingBox.x,\n\t\t\ty: effect.position.y + boundingBox.y,\n\t\t\twidth: boundingBox.width,\n\t\t\theight: boundingBox.height,\n\t\t};\n\n\t\tif (effect.data.shapes.length) {\n\t\t\tfor (const shape of Object.values(effect.shapes)) {\n\t\t\t\tboundingBox = shape.getLocalBounds();\n\t\t\t\tdimensions = {\n\t\t\t\t\tx: Math.min(\n\t\t\t\t\t\tdimensions.x,\n\t\t\t\t\t\teffect.position.x + boundingBox.x * shape.scale.x\n\t\t\t\t\t),\n\t\t\t\t\ty: Math.min(\n\t\t\t\t\t\tdimensions.y,\n\t\t\t\t\t\teffect.position.y + boundingBox.y * shape.scale.y\n\t\t\t\t\t),\n\t\t\t\t\twidth: Math.max(dimensions.width, boundingBox.width * shape.scale.x),\n\t\t\t\t\theight: Math.max(\n\t\t\t\t\t\tdimensions.height,\n\t\t\t\t\t\tboundingBox.height * shape.scale.y\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tconst rotation = Math.normalizeRadians(\n\t\t\teffect.rotationContainer.rotation +\n\t\t\teffect.spriteContainer.rotation +\n\t\t\teffect.sprite.rotation\n\t\t);\n\n\t\tthis._drawRectangle(graphic, effect.position, rotation, dimensions);\n\t}\n\n\t_drawRectangle(graphic, position, rotation, dimensions) {\n\t\tgraphic.moveTo(\n\t\t\t...canvaslib.rotate_coordinate(\n\t\t\t\tposition,\n\t\t\t\t{\n\t\t\t\t\tx: dimensions.x,\n\t\t\t\t\ty: dimensions.y,\n\t\t\t\t},\n\t\t\t\t-rotation\n\t\t\t)\n\t\t);\n\n\t\tgraphic.lineTo(\n\t\t\t...canvaslib.rotate_coordinate(\n\t\t\t\tposition,\n\t\t\t\t{\n\t\t\t\t\tx: dimensions.x + dimensions.width,\n\t\t\t\t\ty: dimensions.y,\n\t\t\t\t},\n\t\t\t\t-rotation\n\t\t\t)\n\t\t);\n\n\t\tgraphic.lineTo(\n\t\t\t...canvaslib.rotate_coordinate(\n\t\t\t\tposition,\n\t\t\t\t{\n\t\t\t\t\tx: dimensions.x + dimensions.width,\n\t\t\t\t\ty: dimensions.y + dimensions.height,\n\t\t\t\t},\n\t\t\t\t-rotation\n\t\t\t)\n\t\t);\n\n\t\tgraphic.lineTo(\n\t\t\t...canvaslib.rotate_coordinate(\n\t\t\t\tposition,\n\t\t\t\t{\n\t\t\t\t\tx: dimensions.x,\n\t\t\t\t\ty: dimensions.y + dimensions.height,\n\t\t\t\t},\n\t\t\t\t-rotation\n\t\t\t)\n\t\t);\n\n\t\tgraphic.lineTo(\n\t\t\t...canvaslib.rotate_coordinate(\n\t\t\t\tposition,\n\t\t\t\t{\n\t\t\t\t\tx: dimensions.x,\n\t\t\t\t\ty: dimensions.y,\n\t\t\t\t},\n\t\t\t\t-rotation\n\t\t\t)\n\t\t);\n\n\t\tgraphic.lineTo(\n\t\t\t...canvaslib.rotate_coordinate(\n\t\t\t\tposition,\n\t\t\t\t{\n\t\t\t\t\tx: dimensions.x + dimensions.width,\n\t\t\t\t\ty: dimensions.y,\n\t\t\t\t},\n\t\t\t\t-rotation\n\t\t\t)\n\t\t);\n\t}\n\n\t/**\n\t * Draws the start/end point circles\n\t * @private\n\t */\n\t_drawEffectStartEndPoints(effect) {\n\t\tif (!effect || effect._destroyed || !effect.spriteContainer) return;\n\t\tif (!effect.data.stretchTo) return;\n\n\t\tconst sourcePos = effect.sourcePosition;\n\t\tconst targetPos = effect.targetPosition;\n\t\tif (!sourcePos || !targetPos) return;\n\n\t\tthis.effectSourcePosition.beginFill(CONSTANTS.COLOR.PRIMARY);\n\t\tthis.effectSourcePosition.drawCircle(\n\t\t\tsourcePos.x,\n\t\t\tsourcePos.y,\n\t\t\tcanvas.grid.size * 0.25\n\t\t);\n\n\t\tif (typeof effect.data.source === \"string\") {\n\t\t\tthis._drawCrossAtPosition(\n\t\t\t\tthis.effectSourcePosition,\n\t\t\t\tsourcePos\n\t\t\t);\n\t\t}\n\n\t\tthis.effectTargetPosition.beginFill(CONSTANTS.COLOR.SECONDARY);\n\t\tthis.effectTargetPosition.drawCircle(\n\t\t\ttargetPos.x,\n\t\t\ttargetPos.y,\n\t\t\tcanvas.grid.size * 0.25\n\t\t);\n\t\tthis.effectTargetPosition.alpha = 0.75;\n\n\t\tif (typeof effect.data.target === \"string\") {\n\t\t\tthis._drawCrossAtPosition(\n\t\t\t\tthis.effectTargetPosition,\n\t\t\t\ttargetPos\n\t\t\t);\n\t\t}\n\t}\n\n\t_drawSuggestionPoint() {\n\t\tif (\n\t\t\t!SelectionManager.suggestedProperties ||\n\t\t\t!SelectionManager.selectedEffect\n\t\t)\n\t\t\treturn;\n\n\t\tconst effect = SelectionManager.selectedEffect;\n\t\tconst suggestion = SelectionManager.suggestedProperties;\n\n\t\tthis.suggestionPoint.position.set(0, 0);\n\t\tthis.suggestionPoint.rotation = 0;\n\n\t\tif (effect.data.stretchTo) {\n\t\t\tthis.suggestionPoint.beginFill(suggestion.color);\n\t\t\tthis.suggestionPoint.drawCircle(\n\t\t\t\tsuggestion.position.x,\n\t\t\t\tsuggestion.position.y,\n\t\t\t\tcanvas.grid.size * 0.25\n\t\t\t);\n\t\t\tif (suggestion.showCursor) {\n\t\t\t\tthis._drawCrossAtPosition(this.suggestionPoint, suggestion.position);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tconst boundingBox = effect.spriteContainer.getLocalBounds();\n\n\t\tconst dimensions = {\n\t\t\tx: boundingBox.x * effect.scale.x,\n\t\t\ty: boundingBox.y * effect.scale.y,\n\t\t\twidth: boundingBox.width * effect.scale.x,\n\t\t\theight: boundingBox.height * effect.scale.y,\n\t\t};\n\n\t\tthis.suggestionPoint.lineStyle(3, CONSTANTS.COLOR.PRIMARY, 0.9);\n\t\tthis.suggestionPoint.position.set(\n\t\t\tsuggestion.position.x,\n\t\t\tsuggestion.position.y\n\t\t);\n\t\tthis._drawRectangle(\n\t\t\tthis.suggestionPoint,\n\t\t\tsuggestion.position,\n\t\t\teffect.rotation,\n\t\t\tdimensions,\n\t\t\ttrue\n\t\t);\n\n\t\tif (suggestion.showCursor) {\n\t\t\tthis.suggestionPoint.beginFill(CONSTANTS.COLOR.SECONDARY);\n\t\t\tthis._drawCrossAtPosition(this.suggestionPoint);\n\t\t}\n\n\t\tif (suggestion.showPoint) {\n\t\t\tthis.suggestionPoint.drawCircle(0, 0, canvas.grid.size * 0.2);\n\t\t}\n\t}\n\n\t_drawCrossAtPosition(inElement, inPosition = { x: 0, y: 0 }) {\n\t\tinElement.drawRect(\n\t\t\tinPosition.x + canvas.grid.size * -0.05,\n\t\t\tinPosition.y + canvas.grid.size * -0.5,\n\t\t\tcanvas.grid.size * 0.1,\n\t\t\tcanvas.grid.size\n\t\t);\n\t\tinElement.drawRect(\n\t\t\tinPosition.x + canvas.grid.size * -0.5,\n\t\t\tinPosition.y + canvas.grid.size * -0.05,\n\t\t\tcanvas.grid.size,\n\t\t\tcanvas.grid.size * 0.1\n\t\t);\n\t}\n}\n\nexport class UIEffectsLayer extends foundry.canvas.layers.InteractionLayer {\n\tstatic get layerOptions() {\n\t\treturn foundry.utils.mergeObject(super.layerOptions, {\n\t\t\tzIndex: 999999999999999,\n\t\t\tname: \"sequencerEffectsAboveEverything\",\n\t\t});\n\t}\n\n\tasync _draw(options) {\n\t\tawait super._draw(options);\n\t\tthis.sortableChildren = true;\n\t}\n\n\tupdateTransform() {\n\t\tif (this.sortableChildren && this.sortDirty) {\n\t\t\tthis.sortChildren();\n\t\t}\n\n\t\tthis._boundsID++;\n\n\t\tthis.transform.updateTransform(PIXI.Transform.IDENTITY);\n\t\tthis.worldAlpha = this.alpha;\n\n\t\tfor (let child of this.children) {\n\t\t\tif (child.visible) {\n\t\t\t\tchild.updateTransform();\n\t\t\t}\n\t\t}\n\t}\n}\n\nlet ABOVE_UI_LAYER = false;\n\nexport class SequencerAboveUILayer {\n\tconstructor(name, zIndex = 0.1) {\n\t\tthis.canvas = document.createElement(\"canvas\");\n\t\tthis.canvas.id = name;\n\n\t\tthis.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\t\tdocument.body.appendChild(this.canvas);\n\n\t\tthis.app = new PIXI.Application({\n\t\t\twidth: window.innerWidth,\n\t\t\theight: window.innerHeight,\n\t\t\tview: this.canvas,\n\t\t\tantialias: true,\n\t\t\tbackgroundAlpha: 0.0,\n\t\t\tsharedTicker: true,\n\t\t});\n\n\t\tthis.app.resizeTo = window;\n\t\tthis.app.stage.renderable = false;\n\t\tthis.app.stage.sortableChildren = true;\n\t\t// PIXI's TickerPlugin auto-registers app.render on the shared ticker\n\t\t// when the app is constructed. Undo that so the secondary renderer\n\t\t// only ticks while there are children to draw; addChild / remove\n\t\t// re-register and de-register the callback at the right transitions.\n\t\tPIXI.Ticker.shared.remove(this.app.render, this.app);\n\t\tthis._renderTickerActive = false;\n\t}\n\n\tstatic getLayer() {\n\t\treturn ABOVE_UI_LAYER ? ABOVE_UI_LAYER.app.stage : canvas.sequencerEffectsUILayer;\n\t}\n\n\tstatic addChild(...args) {\n\t\tif (!ABOVE_UI_LAYER && game.settings.get(\"sequencer\", \"enable-above-ui-screenspace\")) {\n\t\t\tABOVE_UI_LAYER = new this(\"sequencerUILayerAbove\", 10000);\n\t\t}\n\t\tconst targetLayer = this.getLayer();\n\t\tconst result = targetLayer.addChild(...args);\n\t\tif (ABOVE_UI_LAYER && targetLayer === ABOVE_UI_LAYER.app.stage) {\n\t\t\ttargetLayer.renderable = targetLayer.children.length > 0;\n\t\t\tif (targetLayer.renderable && !ABOVE_UI_LAYER._renderTickerActive) {\n\t\t\t\tPIXI.Ticker.shared.add(\n\t\t\t\t\tABOVE_UI_LAYER.app.render,\n\t\t\t\t\tABOVE_UI_LAYER.app,\n\t\t\t\t\tPIXI.UPDATE_PRIORITY.LOW\n\t\t\t\t);\n\t\t\t\tABOVE_UI_LAYER._renderTickerActive = true;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tstatic sortChildren() {\n\t\tthis.getLayer().sortDirty = true;\n\t}\n\n\tstatic removeContainerByEffect(inEffect) {\n\t\tconst targetLayer = this.getLayer();\n\t\tif (!targetLayer) return;\n\t\ttargetLayer.removeChild(inEffect);\n\t\tif (ABOVE_UI_LAYER && targetLayer === ABOVE_UI_LAYER.app.stage) {\n\t\t\ttargetLayer.renderable = targetLayer.children.length > 0;\n\t\t\tif (!targetLayer.renderable && ABOVE_UI_LAYER._renderTickerActive) {\n\t\t\t\ttry {\n\t\t\t\t\t// Clear the framebuffer one last time before we stop ticking.\n\t\t\t\t\tABOVE_UI_LAYER.app.render();\n\t\t\t\t} finally {\n\t\t\t\t\tPIXI.Ticker.shared.remove(\n\t\t\t\t\t\tABOVE_UI_LAYER.app.render,\n\t\t\t\t\t\tABOVE_UI_LAYER.app\n\t\t\t\t\t);\n\t\t\t\t\tABOVE_UI_LAYER._renderTickerActive = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","\nconst tempMat = new PIXI.Matrix();\nconst uvPoint = new PIXI.Point();\n\nclass VisionSamplerShaderGenerator extends foundry.canvas.rendering.batching.BatchShaderGenerator {\n\tgenerateSampleSrc(maxTextures) {\n\t\tlet src = \"\\n\\n\";\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tif (i > 0) {\n\t\t\t\tsrc += \"\\nelse \";\n\t\t\t}\n\t\t\tif (i < maxTextures - 1) {\n\t\t\t\tsrc += `if(vTextureId < ${i}.5)`;\n\t\t\t}\n\n\t\t\tsrc += \"\\n{\";\n\t\t\tsrc += `\\n\\tcolor = texture(uSamplers[${i}], coord, unclamped == coord ? 0.0f : -32.0f);`;\n\t\t\tsrc += \"\\n}\";\n\t\t}\n\n\t\tsrc += \"\\n\";\n\t\tsrc += \"\\n\";\n\n\t\treturn src;\n\t}\n}\n\nconst emptyColorMatrix = new Uint8Array(20);\n\nexport default class VisionSamplerShader extends foundry.canvas.rendering.shaders.BaseSamplerShader {\n\tstatic classPluginName = \"sequencerVisionBatch\";\n\tstatic batchShaderGeneratorClass = VisionSamplerShaderGenerator;\n\n\tstatic batchGeometry = [\n\t\t{ id: \"aVertexPosition\", size: 2, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aTextureCoord\", size: 2, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aClampOffset\", size: 2, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aClampFrame\", size: 4, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aMapCoord1\", size: 3, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aMapCoord2\", size: 3, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aMapCoord3\", size: 3, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aColor\", size: 4, normalized: true, type: PIXI.TYPES.UNSIGNED_BYTE },\n\t\t{ id: \"aColorMatrixR\", size: 4, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aColorMatrixG\", size: 4, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aColorMatrixB\", size: 4, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aColorMatrixA\", size: 4, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aColorMatrixOffset\", size: 4, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aColorMatrixAlpha\", size: 1, normalized: false, type: PIXI.TYPES.FLOAT },\n\t\t{ id: \"aShaderFlags\", size: 1, normalized: false, type: PIXI.TYPES.UNSIGNED_SHORT },\n\t\t{ id: \"aTextureId\", size: 1, normalized: false, type: PIXI.TYPES.UNSIGNED_SHORT },\n\t];\n\n\tstatic #SHADER_FLAGS = foundry.utils.BitMask.generateShaderBitMaskConstants([\n\t\t\"IS_TILING\",\n\t\t\"IS_VISION_MASKING_ENABLED\",\n\t\t\"IS_COLOR_MATRIX_ENABLED\",\n\t]);\n\n\t/** @override */\n\tstatic batchVertexSize = 42;\n\n\t/** @override */\n\tstatic reservedTextureUnits = 1; // We need a texture unit for the occlusion texture\n\n\t/**\n\t * The batch vertex shader source.\n\t * @type {string}\n\t */\n\tstatic batchVertexShader = /* glsl */ `#version 300 es\n\tprecision highp float;\n\t\n\tuniform vec2 screenDimensions;\n\tuniform mat3 projectionMatrix;\n\tuniform mat3 translationMatrix;\n\tuniform vec4 tint;\n\t\n\tin vec2 aVertexPosition;\n\tin vec2 aTextureCoord;\n\tin vec2 aClampOffset;\n\tin vec4 aClampFrame;\n\tin vec3 aMapCoord1;\n\tin vec3 aMapCoord2;\n\tin vec3 aMapCoord3;\n\tin vec4 aColor;\n\tin vec4 aColorMatrixR;\n\tin vec4 aColorMatrixG;\n\tin vec4 aColorMatrixB;\n\tin vec4 aColorMatrixA;\n\tin vec4 aColorMatrixOffset;\n\tin float aColorMatrixAlpha;\n\tin float aShaderFlags;\n\tin float aTextureId;\n\t\n\tout vec2 vTextureCoord;\n\tout vec2 vVisionCoord;\n\tflat out vec2 vClampOffset;\n\tflat out vec4 vClampFrame;\n\tflat out mat3 vMapCoord;\n\tflat out vec4 vColor;\n\tflat out mat4 vColorMatrix;\n\tflat out vec4 vColorMatrixOffset;\n\tflat out float vColorMatrixAlpha;\n\tflat out uint vShaderFlags;\n\tflat out float vTextureId;\n\t\n\tvoid main(void) {\n\t\tgl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0f)).xy, 0.0f, 1.0f);\n\t\tvTextureCoord = aTextureCoord;\n\t\tvVisionCoord = aVertexPosition / screenDimensions;\n\t\tvColor = aColor * tint;\n\t\tvClampOffset = aClampOffset;\n\t\tvClampFrame = aClampFrame;\n\t\tvMapCoord = mat3(aMapCoord1, aMapCoord2, aMapCoord3);\n\t\tvColorMatrix = mat4(aColorMatrixR, aColorMatrixG, aColorMatrixB, aColorMatrixA);\n\t\tvColorMatrixOffset = aColorMatrixOffset;\n\t\tvColorMatrixAlpha = aColorMatrixAlpha;\n\t\tvShaderFlags = uint(aShaderFlags);\n\t\tvTextureId = aTextureId;\n\t}\n\t`;\n\n\t/**\n\t * The batch fragment shader source.\n\t * @type {string}\n\t */\n\tstatic batchFragmentShader = /* glsl */ `#version 300 es\n\tprecision mediump float;\n\n\tin vec2 vTextureCoord;\n\tin vec2 vVisionCoord;\n\tflat in float vTextureId;\n\tflat in vec4 vColor;\n\tflat in mat3 vMapCoord;\n\tflat in uint vShaderFlags;\n\tflat in vec2 vClampOffset;\n\tflat in vec4 vClampFrame;\n\tflat in mat4 vColorMatrix;\n\tflat in vec4 vColorMatrixOffset;\n\tflat in float vColorMatrixAlpha;\n\n\tuniform bool enableVisionMasking;\n\tuniform sampler2D visionMaskTexture;\n\tuniform sampler2D uSamplers[%count%];\n\tout vec4 fragColor;\n\n\t${VisionSamplerShader.#SHADER_FLAGS}\n\n\tvoid main(void){\n\t\tbool isTilingEnabled = ((vShaderFlags & IS_TILING) == IS_TILING);\n\t\tbool isVisionMaskingEnabled = ((vShaderFlags & IS_VISION_MASKING_ENABLED) == IS_VISION_MASKING_ENABLED);\n\t\tbool isColorMatrixEnabled = ((vShaderFlags & IS_COLOR_MATRIX_ENABLED) == IS_COLOR_MATRIX_ENABLED);\n\n\t\tvec2 coord = vTextureCoord;\n\t\tvec2 unclamped;\n\t\tif (isTilingEnabled) {\n\t\t\tcoord = coord + ceil(vClampOffset - coord);\n\t\t\tcoord = (vMapCoord * vec3(coord, 1.0)).xy;\n\t\t\tunclamped = coord;\n\t\t\tcoord = clamp(coord, vClampFrame.xy, vClampFrame.zw);\n\t\t} else {\n\t\t\tunclamped = coord;\n\t  }\n\t  float mask = isVisionMaskingEnabled && enableVisionMasking ? texture(visionMaskTexture, vVisionCoord).r : 1.0;\n\n\t  vec4 color;\n\t  %forloop%\n\n\t\tif (isColorMatrixEnabled && vColorMatrixAlpha > 0.0) {\n\t\t\tif (color.a > 0.0) {\n\t      color.rgb /= color.a;\n\t    }\n\t\t\tvec4 result = color * vColorMatrix + vColorMatrixOffset;\n\n\t\t\tvec3 rgb = mix(color.rgb, result.rgb, vColorMatrixAlpha);\n\t\t\trgb *= result.a;\n\t\t\tcolor = vec4(rgb, result.a);\n\t  }\n\t  fragColor = color * mask * vColor;\n\t}\t\n\t`;\n\n\t/** @override */\n\tstatic batchDefaultUniforms(maxTex) {\n\t\treturn {\n\t\t\tscreenDimensions: [1, 1],\n\t\t\tvisionMaskTexture: maxTex,\n\t\t};\n\t}\n\n\t/** @override */\n\tstatic _preRenderBatch(batchRenderer) {\n\t\tconst uniforms = batchRenderer._shader.uniforms;\n\t\tuniforms.screenDimensions = canvas.screenDimensions;\n\t\tuniforms.enableVisionMasking = canvas?.visibility?.visible ?? canvas?.effects?.visibility?.visible ?? true;\n\t\tbatchRenderer.renderer.texture.bind(canvas.masks.vision.renderTexture, uniforms.visionMaskTexture);\n\t}\n\n\t/** @override */\n\tstatic _packInterleavedGeometry(element, attributeBuffer, indexBuffer, aIndex, iIndex) {\n\t\tconst { float32View, uint32View, uint16View } = attributeBuffer;\n\n\t\t/** @type {import(\"../meshes/TilingSpriteMesh\").default} */\n\t\tconst mesh = element.object;\n\t\t// Write indices into buffer\n\t\tconst packedVertices = aIndex / this.vertexSize;\n\t\tconst indices = element.indices;\n\t\tfor (let i = 0; i < indices.length; i++) {\n\t\t\tindexBuffer[iIndex++] = packedVertices + indices[i];\n\t\t}\n\n\t\t// Prepare attributes\n\t\tconst vertexData = element.vertexData;\n\t\tlet uvs = element.uvs;\n\t\tconst alpha = Math.min(element.worldAlpha, 1.0);\n\t\tconst baseTexture = element._texture.baseTexture;\n\t\tconst argb = PIXI.Color.shared.setValue(element._tintRGB).toPremultiplied(alpha, baseTexture.alphaMode > 0);\n\t\tconst textureId = element._texture.baseTexture._batchLocation;\n\t\tconst mapCoord = mesh.uvMatrix.mapCoord.toArray(true);\n\t\tlet clampFrame = mesh.uvMatrix.uClampFrame;\n\t\tlet clampOffset = mesh.uvMatrix.uClampOffset;\n\t\tif (mesh.tiling) {\n\t\t\tconst tex = element._texture;\n\t\t\tconst w = tex.width;\n\t\t\tconst h = tex.height;\n\t\t\tconst W = mesh.width;\n\t\t\tconst H = mesh.height;\n\t\t\tconst lt = mesh.tileTransform.localTransform;\n\t\t\ttempMat.set((lt.a * w) / W, (lt.b * w) / H, (lt.c * h) / W, (lt.d * h) / H, lt.tx / W, lt.ty / H);\n\n\t\t\tconst anchorX = mesh.uvRespectAnchor ? mesh.anchor.x : 0;\n\t\t\tconst anchorY = mesh.uvRespectAnchor ? mesh.anchor.y : 0;\n\n\t\t\tuvs[0] = uvs[6] = -anchorX;\n\t\t\tuvs[1] = uvs[3] = -anchorY;\n\t\t\tuvs[2] = uvs[4] = 1.0 - anchorX;\n\t\t\tuvs[5] = uvs[7] = 1.0 - anchorY;\n\t\t}\n\n\t\t// Write attributes into buffer\n\t\tconst vertexSize = this.vertexSize;\n\t\tconst colorMatrixArray = mesh.colorMatrixFilter?.matrix ?? emptyColorMatrix;\n\t\tconst colorMatrixAlpha = mesh.colorMatrixFilter?.alpha ?? 1;\n\t\tfor (let i = 0, j = 0; i < vertexData.length; i += 2, j += vertexSize) {\n\t\t\tuvPoint.set(uvs[i], uvs[i + 1]);\n\t\t\tif (mesh.tiling) {\n\t\t\t\ttempMat.applyInverse(uvPoint, uvPoint);\n\t\t\t}\n\t\t\tlet k = aIndex + j;\n\t\t\tfloat32View[k++] = vertexData[i];\n\t\t\tfloat32View[k++] = vertexData[i + 1];\n\t\t\tfloat32View[k++] = uvPoint.x;\n\t\t\tfloat32View[k++] = uvPoint.y;\n\t\t\tfloat32View[k++] = clampOffset[0];\n\t\t\tfloat32View[k++] = clampOffset[1];\n\t\t\tfloat32View[k++] = clampFrame[0];\n\t\t\tfloat32View[k++] = clampFrame[1];\n\t\t\tfloat32View[k++] = clampFrame[2];\n\t\t\tfloat32View[k++] = clampFrame[3];\n\t\t\tfloat32View[k++] = mapCoord[0];\n\t\t\tfloat32View[k++] = mapCoord[1];\n\t\t\tfloat32View[k++] = mapCoord[2];\n\t\t\tfloat32View[k++] = mapCoord[3];\n\t\t\tfloat32View[k++] = mapCoord[4];\n\t\t\tfloat32View[k++] = mapCoord[5];\n\t\t\tfloat32View[k++] = mapCoord[6];\n\t\t\tfloat32View[k++] = mapCoord[7];\n\t\t\tfloat32View[k++] = mapCoord[8];\n\t\t\tuint32View[k++] = argb;\n\n\t\t\tfloat32View[k++] = colorMatrixArray[0];\n\t\t\tfloat32View[k++] = colorMatrixArray[1];\n\t\t\tfloat32View[k++] = colorMatrixArray[2];\n\t\t\tfloat32View[k++] = colorMatrixArray[3];\n\n\t\t\tfloat32View[k++] = colorMatrixArray[5];\n\t\t\tfloat32View[k++] = colorMatrixArray[6];\n\t\t\tfloat32View[k++] = colorMatrixArray[7];\n\t\t\tfloat32View[k++] = colorMatrixArray[8];\n\n\t\t\tfloat32View[k++] = colorMatrixArray[10];\n\t\t\tfloat32View[k++] = colorMatrixArray[11];\n\t\t\tfloat32View[k++] = colorMatrixArray[12];\n\t\t\tfloat32View[k++] = colorMatrixArray[13];\n\n\t\t\tfloat32View[k++] = colorMatrixArray[15];\n\t\t\tfloat32View[k++] = colorMatrixArray[16];\n\t\t\tfloat32View[k++] = colorMatrixArray[17];\n\t\t\tfloat32View[k++] = colorMatrixArray[18];\n\n\t\t\tfloat32View[k++] = colorMatrixArray[4];\n\t\t\tfloat32View[k++] = colorMatrixArray[9];\n\t\t\tfloat32View[k++] = colorMatrixArray[14];\n\t\t\tfloat32View[k++] = colorMatrixArray[19];\n\n\t\t\tfloat32View[k++] = colorMatrixAlpha;\n\n\t\t\tk <<= 1;\n\t\t\tuint16View[k++] = mesh.shaderFlags.valueOf();\n\t\t\tuint16View[k++] = textureId;\n\t\t}\n\t}\n\n\t// need to override createPlugin as canvas.performance is not defined in foundry when\n\t// we need it to be\n\tstatic createPlugin() {\n    const shaderClass = this;\n    const geometryClass = Array.isArray(shaderClass.batchGeometry)\n      ? class BatchGeometry extends PIXI.Geometry {\n        constructor(_static=false) {\n          super();\n          this._buffer = new PIXI.Buffer(null, _static, false);\n          this._indexBuffer = new PIXI.Buffer(null, _static, true);\n          for ( const {id, size, normalized, type} of shaderClass.batchGeometry ) {\n            this.addAttribute(id, this._buffer, size, normalized, type);\n          }\n          this.addIndex(this._indexBuffer);\n        }\n      } : shaderClass.batchGeometry;\n    return class BatchPlugin extends shaderClass.batchRendererClass {\n\n      /** @override */\n      static get shaderGeneratorClass() {\n        return shaderClass.batchShaderGeneratorClass;\n      }\n\n      /* ---------------------------------------- */\n\n      /** @override */\n      static get defaultVertexSrc() {\n        return shaderClass.batchVertexShader;\n      }\n\n      /* ---------------------------------------- */\n\n      /** @override */\n      static get defaultFragmentTemplate() {\n        return shaderClass.batchFragmentShader;\n      }\n\n      /* ---------------------------------------- */\n\n      /** @override */\n      static get defaultUniforms() {\n        return shaderClass.batchDefaultUniforms;\n      }\n\n      /* ---------------------------------------- */\n\n      /**\n       * The batch plugin constructor.\n       * @param {PIXI.Renderer} renderer    The renderer\n       */\n      constructor(renderer) {\n        super(renderer);\n        this.geometryClass = geometryClass;\n        this.vertexSize = shaderClass.batchVertexSize;\n        this.reservedTextureUnits = shaderClass.reservedTextureUnits;\n        this._packInterleavedGeometry = shaderClass._packInterleavedGeometry;\n        this._preRenderBatch = shaderClass._preRenderBatch;\n      }\n\n      /* ---------------------------------------- */\n\n      /** @inheritdoc */\n      setShaderGenerator(options) {\n        // if ( !canvas.performance ) return;\n        super.setShaderGenerator(options);\n      }\n\n      /* ---------------------------------------- */\n\n      /** @inheritdoc */\n      contextChange() {\n        this.shaderGenerator = null;\n        super.contextChange();\n      }\n    };\n  }\n}\n","import VisionSamplerShader from \"../filters/vision-sampler-shader.js\";\n\n/**\n * Extends SpriteMesh to allow for tiling of sprites\n */\nexport default class TilingSpriteMesh extends foundry.canvas.containers.SpriteMesh {\n\t/** @type {PIXI.Transform} */\n\ttileTransform;\n\n\t/** @type {PIXI.TextureMatrix} */\n\tuvMatrix;\n\n\t/** @type {PIXI.ColorMatrixFilter} */\n\t#colorMatrixFilter;\n\n\tshaderFlags = new foundry.utils.BitMask({\n\t\tisTiling: false,\n\t\tisVisionMaskingEnabled: true,\n\t\tisColorMatrixEnabled: false,\n\t});\n\n\t/**\n\t * @param {PIXI.Texture} texture - The {@link PIXI.Texture} bound to this mesh\n\t * @param {object} [options = {}]\n\t * @property {typeof BaseSamplerShader} options.shaderClassader Shader class used by this sprite mesh.\n\t * @property {boolean} options.tiling Shader class used by this sprite mesh.\n\t * @property {boolean} options.isVisionMaskingEnabled Shader class used by this sprite mesh.\n\t */\n\tconstructor(texture, { shaderClass = VisionSamplerShader, tiling = false, isVisionMaskingEnabled = true } = {}) {\n\t\tsuper(texture, shaderClass);\n\t\tthis.tileTransform = new PIXI.Transform();\n\t\tthis.tiling = tiling;\n\t\tthis.isVisionMaskingEnabled = isVisionMaskingEnabled;\n\t\tthis.uvMatrix = this.texture.uvMatrix || new PIXI.TextureMatrix(texture);\n\t}\n\n\tget tiling() {\n\t\treturn this.shaderFlags.hasState('isTiling')\n\t}\n\t/**\n\t * @param {boolean} value\n\t */\n\tset tiling(value) {\n\t\tthis.shaderFlags.toggleState('isTiling', value)\n\t}\n\n\t\n\tget isVisionMaskingEnabled() {\n\t\treturn this.shaderFlags.hasState('isVisionMaskingEnabled')\n\t}\n\t/**\n\t * @param {boolean} value\n\t */\n\tset isVisionMaskingEnabled(value) {\n\t\tthis.shaderFlags.toggleState('isVisionMaskingEnabled', value)\n\t}\n\n\t/**\n\t * @param {PIXI.ColorMatrixFilter | null} value\n\t */\n\tset colorMatrixFilter(value) {\n\t\tthis.shaderFlags.toggleState('isColorMatrixEnabled', value != null)\n\t\tthis.#colorMatrixFilter = value;\n\t}\n\tget colorMatrixFilter() {\n\t\treturn this.#colorMatrixFilter;\n\t}\n\n\t/** The scaling of the image that is being tiled. */\n\tget tileScale() {\n\t\treturn this.tileTransform.scale;\n\t}\n\n\tset tileScale(value) {\n\t\tthis.tileTransform.scale.copyFrom(value);\n\t}\n\n\t/** The offset of the image that is being tiled. */\n\tget tilePosition() {\n\t\treturn this.tileTransform.position;\n\t}\n\n\tset tilePosition(value) {\n\t\tthis.tileTransform.position.copyFrom(value);\n\t}\n\n\t_onTextureUpdate() {\n\t\tsuper._onTextureUpdate();\n\t\tif (this.uvMatrix) {\n\t\t\tthis.uvMatrix.texture = this._texture;\n\t\t}\n\t}\n\n\t/**\n\t * Renders the object using the WebGL renderer\n\t * @param renderer - The renderer\n\t */\n\t_render(renderer) {\n\t\tthis.uvMatrix.update();\n\t\tthis.tileTransform.updateLocalTransform();\n\t\tsuper._render(renderer);\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\tthis.tileTransform = null;\n\t\tthis.uvMatrix = null;\n\t}\n}\n","import VisionSamplerShader from \"../filters/vision-sampler-shader.js\";\nimport TilingSpriteMesh from \"./TilingSpriteMesh.js\";\n\n/**\n * This is a 1:1 copy of the animated sprite code but set atop the TilingSpriteMesh\n */\nexport default class AnimatedSpriteMesh extends TilingSpriteMesh {\n\t/**\n\t * @param textures - An array of {@link PIXI.Texture} or frame\n\t *  objects that make up the animation.\n\t * @param {object} [options = {}]\n\t * @property {typeof BaseSamplerShader} options.shaderClassader Shader class used by this sprite mesh.\n\t * @property {boolean} options.tiling Shader class used by this sprite mesh.\n\t * @property {boolean} options.isVisionMaskingEnabled Shader class used by this sprite mesh.\n\t */\n\tconstructor(\n\t\ttextures,\n\t\t{ autoUpdate = true, shaderClass = VisionSamplerShader, isVisionMaskingEnabled = true, tiling } = {}\n\t) {\n\t\tconst texture = textures[0] instanceof PIXI.Texture ? textures[0] : textures[0].texture;\n\t\tsuper(texture, { shaderClass, tiling, isVisionMaskingEnabled });\n\t\tthis._textures = [];\n\t\tthis._durations = null;\n\t\tthis._autoUpdate = autoUpdate;\n\t\tthis._isConnectedToTicker = false;\n\t\tthis.animationSpeed = 1;\n\t\tthis.loop = true;\n\t\tthis.updateAnchor = false;\n\t\tthis.onComplete = null;\n\t\tthis.onFrameChange = null;\n\t\tthis.onLoop = null;\n\t\tthis._currentTime = 0;\n\t\tthis._playing = false;\n\t\tthis._previousFrame = null;\n\t\tthis.textures = textures;\n\t}\n\t/** Stops the AnimatedSprite. */\n\tstop() {\n\t\tif (!this._playing) {\n\t\t\treturn;\n\t\t}\n\t\tthis._playing = false;\n\t\tif (this._autoUpdate && this._isConnectedToTicker) {\n\t\t\tPIXI.Ticker.shared.remove(this.update, this);\n\t\t\tthis._isConnectedToTicker = false;\n\t\t}\n\t}\n\t/** Plays the AnimatedSprite. */\n\tplay() {\n\t\tif (this._playing) {\n\t\t\treturn;\n\t\t}\n\t\tthis._playing = true;\n\t\tif (this._autoUpdate && !this._isConnectedToTicker) {\n\t\t\tPIXI.Ticker.shared.add(this.update, this, PIXI.UPDATE_PRIORITY.HIGH);\n\t\t\tthis._isConnectedToTicker = true;\n\t\t}\n\t}\n\t/**\n\t * Stops the AnimatedSprite and goes to a specific frame.\n\t * @param frameNumber - Frame index to stop at.\n\t */\n\tgotoAndStop(frameNumber) {\n\t\tthis.stop();\n\t\tthis.currentFrame = frameNumber;\n\t}\n\t/**\n\t * Goes to a specific frame and begins playing the AnimatedSprite.\n\t * @param frameNumber - Frame index to start at.\n\t */\n\tgotoAndPlay(frameNumber) {\n\t\tthis.currentFrame = frameNumber;\n\t\tthis.play();\n\t}\n\t/**\n\t * Updates the object transform for rendering.\n\t * @param deltaTime - Time since last tick.\n\t */\n\tupdate(deltaTime) {\n\t\tif (!this._playing) {\n\t\t\treturn;\n\t\t}\n\t\tconst elapsed = this.animationSpeed * deltaTime;\n\t\tconst previousFrame = this.currentFrame;\n\t\tif (this._durations !== null) {\n\t\t\tlet lag = (this._currentTime % 1) * this._durations[this.currentFrame];\n\t\t\tlag += (elapsed / 60) * 1000;\n\t\t\twhile (lag < 0) {\n\t\t\t\tthis._currentTime--;\n\t\t\t\tlag += this._durations[this.currentFrame];\n\t\t\t}\n\t\t\tconst sign = Math.sign(this.animationSpeed * deltaTime);\n\t\t\tthis._currentTime = Math.floor(this._currentTime);\n\t\t\twhile (lag >= this._durations[this.currentFrame]) {\n\t\t\t\tlag -= this._durations[this.currentFrame] * sign;\n\t\t\t\tthis._currentTime += sign;\n\t\t\t}\n\t\t\tthis._currentTime += lag / this._durations[this.currentFrame];\n\t\t} else {\n\t\t\tthis._currentTime += elapsed;\n\t\t}\n\t\tif (this._currentTime < 0 && !this.loop) {\n\t\t\tthis.gotoAndStop(0);\n\t\t\tif (this.onComplete) {\n\t\t\t\tthis.onComplete();\n\t\t\t}\n\t\t} else if (this._currentTime >= this._textures.length && !this.loop) {\n\t\t\tthis.gotoAndStop(this._textures.length - 1);\n\t\t\tif (this.onComplete) {\n\t\t\t\tthis.onComplete();\n\t\t\t}\n\t\t} else if (previousFrame !== this.currentFrame) {\n\t\t\tif (this.loop && this.onLoop) {\n\t\t\t\tif (\n\t\t\t\t\t(this.animationSpeed > 0 && this.currentFrame < previousFrame) ||\n\t\t\t\t\t(this.animationSpeed < 0 && this.currentFrame > previousFrame)\n\t\t\t\t) {\n\t\t\t\t\tthis.onLoop();\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.updateTexture();\n\t\t}\n\t}\n\t/** Updates the displayed texture to match the current frame index. */\n\tupdateTexture() {\n\t\tconst currentFrame = this.currentFrame;\n\t\tif (this._previousFrame === currentFrame) {\n\t\t\treturn;\n\t\t}\n\t\tthis._previousFrame = currentFrame;\n\t\tthis._texture = this._textures[currentFrame];\n\t\tthis._textureID = -1;\n\t\tthis._textureTrimmedID = -1;\n\t\tthis._cachedTint = [1, 1, 1, 1];\n\t\tthis.uvs.set(this._texture._uvs.uvsFloat32);\n\t\t\n\t\tif (this.updateAnchor) {\n\t\t\tthis._anchor.copyFrom(this._texture.defaultAnchor);\n\t\t}\n\t\tif (this.onFrameChange) {\n\t\t\tthis.onFrameChange(this.currentFrame);\n\t\t}\n\t\tif (this.uvMatrix) {\n\t\t\tthis.uvMatrix.texture = this._texture;\n\t\t}\n\t}\n\tdestroy(options) {\n\t\tthis.stop();\n\t\tsuper.destroy(options);\n\t\tthis.onComplete = null;\n\t\tthis.onFrameChange = null;\n\t\tthis.onLoop = null;\n\t}\n\t/**\n\t * A short hand way of creating an AnimatedSprite from an array of frame ids.\n\t * @param frames - The array of frames ids the AnimatedSprite will use as its texture frames.\n\t * @returns - The new animated sprite with the specified frames.\n\t */\n\tstatic fromFrames(frames) {\n\t\tconst textures = [];\n\t\tfor (let i = 0; i < frames.length; ++i) {\n\t\t\ttextures.push(PIXI.Texture.from(frames[i]));\n\t\t}\n\t\treturn new AnimatedSprite(textures);\n\t}\n\t/**\n\t * A short hand way of creating an AnimatedSprite from an array of image ids.\n\t * @param images - The array of image urls the AnimatedSprite will use as its texture frames.\n\t * @returns The new animate sprite with the specified images as frames.\n\t */\n\tstatic fromImages(images) {\n\t\tconst textures = [];\n\t\tfor (let i = 0; i < images.length; ++i) {\n\t\t\ttextures.push(PIXI.Texture.from(images[i]));\n\t\t}\n\t\treturn new AnimatedSprite(textures);\n\t}\n\t/**\n\t * The total number of frames in the AnimatedSprite. This is the same as number of textures\n\t * assigned to the AnimatedSprite.\n\t * @readonly\n\t * @default\n\t */\n\tget totalFrames() {\n\t\treturn this._textures.length;\n\t}\n\t/** The array of textures used for this AnimatedSprite. */\n\tget textures() {\n\t\treturn this._textures;\n\t}\n\tset textures(value) {\n\t\tif (value[0] instanceof PIXI.Texture) {\n\t\t\tthis._textures = value;\n\t\t\tthis._durations = null;\n\t\t} else {\n\t\t\tthis._textures = [];\n\t\t\tthis._durations = [];\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tthis._textures.push(value[i].texture);\n\t\t\t\tthis._durations.push(value[i].time);\n\t\t\t}\n\t\t}\n\t\tthis._previousFrame = null;\n\t\tthis.gotoAndStop(0);\n\t\tthis.updateTexture();\n\t}\n\t/** The AnimatedSprite's current frame index. */\n\tget currentFrame() {\n\t\tlet currentFrame = Math.floor(this._currentTime) % this._textures.length;\n\t\tif (currentFrame < 0) {\n\t\t\tcurrentFrame += this._textures.length;\n\t\t}\n\t\treturn currentFrame;\n\t}\n\tset currentFrame(value) {\n\t\tif (value < 0 || value > this.totalFrames - 1) {\n\t\t\tthrow new Error(\n\t\t\t\t`[AnimatedSprite]: Invalid frame index value ${value}, ` +\n\t\t\t\t\t`expected to be between 0 and totalFrames ${this.totalFrames}.`\n\t\t\t);\n\t\t}\n\t\tconst previousFrame = this.currentFrame;\n\t\tthis._currentTime = value;\n\t\tif (previousFrame !== this.currentFrame) {\n\t\t\tthis.updateTexture();\n\t\t}\n\t}\n\t/**\n\t * Indicates if the AnimatedSprite is currently playing.\n\t * @readonly\n\t */\n\tget playing() {\n\t\treturn this._playing;\n\t}\n\t/** Whether to use Ticker.shared to auto update animation time. */\n\tget autoUpdate() {\n\t\treturn this._autoUpdate;\n\t}\n\tset autoUpdate(value) {\n\t\tif (value !== this._autoUpdate) {\n\t\t\tthis._autoUpdate = value;\n\t\t\tif (!this._autoUpdate && this._isConnectedToTicker) {\n\t\t\t\tPIXI.Ticker.shared.remove(this.update, this);\n\t\t\t\tthis._isConnectedToTicker = false;\n\t\t\t} else if (this._autoUpdate && !this._isConnectedToTicker && this._playing) {\n\t\t\t\tPIXI.Ticker.shared.add(this.update, this, PIXI.UPDATE_PRIORITY.HIGH);\n\t\t\t\tthis._isConnectedToTicker = true;\n\t\t\t}\n\t\t}\n\t}\n}\n","// @ts-check\nimport AnimatedSpriteMesh from \"../lib/meshes/AnimatedSpriteMesh.js\";\nimport TilingSpriteMesh from \"../lib/meshes/TilingSpriteMesh.js\";\nimport SequencerFileCache from \"../modules/sequencer-file-cache.js\";\nclass Asset {\n\tdestroy() {\n\t\t// nothing to do in the general case\n\t}\n}\nclass TextureAsset extends Asset {\n\tfilepath;\n\ttexture;\n\tconstructor({ filepath, texture }) {\n\t\tsuper();\n\t\tthis.filepath = filepath;\n\t\tthis.texture = texture;\n\t}\n}\nclass VideoAsset extends Asset {\n\t/** @type {string} */\n\tfilepath;\n\n\t/** @type {PIXI.Texture} */\n\ttexture;\n\n\t/** @type {HTMLVideoElement  } */\n\tvideo;\n\n\t/**\n\t *\n\t * @param {object} params\n\t * @param {string} params.filepath\n\t * @param {PIXI.Texture} params.texture\n\t * @param {HTMLVideoElement} params.video\n\t */\n\tconstructor({ filepath, texture, video }) {\n\t\tsuper();\n\t\tthis.filepath = filepath;\n\t\tthis.texture = texture;\n\t\tthis.video = video;\n\t}\n\tdestroy() {\n\t\ttry {\n\t\t\tthis.video.pause();\n\t\t\tURL.revokeObjectURL(this.video.src);\n\t\t\tthis.video.removeAttribute(\"src\");\n\t\t\tthis.video.onerror = null;\n\t\t\tthis.video.oncanplay = null;\n\t\t\tthis.video.load();\n\t\t\t// @ts-expect-error can only be null after destroy\n\t\t\tthis.video = null;\n\t\t} catch (err) {}\n\t\tthis.texture.destroy(true);\n\t}\n}\nclass VideoSpritesheetAsset extends Asset {\n\t/** @type {string} */\n\tfilepath;\n\n\t/** @type {PIXI.Spritesheet} */\n\tspritesheet;\n\n\t/** @type {PIXI.FrameObject[]} */\n\tframeObjects;\n\n\t/** @type {number} */\n\tframerate;\n\n\t/**\n\t * @param {object} params\n\t * @param {string} params.filepath\n\t * @param {PIXI.Spritesheet} params.spritesheet\n\t */\n\tconstructor({ filepath, spritesheet }) {\n\t\tsuper();\n\t\tthis.filepath = filepath;\n\t\tthis.spritesheet = spritesheet;\n\t\t// @ts-expect-error framerate is either there or undefined, stop complaining typescript...\n\t\tthis.framerate = this.spritesheet.data?.meta?.frameRate ?? 30;\n\t\tconst frametime = (1 / this.framerate) * 1000;\n\t\tthis.frameObjects = (Object.values(spritesheet.animations)[0] ?? []).map((texture) => ({\n\t\t\ttexture,\n\t\t\ttime: frametime,\n\t\t}));\n\t\tthis.#register();\n\t}\n\tdestroy() {\n\t\treturn SequencerFileCache.unloadSpritesheet(this.filepath);\n\t}\n\t#register() {\n\t\tSequencerFileCache.registerSpritesheet(this.filepath, this.spritesheet);\n\t}\n}\nclass FlipbookAsset extends Asset {\n\t/** @type {string[]} */\n\tfilepaths;\n\n\t/** @type {PIXI.FrameObject[]} */\n\tframeObjects;\n\n\t/** @type {number} */\n\tframerate;\n\n\t/**\n\t * @param {object} params\n\t * @param {string[]} params.filepaths\n\t * @param {PIXI.Texture[]} params.textures\n\t * @param {number} params.framerate\n\t */\n\tconstructor({ filepaths, textures, framerate = 24 }) {\n\t\tsuper();\n\t\tthis.filepaths = filepaths;\n\t\tthis.framerate = framerate;\n\t\tconst frametime = (1 / framerate) * 1000;\n\t\tthis.frameObjects = textures.map((texture) => ({ texture, time: frametime }));\n\t}\n\tdestroy() {\n\t\t// TODO maybe add spritesheet-like ref counting for flipbooks too?\n\t}\n}\n//#endregion\n//#region Playback controls\nclass PlaybackControls {\n\tdestroy() {}\n}\nclass VideoPlaybackControls extends PlaybackControls {\n\t/** @type {HTMLVideoElement} */\n\t#video;\n\n\t/** @type {PIXI.Texture} */\n\t#texture;\n\n\t/**\n\t * @param {HTMLVideoElement} video\n\t * @param {PIXI.Texture} texture\n\t */\n\tconstructor(video, texture) {\n\t\tsuper();\n\t\tthis.#video = video;\n\t\tthis.#texture = texture;\n\t}\n\tasync play() {\n\t\ttry {\n\t\t\tawait this.#video.play();\n\t\t\tthis.#texture.update();\n\t\t} catch (error) {}\n\t}\n\tstop() {\n\t\tthis.#video.pause();\n\t}\n\tget duration() {\n\t\treturn this.#video.duration;\n\t}\n\tget isPlaying() {\n\t\treturn !this.#video.paused;\n\t}\n\tget loop() {\n\t\treturn this.#video.loop;\n\t}\n\tset loop(value) {\n\t\tthis.#video.loop = value;\n\t}\n\tget volume() {\n\t\treturn this.#video.volume;\n\t}\n\tset volume(value) {\n\t\tthis.#video.muted = !value;\n\t\tthis.#video.volume = value;\n\t}\n\tget currentTime() {\n\t\treturn this.#video.currentTime;\n\t}\n\tset currentTime(value) {\n\t\tthis.#video.currentTime = value;\n\t}\n\tget playbackRate() {\n\t\treturn this.#video.playbackRate;\n\t}\n\tset playbackRate(value) {\n\t\tthis.#video.playbackRate = value;\n\t}\n\tdestroy() {\n\t\tthis.stop();\n\t\t// @ts-expect-error should be null only when destroyed\n\t\tthis.#video = null;\n\t\t// @ts-expect-error should be null only when destroyed\n\t\tthis.#texture = null;\n\t}\n}\n\nclass SpritePlaybackControls extends PlaybackControls {\n\t/** @type {AnimatedSpriteMesh} */\n\t#sprite;\n\n\t/** @type {number} */\n\t#framerate;\n\n\t/** @type {number} */\n\t#framecount;\n\n\t/**\n\t * @param {AnimatedSpriteMesh} sprite\n\t * @param {number} framerate\n\t * @param {number} framecount\n\t */\n\tconstructor(sprite, framerate, framecount) {\n\t\tsuper();\n\t\tthis.#sprite = sprite;\n\t\tthis.#framerate = framerate;\n\t\tthis.#framecount = framecount;\n\t}\n\tasync play() {\n\t\tthis.#sprite.play();\n\t}\n\tstop() {\n\t\tthis.#sprite.stop();\n\t}\n\tget duration() {\n\t\treturn this.#framecount / this.#framerate;\n\t}\n\tget isPlaying() {\n\t\treturn this.#sprite.playing;\n\t}\n\tget loop() {\n\t\treturn this.#sprite.loop;\n\t}\n\tset loop(value) {\n\t\tthis.#sprite.loop = value;\n\t}\n\tget volume() {\n\t\treturn 0;\n\t}\n\tset volume(_value) {}\n\n\tget currentTime() {\n\t\t// return currentTime rounded with ms accuracy.\n\t\t// This solves issues with videos vor example having 265 frames, 24 fps.\n\t\t// This resolves to an accurate total time of 11.04166.. s, whereas\n\t\t// the reported time from the video file would be 11.042s.\n\t\tconst accurateTime = (this.#sprite.currentFrame + 1) / this.#framerate;\n\t\treturn Math.round(accurateTime * 1000) / 1000;\n\t}\n\tset currentTime(value) {\n\t\tconst newFrame = Math.floor(value * this.#framerate);\n\t\tconst newFrameIndex = Math.clamp(newFrame, 0, this.#framecount - 1);\n\t\tif (this.#sprite.playing) {\n\t\t\tthis.#sprite.gotoAndPlay(newFrameIndex);\n\t\t} else {\n\t\t\tthis.#sprite.gotoAndStop(newFrameIndex);\n\t\t}\n\t}\n\tget playbackRate() {\n\t\treturn this.#sprite.animationSpeed;\n\t}\n\tset playbackRate(value) {\n\t\tthis.#sprite.animationSpeed = value;\n\t}\n\n\tdestroy() {\n\t\tthis.stop();\n\t\t// @ts-expect-error should be null only when destroyed\n\t\tthis.#sprite = null;\n\t}\n}\n\nexport class SequencerSpriteManager extends PIXI.Container {\n\t// @ts-ignore\n\t#id = foundry.utils.randomID();\n\n\t/** @type {import(\"../modules/sequencer-file.js\").SequencerFile} */\n\t#file;\n\n\t/** @type {{ antialiasing: PIXI.SCALE_MODES; tiling?: boolean; xray?: boolean; isPersisted: boolean }} */\n\t#sharedSpriteConfig;\n\n\t/** @type {string | undefined} */\n\t#activeAssetPath;\n\n\t/** @type {Map<string | undefined, VideoAsset | VideoSpritesheetAsset | TextureAsset | FlipbookAsset>} */\n\t#relatedAssets = new Map();\n\n\t/** @type {VideoPlaybackControls | SpritePlaybackControls | null} */\n\t#playbackControls;\n\n\t/** @type {Promise<void> | undefined} */\n\t#preloadingPromise;\n\n\t/** @type {TilingSpriteMesh | null} */\n\t#managedSprite;\n\n\t/** @type {PIXI.Text | null} */\n\t#textSprite;\n\n\t/** @type {{width: number, height: number, scaleX: number, scaleY: number}} */\n\t#defaultScaling = {\n\t\twidth: 0,\n\t\theight: 0,\n\t\tscaleX: 1,\n\t\tscaleY: 1,\n\t};\n\n\tget preloadingPromise() {\n\t\tif (this.#preloadingPromise) {\n\t\t\treturn this.#preloadingPromise;\n\t\t}\n\t\treturn Promise.resolve();\n\t}\n\n\t/**\n\t * @param {import(\"../modules/sequencer-file.js\").SequencerFile} file\n\t * @param {{ texture?: null, antialiasing: PIXI.SCALE_MODES; tiling?: boolean; xray?: boolean; isPersisted: boolean }} options\n\t */\n\tconstructor(file, options) {\n\t\tsuper();\n\t\tthis.#sharedSpriteConfig = options ?? {\n\t\t\ttexture: null,\n\t\t\tantialiasing: PIXI.SCALE_MODES.LINEAR,\n\t\t\ttiling: false,\n\t\t\txray: false,\n\t\t\tisPersisted: false,\n\t\t};\n\t\tthis.#file = file;\n\t}\n\t//#region public api\n\tget activePath() {\n\t\treturn this.#activeAssetPath;\n\t}\n\n\tget activeAsset() {\n\t\treturn this.#relatedAssets.get(this.activePath);\n\t}\n\n\tget texture() {\n\t\treturn this.managedSprite?.texture;\n\t}\n\n\tget managedSprite() {\n\t\treturn this.#managedSprite;\n\t}\n\n\t/** @return {foundry.canvas.containers.PreciseText | null} */\n\tget textSprite() {\n\t\treturn this.#textSprite\n\t}\n\n\t/**\n\t * caches current scaling values to be used for spritesheet scaling if needed\n\t */\n\tupdateDefaultScaling() {\n\t\tthis.#defaultScaling = {\n\t\t\tscaleX: this.scale.x,\n\t\t\tscaleY: this.scale.y,\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t};\n\t}\n\n\tupdateVideoTextures() {\n\t\t// CHECKME lets see if this works without update texture.\n\t\tthis.#managedSprite?.texture?.update();\n\t}\n\t/**\n\t * @param {string | undefined} filePath\n\t */\n\tasync activate(filePath) {\n\t\tif (!filePath || this.#activeAssetPath === filePath) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet nextAsset = this.#relatedAssets.get(filePath);\n\t\t// new file is already being loaded, nothing more to do\n\t\tif (this.#relatedAssets.has(filePath) && nextAsset == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!nextAsset) {\n\t\t\tthis.#relatedAssets.set(filePath, null);\n\t\t\tnextAsset = await this.#loadAsset(filePath);\n\t\t\tif (this.destroyed) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.#relatedAssets.set(filePath, nextAsset);\n\t\t}\n\n\t\tif (this.#activateAsset(nextAsset)) {\n\t\t\tthis.#activeAssetPath = filePath;\n\t\t}\n\t\tif (this.#sharedSpriteConfig.isPersisted && !this.#sharedSpriteConfig.tiling) {\n\t\t\trequestAnimationFrame(async () => {\n\t\t\t\tconst minimumScale = this.#calculateMinimumSpritesheetScale();\n\t\t\t\tconst spritesheet = await SequencerFileCache.requestCompiledSpritesheet(filePath, {\n\t\t\t\t\tminimumScale: minimumScale,\n\t\t\t\t});\n\t\t\t\tif (!spritesheet) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst previousAsset = this.activeAsset;\n\t\t\t\tconst asset = new VideoSpritesheetAsset({ filepath: filePath, spritesheet });\n\t\t\t\tthis.#relatedAssets.set(filePath, asset);\n\t\t\t\tif (this.destroyed || this.#activeAssetPath !== filePath) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.#activateAsset(asset);\n\t\t\t\tpreviousAsset?.destroy();\n\t\t\t});\n\t\t}\n\t}\n\t/**\n\t * @param {{ text: string | null; textStyle: Partial<PIXI.ITextStyle> | PIXI.TextStyle }} textData\n\t */\n\taddText(textData) {\n\t\tif (this.#textSprite) {\n\t\t\tthis.#textSprite.text = textData.text ?? \"\";\n\t\t\treturn this.#textSprite;\n\t\t}\n\t\tconst textSprite = new foundry.canvas.containers.PreciseText(textData.text ?? \"\", textData.textStyle);\n\t\ttextSprite.resolution = 5;\n\t\ttextSprite.zIndex = 1;\n\t\ttextSprite.anchor.set(0.5, 0.5);\n\t\tthis.#textSprite = textSprite;\n\t\treturn this.addChild(textSprite);\n\t}\n\tremoveText() {\n\t\tthis.#textSprite?.destroy();\n\t\tthis.#textSprite = null;\n\t}\n\n\t/**\n\t * @param {string | number} filepath\n\t */\n\tremoveSprite(filepath) {\n\t\tthis.#relatedAssets.get(filepath)?.destroy();\n\t\tthis.#relatedAssets.delete(filepath);\n\t}\n\tasync preloadVariants() {\n\t\tif (!this.#preloadingPromise) {\n\t\t\treturn (this.#preloadingPromise = this.#preloadVariants());\n\t\t}\n\t\treturn this.#preloadingPromise;\n\t}\n\tdestroy() {\n\t\tthis.#playbackControls?.destroy();\n\t\tfor (const asset of this.#relatedAssets.values()) {\n\t\t\tasset?.destroy();\n\t\t}\n\t\tthis.#relatedAssets.clear();\n\t\tthis.managedSprite?.removeFromParent();\n\t\tthis.managedSprite?.destroy();\n\t\tsuper.destroy({ children: true });\n\t}\n\t//#endregion\n\t//#region Managed Sprite proxies\n\tasync play() {\n\t\tthis.#playbackControls?.play();\n\t}\n\tstop() {\n\t\tthis.#playbackControls?.stop();\n\t}\n\tget tileScale() {\n\t\treturn this.managedSprite?.tileScale;\n\t}\n\tset tileScale(point) {\n\t\tif (point) {\n\t\t\tthis.managedSprite?.tileScale.copyFrom(point);\n\t\t}\n\t}\n\tget tilePosition() {\n\t\treturn this.managedSprite?.tilePosition;\n\t}\n\tset tilePosition(point) {\n\t\tif (point) {\n\t\t\tthis.managedSprite?.tilePosition.copyFrom(point);\n\t\t}\n\t}\n\tget anchor() {\n\t\treturn this.managedSprite?.anchor;\n\t}\n\tset anchor(point) {\n\t\tif (point) {\n\t\t\tthis.managedSprite?.anchor.copyFrom(point);\n\t\t}\n\t}\n\tget tint() {\n\t\treturn this.managedSprite?.tint ?? 0xffffff;\n\t}\n\tset tint(value) {\n\t\tif (this.managedSprite) {\n\t\t\tthis.managedSprite.tint = typeof value === \"number\" ? Math.floor(value) : value;\n\t\t}\n\t}\n\tget blendMode() {\n\t\treturn this.managedSprite?.blendMode ?? PIXI.BLEND_MODES.NORMAL;\n\t}\n\tset blendMode(value) {\n\t\tif (this.managedSprite) {\n\t\t\tthis.managedSprite.blendMode = value;\n\t\t}\n\t}\n\tget scale() {\n\t\treturn this.managedSprite?.scale || super.scale;\n\t}\n\tset scale(point) {\n\t\tthis.managedSprite?.scale.copyFrom(point);\n\t}\n\tget width() {\n\t\treturn this.managedSprite?.width ?? 0;\n\t}\n\tset width(value) {\n\t\tif (!this.managedSprite) {\n\t\t\treturn;\n\t\t}\n\t\tthis.managedSprite.width = value;\n\t}\n\tget height() {\n\t\treturn this.managedSprite?.height ?? 0;\n\t}\n\tset height(value) {\n\t\tif (!this.managedSprite) {\n\t\t\treturn;\n\t\t}\n\t\tthis.managedSprite.height = value;\n\t}\n\tget resolution() {\n\t\treturn this.#textSprite?.resolution;\n\t}\n\tset resolution(value) {\n\t\tif (!this.#textSprite) return;\n\t\tthis.#textSprite.resolution = value ?? 5;\n\t}\n\n\t/** @type {} */\n\tget hasAnimatedMedia() {\n\t\treturn (\n\t\t\tthis.activeAsset instanceof VideoAsset ||\n\t\t\tthis.activeAsset instanceof VideoSpritesheetAsset ||\n\t\t\tthis.activeAsset instanceof FlipbookAsset\n\t\t);\n\t}\n\tget playing() {\n\t\treturn this.#playbackControls?.isPlaying ?? false;\n\t}\n\tget duration() {\n\t\treturn this.#playbackControls?.duration ?? 0;\n\t}\n\tget volume() {\n\t\treturn this.#playbackControls?.volume ?? 0;\n\t}\n\tset volume(value) {\n\t\tif (!this.#playbackControls) return;\n\t\tthis.#playbackControls.volume = value;\n\t}\n\tget loop() {\n\t\treturn this.#playbackControls?.loop ?? false;\n\t}\n\tset loop(value) {\n\t\tif (!this.#playbackControls) return;\n\t\tthis.#playbackControls.loop = value;\n\t}\n\tget currentTime() {\n\t\treturn this.#playbackControls?.currentTime ?? 0;\n\t}\n\tset currentTime(value) {\n\t\tif (!this.#playbackControls) return;\n\t\tthis.#playbackControls.currentTime = value;\n\t}\n\tget playbackRate() {\n\t\treturn this.#playbackControls?.playbackRate ?? 1;\n\t}\n\tset playbackRate(value) {\n\t\tif (!this.#playbackControls) return;\n\t\tthis.#playbackControls.playbackRate = value;\n\t}\n\t/** @return {PIXI.ColorMatrixFilter | null} */\n\tget colorMatrixFilter() {\n\t\treturn this.managedSprite?.colorMatrixFilter ?? null;\n\t}\n\tset colorMatrixFilter(value) {\n\t\tif (!this.managedSprite) return;\n\t\tthis.managedSprite.colorMatrixFilter = value;\n\t\tif (this.#textSprite) {\n\t\t\tif (value) {\n\t\t\t\tthis.#textSprite.filters?.push(value);\n\t\t\t} else if (this.#textSprite.filters) {\n\t\t\t\tthis.#textSprite.filters = this.#textSprite.filters.filter(\n\t\t\t\t\t(filter) => !(filter instanceof PIXI.ColorMatrixFilter)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tasync #preloadVariants() {\n\t\tif (this.#activeAssetPath === \"TEXT\") {\n\t\t\treturn;\n\t\t}\n\t\tif (!this.#file || this.#file.isFlipbook) {\n\t\t\treturn;\n\t\t}\n\t\t/** @type {string[]} */\n\t\tconst allFiles = this.#file.getAllFiles();\n\n\t\tfor (const filePath of allFiles) {\n\t\t\tif (this.#relatedAssets.has(filePath)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst asset = await this.#loadAsset(filePath);\n\t\t\tthis.#relatedAssets.set(filePath, asset);\n\t\t}\n\t}\n\n\t/**\n\t * @param {string} filepath\n\t */\n\tasync #loadAsset(filepath) {\n\t\tif (this.#file && this.#file.isFlipbook) {\n\t\t\treturn this.#loadFlipbook(this.#file.getAllFiles(), this.#file.originalMetadata);\n\t\t}\n\t\tconst texture = this.#sharedSpriteConfig.texture ?? await SequencerFileCache.loadFile(filepath);\n\t\t// disable mipmaps if using compressed textures and no level information is given.\n\t\t// for some reason, the integrated basis_universal transcoder does not set this\n\t\t// correctly.\n\t\tif (\n\t\t\ttexture?.baseTexture?.resource instanceof PIXI.CompressedTextureResource &&\n\t\t\ttexture?.baseTexture?.resource.levels === 1\n\t\t) {\n\t\t\ttexture?.baseTexture?.setStyle(0, 0);\n\t\t} else if (\n\t\t\tthis.#sharedSpriteConfig.antialiasing &&\n\t\t\tthis.#sharedSpriteConfig.antialiasing !== PIXI.SCALE_MODES.LINEAR\n\t\t) {\n\t\t\ttexture?.baseTexture.setStyle(0, this.#sharedSpriteConfig.antialiasing);\n\t\t}\n\t\tif (texture instanceof PIXI.Spritesheet) {\n\t\t\treturn new VideoSpritesheetAsset({ filepath, spritesheet: texture });\n\t\t}\n\t\tif (texture.baseTexture?.resource?.source instanceof HTMLVideoElement) {\n\t\t\treturn new VideoAsset({ filepath, texture, video: texture.baseTexture.resource.source });\n\t\t}\n\t\treturn new TextureAsset({ filepath, texture });\n\t}\n\n\t/**\n\t * @param {string[]} filepaths\n\t * @param {{ fps: number; }} metadata\n\t */\n\tasync #loadFlipbook(filepaths, metadata) {\n\t\tconst textures = (await Promise.all(filepaths.map(async (filepath) => foundry.canvas.loadTexture(filepath)))).filter(\n\t\t\t(t) => t instanceof PIXI.Texture\n\t\t);\n\t\treturn new FlipbookAsset({ filepaths, textures, framerate: metadata?.fps ?? 24 });\n\t}\n\n\t/**\n\t * @param {VideoAsset | VideoSpritesheetAsset | TextureAsset | FlipbookAsset} nextAsset\n\t * @returns\n\t */\n\t#activateAsset(nextAsset) {\n\t\tlet view;\n\t\tlet controls;\n\t\tconst tiling = this.#sharedSpriteConfig.tiling;\n\t\tconst isVisionMaskingEnabled = !this.#sharedSpriteConfig.xray;\n\t\tif (nextAsset instanceof VideoAsset) {\n\t\t\tview = new TilingSpriteMesh(nextAsset.texture, { isVisionMaskingEnabled, tiling });\n\t\t\tcontrols = new VideoPlaybackControls(nextAsset.video, nextAsset.texture);\n\t\t} else if (nextAsset instanceof VideoSpritesheetAsset || nextAsset instanceof FlipbookAsset) {\n\t\t\tview = new AnimatedSpriteMesh(nextAsset.frameObjects, {\n\t\t\t\tautoUpdate: true,\n\t\t\t\tisVisionMaskingEnabled,\n\t\t\t\ttiling: !!tiling,\n\t\t\t});\n\t\t\tcontrols = new SpritePlaybackControls(view, nextAsset.framerate, nextAsset.frameObjects.length);\n\t\t} else if (nextAsset instanceof TextureAsset) {\n\t\t\tview = new TilingSpriteMesh(nextAsset.texture, { isVisionMaskingEnabled, tiling });\n\t\t\tcontrols = null;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\n\t\t// apply current values\n\t\tthis.#applyPreviousValues(view, controls);\n\n\t\tif (this.#playbackControls) {\n\t\t\tthis.#playbackControls.destroy();\n\t\t} else {\n\t\t\tcontrols?.play();\n\t\t}\n\t\tthis.#playbackControls = controls;\n\n\t\tif (this.managedSprite) {\n\t\t\tthis.managedSprite.removeFromParent();\n\t\t\tthis.managedSprite.destroy();\n\t\t}\n\t\tthis.#managedSprite = view;\n\t\tthis.addChildAt(view, 0);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t *\n\t * @param {TilingSpriteMesh} view\n\t * @param {VideoPlaybackControls | SpritePlaybackControls | null} controls\n\t */\n\t#applyPreviousValues(view, controls) {\n\t\tif (this.managedSprite) {\n\t\t\tconst prev = this.managedSprite;\n\t\t\tview.tint = prev.tint;\n\t\t\tview.anchor.copyFrom(prev.anchor);\n\t\t\tview.scale.copyFrom(prev.scale);\n\t\t\tview.width = prev.width;\n\t\t\tview.height = prev.height;\n\t\t\tview.tileScale.copyFrom(prev.tileScale);\n\t\t\tview.tilePosition.copyFrom(prev.tilePosition);\n\t\t\tview.pivot.copyFrom(prev.pivot);\n\t\t\tview.skew.copyFrom(prev.skew);\n\t\t\tview.alpha = prev.alpha;\n\t\t\tview.colorMatrixFilter = prev.colorMatrixFilter;\n\t\t\tview.position.copyFrom(prev.position);\n\t\t\tview.alphaMode = prev.alphaMode;\n\t\t\tview.blendMode = prev.blendMode;\n\t\t\tview.cullable = prev.cullable;\n\t\t\tview.renderable = prev.renderable;\n\t\t\tview.visible = prev.visible;\n\t\t\tview.tiling = prev.tiling;\n\t\t}\n\n\t\tif (controls && this.#playbackControls) {\n\t\t\tconst prev = this.#playbackControls;\n\t\t\tcontrols.volume = prev.volume;\n\t\t\tcontrols.loop = prev.loop;\n\t\t\tcontrols.playbackRate = prev.playbackRate;\n\t\t\tcontrols.currentTime = prev.currentTime;\n\t\t\tif (prev.isPlaying) {\n\t\t\t\tcontrols.play();\n\t\t\t} else {\n\t\t\t\tcontrols.stop();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * calculates the minimum scale required for generated spritesheets\n\t * @returns {number}\n\t */\n\t#calculateMinimumSpritesheetScale() {\n\t\tconst defaultScale = this.#defaultScaling;\n\t\t// Return the largest of the x, y scaling factors.\n\t\t// if any of those is 0, fall back to the default 1x scaling.\n\t\tconst maxScale = Math.max(defaultScale.scaleX || 1, defaultScale.scaleY || 1);\n\n\t\t// Never return a value larger than 1 as it makes no sense to upscale the video\n\t\t// textures for spritesheets\n\t\treturn Math.min(maxScale, 1);\n\t}\n}\n//#endregion\n","import { get_mouse_position, } from \"../../lib/canvas-lib.js\";\r\nimport { is_real_number } from \"../../lib/lib.js\";\r\nimport CONSTANTS from \"../../constants.js\";\r\nimport * as lib from \"../../lib/lib.js\"\r\n\r\nexport default class CrosshairsPlaceable extends foundry.canvas.placeables.MeasuredTemplate {\r\n\r\n\tconstructor(...args) {\r\n\t\tsuper(...args);\r\n\t\tthis.tag = \"sequencer-crosshair-\" + foundry.utils.randomID();\r\n\t\tthis.cachedLocation = false;\r\n\t}\r\n\r\n\t#handlers = {\r\n\t\tmouseup: null, move: null, wheel: null\r\n\t};\r\n\r\n\t#promise = {\r\n\t\tresolve: null,\r\n\t};\r\n\r\n\t#isDrag = false;\r\n\t#isPanning = false;\r\n\t#customText = false;\r\n\t#distanceText = false;\r\n\t#rangeHighlight = false;\r\n\tisValid = true;\r\n\r\n\t#lastPositions = false;\r\n\r\n\tget crosshair() {\r\n\t\treturn this.document.crosshair;\r\n\t}\r\n\r\n\tget callbacks() {\r\n\t\treturn this.document.callbacks;\r\n\t}\r\n\r\n\tget range() {\r\n\t\tconst objLocation = this.crosshair.location.obj?.center ?? this.crosshair.location.obj;\r\n\t\treturn canvas.grid.measurePath([objLocation, this.position]).distance;\r\n\t}\r\n\r\n\tupdateCrosshair(data) {\r\n\t\tthis.document.crosshair = foundry.utils.mergeObject(this.document.crosshair, data);\r\n\t\tif(this.#customText){\r\n\t\t\tthis.#customText.destroy();\r\n\t\t\tthis.#customText = null;\r\n\t\t}\r\n\t\tif(this.#distanceText){\r\n\t\t\tthis.#distanceText.destroy();\r\n\t\t\tthis.#distanceText = null;\r\n\t\t}\r\n\t\tif(this.#rangeHighlight){\r\n\t\t\tthis.#rangeHighlight.destroy();\r\n\t\t\tthis.#rangeHighlight = null;\r\n\t\t}\r\n\t\treturn this.draw();\r\n\t}\r\n\r\n\tasync #refreshIcon() {\r\n\t\tthis.controlIcon.renderable = !!this.crosshair.icon.texture;\r\n\t\tif (this.crosshair.icon.texture) {\r\n\t\t\tthis.controlIcon.iconSrc = this.crosshair.icon.texture;\r\n\t\t\tthis.controlIcon.texture = await foundry.canvas.loadTexture(this.controlIcon.iconSrc);\r\n\t\t\tthis.controlIcon.icon.texture = this.controlIcon.texture;\r\n\t\t}\r\n\t\tif (!this.crosshair.icon.borderVisible) {\r\n\t\t\tthis.controlIcon.bg.clear();\r\n\t\t}\r\n\t}\r\n\r\n\t_refreshRulerText() {\r\n\t\tconst shapeWidth = this.shape.width ?? 0;\r\n\t\tconst shapeHeight = this.shape.height ?? 0;\r\n\t\tif (this.crosshair.location.showRange && this.crosshair.location.obj) {\r\n\t\t\tif (!this.#distanceText && this.crosshair.location.obj) {\r\n\t\t\t\tconst style = CONFIG.canvasTextStyle.clone();\r\n\t\t\t\tstyle.align = \"center\";\r\n\t\t\t\tthis.#distanceText = this.template.addChild(new foundry.canvas.containers.PreciseText(\"\", style));\r\n\t\t\t}\r\n\t\t\tconst actualHeight = (this.shapeHeight || this.shape.radius) + (canvas.grid.size / 2);\r\n\t\t\tthis.#distanceText.anchor.set(0.5, 0.5);\r\n\t\t\tthis.#distanceText.position.set((shapeWidth / 2), actualHeight);\r\n\t\t\tconst { units } = this.document.parent.grid;\r\n\t\t\tthis.#distanceText.text = this.range.toString() + \" \" + units;\r\n\t\t}\r\n\t\tthis.ruler.renderable = !!this.crosshair.label?.text;\r\n\t\tif (!this.ruler.renderable) return;\r\n\t\tif (this.crosshair.label?.text) {\r\n\t\t\tif (!this.#customText) {\r\n\t\t\t\tconst style = CONFIG.canvasTextStyle.clone();\r\n\t\t\t\tstyle.align = \"center\";\r\n\t\t\t\tthis.#customText = this.template.addChild(new foundry.canvas.containers.PreciseText(\"\", style));\r\n\t\t\t}\r\n\t\t\tif (this.#customText.text !== this.crosshair.label.text) this.#customText.text = this.crosshair.label.text;\r\n\t\t\tthis.#customText.anchor.set(0.5);\r\n\t\t\tthis.#customText.position.set(\r\n\t\t\t\t(shapeWidth / 2) + (this.crosshair.label.dx ?? 0),\r\n\t\t\t\t(shapeHeight / 2) + (this.crosshair.label.dy ?? 0)\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tif (this.#customText) {\r\n\t\t\t\tthis.#customText.text = \"\";\r\n\t\t\t\tthis.#customText.destroy();\r\n\t\t\t\tthis.#customText = null;\r\n\t\t\t}\r\n\t\t\treturn super._refreshRulerText();\r\n\t\t}\r\n\t}\r\n\r\n\t_refreshTemplate() {\r\n\t\tconst t = this.template.clear();\r\n\r\n\t\t// Draw the Template outline\r\n\t\tt.lineStyle(this._borderThickness, this.document.borderColor, this.crosshair.borderAlpha).beginFill(0x000000, 0.0);\r\n\r\n\t\t// Fill Color or Texture\r\n\t\tif (this.texture) {\r\n\t\t\tconst d = canvas.dimensions;\r\n\t\t\tlet { direction, distance } = this.document;\r\n\t\t\tdistance *= (d.size / d.distance);\r\n\r\n\t\t\tconst textureAlpha = this.crosshair.textureAlpha || 0.5;\r\n\t\t\tlet textureScale = this.crosshair.textureScale || 1;\r\n\t\t\tlet textureSize = distance * textureScale;\r\n\r\n\t\t\tlet xScale = 1;\r\n\t\t\tlet yScale = 1;\r\n\t\t\tlet xOffset = 0;\r\n\t\t\tlet yOffset = 0;\r\n\r\n\t\t\tswitch (this.document.t) {\r\n\t\t\t\tcase 'circle':\r\n          xOffset = yOffset = textureSize;\r\n          xScale = yScale = textureSize * 2 / this.texture.width;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'cone':\r\n          textureSize /= 2;\r\n          yOffset = -textureSize;\r\n          xScale = yScale = textureSize * 2 / this.texture.width;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'rect':\r\n          // textureSize is basically the hypotenuse, multiple by cos/sin to get the width/height of the rect\r\n          xScale = textureSize * Math.cos(Math.toRadians(direction)) / this.texture.width;\r\n          yScale = textureSize * Math.sin(Math.toRadians(direction)) / this.texture.height;\r\n          textureSize /= 2;\r\n          // don't change angle of texture as the shape of the rect changes width/height\r\n          direction = 0;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'ray':\r\n          yOffset = this.document.width / d.distance * d.size / 2;\r\n          xScale = textureSize / this.texture.width;\r\n          yScale = textureSize / this.texture.height;\r\n          yScale *= this.document.width / this.document.distance;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tt.beginTextureFill({\r\n\t\t\t\ttexture: this.texture,\r\n\t\t\t\tmatrix: new PIXI.Matrix()\r\n\t\t\t\t\t.scale(xScale, yScale)\r\n\t\t\t\t\t.translate(xOffset, yOffset)\r\n\t\t\t\t\t.rotate(Math.toRadians(direction)),\r\n\t\t\t\talpha: textureAlpha,\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tt.beginFill(0x000000, 0.0);\r\n\t\t}\r\n\r\n\t\t// Draw the shape\r\n\t\tt.drawShape(this.shape);\r\n\r\n\t\tif (!this.crosshair.lockDrag) {\r\n\t\t\t// Draw origin and destination points\r\n\t\t\tt.lineStyle(this._borderThickness, 0x000000)\r\n\t\t\t\t.beginFill(0x000000, 0.5)\r\n\t\t\t\t.drawCircle(0, 0, 6)\r\n\t\t\t\t.drawCircle(this.ray.dx, this.ray.dy, 6)\r\n\t\t\t\t.endFill();\r\n\t\t}\r\n\t}\r\n\r\n\t#refreshRangeHighlight() {\r\n\r\n\t\tconst loc = this.crosshair.location;\r\n\r\n\t\tif(!loc.displayRangePoly || !loc.obj || loc.limitMaxRange === null) return;\r\n\r\n\t\tif(this.#rangeHighlight){\r\n\t\t\tthis.#rangeHighlight.clear();\r\n\t\t}else{\r\n\t\t\tthis.#rangeHighlight = new PIXI.Graphics();\r\n\t\t\tcanvas.tokens.addChild(this.#rangeHighlight);\r\n\t\t\tthis.#rangeHighlight.zIndex = -1;\r\n\t\t\tthis.#rangeHighlight.interactive = false;\r\n\t\t\tcanvas.tokens.sortChildren();\r\n\t\t}\r\n\r\n\t\tconst object = loc.obj;\r\n\r\n\t\tconst position = {\r\n\t\t\tx: object?.center?.x ?? object?.position?.x ?? object?.x,\r\n\t\t\ty: object?.center?.y ?? object?.position?.y ?? object?.y\r\n\t\t};\r\n\r\n    const defaultSize = canvas.dimensions.distancePixels;\r\n\t\tconst { w, h } = object;\r\n\t\tconst distance = loc.limitMaxRange + ((Math.max(w ?? defaultSize, h ?? defaultSize) / 2) / canvas.dimensions.distancePixels);\r\n\r\n\t\tthis.#rangeHighlight\r\n\t\t\t.beginFill(loc.rangePolyFillColor ?? 0xFFFFFF, lib.clamp(loc.rangePolyFillAlpha ?? 0.25, 0.0, 1.0))\r\n\t\t\t.lineStyle(2, loc.rangePolyLineColor ?? 0xFF0000, lib.clamp(loc.rangePolyLineAlpha ?? 0.5, 0.0, 1.0))\r\n\t\t\t.drawPolygon(canvas.grid.getCircle(position, distance));\r\n\r\n\t}\r\n\r\n\tasync show() {\r\n\t\tawait this.draw();\r\n\t\tthis.layer.addChild(this);\r\n\t\tthis.oldInteractiveChildren = this.layer.interactiveChildren;\r\n\t\tthis.layer.interactiveChildren = false;\r\n\t\tthis.#updateLocation();\r\n\t\tthis.#refreshRangeHighlight();\r\n\t\tthis.#runCallback(CONSTANTS.CALLBACKS.SHOW, this);\r\n\t\treturn this.#activateShowListeners();\r\n\t}\r\n\r\n\tasync #activateShowListeners() {\r\n\t\treturn new Promise((resolve) => {\r\n\t\t\tthis.#promise.resolve = resolve;\r\n\t\t\tthis.#handlers.move = this.#onMove.bind(this);\r\n\t\t\tthis.#handlers.mouseup = this.#onMouseUp.bind(this);\r\n\t\t\tthis.#handlers.wheel = this.#onWheel.bind(this);\r\n\t\t\t// Canvas.stage.removeAllListeners();\r\n\t\t\tcanvas.stage.on(\"mousemove\", this.#handlers.move);\r\n\t\t\tcanvas.stage.on(\"pointerup\", this.#handlers.mouseup);\r\n\t\t\tcanvas.app.view.addEventListener(\"wheel\", this.#handlers.wheel, { passive: true });\r\n\t\t});\r\n\t}\r\n\r\n\t#getSnappedPoint(point, mode = this.crosshair.snap.position, resolution = this.crosshair.snap.resolution) {\r\n\t\tresolution = !resolution || resolution <= 0 ? canvas.grid.size : resolution;\r\n\t\treturn canvas.grid.getSnappedPoint(point, { mode, resolution: resolution });\r\n\t}\r\n\r\n\t#onMove(evt) {\r\n\r\n\t\tconst now = Date.now();\r\n\t\tconst leftDown = (evt.buttons & 1) > 0;\r\n\t\tconst rightDown = (evt.buttons & 2) > 0;\r\n\t\tthis.#isDrag = !!(leftDown && canvas.mouseInteractionManager.isDragging);\r\n\t\tthis.#isPanning = this.#isPanning || !!(rightDown && canvas.mouseInteractionManager.isDragging);\r\n\r\n\t\tif (this.#isPanning) return;\r\n\r\n\t\tif (this.#isDrag) {\r\n\t\t\tcanvas.mouseInteractionManager.cancel(evt);\r\n\t\t}\r\n\r\n\t\tevt.preventDefault();\r\n\r\n\t\t// Apply a 20ms throttle\r\n\t\tif (now - this.moveTime <= 20) return;\r\n\r\n\t\tconst moved = this.#updateLocation();\r\n\r\n\t\tthis.#runCallback(CONSTANTS.CALLBACKS.MOUSE_MOVE, this);\r\n\t\tif (moved) this.#runCallback(CONSTANTS.CALLBACKS.MOVE, this);\r\n\r\n\t\tthis.#updateLineOfSight();\r\n\r\n\t\tthis.refresh();\r\n\t\tthis.moveTime = now;\r\n\t}\r\n\r\n\t#updateLineOfSight() {\r\n\r\n\t\tif (!this.crosshair.location?.obj || this.crosshair.location?.wallBehavior === CONSTANTS.PLACEMENT_RESTRICTIONS.ANYWHERE) return;\r\n\r\n\t\tconst object = this.crosshair.location.obj;\r\n\t\tconst objLocation = {\r\n\t\t\tx: object?.center?.x ?? object?.position?.x ?? object?.x,\r\n\t\t\ty: object?.center?.y ?? object?.position?.y ?? object?.y\r\n\t\t};\r\n\t\tconst location = { x: this.document.x, y: this.document.y };\r\n\r\n\t\tconst exitEarly = this.#lastPositions && (this.#lastPositions.obj.x === objLocation.x\r\n\t\t\t&& this.#lastPositions.obj.y === objLocation.y\r\n\t\t\t&& this.#lastPositions.tgt.x === location.x\r\n\t\t\t&& this.#lastPositions.tgt.y === location.y);\r\n\r\n\t\tthis.#lastPositions = {\r\n\t\t\tobj: objLocation,\r\n\t\t\ttgt: location\r\n\t\t}\r\n\r\n\t\tif (exitEarly) return;\r\n\r\n\t\tconst type = this.crosshair.location?.wallBehavior === CONSTANTS.PLACEMENT_RESTRICTIONS.LINE_OF_SIGHT\r\n\t\t\t? \"sight\"\r\n\t\t\t: \"move\";\r\n\r\n\t\tconst collisions = CONFIG.Canvas.polygonBackends.sight.testCollision(objLocation, location, {\r\n\t\t\ttype,\r\n\t\t\tuseThreshold: true\r\n\t\t});\r\n\r\n\t\tconst wasValid = this.isValid;\r\n\t\tthis.isValid = !collisions.length;\r\n\r\n\t\tif(!this.isValid && wasValid){\r\n\t\t\tthis.#runCallback(CONSTANTS.CALLBACKS.COLLIDE, this, collisions);\r\n\t\t}else if(this.isValid && !wasValid){\r\n\t\t\tthis.#runCallback(CONSTANTS.CALLBACKS.STOP_COLLIDING, this);\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t#handleLockedEdge(mouseLocation) {\r\n\r\n\t\tlet snappedMouseLocation = this.#getSnappedPoint(mouseLocation, CONST.GRID_SNAPPING_MODES.CENTER);\r\n\t\tconst { lockToEdgeDirection } = this.crosshair.location;\r\n\r\n\t\tconst placeable = this.crosshair.location.obj;\r\n\t\tconst shape = placeable.getShape();\r\n\t\tconst { w, h } = this.crosshair.location.obj;\r\n\r\n\t\tconst shapePoints = shape?.points ?? [0, 0, w, 0, w, h, 0, h];\r\n\t\tconst points = shapePoints.map((point, i) => {\r\n\t\t\tconst worldCoord = i % 2 === 0 ? (placeable.document.x) : (placeable.document.y)\r\n\t\t\treturn point + worldCoord;\r\n\t\t});\r\n\r\n\t\tconst centerPoint = placeable.getCenterPoint();\r\n\t\tconst ray = new foundry.canvas.geometry.Ray(centerPoint, mouseLocation);\r\n\r\n\t\tlet intersection;\r\n\t\tfor (let i = 0; i < points.length; i += 2) {\r\n\t\t\tintersection = ray.intersectSegment([points[i], points[i + 1], points[i + 2 >= points.length ? 0 : i + 2], points[i + 3 >= points.length ? 1 : i + 3]]);\r\n\t\t\tif (intersection) break;\r\n\t\t}\r\n\r\n\t\tif (!intersection) return {};\r\n\r\n\t\tlet snappedIntersection = this.#getSnappedPoint(intersection, CONST.GRID_SNAPPING_MODES.EDGE_MIDPOINT);\r\n\r\n\t\tif (canvas.scene.grid.type === CONST.GRID_TYPES.SQUARE) {\r\n\t\t\tconst size = this.document.parent.grid.size;\r\n\t\t\tconst left = snappedMouseLocation.x < points[0]\r\n\t\t\tconst above = snappedMouseLocation.y < points[1];\r\n\t\t\tconst right = snappedMouseLocation.x > points[2];\r\n\t\t\tconst below = snappedMouseLocation.y > points[5];\r\n\t\t\tif ((left || right) && (below || above)) {\r\n\t\t\t\tsnappedIntersection.x = left ? points[0] - size : (right ? points[2] + size : snappedIntersection.x);\r\n\t\t\t\tsnappedIntersection.y = above ? points[1] - size : (right ? points[5] + size : snappedIntersection.y);\r\n\t\t\t\tif (above && left) {\r\n\t\t\t\t\tsnappedIntersection.x = points[0];\r\n\t\t\t\t\tsnappedIntersection.y = points[1];\r\n\t\t\t\t} else if (above && right) {\r\n\t\t\t\t\tsnappedIntersection.x = points[2];\r\n\t\t\t\t\tsnappedIntersection.y = points[3];\r\n\t\t\t\t} else if (below && right) {\r\n\t\t\t\t\tsnappedIntersection.x = points[4];\r\n\t\t\t\t\tsnappedIntersection.y = points[5];\r\n\t\t\t\t} else if (below && left) {\r\n\t\t\t\t\tsnappedIntersection.x = points[6];\r\n\t\t\t\t\tsnappedIntersection.y = points[7];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (lockToEdgeDirection) {\r\n\t\t\tconst lockedRay = foundry.canvas.geometry.Ray.towardsPoint(snappedIntersection, snappedMouseLocation, 2)\r\n\t\t\tconst snappedDirection = this.#getSnappedPoint(lockedRay.B, CONST.GRID_SNAPPING_MODES.CENTER)\r\n\t\t\tsnappedMouseLocation.x = snappedDirection.x;\r\n\t\t\tsnappedMouseLocation.y = snappedDirection.y;\r\n\t\t}\r\n\r\n\t\tconst { direction, distance } = this.#getDraggedMatrix(snappedIntersection, snappedMouseLocation);\r\n\r\n\t\treturn {\r\n\t\t\t...snappedIntersection, direction, distance\r\n\t\t};\r\n\r\n\t}\r\n\r\n\t#handleLimit(mouseLocation, targetLocation) {\r\n\r\n\t\tconst ray = new foundry.canvas.geometry.Ray(targetLocation, mouseLocation);\r\n\t\tconst gridPath = canvas.grid.measurePath([targetLocation, mouseLocation]);\r\n\r\n\t\tconst limitMinRange = is_real_number(this.crosshair.location.limitMinRange) ? this.crosshair.location.limitMinRange : 0;\r\n\t\tconst limitMaxRange = is_real_number(this.crosshair.location.limitMaxRange) ? this.crosshair.location.limitMaxRange : Infinity;\r\n\r\n\t\tlet finalLocation = mouseLocation;\r\n\t\tif (gridPath.cost < limitMinRange) {\r\n\t\t\tfinalLocation = canvas.grid.getTranslatedPoint(targetLocation, Math.toDegrees(ray.angle), limitMinRange);\r\n\t\t} else if (gridPath.cost > limitMaxRange) {\r\n\t\t\tfinalLocation = canvas.grid.getTranslatedPoint(targetLocation, Math.toDegrees(ray.angle), limitMaxRange);\r\n\t\t}\r\n\r\n\t\tconst snappedPosition = this.#getSnappedPoint(finalLocation);\r\n\t\tconst { direction, distance } = this.#getDraggedMatrix(targetLocation, snappedPosition);\r\n\r\n\t\treturn {\r\n\t\t\t...snappedPosition, direction, distance\r\n\t\t};\r\n\r\n\t}\r\n\r\n\t#updateLocation() {\r\n\r\n\t\tlet mouseLocation = get_mouse_position();\r\n\r\n\t\tmouseLocation.x += this.crosshair.location.offset.x ?? 0;\r\n\t\tmouseLocation.y += this.crosshair.location.offset.y ?? 0;\r\n\r\n\t\tlet update;\r\n\r\n\t\tif (this.crosshair.location.obj && (this.crosshair.location.lockToEdge || this.crosshair.location.limitMinRange || this.crosshair.location.limitMaxRange)) {\r\n\r\n\t\t\tconst location = this.crosshair.location.obj;\r\n\t\t\tconst targetLocation = {\r\n\t\t\t\tx: location?.center?.x ?? location?.position?.x ?? location?.x,\r\n\t\t\t\ty: location?.center?.y ?? location?.position?.y ?? location?.y\r\n\t\t\t};\r\n\r\n\t\t\tif (this.crosshair.location.lockToEdge) {\r\n\t\t\t\tupdate = this.#handleLockedEdge(mouseLocation);\r\n\t\t\t} else if (this.crosshair.location.limitMinRange || this.crosshair.location.limitMaxRange) {\r\n\t\t\t\tupdate = this.#handleLimit(mouseLocation, targetLocation);\r\n\t\t\t}\r\n\r\n\t\t} else if (this.#isDrag) {\r\n\t\t\tconst { direction, distance } = this.#getDraggedMatrix(this.document, mouseLocation);\r\n\t\t\tupdate = { distance, direction };\r\n\t\t} else {\r\n\t\t\tconst snappedPosition = this.#getSnappedPoint(mouseLocation);\r\n\t\t\tupdate = {\r\n\t\t\t\tx: snappedPosition.x, y: snappedPosition.y\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tconst isChanged = update?.x !== undefined && this.document.x !== update.x || update?.y !== undefined && this.document.y !== update.y || update?.direction !== undefined && this.document.direction !== update.direction || update?.distance !== undefined && this.document.distance !== update.distance;\r\n\r\n\t\tthis.document.updateSource(update);\r\n\r\n\t\treturn isChanged;\r\n\t}\r\n\r\n\t#getDistance(dragDistance) {\r\n\t\tif (this.crosshair.distanceMin === null && this.crosshair.distanceMax === null) {\r\n\t\t\treturn this.document.distance;\r\n\t\t}\r\n\t\tconst min = this.crosshair.distanceMin ?? this.document.originalConfig.distance;\r\n\t\tconst max = this.crosshair.distanceMax ?? this.document.originalConfig.distance;\r\n\t\treturn Math.min(Math.max(0.5, dragDistance, min), max);\r\n\t}\r\n\r\n\t#getDraggedMatrix(source, target) {\r\n\r\n\t\tconst dragAngle = (new foundry.canvas.geometry.Ray(source, target)).angle;\r\n\t\tconst dragDistance = canvas.grid.measurePath([source, target]);\r\n\r\n\t\tconst direction = this.crosshair.snap.direction\r\n\t\t\t? Math.round(Math.toDegrees(dragAngle) / this.crosshair.snap.direction) * this.crosshair.snap.direction\r\n\t\t\t: Math.toDegrees(dragAngle);\r\n\r\n\t\treturn {\r\n\t\t\tdirection: direction || 0,\r\n\t\t\tdistance: this.#getDistance(dragDistance.distance)\r\n\t\t};\r\n\r\n\t}\r\n\r\n\t#onMouseUp(evt) {\r\n\t\tconst event = evt?.nativeEvent ?? evt;\r\n\t\tif (!(event.which === 1 || event.which === 3)) return;\r\n\t\tif (this.#isDrag) {\r\n\t\t\tthis.#isDrag = false;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (this.#isPanning) {\r\n\t\t\tthis.#isPanning = false;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\treturn event.which === 1 ? this.#onConfirm() : this.#onCancel();\r\n\t}\r\n\r\n\t#onConfirm() {\r\n\t\tconst position = this.document.getOrientation();\r\n\t\tif (!this.isValid) {\r\n\t\t\tthis.#runCallback(CONSTANTS.CALLBACKS.INVALID_PLACEMENT, position);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst placedCallback = this.#runCallback(CONSTANTS.CALLBACKS.PLACED, position);\r\n\t\tif (placedCallback === false) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.cachedLocation = position;\r\n\t\tthis.#promise.resolve(this.document);\r\n\t\tthis.destroy();\r\n\t}\r\n\r\n\t#onCancel() {\r\n\t\tthis.#runCallback(CONSTANTS.CALLBACKS.CANCEL);\r\n\t\tthis.#promise.resolve(false);\r\n\t\tthis.destroy();\r\n\t}\r\n\r\n\t#runCallback(name, ...params) {\r\n\t\tif (!this.callbacks[name]) return;\r\n\t\treturn this.callbacks[name](...params);\r\n\t}\r\n\r\n\t#clearHandlers() {\r\n\t\tthis.layer.interactiveChildren = this.oldInteractiveChildren;\r\n\t\tcanvas.stage.off(\"mousemove\", this.#handlers.move);\r\n\t\tcanvas.stage.off(\"pointerup\", this.#handlers.mouseup);\r\n\t\tcanvas.app.view.removeEventListener(\"wheel\", this.#handlers.wheel);\r\n\t}\r\n\r\n\t#onWheel(evt) {\r\n\r\n\t\tif (!evt.altKey && !evt.ctrlKey && !evt.shiftKey) return;\r\n\r\n\t\tevt.stopPropagation();\r\n\r\n\t\tif (evt.shiftKey) this.#updateDirection(evt)\r\n\r\n\t\tif (evt.altKey) this.#updateDistance(evt);\r\n\r\n\t\tif (evt.ctrlKey) {\r\n\t\t\t// TODO widen\r\n\t\t}\r\n\r\n\t\tthis.refresh();\r\n\t}\r\n\r\n\t#updateDistance(evt) {\r\n\t\tconst step = (this.document.parent.grid.distance / 2);\r\n\t\tconst delta = step * Math.sign(-evt.deltaY);\r\n\t\tlet distance = this.document.distance + delta;\r\n\t\tdistance = Math.max(0.5, distance.toNearest(step));\r\n\t\tdistance = this.#getDistance(distance)\r\n\t\tthis.document.updateSource({ distance });\r\n\t}\r\n\r\n\t#updateDirection(evt) {\r\n\t\tif (this.crosshair.lockManualRotation) return;\r\n\t\tconst scrollDelta = Math.sign(evt.deltaY);\r\n\t\tlet delta = this.crosshair.snap.direction ? this.crosshair.snap.direction * scrollDelta : scrollDelta * 5;\r\n\t\tif (delta < 0) delta += 360;\r\n\t\tif (delta > 360) delta -= 360;\r\n\t\tconst direction = Math.max(1, this.document.direction + delta);\r\n\t\tthis.document.updateSource({ direction });\r\n\t}\r\n\r\n\t/** @override */\r\n\t_getGridHighlightPositions() {\r\n\t\tif (!this.crosshair.gridHighlight) return [];\r\n\t\treturn super._getGridHighlightPositions();\r\n\t}\r\n\r\n\t/** @override */\r\n\t_destroy(options = {}) {\r\n\t\tsuper._destroy(options);\r\n\t\tif(this.#rangeHighlight) this.#rangeHighlight.destroy();\r\n\t\tthis.#clearHandlers();\r\n\t}\r\n\r\n\t/** @override */\r\n\tasync draw() {\r\n\t\tawait super.draw();\r\n\t\tthis.#refreshIcon();\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * The only difference between here and `super` is that this passes along an alpha\r\n\t * @override\r\n\t */\r\n\thighlightGrid() {\r\n\t\t// Clear the existing highlight layer\r\n\t\tcanvas.interface.grid.clearHighlightLayer(this.highlightId);\r\n  \r\n\t\t// Highlight colors\r\n\t\tconst border = this.document.borderColor;\r\n\t\tconst color = this.document.fillColor;\r\n\t\tconst alpha = this.crosshair.fillAlpha;\r\n  \r\n\t\t// If we are in grid-less mode, highlight the shape directly\r\n\t\tif ( canvas.grid.type === CONST.GRID_TYPES.GRIDLESS ) {\r\n\t\t\tconst shape = this._getGridHighlightShape();\r\n\t\t\tcanvas.interface.grid.highlightPosition(this.highlightId, {border, color, alpha, shape});\r\n\t\t}\r\n\r\n\t\t// Otherwise, highlight specific grid positions\r\n\t\telse {\r\n\t\t\tconst positions = this._getGridHighlightPositions();\r\n\t\t\tfor ( const {x, y} of positions ) {\r\n\t\t\t\tcanvas.interface.grid.highlightPosition(this.highlightId, {x, y, border, color, alpha});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n","class Plugin {\r\n\r\n\tconstructor(name) {\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n\t/**\r\n\t * The effect's source location, eg the target of `.atLocation()` or `.attachTo()`\r\n\t *\r\n\t * @param effect\r\n\t * @param position\r\n\t * @returns {*}\r\n\t */\r\n\tsourcePosition({ effect, position }={}) {\r\n\t\treturn position;\r\n\t}\r\n\r\n\r\n\t/**\r\n\t * The effect's source location, eg the target of `.stretchTo()` or `.rotateTowards()`\r\n\t *\r\n\t * @param effect\r\n\t * @param position\r\n\t * @returns {*}\r\n\t */\r\n\ttargetPosition({ effect, position }={}) {\r\n\t\treturn position;\r\n\t}\r\n\r\n\t/**\r\n\t * The effect's rotation calculation\r\n\t *\r\n\t * @param effect\r\n\t */\r\n\trotation({ effect }={}) { }\r\n\r\n\t/**\r\n\t * The effect's elevation calculation\r\n\t *\r\n\t * @param effect\r\n\t * @param sort\r\n\t * @returns Number\r\n\t */\r\n\televation({ effect, sort }={}) {\r\n\t\treturn sort;\r\n\t}\r\n\r\n\tcreateSpriteContainers({ effect, container }={}) {\r\n\t\treturn container;\r\n\t}\r\n\r\n\t/**\r\n\t * makes changes to the effect upon creation\r\n\t *\r\n\t * @param effect\r\n\t */\r\n\tcreateSprite({ effect }={}) { }\r\n\r\n\t/**\r\n\t * Allows you to make changes to the effect's mask, if used\r\n\t *\r\n\t * @param effect\r\n\t * @param doc\r\n\t * @param obj\r\n\t * @param shape\r\n\t * @returns {*}\r\n\t */\r\n\tmasking({ effect, doc, obj, shape }={}) {\r\n\t\treturn shape\r\n\t}\r\n\r\n\t/**\r\n\t * Which hooks should refresh the masking of the effect\r\n\t *\r\n\t * @returns {*[]}\r\n\t */\r\n\tget maskingHooks() {\r\n\t\treturn [];\r\n\t}\r\n}\r\n\r\nclass GrapeJuiceIsometrics extends Plugin {\r\n\r\n\tisIsometricActive(effect) {\r\n\t\treturn !(effect.data.screenSpace || effect.data.screenSpaceAboveUI) && foundry.utils.getProperty(\r\n\t\t\tgame.scenes.get(effect.data.sceneId),\r\n\t\t\t`flags.${this.name}.is_isometric`\r\n\t\t)\r\n\t}\r\n\r\n\tsourcePosition({ effect, position, height }={}) {\r\n\r\n\t\tif (this.isIsometricActive(effect) && effect.source instanceof PlaceableObject) {\r\n\t\t\tconst elevation = ((effect.sourceDocument.elevation ?? 0) / canvas.scene.grid.distance) * canvas.grid.size;\r\n\t\t\tposition.x += elevation;\r\n\t\t\tposition.y -= elevation;\r\n\t\t\tif (\r\n\t\t\t\teffect.data.isometric?.overlay ||\r\n\t\t\t\teffect.target instanceof PlaceableObject\r\n\t\t\t) {\r\n\t\t\t\tposition.x += height / 2;\r\n\t\t\t\tposition.y -= height / 2;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn position;\r\n\r\n\t}\r\n\r\n\ttargetPosition({ effect, position, height }={}) {\r\n\r\n\t\tif (this.isIsometricActive(effect) && effect.target instanceof PlaceableObject) {\r\n\t\t\tconst targetHeight = height / 2;\r\n\t\t\tconst elevation = ((effect.targetDocument.elevation ?? 0) / canvas.scene.grid.distance) * canvas.grid.size;\r\n\t\t\tposition.x += elevation + targetHeight;\r\n\t\t\tposition.y -= elevation + targetHeight;\r\n\t\t}\r\n\r\n\t\treturn position;\r\n\r\n\t}\r\n\r\n\trotation({ effect }={}) {\r\n\r\n\t\tif (effect.data.stretchTo) {\r\n\t\t\tlet skew = Math.normalizeRadians(\r\n\t\t\t\teffect.rotationContainer.rotation - Math.PI / 4\r\n\t\t\t);\r\n\r\n\t\t\tif (\r\n\t\t\t\tMath.abs(skew) >= Math.PI / 2 - 0.5 &&\r\n\t\t\t\tMath.abs(skew) <= Math.PI / 2 + 0.5\r\n\t\t\t) {\r\n\t\t\t\tskew -= Math.PI / 2;\r\n\t\t\t}\r\n\r\n\t\t\teffect.isometricContainer.skew.set(Math.normalizeRadians(skew), 0);\r\n\t\t\teffect.isometricContainer.rotation = 0;\r\n\t\t} else if (effect.data?.isometric?.overlay) {\r\n\t\t\teffect.rotationContainer.rotation = 0;\r\n\t\t\tlet skew = Math.PI / 4 + effect.rotationContainer.rotation;\r\n\t\t\teffect.isometricContainer.skew.set(\r\n\t\t\t\tMath.normalizeRadians(skew - Math.PI / 4),\r\n\t\t\t\t0\r\n\t\t\t);\r\n\t\t\teffect.isometricContainer.scale.set(\r\n\t\t\t\t1.0,\r\n\t\t\t\twindow.scale ?? Math.sqrt(3)\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t}\r\n\r\n\televation({ effect, sort }={}) {\r\n\r\n\t\tif (this.isIsometricActive(effect)) {\r\n\t\t\tconst sourceSort = effect.source\r\n\t\t\t\t? (effect.sourceMesh?.sort ?? 0) + (effect.data.isometric?.overlay ? 1 : -1)\r\n\t\t\t\t: 0;\r\n\t\t\tconst targetSort = effect.target\r\n\t\t\t\t? (effect.targetMesh?.sort ?? 0) + (effect.data.isometric?.overlay ? 1 : -1)\r\n\t\t\t\t: 0;\r\n\t\t\tsort = Math.max(sourceSort, targetSort);\r\n\t\t}\r\n\r\n\t\treturn sort;\r\n\t}\r\n\r\n\tcreateSpriteContainers({ effect, container }={}) {\r\n\t\teffect.isometricContainer = container.addChild(\r\n\t\t\tnew PIXI.Container()\r\n\t\t);\r\n\t\teffect.isometricContainer.id = effect.id + \"-isometricContainer\";\r\n\t\treturn effect.isometricContainer;\r\n\t}\r\n\r\n\tcreateSprite({ effect }={}) {\r\n\t\tif (this.isIsometricActive(effect)) {\r\n\t\t\teffect.isometricContainer.rotation = Math.PI / 4;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nclass IsometricPerspective extends GrapeJuiceIsometrics {\r\n\tisIsometricActive(effect) {\r\n\t\treturn !(effect.data.screenSpace || effect.data.screenSpaceAboveUI) && foundry.utils.getProperty(\r\n\t\t\tgame.scenes.get(effect.data.sceneId),\r\n\t\t\t`flags.${this.name}.isometricEnabled`\r\n\t\t)\r\n\t}\r\n}\r\n\r\nclass WalledTemplates extends Plugin {\r\n\tmasking({ effect, doc, obj, shape }={}) {\r\n\t\tif (\r\n\t\t\tobj.walledtemplates?.walledTemplate\r\n\t\t) {\r\n\t\t\tlet wt = obj.walledtemplates.walledTemplate;\r\n\t\t\twt.options.padding = 3 * canvas.dimensions.distancePixels;\r\n\t\t\tshape = wt.computeShape();\r\n\t\t\twt.options.padding = 0;\r\n\t\t}\r\n\t\treturn shape\r\n\t}\r\n\r\n\tget maskingHooks() {\r\n\t\treturn [\"createWall\", \"updateWall\", \"deleteWall\"];\r\n\t}\r\n}\r\n\r\nclass PluginsManager {\r\n\tstatic modules = {\r\n\t\t\"grape_juice-isometrics\": GrapeJuiceIsometrics,\r\n\t\t\"isometric-perspective\": IsometricPerspective,\r\n\t\t\"walledtemplates\": WalledTemplates,\r\n\t}\r\n\tstatic plugins = [];\r\n\r\n\tstatic initialize() {\r\n\t\tfor(const [module, pluginClass] of Object.entries(this.modules)){\r\n\t\t\tif(!game.modules.get(module)?.active) continue;\r\n\t\t\tthis.plugins.push(new pluginClass(module));\r\n\t\t}\r\n\t}\r\n\r\n\tstatic sourcePosition({ effect, position, height }={}) {\r\n\t\tfor(const plugin of this.plugins){\r\n\t\t\tposition = plugin.sourcePosition({ effect, position, height })\r\n\t\t}\r\n\t\treturn position;\r\n\t}\r\n\r\n\tstatic targetPosition({ effect, position, height }={}) {\r\n\t\tfor(const plugin of this.plugins){\r\n\t\t\tposition = plugin.targetPosition({ effect, position, height })\r\n\t\t}\r\n\t\treturn position;\r\n\t}\r\n\r\n\tstatic rotation({ effect }={}) {\r\n\t\tfor(const plugin of this.plugins){\r\n\t\t\tplugin.rotation({ effect })\r\n\t\t}\r\n\t}\r\n\r\n\tstatic elevation({ effect, sort }={}) {\r\n\t\tfor(const plugin of this.plugins){\r\n\t\t\tsort = plugin.elevation({ effect, sort })\r\n\t\t}\r\n\t\treturn sort;\r\n\t}\r\n\r\n\tstatic createSpriteContainers({ effect, container }={}){\r\n\t\tfor(const plugin of this.plugins){\r\n\t\t\tcontainer = plugin.createSpriteContainers({ effect, container });\r\n\t\t}\r\n\t\treturn container\r\n\t}\r\n\r\n\tstatic createSprite({ effect }={}) {\r\n\t\tfor(const plugin of this.plugins){\r\n\t\t\tplugin.createSprite({ effect })\r\n\t\t}\r\n\t}\r\n\r\n\tstatic masking({ effect, doc, obj, shape }={}) {\r\n\t\tfor(const plugin of this.plugins){\r\n\t\t\tshape = plugin.masking({ effect, doc, obj, shape })\r\n\t\t}\r\n\t\treturn shape;\r\n\t}\r\n\r\n\tstatic get maskingHooks() {\r\n\t\tlet hooks = [];\r\n\t\tfor(const plugin of this.plugins){\r\n\t\t\thooks = hooks.concat(plugin.maskingHooks)\r\n\t\t}\r\n\t\treturn hooks;\r\n\t}\r\n}\r\n\r\n\r\nexport default PluginsManager;","import CONSTANTS from \"../constants.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport filters from \"../lib/filters.js\";\nimport MaskFilter from \"../lib/filters/mask-filter.js\";\nimport * as lib from \"../lib/lib.js\";\nimport SequencerAnimationEngine from \"../modules/sequencer-animation-engine.js\";\nimport SequencerEffectManager from \"../modules/sequencer-effect-manager.js\";\nimport { SequencerFileBase } from \"../modules/sequencer-file.js\";\nimport { sequencerSocket, SOCKET_HANDLERS } from \"../sockets.js\";\nimport flagManager from \"../utils/flag-manager.js\";\nimport { SequencerAboveUILayer } from \"./effects-layer.js\";\nimport { SequencerSpriteManager } from \"./sequencer-sprite-manager.js\";\nimport CrosshairsPlaceable from \"../modules/sequencer-crosshair/CrosshairsPlaceable.js\";\nimport PluginsManager from \"../utils/plugins-manager.js\";\n\nconst hooksManager = {\n\t_byHook: new Map(),\n\t_hooksRegistered: new Set(),\n\n\taddHook(effectUuid, hookName, callable, { effect = null, callNow = false } = {}) {\n\t\tif (!this._hooksRegistered.has(hookName)) {\n\t\t\tlib.debug(\"registering hook for: \" + hookName);\n\t\t\tthis._hooksRegistered.add(hookName);\n\t\t\tHooks.on(hookName, (...args) => {\n\t\t\t\tthis._hookCalled(hookName, ...args);\n\t\t\t});\n\t\t}\n\n\t\tlet perHook = this._byHook.get(hookName);\n\t\tif (!perHook) {\n\t\t\tperHook = new Map();\n\t\t\tthis._byHook.set(hookName, perHook);\n\t\t}\n\t\tlet callbacks = perHook.get(effectUuid);\n\t\tif (!callbacks) {\n\t\t\tcallbacks = [];\n\t\t\tperHook.set(effectUuid, callbacks);\n\t\t}\n\t\tcallbacks.push(callable);\n\n\t\tif (callNow) {\n\t\t\tif (effect?._setTimeout) effect._setTimeout(callable, 20);\n\t\t\telse setTimeout(callable, 20);\n\t\t}\n\t},\n\n\t_hookCalled(hookName, ...args) {\n\t\tconst perHook = this._byHook.get(hookName);\n\t\tif (!perHook) return;\n\t\tfor (const callbacks of perHook.values()) {\n\t\t\tfor (let i = 0; i < callbacks.length; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tcallbacks[i](...args);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`Sequencer | hook handler for \"${hookName}\" threw:`, err);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tremoveHooks(effectUuid) {\n\t\tfor (const perHook of this._byHook.values()) {\n\t\t\tperHook.delete(effectUuid);\n\t\t}\n\t},\n};\n\nconst SyncGroups = {\n\ttimes: new Map(),\n\teffectIds: new Map(),\n\n\tget(effect) {\n\t\tconst fullName = effect.data.sceneId + \"-\" + effect.data.syncGroup;\n\t\tconst effectIds = new Set(this.effectIds.get(fullName));\n\t\tif (effectIds && !effectIds.has(effect.id)) {\n\t\t\teffectIds.add(effect.id);\n\t\t\tthis.effectIds.set(fullName, Array.from(effectIds));\n\t\t}\n\t\treturn this.times.get(fullName);\n\t},\n\n\tset(effect) {\n\t\tconst fullName = effect.data.sceneId + \"-\" + effect.data.syncGroup;\n\t\tthis.times.set(fullName, effect.data.creationTimestamp);\n\t\tthis.effectIds.set(fullName, [effect.id]);\n\t},\n\n\tremove(effect) {\n\t\tconst fullName = effect.data.sceneId + \"-\" + effect.data.syncGroup;\n\t\tconst effectIds = new Set(this.effectIds.get(fullName));\n\t\teffectIds.delete(effect.id);\n\t\tif (effectIds.size) {\n\t\t\tthis.effectIds.set(fullName, Array.from(effectIds));\n\t\t} else {\n\t\t\tthis.effectIds.delete(fullName);\n\t\t\tthis.times.delete(fullName);\n\t\t}\n\t}\n};\n\n/**\n * Whether the document shows on the viewed level, including via\n * cross-visibility. Foundry's `Token.includedInLevel` already follows\n * cross-visibility, but the generic `CanvasDocument.includedInLevel`\n * used by Region, Tile, Drawing, etc. does not, so we walk the viewed\n * level's `visibility.levels` against the document's level set ourselves.\n *\n * @param {foundry.abstract.Document|null|undefined} doc\n * @param {foundry.documents.Level|null|undefined} viewedLevel\n * @returns {boolean}\n */\nfunction isDocOnViewedLevel(doc, viewedLevel) {\n\tif (!doc || !viewedLevel) return false;\n\tif (doc.includedInLevel?.(viewedLevel.id) === true) return true;\n\tconst cross = viewedLevel.visibility?.levels;\n\tif (!cross?.size) return false;\n\tif (doc.levels?.size) {\n\t\tfor (const id of doc.levels) {\n\t\t\tif (cross.has(id)) return true;\n\t\t}\n\t} else if (typeof doc.level === \"string\") {\n\t\tif (cross.has(doc.level)) return true;\n\t}\n\treturn false;\n}\n\n/**\n * Whether an attached effect's source/target placeable should let the\n * effect render. Only Tokens are gated on visibility, since their\n * `isVisible` reflects per-perception culling and line of sight; other\n * placeables (Region, Tile, Drawing, Note) have `isVisible` getters\n * that return false for permission and layer-state reasons unrelated\n * to whether the placeable is rendered.\n *\n * @param {foundry.canvas.placeables.PlaceableObject|null|undefined} placeable\n * @returns {boolean}\n */\nfunction isAttachedPlaceableVisible(placeable) {\n\tif (!placeable) return false;\n\tconst Token = foundry.canvas.placeables.Token;\n\tif (!(placeable instanceof Token)) return true;\n\treturn placeable.isVisible !== false;\n}\n\n/**\n * Whether the given scene position is hidden from the viewed level by a\n * `defineSurface` Region with `culling: true`. Mirrors what Foundry's\n * `Token#testCulled` does, generalised to an arbitrary `(x, y)` and\n * elevation range.\n *\n * @param {foundry.documents.Scene} scene\n * @param {foundry.documents.Level} viewedLevel\n * @param {number} x\n * @param {number} y\n * @param {number} zMin\n * @param {number} zMax\n * @returns {boolean}\n */\nfunction isPositionCulled(scene, viewedLevel, x, y, zMin, zMax) {\n\tconst { bottom, top } = viewedLevel.elevation;\n\tlet lo, hi;\n\tif (zMax < bottom) {\n\t\tlo = Math.nextUp(zMax);\n\t\thi = bottom;\n\t} else if (zMin >= top) {\n\t\tlo = top;\n\t\thi = zMin;\n\t} else {\n\t\treturn false;\n\t}\n\tconst probe = { x, y };\n\tfor (const surface of scene.getSurfaces({ culling: true, level: viewedLevel })) {\n\t\tif (surface.elevation > hi) break;\n\t\tif (surface.elevation < lo) continue;\n\t\tif (surface.region.polygonTree.testPoint(probe)) return true;\n\t}\n\treturn false;\n}\n\n/**\n * Does an effect's vertical extent `[a0, a1]` overlap a Level's\n * elevation range `[b0, b1]`? Bottoms always count as part of their\n * interval. The effect's top counts when `aTopInclusive` is set,\n * matching Foundry Region `elevation.topInclusive`. The level's top is\n * never inclusive: adjacent levels share that boundary, and it belongs\n * to the upper level.\n *\n * @returns {boolean}\n */\nfunction intervalsOverlap(a0, a1, b0, b1, aTopInclusive = false) {\n\tconst aIsRange = a0 < a1;\n\tconst bIsRange = b0 < b1;\n\tconst lo = Math.max(a0, b0);\n\tconst hi = Math.min(a1, b1);\n\tif (lo > hi) return false;\n\tif (lo < hi) return true;\n\tif (bIsRange && (hi === b1)) return false;\n\tif (aIsRange && (hi === a1)) return aTopInclusive;\n\treturn true;\n}\n\nexport default class CanvasEffect extends PIXI.Container {\n\t#elevation = 0;\n\t#sort = 0;\n\t#sortLayer = 800\n\n\tconstructor(inData) {\n\t\tsuper();\n\n\t\tthis.sortableChildren = true;\n\t\tthis.interactiveChildren = false;\n\n\t\t// Set default values\n\t\tthis.actualCreationTime = +new Date();\n\t\tthis.data = inData;\n\n\t\tthis._resolve = null;\n\t\tthis._durationResolve = null;\n\n\t\tthis.ready = false;\n\t\tthis._ended = false;\n\t\tthis._isEnding = false;\n\n\t\tthis._cachedSourceData = {};\n\t\tthis._cachedTargetData = {};\n\n\t\tthis.uuid = false;\n\n\t}\n\n\tstatic get protectedValues() {\n\t\treturn [\n\t\t\t\"_id\",\n\t\t\t\"sequenceId\",\n\t\t\t\"creationTimestamp\",\n\t\t\t\"creatorUserId\",\n\t\t\t\"moduleName\",\n\t\t\t\"index\",\n\t\t\t\"repetition\",\n\t\t\t\"moves\",\n\t\t\t\"fadeIn\",\n\t\t\t\"fadeOut\",\n\t\t\t\"scaleIn\",\n\t\t\t\"scaleOut\",\n\t\t\t\"rotateIn\",\n\t\t\t\"rotateOut\",\n\t\t\t\"fadeInAudio\",\n\t\t\t\"fadeOutAudio\",\n\t\t\t\"animations\",\n\t\t\t\"nameOffsetMap\",\n\t\t\t\"persist\",\n\t\t];\n\t}\n\n\t/** @type {number} */\n\tget elevation() {\n\t\treturn this.#elevation;\n\t}\n\n\tset elevation(value) {\n\t\tthis.#elevation = value;\n\t}\n\n\t/** @type {number} */\n\tget sort() {\n\t\treturn this.#sort;\n\t}\n\n\tset sort(value) {\n\t\tthis.#sort = value;\n\t}\n\n\t/** @type {number} */\n\tget sortLayer() {\n\t\treturn this.#sortLayer;\n\t}\n\n\tset sortLayer(value) {\n\t\tthis.#sortLayer = value;\n\t}\n\n\tget context() {\n\t\treturn this.data.attachTo?.active && this.sourceDocument\n\t\t\t? this.sourceDocument\n\t\t\t: game.scenes.get(this.data.sceneId);\n\t}\n\n\tget creationTimestamp() {\n\t\tif (this.data.syncGroup) {\n\t\t\tconst time = SyncGroups.get(this);\n\t\t\tif (time) return time;\n\t\t\tSyncGroups.set(this)\n\t\t}\n\t\treturn this.data.creationTimestamp;\n\t}\n\n\t/**\n\t * The ID of the effect\n\t *\n\t * @returns {string}\n\t */\n\tget id() {\n\t\treturn this.data._id;\n\t}\n\n\t/**\n\t * Whether this effect is destroyed or is in the process of being destroyed\n\t */\n\tget isDestroyed() {\n\t\treturn (\n\t\t\tthis.destroyed ||\n\t\t\t(this.source && this.isSourceDestroyed) ||\n\t\t\t(this.target && this.isTargetDestroyed)\n\t\t);\n\t}\n\n\t/**\n\t * Whether the source of this effect is temporary\n\t *\n\t * @returns {boolean}\n\t */\n\tget isSourceTemporary() {\n\t\treturn (\n\t\t\tthis.data.attachTo?.active &&\n\t\t\tthis.sourceDocument &&\n\t\t\t!lib.is_UUID(this.sourceDocument?.uuid)\n\t\t);\n\t}\n\n\t/**\n\t * Whether the source of this effect has been destroyed\n\t *\n\t * @returns {boolean}\n\t */\n\tget isSourceDestroyed() {\n\t\treturn (\n\t\t\tthis.source && this.source?.destroyed && (!this.sourceDocument?.object || this.sourceDocument?.object?.destroyed || this.source.constructor.name === \"Crosshairs\")\n\t\t);\n\t}\n\n\t/**\n\t * Whether the target of this effect is temporary\n\t *\n\t * @returns {boolean}\n\t */\n\tget isTargetTemporary() {\n\t\treturn (\n\t\t\t(this.data.stretchTo?.attachTo || this.data.rotateTowards?.attachTo) &&\n\t\t\tthis.targetDocument &&\n\t\t\t!lib.is_UUID(this.targetDocument.uuid)\n\t\t);\n\t}\n\n\t/**\n\t * Whether the target of this effect has been destroyed\n\t *\n\t * @returns {boolean}\n\t */\n\tget isTargetDestroyed() {\n\t\treturn (\n\t\t\tthis.target && this.target?.destroyed && (!this.targetDocument?.object || this.targetDocument?.object?.destroyed || this.target.constructor.name === \"Crosshairs\")\n\t\t);\n\t}\n\n\t/**\n\t * The source object (or source location) of the effect\n\t *\n\t * @returns {boolean|object}\n\t */\n\tget source() {\n\t\tif (!this._source && this.data.source) {\n\t\t\tconst getDifferentTarget = this.data.source === this.data.target;\n\t\t\tthis._source = this._getObjectByID(this.data.source?.uuid ?? this.data.source, getDifferentTarget, true) ?? this.data.source;\n\t\t\tthis._source = this._source?._object ?? this._source;\n\t\t}\n\t\treturn this._source;\n\t}\n\n\t/**\n\t * Retrieves the source document\n\t *\n\t * @returns {Document|foundry.canvas.placeables.PlaceableObject}\n\t */\n\tget sourceDocument() {\n\t\treturn this.source?.document ?? this.source;\n\t}\n\n\t/**\n\t * Retrieves the PIXI object for the source object\n\t *\n\t * @returns {*|PIXI.Sprite|TileHUD<Application.Options>}\n\t */\n\tget sourceMesh() {\n\t\treturn this.source?.mesh ?? this.source?.template;\n\t}\n\n\t/**\n\t * The source position with the relevant offsets calculated\n\t *\n\t * @returns {{x: number, y: number}}\n\t */\n\tget sourcePosition() {\n\t\treturn this._resolveSourcePosition(this.getSourceData());\n\t}\n\n\t_resolveSourcePosition(sourceData) {\n\t\tconst position = sourceData.position;\n\t\tconst offset = this._getOffset(this.data.source, true);\n\n\t\tif (this.data.attachTo?.active && this.data.attachTo?.align && this.data.attachTo?.align !== \"center\") {\n\t\t\tconst additionalOffset = canvaslib.align({\n\t\t\t\tcontext: this.source,\n\t\t\t\tspriteWidth: this.sprite.width,\n\t\t\t\tspriteHeight: this.sprite.height,\n\t\t\t\talign: this.data.attachTo?.align,\n\t\t\t\tedge: this.data.attachTo?.edge,\n\t\t\t});\n\n\t\t\toffset.x += additionalOffset.x;\n\t\t\toffset.y += additionalOffset.y;\n\t\t}\n\n\t\treturn {\n\t\t\tx: (position.x - offset.x),\n\t\t\ty: (position.y - offset.y),\n\t\t};\n\t}\n\n\t/**\n\t * The target object (or target location) of the effect\n\t *\n\t * @returns {boolean|object}\n\t */\n\tget target() {\n\t\tif (!this._target && this.data.target) {\n\t\t\tconst getDifferentTarget = this.data.source === this.data.target;\n\t\t\tthis._target = this._getObjectByID(this.data.target?.uuid ?? this.data.target, getDifferentTarget, false) ?? this.data.target;\n\t\t\tthis._target = this._target?._object ?? this._target;\n\t\t}\n\t\treturn this._target;\n\t}\n\n\t/**\n\t * Retrieves the document of the target\n\t *\n\t * @returns {Document|foundry.canvas.placeables.PlaceableObject}\n\t */\n\tget targetDocument() {\n\t\treturn this.target?.document ?? this.target;\n\t}\n\n\t/**\n\t * Retrieves the PIXI object for the target object\n\t *\n\t * @returns {*|PIXI.Sprite|TileHUD<Application.Options>}\n\t */\n\tget targetMesh() {\n\t\treturn this.target?.mesh ?? this.target?.template;\n\t}\n\n\t/**\n\t * The target position with the relevant offsets calculated\n\t *\n\t * @returns {{x: number, y: number}}\n\t */\n\tget targetPosition() {\n\t\tconst position = this.getTargetData().position;\n\t\tconst offset = this._getOffset(this.data.target);\n\n\t\treturn {\n\t\t\tx: (position.x - offset.x),\n\t\t\ty: (position.y - offset.y),\n\t\t};\n\t}\n\n\t/**\n\t * Returns this effect's world position\n\t *\n\t * @returns {{x: number, y: number}}\n\t */\n\tget worldPosition() {\n\t\tconst t = canvas.stage.worldTransform;\n\t\treturn {\n\t\t\tx: (this.sprite.worldTransform.tx - t.tx) / canvas.stage.scale.x,\n\t\t\ty: (this.sprite.worldTransform.ty - t.ty) / canvas.stage.scale.y,\n\t\t};\n\t}\n\n\t/**\n\t * Whether the current user is the owner of this effect\n\t *\n\t * @returns {boolean}\n\t */\n\tget owner() {\n\t\treturn this.data.creatorUserId === game.user.id;\n\t}\n\n\tget loopDelay() {\n\t\treturn (this.data.loopOptions?.loopDelay ?? 0);\n\t}\n\n\tget loops() {\n\t\treturn (this.data.loopOptions?.loops ?? 0);\n\t}\n\n\t/**\n\t * Whether the current user can update this effect\n\t *\n\t * @returns {boolean}\n\t */\n\tget userCanUpdate() {\n\t\treturn (\n\t\t\tgame.user.isGM ||\n\t\t\tthis.owner ||\n\t\t\t(this.data.attachTo?.active &&\n\t\t\t\t!!this.sourceDocument?.canUserModify?.(game.user, \"update\"))\n\t\t);\n\t}\n\n\t/**\n\t * Whether the current user can delete this effect\n\t *\n\t * @returns {boolean}\n\t */\n\tget userCanDelete() {\n\t\treturn this.userCanUpdate || lib.user_can_do(\"permissions-effect-delete\");\n\t}\n\n\t/**\n\t * Whether this effect is on the current scene\n\t *\n\t * @returns {boolean}\n\t */\n\tget onCurrentScene() {\n\t\treturn this.data.sceneId === game.user.viewedScene;\n\t}\n\n\t/**\n\t * Whether this effect should be shown as faded or not - effects created by users for other users should be shown\n\t * for all\n\t *\n\t * @returns {boolean}\n\t */\n\tget shouldShowFadedVersion() {\n\t\t// If the user has not set the opacity user-specific effects to 0\n\t\t// And it is not an effect that is only played for the user who created the effect\n\t\t// And if the effect is going to be played for a subset of users\n\t\t// And the users does not contain this user\n\t\treturn (\n\t\t\tthis.data.users &&\n\t\t\tthis.data.users.length &&\n\t\t\t!(\n\t\t\t\tthis.data.users.length === 1 &&\n\t\t\t\tthis.data.users.includes(this.data.creatorUserId)\n\t\t\t) &&\n\t\t\t!this.data.users.includes(game.userId)\n\t\t);\n\t}\n\n\tset effectAlpha(value) {\n\t\tif (this.sprite) {\n\t\t\tthis.sprite.alpha = value\n\t\t}\n\t\tif (this.shapes) {\n\t\t\tObject.values(this.shapes).forEach(shape => {\n\t\t\t\tshape.alpha = value\n\t\t\t})\n\t\t}\n\t}\n\n\tget effectAlpha() {\n\t\treturn this.sprite?.alpha\n\t}\n\n\tasync playMedia() {\n\t\tif (this.destroyed || this._ended || this._isEnding || !this.sprite) {\n\t\t\treturn\n\t\t}\n\t\tawait this.sprite.play()\n\t\tthis._setupTimestampHook(this.mediaCurrentTime * 1000);\n\t}\n\n\tupdateTexture() {\n\t\tthis.sprite?.updateVideoTextures()\n\t}\n\n\tasync pauseMedia() {\n\t\tthis.sprite?.stop()\n\t}\n\n\tget mediaLooping() {\n\t\treturn !!this.sprite?.loop\n\t}\n\n\tset mediaLooping(looping) {\n\t\tif (!this.sprite) return;\n\t\tthis.sprite.loop = looping;\n\t}\n\n\tget mediaIsPlaying() {\n\t\treturn !!this.sprite?.playing\n\t}\n\n\tget mediaCurrentTime() {\n\t\treturn this.sprite?.currentTime ?? 0\n\t}\n\n\tget mediaPlaybackRate() {\n\t\treturn this.sprite?.playbackRate ?? 1\n\t}\n\n\tset mediaPlaybackRate(inPlaybackRate) {\n\t\tif (!this.sprite) return;\n\t\t// Playbackrate for spritesheets is now handled by timing info in the animation sequence\n\t\tthis.sprite.playbackRate = inPlaybackRate;\n\t}\n\n\tset mediaCurrentTime(newTime) {\n\t\tif (!this.sprite) return;\n\t\tthis.sprite.currentTime = newTime;\n\t}\n\n\tget mediaDuration() {\n\t\treturn this.sprite?.duration ?? 0\n\t}\n\n\tget mediaDurationMs() {\n\t\treturn this.mediaDuration * 1000\n\t}\n\n\tget hasAnimatedMedia() {\n\t\treturn !!this.sprite?.hasAnimatedMedia\n\t}\n\n\t/**\n\t * The template of the effect, determining the effect's internal grid size, and start/end padding\n\t *\n\t * @returns {object}\n\t */\n\tget template() {\n\t\treturn this._template\n\t}\n\n\t/**\n\t * 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\t *\n\t * @returns {number}\n\t */\n\tget gridSizeDifference() {\n\t\treturn canvas.grid.size / (this.template?.gridSize ?? this.defaultGridSize);\n\t}\n\n\tget defaultGridSize() {\n\t\treturn 100\n\t}\n\n\t/**\n\t * Whether the effect should be flipped on any given axis\n\t *\n\t * @returns {number}\n\t */\n\tget flipX() {\n\t\tconst offsetMap = this._nameOffsetMap?.[this.data.source];\n\t\tlet flip = this.data.flipX ? -1 : 1\n\t\tif (offsetMap && offsetMap.mirrorX !== undefined) {\n\t\t\tflip *= offsetMap.mirrorX ? -1 : 1;\n\t\t}\n\t\treturn flip;\n\t}\n\n\tget flipY() {\n\t\tconst offsetMap = this._nameOffsetMap?.[this.data.source];\n\t\tlet flip = this.data.flipY ? -1 : 1\n\t\tif (offsetMap && offsetMap.mirrorY !== undefined) {\n\t\t\tflip *= offsetMap.mirrorY ? -1 : 1;\n\t\t}\n\t\treturn flip;\n\t}\n\n\t/**\n\t * Whether this effect should play at all, depending on a multitude of factors\n\t *\n\t * @returns {boolean}\n\t */\n\tget shouldPlay() {\n\t\treturn (\n\t\t\t(game.user.viewedScene === this.data.sceneId || this.data.creatorUserId === game.userId)\n\t\t\t&&\n\t\t\t(game.user.isGM || !this.data.users || this.data.users.length === 0 || this.data.users.includes(game.userId))\n\t\t\t&&\n\t\t\t(!this.data.local || this.data.creatorUserId === game.user.id)\n\t\t);\n\t}\n\n\tget shouldPlayVisible() {\n\t\tlet playVisible =\n\t\t\tthis.shouldPlay &&\n\t\t\tgame.settings.get(\"sequencer\", \"effectsEnabled\") &&\n\t\t\tgame.user.viewedScene === this.data.sceneId;\n\n\t\tif (game.settings.get(\"core\", \"photosensitiveMode\")) {\n\t\t\tplayVisible = false;\n\t\t\tlib.throttled_custom_warning(\n\t\t\t\tthis.data.moduleName,\n\t\t\t\t\"Photosensitive Mode is turned on, so Sequencer's visual effects aren't being rendered\"\n\t\t\t);\n\t\t}\n\n\t\treturn playVisible;\n\t}\n\n\tstatic make(inData) {\n\t\treturn !inData.persist\n\t\t\t? new CanvasEffect(inData)\n\t\t\t: new PersistentCanvasEffect(inData);\n\t}\n\n\tstatic checkShouldPlay(effectData) {\n\t\treturn !effectData.local || effectData.creatorUserId === game.user.id;\n\t}\n\n\tstatic checkValid(effectData) {\n\t\tif (effectData.delete) {\n\t\t\treturn false;\n\t\t}\n\t\tlet sourceExists = true;\n\t\tlet targetExists = true;\n\t\tif (effectData.source && lib.is_UUID(effectData.source)) {\n\t\t\tsourceExists = fromUuidSync(effectData.source);\n\t\t}\n\t\tif (effectData.target && lib.is_UUID(effectData.target)) {\n\t\t\ttargetExists = fromUuidSync(effectData.target);\n\t\t}\n\t\tfor (let tiedDocumentUuid of effectData?.tiedDocuments ?? []) {\n\t\t\tif (tiedDocumentUuid && lib.is_UUID(tiedDocumentUuid)) {\n\t\t\t\tlet tiedDocumentExists = fromUuidSync(tiedDocumentUuid);\n\t\t\t\tif (!tiedDocumentExists) return false;\n\t\t\t}\n\t\t}\n\t\tif (\n\t\t\teffectData.source &&\n\t\t\tlib.is_UUID(effectData.source) &&\n\t\t\teffectData.target &&\n\t\t\tlib.is_UUID(effectData.target)\n\t\t) {\n\t\t\tconst sourceScene = effectData.source.split(\".\")[1];\n\t\t\tconst targetScene = effectData.target.split(\".\")[1];\n\t\t\tif (sourceScene !== targetScene || sourceScene !== effectData.sceneId)\n\t\t\t\treturn false;\n\t\t}\n\t\treturn sourceExists && targetExists;\n\t}\n\n\t/**\n\t * Validates that the update contains the appropriate data\n\t *\n\t * @param inUpdates\n\t */\n\tstatic validateUpdate(inUpdates) {\n\t\tconst updateKeys = Object.keys(inUpdates);\n\t\tconst protectedValues = updateKeys.filter((key) =>\n\t\t\tCanvasEffect.protectedValues.includes(key)\n\t\t);\n\t\tif (protectedValues.length) {\n\t\t\tthrow lib.custom_error(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t`CanvasEffect | update | You cannot update the following keys of an effect's data: ${protectedValues.join(\n\t\t\t\t\t\"\\n - \"\n\t\t\t\t)}`\n\t\t\t);\n\t\t}\n\t\tif (updateKeys.includes(\"source\")) {\n\t\t\tif (\n\t\t\t\t!(\n\t\t\t\t\tlib.is_UUID(inUpdates.source) ||\n\t\t\t\t\tcanvaslib.is_object_canvas_data(inUpdates.source)\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\t\"Sequencer\",\n\t\t\t\t\t`CanvasEffect | update | source must be of type document UUID or object with X and Y coordinates`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (updateKeys.includes(\"target\")) {\n\t\t\tif (\n\t\t\t\t!(\n\t\t\t\t\tlib.is_UUID(inUpdates.target) ||\n\t\t\t\t\tcanvaslib.is_object_canvas_data(inUpdates.target)\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\t\"Sequencer\",\n\t\t\t\t\t`CanvasEffect | update | target must be of type document UUID or object with X and Y coordinates`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tgetHook(type, uuid) {\n\t\tif (!lib.is_UUID(uuid)) return false;\n\t\tconst parts = uuid.split(\".\");\n\t\treturn type + parts[parts.length - 2];\n\t}\n\n\t/**\n\t * Gets the source hook name\n\t *\n\t * @param {string} type\n\t * @returns {string|boolean}\n\t */\n\tgetSourceHook(type = \"\") {\n\t\treturn this.getHook(type, this.data.source);\n\t}\n\n\t/**\n\t * The source object's current position, or its current position\n\t *\n\t * @returns {boolean|object}\n\t */\n\tgetSourceData() {\n\n\t\tif (this.data.temporary && !this.owner) {\n\t\t\treturn SequencerEffectManager.getPositionForUUID(this.data.source);\n\t\t}\n\n\t\tif (this.source instanceof foundry.canvas.placeables.PlaceableObject && this.isSourceDestroyed) {\n\t\t\treturn {\n\t\t\t\t...this._cachedSourceData,\n\t\t\t};\n\t\t}\n\n\t\tlet crosshairPos = this.source instanceof CrosshairsPlaceable ? this.sourceDocument.getOrientation() : false;\n\t\tcrosshairPos = crosshairPos?.source;\n\n\t\t// Fall back to the document when the placeable isn't on this canvas.\n\t\tconst positionSource =\n\t\t\tthis.source instanceof foundry.canvas.placeables.PlaceableObject && !this.isSourceTemporary\n\t\t\t\t? this.source\n\t\t\t\t: (this.sourceDocument ?? this.source);\n\n\t\tlet position =\n\t\t\tcrosshairPos\n\t\t\t|| (positionSource ? canvaslib.get_object_position(positionSource) : null)\n\t\t\t|| this.source?.worldPosition\n\t\t\t|| this.source?.center\n\t\t\t|| this.source;\n\n\t\tconst { width, height } = crosshairPos || canvaslib.get_object_dimensions(positionSource);\n\n\t\tposition = PluginsManager.sourcePosition({ effect: this, position, height });\n\n\t\tif (position !== undefined) {\n\t\t\tthis._cachedSourceData.position = position;\n\t\t}\n\n\t\tif (width !== undefined && height !== undefined) {\n\t\t\tthis._cachedSourceData.width = width;\n\t\t\tthis._cachedSourceData.height = height;\n\t\t}\n\n\t\tlet rotation = 0;\n\t\tif (this.source instanceof foundry.canvas.placeables.MeasuredTemplate && this.sourceDocument?.t !== \"rect\") {\n\t\t\trotation = Math.normalizeRadians(\n\t\t\t\tMath.toRadians(this.sourceDocument?.direction)\n\t\t\t);\n\t\t} else if (!(this.source instanceof foundry.canvas.placeables.MeasuredTemplate)) {\n\t\t\trotation = this.sourceDocument?.rotation\n\t\t\t\t? Math.normalizeRadians(Math.toRadians(this.sourceDocument?.rotation))\n\t\t\t\t: 0;\n\t\t}\n\n\t\tif (rotation !== undefined) {\n\t\t\tthis._cachedSourceData.rotation = rotation;\n\t\t}\n\n\t\tconst alpha =\n\t\t\tthis.sourceDocument instanceof TokenDocument || this.sourceDocument instanceof TileDocument\n\t\t\t\t? this.sourceDocument?._source?.alpha ?? 1.0\n\t\t\t\t: 1.0;\n\n\t\tif (alpha !== undefined) {\n\t\t\tthis._cachedSourceData.alpha = alpha;\n\t\t}\n\n\t\treturn {\n\t\t\t...this._cachedSourceData,\n\t\t};\n\t}\n\n\t/**\n\t * Gets the target hook name\n\t *\n\t * @param {string} type\n\t * @returns {string|boolean}\n\t */\n\tgetTargetHook(type = \"\") {\n\t\treturn this.getHook(type, this.data.target);\n\t}\n\n\t/**\n\t * The target object's current position, or its current position\n\t *\n\t * @returns {boolean|object}\n\t */\n\tgetTargetData() {\n\n\t\tif (this.data.temporary && !this.owner) {\n\t\t\treturn (\n\t\t\t\tSequencerEffectManager.getPositionForUUID(this.data.target) ??\n\t\t\t\tthis.getSourceData()\n\t\t\t);\n\t\t}\n\n\t\tif (this.target instanceof foundry.canvas.placeables.PlaceableObject && this.isTargetDestroyed) {\n\t\t\treturn {\n\t\t\t\t...this._cachedTargetData,\n\t\t\t};\n\t\t}\n\n\t\tlet crosshairPos = this.target instanceof CrosshairsPlaceable ? this.targetDocument.getOrientation() : false;\n\t\tcrosshairPos = crosshairPos?.target ?? crosshairPos?.source;\n\n\t\t// Fall back to the document when the placeable isn't on this canvas.\n\t\tconst positionTarget =\n\t\t\tthis.target instanceof foundry.canvas.placeables.PlaceableObject && !this.isTargetTemporary && !this.isTargetDestroyed\n\t\t\t\t? this.target\n\t\t\t\t: (this.targetDocument ?? this.target);\n\n\t\tlet position =\n\t\t\tcrosshairPos\n\t\t\t|| (positionTarget ? canvaslib.get_object_position(positionTarget, { measure: true }) : null)\n\t\t\t|| this.target?.worldPosition\n\t\t\t|| this.target?.center\n\t\t\t|| this.target;\n\n\t\tconst { width, height } = crosshairPos || canvaslib.get_object_dimensions(positionTarget);\n\n\t\tposition = PluginsManager.targetPosition({ effect: this, position, height });\n\n\t\tif (width !== undefined && height !== undefined) {\n\t\t\tthis._cachedTargetData.width = width;\n\t\t\tthis._cachedTargetData.height = height;\n\t\t}\n\n\t\tif (position !== undefined) {\n\t\t\tthis._cachedTargetData.position = position;\n\t\t}\n\n\t\tlet rotation = 0;\n\t\tif (\n\t\t\tthis.target instanceof foundry.canvas.placeables.MeasuredTemplate &&\n\t\t\tthis.targetDocument?.t !== \"rect\"\n\t\t) {\n\t\t\trotation = Math.normalizeRadians(\n\t\t\t\tMath.toRadians(this.targetDocument?.direction)\n\t\t\t);\n\t\t} else if (!(this.target instanceof foundry.canvas.placeables.MeasuredTemplate)) {\n\t\t\trotation = this.targetDocument?.rotation\n\t\t\t\t? Math.normalizeRadians(Math.toRadians(this.targetDocument?.rotation))\n\t\t\t\t: 0;\n\t\t}\n\n\t\tif (rotation !== undefined) {\n\t\t\tthis._cachedTargetData.rotation = rotation;\n\t\t}\n\n\t\tconst alpha =\n\t\t\tthis.targetDocument instanceof TokenDocument ||\n\t\t\tthis.targetDocument instanceof TileDocument\n\t\t\t\t? this.targetDocument?.alpha ?? 1.0\n\t\t\t\t: 1.0;\n\n\t\tif (alpha !== undefined) {\n\t\t\tthis._cachedTargetData.alpha = alpha;\n\t\t}\n\n\t\treturn {\n\t\t\t...this._cachedTargetData,\n\t\t};\n\t}\n\n\t/**\n\t * Calculates the offset for a given offset property and name mapping\n\t *\n\t * @param {string} offsetMapName\n\t * @param {boolean} source\n\t * @returns {{x: number, y: number}|*}\n\t * @private\n\t */\n\t_getOffset(offsetMapName, source = false) {\n\t\tconst key = source ? \"source\" : \"target\";\n\n\t\tconst offset = {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t};\n\n\t\tlet twister = this._twister;\n\n\t\tlet nameOffsetMap = this._nameOffsetMap?.[this.data.name];\n\n\t\tif (nameOffsetMap) {\n\t\t\ttwister = nameOffsetMap.twister;\n\t\t}\n\n\t\t// 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\t\tif (this.data.missed && (!source || !this.data.target)) {\n\t\t\tlet missedOffset =\n\t\t\t\tthis._offsetCache[key]?.missedOffset ||\n\t\t\t\tcanvaslib.calculate_missed_position(this.source, this.target, twister);\n\t\t\tthis._offsetCache[key].missedOffset = missedOffset;\n\t\t\toffset.x -= missedOffset.x;\n\t\t\toffset.y -= missedOffset.y;\n\t\t}\n\n\t\tconst obj = source ? this.source : this.target;\n\t\tconst multiplier = source\n\t\t\t? this.data.randomOffset?.source\n\t\t\t: this.data.randomOffset?.target;\n\n\t\tif (obj && multiplier) {\n\t\t\tlet randomOffset =\n\t\t\t\tthis._offsetCache[key]?.randomOffset ||\n\t\t\t\tcanvaslib.get_random_offset(obj, multiplier, twister);\n\t\t\tthis._offsetCache[key].randomOffset = randomOffset;\n\t\t\toffset.x -= randomOffset.x;\n\t\t\toffset.y -= randomOffset.y;\n\t\t}\n\n\t\tlet extraOffset = this.data?.offset?.[key];\n\t\tif (extraOffset) {\n\t\t\tlet newOffset = {\n\t\t\t\tx: extraOffset.x,\n\t\t\t\ty: extraOffset.y,\n\t\t\t};\n\t\t\tif (extraOffset.gridUnits) {\n\t\t\t\tnewOffset.x *= canvas.grid.size;\n\t\t\t\tnewOffset.y *= canvas.grid.size;\n\t\t\t}\n\t\t\tif (extraOffset.local) {\n\t\t\t\tif (\n\t\t\t\t\t!this._cachedSourceData?.position ||\n\t\t\t\t\t!this._cachedTargetData?.position\n\t\t\t\t) {\n\t\t\t\t\tthis.getSourceData();\n\t\t\t\t\tthis.getTargetData();\n\t\t\t\t}\n\n\t\t\t\tconst startPos = this._cachedSourceData.position;\n\t\t\t\tconst endPos = this._cachedTargetData.position;\n\n\t\t\t\tconst angle = this.target\n\t\t\t\t\t? new foundry.canvas.geometry.Ray(startPos, endPos).angle\n\t\t\t\t\t: foundry.canvas.geometry.Ray.fromAngle(\n\t\t\t\t\t\tstartPos.x,\n\t\t\t\t\t\tstartPos.y,\n\t\t\t\t\t\tthis._cachedSourceData.rotation,\n\t\t\t\t\t\t1\n\t\t\t\t\t).angle;\n\n\t\t\t\tnewOffset = canvaslib.rotateAroundPoint(\n\t\t\t\t\t0,\n\t\t\t\t\t0,\n\t\t\t\t\tnewOffset.x,\n\t\t\t\t\tnewOffset.y,\n\t\t\t\t\t-angle\n\t\t\t\t);\n\t\t\t}\n\t\t\toffset.x -= newOffset.x;\n\t\t\toffset.y -= newOffset.y;\n\t\t}\n\n\t\tlet offsetMap = this._nameOffsetMap?.[offsetMapName];\n\n\t\tif (!this._offsetCache[key][\"nameCache\"][offsetMapName]) {\n\t\t\tthis._offsetCache[key][\"nameCache\"][offsetMapName] = {};\n\t\t}\n\n\t\tif (offsetMap) {\n\t\t\tif (offsetMap.missed) {\n\t\t\t\tconst missedOffset =\n\t\t\t\t\tthis._offsetCache[key][\"nameCache\"][offsetMapName]?.missedOffset ||\n\t\t\t\t\tcanvaslib.calculate_missed_position(\n\t\t\t\t\t\toffsetMap.sourceObj,\n\t\t\t\t\t\toffsetMap.targetObj,\n\t\t\t\t\t\toffsetMap.twister\n\t\t\t\t\t);\n\t\t\t\tthis._offsetCache[key][\"nameCache\"][offsetMapName].missedOffset =\n\t\t\t\t\tmissedOffset;\n\t\t\t\toffset.x -= missedOffset.x;\n\t\t\t\toffset.y -= missedOffset.y;\n\t\t\t}\n\n\t\t\tconst obj = offsetMap.targetObj || offsetMap.sourceObj;\n\t\t\tconst multiplier =\n\t\t\t\toffsetMap.randomOffset?.source || offsetMap.randomOffset?.target;\n\n\t\t\tif (obj && multiplier) {\n\t\t\t\tlet randomOffset =\n\t\t\t\t\tthis._offsetCache[key][\"nameCache\"][offsetMapName]?.randomOffset ||\n\t\t\t\t\tcanvaslib.get_random_offset(obj, multiplier, offsetMap.twister);\n\t\t\t\tthis._offsetCache[key][\"nameCache\"][offsetMapName].randomOffset =\n\t\t\t\t\trandomOffset;\n\t\t\t\toffset.x -= randomOffset.x;\n\t\t\t\toffset.y -= randomOffset.y;\n\t\t\t}\n\n\t\t\tif (offsetMap.offset) {\n\t\t\t\toffset.x += offsetMap.offset.x;\n\t\t\t\toffset.y += offsetMap.offset.y;\n\t\t\t}\n\t\t}\n\n\t\treturn offset;\n\t}\n\n\t/**\n\t * Initializes the name offset map by establishing targets\n\t *\n\t * @param inOffsetMap\n\t * @returns {{setup}|*}\n\t * @private\n\t */\n\t_setupOffsetMap(inOffsetMap) {\n\t\tif (!inOffsetMap.setup) {\n\t\t\tinOffsetMap.setup = true;\n\t\t\tinOffsetMap.sourceObj = inOffsetMap.source\n\t\t\t\t? this._validateObject(inOffsetMap.source)\n\t\t\t\t: false;\n\t\t\tinOffsetMap.targetObj = inOffsetMap.target\n\t\t\t\t? this._validateObject(inOffsetMap.target)\n\t\t\t\t: false;\n\t\t\tconst repetition = this.data.repetition % inOffsetMap.repetitions;\n\t\t\tconst seed = lib.get_hash(`${inOffsetMap.seed}-${repetition}`);\n\t\t\tinOffsetMap.twister = lib.createMersenneTwister(seed);\n\t\t}\n\n\t\treturn inOffsetMap;\n\t}\n\n\t/**\n\t * Plays the effect, returning two promises; one that resolves once the duration has been established, and another\n\t * when the effect has finished playing\n\t *\n\t * @returns {Object}\n\t */\n\tplay() {\n\t\tconst durationPromise = new Promise((resolve, reject) => {\n\t\t\tthis._durationResolve = resolve;\n\t\t});\n\n\t\tconst finishPromise = new Promise(async (resolve, reject) => {\n\t\t\tthis._resolve = resolve;\n\t\t\tHooks.callAll(\"createSequencerEffect\", this);\n\t\t\tlib.debug(`Playing effect:`, this.data);\n\t\t\tthis._initialize();\n\t\t});\n\n\t\treturn {\n\t\t\tduration: durationPromise,\n\t\t\tpromise: finishPromise,\n\t\t};\n\t}\n\n\t/**\n\t *  Ends the effect\n\t */\n\tendEffect() {\n\t\tif (this._ended) return;\n\t\tthis._durationResolve?.(0);\n\t\tthis._durationResolve = null;\n\t\tthis._resolve?.(this.data);\n\t\tHooks.callAll(\"endedSequencerEffect\", this);\n\t\tthis.destroy();\n\t}\n\n\tdestroy(...args) {\n\t\tthis._destroyDependencies();\n\t\treturn super.destroy(...args);\n\t}\n\n\t/**\n\t * Updates this effect with the given parameters\n\t * @param inUpdates\n\t * @returns {Promise}\n\t */\n\tasync update(inUpdates) {\n\t\tif (!this.userCanUpdate)\n\t\t\tthrow lib.custom_error(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"CanvasEffect | Update | You do not have permission to update this effect\"\n\t\t\t);\n\t\tCanvasEffect.validateUpdate(inUpdates);\n\n\t\tconst newData = foundry.utils.deepClone(this.data);\n\t\tconst updateKeys = Object.keys(inUpdates);\n\n\t\tupdateKeys.forEach((key) => {\n\t\t\tfoundry.utils.setProperty(newData, key, inUpdates[key]);\n\t\t});\n\n\t\tif (\n\t\t\tObject.keys(foundry.utils.diffObject(newData, this.data)).length === 0\n\t\t) {\n\t\t\tlib.debug(\n\t\t\t\t`Skipped updating effect with ID ${this.id} - no changes needed`\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.data.persist) {\n\t\t\tconst originalSourceUUID =\n\t\t\t\tlib.is_UUID(this.data.source) && this.data.attachTo\n\t\t\t\t\t? this.data.source\n\t\t\t\t\t: \"Scene.\" + this.data.sceneId;\n\n\t\t\tconst newSourceUUID =\n\t\t\t\tlib.is_UUID(newData.source) && newData.attachTo\n\t\t\t\t\t? newData.source\n\t\t\t\t\t: \"Scene.\" + newData.sceneId;\n\n\t\t\tif (originalSourceUUID !== newSourceUUID) {\n\t\t\t\tflagManager.removeFlags(originalSourceUUID, { effects: newData });\n\t\t\t}\n\n\t\t\tflagManager.addFlags(newSourceUUID, { effects: newData });\n\t\t}\n\n\t\tlib.debug(`Updated effect with ID ${this.id}`);\n\n\t\treturn sequencerSocket.executeForEveryone(\n\t\t\tSOCKET_HANDLERS.UPDATE_EFFECT,\n\t\t\tthis.id,\n\t\t\tnewData\n\t\t);\n\t}\n\n\tasync addAnimatedProperties({ animations = [], loopingAnimation = [] } = {}) {\n\t\tconst animationsToAdd = [];\n\t\tif (!Array.isArray(animations)) {\n\t\t\tthrow lib.custom_error(\n\t\t\t\tthis.data.moduleName,\n\t\t\t\t`animations must be an array of arrays`\n\t\t\t);\n\t\t}\n\t\tfor (const animationData of animations) {\n\t\t\tif (!Array.isArray(animationData)) {\n\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\tthis.data.moduleName,\n\t\t\t\t\t`each entry in animations must be an array, each with target, property name, and animation options`\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst result = canvaslib.validateAnimation(...animationData);\n\t\t\tif (typeof result === \"string\") {\n\t\t\t\tthrow lib.custom_error(this.data.moduleName, result);\n\t\t\t}\n\t\t\tresult.creationTimestamp = +new Date();\n\t\t\tanimationsToAdd.push(result);\n\t\t}\n\t\tif (!Array.isArray(loopingAnimation)) {\n\t\t\tthrow lib.custom_error(\n\t\t\t\tthis.data.moduleName,\n\t\t\t\t`loopingAnimation must be an array of arrays`\n\t\t\t);\n\t\t}\n\t\tfor (const animationData of loopingAnimation) {\n\t\t\tif (!Array.isArray(animationData)) {\n\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\tthis.data.moduleName,\n\t\t\t\t\t`each entry in loopingAnimation must be an array, each with target, property name, and animation options`\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst result = canvaslib.validateLoopingAnimation(...animationData);\n\t\t\tif (typeof result === \"string\") {\n\t\t\t\tthrow lib.custom_error(this.data.moduleName, result);\n\t\t\t}\n\t\t\tresult.creationTimestamp = +new Date();\n\t\t\tanimationsToAdd.push(result);\n\t\t}\n\n\t\tif (this.data.persist) {\n\t\t\tconst originalSourceUUID =\n\t\t\t\tlib.is_UUID(this.data.source) && this.data.attachTo\n\t\t\t\t\t? this.data.source\n\t\t\t\t\t: \"Scene.\" + this.data.sceneId;\n\t\t\tconst newData = foundry.utils.deepClone(this.data);\n\t\t\tnewData.animations = (newData.animations ?? []).concat(\n\t\t\t\tfoundry.utils.deepClone(animationsToAdd)\n\t\t\t);\n\t\t\tflagManager.addFlags(originalSourceUUID, { effects: newData });\n\t\t}\n\n\t\treturn sequencerSocket.executeForEveryone(\n\t\t\tSOCKET_HANDLERS.ADD_EFFECT_ANIMATIONS,\n\t\t\tthis.id,\n\t\t\tanimationsToAdd\n\t\t);\n\t}\n\n\tasync _addAnimations(inAnimations) {\n\t\tthis._playAnimations(foundry.utils.deepClone(inAnimations));\n\t\tthis.data.animations = (this.data.animations ?? []).concat(inAnimations);\n\t}\n\n\t/**\n\t * Updates the effect\n\t *\n\t * @param inUpdates\n\t * @returns {Promise}\n\t * @private\n\t */\n\t_update(inUpdates) {\n\t\tthis.data = inUpdates;\n\t\tHooks.callAll(\"updateSequencerEffect\", this);\n\t\tthis._destroyDependencies();\n\t\treturn this._reinitialize();\n\t}\n\n\t/**\n\t * Determines whether a position is within the bounds of this effect\n\t *\n\t * @param inPosition\n\t * @returns {boolean}\n\t */\n\tisPositionWithinBounds(inPosition) {\n\t\tif (!this.spriteContainer) return false;\n\t\treturn canvaslib.is_position_within_bounds(\n\t\t\tinPosition,\n\t\t\tthis.spriteContainer,\n\t\t\tthis.parent\n\t\t);\n\t}\n\n\t/**\n\t * Initializes the effect and places it on the canvas\n\t *\n\t * @returns {Promise}\n\t * @private\n\t */\n\tasync _initialize() {\n\t\ttry {\n\t\t\tthis.ready = false;\n\t\t\tthis._initializeVariables();\n\t\t\tthis._addToContainer();\n\t\t\tawait this._createFile()\n\t\t\tthis._updateCurrentFilePath(false, true)\n\t\t\tawait this._createSprite();\n\t\t\tthis._calculateDuration();\n\t\t\tthis._createShapes();\n\t\t\tawait this._setupMasks();\n\t\t\tawait this._transformSprite();\n\t\t\tthis._playPresetAnimations();\n\t\t\tthis._playCustomAnimations();\n\t\t\tthis._setEndTimeout();\n\t\t\tthis._registerTickers()\n\t\t\tthis._timeoutVisibility();\n\t\t\tawait this._startEffect();\n\t\t\tthis.ready = true;\n\t\t} catch (err) {\n\t\t\tthis._durationResolve?.(0);\n\t\t\tthis._durationResolve = null;\n\t\t\tthis._resolve?.(this.data);\n\t\t\tthis._resolve = null;\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\t/**\n\t * Reinitializes the effect after it has been updated\n\t *\n\t * @param play\n\t * @returns {Promise}\n\t * @private\n\t */\n\tasync _reinitialize() {\n\t\tthis._initializing = true;\n\t\tthis._recomputeRenderable();\n\t\tif (!this.shouldPlay) {\n\t\t\treturn Sequencer.EffectManager._removeEffect(this);\n\t\t}\n\t\tthis.actualCreationTime = +new Date();\n\t\treturn this._initialize();\n\t}\n\n\t/**\n\t * Initializes variables core to the function of the effect\n\t * This is run as a part of the construction of the effect\n\t *\n\t * @private\n\t */\n\t_initializeVariables() {\n\t\t// Responsible for rotating the sprite\n\t\tthis.rotationContainer = this.addChild(new PIXI.Container());\n\t\tthis.rotationContainer.id = this.id + \"-rotationContainer\";\n\n\t\tthis.pluginContainer = PluginsManager.createSpriteContainers({ effect: this, container: this.rotationContainer });\n\n\t\t// An offset container for the sprite\n\t\tthis.spriteContainer = this.pluginContainer.addChild(\n\t\t\tnew PIXI.Container()\n\t\t);\n\t\tthis.spriteContainer.id = this.id + \"-spriteContainer\";\n\n\t\tthis._template = this.data.template;\n\t\tthis._ended = null;\n\t\tthis._maskContainer = null;\n\t\tthis._maskSprite = null;\n\t\tthis._stageMasks = [];\n\t\tthis._wallMaskGraphics = null;\n\t\tthis._wallMaskDirty = false;\n\t\tthis._verticalExtent = [0, 0, false];\n\t\tthis._timeouts = new Set();\n\t\tthis._file = null;\n\t\tthis._loopOffset = 0;\n\t\tthis.effectFilters = {};\n\t\tthis._animationDuration = 0;\n\t\tthis._animationTimes = {};\n\t\tthis._twister = lib.createMersenneTwister(this.creationTimestamp);\n\t\tthis._distanceCache = null;\n\t\tthis._isRangeFind = false;\n\t\tthis._customAngle = 0;\n\t\tthis._currentFilePath = this.data.file;\n\t\tthis._hooks = [];\n\t\tthis._lastDimensions = {};\n\t\tthis._lastScreenDimensions = {};\n\t\tthis._renderTexture = null;\n\n\t\tif (this._resetTimeout) {\n\t\t\tclearTimeout(this._resetTimeout);\n\t\t}\n\t\tthis._resetTimeout = null;\n\n\t\tthis._source = false;\n\t\tthis._target = false;\n\t\tthis._offsetCache = {\n\t\t\tsource: { nameCache: {} },\n\t\t\ttarget: { nameCache: {} },\n\t\t};\n\n\t\tthis._nameOffsetMap = Object.fromEntries(\n\t\t\tObject.entries(\n\t\t\t\tfoundry.utils.deepClone(this.data.nameOffsetMap ?? {})\n\t\t\t).map((entry) => {\n\t\t\t\treturn [entry[0], this._setupOffsetMap(entry[1])];\n\t\t\t})\n\t\t);\n\n\t\tthis.uuid = !lib.is_UUID(this.context.uuid)\n\t\t\t? this.id\n\t\t\t: this.context.uuid + \".data.flags.sequencer.effects.\" + this.id;\n\n\t\tthis._ticker = foundry.canvas.animation.CanvasAnimation.ticker;\n\t\tthis._tickerMethods = [];\n\t}\n\n\t_addToTicker(func) {\n\t\tthis._tickerMethods.push(func);\n\t\tthis._ticker.add(func, this);\n\t}\n\n\t_setTimeout(fn, ms) {\n\t\tconst id = setTimeout(() => {\n\t\t\tthis._timeouts?.delete(id);\n\t\t\tfn();\n\t\t}, ms);\n\t\tthis._timeouts.add(id);\n\t\treturn id;\n\t}\n\n\t/**\n\t * Destroys all dependencies to this element, such as tickers, animations, textures, and child elements\n\t *\n\t * @private\n\t */\n\t_destroyDependencies() {\n\t\tif (this._ended) return;\n\t\tthis._ended = true;\n\n\t\tthis._durationResolve?.(0);\n\t\tthis._durationResolve = null;\n\n\t\tthis.mask = null;\n\n\t\t// Tear down the region punch-through proxy first so it cannot\n\t\t// dereference this.sprite / children while we destroy them.\n\t\tthis._teardownVoidProxy();\n\n\t\tif (this._timeouts?.size) {\n\t\t\tfor (const id of this._timeouts) clearTimeout(id);\n\t\t\tthis._timeouts.clear();\n\t\t}\n\t\tthis.restartLoopHandler = null;\n\n\t\thooksManager.removeHooks(this.uuid);\n\n\t\tthis._tickerMethods.forEach(func => this._ticker.remove(func, this));\n\t\tthis._ticker = null;\n\t\tthis._perEffectTickHandlers = null;\n\n\t\tSequencerAnimationEngine.endAnimations(this.id);\n\n\t\tif (this._maskContainer) this._maskContainer.destroy({ children: true });\n\t\tthis._maskContainer = null;\n\t\tif (this._maskSprite) {\n\t\t\ttry {\n\t\t\t\tthis._maskSprite.texture.destroy(true);\n\t\t\t\tthis._maskSprite.destroy();\n\t\t\t} catch (err) {\n\t\t\t}\n\t\t\tthis._maskSprite = null;\n\t\t}\n\n\t\tif (this._stageMasks?.length) {\n\t\t\tfor (const shape of this._stageMasks) {\n\t\t\t\ttry {\n\t\t\t\t\tif (shape?.parent) shape.parent.removeChild(shape);\n\t\t\t\t\tshape?.destroy?.({ children: true });\n\t\t\t\t} catch (err) {\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._stageMasks.length = 0;\n\t\t}\n\t\tthis._wallMaskGraphics = null;\n\n\t\tthis.sprite?.destroy();\n\t\tthis.sprite = null;\n\n\t\tif (this.data.screenSpaceAboveUI) {\n\t\t\tSequencerAboveUILayer.removeContainerByEffect(this);\n\t\t}\n\n\t\tif (this.data.syncGroup) {\n\t\t\tSyncGroups.remove(this);\n\t\t}\n\t\tthis.removeChildren().forEach((child) => child.destroy({ children: true }));\n\n\t\tthis.rotationContainer = null;\n\t\tthis.pluginContainer = null;\n\t\tthis.spriteContainer = null;\n\t}\n\n\t/**\n\t * Plays preset animations\n\t *\n\t * @private\n\t */\n\t_playPresetAnimations() {\n\t\tthis._moveTowards();\n\n\t\tthis._fadeOut();\n\t\tthis._fadeIn();\n\n\t\tthis._rotateOut();\n\t\tthis._rotateIn();\n\n\t\tthis._scaleOut();\n\t\tthis._scaleIn();\n\n\t\tthis._fadeOutAudio();\n\t\tthis._fadeInAudio();\n\t}\n\n\t/**\n\t * Gets an object based on an identifier, checking if it exists within the named offset map, whether it's a\n\t * coordinate object, or if it's an UUID that needs to be fetched from the scene\n\t *\n\t * @param inIdentifier\n\t * @param specific\n\t * @param returnSource\n\t * @returns {*}\n\t * @private\n\t */\n\t_getObjectByID(inIdentifier, specific = false, returnSource = false) {\n\t\tlet source = inIdentifier;\n\t\tlet offsetMap = this._nameOffsetMap?.[inIdentifier];\n\t\tif (offsetMap) {\n\t\t\tif (specific) {\n\t\t\t\tsource = (returnSource\n\t\t\t\t\t\t? offsetMap?.sourceObj || offsetMap?.targetObj\n\t\t\t\t\t\t: offsetMap?.targetObj || offsetMap?.sourceObj\n\t\t\t\t) || source;\n\t\t\t} else {\n\t\t\t\tsource = offsetMap?.targetObj || offsetMap?.sourceObj || source;\n\t\t\t}\n\t\t} else {\n\t\t\tsource = this._validateObject(source);\n\t\t}\n\t\treturn source;\n\t}\n\n\t/**\n\t * Validates the given parameter, whether it's a UUID or a coordinate object, and returns the proper one\n\t *\n\t * @param inObject\n\t * @returns {*}\n\t * @private\n\t */\n\t_validateObject(inObject) {\n\t\tif (lib.is_UUID(inObject) || !canvaslib.is_object_canvas_data(inObject)) {\n\t\t\tinObject = lib.get_object_from_scene(inObject, this.data.sceneId);\n\t\t\tinObject = inObject?._object ?? inObject;\n\t\t}\n\t\treturn inObject;\n\t}\n\n\t/**\n\t * Adds this effect to the appropriate container on the right layer\n\t *\n\t * @private\n\t */\n\t_addToContainer() {\n\t\tlet layer;\n\t\tlet registerVoidProxy = false;\n\t\tif (this.data.screenSpaceAboveUI) {\n\t\t\tlayer = SequencerAboveUILayer;\n\t\t} else if (this.data.screenSpace) {\n\t\t\tlayer = canvas.sequencerEffectsUILayer;\n\t\t} else if (this.data.aboveInterface) {\n\t\t\tlayer = canvas.controls;\n\t\t} else if (this.data.aboveLighting) {\n\t\t\tlayer = canvas.interface;\n\t\t} else {\n\t\t\t// Render inside the primary canvas group so that effects\n\t\t\t// participate in elevation/sortLayer/sort ordering with tokens,\n\t\t\t// tiles, drawings, and weather.\n\t\t\tlayer = canvas.primary;\n\t\t\tregisterVoidProxy = true;\n\t\t}\n\n\t\tif (!layer || typeof layer.addChild !== \"function\") return;\n\n\t\tlayer.addChild(this);\n\t\tlayer.sortChildren?.();\n\n\t\t// For default-routed effects, register an ERASE-blend proxy in the\n\t\t// interface group so the effect visually \"punches through\" any\n\t\t// region highlights drawn above the primary group. Matches Foundry's\n\t\t// Token#voidMesh mechanism (isolated by InterfaceCanvasGroup's\n\t\t// VoidFilter so the erase does not leak into non-interface pixels).\n\t\tif (registerVoidProxy) this._registerVoidProxy();\n\t}\n\n\t/* -------------------------------------------------------------- */\n\t/*  Region \"punch-through\" (voidMesh proxy)                       */\n\t/* -------------------------------------------------------------- */\n\n\t/**\n\t * Register an ERASE-blend proxy container in the interface group so\n\t * this effect visually punches through region highlights that draw\n\t * above the primary canvas group.\n\t *\n\t * The proxy itself has no geometry. Its `render` callback reaches back\n\t * into this effect's sub-tree and re-renders every visible mesh/graphic/\n\t * text element with BLEND_MODES.ERASE. InterfaceCanvasGroup has a\n\t * VoidFilter that isolates its framebuffer, so the erase is constrained\n\t * to interface-group pixels only.\n\t *\n\t * @private\n\t */\n\t_registerVoidProxy() {\n\t\tif (this._voidProxy || !canvas?.interface) return;\n\t\tconst proxy = new PIXI.Container();\n\t\t// No local geometry; skip transform work.\n\t\tproxy.updateTransform = () => {};\n\t\t// Render last within the interface group, above RegionLayer.\n\t\tproxy.zIndex = 1000;\n\t\tproxy.__sequencerOwner = this;\n\t\tproxy.render = (renderer) => this._renderAsVoid(renderer);\n\t\tcanvas.interface.addChild(proxy);\n\t\tthis._voidProxy = proxy;\n\t}\n\n\t/**\n\t * Root render hook for the voidMesh proxy. Guards and dispatches\n\t * to the subtree-walking renderer. Silent failure on error (the\n\t * effect still renders in its primary layer).\n\t *\n\t * @param {PIXI.Renderer} renderer\n\t * @private\n\t */\n\t_renderAsVoid(renderer) {\n\t\tif (this._destroyed || this._isEnding) return;\n\t\tif (!this.renderable || !this.visible || this.worldAlpha <= 0) return;\n\t\tif (!CanvasEffect._sceneHasActiveRegionHighlights()) return;\n\t\ttry {\n\t\t\tthis._renderSubtreeAsVoid(renderer, this, null);\n\t\t} catch (err) {\n\t\t\tif (CONFIG.debug?.sequencer) {\n\t\t\t\tconsole.warn(\"Sequencer | voidProxy render error\", err);\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic _sceneHasActiveRegionHighlights() {\n\t\tconst layer = canvas?.regions;\n\t\tif (!layer) return false;\n\t\tconst placeables = layer.placeables;\n\t\tif (!placeables?.length) return false;\n\t\tfor (let i = 0; i < placeables.length; i++) {\n\t\t\tconst region = placeables[i];\n\t\t\tif (region?.visible && region?.renderable) return true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t_renderSubtreeAsVoid(renderer, displayObject, outerFilter) {\n\t\tif (!displayObject) return;\n\t\tif (!displayObject.renderable || !displayObject.visible) return;\n\t\tif ((displayObject.worldAlpha ?? 1) <= 0) return;\n\n\t\tconst filters = displayObject.filters;\n\t\tconst mask = displayObject._mask;\n\n\t\tlet enabledFilters = null;\n\t\tif (filters?.length) {\n\t\t\tlet anyDisabled = false;\n\t\t\tfor (let i = 0; i < filters.length; i++) {\n\t\t\t\tif (!filters[i].enabled) { anyDisabled = true; break; }\n\t\t\t}\n\t\t\tif (anyDisabled) {\n\t\t\t\tconst scratch = this._voidEnabledFilters ??= [];\n\t\t\t\tscratch.length = 0;\n\t\t\t\tfor (let i = 0; i < filters.length; i++) {\n\t\t\t\t\tif (filters[i].enabled) scratch.push(filters[i]);\n\t\t\t\t}\n\t\t\t\tif (scratch.length) enabledFilters = scratch.slice();\n\t\t\t} else {\n\t\t\t\tenabledFilters = filters;\n\t\t\t}\n\t\t}\n\n\t\tconst hasFilter = !!enabledFilters && enabledFilters.length > 0;\n\t\tconst hasMask = !!mask && (!mask.isMaskData\n\t\t\t|| (mask.enabled && (mask.autoDetect || mask.type !== PIXI.MASK_TYPES.NONE)));\n\t\tconst flush = hasFilter || hasMask;\n\n\t\tlet pushedFilter = null;\n\t\tlet priorFilterBlend;\n\t\tlet promoted = false;\n\t\tlet nextOuterFilter = outerFilter;\n\n\t\tif (flush) renderer.batch.flush();\n\t\tif (hasFilter) {\n\t\t\trenderer.filter.push(displayObject, enabledFilters);\n\t\t\tconst installed = renderer.filter.defaultFilterStack?.at?.(-1);\n\t\t\tconst installedFilters = installed?.filters ?? enabledFilters;\n\t\t\tpushedFilter = installedFilters[installedFilters.length - 1];\n\t\t\tif (!outerFilter && pushedFilter) {\n\t\t\t\tpriorFilterBlend = pushedFilter.blendMode;\n\t\t\t\tpushedFilter.blendMode = PIXI.BLEND_MODES.ERASE;\n\t\t\t\tpromoted = true;\n\t\t\t\tnextOuterFilter = pushedFilter;\n\t\t\t}\n\t\t}\n\t\tif (hasMask) renderer.mask.push(displayObject, mask);\n\n\t\tconst isMeshLike = typeof displayObject._render === \"function\"\n\t\t\t&& (displayObject.isSprite === true\n\t\t\t\t|| displayObject instanceof PIXI.Mesh\n\t\t\t\t|| displayObject instanceof PIXI.Graphics\n\t\t\t\t|| displayObject instanceof PIXI.Text);\n\n\t\tconst shouldBlendLeaf = isMeshLike && !nextOuterFilter;\n\t\tlet originalLeafBlend;\n\t\tif (shouldBlendLeaf) {\n\t\t\toriginalLeafBlend = displayObject.blendMode;\n\t\t\tdisplayObject.blendMode = PIXI.BLEND_MODES.ERASE;\n\t\t}\n\n\t\ttry {\n\t\t\tif (isMeshLike) {\n\t\t\t\tif (displayObject.cullable && typeof displayObject._renderWithCulling === \"function\") {\n\t\t\t\t\tdisplayObject._renderWithCulling(renderer);\n\t\t\t\t} else {\n\t\t\t\t\tdisplayObject._render(renderer);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst children = displayObject.children;\n\t\t\tif (children?.length) {\n\t\t\t\tfor (let i = 0, n = children.length; i < n; i++) {\n\t\t\t\t\tthis._renderSubtreeAsVoid(renderer, children[i], nextOuterFilter);\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tif (shouldBlendLeaf) displayObject.blendMode = originalLeafBlend;\n\t\t\tif (promoted && pushedFilter) pushedFilter.blendMode = priorFilterBlend;\n\t\t\tif (flush) {\n\t\t\t\ttry { renderer.batch.flush(); } catch (_) { /* best-effort */ }\n\t\t\t}\n\t\t\tif (hasMask) {\n\t\t\t\ttry { renderer.mask.pop(displayObject); } catch (_) { /* best-effort */ }\n\t\t\t}\n\t\t\tif (hasFilter) {\n\t\t\t\ttry { renderer.filter.pop(); } catch (_) { /* best-effort */ }\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Remove and destroy the voidMesh proxy if one was registered.\n\t *\n\t * @private\n\t */\n\t_teardownVoidProxy() {\n\t\tconst proxy = this._voidProxy;\n\t\tif (!proxy) return;\n\t\tthis._voidProxy = null;\n\t\ttry {\n\t\t\tif (proxy.parent) proxy.parent.removeChild(proxy);\n\t\t\tproxy.destroy({ children: false });\n\t\t} catch (err) {\n\t\t\tif (CONFIG.debug?.sequencer) {\n\t\t\t\tconsole.warn(\"Sequencer | voidProxy teardown error\", err);\n\t\t\t}\n\t\t}\n\t}\n\n\tget startTimeMs() {\n\t\treturn this._startTime * 1000;\n\t}\n\n\tget endTimeMs() {\n\t\treturn this._endTime * 1000;\n\t}\n\n\t/**\n\t * Calculates the duration of this effect, based on animation durations, the video source duration, end/start times, etc\n\t *\n\t * @private\n\t */\n\t_calculateDuration() {\n\t\tlet playbackRate = this.data.playbackRate || 1.0;\n\n\t\tthis.mediaPlaybackRate = playbackRate;\n\n\t\tthis._animationDuration = this.data.duration || this.mediaDurationMs;\n\n\t\t// If the effect moves, then infer the duration from the distance divided by the speed\n\t\tif (this.data.moveSpeed && this.data.moves) {\n\t\t\tlet distance = canvaslib.distance_between(\n\t\t\t\tthis.sourcePosition,\n\t\t\t\tthis.targetPosition\n\t\t\t);\n\t\t\tlet durationFromSpeed = (distance / this.data.moveSpeed) * 1000;\n\t\t\tthis._animationDuration = Math.max(durationFromSpeed, this.data.duration);\n\t\t} else if (!this.data.duration && !this.hasAnimatedMedia) {\n\t\t\t// Determine static image duration\n\t\t\tlet fadeDuration =\n\t\t\t\t(this.data.fadeIn?.duration ?? 0) + (this.data.fadeOut?.duration ?? 0);\n\t\t\tlet scaleDuration =\n\t\t\t\t(this.data.scaleIn?.duration ?? 0) +\n\t\t\t\t(this.data.scaleOut?.duration ?? 0);\n\t\t\tlet rotateDuration =\n\t\t\t\t(this.data.rotateIn?.duration ?? 0) +\n\t\t\t\t(this.data.rotateOut?.duration ?? 0);\n\t\t\tlet moveDuration = 0;\n\t\t\tif (this.data.moves) {\n\t\t\t\tlet distance = canvaslib.distance_between(\n\t\t\t\t\tthis.sourcePosition,\n\t\t\t\t\tthis.targetPosition\n\t\t\t\t);\n\t\t\t\tmoveDuration =\n\t\t\t\t\t(this.data.moveSpeed\n\t\t\t\t\t\t? (distance / this.data.moveSpeed) * 1000\n\t\t\t\t\t\t: 1000) + this.data.moves.delay;\n\t\t\t}\n\n\t\t\tlet animationDurations = this.data.animations?.length\n\t\t\t\t? Math.max(\n\t\t\t\t\t...this.data.animations.map((animation) => {\n\t\t\t\t\t\tif (animation.looping) {\n\t\t\t\t\t\t\tif (animation.loops === 0) return 0;\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t(animation?.duration ?? 0) * (animation?.loops ?? 0) +\n\t\t\t\t\t\t\t\t(animation?.delay ?? 0)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn (animation?.duration ?? 0) + (animation?.delay ?? 0);\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t\t: 0;\n\n\t\t\tthis._animationDuration = Math.max(\n\t\t\t\tfadeDuration,\n\t\t\t\tscaleDuration,\n\t\t\t\trotateDuration,\n\t\t\t\tmoveDuration,\n\t\t\t\tanimationDurations\n\t\t\t);\n\n\t\t\tthis._animationDuration = this._animationDuration || 1000;\n\t\t}\n\n\t\t// Clamp effect duration to start time and end time\n\t\tthis._startTime = 0;\n\t\tif (this.data.time?.start && this.mediaCurrentTime !== null) {\n\t\t\tlet currentTime = !this.data.time.start.isPerc\n\t\t\t\t? this.data.time.start.value ?? 0\n\t\t\t\t: this._animationDuration * this.data.time.start.value;\n\t\t\tthis.mediaCurrentTime = currentTime / 1000;\n\t\t\tthis._startTime = currentTime / 1000;\n\t\t}\n\n\t\tthis._endTime = this._animationDuration;\n\t\tif (this.data.time?.end) {\n\t\t\tif (this.data.time.end.isPerc) {\n\t\t\t\tthis._endTime = this._animationDuration - (this._animationDuration * this.data.time.end.value);\n\t\t\t} else {\n\t\t\t\tthis._endTime = this.data.time.isRange\n\t\t\t\t\t? this.data.time.end.value\n\t\t\t\t\t: this._animationDuration - this.data.time.end.value;\n\t\t\t}\n\t\t}\n\t\tthis._endTime /= 1000;\n\n\t\tthis._animationDuration = lib.clamp(this.endTimeMs - this.startTimeMs, 0, this._animationDuration);\n\n\t\tif (\n\t\t\tthis._file?.markers &&\n\t\t\tthis._startTime === 0 &&\n\t\t\tthis._endTime === this.mediaDuration\n\t\t) {\n\t\t\tthis._animationTimes.loopStart = this._file.markers.loop.start / playbackRate / 1000;\n\t\t\tthis._animationTimes.loopEnd = this._file.markers.loop.end / playbackRate / 1000;\n\t\t\tthis._animationTimes.forcedEnd = this._file.markers.forcedEnd / playbackRate / 1000;\n\t\t}\n\n\t\tthis._totalDuration = this.loops\n\t\t\t? (this._animationDuration * this.loops) + (this.loopDelay * (this.loops - 1))\n\t\t\t: this._animationDuration;\n\n\t\tthis._totalDuration /= playbackRate;\n\n\t\tif (this.data.persist) {\n\t\t\tthis.mediaLooping = (\n\t\t\t\t(!this.data.time || (this._startTime === 0 && this._endTime === this.mediaDuration)) &&\n\t\t\t\tthis._animationTimes.loopStart === undefined &&\n\t\t\t\tthis._animationTimes.loopEnd === undefined &&\n\t\t\t\t!this.loops &&\n\t\t\t\t!this.loopDelay\n\t\t\t);\n\t\t} else {\n\t\t\tthis.mediaLooping = this._startTime === 0 && this._endTime > this.mediaDuration && !this.loops;\n\t\t}\n\n\t\t// Resolve duration promise so that owner of effect may know when it is finished\n\t\tthis._durationResolve?.(this._totalDuration);\n\t\tthis._durationResolve = null;\n\t}\n\n\t/**\n\t * If this effect is animatable, hold off on rendering it for a bit so that the animations have time to initialize to\n\t * prevent it from spawning and then jumping to the right place\n\t *\n\t * @private\n\t */\n\t_timeoutVisibility() {\n\t\tif (!this.data.animations) {\n\t\t\treturn this._setupHooks();\n\t\t}\n\t\tthis._setTimeout(() => {\n\t\t\tthis._setupHooks();\n\t\t}, 50);\n\t}\n\n\t/**\n\t * Add Ticker handler to check for updates to attached objects\n\t *\n\t * @private\n\t */\n\t_registerTickers() {\n\t\tconst handlers = [];\n\n\t\t//stretchTo && attached to stretchTo\n\t\tif (this.data.stretchTo && this.data.stretchTo?.attachTo) {\n\t\t\thandlers.push(this._transformStretchToAttachedSprite);\n\t\t}\n\t\t// attachTo, not attached to stretchTo\n\t\tif (this.data.attachTo?.active && !this.data.stretchTo?.attachTo) {\n\t\t\thandlers.push(this._transformAttachedNoStretchSprite);\n\t\t}\n\n\t\t// rotateTowards\n\t\tif (this.data.rotateTowards && this.data.rotateTowards?.attachTo) {\n\t\t\thandlers.push(this._transformRotateTowardsAttachedSprite);\n\t\t}\n\n\t\t// scaleTo\n\t\tif (this.data.scaleToObject && this.data?.attachTo?.active && this.data?.attachTo?.bindScale) {\n\t\t\tconst { heightWidthRatio, widthHeightRatio, baseScaleX, baseScaleY } = this._getBaseScale();\n\t\t\thandlers.push(function scaleTick() {\n\t\t\t\tthis._applyScaleToObject(heightWidthRatio, widthHeightRatio, baseScaleX, baseScaleY);\n\t\t\t\tthis._setAnchors();\n\t\t\t});\n\t\t}\n\n\t\t// source or target destroy safeguards\n\t\tif (this.isSourceTemporary) handlers.push(this._checkSourceDestroyed);\n\t\tif (this.isTargetTemporary) handlers.push(this._checkTargetDestroyed);\n\n\t\tif (!handlers.length) return;\n\n\t\tthis._perEffectTickHandlers = handlers;\n\t\tthis._addToTicker(this._perEffectTick);\n\t}\n\n\t_perEffectTick() {\n\t\tconst handlers = this._perEffectTickHandlers;\n\t\tif (!handlers) return;\n\t\tfor (let i = 0; i < handlers.length; i++) {\n\t\t\ttry {\n\t\t\t\thandlers[i].call(this);\n\t\t\t} catch (err) {\n\t\t\t\tif (CONFIG.debug?.sequencer) {\n\t\t\t\t\tconsole.warn(\"Sequencer | per-effect ticker handler threw\", err);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t_checkSourceDestroyed() {\n\t\tif (this.isSourceDestroyed) {\n\t\t\tthis._source = this.sourcePosition;\n\t\t\tthis._source.uuid = this.uuid;\n\t\t\tSequencerEffectManager.endEffects({ effects: this });\n\t\t}\n\t}\n\n\t_checkTargetDestroyed() {\n\t\tif (this.isTargetDestroyed) {\n\t\t\tthis._target = this.targetPosition;\n\t\t\tSequencerEffectManager.endEffects({ effects: this });\n\t\t}\n\t}\n\n\tasync _createFile() {\n\t\tif (this.data.copySprite) {\n\t\t\tlet targetDocument = fromUuidSync(this.data.copySprite.uuid);\n\t\t\tif (targetDocument?.ring?.enabled && targetDocument.object) {\n\t\t\t\tlet clonedObject = targetDocument.object.clone();\n\t\t\t\tawait clonedObject.draw();\n\t\t\t\tlet clonedMesh = clonedObject.mesh;\n\t\t\t\tclonedMesh.position.set(0, 0);\n\t\t\t\tclonedMesh.setShaderClass(CONFIG.Token.ring.shaderClass);\n\t\t\t\tthis._renderTexture = canvas.app.renderer.generateTexture(clonedMesh, {\n\t\t\t\t\tresolution: clonedMesh.texture.resolution\n\t\t\t\t});\n\t\t\t\tclonedObject.destroy();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (this.data.file === \"\") {\n\t\t\treturn;\n\t\t}\n\n\t\tlet file;\n\t\tif (this.data.customRange) {\n\t\t\tconst template = this.template ? [this.template.gridSize, this.template.startPoint, this.template.endPoint] : [100, 0, 0]\n\t\t\tfile = SequencerFileBase.make(\n\t\t\t\tthis.data.file,\n\t\t\t\t\"temporary.range.file\",\n\t\t\t\t{ template },\n\t\t\t);\n\t\t} else if (Sequencer.Database.entryExists(this.data.file)) {\n\t\t\tfile = Sequencer.Database.getEntry(this.data.file).clone();\n\t\t} else {\n\t\t\tfile = SequencerFileBase.make(this.data.file)\n\t\t\tthis._currentFilePath = this.data.file;\n\t\t}\n\n\t\tif (file.template) {\n\t\t\tthis._template =\n\t\t\t\tfoundry.utils.mergeObject(\n\t\t\t\t\t{ gridSize: file.template[0], startPoint: file.template[1], endPoint: file.template[2] },\n\t\t\t\t\tthis.data.template ?? {}\n\t\t\t\t)\n\t\t}\n\t\tfile.fileIndex = this.data.forcedIndex;\n\t\tfile.twister = this._twister;\n\t\tthis._file = file\n\t\tthis._isRangeFind = file?.rangeFind;\n\t}\n\n\t_updateCurrentFilePath(distance, showDistanceWarning = false) {\n\t\tif (this.data.copySprite && this._renderTexture) {\n\t\t\tthis._currentFilePath = this.data.copySprite.uuid;\n\t\t\treturn;\n\t\t}\n\t\tif (!this._file) {\n\t\t\treturn;\n\t\t}\n\t\tif (!this.data.stretchTo) {\n\t\t\tthis._currentFilePath = this._file.getFile();\n\t\t\treturn;\n\t\t}\n\t\tdistance = distance || (new foundry.canvas.geometry.Ray(this.sourcePosition, this.targetPosition)).distance;\n\t\tif (distance === 0 && showDistanceWarning) {\n\t\t\tlib.custom_error(\n\t\t\t\t\"effect\",\n\t\t\t\t`stretchTo - You are stretching over a distance of \"0\", you may be attempting to stretch between two of the same coordinates!`\n\t\t\t);\n\t\t}\n\t\tthis._currentFilePath = this._file.getFileForDistance(distance);\n\t}\n\n\t/**\n\t * Creates the sprite, and the relevant containers that manage the position and offsets of the overall visual look of the sprite\n\t *\n\t * @private\n\t */\n\tasync _createSprite() {\n\t\tif (this.data.copySprite?.offsetX !== undefined && this.data.copySprite?.offsetY !== undefined) {\n\t\t\tthis.rotationContainer.position.set(this.data.copySprite.offsetX, this.data.copySprite.offsetY);\n\t\t}\n\n\t\tthis._initializing = true;\n\t\tthis._recomputeRenderable();\n\t\tconst spriteData = {\n\t\t\ttexture: this._renderTexture,\n\t\t\tantialiasing: this.data?.fileOptions?.antialiasing,\n\t\t\ttiling: this.data.tilingTexture,\n\t\t\txray: this.data.xray || this.data.screenSpace || this.data.screenSpaceAboveUI,\n\t\t\tisPersisted: this.data.persist && !this.data.loopOptions?.endOnLastLoop\n\t\t}\n\t\t/** @type {SequencerSpriteManager} */\n\t\tthis.sprite = new SequencerSpriteManager(this._file, spriteData)\n\t\tthis.spriteContainer.addChild(this.sprite)\n\t\tthis.sprite.id = this.id + \"-sprite\";\n\t\tthis.sprite.loopDelay = this.loopDelay\n\t\tthis.sprite.currentTime = this._startTime\n\t\tthis.sprite.loop = this.loops\n\n\t\tawait this.sprite.activate(this._currentFilePath)\n\n\t\tif (this.data.copySprite && !this._renderTexture && !this.data.time?.start) {\n\t\t\tconst sourcePlaceable = fromUuidSync(this.data.copySprite.uuid)?.object ?? null;\n\t\t\tconst sourceTime = sourcePlaceable?.sourceElement?.currentTime;\n\t\t\tif (Number.isFinite(sourceTime) && sourceTime > 0) {\n\t\t\t\tthis.sprite.currentTime = sourceTime;\n\t\t\t}\n\t\t}\n\n\t\tthis.sprite.volume = (this.data.volume ?? 0) * game.settings.get(\"core\", \"globalInterfaceVolume\");\n\n\t\tif (this._isRangeFind && this.data.stretchTo && (this.data.attachTo?.active || this.data.stretchTo?.attachTo?.active)) {\n\t\t\tthis.sprite.preloadVariants()\n\t\t}\n\n\t\tif (this.data.text) {\n\t\t\tconst text = this.data.text.text;\n\t\t\tconst fontSettings = foundry.utils.deepClone(this.data.text);\n\t\t\tfontSettings.fontSize = (fontSettings?.fontSize ?? 26) * (150 / canvas.grid.size);\n\t\t\tconst textSprite = this.sprite.addText({ text, textStyle: fontSettings })\n\t\t\ttextSprite.zIndex = 1;\n\t\t\tconst textAnchor = this.data.text.anchor\n\t\t\ttextSprite.anchor.set(textAnchor?.x ?? 0.5, textAnchor?.y ?? 0.5);\n\t\t}\n\n\t\tthis.sprite.filters = [];\n\n\t\tif (this.data.filters) {\n\t\t\tfor (let index = 0; index < this.data.filters.length; index++) {\n\t\t\t\tconst filterData = this.data.filters[index];\n\t\t\t\tconst filter = new filters[filterData.className](filterData.data);\n\t\t\t\tfilter.id = this.id + \"-\" + filterData.className + \"-\" + index.toString();\n\t\t\t\tif (filter instanceof PIXI.ColorMatrixFilter) {\n\t\t\t\t\tthis.sprite.colorMatrixFilter = filter;\n\t\t\t\t} else {\n\t\t\t\t\tthis.sprite.filters.push(filter);\n\t\t\t\t}\n\t\t\t\tconst filterKeyName = filterData.name || filterData.className;\n\t\t\t\tthis.effectFilters[filterKeyName] = filter;\n\t\t\t}\n\t\t}\n\n\t\tthis.effectAlpha = this.data.opacity\n\n\t\tlet spriteOffsetX = this.data.spriteOffset?.x ?? 0;\n\t\tlet spriteOffsetY = this.data.spriteOffset?.y ?? 0;\n\t\tif (this.data.spriteOffset?.gridUnits) {\n\t\t\tspriteOffsetX *= canvas.grid.size;\n\t\t\tspriteOffsetY *= canvas.grid.size;\n\t\t}\n\n\t\tthis.sprite.position.set(spriteOffsetX, spriteOffsetY);\n\n\t\tthis.sprite.anchor?.set(\n\t\t\tthis.data.spriteAnchor?.x ?? 0.5,\n\t\t\tthis.data.spriteAnchor?.y ?? 0.5\n\t\t);\n\n\t\tlet spriteRotation = this.data.spriteRotation ?? 0;\n\t\tif (this.data.randomSpriteRotation) {\n\t\t\tspriteRotation += lib.random_float_between(-360, 360, this._twister);\n\t\t}\n\n\t\tthis.sprite.rotation = Math.normalizeRadians(\n\t\t\tMath.toRadians(spriteRotation)\n\t\t);\n\n\t\tthis._customAngle = this.data.angle ?? 0;\n\t\tif (this.data.randomRotation) {\n\t\t\tthis._customAngle += lib.random_float_between(-360, 360, this._twister);\n\t\t}\n\n\t\tconst offsetMap = this._nameOffsetMap?.[this.data.source];\n\t\tif (offsetMap?.angle !== undefined) {\n\t\t\tthis._customAngle += offsetMap?.angle;\n\t\t}\n\t\tif (offsetMap?.randomRotation) {\n\t\t\tthis._customAngle += lib.random_float_between(-360, 360, offsetMap.twister);\n\t\t}\n\n\t\tthis.spriteContainer.rotation = -Math.normalizeRadians(\n\t\t\tMath.toRadians(this._customAngle)\n\t\t);\n\n\t\tPluginsManager.createSprite({ effect: this });\n\n\t\tif (this.data.tint) {\n\t\t\tthis.sprite.tint = this.data.tint;\n\t\t}\n\n\t\tif (this.data.blendMode != null) {\n\t\t\tthis.sprite.blendMode = this.data.blendMode;\n\t\t}\n\n\t\t// only set filter and fade effects when a faded version should actually be shown\n\t\tif (this.shouldShowFadedVersion) {\n\t\t\tthis.alpha = game.settings.get(CONSTANTS.MODULE_NAME, \"user-effect-opacity\") / 100;\n\t\t\tthis.filters = [\n\t\t\t\tnew PIXI.ColorMatrixFilter({\n\t\t\t\t\tsaturation: -1,\n\t\t\t\t}),\n\t\t\t];\n\t\t}\n\n\t\tthis.updateElevation();\n\t}\n\n\t_createShapes() {\n\t\tconst nonMaskShapes = (this.data?.shapes ?? []).filter(\n\t\t\t(shape) => !shape.isMask\n\t\t);\n\t\tthis.shapes = {};\n\t\tfor (const shape of nonMaskShapes) {\n\t\t\tconst graphic = canvaslib.createShape(shape);\n\t\t\tgraphic.filters = this.sprite.filters;\n\t\t\tthis.spriteContainer.addChild(graphic);\n\t\t\tthis.shapes[shape?.name ?? \"shape-\" + foundry.utils.randomID()] = graphic;\n\t\t}\n\t}\n\n\t/**\n\t * Single place to write to this.renderable. Other code paths set their\n\t * gate slot (e.g. _baseRenderable) and call this; don't bypass.\n\t *\n\t * @private\n\t */\n\t_recomputeRenderable() {\n\t\tif (this._initializing) {\n\t\t\tthis.renderable = false;\n\t\t\treturn;\n\t\t}\n\t\tconst base = this._baseRenderable ?? this.shouldPlayVisible;\n\t\tconst paused = this._pauseRenderable !== false;\n\t\tthis.renderable = base && paused && this._isOnViewedLevel();\n\t}\n\n\t/**\n\t * Whether this effect is visible on the currently viewed scene level.\n\t * Always true on Foundry v13, and on `.screenSpace()`,\n\t * `.screenSpaceAboveUI()`, and `.aboveInterface()` effects.\n\t *\n\t * @returns {boolean}\n\t * @private\n\t */\n\t_isOnViewedLevel() {\n\t\tif (!CONSTANTS.IS_V14) return true;\n\t\tconst currentLevel = canvas?.level;\n\t\tif (!currentLevel) return true;\n\t\tif (this.data.screenSpace || this.data.screenSpaceAboveUI || this.data.aboveInterface) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst crossLevels = currentLevel.visibility?.levels;\n\t\tconst sceneLevels = canvas.scene?.levels;\n\n\t\tif (this.data.levels?.length) {\n\t\t\tfor (const entry of this.data.levels) {\n\t\t\t\tlet id = entry;\n\t\t\t\tif (sceneLevels && !sceneLevels.get(id)) {\n\t\t\t\t\tid = sceneLevels.getName?.(entry)?.id ?? entry;\n\t\t\t\t}\n\t\t\t\tif (id === currentLevel.id) return true;\n\t\t\t\tif (crossLevels?.has(id)) return true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// An explicit `.elevation()` range or `absolute` wins over\n\t\t// the source's level membership.\n\t\tconst hasExplicitSpatial = !!this.data.elevation\n\t\t\t&& (typeof this.data.elevation.top === \"number\" || this.data.elevation.absolute === true);\n\t\tconst sourceAttached = !hasExplicitSpatial && this.data.attachTo?.active\n\t\t\t&& typeof this.sourceDocument?.viewed === \"boolean\";\n\t\tconst targetAttached = !hasExplicitSpatial\n\t\t\t&& (this.data.stretchTo?.attachTo || this.data.rotateTowards?.attachTo)\n\t\t\t&& typeof this.targetDocument?.viewed === \"boolean\";\n\t\tif (sourceAttached || targetAttached) {\n\t\t\tif (sourceAttached && isDocOnViewedLevel(this.sourceDocument, currentLevel)) return true;\n\t\t\tif (targetAttached && isDocOnViewedLevel(this.targetDocument, currentLevel)) return true;\n\t\t\treturn false;\n\t\t}\n\n\t\tif (sceneLevels?.size === 1 && sceneLevels.has(foundry.documents.BaseScene.metadata.defaultLevelId)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst [zMin, zMax, topInclusive] = this._getEffectiveVerticalExtent();\n\t\tconst viewed = currentLevel.elevation;\n\t\tlet levelMatch = intervalsOverlap(zMin, zMax, viewed.bottom, viewed.top, topInclusive);\n\t\tif (!levelMatch && crossLevels?.size) {\n\t\t\tconst allLevels = canvas.scene?.levels;\n\t\t\tfor (const otherId of crossLevels) {\n\t\t\t\tconst other = allLevels?.get(otherId)?.elevation;\n\t\t\t\tif (!other) continue;\n\t\t\t\tif (intervalsOverlap(zMin, zMax, other.bottom, other.top, topInclusive)) {\n\t\t\t\t\tlevelMatch = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!levelMatch) return false;\n\n\t\t// Hide an unattached effect the same way Foundry hides tokens through its culling system\n\t\tconst pos = this.sourcePosition;\n\t\tif (!pos || !canvas.scene) return true;\n\t\treturn !isPositionCulled(canvas.scene, currentLevel, pos.x, pos.y, zMin, zMax);\n\t}\n\n\t/**\n\t * The effect's vertical `[zMin, zMax, topInclusive]` in scene elevation\n\t * units. Pinned by an explicit `.elevation()`; otherwise inherits the\n\t * source/target's extent (Token depth, Region elevation range and its\n\t * `topInclusive` flag).\n\t *\n\t * @returns {[number, number, boolean]}\n\t * @private\n\t */\n\t_getEffectiveVerticalExtent() {\n\t\tconst out = this._verticalExtent;\n\t\tif (this.data.elevation) {\n\t\t\tout[0] = (typeof this.elevationBottom === \"number\") ? this.elevationBottom : this.elevation;\n\t\t\tout[1] = (typeof this.elevationTop === \"number\") ? this.elevationTop : out[0];\n\t\t\tout[2] = !!this.data.elevation.topInclusive;\n\t\t\treturn out;\n\t\t}\n\n\t\tconst sourceExtent = canvaslib.get_object_vertical_extent(this.sourceDocument);\n\t\tconst targetExtent = canvaslib.get_object_vertical_extent(this.targetDocument);\n\n\t\tif (sourceExtent && targetExtent) {\n\t\t\tout[0] = Math.min(sourceExtent[0], targetExtent[0]);\n\t\t\tout[1] = Math.max(sourceExtent[1], targetExtent[1]);\n\t\t\tout[2] = !!(sourceExtent[1] >= targetExtent[1] ? sourceExtent[2] : false)\n\t\t\t\t|| !!(targetExtent[1] >= sourceExtent[1] ? targetExtent[2] : false);\n\t\t\treturn out;\n\t\t}\n\t\tif (sourceExtent) { out[0] = sourceExtent[0]; out[1] = sourceExtent[1]; out[2] = !!sourceExtent[2]; return out; }\n\t\tif (targetExtent) { out[0] = targetExtent[0]; out[1] = targetExtent[1]; out[2] = !!targetExtent[2]; return out; }\n\t\tout[0] = this.elevation; out[1] = this.elevation; out[2] = false;\n\t\treturn out;\n\t}\n\n\tupdateElevation() {\n\t\tlet targetElevation = Math.max(\n\t\t\tcanvaslib.get_object_elevation(this.source ?? {}),\n\t\t\tcanvaslib.get_object_elevation(this.target ?? {})\n\t\t);\n\n\t\tconst offset = this.data.elevation?.absolute ? 0 : targetElevation;\n\t\tconst bottom = (this.data.elevation?.elevation ?? 0) + offset;\n\t\tconst top = (typeof this.data.elevation?.top === \"number\")\n\t\t\t? this.data.elevation.top + offset\n\t\t\t: null;\n\t\tthis.elevationBottom = bottom;\n\t\tthis.elevationTop = top;\n\n\t\t// Anchor above the highest level floor the effect's top reaches\n\t\t// into, so a multi-level effect keeps its sort position when the\n\t\t// viewed level changes.\n\t\tlet renderElevation = bottom;\n\t\tconst onDefaultRoute = !this.data.aboveLighting && !this.data.aboveInterface\n\t\t\t&& !this.data.screenSpace && !this.data.screenSpaceAboveUI;\n\t\tif (onDefaultRoute) {\n\t\t\tconst [, extentTop, extentTopInclusive] = this._getEffectiveVerticalExtent();\n\t\t\tconst effectiveTop = (typeof extentTop === \"number\") ? extentTop : bottom;\n\t\t\tconst sceneLevels = canvas?.scene?.levels;\n\t\t\tif (sceneLevels) {\n\t\t\t\tfor (const level of sceneLevels) {\n\t\t\t\t\tconst lvlBottom = level.elevation?.bottom;\n\t\t\t\t\tif (!Number.isFinite(lvlBottom)) continue;\n\t\t\t\t\tconst crosses = extentTopInclusive\n\t\t\t\t\t\t? (effectiveTop >= lvlBottom)\n\t\t\t\t\t\t: (effectiveTop > lvlBottom);\n\t\t\t\t\tif (crosses && lvlBottom > renderElevation) renderElevation = lvlBottom;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.elevation = renderElevation;\n\t\tlet sort = !lib.is_real_number(this.data.zIndex)\n\t\t\t? (this?.parent?.children?.length ?? 0)\n\t\t\t: 100000;\n\t\tsort = PluginsManager.elevation({ effect: this, sort })\n\t\tsort += 100;\n\t\tthis.sort = sort;\n\t\t// sortLayer defaults to the CanvasEffect class default (800), which\n\t\t// sits between PrimaryCanvasGroup.SORT_LAYERS.TOKENS (700) and\n\t\t// WEATHER (1000). Fall back explicitly when data.sortLayer is\n\t\t// unset so we never pass undefined to the primary group sort\n\t\t// (which would treat it as 0 and place effects below tiles).\n\t\tthis.sortLayer = this.data.sortLayer ?? 800;\n\t\t// When routed to the interface group (.aboveLighting()), anchor\n\t\t// the effect above RegionLayer (zIndex ~100/600) and below the\n\t\t// controls layer (zIndex ~1000). The interface group sorts\n\t\t// children by zIndex, not sortLayer, so we bake it in here.\n\t\tif (this.data.aboveLighting) {\n\t\t\tthis.zIndex = 750 + (lib.is_real_number(this.data.zIndex) ? this.data.zIndex : 0);\n\t\t} else {\n\t\t\tthis.zIndex = sort + (lib.is_real_number(this.data.zIndex) ? this.data.zIndex : 0);\n\t\t}\n\t\tif (this.parent) {\n\t\t\tthis.parent.sortDirty = true;\n\t\t}\n\t\t// Elevation changes can flip level membership. e.g. an effect at\n\t\t// elevation 15 sits in level 2 [10, 20]; raise it to elevation 25\n\t\t// and it's on level 3 [20, 30], so visibility must re-evaluate.\n\t\tthis._recomputeRenderable();\n\t}\n\n\tupdateTransform() {\n\t\tsuper.updateTransform();\n\t\tif (this.data.screenSpace || this.data.screenSpaceAboveUI) {\n\t\t\tif (!canvas?.screenDimensions) return;\n\t\t\tconst [screenWidth, screenHeight] = canvas.screenDimensions;\n\n\t\t\tif (this._lastScreenDimensions?.screenWidth !== screenWidth\n\t\t\t\t|| this._lastScreenDimensions?.screenHeight !== screenHeight) {\n\t\t\t\tthis._lastScreenDimensions.screenWidth = screenWidth;\n\t\t\t\tthis._lastScreenDimensions.screenHeight = screenHeight;\n\t\t\t}\n\n\t\t\tthis.position.set(\n\t\t\t\t(this.data.screenSpacePosition?.x ?? 0) +\n\t\t\t\tscreenWidth *\n\t\t\t\t(this.data.screenSpaceAnchor?.x ?? this.data.anchor?.x ?? 0.5),\n\t\t\t\t(this.data.screenSpacePosition?.y ?? 0) +\n\t\t\t\tscreenHeight *\n\t\t\t\t(this.data.screenSpaceAnchor?.y ?? this.data.anchor?.y ?? 0.5)\n\t\t\t);\n\n\t\t\tif (this.data.screenSpaceScale) {\n\t\t\t\tconst scaleData = this.data.screenSpaceScale ?? { x: 1, y: 1 };\n\n\t\t\t\tlet scaleX = scaleData.x;\n\t\t\t\tlet scaleY = scaleData.y;\n\n\t\t\t\tthis._lastScreenDimensions.width = this.sprite.texture?.width || this._lastScreenDimensions.width || this.sprite.width || this.spriteContainer.children[this.spriteContainer.children.length - 1].width;\n\t\t\t\tthis._lastScreenDimensions.height = this.sprite.texture?.height || this._lastScreenDimensions.height || this.sprite.height || this.spriteContainer.children[this.spriteContainer.children.length - 1].height;\n\n\t\t\t\tif (scaleData.fitX) {\n\t\t\t\t\tscaleX = scaleX * (screenWidth / this._lastScreenDimensions.width);\n\t\t\t\t}\n\n\t\t\t\tif (scaleData.fitY) {\n\t\t\t\t\tscaleY = scaleY * (screenHeight / this._lastScreenDimensions.height);\n\t\t\t\t}\n\n\t\t\t\tscaleX = scaleData.ratioX ? scaleY : scaleX;\n\t\t\t\tscaleY = scaleData.ratioY ? scaleX : scaleY;\n\n\t\t\t\tthis.scale.set(scaleX, scaleY);\n\t\t\t}\n\t\t}\n\t}\n\n\tasync _setupMasks() {\n\t\tconst maskShapes = this.data.shapes.filter((shape) => shape.isMask);\n\n\t\tif (!this.data?.masks?.length && !maskShapes.length && !this.data?.constrainedByWalls) return;\n\n\t\tconst maskFilter = MaskFilter.create();\n\n\t\tif (this.data.constrainedByWalls) {\n\t\t\tthis._setupWallMask(maskFilter);\n\t\t}\n\n\t\tfor (const entry of this.data.masks) {\n\t\t\tif (entry && typeof entry === \"object\" && entry.__shape) {\n\t\t\t\tconst rawShape = canvaslib.deserializeShape(entry.__shape);\n\t\t\t\tif (!rawShape) continue;\n\t\t\t\tconst graphics = new PIXI.LegacyGraphics().beginFill().drawShape(rawShape).endFill();\n\t\t\t\tgraphics.cullable = true;\n\t\t\t\tgraphics.custom = true;\n\t\t\t\tgraphics.renderable = false;\n\t\t\t\tgraphics.uuid = \"__rawShape-\" + foundry.utils.randomID();\n\t\t\t\tcanvas.stage.addChild(graphics);\n\t\t\t\tthis._stageMasks.push(graphics);\n\t\t\t\tmaskFilter.masks.push(graphics);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst uuid = entry;\n\t\t\tconst documentObj = fromUuidSync(uuid);\n\n\t\t\tif (!documentObj || documentObj.parent.id !== this.data.sceneId) continue;\n\n\t\t\tconst obj = documentObj.object;\n\t\t\tconst docName = documentObj.documentName;\n\n\t\t\tlet shape = obj?.mesh;\n\t\t\tlet shapeToAdd = shape;\n\n\t\t\tif (docName === \"Region\") {\n\n\t\t\t\t// documentObj.polygons works without the placeable; negative\n\t\t\t\t// polygons (ring inner disc, etc.) become holes.\n\t\t\t\tshape = new PIXI.LegacyGraphics()\n\n\t\t\t\tfor (let polygon of documentObj.polygons) {\n\t\t\t\t\tif (polygon.isPositive) {\n\t\t\t\t\t\tshape.beginFill();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tshape.beginHole();\n\t\t\t\t\t}\n\t\t\t\t\tshape.drawShape(polygon);\n\t\t\t\t\tif (polygon.isPositive) {\n\t\t\t\t\t\tshape.endFill();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tshape.endHole();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tshapeToAdd = shape;\n\n\t\t\t\tshapeToAdd.cullable = true;\n\t\t\t\tshapeToAdd.custom = true;\n\t\t\t\tshapeToAdd.renderable = false;\n\t\t\t\tshapeToAdd.uuid = uuid;\n\t\t\t\tcanvas.stage.addChild(shapeToAdd);\n\t\t\t\tthis._stageMasks.push(shapeToAdd);\n\n\t\t\t} else if (docName === \"Token\" || docName === \"Tile\") {\n\t\t\t\tif (!obj?.mesh) continue;\n\t\t\t\tmaskFilter.masks.push(obj.mesh);\n\t\t\t\tcontinue;\n\t\t\t} else if (docName === \"MeasuredTemplate\" || docName === \"Drawing\") {\n\t\t\t\t// MeasuredTemplates are always instantiated; off-level\n\t\t\t\t// Drawings fall back to doc-shape construction.\n\t\t\t\tif (obj) {\n\t\t\t\t\tshape = obj?.shape?.geometry?.graphicsData?.[0]?.shape ?? obj?.shape;\n\t\t\t\t} else if (docName === \"Drawing\") {\n\t\t\t\t\tshape = canvaslib.create_drawing_mask_shape(documentObj);\n\t\t\t\t} else {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (!shape) continue;\n\n\t\t\t\tshape = PluginsManager.masking({\n\t\t\t\t\teffect: this,\n\t\t\t\t\tdoc: documentObj,\n\t\t\t\t\tobj,\n\t\t\t\t\tshape\n\t\t\t\t});\n\n\t\t\t\tshapeToAdd = new PIXI.LegacyGraphics()\n\t\t\t\t\t.beginFill()\n\t\t\t\t\t.drawShape(shape)\n\t\t\t\t\t.endFill();\n\n\t\t\t\tif (docName === \"MeasuredTemplate\") {\n\t\t\t\t\tshapeToAdd.position.set(documentObj.x, documentObj.y);\n\t\t\t\t} else {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tx,\n\t\t\t\t\t\ty,\n\t\t\t\t\t\tshape: { width, height },\n\t\t\t\t\t\trotation,\n\t\t\t\t\t} = documentObj;\n\t\t\t\t\tshapeToAdd.pivot.set(width / 2, height / 2);\n\t\t\t\t\tshapeToAdd.position.set(x + width / 2, y + height / 2);\n\t\t\t\t\tshapeToAdd.angle = rotation;\n\t\t\t\t}\n\t\t\t\tshapeToAdd.cullable = true;\n\t\t\t\tshapeToAdd.custom = true;\n\t\t\t\tshapeToAdd.renderable = false;\n\t\t\t\tshapeToAdd.uuid = uuid;\n\t\t\t\tcanvas.stage.addChild(shapeToAdd);\n\t\t\t\tthis._stageMasks.push(shapeToAdd);\n\t\t\t} else {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tshapeToAdd.obj = obj;\n\n\t\t\tconst updateMethod = (doc) => {\n\t\t\t\tif (doc !== documentObj) return;\n\t\t\t\tconst mask = maskFilter.masks.find((shape) => shape.uuid === uuid);\n\t\t\t\tif (!mask) return;\n\t\t\t\tif (!mask.custom) return;\n\t\t\t\tmask.clear();\n\t\t\t\tif (docName === \"Region\") {\n\t\t\t\t\tfor (let polygon of documentObj.polygons) {\n\t\t\t\t\t\tif (polygon.isPositive) {\n\t\t\t\t\t\t\tmask.beginFill();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmask.beginHole();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmask.drawShape(polygon);\n\t\t\t\t\t\tif (polygon.isPositive) {\n\t\t\t\t\t\t\tmask.endFill();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmask.endHole();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (docName === \"MeasuredTemplate\") {\n\t\t\t\t\tmask.position.set(documentObj.x, documentObj.y);\n\t\t\t\t\tlet maskObj = documentObj.object;\n\t\t\t\t\tshape = maskObj?.shape?.geometry?.graphicsData?.[0]?.shape ?? maskObj?.shape;\n\t\t\t\t\tshape = PluginsManager.masking({\n\t\t\t\t\t\teffect: this,\n\t\t\t\t\t\tdoc: documentObj,\n\t\t\t\t\t\tobj: maskObj,\n\t\t\t\t\t\tshape\n\t\t\t\t\t});\n\t\t\t\t\tmask.beginFill().drawShape(shape).endFill();\n\t\t\t\t} else if (docName === \"Drawing\") {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tx,\n\t\t\t\t\t\ty,\n\t\t\t\t\t\tshape: { width, height },\n\t\t\t\t\t\trotation,\n\t\t\t\t\t} = documentObj;\n\t\t\t\t\tmask.pivot.set(width / 2, height / 2);\n\t\t\t\t\tmask.position.set(x + width / 2, y + height / 2);\n\t\t\t\t\tmask.angle = rotation;\n\t\t\t\t\tlet updatedShape;\n\t\t\t\t\tif (documentObj.object) {\n\t\t\t\t\t\tupdatedShape = documentObj.object?.shape?.geometry?.graphicsData?.[0]?.shape\n\t\t\t\t\t\t\t?? documentObj.object?.shape;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tupdatedShape = canvaslib.create_drawing_mask_shape(documentObj);\n\t\t\t\t\t}\n\t\t\t\t\tif (updatedShape) mask.beginFill().drawShape(updatedShape).endFill();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tPluginsManager.maskingHooks.forEach(hook => {\n\t\t\t\thooksManager.addHook(this.uuid, hook, (doc) => {\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tupdateMethod(doc);\n\t\t\t\t\t}, 100);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\thooksManager.addHook(this.uuid, this.getHook(\"update\", uuid), (doc) => {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tupdateMethod(doc);\n\t\t\t\t}, 100);\n\t\t\t});\n\n\t\t\tmaskFilter.masks.push(shapeToAdd);\n\t\t}\n\n\t\tfor (const shapeData of maskShapes) {\n\t\t\tconst shape = canvaslib.createShape(shapeData);\n\t\t\tshape.cullable = true;\n\t\t\tshape.custom = true;\n\t\t\tshape.renderable = false;\n\t\t\tthis.spriteContainer.addChild(shape);\n\t\t\tthis.shapes[shapeData?.name ?? \"shape-\" + foundry.utils.randomID()] = shape;\n\t\t\tmaskFilter.masks.push(shape);\n\t\t}\n\n\t\tthis.sprite.filters.push(maskFilter);\n\t}\n\n\t/**\n\t * Builds the initial wall-constrained mask graphic and wires hooks that recompute\n\t * the sweep when walls change or when the attached source moves.\n\t *\n\t * @param {MaskFilter} maskFilter\n\t * @private\n\t */\n\t_setupWallMask(maskFilter) {\n\t\tconst shape = this._computeWallPolygon();\n\t\tif (!shape) return;\n\n\t\tconst graphics = new PIXI.LegacyGraphics().beginFill().drawShape(shape).endFill();\n\t\tgraphics.cullable = true;\n\t\tgraphics.custom = true;\n\t\tgraphics.renderable = false;\n\t\tgraphics.uuid = \"__constrainedByWalls\";\n\t\tcanvas.stage.addChild(graphics);\n\t\tthis._stageMasks.push(graphics);\n\t\tmaskFilter.masks.push(graphics);\n\t\tthis._wallMaskGraphics = graphics;\n\n\t\tconst recompute = () => {\n\t\t\tif (!this._wallMaskGraphics || this._ended) return;\n\t\t\tconst next = this._computeWallPolygon();\n\t\t\tif (!next) return;\n\t\t\tthis._wallMaskGraphics.clear().beginFill().drawShape(next).endFill();\n\t\t};\n\n\t\tconst debouncedRecompute = () => {\n\t\t\tif (this._wallMaskDirty) return;\n\t\t\tthis._wallMaskDirty = true;\n\t\t\tthis._setTimeout(() => {\n\t\t\t\tthis._wallMaskDirty = false;\n\t\t\t\trecompute();\n\t\t\t}, 100);\n\t\t};\n\n\t\tfor (const hook of [\"createWall\", \"updateWall\", \"deleteWall\"]) {\n\t\t\thooksManager.addHook(this.uuid, hook, debouncedRecompute);\n\t\t}\n\n\t\tif (CONSTANTS.IS_V14) {\n\t\t\tfor (const hook of [\"createLevel\", \"updateLevel\", \"deleteLevel\"]) {\n\t\t\t\thooksManager.addHook(this.uuid, hook, (level) => {\n\t\t\t\t\tif (level?.parent?.id !== this.data.sceneId) return;\n\t\t\t\t\tdebouncedRecompute();\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tconst attachedToSource = this.data.attachTo?.active && lib.is_UUID(this.data.source);\n\t\tconst sourceRefreshHook = attachedToSource && this.getSourceHook(\"refresh\");\n\t\tif (sourceRefreshHook) {\n\t\t\thooksManager.addHook(this.uuid, sourceRefreshHook, (placeable) => {\n\t\t\t\tif (placeable?.document?.uuid !== this.data.source) return;\n\t\t\t\trecompute();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Computes the wall-constrained polygon for this effect from the source position.\n\t *\n\t * @returns {PIXI.Polygon|null}\n\t * @private\n\t */\n\t_computeWallPolygon() {\n\t\tconst cfg = this.data.constrainedByWalls;\n\t\tif (!cfg) return null;\n\n\t\tconst origin = cfg.origin ?? this.sourcePosition;\n\t\tif (!origin || !lib.is_real_number(origin.x) || !lib.is_real_number(origin.y)) return null;\n\n\t\tconst elevation = lib.is_real_number(origin.elevation)\n\t\t\t? origin.elevation\n\t\t\t: canvaslib.get_object_elevation(this.source ?? this.sourceDocument ?? {});\n\n\t\treturn canvaslib.computeWallPolygon({ ...origin, elevation }, {\n\t\t\ttype: cfg.type,\n\t\t\tradius: cfg.radius,\n\t\t\tlevel: cfg.level ?? this._resolveWallSweepLevel(),\n\t\t});\n\t}\n\n\t/**\n\t * Resolves which scene Level the wall sweep should consult on Foundry v14.\n\t * Returns null on v13 (where Levels do not exist) and when no clear\n\t * affinity is available, in which case the polygon backend falls back to\n\t * `canvas.level` (the currently viewed level).\n\t *\n\t * Priority: an attached source's `document.level`, then a single-entry\n\t * `.onLevels()` selection, then the lowest-elevation Level whose vertical\n\t * range overlaps the effect.\n\t *\n\t * @returns {foundry.documents.Level|null}\n\t * @private\n\t */\n\t_resolveWallSweepLevel() {\n\t\tif (!CONSTANTS.IS_V14) return null;\n\t\tconst sceneLevels = canvas.scene?.levels;\n\t\tif (!sceneLevels?.size) return null;\n\n\t\tconst sourceDoc = this.sourceDocument;\n\t\tconst attachedLevelId = this.data.attachTo?.active ? sourceDoc?.level : null;\n\t\tif (attachedLevelId) {\n\t\t\tconst fromSource = sceneLevels.get(attachedLevelId);\n\t\t\tif (fromSource) return fromSource;\n\t\t}\n\n\t\tif (this.data.levels?.length === 1) {\n\t\t\tconst entry = this.data.levels[0];\n\t\t\tconst fromSection = sceneLevels.get(entry) ?? sceneLevels.getName?.(entry);\n\t\t\tif (fromSection) return fromSection;\n\t\t}\n\n\t\tconst [zMin, zMax, topInclusive] = this._getEffectiveVerticalExtent();\n\t\tlet best = null;\n\t\tfor (const level of sceneLevels) {\n\t\t\tconst ext = level.elevation;\n\t\t\tif (!ext) continue;\n\t\t\tif (intervalsOverlap(zMin, zMax, ext.bottom, ext.top, topInclusive)) {\n\t\t\t\tif (!best || (ext.bottom ?? -Infinity) < (best.elevation.bottom ?? -Infinity)) {\n\t\t\t\t\tbest = level;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn best;\n\t}\n\n\t/**\n\t * Sets up the hooks relating to this effect's source and target\n\t *\n\t * @private\n\t */\n\t_setupHooks() {\n\n\t\tconst attachedToSource =\n\t\t\tthis.data.attachTo?.active && lib.is_UUID(this.data.source);\n\t\tconst attachedToTarget =\n\t\t\t(this.data.stretchTo?.attachTo || this.data.rotateTowards?.attachTo) &&\n\t\t\tlib.is_UUID(this.data.target);\n\n\t\tconst baseRenderable = this.shouldPlayVisible;\n\t\tlet alpha = null;\n\n\t\tif (attachedToSource) {\n\t\t\thooksManager.addHook(this.uuid, this.getSourceHook(\"delete\"), (doc) => {\n\t\t\t\tconst uuid = doc.uuid;\n\t\t\t\tif (doc !== this.sourceDocument) return;\n\t\t\t\tthis._source = this._cachedSourceData.position;\n\t\t\t\tthis._source.uuid = uuid;\n\t\t\t\tSequencerEffectManager.objectDeleted(uuid);\n\t\t\t});\n\n\t\t\tif (this.isSourceDestroyed) {\n\t\t\t\tSequencerEffectManager.objectDeleted(this.sourceDocument.uuid);\n\t\t\t}\n\n\t\t\tif (this.data.attachTo?.bindVisibility) {\n\t\t\t\thooksManager.addHook(\n\t\t\t\t\tthis.uuid,\n\t\t\t\t\t\"sightRefresh\",\n\t\t\t\t\t() => {\n\t\t\t\t\t\tif (this._ended) return;\n\t\t\t\t\t\tconst sourceVisible =\n\t\t\t\t\t\t\tthis.source\n\t\t\t\t\t\t\t&& isAttachedPlaceableVisible(this.source)\n\t\t\t\t\t\t\t&& !this.sourceMesh?.occluded;\n\t\t\t\t\t\tconst sourceHidden =\n\t\t\t\t\t\t\tthis.sourceDocument && (this.sourceDocument?.hidden ?? false);\n\t\t\t\t\t\tconst targetVisible =\n\t\t\t\t\t\t\tthis.target\n\t\t\t\t\t\t\t&& isAttachedPlaceableVisible(this.target)\n\t\t\t\t\t\t\t&& (!attachedToTarget || (this.targetMesh?.occluded ?? true));\n\t\t\t\t\t\tthis._baseRenderable =\n\t\t\t\t\t\t\tbaseRenderable &&\n\t\t\t\t\t\t\t(!sourceHidden || game.user.isGM) &&\n\t\t\t\t\t\t\t(sourceVisible || targetVisible) &&\n\t\t\t\t\t\t\tthis._checkWallCollisions();\n\t\t\t\t\t\tthis.alpha = sourceVisible && sourceHidden ? 0.5 : 1.0;\n\t\t\t\t\t\tthis._recomputeRenderable();\n\t\t\t\t\t},\n\t\t\t\t\t{ effect: this, callNow: true }\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (this.data.attachTo?.bindAlpha || this.data.attachTo?.bindElevation) {\n\t\t\t\thooksManager.addHook(this.uuid, this.getSourceHook(\"update\"), (doc) => {\n\t\t\t\t\tif (doc !== this.sourceDocument) return;\n\t\t\t\t\tif (this.data.attachTo?.bindAlpha) {\n\t\t\t\t\t\tthis.spriteContainer.alpha = this.getSourceData().alpha;\n\t\t\t\t\t}\n\t\t\t\t\tif (this.data.attachTo?.bindElevation) {\n\t\t\t\t\t\tthis.updateElevation();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (CONSTANTS.IS_V14) {\n\t\t\t\thooksManager.addHook(this.uuid, this.getSourceHook(\"update\"), (doc, changed) => {\n\t\t\t\t\tif (doc !== this.sourceDocument) return;\n\t\t\t\t\tif (changed?.level === undefined) return;\n\t\t\t\t\tthis._recomputeRenderable();\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (this.data.attachTo?.bindAlpha) {\n\t\t\t\talpha = this.getSourceData().alpha;\n\t\t\t}\n\t\t}\n\n\t\tif (attachedToTarget) {\n\t\t\thooksManager.addHook(this.uuid, this.getTargetHook(\"delete\"), (doc) => {\n\t\t\t\tif (doc !== this.target) return;\n\t\t\t\tthis._target = this._cachedTargetData.position;\n\t\t\t\tconst uuid = doc.uuid;\n\t\t\t\tSequencerEffectManager.objectDeleted(uuid);\n\t\t\t});\n\t\t\tif (this.isTargetDestroyed) {\n\t\t\t\tSequencerEffectManager.objectDeleted(this.targetDocument.uuid);\n\t\t\t}\n\t\t\thooksManager.addHook(this.uuid, this.getTargetHook(\"update\"), (doc) => {\n\t\t\t\tif (doc !== this.target) return;\n\t\t\t\tthis.updateElevation();\n\t\t\t});\n\n\t\t\tif (CONSTANTS.IS_V14) {\n\t\t\t\thooksManager.addHook(this.uuid, this.getTargetHook(\"update\"), (doc, changed) => {\n\t\t\t\t\tif (doc !== this.targetDocument) return;\n\t\t\t\t\tif (changed?.level === undefined) return;\n\t\t\t\t\tthis._recomputeRenderable();\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Level documents can mutate independently of the viewed-level\n\t\t// switch (which redraws the whole canvas). Edits to elevation,\n\t\t// `visibility.levels`, etc. need to re-evaluate every effect.\n\t\tif (CONSTANTS.IS_V14) {\n\t\t\thooksManager.addHook(this.uuid, \"updateLevel\", (level) => {\n\t\t\t\tif (level.parent?.id !== this.data.sceneId) return;\n\t\t\t\tthis._recomputeRenderable();\n\t\t\t});\n\t\t}\n\n\t\tfor (let uuid of this.data?.tiedDocuments ?? []) {\n\t\t\tconst tiedDocument = fromUuidSync(uuid);\n\t\t\tif (tiedDocument) {\n\t\t\t\thooksManager.addHook(\n\t\t\t\t\tthis.uuid,\n\t\t\t\t\tthis.getHook(\"delete\", tiedDocument.uuid),\n\t\t\t\t\t(doc) => {\n\t\t\t\t\t\tif (tiedDocument !== doc) return;\n\t\t\t\t\t\tSequencerEffectManager.objectDeleted(doc.uuid);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis._setTimeout(() => {\n\t\t\tif (this._ended) return;\n\t\t\t// Seed _baseRenderable when no sightRefresh listener registered.\n\t\t\tif (this._baseRenderable === undefined) {\n\t\t\t\tthis._baseRenderable = baseRenderable;\n\t\t\t}\n\t\t\t// Normalize the pause gate before clearing _initializing.\n\t\t\t// A loop-end pause that fired during init would otherwise\n\t\t\t// leave _pauseRenderable === false, which the post-init\n\t\t\t// recompute reads as paused and hides the effect until the\n\t\t\t// pause cascade lands.\n\t\t\tthis._pauseRenderable = true;\n\t\t\tthis._initializing = false;\n\t\t\tthis._recomputeRenderable();\n\t\t\tif (this.spriteContainer) this.spriteContainer.alpha = alpha ?? 1.0;\n\t\t}, 25);\n\t}\n\n\t/**\n\t * Calculates the padding and scale to stretch an effect across the given distance\n\t *\n\t * If the file is a SequencerFileBase instance, it will also pick the appropriate file for the right distance\n\t *\n\t * @param {number} distance\n\t * @param {number} textureWidth\n\t * @returns {Object}\n\t * @private\n\t */\n\tasync _getDistanceScaling(distance, textureWidth) {\n\t\tif (!this._distanceCache || this._distanceCache?.distance !== distance) {\n\t\t\tlet scaleX = 1.0;\n\t\t\tlet scaleY = 1.0;\n\n\t\t\tif (this._file instanceof SequencerFileBase) {\n\n\t\t\t\tconst startPoint = this.template?.startPoint ?? 0\n\t\t\t\tconst endPoint = this.template?.endPoint ?? 0\n\t\t\t\tconst widthWithPadding = textureWidth - (startPoint + endPoint);\n\n\t\t\t\tconst spriteScale = distance / widthWithPadding\n\n\t\t\t\tscaleX = spriteScale;\n\t\t\t\tscaleY = this.data.stretchTo?.onlyX ? widthWithPadding / textureWidth : spriteScale;\n\t\t\t}\n\n\t\t\tthis._distanceCache = {\n\t\t\t\tscaleX,\n\t\t\t\tscaleY,\n\t\t\t\tdistance,\n\t\t\t};\n\t\t}\n\n\t\treturn this._distanceCache;\n\t}\n\n\t/**\n\t * Applies the distance scaling to the sprite based on the previous method\n\t *\n\t * @returns {Promise<void>}\n\t * @private\n\t */\n\tasync _applyDistanceScaling() {\n\t\tconst ray = new foundry.canvas.geometry.Ray(this.sourcePosition, this.targetPosition);\n\n\t\tthis._rotateTowards(ray);\n\n\t\tconst distance = ray.distance / (this.data.scale.x ?? 1.0);\n\n\t\tthis._updateCurrentFilePath(distance)\n\t\tawait this.sprite.activate(this._currentFilePath)\n\t\tconst texture = this.sprite.texture\n\n\t\tlet { scaleX, scaleY } = await this._getDistanceScaling(distance, texture.width);\n\n\t\tif (this.data.attachTo?.active) {\n\t\t\tconst { x, y } = this.sourcePosition;\n\t\t\tthis.position.set(x, y);\n\t\t}\n\n\t\tif (this.data.tilingTexture) {\n\t\t\tconst scaleX = (this.data.scale.x ?? 1.0);\n\t\t\tconst scaleY = (this.data.scale.y ?? 1.0);\n\t\t\tthis.sprite.scale.set(scaleX * this.flipX, scaleY * this.flipY);\n\t\t\tthis.sprite.width = distance * scaleX;\n\t\t\tthis.sprite.height = texture.height * scaleY;\n\n\t\t\tthis.sprite.tileScale.x = this.data.tilingTexture.scale.x * scaleX;\n\t\t\tthis.sprite.tileScale.y = this.data.tilingTexture.scale.y * scaleY;\n\t\t\tthis.sprite.tilePosition = this.data.tilingTexture.position;\n\t\t} else {\n\t\t\tthis.sprite.scale.set(\n\t\t\t\tscaleX * (this.data.scale.x ?? 1.0) * this.flipX,\n\t\t\t\tscaleY * (this.data.scale.y ?? 1.0) * this.flipY\n\t\t\t);\n\t\t}\n\n\t}\n\n\t_setAnchors() {\n\t\tlet anchor = { x: 0.5, y: 0.5, ...(this.data.spriteAnchor ?? null) }\n\n\t\tif (\n\t\t\t(this.data.rotateTowards && this.data.rotateTowards.template) ||\n\t\t\tthis.data.stretchTo\n\t\t) {\n\t\t\tconst textureWidth = this.sprite.texture?.width ?? this.sprite.width;\n\t\t\tconst templateAnchorX = this.template ? this.template.startPoint / textureWidth : undefined;\n\t\t\tanchor = { x: templateAnchorX, y: 0.5 }\n\t\t}\n\t\tif (this.data.rotateTowards && !this.data.rotateTowards.template && !this.data.anchor) {\n\t\t\tthis.spriteContainer.pivot.set(this.sprite.width * -0.5, 0);\n\t\t} else {\n\t\t\tthis.spriteContainer.pivot.set(\n\t\t\t\tlib.interpolate(\n\t\t\t\t\tthis.sprite.width * -0.5,\n\t\t\t\t\tthis.sprite.width * 0.5,\n\t\t\t\t\tthis.data.anchor?.x ?? 0.5\n\t\t\t\t),\n\t\t\t\tlib.interpolate(\n\t\t\t\t\tthis.sprite.height * -0.5,\n\t\t\t\t\tthis.sprite.height * 0.5,\n\t\t\t\t\tthis.data.anchor?.y ?? 0.5\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tthis.sprite.anchor?.set(\n\t\t\tthis.flipX === 1 ? anchor.x : 1 - anchor.x,\n\t\t\tanchor.y\n\t\t);\n\t}\n\n\t_checkWallCollisions() {\n\t\tif (\n\t\t\t!this.data.stretchTo?.attachTo ||\n\t\t\t!this.data.stretchTo?.requiresLineOfSight\n\t\t)\n\t\t\treturn true;\n\n\t\tconst ray = new foundry.canvas.geometry.Ray(this.sourcePosition, this.targetPosition);\n\n\t\tconst blockingObjects = canvas.walls.checkCollision(ray, { type: \"sight\" });\n\n\t\tif (!blockingObjects.length && !this.data.stretchTo?.hideLineOfSight) {\n\t\t\tSequencerEffectManager.endEffects({ effects: this });\n\t\t}\n\n\t\treturn !blockingObjects.length;\n\t}\n\n\t/**\n\t * Rotates the effect towards the target\n\t *\n\t * @param ray\n\t * @private\n\t */\n\t_rotateTowards(ray) {\n\t\tif (!ray) {\n\t\t\tconst sourcePosition =\n\t\t\t\tthis.flipX === 1 ? this.sourcePosition : this.targetPosition;\n\t\t\tconst targetPosition =\n\t\t\t\tthis.flipX === 1 ? this.targetPosition : this.sourcePosition;\n\t\t\tray = new foundry.canvas.geometry.Ray(sourcePosition, targetPosition);\n\t\t}\n\n\t\tthis.rotationContainer.rotation = Math.normalizeRadians(\n\t\t\tray.angle + Math.toRadians(this.data.rotateTowards?.rotationOffset ?? 0)\n\t\t);\n\n\t\tPluginsManager.rotation({ effect: this });\n\t}\n\n\t/**\n\t * Transforms the sprite, rotating it, stretching it, scaling it, sizing it according its data\n\t *\n\t * @private\n\t */\n\tasync _transformSprite() {\n\t\tif (this.data.stretchTo) {\n\t\t\tawait this._applyDistanceScaling();\n\t\t}\n\n\t\tif (!this.data.stretchTo) {\n\t\t\tthis._transformNoStretchSprite();\n\t\t}\n\n\t\tif (!this.data.screenSpace && (!this.data.attachTo?.active || this.data.stretchTo?.attachTo)) {\n\t\t\tconst { x, y } = this.sourcePosition;\n\t\t\tthis.position.set(x, y);\n\t\t}\n\n\t\tif (this.data.rotateTowards) {\n\t\t\tthis._rotateTowards();\n\t\t}\n\n\t\tthis._setAnchors()\n\t\tPluginsManager.rotation({ effect: this });\n\t\tthis.sprite.updateDefaultScaling()\n\t}\n\n\tasync _transformStretchToAttachedSprite() {\n\t\ttry {\n\t\t\tawait this._applyDistanceScaling();\n\t\t\tthis._setAnchors()\n\t\t} catch (err) {\n\t\t\t//lib.debug_error(err);\n\t\t}\n\t}\n\n\t_transformNoStretchSprite() {\n\t\tif (this.data.tilingTexture) {\n\t\t\tthis.sprite.tileScale = {\n\t\t\t\tx: this.data.tilingTexture.scale.x * this.gridSizeDifference,\n\t\t\t\ty: this.data.tilingTexture.scale.y * this.gridSizeDifference,\n\t\t\t};\n\n\t\t\tthis.sprite.tilePosition = this.data.tilingTexture.position;\n\t\t}\n\n\t\tconst { heightWidthRatio, widthHeightRatio, baseScaleX, baseScaleY } = this._getBaseScale()\n\n\t\tif (this.data.scaleToObject) {\n\t\t\tthis._applyScaleToObject(heightWidthRatio, widthHeightRatio, baseScaleX, baseScaleY);\n\n\t\t} else if (this.data.size) {\n\n\t\t\tlet { height, width } = this.data.size;\n\n\t\t\tif (this.data.size.width === \"auto\" || this.data.size.height === \"auto\") {\n\t\t\t\theight = this.sprite.height;\n\t\t\t\twidth = this.sprite.width;\n\n\t\t\t\tif (this.data.size.width === \"auto\") {\n\t\t\t\t\theight = this.data.size.height;\n\t\t\t\t\tif (this.data.size.gridUnits) {\n\t\t\t\t\t\theight *= canvas.grid.size;\n\t\t\t\t\t}\n\t\t\t\t\twidth = height * widthHeightRatio;\n\t\t\t\t} else if (this.data.size.height === \"auto\") {\n\t\t\t\t\twidth = this.data.size.width;\n\t\t\t\t\tif (this.data.size.gridUnits) {\n\t\t\t\t\t\twidth *= canvas.grid.size;\n\t\t\t\t\t}\n\t\t\t\t\theight = width * heightWidthRatio;\n\t\t\t\t}\n\t\t\t} else if (this.data.size.gridUnits) {\n\t\t\t\theight *= canvas.grid.size;\n\t\t\t\twidth *= canvas.grid.size;\n\t\t\t}\n\n\t\t\tthis.sprite.width = width * baseScaleX;\n\t\t\tthis.sprite.height = height * baseScaleY;\n\t\t} else if (this.data.screenSpace) {\n\t\t\tthis.sprite.scale.set(\n\t\t\t\tbaseScaleX,\n\t\t\t\tbaseScaleY\n\t\t\t);\n\t\t} else {\n\t\t\tthis.sprite.scale.set(\n\t\t\t\tbaseScaleX * this.gridSizeDifference,\n\t\t\t\tbaseScaleY * this.gridSizeDifference\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Calculate the base scale and aspect ratios of the sprite\n\t *\n\t * @returns {{heightWidthRatio: number, widthHeightRatio: number, baseScaleX: number, baseScaleY: number}}\n\t *\n\t * @private\n\t */\n\t_getBaseScale() {\n\t\tconst heightWidthRatio = this.sprite.height / this.sprite.width;\n\t\tconst widthHeightRatio = this.sprite.width / this.sprite.height;\n\n\t\tconst baseScaleX =\n\t\t\t(this.data.scale?.x ?? 1.0) *\n\t\t\t(this.data.spriteScale?.x ?? 1.0) *\n\t\t\tthis.flipX;\n\t\tconst baseScaleY =\n\t\t\t(this.data.scale?.y ?? 1.0) *\n\t\t\t(this.data.spriteScale?.y ?? 1.0) *\n\t\t\tthis.flipY;\n\n\t\treturn {\n\t\t\theightWidthRatio,\n\t\t\twidthHeightRatio,\n\t\t\tbaseScaleX,\n\t\t\tbaseScaleY,\n\t\t}\n\t}\n\n\t_applyScaleToObject(heightWidthRatio, widthHeightRatio, baseScaleX, baseScaleY) {\n\t\ttry {\n\t\t\tlet { width, height } = this.getSourceData();\n\n\t\t\tif (this.sourceDocument instanceof TokenDocument) {\n\t\t\t\twidth *= this.data.scaleToObject?.considerTokenScale\n\t\t\t\t\t? this.sourceDocument.texture.scaleX\n\t\t\t\t\t: 1.0;\n\t\t\t\theight *= this.data.scaleToObject?.considerTokenScale\n\t\t\t\t\t? this.sourceDocument.texture.scaleY\n\t\t\t\t\t: 1.0;\n\t\t\t}\n\n\t\t\tif (width === this._lastDimensions.width && height === this._lastDimensions.height) return;\n\n\t\t\tthis._lastDimensions = { width, height };\n\n\t\t\tconst ratioToUse = heightWidthRatio > widthHeightRatio;\n\n\t\t\tif (this.data.scaleToObject?.uniform) {\n\t\t\t\tlet newWidth = Math.max(width, height);\n\t\t\t\theight = Math.max(width, height);\n\t\t\t\twidth = newWidth;\n\t\t\t} else {\n\t\t\t\twidth = width * (ratioToUse ? widthHeightRatio : 1.0);\n\t\t\t\theight = height * (!ratioToUse ? heightWidthRatio : 1.0);\n\t\t\t}\n\n\t\t\tthis.sprite.width = width * (this.data.scaleToObject?.scale ?? 1.0) * baseScaleX;\n\t\t\tthis.sprite.height = height * (this.data.scaleToObject?.scale ?? 1.0) * baseScaleY;\n\n\t\t\tSequencerAnimationEngine.updateStartValues(this.sprite, \"width\");\n\t\t\tSequencerAnimationEngine.updateStartValues(this.sprite, \"height\");\n\t\t\tSequencerAnimationEngine.updateStartValues(this.sprite, \"scale.x\");\n\t\t\tSequencerAnimationEngine.updateStartValues(this.sprite, \"scale.y\");\n\n\t\t} catch (err) {\n\n\t\t}\n\n\t}\n\n\t_transformAttachedNoStretchSprite() {\n\n\t\tif (this.isDestroyed) return;\n\n\t\tconst applyRotation =\n\t\t\tthis.data.attachTo?.bindRotation &&\n\t\t\t!(\n\t\t\t\tthis.sourceDocument instanceof TokenDocument &&\n\t\t\t\tthis.sourceDocument.lockRotation\n\t\t\t) &&\n\t\t\t(this.sourceDocument?.rotation !== undefined ||\n\t\t\t\tthis.sourceDocument?.direction !== undefined) &&\n\t\t\t!this.data.rotateTowards &&\n\t\t\t!this.data.stretchTo;\n\n\t\tconst sourceData = this.getSourceData();\n\t\tif (applyRotation) {\n\t\t\tthis.rotationContainer.rotation = sourceData.rotation;\n\t\t}\n\n\t\tPluginsManager.rotation({ effect: this });\n\n\t\tconst { x, y } = this._resolveSourcePosition(sourceData);\n\t\tthis.position.set(x, y);\n\t}\n\n\t_transformRotateTowardsAttachedSprite() {\n\t\tif (this.isDestroyed) return;\n\t\ttry {\n\t\t\tthis._rotateTowards();\n\t\t\tthis._setAnchors()\n\t\t} catch (err) {\n\t\t\tlib.debug_error(err);\n\t\t}\n\t}\n\n\t/**\n\t * Provided an animation targeting the rotation of the sprite's primary container, this method will counter-rotate\n\t * the sprite in an equal fashion so that the sprite's rotation remains static relative to this animation\n\t *\n\t * @param animation\n\t * @returns {*[]}\n\t * @private\n\t */\n\t_counterAnimateRotation(animation) {\n\t\tif (\n\t\t\tanimation.target === this.spriteContainer &&\n\t\t\tthis.data.zeroSpriteRotation\n\t\t) {\n\t\t\tdelete animation.target;\n\t\t\tlet counterAnimation = foundry.utils.deepClone(animation);\n\t\t\tanimation.target = this.spriteContainer;\n\t\t\tcounterAnimation.target = this.sprite;\n\t\t\tif (counterAnimation.values) {\n\t\t\t\tcounterAnimation.values = counterAnimation.values.map(\n\t\t\t\t\t(value) => value * -1\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tcounterAnimation.from *= -1;\n\t\t\t\tcounterAnimation.to *= -1;\n\t\t\t}\n\t\t\tif (!Array.isArray(animation)) {\n\t\t\t\tanimation = [animation, counterAnimation];\n\t\t\t} else {\n\t\t\t\tanimation.push(counterAnimation);\n\t\t\t}\n\t\t}\n\n\t\treturn animation;\n\t}\n\n\t/**\n\t * Plays the custom animations of this effect\n\t *\n\t * @returns {number}\n\t * @private\n\t */\n\t_playCustomAnimations() {\n\t\tif (!this.data.animations) return 0;\n\n\t\tthis._playAnimations(\n\t\t\tfoundry.utils.deepClone(this.data.animations) ?? [],\n\t\t\tthis.actualCreationTime - this.creationTimestamp\n\t\t);\n\t}\n\n\t_playAnimations(animations, timeDifference = 0) {\n\t\tlet animationsToSend = [];\n\n\t\tconst oneShotAnimations = animations.filter(\n\t\t\t(animation) => !animation.looping && !animation.fromEnd\n\t\t);\n\n\t\tfor (let animation of oneShotAnimations) {\n\t\t\tif (animation.target === 'alphaFilter') {\n\t\t\t\tanimation.target = this\n\t\t\t\tanimation.propertyName = 'effectAlpha'\n\t\t\t} else if (animation.target === \"effect\") {\n\t\t\t\tanimation.target = this;\n\t\t\t} else {\n\t\t\t\tanimation.target = foundry.utils.getProperty(this, animation.target);\n\t\t\t}\n\n\t\t\tif (!animation.target) continue;\n\n\t\t\tif (animation.propertyName.indexOf(\"rotation\") > -1) {\n\t\t\t\tanimation.from = animation.from * (Math.PI / 180);\n\t\t\t\tanimation.to = animation.to * (Math.PI / 180);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t[\"position.x\", \"position.y\", \"height\", \"width\"].includes(\n\t\t\t\t\tanimation.propertyName\n\t\t\t\t) &&\n\t\t\t\tanimation.gridUnits\n\t\t\t) {\n\t\t\t\tanimation.from *= canvas.grid.size;\n\t\t\t\tanimation.to *= canvas.grid.size;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t[\"position.x\", \"position.y\", \"height\", \"width\"].includes(\n\t\t\t\t\tanimation.propertyName\n\t\t\t\t) &&\n\t\t\t\tanimation.screenSpace\n\t\t\t) {\n\t\t\t\tconst [screenWidth, screenHeight] = canvas.screenDimensions;\n\t\t\t\tconst dimension = animation.propertyName === \"position.x\" || animation.propertyName === \"width\"\n\t\t\t\t\t? screenWidth\n\t\t\t\t\t: screenHeight;\n\t\t\t\tanimation.from *= dimension;\n\t\t\t\tanimation.to *= dimension;\n\t\t\t}\n\n\t\t\tif ([\"hue\"].includes(animation.propertyName)) {\n\t\t\t\tanimation.getPropertyName = \"values.\" + animation.propertyName;\n\t\t\t}\n\n\t\t\tanimationsToSend = animationsToSend.concat(\n\t\t\t\tthis._counterAnimateRotation(animation)\n\t\t\t);\n\t\t}\n\n\t\tconst loopingAnimations = animations.filter(\n\t\t\t(animation) => animation.looping\n\t\t);\n\n\t\tfor (let animation of loopingAnimations) {\n\t\t\tif (animation.target === 'alphaFilter') {\n\t\t\t\tanimation.target = this\n\t\t\t\tanimation.propertyName = 'effectAlpha'\n\t\t\t} else if (animation.target === \"effect\") {\n\t\t\t\tanimation.target = this;\n\t\t\t} else {\n\t\t\t\tanimation.target = foundry.utils.getProperty(this, animation.target);\n\t\t\t}\n\n\t\t\tif (!animation.target) continue;\n\n\t\t\tif (animation.propertyName.indexOf(\"rotation\") > -1) {\n\t\t\t\tanimation.values = animation.values.map((angle) => {\n\t\t\t\t\treturn angle * (Math.PI / 180);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t[\"position.x\", \"position.y\", \"height\", \"width\"].includes(\n\t\t\t\t\tanimation.propertyName\n\t\t\t\t) &&\n\t\t\t\tanimation.gridUnits\n\t\t\t) {\n\t\t\t\tanimation.values = animation.values.map((value) => {\n\t\t\t\t\treturn value * canvas.grid.size;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif ([\"hue\"].includes(animation.propertyName)) {\n\t\t\t\tanimation.getPropertyName = \"values.\" + animation.propertyName;\n\t\t\t}\n\n\t\t\tanimationsToSend = animationsToSend.concat(\n\t\t\t\tthis._counterAnimateRotation(animation)\n\t\t\t);\n\t\t}\n\n\t\tif (!(this instanceof PersistentCanvasEffect)) {\n\t\t\tanimationsToSend = animationsToSend.concat(\n\t\t\t\tthis._getFromEndCustomAnimations()\n\t\t\t);\n\t\t}\n\n\t\tsetTimeout(() => {\n\t\t\tSequencerAnimationEngine.addAnimation(\n\t\t\t\tthis.id,\n\t\t\t\tanimationsToSend,\n\t\t\t\ttimeDifference\n\t\t\t);\n\t\t}, 20);\n\t}\n\n\t_getFromEndCustomAnimations(immediate = false) {\n\t\tlet fromEndAnimations = [];\n\n\t\tconst animations = foundry.utils.deepClone(this.data.animations) ?? [];\n\n\t\tconst oneShotEndingAnimations = animations.filter(\n\t\t\t(animation) => !animation.looping && animation.fromEnd\n\t\t);\n\n\t\tfor (let animation of oneShotEndingAnimations) {\n\t\t\tanimation.target = foundry.utils.getProperty(this, animation.target);\n\n\t\t\tif (!animation.target) continue;\n\n\t\t\tanimation.delay = lib.is_real_number(immediate)\n\t\t\t\t? Math.max(immediate - animation.duration + animation.delay, 0)\n\t\t\t\t: Math.max(\n\t\t\t\t\tthis._totalDuration - animation.duration + animation.delay,\n\t\t\t\t\t0\n\t\t\t\t);\n\n\t\t\tif (animation.propertyName.indexOf(\"rotation\") > -1) {\n\t\t\t\tanimation.from = animation.from * (Math.PI / 180);\n\t\t\t\tanimation.to = animation.to * (Math.PI / 180);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t[\"position.x\", \"position.y\", \"height\", \"width\"].includes(\n\t\t\t\t\tanimation.propertyName\n\t\t\t\t) &&\n\t\t\t\tanimation.gridUnits\n\t\t\t) {\n\t\t\t\tanimation.from *= canvas.grid.size;\n\t\t\t\tanimation.to *= canvas.grid.size;\n\t\t\t}\n\n\t\t\tfromEndAnimations = fromEndAnimations.concat(\n\t\t\t\tthis._counterAnimateRotation(animation)\n\t\t\t);\n\t\t}\n\n\t\treturn fromEndAnimations;\n\t}\n\n\t/**\n\t * Fades in the effect at the start of the effect\n\t *\n\t * @returns {number|*}\n\t * @private\n\t */\n\t_fadeIn() {\n\t\tif (!this.data.fadeIn || !this.sprite) return 0;\n\n\t\tlet fadeIn = this.data.fadeIn;\n\n\t\tif (\n\t\t\tthis.actualCreationTime -\n\t\t\t(this.creationTimestamp + fadeIn.duration + fadeIn.delay) >\n\t\t\t0\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.effectAlpha = 0.0;\n\n\t\tSequencerAnimationEngine.addAnimation(this.id, {\n\t\t\ttarget: this,\n\t\t\tpropertyName: \"effectAlpha\",\n\t\t\tto: this.data.opacity,\n\t\t\tduration: fadeIn.duration,\n\t\t\tease: fadeIn.ease,\n\t\t\tdelay: fadeIn.delay,\n\t\t\tabsolute: true,\n\t\t});\n\n\t\treturn fadeIn.duration + fadeIn.delay;\n\t}\n\n\t/**\n\t * Fades in the effect's audio at the start of the effect\n\t *\n\t * @returns {number|*}\n\t * @private\n\t */\n\t_fadeInAudio() {\n\t\tif (!this.data.fadeInAudio || !this.sprite || !this.sprite.hasAnimatedMedia) return 0;\n\n\t\tlet fadeInAudio = this.data.fadeInAudio;\n\n\t\tif (\n\t\t\tthis.actualCreationTime -\n\t\t\t(this.creationTimestamp +\n\t\t\t\tfadeInAudio.duration +\n\t\t\t\tfadeInAudio.delay) >\n\t\t\t0\n\t\t)\n\t\t\treturn;\n\n\t\tthis.sprite.volume = 0.0;\n\n\t\tSequencerAnimationEngine.addAnimation(this.id, {\n\t\t\ttarget: this.sprite,\n\t\t\tpropertyName: \"volume\",\n\t\t\tto:\n\t\t\t\t(this.data.volume ?? 0) *\n\t\t\t\tgame.settings.get(\"core\", \"globalInterfaceVolume\"),\n\t\t\tduration: fadeInAudio.duration,\n\t\t\tease: fadeInAudio.ease,\n\t\t\tdelay: fadeInAudio.delay,\n\t\t\tabsolute: true,\n\t\t});\n\n\t\treturn fadeInAudio.duration + fadeInAudio.delay;\n\t}\n\n\t/**\n\t * Fades out the effect at the end of the effect's duration\n\t *\n\t * @returns {number|*}\n\t * @private\n\t */\n\t_fadeOut(immediate = false) {\n\t\tif (!this.data.fadeOut || !this.sprite) return 0;\n\n\t\tconst fadeOut = this.data.fadeOut;\n\t\tconst delay = lib.is_real_number(immediate)\n\t\t\t? Math.max(immediate - fadeOut.duration + fadeOut.delay, 0)\n\t\t\t: Math.max(this._totalDuration - fadeOut.duration + fadeOut.delay, 0);\n\n\t\tSequencerAnimationEngine.addAnimation(this.id, {\n\t\t\ttarget: this,\n\t\t\tpropertyName: \"effectAlpha\",\n\t\t\tto: 0.0,\n\t\t\tduration: fadeOut.duration,\n\t\t\tease: fadeOut.ease,\n\t\t\tdelay,\n\t\t\tabsolute: true,\n\t\t});\n\n\t\treturn fadeOut.duration + delay;\n\t}\n\n\t/**\n\t * Fades out the effect at the end of the effect's duration\n\t *\n\t * @returns {number|*}\n\t * @private\n\t */\n\t_fadeOutAudio(immediate = false) {\n\t\tif (!this.data.fadeOutAudio || !this.sprite || !this.sprite.hasAnimatedMedia) return 0;\n\n\t\tconst fadeOutAudio = this.data.fadeOutAudio;\n\t\tconst delay = lib.is_real_number(immediate)\n\t\t\t? Math.max(immediate - fadeOutAudio.duration + fadeOutAudio.delay, 0)\n\t\t\t: Math.max(\n\t\t\t\tthis._totalDuration - fadeOutAudio.duration + fadeOutAudio.delay,\n\t\t\t\t0\n\t\t\t);\n\n\t\tsetTimeout(() => {\n\t\t\tSequencerAnimationEngine.addAnimation(this.id, {\n\t\t\t\ttarget: this.sprite,\n\t\t\t\tpropertyName: \"volume\",\n\t\t\t\tto: 0.0,\n\t\t\t\tduration: fadeOutAudio.duration,\n\t\t\t\tease: fadeOutAudio.ease,\n\t\t\t\tdelay,\n\t\t\t\tabsolute: true,\n\t\t\t});\n\t\t});\n\n\t\treturn fadeOutAudio.duration + delay;\n\t}\n\n\t/**\n\t * Determines the scale to animate from or to\n\t * @param property\n\t * @returns {{x: number, y: number}}\n\t * @private\n\t */\n\t_determineScale(property) {\n\t\tlet scale = {\n\t\t\tx: this.sprite.scale.x,\n\t\t\ty: this.sprite.scale.y,\n\t\t};\n\n\t\tif (lib.is_real_number(property.value)) {\n\t\t\tscale.x *= property.value * this.gridSizeDifference * this.flipX;\n\t\t\tscale.y *= property.value * this.gridSizeDifference * this.flipY;\n\t\t} else {\n\t\t\tscale.x *= property.value.x * this.gridSizeDifference * this.flipX;\n\t\t\tscale.y *= property.value.y * this.gridSizeDifference * this.flipY;\n\t\t}\n\n\t\treturn scale;\n\t}\n\n\t/**\n\t * Scales the effect in at the start of the effect\n\t *\n\t * @returns {number|*}\n\t * @private\n\t */\n\t_scaleIn() {\n\t\tif (!this.data.scaleIn || !this.sprite) return 0;\n\n\t\tlet scaleIn = this.data.scaleIn;\n\t\tlet fromScale = this._determineScale(scaleIn);\n\n\t\tif (\n\t\t\tthis.actualCreationTime -\n\t\t\t(this.creationTimestamp + scaleIn.duration + scaleIn.delay) >\n\t\t\t0\n\t\t)\n\t\t\treturn;\n\n\t\tlet toScale = {\n\t\t\tx: this.sprite.scale.x,\n\t\t\ty: this.sprite.scale.y,\n\t\t};\n\n\t\tthis.sprite.scale.set(fromScale.x, fromScale.y);\n\n\t\tSequencerAnimationEngine.addAnimation(this.id, [\n\t\t\t{\n\t\t\t\ttarget: this.sprite,\n\t\t\t\tpropertyName: \"scale.x\",\n\t\t\t\tfrom: fromScale.x,\n\t\t\t\tto: toScale.x,\n\t\t\t\tduration: scaleIn.duration,\n\t\t\t\tease: scaleIn.ease,\n\t\t\t\tdelay: scaleIn.delay,\n\t\t\t\tabsolute: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\ttarget: this.sprite,\n\t\t\t\tpropertyName: \"scale.y\",\n\t\t\t\tfrom: fromScale.y,\n\t\t\t\tto: toScale.y,\n\t\t\t\tduration: scaleIn.duration,\n\t\t\t\tease: scaleIn.ease,\n\t\t\t\tdelay: scaleIn.delay,\n\t\t\t\tabsolute: true,\n\t\t\t},\n\t\t]);\n\n\t\treturn scaleIn.duration + scaleIn.delay;\n\t}\n\n\t/**\n\t * Scales the effect out at the end of the effect's duration\n\t *\n\t * @returns {number|*}\n\t * @private\n\t */\n\t_scaleOut(immediate = false) {\n\t\tif (!this.data.scaleOut || !this.sprite) return 0;\n\n\t\tconst scaleOut = this.data.scaleOut;\n\t\tconst scale = this._determineScale(scaleOut);\n\n\t\tconst delay = lib.is_real_number(immediate)\n\t\t\t? Math.max(immediate - scaleOut.duration + scaleOut.delay, 0)\n\t\t\t: Math.max(\n\t\t\t\tthis._totalDuration - scaleOut.duration + scaleOut.delay,\n\t\t\t\t0\n\t\t\t);\n\n\t\tSequencerAnimationEngine.addAnimation(this.id, [\n\t\t\t{\n\t\t\t\ttarget: this.sprite,\n\t\t\t\tpropertyName: \"scale.x\",\n\t\t\t\tto: scale.x,\n\t\t\t\tduration: scaleOut.duration,\n\t\t\t\tease: scaleOut.ease,\n\t\t\t\tdelay,\n\t\t\t\tabsolute: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\ttarget: this.sprite,\n\t\t\t\tpropertyName: \"scale.y\",\n\t\t\t\tto: scale.y,\n\t\t\t\tduration: scaleOut.duration,\n\t\t\t\tease: scaleOut.ease,\n\t\t\t\tdelay,\n\t\t\t\tabsolute: true,\n\t\t\t},\n\t\t]);\n\n\t\treturn scaleOut.duration + delay;\n\t}\n\n\t/**\n\t * Rotates the effect in at the start of the effect\n\t *\n\t * @returns {number|*}\n\t * @private\n\t */\n\t_rotateIn() {\n\t\tif (!this.data.rotateIn || !this.sprite) return 0;\n\n\t\tlet rotateIn = this.data.rotateIn;\n\n\t\tif (\n\t\t\tthis.actualCreationTime -\n\t\t\t(this.creationTimestamp + rotateIn.duration + rotateIn.delay) >\n\t\t\t0\n\t\t)\n\t\t\treturn;\n\n\t\tlet original_radians = this.spriteContainer.rotation;\n\t\tthis.spriteContainer.rotation = rotateIn.value * (Math.PI / 180);\n\n\t\tSequencerAnimationEngine.addAnimation(\n\t\t\tthis.id,\n\t\t\tthis._counterAnimateRotation({\n\t\t\t\ttarget: this.spriteContainer,\n\t\t\t\tpropertyName: \"rotation\",\n\t\t\t\tto: original_radians,\n\t\t\t\tduration: rotateIn.duration,\n\t\t\t\tease: rotateIn.ease,\n\t\t\t\tdelay: rotateIn.delay,\n\t\t\t\tabsolute: true,\n\t\t\t})\n\t\t);\n\n\t\treturn rotateIn.duration + rotateIn.delay;\n\t}\n\n\t/**\n\t * Rotates the effect out at the end of the effect's duration\n\t *\n\t * @returns {number|*}\n\t * @private\n\t */\n\t_rotateOut(immediate = false) {\n\t\tif (!this.data.rotateOut || !this.sprite) return 0;\n\n\t\tconst rotateOut = this.data.rotateOut;\n\n\t\tconst delay = lib.is_real_number(immediate)\n\t\t\t? Math.max(immediate - rotateOut.duration + rotateOut.delay, 0)\n\t\t\t: Math.max(\n\t\t\t\tthis._totalDuration - rotateOut.duration + rotateOut.delay,\n\t\t\t\t0\n\t\t\t);\n\n\t\tSequencerAnimationEngine.addAnimation(\n\t\t\tthis.id,\n\t\t\tthis._counterAnimateRotation({\n\t\t\t\ttarget: this.spriteContainer,\n\t\t\t\tpropertyName: \"rotation\",\n\t\t\t\tto: rotateOut.value * (Math.PI / 180),\n\t\t\t\tduration: rotateOut.duration,\n\t\t\t\tease: rotateOut.ease,\n\t\t\t\tdelay,\n\t\t\t\tabsolute: true,\n\t\t\t})\n\t\t);\n\n\t\treturn rotateOut.duration + delay;\n\t}\n\n\t/**\n\t * Causes the effect to move towards the given location\n\t *\n\t * @returns {number|*}\n\t * @private\n\t */\n\t_moveTowards() {\n\t\tif (!this.data.moves || !this.sprite) return 0;\n\n\t\tlet moves = this.data.moves;\n\n\t\tconst targetPos = this.targetPosition;\n\n\t\tlet movementDuration = this._totalDuration;\n\t\tif (this.data.moveSpeed) {\n\t\t\tconst distance = canvaslib.distance_between(\n\t\t\t\tthis.sourcePosition,\n\t\t\t\ttargetPos\n\t\t\t);\n\t\t\tmovementDuration = (distance / this.data.moveSpeed) * 1000;\n\t\t}\n\n\t\tif (this.data.moves.rotate) this._rotateTowards();\n\n\t\tconst duration = movementDuration - moves.delay;\n\n\t\tif (\n\t\t\tthis.actualCreationTime -\n\t\t\t(this.creationTimestamp + duration + moves.delay) >\n\t\t\t0\n\t\t)\n\t\t\treturn;\n\n\t\tSequencerAnimationEngine.addAnimation(this.id, [\n\t\t\t{\n\t\t\t\ttarget: this,\n\t\t\t\tpropertyName: \"position.x\",\n\t\t\t\tto: targetPos.x,\n\t\t\t\tduration: duration,\n\t\t\t\tease: moves.ease,\n\t\t\t\tdelay: moves.delay,\n\t\t\t\tabsolute: true\n\t\t\t},\n\t\t\t{\n\t\t\t\ttarget: this,\n\t\t\t\tpropertyName: \"position.y\",\n\t\t\t\tto: targetPos.y,\n\t\t\t\tduration: duration,\n\t\t\t\tease: moves.ease,\n\t\t\t\tdelay: moves.delay,\n\t\t\t\tabsolute: true\n\t\t\t},\n\t\t]);\n\n\t\treturn duration + moves.delay;\n\t}\n\n\t/**\n\t * If this effect is temporary, this sets the timeout for when the effect should resolve and get removed;\n\t *\n\t * @private\n\t */\n\t_setEndTimeout() {\n\t\tthis._setTimeout(() => {\n\t\t\tthis._resolve(this.data);\n\t\t\tthis.endEffect();\n\t\t}, this._totalDuration);\n\t}\n\n\t_setupTimestampHook(offset) {\n\t\tif (!this._file?.originalMetadata?.timestamps || this._ended) return;\n\t\tconst timestamps = this._file.getTimestamps();\n\t\tconst timestampArray = Array.isArray(timestamps)\n\t\t\t? timestamps\n\t\t\t: [timestamps];\n\t\tfor (const timestamp of timestampArray) {\n\t\t\tif (!lib.is_real_number(timestamp)) continue;\n\t\t\tlet realTimestamp = timestamp - offset / this.mediaPlaybackRate;\n\t\t\tif (realTimestamp < 0) {\n\t\t\t\trealTimestamp += this._endTime;\n\t\t\t}\n\t\t\tthis._setTimeout(() => {\n\t\t\t\tif (this._ended) return;\n\t\t\t\tHooks.callAll(\"sequencerEffectTimestamp\", this, this._file);\n\t\t\t\tif (this.mediaLooping) {\n\t\t\t\t\tconst offsets = (this._endTime - this.mediaCurrentTime) * -1000;\n\t\t\t\t\tthis._setupTimestampHook(offsets);\n\t\t\t\t}\n\t\t\t}, realTimestamp);\n\t\t}\n\t}\n\n\t/**\n\t * Starts the loop of this effect, calculating the difference between the effect's creation time, and the actual\n\t * creation time on the client\n\t *\n\t * @returns {Promise<void>}\n\t * @private\n\t */\n\tasync _startEffect() {\n\n\t\tif (!this.hasAnimatedMedia) return;\n\n\t\tlet creationTimeDifference = this.data.persist ? this.actualCreationTime - this.creationTimestamp : 0;\n\t\tcreationTimeDifference *= this.mediaPlaybackRate\n\n\t\t// +1 because \"loops: 1\" means we run the animation one time, not that it restarts once\n\t\t// whereas 0 means endless looping.\n\t\tthis._currentLoops = Math.floor(creationTimeDifference / this._totalDuration) + 1;\n\n\t\tif (this.loops && this._currentLoops > this.loops) {\n\t\t\tif (this.data.loopOptions?.endOnLastLoop || !this.data.persist) {\n\t\t\t\treturn this.endEffect();\n\t\t\t}\n\t\t\tawait this.pauseMedia();\n\t\t\tthis.mediaCurrentTime = this._endTime;\n\t\t\tif (this.sprite.texture) {\n\t\t\t\tthis._pauseRenderable = false;\n\t\t\t\tthis._recomputeRenderable();\n\t\t\t\tthis._setTimeout(() => {\n\t\t\t\t\tthis.updateTexture();\n\t\t\t\t\tthis._setTimeout(() => {\n\t\t\t\t\t\tthis._pauseRenderable = true;\n\t\t\t\t\t\tthis._recomputeRenderable();\n\t\t\t\t\t}, 150)\n\t\t\t\t}, 150);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\treturn this._startLoop(creationTimeDifference);\n\t}\n\n\t/**\n\t * Kicks off the loop, or just sets the video to loop\n\t *\n\t * @param creationTimeDifference\n\t * @returns {Promise<void>}\n\t * @private\n\t */\n\tasync _startLoop(creationTimeDifference) {\n\t\tif (!this._animationTimes.loopStart) {\n\t\t\tthis._loopOffset =\n\t\t\t\t(creationTimeDifference % this._animationDuration) / 1000;\n\t\t} else if ((creationTimeDifference / 1000) > this._animationTimes.loopStart) {\n\t\t\tconst loopDuration =\n\t\t\t\tthis._animationTimes.loopEnd - this._animationTimes.loopStart;\n\t\t\tthis._loopOffset =\n\t\t\t\t(creationTimeDifference % (loopDuration * 1000)) / 1000;\n\t\t}\n\n\t\tif (this._loopOffset) {\n\t\t\tthis.mediaCurrentTime = this._loopOffset\n\t\t}\n\t\tawait this.playMedia();\n\t\tthis._addToTicker(this.loopHandler);\n\t}\n\n\tasync loopHandler() {\n\t\tif (this._ended || this._isEnding) {\n\t\t\treturn;\n\t\t}\n\t\tconst endTime = this.data.persist\n\t\t\t? (this._animationTimes.loopEnd ?? this._endTime)\n\t\t\t: this.loops\n\t\t\t\t? Math.min(this._endTime, this.mediaDuration)\n\t\t\t\t: this._endTime;\n\t\tif (this.mediaCurrentTime < endTime) {\n\t\t\treturn;\n\t\t}\n\t\tif (this.restartLoopHandler != null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// if we're above end time, we can safely just pause for now\n\t\tthis.pauseMedia();\n\n\t\t// default media current time to exactly end time so we don't\n\t\t// continue to trigger certain parts of the following code\n\t\t// unnecessarily\n\t\tthis.mediaCurrentTime = this._endTime;\n\n\t\t// if we reached maximum loops, stay paused or even end the effect\n\t\tif ((this.loops || !this.data.persist) && this._currentLoops >= this.loops) {\n\t\t\t// when the video is shorter than the effect's duration, hold the last\n\t\t\t// frame and let the end timeout at _totalDuration remove the effect\n\t\t\tconst holdsLastFrame = !this.data.persist && this._endTime > this.mediaDuration;\n\t\t\tif (!holdsLastFrame && (!this.data.persist || this.data.loopOptions?.endOnLastLoop)) {\n\t\t\t\tthis.endEffect();\n\t\t\t}\n\t\t\tthis._ticker?.remove(this.loopHandler, this);\n\t\t\treturn;\n\t\t}\n\n\t\tconst restartTime = this._startTime === 0 && this._animationTimes.loopStart\n\t\t\t? this._animationTimes.loopStart\n\t\t\t: this._startTime;\n\t\t// no loop delay means just start again at the beginning!\n\t\tif (!this.loopDelay) {\n\t\t\tthis._currentLoops++;\n\t\t\tthis.mediaCurrentTime = restartTime;\n\t\t\tthis.playMedia();\n\t\t\treturn;\n\t\t}\n\n\t\tthis._currentLoops++;\n\t\t// register restart handler to trigger after loop delay\n\t\tthis.restartLoopHandler = this._setTimeout(() => {\n\t\t\tthis.restartLoopHandler = null;\n\t\t\tthis.mediaCurrentTime = restartTime;\n\t\t\tthis.playMedia();\n\t\t}, this.loopDelay)\n\t}\n}\n\nclass PersistentCanvasEffect extends CanvasEffect {\n\n\t/** @OVERRIDE */\n\t_playPresetAnimations() {\n\t\tthis._moveTowards();\n\t\tthis._fadeIn();\n\t\tthis._scaleIn();\n\t\tthis._rotateIn();\n\t}\n\n\t/** @OVERRIDE */\n\t_timeoutVisibility() {\n\t\tlet creationTimeDifference = this.actualCreationTime - this.creationTimestamp;\n\t\tlet timeout =\n\t\t\tcreationTimeDifference === 0 && !this.data.animations ? 0 : 50;\n\t\tthis._setTimeout(() => {\n\t\t\tthis._setupHooks();\n\t\t}, timeout);\n\t}\n\n\t/** @OVERRIDE */\n\t_setEndTimeout() {\n\t\tlet creationTimeDifference = this.actualCreationTime - this.creationTimestamp;\n\t\tif (this.loops && creationTimeDifference >= this._totalDuration && this.hasAnimatedMedia) {\n\t\t\tthis._setTimeout(() => {\n\t\t\t\tthis.pauseMedia();\n\t\t\t}, this._totalDuration);\n\t\t}\n\t}\n\n\t/** @OVERRIDE */\n\tasync endEffect() {\n\t\tif (this._isEnding) return;\n\t\tthis._isEnding = true;\n\t\tlet extraEndDuration = this.data.extraEndDuration ?? 0;\n\t\tthis.mediaLooping = false;\n\t\tif (this._animationTimes?.forcedEnd) {\n\t\t\tthis.mediaCurrentTime = this._animationTimes.forcedEnd;\n\t\t\textraEndDuration += (this.mediaDuration - (this._animationTimes?.forcedEnd ?? 0)) * 1000;\n\t\t} else if (this._animationTimes?.loopEnd) {\n\t\t\textraEndDuration += (this.mediaDuration - this.mediaCurrentTime) * 1000;\n\t\t}\n\t\tconst fromEndCustomAnimations = this._getFromEndCustomAnimations(extraEndDuration);\n\t\tconst durations = [\n\t\t\tthis._fadeOut(extraEndDuration),\n\t\t\tthis._fadeOutAudio(extraEndDuration),\n\t\t\tthis._scaleOut(extraEndDuration),\n\t\t\tthis._rotateOut(extraEndDuration),\n\t\t\textraEndDuration,\n\t\t\t...fromEndCustomAnimations.map(\n\t\t\t\t(animation) => animation.duration + animation.delay\n\t\t\t),\n\t\t].filter(Boolean);\n\t\tSequencerAnimationEngine.addAnimation(this.id, fromEndCustomAnimations);\n\t\tconst waitDuration = Math.max(...durations, 0);\n\t\tthis._resolve(waitDuration);\n\t\treturn new Promise((resolve) =>\n\t\t\tthis._setTimeout(() => {\n\t\t\t\tsuper.endEffect();\n\t\t\t\tresolve(this.data);\n\t\t\t}, waitDuration)\n\t\t);\n\t}\n}\n","import * as lib from \"./lib.js\";\nimport CanvasEffect from \"../canvas-effects/canvas-effect.js\";\nimport CONSTANTS from \"../constants.js\";\nimport { sequencerSocket, SOCKET_HANDLERS } from \"../sockets.js\";\n\nexport function createShape(shape) {\n  const graphic = new PIXI.LegacyGraphics();\n\n\tgraphic.id = \"sequencer-graphics-\" + foundry.utils.randomID();\n\n\tgraphic.beginFill(\n\t\tshape?.isMask || !lib.is_real_number(shape?.fillColor) ? 0xffffff : shape?.fillColor,\n\t\tshape?.isMask ? 1 : (shape?.fillAlpha ?? 0)\n\t);\n\n  graphic.lineStyle(\n    shape.lineSize ?? (shape?.isMask ? 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) => {\n          return new PIXI.Point(\n            point[0] * sizeMultiplier,\n            point[1] * sizeMultiplier\n          );\n        })\n      );\n      break;\n  }\n\n  graphic.alpha = shape.alpha ?? 1.0;\n\n  graphic.endFill();\n\n\tif (shape.anchor) {\n\t\tgraphic.pivot.set(\n\t\t\tshape.width * (shape.anchor.x ?? 0.0),\n\t\t\tshape.height * (shape.anchor.y ?? 0.0)\n\t\t)\n\t}\n\n  return graphic;\n}\n\n/**\n * Serialize a raw PIXI shape into a plain-object envelope that survives JSON cloning.\n *\n * @param {PIXI.Polygon|PIXI.Circle|PIXI.Rectangle} shape\n * @returns {{type: string, [key: string]: any}}\n */\nexport function serializeShape(shape) {\n\tif (shape instanceof PIXI.Polygon) {\n\t\treturn { type: \"Polygon\", points: Array.from(shape.points) };\n\t}\n\tif (shape instanceof PIXI.Circle) {\n\t\treturn { type: \"Circle\", x: shape.x, y: shape.y, radius: shape.radius };\n\t}\n\tif (shape instanceof PIXI.Rectangle) {\n\t\treturn { type: \"Rectangle\", x: shape.x, y: shape.y, width: shape.width, height: shape.height };\n\t}\n\tthrow new Error(\"serializeShape: unsupported shape type\");\n}\n\n/**\n * Rebuild a PIXI shape from a serialized envelope produced by `serializeShape`.\n *\n * @param {{type: string, [key: string]: any}} data\n * @returns {PIXI.Polygon|PIXI.Circle|PIXI.Rectangle|null}\n */\nexport function deserializeShape(data) {\n\tif (!data || typeof data !== \"object\") return null;\n\tswitch (data.type) {\n\t\tcase \"Polygon\":\n\t\t\treturn new PIXI.Polygon(data.points ?? []);\n\t\tcase \"Circle\":\n\t\t\treturn new PIXI.Circle(data.x ?? 0, data.y ?? 0, data.radius ?? 0);\n\t\tcase \"Rectangle\":\n\t\t\treturn new PIXI.Rectangle(data.x ?? 0, data.y ?? 0, data.width ?? 0, data.height ?? 0);\n\t}\n\treturn null;\n}\n\n/**\n * Computes a wall-constrained polygon sweep from an origin point, using Foundry's\n * native ClockwiseSweepPolygon. Useful for masking effects to line of sight, sound,\n * or movement reachability, independent of any third-party module.\n *\n * @param {{x: number, y: number, elevation?: number}} origin\n * @param {object} [options]\n * @param {\"sight\"|\"sound\"|\"move\"|\"light\"} [options.type=\"sight\"]   Collision type\n * @param {number|null} [options.radius=null]                       Bounding circle radius in pixels\n * @param {foundry.documents.Level|string|null} [options.level=null]\n *        On Foundry v14+, the scene Level whose edge set the sweep should consult. Accepts\n *        a Level document or its id (resolved against the current scene). When omitted,\n *        Foundry defaults to `canvas.level`, the currently viewed level, which is wrong for\n *        sources on a different floor than the viewer. Ignored on Foundry v13.\n * @returns {PIXI.Polygon|null}\n */\nexport function computeWallPolygon(origin, options = {}) {\n\tif (!origin || typeof origin.x !== \"number\" || typeof origin.y !== \"number\") {\n\t\tthrow new Error(\"computeWallPolygon: origin must be { x: number, y: number }\");\n\t}\n\tconst {\n\t\ttype = \"sight\",\n\t\tradius = null,\n\t\tlevel = null,\n\t} = options;\n\n\tconst validTypes = [\"sight\", \"sound\", \"move\", \"light\"];\n\tif (!validTypes.includes(type)) {\n\t\tthrow new Error(`computeWallPolygon: type must be one of ${validTypes.join(\", \")}`);\n\t}\n\n\tconst config = { type };\n\n\tif (typeof radius === \"number\") {\n\t\tconfig.radius = radius;\n\t}\n\n\tif (level) {\n\t\tlet resolved = level;\n\t\tif (typeof level === \"string\") {\n\t\t\tconst sceneLevels = canvas.scene?.levels;\n\t\t\tresolved = sceneLevels?.get(level) ?? sceneLevels?.getName?.(level) ?? null;\n\t\t}\n\t\tif (resolved) config.level = resolved;\n\t}\n\n\tconst PolygonBackend = CONFIG.Canvas.polygonBackends[type];\n\tif (!PolygonBackend) {\n\t\tthrow new Error(`computeWallPolygon: no polygon backend registered for type \"${type}\"`);\n\t}\n\n\treturn PolygonBackend.create(\n\t\t{ x: origin.x, y: origin.y, elevation: origin.elevation ?? 0 },\n\t\tconfig\n\t);\n}\n\nexport function calculate_missed_position(source, target, twister) {\n  const sourcePosition = get_object_position(source);\n  const sourceDimensions = get_object_dimensions(source, true);\n\n  if (!target) {\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 foundry.canvas.geometry.Ray(targetPosition, sourcePosition);\n\n  let startRadians = ray.angle + Math.PI / 2;\n  let endRadians = ray.angle - Math.PI / 2;\n\n  const sizeCompensation = Math.max(\n    1,\n    Math.abs(sourceDimensions.width - targetDimensions.height)\n  );\n  let distance = ray.distance / canvas.grid.size - sizeCompensation;\n\n  if (distance <= 1) {\n    const angle =\n      twister.random() > 0.5\n        ? ray.angle + Math.PI / 4\n        : ray.angle - Math.PI / 4;\n    const x = Math.cos(angle) * targetDimensions.width;\n    const y = Math.sin(angle) * targetDimensions.height;\n    return { x, y };\n  }\n\n  distance = Math.max(Math.abs(distance - 15), 6);\n\n  endRadians -= Math.PI / distance;\n  startRadians += Math.PI / distance;\n\n  const angle = lib.interpolate(startRadians, endRadians, twister.random());\n  const x = Math.cos(angle) * targetDimensions.width;\n  const 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\tif (obj instanceof foundry.canvas.placeables.Region){\n\t\tif(obj.document.shapes.length > 1){\n\t\t\tpos.x = obj.bounds.x + obj.bounds.width/2;\n\t\t\tpos.y = obj.bounds.y + obj.bounds.height/2;\n\t\t}else{\n\t\t\tlet firstShape = obj.document.shapes[0];\n\t\t\tswitch(firstShape.type){\n\t\t\t\tcase \"cone\":\n\t\t\t\tcase \"line\":\n\t\t\t\t\tif (!measure) {\n\t\t\t\t\t\tpos.x = firstShape.measuredSegments[0].ray.A.x;\n\t\t\t\t\t\tpos.y = firstShape.measuredSegments[0].ray.A.y;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpos.x = firstShape.measuredSegments[0].ray.B.x;\n\t\t\t\t\t\tpos.y = firstShape.measuredSegments[0].ray.B.y;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tpos.x = firstShape.center.x;\n\t\t\t\t\tpos.y = firstShape.center.y;\n\t\t\t}\n\t\t}\n\t} else if (obj instanceof foundry.canvas.placeables.MeasuredTemplate) {\n\t\tif (measure) {\n\t\t\tif (obj.document.t === \"cone\" || obj.document.t === \"ray\") {\n\t\t\t\tpos.x = obj.ray.B.x;\n\t\t\t\tpos.y = obj.ray.B.y;\n\t\t\t}\n\t\t}\n\t\tif (obj.document.t === \"rect\") {\n\t\t\tpos.x = obj.x;\n\t\t\tpos.y = obj.y;\n\n\t\t\tif (!exact) {\n\t\t\t\tpos.x += Math.abs(obj.shape.width / 2) + obj.shape.x;\n\t\t\t\tpos.y += Math.abs(obj.shape.height / 2) + obj.shape.y;\n\t\t\t}\n\t\t}\n\t} else if (obj instanceof foundry.canvas.placeables.Tile) {\n    pos = {\n      x: obj.document.x,\n      y: obj.document.y,\n    };\n\n    // Foundry v14 only behaves correctly without this logic\n    // Foundry v13 only behaves correctly with this logic\n    if (!foundry.utils.isNewerVersion(game.version, '14')) {\n        if (!exact) {\n            pos.x += Math.abs(obj.document.width / 2);\n            pos.y += Math.abs(obj.document.height / 2);\n        }\n    }\n  } else if (obj instanceof foundry.canvas.placeables.Token) {\n    const halfSize = get_object_dimensions(obj, true);\n    pos = {\n      x: obj.x + halfSize.width,\n      y: obj.y + halfSize.height,\n    };\n\n    if (exact) {\n      pos.x -= halfSize.width;\n      pos.y -= halfSize.height;\n    }\n  } else if (obj instanceof foundry.canvas.placeables.Drawing) {\n    pos = {\n      x: obj.document.x,\n      y: obj.document.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  } else {\n    // When the placeable isn't on this canvas (off-level region, etc.),\n    // read position from the document directly.\n    const docBounds = compute_document_bounds(obj, { measure });\n    if (docBounds) {\n      if (exact) {\n        pos.x = docBounds.x;\n        pos.y = docBounds.y;\n      } else {\n        pos.x = docBounds.x + docBounds.width / 2;\n        pos.y = docBounds.y + docBounds.height / 2;\n      }\n      // Region line and cone shapes return endpoint A or B based on the\n      // measure flag, matching the placeable branch so .stretchTo() can\n      // stretch across them.\n      const directional = compute_region_directional_endpoint(obj, { measure });\n      if (directional) {\n        pos.x = directional.x;\n        pos.y = directional.y;\n      }\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      null,\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      null,\n    elevation:\n      (obj?.elevation ?? obj?.document?.elevation) != null\n        ? get_object_elevation(obj)\n        : null,\n  };\n\n  if (pos.x === null) delete pos[\"x\"];\n  if (pos.y === null) delete pos[\"y\"];\n  if (pos.elevation === null) delete pos[\"elevation\"];\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\tif (inObj instanceof foundry.canvas.placeables.Region){\n\t\tif(inObj.document.shapes.length > 1){\n\t\t\treturn {\n\t\t\t\twidth: inObj.bounds.width / (half ? 2 : 1),\n\t\t\t\theight: inObj.bounds.height / (half ? 2 : 1)\n\t\t\t}\n\t\t}else{\n\t\t\tlet firstShape = inObj.document.shapes[0];\n\t\t\tswitch(firstShape.type){\n\t\t\t\tcase \"cone\":\n\t\t\t\tcase \"circle\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\twidth: firstShape.radius / (half ? 1 : 0.5),\n\t\t\t\t\t\theight: firstShape.radius / (half ? 1 : 0.5)\n\t\t\t\t\t}\n\t\t\t\tcase \"ring\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\twidth: ((firstShape.radius + firstShape.outerWidth) - (firstShape.innerWidth / 2)) / (half ? 1 : 0.5),\n\t\t\t\t\t\theight: ((firstShape.radius + firstShape.outerWidth) - (firstShape.innerWidth / 2)) / (half ? 1 : 0.5)\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn \"radius\" in firstShape ? {\n\t\t\t\t\t\twidth: firstShape.radius / (half ? 1 : 0.5),\n\t\t\t\t\t\theight: firstShape.radius / (half ? 1 : 0.5)\n\t\t\t\t\t} : {\n\t\t\t\t\t\twidth: firstShape.width / (half ? 2 : 1),\n\t\t\t\t\t\theight: firstShape.height / (half ? 2 : 1)\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}else if(inObj instanceof foundry.canvas.placeables.Tile){\n\t\treturn {\n\t\t\twidth: inObj.document.width / (half ? 2 : 1),\n\t\t\theight: inObj.document.height / (half ? 2 : 1)\n\t\t}\n\t}\n\n  // When the placeable isn't on this canvas (off-level region, etc.),\n  // read dimensions from the document directly.\n  const docBounds = compute_document_bounds(inObj);\n  if (docBounds) {\n    return {\n      width: docBounds.width / (half ? 2 : 1),\n      height: docBounds.height / (half ? 2 : 1),\n    };\n  }\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?.bounds?.width ??\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?.bounds?.height ??\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\n// Document/shape type warnings are deduped so a per-frame caller can't\n// flood the debug log when a Foundry schema field drifts.\nconst _warnedUnknownTypes = new Set();\nfunction _warnUnknownType(category, type) {\n\tconst key = category + \":\" + type;\n\tif (_warnedUnknownTypes.has(key)) return;\n\t_warnedUnknownTypes.add(key);\n\tlib.debug(`Sequencer | unhandled ${category} type \"${type}\"`);\n}\n\n/**\n * Bounding box (canvas pixels) for a CanvasDocument from schema fields.\n * Returns null when the input isn't a recognized document.\n *\n * @param {foundry.abstract.Document|null|undefined} doc\n * @param {{measure?: boolean}} [options]\n * @returns {{x: number, y: number, width: number, height: number}|null}\n */\nfunction compute_document_bounds(doc, { measure = false } = {}) {\n  if (!doc || typeof doc !== \"object\") return null;\n  const docName = doc.documentName;\n  if (!docName) return null;\n\n  const scene = doc.parent ?? canvas?.scene;\n  const gridSize = scene?.grid?.size ?? canvas?.grid?.size ?? 100;\n  const gridDistance = scene?.grid?.distance ?? canvas?.grid?.distance ?? 5;\n  const distancePixels = scene?.dimensions?.distancePixels ?? (gridSize / gridDistance);\n\n  switch (docName) {\n    case \"Token\": {\n      // doc.width / doc.height are in grid units.\n      const w = (doc.width ?? 1) * gridSize;\n      const h = (doc.height ?? 1) * gridSize;\n      return { x: doc.x ?? 0, y: doc.y ?? 0, width: w, height: h };\n    }\n\n    case \"Tile\": {\n      return {\n        x: doc.x ?? 0,\n        y: doc.y ?? 0,\n        width: doc.width ?? 0,\n        height: doc.height ?? 0,\n      };\n    }\n\n    case \"Drawing\": {\n      const shape = doc.shape ?? {};\n      const baseX = doc.x ?? 0;\n      const baseY = doc.y ?? 0;\n      switch (shape.type) {\n        case \"r\": // rectangle\n        case \"e\": // ellipse\n          return { x: baseX, y: baseY, width: shape.width ?? 0, height: shape.height ?? 0 };\n        case \"c\": { // circle\n          const r = shape.radius ?? 0;\n          return { x: baseX, y: baseY, width: r * 2, height: r * 2 };\n        }\n        case \"p\": // polygon\n        case \"f\": { // freehand\n          const pts = shape.points;\n          if (!pts?.length) return { x: baseX, y: baseY, width: 0, height: 0 };\n          let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n          for (let i = 0; i < pts.length; i += 2) {\n            const px = pts[i], py = pts[i + 1];\n            if (px < minX) minX = px;\n            if (py < minY) minY = py;\n            if (px > maxX) maxX = px;\n            if (py > maxY) maxY = py;\n          }\n          return { x: baseX + minX, y: baseY + minY, width: maxX - minX, height: maxY - minY };\n        }\n        default:\n          _warnUnknownType(\"drawing shape\", shape.type);\n          return { x: baseX, y: baseY, width: shape.width ?? 0, height: shape.height ?? 0 };\n      }\n    }\n\n    case \"Region\": {\n      // Union the bounding boxes of every shape on the region.\n      let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n      let any = false;\n      for (const shape of doc.shapes ?? []) {\n        const sb = compute_region_shape_bounds(shape);\n        if (!sb) continue;\n        any = true;\n        if (sb.x < minX) minX = sb.x;\n        if (sb.y < minY) minY = sb.y;\n        if (sb.x + sb.width > maxX) maxX = sb.x + sb.width;\n        if (sb.y + sb.height > maxY) maxY = sb.y + sb.height;\n      }\n\t    if (!any) return null;\n      return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n    }\n\n    case \"MeasuredTemplate\": {\n      const baseX = doc.x ?? 0;\n      const baseY = doc.y ?? 0;\n      const distance = doc.distance ?? 0;\n      const r = distance * distancePixels;\n      switch (doc.t) {\n        case \"circle\":\n        case \"cone\":\n          return { x: baseX - r, y: baseY - r, width: r * 2, height: r * 2 };\n        case \"rect\":\n          return { x: baseX, y: baseY, width: r, height: r };\n        case \"ray\": {\n          const w = (doc.width ?? 1) * distancePixels;\n          return { x: baseX, y: baseY - w / 2, width: r, height: w };\n        }\n        default:\n          return { x: baseX - r, y: baseY - r, width: r * 2, height: r * 2 };\n      }\n    }\n\n    case \"AmbientLight\": {\n      const radius = Math.max(doc.config?.dim ?? 0, doc.config?.bright ?? 0) * distancePixels;\n      if (radius > 0) {\n        return { x: (doc.x ?? 0) - radius, y: (doc.y ?? 0) - radius, width: radius * 2, height: radius * 2 };\n      }\n      return { x: doc.x ?? 0, y: doc.y ?? 0, width: gridSize, height: gridSize };\n    }\n\n    case \"AmbientSound\": {\n      const radius = (doc.radius ?? 0) * distancePixels;\n      if (radius > 0) {\n        return { x: (doc.x ?? 0) - radius, y: (doc.y ?? 0) - radius, width: radius * 2, height: radius * 2 };\n      }\n      return { x: doc.x ?? 0, y: doc.y ?? 0, width: gridSize, height: gridSize };\n    }\n\n    case \"Wall\": {\n      const c = doc.c ?? [0, 0, 0, 0];\n      const [x1, y1, x2, y2] = c;\n      return {\n        x: Math.min(x1, x2),\n        y: Math.min(y1, y2),\n        width: Math.abs(x2 - x1),\n        height: Math.abs(y2 - y1),\n      };\n    }\n\n    case \"Note\": {\n      const s = doc.iconSize ?? gridSize;\n      return { x: (doc.x ?? 0) - s / 2, y: (doc.y ?? 0) - s / 2, width: s, height: s };\n    }\n\n    default:\n      _warnUnknownType(\"document\", docName);\n      return null;\n  }\n}\n\n/**\n * Build a PIXI mask shape from a DrawingDocument's schema fields. Local\n * coordinates; the caller positions the resulting graphics.\n *\n * @param {foundry.abstract.Document|null|undefined} doc\n * @returns {PIXI.Rectangle|PIXI.Ellipse|PIXI.Circle|PIXI.Polygon|null}\n */\nexport function create_drawing_mask_shape(doc) {\n  const shape = doc?.shape;\n  if (!shape) return null;\n  switch (shape.type) {\n    case \"r\":\n      return new PIXI.Rectangle(0, 0, shape.width ?? 0, shape.height ?? 0);\n    case \"e\": {\n      const w = shape.width ?? 0;\n      const h = shape.height ?? 0;\n      return new PIXI.Ellipse(w / 2, h / 2, w / 2, h / 2);\n    }\n    case \"c\": {\n      const r = shape.radius ?? 0;\n      return new PIXI.Circle(r, r, r);\n    }\n    case \"p\":\n    case \"f\": {\n      const pts = shape.points;\n      if (!pts?.length) return null;\n      return new PIXI.Polygon(pts.slice());\n    }\n    default:\n      _warnUnknownType(\"drawing shape\", shape.type);\n      return null;\n  }\n}\n\n/**\n * For single-shape Regions with a directional shape (line, cone), returns\n * endpoint A at `!measure` and endpoint B at `measure`. Null otherwise.\n *\n * @param {foundry.abstract.Document|null|undefined} doc\n * @param {{measure?: boolean}} [options]\n * @returns {{x: number, y: number}|null}\n */\nfunction compute_region_directional_endpoint(doc, { measure = false } = {}) {\n  if (doc?.documentName !== \"Region\") return null;\n  const shapes = doc.shapes;\n  if (!shapes || shapes.length !== 1) return null;\n  const shape = shapes[0];\n  if (shape?.type !== \"line\" && shape?.type !== \"cone\") return null;\n\n  const ox = shape.x ?? 0;\n  const oy = shape.y ?? 0;\n  if (!measure) return { x: ox, y: oy };\n\n  const extent = shape.type === \"line\" ? (shape.length ?? 0) : (shape.radius ?? 0);\n  const rot = ((shape.rotation ?? 0) * Math.PI) / 180;\n  return {\n    x: ox + (extent * Math.cos(rot)),\n    y: oy + (extent * Math.sin(rot)),\n  };\n}\n\n/**\n * Axis-aligned bounding box (canvas pixels) for any v14 BaseShapeData\n * on a RegionDocument. Rotation is over-approximated, not rotated exactly.\n *\n * @param {object} shape\n * @returns {{x: number, y: number, width: number, height: number}|null}\n */\nfunction compute_region_shape_bounds(shape) {\n  if (!shape) return null;\n\n  switch (shape.type) {\n\n    case \"rectangle\": {\n      // x, y is top-left.\n      return {\n        x: shape.x ?? 0,\n        y: shape.y ?? 0,\n        width: shape.width ?? 0,\n        height: shape.height ?? 0,\n      };\n    }\n\n    case \"circle\": {\n      // x, y is center.\n      const r = shape.radius ?? 0;\n      return {\n        x: (shape.x ?? 0) - r,\n        y: (shape.y ?? 0) - r,\n        width: r * 2,\n        height: r * 2,\n      };\n    }\n\n    case \"ellipse\": {\n      // x, y is center.\n      const rx = shape.radiusX ?? 0;\n      const ry = shape.radiusY ?? 0;\n      return {\n        x: (shape.x ?? 0) - rx,\n        y: (shape.y ?? 0) - ry,\n        width: rx * 2,\n        height: ry * 2,\n      };\n    }\n\n    case \"emanation\": {\n      // Expands the embedded base shape by `radius` on every side.\n      const base = compute_region_shape_bounds(shape.base);\n      if (!base) return null;\n      const r = shape.radius ?? 0;\n      return {\n        x: base.x - r,\n        y: base.y - r,\n        width: base.width + r * 2,\n        height: base.height + r * 2,\n      };\n    }\n\n    case \"cone\": {\n      // x, y is the apex; bounded by the outer circle of `radius`.\n      const r = shape.radius ?? 0;\n      return {\n        x: (shape.x ?? 0) - r,\n        y: (shape.y ?? 0) - r,\n        width: r * 2,\n        height: r * 2,\n      };\n    }\n\n    case \"ring\": {\n      // x, y is center. Outer radius is radius + outerWidth.\n      const outer = (shape.radius ?? 0) + (shape.outerWidth ?? 0);\n      return {\n        x: (shape.x ?? 0) - outer,\n        y: (shape.y ?? 0) - outer,\n        width: outer * 2,\n        height: outer * 2,\n      };\n    }\n\n    case \"line\": {\n      // x, y is the origin endpoint; stroke `width` spreads perpendicular.\n      const ox = shape.x ?? 0;\n      const oy = shape.y ?? 0;\n      const len = shape.length ?? 0;\n      const w = shape.width ?? 0;\n      const rot = ((shape.rotation ?? 0) * Math.PI) / 180;\n      const ex = ox + (len * Math.cos(rot));\n      const ey = oy + (len * Math.sin(rot));\n      const halfW = w / 2;\n      const minX = Math.min(ox, ex) - halfW;\n      const maxX = Math.max(ox, ex) + halfW;\n      const minY = Math.min(oy, ey) - halfW;\n      const maxY = Math.max(oy, ey) + halfW;\n      return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n    }\n\n    case \"polygon\": {\n      // Flat array [x0, y0, x1, y1, ...].\n      const pts = shape.points;\n      if (!pts?.length) return null;\n      let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n      for (let i = 0; i < pts.length; i += 2) {\n        const px = pts[i], py = pts[i + 1];\n        if (px < minX) minX = px;\n        if (py < minY) minY = py;\n        if (px > maxX) maxX = px;\n        if (py > maxY) maxY = py;\n      }\n      return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n    }\n\n    case \"token\": {\n      // x, y is top-left (pixels); width, height are in grid spaces.\n      const grid = canvas?.scene?.grid ?? canvas?.grid;\n      const gridSize = grid?.size ?? 100;\n      return {\n        x: shape.x ?? 0,\n        y: shape.y ?? 0,\n        width: (shape.width ?? 1) * gridSize,\n        height: (shape.height ?? 1) * gridSize,\n      };\n    }\n\n    case \"grid\": {\n      // Union of grid-cell offsets {i: row, j: column}. Use\n      // grid.getTopLeftPoint() when available so hex grids resolve right.\n      const offsets = shape.offsets;\n      if (!offsets?.length) return null;\n      const grid = canvas?.scene?.grid ?? canvas?.grid;\n      const gridSize = grid?.size ?? 100;\n      let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n      for (const off of offsets) {\n        let cellX, cellY;\n        if (grid && typeof grid.getTopLeftPoint === \"function\") {\n          const tl = grid.getTopLeftPoint(off);\n          cellX = tl.x;\n          cellY = tl.y;\n        } else {\n          cellX = (off.j ?? 0) * gridSize;\n          cellY = (off.i ?? 0) * gridSize;\n        }\n        if (cellX < minX) minX = cellX;\n        if (cellY < minY) minY = cellY;\n        if (cellX + gridSize > maxX) maxX = cellX + gridSize;\n        if (cellY + gridSize > maxY) maxY = cellY + gridSize;\n      }\n      return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n    }\n\n    default:\n      _warnUnknownType(\"region shape\", shape.type);\n      return null;\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, uuid = true }={}) {\n  inObject = inObject?.object ?? inObject;\n  const data = {\n    ...get_object_position(inObject, { measure }),\n    ...get_object_dimensions(inObject?.mesh ?? inObject?.tile ?? inObject),\n    elevation: get_object_elevation(inObject),\n    cachedLocation: true,\n  };\n\tif(uuid) {\n\t\tdata[\"uuid\"] = inObject?.document?.uuid ?? inObject?.uuid;\n\t}\n\treturn data;\n}\n\nexport function get_object_elevation(inObject) {\n  const e = inObject?.document?.elevation ?? inObject?.elevation ?? 0;\n  // RegionDocument.elevation is { top, bottom } (either may be null for\n  // unbounded); every other placeable's elevation is a scalar number.\n  // Collapse the object to its floor so downstream Math.max / arithmetic\n  // and PIXI sort comparisons receive a real number.\n  return typeof e === \"object\" ? (e?.bottom ?? e?.top ?? 0) : e;\n}\n\n/**\n * Vertical extent of a placeable as `[bottom, top, topInclusive]` in\n * scene elevation units. Regions contribute their elevation range and\n * `topInclusive` flag, Tokens their depth, anything else returns top\n * equal to bottom. Returns null when there's no elevation field.\n *\n * @param {PlaceableObject|foundry.abstract.Document|null|undefined} inObject\n * @returns {[number, number, boolean]|null}\n */\nexport function get_object_vertical_extent(inObject) {\n  const doc = inObject?.document ?? inObject;\n  if (!doc) return null;\n  const elevation = doc.elevation;\n\n  // Range-elevation documents (Region).\n  if (elevation && typeof elevation === \"object\") {\n    const bottom = elevation.bottom ?? -Infinity;\n    const top = elevation.top ?? Infinity;\n    return [bottom, top, !!elevation.topInclusive];\n  }\n\n  // Token: feet + (depth × grid.distance). Matches v14 token.mjs.\n  if (typeof elevation === \"number\" && typeof doc.depth === \"number\") {\n    const gridDistance = doc.parent?.grid?.distance ?? canvas?.scene?.grid?.distance ?? 1;\n    return [elevation, elevation + (doc.depth * gridDistance), false];\n  }\n\n  if (typeof elevation === \"number\") {\n    return [elevation, elevation, false];\n  }\n\n  return null;\n}\n\nexport function get_mouse_position(snapToGrid = false) {\n  const pos = lib.getCanvasMouse().getLocalPosition(canvas.app.stage);\n\n\tconst snappingOptions = {\n\t\tmode: CONST.GRID_SNAPPING_MODES.CENTER | CONST.GRID_SNAPPING_MODES.VERTEX | CONST.GRID_SNAPPING_MODES.EDGE_MIDPOINT\n\t};\n\n\treturn !snapToGrid\n\t\t? new PIXI.Point(pos.x, pos.y)\n\t\t: canvas.grid.getSnappedPoint({ x: pos.x, y: pos.y }, snappingOptions)\n}\n\nexport function distance_between(p1, p2) {\n  return new foundry.canvas.geometry.Ray(p1, p2).distance;\n}\n\n\nexport function validateObject(inObject, sceneId) {\n  if (lib.is_UUID(inObject) || !is_object_canvas_data(inObject)) {\n    inObject = lib.get_object_from_scene(inObject, sceneId);\n  }\n  return inObject?._object ?? inObject;\n}\n\nexport function getPositionFromData(data, type=\"source\", twister = false) {\n  const source = data.nameOffsetMap[data[type]]\n    ? data.nameOffsetMap[data[type]][type]\n    : validateObject(data[type], data.sceneId);\n\n  const position = source instanceof foundry.canvas.placeables.PlaceableObject\n      ? get_object_position(source)\n      : source?.worldPosition || source?.center || source;\n\n\tlet offset = getOffsetFromData(data, { source, type, twister });\n\n  const result = {\n\t\tx: position.x - offset.x,\n\t  y: position.y - offset.y,\n  };\n  if (typeof position?.elevation === \"number\") {\n    result.elevation = position.elevation;\n  }\n  return result;\n}\n\nexport function getOffsetFromData(data, { source = false, type = \"source\", twister = false }={}) {\n\tif(!source){\n\t\tsource = data.nameOffsetMap[data[type]]\n\t\t\t? data.nameOffsetMap[data[type]][type]\n\t\t\t: validateObject(data[type], data.sceneId);\n\t}\n\n\tconst multiplier = data.randomOffset?.[type];\n\ttwister = twister || lib.createMersenneTwister(data.seed);\n\n\tlet offset = { x: 0, y: 0 };\n\n\tif (source && multiplier) {\n\t\tlet randomOffset = get_random_offset(\n\t\t\tsource,\n\t\t\tmultiplier,\n\t\t\ttwister\n\t\t);\n\t\toffset.x += randomOffset.x;\n\t\toffset.y += randomOffset.y;\n\t}\n\n\tlet extraOffset = data.offset;\n\tif (extraOffset) {\n\t\tlet newOffset = {\n\t\t\tx: extraOffset.x,\n\t\t\ty: extraOffset.y,\n\t\t};\n\t\tif (extraOffset.gridUnits) {\n\t\t\tnewOffset.x *= canvas.grid.size;\n\t\t\tnewOffset.y *= canvas.grid.size;\n\t\t}\n\t\tif (extraOffset.local) {\n\t\t\tnewOffset = rotateAroundPoint(\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t\tnewOffset.x,\n\t\t\t\tnewOffset.y,\n\t\t\t\tsource?.rotation ?? 0\n\t\t\t);\n\t\t}\n\t\toffset.x += newOffset.x;\n\t\toffset.y += newOffset.y;\n\t}\n\n\treturn offset;\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 rotateAroundPoint(cx, cy, x, y, radians) {\n  const cos = Math.cos(radians);\n  const sin = Math.sin(radians);\n  const nx = cos * (x - cx) + sin * (y - cy) + cx;\n  const 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\tif (inOptions?.screenSpace !== undefined && typeof inOptions.screenSpace !== \"boolean\") {\n\t\treturn `inOptions.screenSpace must be of type boolean`;\n\t}\n\tif (inOptions?.gridUnits !== undefined) {\n\t  if (typeof inOptions.gridUnits !== \"boolean\") {\n\t    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\tif (\n\t\tinOptions?.absolute !== undefined &&\n\t\ttypeof inOptions.absolute !== \"boolean\"\n\t) {\n\t\treturn `inOptions.absolute must be of type boolean`;\n\t}\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    absolute: inOptions?.absolute ?? false,\n\t  screenSpace: inOptions?.screenSpace ?? 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\tif (inOptions?.screenSpace !== undefined && typeof inOptions.screenSpace !== \"boolean\") {\n\t\treturn `inOptions.screenSpace must be of type boolean`;\n\t}\n\tif (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\t  screenSpace: inOptions?.screenSpace ?? 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  const placeholder = game.i18n.localize(\n    \"SEQUENCER.Player.CreateNewPresetInputLabel\"\n  );\n  const result = await foundry.applications.api.DialogV2.input({\n    window: { title },\n    content: `<p><input type=\"text\" name=\"presetName\" placeholder=\"${placeholder}\" value=\"${foundry.utils.escapeHTML(inName ?? \"\")}\" style=\"width:100%;\" autofocus></p>`,\n    ok: {\n      icon: \"fas fa-check\",\n      label: game.i18n.localize(\"SEQUENCER.OK\"),\n    },\n    rejectClose: false,\n  });\n  let presetName = result?.presetName || false;\n\n  if (presetName) {\n    if (presetName.toLowerCase() === \"default\") {\n      foundry.applications.api.DialogV2.prompt({\n        window: {\n          title: game.i18n.localize(\"SEQUENCER.Player.DefaultErrorTitle\"),\n        },\n        content: `<p>${game.i18n.localize(\n          \"SEQUENCER.Player.DefaultErrorContent\"\n        )}</p>`,\n        ok: { label: game.i18n.localize(\"SEQUENCER.OK\") },\n      });\n      return false;\n    }\n\n    if (effectPresets[presetName]) {\n      const overwrite = await foundry.applications.api.DialogV2.confirm({\n        window: {\n          title: game.i18n.localize(\"SEQUENCER.Player.OverwritePresetTitle\"),\n        },\n        content: `<p>${game.i18n.format(\n          \"SEQUENCER.Player.OverwritePresetContent\",\n          { preset_name: presetName }\n        )}</p>`,\n      });\n\n      if (!overwrite) {\n        presetName = await promptNewPresetName(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      if (!this.isLayerActive) return;\n      const hover = document.elementFromPoint(event.clientX, event.clientY);\n      if (!hover || hover.id !== \"board\") 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 === CONSTANTS.TOOLS.PLAY\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  hoveredSoundUI: 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 === CONSTANTS.TOOLS.SELECT\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      const layerDiff = (b.data.sortLayer ?? 800) - (a.data.sortLayer ?? 800);\n      if (layerDiff !== 0) return layerDiff;\n      return (b.data.zIndex ?? 0) - (a.data.zIndex ?? 0);\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","<script>\r\n\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n  import { SelectionManager } from \"../../modules/sequencer-interaction-manager.js\";\r\n  import SequencerEffectManager from \"../../modules/sequencer-effect-manager.js\";\r\n\r\n  export let effect;\r\n\r\n  function getEffectName(effect) {\r\n\r\n    let effectName = \"\";\r\n    if (effect.data.file && typeof effect.data.file === \"string\") {\r\n\t    effectName = effect.data.file.split('\\\\').pop().split('/').pop();\r\n    } else if (effect.data.file && typeof effect.data.file === \"object\") {\r\n      effectName = Object.values(effect.data.file)[0].split('\\\\').pop().split('/').pop();\r\n    } else if (effect.data.text) {\r\n      effectName = \"Text: \" + effect.data.text.text;\r\n    } else {\r\n      effectName =  effect.data?.shapes?.[0]?.type ? \"Shape: \" + effect.data.shapes[0]?.type : \"Unknown effect\"\r\n    }\r\n\r\n    effectName = effect.data.name ? `${effect.data.name} (${effectName})` : effectName;\r\n\r\n    if (effect.data.creatorUserId !== game.userId) {\r\n      let user_name = game.users.get(effect.data.creatorUserId)?.name;\r\n      let formattedUsername = (user_name\r\n        ? localize(\"SEQUENCER.ManagerPlayersEffect\", { user_name })\r\n        : localize(\"SEQUENCER.ManagerUnknownEffect\"));\r\n      effectName += ` (${formattedUsername})`;\r\n    }\r\n\r\n    return effectName;\r\n\r\n  }\r\n\r\n  function mouseOver() {\r\n    SelectionManager.hoveredEffectUI = effect;\r\n  }\r\n\r\n  function mouseLeave() {\r\n    SelectionManager.hoveredEffectUI = false;\r\n  }\r\n\r\n  function endEffect(){\r\n    SequencerEffectManager.endEffects({ effects: [effect] });\r\n\t}\r\n\r\n</script>\r\n\r\n\r\n<div class=\"effect hover-highlight\" on:mouseleave={mouseLeave} on:mouseover={mouseOver}>\r\n\t<button class=\"btn_end\" type=\"button\" on:click={endEffect}>\r\n\t\t<i class=\"fas fa-times\"></i>\r\n\t</button>\r\n\t<div class=\"effect-text hover-text\">\r\n\t\t{getEffectName(effect)}\r\n\t</div>\r\n</div>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n  .effect {\r\n    display: flex;\r\n    flex: 1 0 auto;\r\n  }\r\n\r\n  .effect > button {\r\n    flex: 0;\r\n    font-size: 0.7rem;\r\n    height: 1.25rem;\r\n    line-height: normal;\r\n    margin-right: 5px;\r\n  }\r\n\r\n  .btn_end {\r\n    min-width: 1.5rem;\r\n  }\r\n\r\n  .effect > div {\r\n    flex: 1;\r\n    line-height: 1.25rem;\r\n  }\r\n\r\n  .hover-highlight:hover > .hover-text {\r\n    color: #000;\r\n    text-shadow: 0 0 10px red;\r\n  }\r\n\r\n</style>\r\n","<script>\r\n\r\n\timport { SelectionManager } from \"../../modules/sequencer-interaction-manager.js\";\r\n\r\n\tlet localize = game.i18n.localize.bind(game.i18n);\r\n\timport SequencerSoundManager from \"../../modules/sequencer-sound-manager.js\";\r\n\r\n\texport let sound;\r\n\r\n\r\n\tfunction getSoundName(sound) {\r\n\r\n\t\tlet soundName = \"\";\r\n\t\tif (sound.data.file && typeof sound.data.file === \"string\") {\r\n\t\t\tsoundName = sound.data.file.split('\\\\').pop().split('/').pop();\r\n\t\t} else if (sound.data.file && typeof sound.data.file === \"object\") {\r\n\t\t\tsoundName = Object.values(sound.data.file)[0].split('\\\\').pop().split('/').pop();\r\n\t\t} else if (sound.data.text) {\r\n\t\t\tsoundName = \"Text: \" + sound.data.text.text;\r\n\t\t} else {\r\n\t\t\tsoundName =  sound.data?.shapes?.[0]?.type ? \"Shape: \" + sound.data.shapes[0]?.type : \"Unknown sound\"\r\n\t\t}\r\n\r\n\t\tsoundName = sound.data.name ? `${sound.data.name} (${soundName})` : soundName;\r\n\r\n\t\tif (sound.data.creatorUserId !== game.userId) {\r\n\t\t\tlet user_name = game.users.get(sound.data.creatorUserId)?.name;\r\n\t\t\tlet formattedUsername = (user_name\r\n\t\t\t\t? localize(\"SEQUENCER.ManagerPlayersSound\", { user_name })\r\n\t\t\t\t: localize(\"SEQUENCER.ManagerUnknownSound\"));\r\n\t\t\tsoundName += ` (${formattedUsername})`;\r\n\t\t}\r\n\r\n\t\treturn soundName;\r\n\r\n\t}\r\n\r\n\tfunction mouseOver() {\r\n\t\tSelectionManager.hoveredSoundUI = sound;\r\n\t}\r\n\r\n\tfunction mouseLeave() {\r\n\t\tSelectionManager.hoveredSoundUI = false;\r\n\t}\r\n\r\n\tfunction endSound() {\r\n\t\tSelectionManager.hoveredSoundUI = false;\r\n\t\tSequencerSoundManager.endSounds({ sounds: [sound.id] }, true);\r\n\t}\r\n\r\n</script>\r\n\r\n\r\n<div class=\"sound hover-highlight\" on:mouseleave={mouseLeave} on:mouseover={mouseOver}>\r\n\t<button class=\"btn_end\" on:click={endSound} type=\"button\">\r\n\t\t<i class=\"fas fa-times\"></i>\r\n\t</button>\r\n\t<div class=\"sound-text hover-text\">\r\n\t\t{getSoundName(sound)}\r\n\t</div>\r\n</div>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n  .sound {\r\n    display: flex;\r\n    flex: 1 0 auto;\r\n  }\r\n\r\n  .sound > button {\r\n    flex: 0;\r\n    font-size: 0.7rem;\r\n    height: 1.25rem;\r\n    line-height: normal;\r\n    margin-right: 5px;\r\n  }\r\n\r\n  .btn_end {\r\n    min-width: 1.5rem;\r\n  }\r\n\r\n  .sound > div {\r\n    flex: 1;\r\n    line-height: 1.25rem;\r\n  }\r\n\r\n  .hover-highlight:hover > .hover-text {\r\n    color: #000;\r\n    text-shadow: 0 0 10px red;\r\n  }\r\n\r\n</style>\r\n","<script>\r\n  import SequenceManager from \"../../modules/sequence-manager.js\";\r\n  import EffectEntry from \"../components/EffectEntry.svelte\";\r\n  import SoundEntry from \"../components/SoundEntry.svelte\";\r\n  import SequencerSoundManager from \"../../modules/sequencer-sound-manager.js\";\r\n\r\n  const VisibleEffects = SequenceManager.VisibleEffects;\r\n  const RunningSounds = SequenceManager.RunningSounds;\r\n\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n\tlet sounds = [];\r\n  $: effects = Object.values($VisibleEffects);\r\n\r\n  $: sounds = Object.values($RunningSounds);\r\n\r\n  $: persistentEffects = effects.filter(effect => effect.data.persist);\r\n  $: temporaryEffects = effects.filter(effect => !effect.data.persist);\r\n\r\n  $: persistentSounds = sounds.filter(effect => effect.data.persist);\r\n  $: temporarySounds = sounds.filter(effect => !effect.data.persist);\r\n\r\n  function endAllEffects() {\r\n    Sequencer.EffectManager.endEffects({\r\n      effects: effects.filter(effect => effect.userCanDelete && !effect.data.private)\r\n\t\t});\r\n  }\r\n\r\n  function endAllSounds() {\r\n    SequencerSoundManager.endSounds({\r\n      sounds: Object.entries($RunningSounds)\r\n        .map(e => e[0])\r\n\t\t});\r\n  }\r\n\r\n</script>\r\n\r\n<div class=\"effects-container\">\r\n\r\n  {#if !effects.length && !sounds.length}\r\n\r\n    <div class=\"no-effects\">\r\n      <h2>{localize(\"SEQUENCER.Manager.NothingPlaying\")}</h2>\r\n    </div>\r\n\r\n  {/if}\r\n\r\n  {#if effects.length}\r\n    <button class=\"w-100 end-all-effects mb-2\" on:click={endAllEffects} type=\"button\">\r\n      {localize(\"SEQUENCER.Manager.EndAllEffects\")}\r\n    </button>\r\n\r\n    <div class=\"effects\">\r\n\r\n      {#if persistentEffects.length}\r\n        <h2>{localize(\"SEQUENCER.Manager.PersistentEffects\")}</h2>\r\n        <div>\r\n          {#each persistentEffects as effect (effect.id)}\r\n            <EffectEntry {effect} />\r\n          {/each}\r\n        </div>\r\n      {/if}\r\n\r\n      {#if temporaryEffects.length && persistentEffects.length}\r\n        <hr />\r\n      {/if}\r\n\r\n      {#if temporaryEffects.length}\r\n        <h2>{localize(\"SEQUENCER.Manager.TemporaryEffects\")}</h2>\r\n        <div>\r\n          {#each temporaryEffects as effect (effect.id)}\r\n            <EffectEntry {effect} />\r\n          {/each}\r\n        </div>\r\n      {/if}\r\n\r\n    </div>\r\n\r\n  {/if}\r\n\r\n  {#if sounds.length}\r\n    <button class=\"w-100 end-all-effects mb-2\" on:click={endAllSounds} type=\"button\">\r\n      {localize(\"SEQUENCER.Manager.EndAllSounds\")}\r\n    </button>\r\n\r\n    <div>\r\n\t    {#if persistentSounds.length}\r\n\t\t    <h2>{localize(\"SEQUENCER.Manager.PersistentSounds\")}</h2>\r\n\t\t    <div>\r\n\t\t\t    {#each persistentSounds as sound (sound.id)}\r\n\t\t\t\t    <SoundEntry {sound} />\r\n\t\t\t    {/each}\r\n\t\t    </div>\r\n\t    {/if}\r\n\r\n\t    {#if temporarySounds.length && persistentSounds.length}\r\n\t\t    <hr />\r\n\t    {/if}\r\n\r\n\t    {#if temporarySounds.length}\r\n\t\t    <h2>{localize(\"SEQUENCER.Manager.TemporarySounds\")}</h2>\r\n\t\t    <div>\r\n\t\t\t    {#each temporarySounds as sound (sound.id)}\r\n\t\t\t\t    <SoundEntry {sound} />\r\n\t\t\t    {/each}\r\n\t\t    </div>\r\n\t    {/if}\r\n    </div>\r\n\r\n  {/if}\r\n\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n  .end-all-effects{\r\n    margin-bottom: 0.5rem;\r\n  }\r\n\r\n  .effects-container {\r\n    min-width: 320px;\r\n    min-height: 563px;\r\n    max-width: 320px;\r\n    max-height: 563px;\r\n    display: flex;\r\n    flex-direction: column;\r\n    overflow-y: auto;\r\n  }\r\n\r\n  .effects {\r\n    flex: 1;\r\n    margin-top: 0.5rem;\r\n  }\r\n\r\n  .running-sequences {\r\n    flex: 1;\r\n    margin-top: 0.5rem;\r\n  }\r\n\r\n</style>\r\n","export function applyStyles(node, data) {\r\n\t// the node has been mounted in the DOM\r\n\r\n\t$effect(() => {\r\n\t\t// setup goes here\r\n\r\n\t\tlet existingStyle = node.getAttribute('style') || '';\r\n\t\tlet existingStyleObj = {};\r\n\r\n\t\tif (existingStyle) {\r\n\t\t\texistingStyleObj = Object.fromEntries(\r\n\t\t\t\texistingStyle.split(';')\r\n\t\t\t\t\t.filter(style => style.trim())\r\n\t\t\t\t\t.map(style => {\r\n\t\t\t\t\t\tconst [key, value] = style.split(':');\r\n\t\t\t\t\t\treturn [key.trim(), value.trim()];\r\n\t\t\t\t\t})\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tconst mergedStyles = { ...existingStyleObj, ...data };\r\n\r\n\t\tlet styles = Object.entries(mergedStyles)\r\n\t\t\t.map(([key, value]) => `${key}: ${value};`)\r\n\t\t\t.join('');\r\n\r\n\t\tnode.setAttribute('style', styles);\r\n\r\n\t\treturn () => {\r\n\t\t\tconst currentStyle = node.getAttribute('style') || '';\r\n\t\t\tconst currentStyleObj = Object.fromEntries(\r\n\t\t\t\tcurrentStyle.split(';')\r\n\t\t\t\t\t.filter(style => style.trim())\r\n\t\t\t\t\t.map(style => {\r\n\t\t\t\t\t\tconst [key, value] = style.split(':');\r\n\t\t\t\t\t\treturn [key.trim(), value.trim()];\r\n\t\t\t\t\t})\r\n\t\t\t);\r\n\r\n\t\t\tObject.keys(data).forEach(key => delete currentStyleObj[key]);\r\n\r\n\t\t\tconst cleanedStyles = Object.entries(currentStyleObj)\r\n\t\t\t\t.map(([key, value]) => `${key}: ${value};`)\r\n\t\t\t\t.join('');\r\n\r\n\t\t\tnode.setAttribute('style', cleanedStyles);\r\n\t\t};\r\n\t});\r\n}","<script>\r\n\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n  import { writable } from \"svelte/store\";\r\n  import { applyStyles } from \"./actions.svelte.js\"\r\n\r\n  export let setting;\r\n  export let lock = false;\r\n  export let min = 0.1;\r\n  export let max = 2;\r\n  export let maxInput = Infinity;\r\n  export let step = 0.01;\r\n  export let styles = {};\r\n\r\n  const store = setting.store;\r\n  const isLocked = lock ? lock.store : writable(false);\r\n\r\n</script>\r\n\r\n<div style=\"display: flex; align-items: center;\" use:applyStyles={styles}>\r\n\t<label>{localize(setting.label)}</label>\r\n\t<input bind:value=\"{$store}\" disabled={$isLocked} {max} {min} {step} type=\"range\"/>\r\n\t<input bind:value=\"{$store}\" disabled={$isLocked} max={maxInput} {min} required {step} type=\"number\"/>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n\tlabel {\r\n\t\tflex: 1 0 auto;\r\n\t\tmargin-right: 0.25rem;\r\n\t}\r\n\r\n\tinput[type=\"range\"] {\r\n    flex: 1 0 50%;\r\n    margin-right: 0.25rem;\r\n\t}\r\n\r\n\tinput[type=\"number\"] {\r\n    flex: 1 0 15%;\r\n\t}\r\n\r\n</style>\r\n","<script>\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n  import { writable } from \"svelte/store\";\r\n\timport { applyStyles } from \"./actions.svelte.js\"\r\n\r\n  export let setting;\r\n  export let label = false;\r\n  export let lock = false;\r\n  export let inverse = false\r\n  export let styles = {};\r\n\r\n\tconst id = \"sequencer-input-\" + foundry.utils.randomID();\r\n  const store = setting.store;\r\n  const isLocked = lock ? lock.store : writable(inverse);\r\n\r\n  $: {\r\n    if($isLocked !== inverse){\r\n      $store = false;\r\n\t\t}\r\n  }\r\n\r\n</script>\r\n\r\n<div style=\"display: flex; align-items: center;\" use:applyStyles={styles}>\r\n\t<input id={id} disabled={$isLocked !== inverse} style=\"height:15px;\" type=\"checkbox\" bind:checked={$store}/>\r\n\t<label for={id}>{localize(setting.label)}</label>\r\n</div>\r\n","<script>\r\n\tlet localize = game.i18n.localize.bind(game.i18n);\r\n\timport { applyStyles } from \"./actions.svelte.js\"\r\n  import { writable } from \"svelte/store\";\r\n\r\n  export let setting;\r\n  export let lock = false;\r\n  export let inverse = false;\r\n  export let styles = {};\r\n\r\n  const id = \"sequencer-input-\" + foundry.utils.randomID();\r\n  const store = setting.store;\r\n  const isLocked = lock ? lock.store : writable(inverse);\r\n</script>\r\n\r\n<div style=\"display: flex; align-items: center;\" use:applyStyles={styles}>\r\n\t{#if localize(setting.label)}\r\n\t\t<label for={id}>{localize(setting.label)}</label>\r\n\t{/if}\r\n\t<input id={id} type=\"number\" disabled={$isLocked !== inverse} bind:value={$store} on:change={() => { if($store === null) $store = 0; }}/>\r\n</div>\r\n\r\n\r\n<style lang=\"scss\">\r\n\tlabel {\r\n    text-align: right;\r\n    flex: 1 0 auto;\r\n\t\tpadding-right: 0.25rem;\r\n\t}\r\n\r\n\tinput {\r\n\t\twidth: 100%;\r\n\t\tflex: 1 0 40%;\r\n\t}\r\n</style>\r\n","<script>\r\n\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n  import { applyStyles } from \"./actions.svelte.js\"\r\n\r\n\texport let setting;\r\n  export let styles = {};\r\n\r\n  const store = setting.store;\r\n\r\n  const width = 5.75;\r\n\r\n  $: finalStyles = {\r\n    ...styles,\r\n\t\t\"--switch-width\": `${width}em`,\r\n\t\t\"--half-switch-width\": `${width-1.5}em`,\r\n\t\t\"--half-switch-width-on\": `${width-1.7}em`,\r\n\t}\r\n\r\n</script>\r\n\r\n<div style=\"display: flex; align-items: center;\" use:applyStyles={finalStyles}>\r\n\r\n\t<div class=\"first\" class:active={!$store} on:click={() => { $store = false; }}>\r\n\t\t<span>{localize(setting.label_off)}</span>\r\n\t</div>\r\n\t<div class=\"second\" class:active={$store} on:click={() => { $store = true; }}>\r\n\t\t<span>{localize(setting.label_on)}</span>\r\n\t</div>\r\n\r\n</div>\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n\tdiv > div {\r\n\t\tdisplay: flex;\r\n\t\talign-items: center;\r\n\t\tpadding: 2px 5px;\r\n\t\tborder: 1px solid #919191;\r\n\t\tcursor:pointer;\r\n\t}\r\n\r\n\t.first {\r\n\t\tborder-bottom-left-radius: 5px;\r\n\t\tborder-top-left-radius: 5px;\r\n\t\tbackground: #ccc;\r\n    border-right: 0;\r\n\t}\r\n\r\n\t.second {\r\n\t\tborder-bottom-right-radius: 5px;\r\n\t\tborder-top-right-radius: 5px;\r\n\t\tbackground: #ccc;\r\n\t}\r\n\r\n\t.active {\r\n    background: #eaeaea;\r\n\t}\r\n\r\n</style>\r\n","<script>\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n  import { PlayerSettings } from \"./effect-player-store.js\";\r\n  import { get } from \"svelte/store\";\r\n  import SequencerDatabase from \"../../modules/sequencer-database.js\";\r\n  import SliderInput from \"../components/SliderInput.svelte\";\r\n  import Checkbox from \"../components/Checkbox.svelte\";\r\n  import NumberInput from \"../components/NumberInput.svelte\";\r\n  import SwitchToggle from \"../components/SwitchToggle.svelte\";\r\n  import CONSTANTS from \"../../constants.js\";\r\n\r\n  const fileStore = PlayerSettings.file.store;\r\n  const users = game.users.filter(user => user.active);\r\n  const userStore = PlayerSettings.users.store;\r\n\r\n  let lastInput = \"\";\r\n  let lastResults = [];\r\n  let suggestions = [];\r\n  const searchDebounce = foundry.utils.debounce(() => {\r\n    const fileInput = get(fileStore).toLowerCase();\r\n    if(!fileInput){\r\n      suggestions = SequencerDatabase.publicModules;\r\n      return;\r\n\t\t}\r\n    if (lastInput === fileInput) return;\r\n    let results = SequencerDatabase.searchFor(fileInput);\r\n    if (lastResults.equals(results)) return;\r\n    lastResults = foundry.utils.duplicate(results);\r\n    if (results.length === 1 && results[0].startsWith(fileInput)) return;\r\n    if (results.length > 100) {\r\n      results = results.slice(0, 100);\r\n    }\r\n    suggestions = foundry.utils.duplicate(results);\r\n  }, 200);\r\n\r\n  $: searchDebounce($fileStore);\r\n\r\n  async function activateLayer(){\r\n\t\tui.controls.activate({ control: \"sequencer\", tool: CONSTANTS.TOOLS.PLAY });\r\n\t  canvas.sequencerInterfaceLayer.activate({ tool: CONSTANTS.TOOLS.PLAY });\r\n  }\r\n\r\n  let filePicker = false;\r\n\r\n  function handleClick() {\r\n    if (!filePicker) {\r\n      const file = get(fileStore);\r\n      const current = SequencerDatabase.getEntry(file, { softFail: true })\r\n        ? file\r\n        : \"\";\r\n      filePicker = new foundry.applications.apps.FilePicker.implementation({\r\n        type: \"imageVideo\",\r\n        current,\r\n        callback: path => {\r\n          fileStore.set(path);\r\n          filePicker = false;\r\n        }\r\n      });\r\n    }\r\n    filePicker.render(true, { focus: true });\r\n  }\r\n\r\n  const presets = PlayerSettings.getPresets();\r\n  let selectedPreset = \"default\";\r\n\r\n</script>\r\n\r\n<div class=\"effect-player-container\">\r\n\r\n\t<fieldset>\r\n\r\n\t\t<legend>Effect</legend>\r\n\r\n\t\t<button class=\"activate-layer\" type=\"button\" on:click={() => activateLayer()}>{localize(\"SEQUENCER.Player.SwitchToLayer\")}</button>\r\n\r\n\t\t<div class=\"file-settings\">\r\n\t\t\t<input bind:value={$fileStore} class=\"file-input flex3\"\r\n             list=\"dblist\"\r\n\t\t\t\t\t\t placeholder='{localize(\"SEQUENCER.Player.PathInput\")}'\r\n\t\t\t\t\t\t type=\"text\"/>\r\n\t\t\t<button class=\"custom-file-picker small-button\" type=\"button\" on:click={handleClick}>\r\n        <i class=\"fas fa-file-import\"></i>\r\n      </button>\r\n\t\t\t<datalist id=\"dblist\">\r\n\t\t\t\t{#each suggestions as suggestion}\r\n\t\t\t\t\t<option>{suggestion}</option>\r\n\t\t\t\t{/each}\r\n\t\t\t</datalist>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"user-settings flexcol\">\r\n\t\t\t<label for=\"user-select\">Play for users:</label>\r\n\t\t\t<select class=\"user-select\" id=\"user-select\" multiple bind:value={$userStore}>\r\n\t\t\t\t<option selected value=\"all\">{localize(\"SEQUENCER.Player.AllUsers\")}</option>\r\n\t\t\t\t{#each users as user (user.id)}\r\n\t\t\t\t\t<option value=\"{user.id}\">{user.name}</option>\r\n\t\t\t\t{/each}\r\n\t\t\t</select>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"flexcol\">\r\n\r\n\t\t\t<div class=\"row w-100\">{localize(\"SEQUENCER.Player.Presets\")}</div>\r\n\r\n\t\t\t<div class=\"preset-container\">\r\n\r\n\t\t\t\t<select class=\"preset-select\" bind:value={selectedPreset} on:change={() => PlayerSettings.loadPreset(selectedPreset)}>\r\n\r\n\t\t\t\t\t<option value=\"default\">{localize(\"SEQUENCER.Player.PresetsDefault\")}</option>\r\n\t\t\t\t\t{#each presets as preset}\r\n\t\t\t\t\t\t<option>{preset}</option>\r\n\t\t\t\t\t{/each}\r\n\t\t\t\t\t<!--{{#each presets}}-->\r\n\t\t\t\t\t<!--<option>{{ @key }}</option>-->\r\n\t\t\t\t\t<!--{{/each}}-->\r\n\r\n\t\t\t\t</select>\r\n\r\n\t\t\t\t<button class=\"save-preset small-button\" data-tooltip=\"Save Preset\" type=\"button\" on:click={() => PlayerSettings.savePreset(selectedPreset)}>\r\n\t\t\t\t\t<i class=\"fas fa-download\"></i>\r\n\t\t\t\t</button>\r\n\t\t\t\t<button class=\"copy-preset small-button\" data-tooltip=\"Copy Preset\" disabled={selectedPreset === \"default\"} type=\"button\" on:click={() => PlayerSettings.copyPreset(selectedPreset)}>\r\n\t\t\t\t\t<i class=\"fas fa-copy\"></i>\r\n\t\t\t\t</button>\r\n\t\t\t\t<button class=\"delete-preset small-button\" data-tooltip=\"Delete Preset\" disabled={selectedPreset === \"default\"} type=\"button\" on:click={() => PlayerSettings.deletePreset(selectedPreset)}>\r\n\t\t\t\t\t<i class=\"fas fa-times\"></i>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</fieldset>\r\n\r\n\t<fieldset>\r\n\r\n\t\t<legend>Transform</legend>\r\n\r\n\t\t<div class=\"effect-transform-container\">\r\n\t\t\t<SliderInput setting={PlayerSettings.scale} styles={{ \"grid-column\": `1 / 5` }}/>\r\n\t\t\t<NumberInput setting={PlayerSettings.scaleIn} styles={{ \"grid-column\": `1 / 3` }}/>\r\n\t\t\t<NumberInput setting={PlayerSettings.scaleOut} styles={{ \"grid-column\": `3 / 5` }}/>\r\n\t\t\t<div class=\"divider\"></div>\r\n\t\t\t<SliderInput setting={PlayerSettings.rotation} lock={PlayerSettings.randomRotation} min=\"-180\" max=\"180\"  styles={{ \"grid-column\": `1 / 5` }}/>\r\n\t\t\t<div></div>\r\n\t\t\t<Checkbox setting={PlayerSettings.randomRotation} styles={{ \"grid-column\": `2 / 4` }}/>\r\n\t\t\t<div></div>\r\n\t\t\t<div class=\"divider\"></div>\r\n\t\t\t<Checkbox setting={PlayerSettings.mirrorX} styles={{ \"grid-column\": `1 / 3` }}/>\r\n\t\t\t<Checkbox setting={PlayerSettings.mirrorY} styles={{ \"grid-column\": `3 / 5` }}/>\r\n\t\t\t<Checkbox setting={PlayerSettings.randomMirrorX} styles={{ \"grid-column\": `1 / 3` }} lock={PlayerSettings.mirrorX} inverse/>\r\n\t\t\t<Checkbox setting={PlayerSettings.randomMirrorY} styles={{ \"grid-column\": `3 / 5` }} lock={PlayerSettings.mirrorY} inverse/>\r\n\t\t\t<div class=\"divider\"></div>\r\n\t\t\t<NumberInput setting={PlayerSettings.offsetX} lock={PlayerSettings.randomOffset} styles={{ \"grid-column\": `1 / 3` }}/>\r\n\t\t\t<NumberInput setting={PlayerSettings.offsetY} lock={PlayerSettings.randomOffset} styles={{ \"grid-column\": `3 / 5` }}/>\r\n\t\t\t<Checkbox setting={PlayerSettings.randomOffset} styles={{ \"grid-column\": `1 / 3` }}/>\r\n\t\t\t<NumberInput setting={PlayerSettings.randomOffsetAmount} lock={PlayerSettings.randomOffset} inverse styles={{ \"grid-column\": `3 / 5` }}/>\r\n\t\t\t<Checkbox setting={PlayerSettings.offsetGridUnits} styles={{ \"grid-column\": `2 / 5` }}/>\r\n\t\t\t<div></div>\r\n\t\t</div>\r\n\r\n\t</fieldset>\r\n\r\n\t<fieldset>\r\n\r\n\t\t<legend>Behavior</legend>\r\n\t\t<div class=\"effect-transform-container\">\r\n\t\t\t<NumberInput setting={PlayerSettings.fadeIn} styles={{ \"grid-column\": `1 / 3` }}/>\r\n\t\t\t<NumberInput setting={PlayerSettings.fadeOut} styles={{ \"grid-column\": `3 / 5` }}/>\r\n\t\t\t<div class=\"divider\"></div>\r\n\t\t\t<Checkbox setting={PlayerSettings.repeat} styles={{ \"grid-column\": `1 / 3` }}/>\r\n\t\t\t<NumberInput setting={PlayerSettings.repetitions} lock={PlayerSettings.repeat} inverse styles={{ \"grid-column\": `3 / 5` }}/>\r\n\t\t\t<NumberInput setting={PlayerSettings.repeatDelayMin} lock={PlayerSettings.repeat} inverse styles={{ \"grid-column\": `3 / 4` }}/>\r\n\t\t\t<NumberInput setting={PlayerSettings.repeatDelayMax} lock={PlayerSettings.repeat} inverse styles={{ \"grid-column\": `4 / 5` }}/>\r\n\t\t\t<div class=\"divider\"></div>\r\n\t\t\t<SwitchToggle setting={PlayerSettings.moveTowards} styles={{ \"grid-column\": `1 / 3` }}/>\r\n\t\t\t<NumberInput setting={PlayerSettings.moveSpeed} lock={PlayerSettings.moveTowards} inverse styles={{ \"grid-column\": `3 / 5` }}/>\r\n\t\t\t<div class=\"divider\"></div>\r\n\t\t\t<Checkbox setting={PlayerSettings.attachTo} styles={{ \"grid-column\": `1 / 5` }}/>\r\n\t\t\t<Checkbox setting={PlayerSettings.stretchToAttach} styles={{ \"grid-column\": `1 / 5` }}/>\r\n\t\t\t<Checkbox setting={PlayerSettings.snapToGrid} styles={{ \"grid-column\": `1 / 5` }}/>\r\n\t\t\t<Checkbox setting={PlayerSettings.persist} styles={{ \"grid-column\": `1 / 5` }}/>\r\n\t\t\t<Checkbox setting={PlayerSettings.belowTokens} styles={{ \"grid-column\": `1 / 5` }}/>\r\n\t\t</div>\r\n\r\n\t</fieldset>\r\n\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n\t.activate-layer {\r\n\t\tmargin-bottom: 0.5rem;\r\n\t}\r\n\r\n\t.file-settings {\r\n\t\tdisplay: flex;\r\n    margin-bottom: 0.5rem;\r\n\t}\r\n\r\n\t.preset-container {\r\n\t\tdisplay: flex;\r\n    margin-bottom: 0.5rem;\r\n\r\n\t\tselect {\r\n\t\t\tflex: 1;\r\n    }\r\n\t}\r\n\r\n  .small-button {\r\n    flex: 0 0 24px;\r\n    min-width: 30px;\r\n    line-height: 24px;\r\n    margin: -1px 0 -1px 4px;\r\n    order: 99;\r\n    text-align: center;\r\n\r\n    i {\r\n      margin: 0;\r\n    }\r\n\r\n    &:disabled {\r\n      cursor: initial;\r\n      opacity: 0.5;\r\n    }\r\n\r\n  }\r\n\r\n\t.user-settings {\r\n    margin-bottom: 0.5rem;\r\n\t}\r\n\r\n  .scrolling-text {\r\n\r\n  }\r\n\r\n  /* jb2a.breath_weapons02.burst.cone.arcana */\r\n\r\n</style>\r\n","<script>\r\n\r\n  import CONSTANTS from \"../../constants.js\";\r\n\r\n  export let status;\r\n\r\n</script>\r\n\r\n<i class=\"fa-solid background-circle\"\r\n   class:invisible={$status === CONSTANTS.STATUS.READY}\r\n   class:fa-arrow-right={$status === CONSTANTS.STATUS.RUNNING || $status === CONSTANTS.STATUS.READY}\r\n   class:fa-check={$status === CONSTANTS.STATUS.COMPLETE}\r\n   class:fa-arrow-down={$status === CONSTANTS.STATUS.SKIPPED}\r\n   class:fa-times={$status === CONSTANTS.STATUS.ABORTED}>\r\n</i>\r\n<i class=\"fa-solid \"></i>\r\n\r\n<style lang=\"scss\">\r\n\r\n  .background-circle{\r\n    position: relative;\r\n    z-index: 2;\r\n    margin-right: 0.2rem;\r\n    min-width: 1rem;\r\n    text-align: center;\r\n  }\r\n\r\n  .invisible {\r\n    opacity: 0;\r\n  }\r\n\r\n</style>\r\n","<script>\r\n\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n  import SequenceStatus from \"./SequenceStatus.svelte\";\r\n  import CONSTANTS from \"../../constants.js\";\r\n\r\n  export let section;\r\n\r\n  const status = section.sectionStatus;\r\n  const sectionName = (section?.constructor?.niceName ? section?.constructor?.niceName : section.constructor.name) + (section?._name ? \" - \" + section._name : \"\");\r\n\r\n</script>\r\n\r\n<div>\r\n  <span>\r\n    <SequenceStatus {status}/>\r\n  </span>\r\n  <span class=\"section-name\">{sectionName}</span>\r\n  <span class=\"sequence-actions\" data-tooltip={localize(\"SEQUENCER.Sequences.AbortSection\")}>\r\n    <a class:section-done={$status > CONSTANTS.STATUS.READY} on:click={() => { section._abortSection(); }}>\r\n      <i class=\"fas fa-stop\"></i>\r\n    </a>\r\n  </span>\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n  div {\r\n    display: flex;\r\n    flex-direction: row;\r\n    align-items: center;\r\n    margin-left: 0.5rem;\r\n    padding: 3px 5px;\r\n    border-radius: 3px;\r\n\r\n    .section-name {\r\n      flex: 1;\r\n    }\r\n\r\n    &:hover {\r\n      background: rgba(0, 0, 0, 0.1);\r\n    }\r\n\r\n    .sequence-actions {\r\n      opacity: 0.3;\r\n    }\r\n\r\n    &:hover .sequence-actions {\r\n      opacity: 0.8;\r\n    }\r\n\r\n    .section-done {\r\n      display: none;\r\n    }\r\n  }\r\n</style>\r\n","<script>\r\n\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n  import SequenceSection from \"./SequenceSection.svelte\";\r\n  import SequenceStatus from \"./SequenceStatus.svelte\";\r\n  import SequenceManager from \"../../modules/sequence-manager.js\";\r\n  import CONSTANTS from \"../../constants.js\";\r\n\r\n  export let sequence;\r\n  export let index;\r\n\r\n  const status = sequence.statusStore;\r\n\r\n</script>\r\n\r\n\r\n<div class=\"sequence-name-container\">\r\n  <span>\r\n    <SequenceStatus {status}/>\r\n  </span>\r\n  <span class=\"sequence-name\">\r\n    Sequence {index}{sequence.moduleName ? ` (${sequence.moduleName})` : \"\"}\r\n  </span>\r\n  <span class=\"sequence-actions\">\r\n    <a class=\"clear-sequence\"\r\n       class:sequence-done-show={$status > CONSTANTS.STATUS.RUNNING}\r\n       on:click={() => { SequenceManager.RunningSequences.delete(sequence.id); }}\r\n       data-tooltip={localize(\"SEQUENCER.Sequences.Clear\")}\r\n    >\r\n      <i class=\"fas fa-trash-can\"></i>\r\n    </a>\r\n    <a class:sequence-done-hide={$status > CONSTANTS.STATUS.RUNNING} on:click={() => { sequence._abort(); }} data-tooltip={localize(\"SEQUENCER.Sequences.AbortSequence\")}>\r\n      <i class=\"fas fa-stop\"></i>\r\n    </a>\r\n  </span>\r\n</div>\r\n{#each sequence.sections as section}\r\n  <SequenceSection {section} />\r\n{/each}\r\n\r\n\r\n<style lang=\"scss\">\r\n\r\n  .sequence-name-container{\r\n    display: flex;\r\n    font-weight: bold;\r\n    padding: 3px 5px;\r\n    border-radius: 3px;\r\n\r\n    .sequence-name {\r\n      flex: 1;\r\n    }\r\n\r\n    &:hover {\r\n      background: rgba(0, 0, 0, 0.1);\r\n    }\r\n\r\n    .sequence-actions {\r\n      display: flex;\r\n      max-width: 10px;\r\n      flex: 0 1 10px;\r\n      & a {\r\n        opacity: 0.35;\r\n      }\r\n    }\r\n\r\n    &:hover .sequence-actions a {\r\n      opacity: 0.7;\r\n\r\n      &:hover{\r\n        opacity: 1.0;\r\n      }\r\n    }\r\n\r\n    .clear-sequence {\r\n      margin-right: 0.5rem;\r\n      display: none;\r\n    }\r\n\r\n    .sequence-done-show {\r\n      display: block;\r\n    }\r\n\r\n    .sequence-done-hide {\r\n      display: none;\r\n    }\r\n\r\n  }\r\n\r\n</style>\r\n","<script>\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n  import { onMount, onDestroy } from \"svelte\";\r\n  import SequenceManager from \"../../modules/sequence-manager.js\";\r\n  import Sequence from \"../components/Sequence.svelte\";\r\n\r\n  const VisibleEffects = SequenceManager.VisibleEffects;\r\n  const RunningSequences = SequenceManager.RunningSequences;\r\n\r\n  $: runningSequences = Object.entries($RunningSequences);\r\n\r\n  onMount(() => {\r\n    SequenceManager.RunningSequences.clearFinishedSequences();\r\n  });\r\n\r\n  onDestroy(() => {\r\n    SequenceManager.RunningSequences.clearFinishedSequences();\r\n  });\r\n\r\n</script>\r\n\r\n<div class=\"sequence-container\">\r\n\r\n  {#if !runningSequences.length}\r\n\r\n    <div class=\"no-sequences\">\r\n      <h2>{localize(\"SEQUENCER.Sequences.NoSequences\")}</h2>\r\n    </div>\r\n\r\n  {:else}\r\n\r\n    <div class=\"sequence-button-header\">\r\n      <button type=\"button\" on:click={() => {\r\n         SequenceManager.RunningSequences.clearFinishedSequences();\r\n      }}>\r\n        {localize(\"SEQUENCER.Sequences.ClearFinished\")}\r\n      </button>\r\n      <button type=\"button\" on:click={() => {\r\n         SequenceManager.RunningSequences.stopAll();\r\n      }}>\r\n        {localize(\"SEQUENCER.Sequences.StopAll\")}\r\n      </button>\r\n    </div>\r\n\r\n    <div class=\"running-sequences\">\r\n      {#each runningSequences as [id, sequence], index (id)}\r\n        <Sequence {sequence} index={index+1}/>\r\n      {/each}\r\n    </div>\r\n\r\n  {/if}\r\n\r\n</div>\r\n\r\n<style lang=\"scss\">\r\n\r\n  .sequence-container {\r\n    min-width: 320px;\r\n    min-height: 563px;\r\n    max-width: 320px;\r\n    max-height: 563px;\r\n    display: flex;\r\n    flex-direction: column;\r\n  }\r\n\r\n  .sequence-button-header{\r\n    display: flex;\r\n    button {\r\n      font-size: 0.85rem;\r\n    }\r\n  }\r\n\r\n  .effects {\r\n    flex: 1;\r\n    margin-top: 0.5rem;\r\n  }\r\n\r\n  .running-sequences{\r\n    flex: 1;\r\n    margin-top: 0.5rem;\r\n  }\r\n\r\n</style>\r\n","<script>\r\n\r\n  let localize = game.i18n.localize.bind(game.i18n);\r\n  import HowTo from \"./HowTo.svelte\";\r\n  import Tabs from \"./Tabs.svelte\";\r\n  import Manager from \"./Manager.svelte\";\r\n  import Player from \"./Player.svelte\";\r\n  import Sequences from \"./Sequences.svelte\";\r\n\r\n  let { tab } = $props();\r\n\r\n  let tabs = [\r\n    { value: \"player\", label: localize(\"SEQUENCER.Player.Title\"), icon: \"fas fa-play-circle\", component: Player },\r\n    { value: \"manager\", label: localize(\"SEQUENCER.Manager.Title\"), icon: \"fas fa-film\", component: Manager },\r\n    { value: \"sequences\", label: localize(\"SEQUENCER.Sequences.Title\"), icon: \"fas fa-play\", component: Sequences },\r\n    { value: \"howto\", label: localize(\"SEQUENCER.HowTo.Title\"), icon: \"fas fa-chalkboard-teacher\", component: HowTo },\r\n  ];\r\n\r\n  let activeTab = $state(tab ?? \"manager\");\r\n  let component = $state(tabs[0].component);\r\n\t$effect(() => {\r\n\t\tcomponent = tabs.find(t => t.value === activeTab)?.component;\r\n\t})\r\n\r\n</script>\r\n\r\n<svelte:options accessors={true}/>\r\n\r\n<div>\r\n\r\n\t<Tabs bind:activeTab {tabs}/>\r\n\r\n\t<svelte:component this={component}/>\r\n\r\n</div>\r\n","import EffectsUIShell from \"./effects-ui-shell.svelte\";\nimport { SvelteApplicationMixin } from \"../SvelteMixin.js\";\n\nconst PATREON_URL = \"https://patreon.com/cw/fantasycomputerworks\";\n\nexport class EffectsUIApp extends SvelteApplicationMixin(foundry.applications.api.ApplicationV2) {\n\n\tstatic DEFAULT_OPTIONS = {\n\t\tclasses: [\"dialog\"],\n\t\ttab: \"manager\",\n\t\tposition: {\n\t\t\twidth: \"auto\",\n\t\t\theight: \"auto\",\n\t\t\ttop: 65,\n\t\t\tleft: 120,\n\t\t},\n\t\tactions: {\n\t\t\topenSequencerChangelog: () => {\n\t\t\t\tif (window.Sequencer?.showChangelog) window.Sequencer.showChangelog();\n\t\t\t},\n\t\t\topenSequencerPatreon: () => {\n\t\t\t\twindow.open(PATREON_URL, \"_blank\", \"noopener\");\n\t\t\t},\n\t\t},\n\t\twindow: {\n\t\t\ttitle: \"SEQUENCER.ManagerUI\",\n\t\t\ticon: \"fa-solid fa-archive\",\n\t\t\tresizable: false,\n\t\t\tcontrols: [\n\t\t\t\t{\n\t\t\t\t\taction: \"openSequencerChangelog\",\n\t\t\t\t\ticon: \"fa-solid fa-clipboard-list\",\n\t\t\t\t\tlabel: \"Changelog\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\taction: \"openSequencerPatreon\",\n\t\t\t\t\ticon: \"fa-brands fa-patreon\",\n\t\t\t\t\tlabel: \"Support Sequencer\",\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t};\n\n\troot = EffectsUIShell;\n}\n","import CONSTANTS from \"./constants.js\";\nimport { debug, 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-fix-pixi\", {\n    name: \"SEQUENCER.Setting.EnablePixiFix.Title\",\n    hint: \"SEQUENCER.Setting.EnablePixiFix.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-global-fix-pixi\", {\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  game.settings.register(CONSTANTS.MODULE_NAME, \"update-notice-shown-version\", {\n    scope: \"world\",\n    config: false,\n    default: \"0.0.0\",\n    type: String,\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\n    if (!game.settings.get(CONSTANTS.MODULE_NAME, \"showSidebarTools\")) return;\n\n\t  const sidebarTools = {\n\t\t  [CONSTANTS.TOOLS.SELECT]: {\n\t\t\t  name: CONSTANTS.TOOLS.SELECT,\n\t\t\t  title: \"SEQUENCER.SidebarButtons.Select\",\n\t\t\t  icon: \"fas fa-expand\",\n\t\t\t  visible:\n\t\t\t\t  user_can_do(\"permissions-effect-create\") &&\n\t\t\t\t  user_can_do(\"permissions-sidebar-tools\"),\n\t\t\t  onChange: () => {}\n\t\t  },\n\t\t  [CONSTANTS.TOOLS.PLAY]: {\n\t\t\t  name: CONSTANTS.TOOLS.PLAY,\n\t\t\t  title: \"SEQUENCER.SidebarButtons.Play\",\n\t\t\t  icon: \"fas fa-play\",\n\t\t\t  visible:\n\t\t\t\t  user_can_do(\"permissions-effect-create\") &&\n\t\t\t\t  user_can_do(\"permissions-sidebar-tools\"),\n\t\t\t  onChange: (event, active) => {\n\t\t\t\t  if (active) {\n\t\t\t\t\t\tEffectsUIApp.show({ inFocus: true, tab: \"player\" });\n\t\t\t\t  }\n\t\t\t  },\n\t\t  },\n\t\t  [CONSTANTS.TOOLS.VIEWER]: {\n\t\t\t  name: CONSTANTS.TOOLS.VIEWER,\n\t\t\t  title: \"SEQUENCER.SidebarButtons.Manager\",\n\t\t\t  icon: \"fas fa-film\",\n\t\t\t  button: true,\n\t\t\t  visible:\n\t\t\t\t  user_can_do(\"permissions-effect-create\") &&\n\t\t\t\t  user_can_do(\"permissions-sidebar-tools\"),\n\t\t\t  onChange: (event, active) => {\n\t\t\t\t  if (active) {\n\t\t\t\t\t  EffectsUIApp.show({ inFocus: true, tab: \"manager\" });\n\t\t\t\t  }\n\t\t\t  },\n\t\t  },\n\t\t  [CONSTANTS.TOOLS.DATABASE]: {\n\t\t\t  name: CONSTANTS.TOOLS.DATABASE,\n\t\t\t  title: \"SEQUENCER.SidebarButtons.Database\",\n\t\t\t  icon: \"fas fa-database\",\n\t\t\t  button: true,\n\t\t\t  visible: user_can_do(\"permissions-sidebar-tools\"),\n\t\t\t  onChange: (event, active) => {\n\t\t\t\t  if (active) {\n\t\t\t\t\t  DatabaseViewerApp.show();\n\t\t\t\t  }\n\t\t\t  },\n\t\t  }\n\t  }\n\n\t\treturn setupSidebarTools(controls, sidebarTools);\n\n  });\n\n  debug(\"Sequencer | Registered settings\");\n}\n\nfunction setupSidebarTools(controls, sidebarTools){\n\n\tcontrols[CONSTANTS.MODULE_NAME] = {\n\t\tname: CONSTANTS.MODULE_NAME,\n\t\ttitle: \"Sequencer Layer\",\n\t\ticon: \"fas fa-list-ol\",\n\t\tlayer: CONSTANTS.INTERFACE_LAYER,\n\t\tvisible:\n\t\t\tuser_can_do(\"permissions-effect-create\") &&\n\t\t\tuser_can_do(\"permissions-sidebar-tools\"),\n\t\tactiveTool: CONSTANTS.TOOLS.PLAY,\n\t\tonChange: (event, active) => {\n\t\t\tif ( active ) canvas.sequencerInterfaceLayer.activate({ tool: CONSTANTS.TOOLS.PLAY });\n\t\t},\n\t\ttools: sidebarTools,\n\t}\n\n\tif (!game.settings.get(CONSTANTS.MODULE_NAME, \"showTokenSidebarTools\")) {\n\t\treturn;\n\t}\n\n\tcontrols[\"tokens\"].tools[CONSTANTS.TOOLS.DATABASE] = sidebarTools[CONSTANTS.TOOLS.DATABASE];\n\tcontrols[\"tokens\"].tools[CONSTANTS.TOOLS.VIEWER] = sidebarTools[CONSTANTS.TOOLS.VIEWER];\n}\n\nexport async function migrateSettings() {\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 { BaseEffectsLayer, SequencerInterfaceLayer, UIEffectsLayer, } from \"./canvas-effects/effects-layer.js\";\nimport { debug } from \"./lib/lib.js\";\n\nexport default function registerLayers() {\n\tCONFIG.Canvas.layers = foundry.utils.mergeObject(foundry.canvas.Canvas.layers, {\n\t\tsequencerEffects: {\n\t\t\tlayerClass: BaseEffectsLayer,\n\t\t\tgroup: \"interface\",\n\t\t},\n\t\tsequencerInterfaceLayer: {\n\t\t\tlayerClass: SequencerInterfaceLayer,\n\t\t\tgroup: \"interface\",\n\t\t},\n\t\tsequencerEffectsUILayer: {\n\t\t\tlayerClass: UIEffectsLayer,\n\t\t\tgroup: \"interface\",\n\t\t},\n\t});\n\n\tdebug(\"Registered Layers\");\n}\n","import VisionSamplerShader from \"./lib/filters/vision-sampler-shader.js\";\nimport { debug } from \"./lib/lib.js\";\n\nexport default function registerBatchShader() {\n  VisionSamplerShader.registerPlugin();\n\n  debug(\"Registered VisionBatchShader\");\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.attachToUp,\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, debug, 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<string, Function>}\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    debug(`Sequencer | Presets | Added \"${inName}\" preset`);\n    return presetMap;\n  }\n\n  /**\n   * Retrieves all presets\n   *\n   * @returns {Map<string, Function>}\n   */\n  static getAll() {\n    return presetMap;\n  }\n\n  /**\n   * Retrieves preset based on its name\n   *\n   * @param {string} name\n   * @param {boolean} exact\n   * @returns {Function}\n   */\n  static get(name, exact = false) {\n\t  if(presetMap.has(name) || exact) {\n\t\t  return presetMap.get(name);\n\t  }\n\t  const parts = name.split(\".\");\n\t  parts.pop();\n\t  while(parts.length){\n\t\t\tconst newName = parts.join(\".\")\n\t\t  if(presetMap.has(newName)) {\n\t\t\t  return presetMap.get(newName);\n\t\t  }\n\t\t  parts.pop();\n\t  }\n\t\treturn false;\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<void>}\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<void>}\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      throw this.sequence._customError(\n        this,\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<void>}\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.screenSpace - if animating position, width, or height, this will set it to work in the screen's dimensions\n   *      @param {Boolean} inOptions.fromEnd   - makes this animation play from the end, like fadeOut, scaleOut, etc\n   *      @param {Boolean} inOptions.absolute  - makes this animation's values override the current value\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   *      @param {Boolean} inOptions.screenSpace - if animating position, width, or height, this will set it to work in the screen's dimensions\n   *      @param {Boolean} inOptions.absolute    - makes this animation's values override the current value\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  _channel: \"interface\",\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","export default {\n\t_elevation: null,\n\n\t/**\n\t * Sets the section's elevation, either as a single Z value or as an\n\t * elevation range `[bottom, top]`. The range form makes the section\n\t * visible on every scene level it reaches on Foundry v14+.\n\t *\n\t * @param {number|[number, number]} inElevation\n\t * @param {Object} inOptions\n\t * @param {boolean} [inOptions.absolute=false]\n\t * @param {boolean} [inOptions.topInclusive=false] Range form only.\n\t *   When true, the top value is part of the range, matching Foundry\n\t *   Region `elevation.topInclusive`. By default an effect whose top\n\t *   equals the next level's bottom sits just below that level rather\n\t *   than reaching into it.\n\t * @returns {this}\n\t */\n\televation(inElevation, inOptions = {}) {\n\t\tlet bottom;\n\t\tlet top;\n\t\tif (typeof inElevation === \"number\") {\n\t\t\tbottom = inElevation;\n\t\t} else if (Array.isArray(inElevation)\n\t\t\t&& inElevation.length === 2\n\t\t\t&& inElevation.every(n => typeof n === \"number\")) {\n\t\t\tbottom = Math.min(inElevation[0], inElevation[1]);\n\t\t\ttop = Math.max(inElevation[0], inElevation[1]);\n\t\t} else {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"elevation\",\n\t\t\t\t\"inElevation must be a number or a [bottom, top] array of two numbers\"\n\t\t\t);\n\t\t}\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"elevation\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tabsolute: false,\n\t\t\t\ttopInclusive: false,\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\n\t\tif (typeof inOptions.absolute !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"elevation\",\n\t\t\t\t\"inOptions.absolute must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions.topInclusive !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"elevation\",\n\t\t\t\t\"inOptions.topInclusive must be of type boolean\"\n\t\t\t);\n\t\tthis._elevation = {\n\t\t\televation: bottom,\n\t\t\ttop,\n\t\t\tabsolute: inOptions.absolute,\n\t\t\ttopInclusive: inOptions.topInclusive,\n\t\t};\n\t\treturn this;\n\t},\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   * 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 CONSTANTS from \"../../constants.js\";\n\nexport default {\n\t_levels: null,\n\n\t/**\n\t * Restricts this section to one or more scene levels on Foundry v14+.\n\t * Accepts a level id, level name, Level document, or an array mixing\n\t * any of those. Pass null to clear. Doesn't do anything on older\n\t * Foundry versions.\n\t *\n\t * Strings (ids or names) are resolved against the scene the section\n\t * is playing in, not the scene that was viewed when the section was\n\t * built. Level documents resolve to their id at build time.\n\t *\n\t * @param {string|foundry.documents.Level|Array<string|foundry.documents.Level>|null} inLevels\n\t * @returns {this}\n\t */\n\tonLevels(inLevels) {\n\t\tif (!CONSTANTS.IS_V14) return this;\n\t\tif (inLevels === null || inLevels === undefined) {\n\t\t\tthis._levels = null;\n\t\t\treturn this;\n\t\t}\n\t\tconst arr = Array.isArray(inLevels) ? inLevels : [inLevels];\n\t\tconst entries = arr.map((item) => {\n\t\t\tif (item && typeof item === \"object\" && item.documentName === \"Level\" && typeof item.id === \"string\") return item.id;\n\t\t\tif (typeof item === \"string\") return item;\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"onLevels\",\n\t\t\t\t\"expected a level id, level name, Level document, or an array of any combination\"\n\t\t\t);\n\t\t});\n\t\tthis._levels = entries.length ? entries : null;\n\t\treturn this;\n\t},\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.target, { 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 (inUser instanceof User) inUser = inUser.id;\n    if (typeof inUser !== \"string\")\n      throw this.sequence._customError(\n        this,\n        \"_addUser\",\n        \"inUser must be a User, a user ID, or a user name\"\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<string|User>} inUsers\n   * @returns this\n   */\n  forUsers(inUsers) {\n    if (!Array.isArray(inUsers)) inUsers = [inUsers];\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 { is_real_number, throttled_custom_warning } from \"../../lib/lib.js\";\nimport CONSTANTS from \"../../constants.js\";\n\n/**\n * Reverse lookup from numeric blend mode value to the canonical name used in\n * CONSTANTS.BLEND_MODES. Built once on module load.\n *\n * @type {Map<number, string>}\n */\nconst BLEND_MODE_NAMES = new Map(\n\tObject.entries(CONSTANTS.BLEND_MODES).map(([name, value]) => [value, name])\n);\n\n/**\n * Normalize a given blend mode name into the PIXI lookup key.\n * Accepts spaces, hyphens, or underscores between words and is case-insensitive.\n * e.g. \"Soft Light\", \"soft-light\", \"SOFT_LIGHT\", \"softlight\" → \"soft_light\"\n *\n * @param {string} name\n * @returns {string}\n */\nfunction normalizeBlendModeName(name) {\n\treturn String(name)\n\t\t.toLowerCase()\n\t\t.replace(/[\\s\\-]+/g, \"_\")\n\t\t.replace(/_+/g, \"_\")\n\t\t.trim();\n}\n\n/**\n * Resolve a string OR numeric input into the canonical PIXI.BLEND_MODES numeric\n * value. Returns null if the value cannot be resolved.\n *\n * Strings are looked up in CONSTANTS.BLEND_MODES (with name normalization, plus\n * a handful of aliases collapsed to the canonical key). Numbers are validated\n * to be one of the values in CONSTANTS.BLEND_MODES.\n *\n * @param {number|string} value\n * @returns {number|null}\n */\nfunction resolveBlendMode(value) {\n\tif (is_real_number(value)) {\n\t\tconst knownValues = Object.values(CONSTANTS.BLEND_MODES);\n\t\treturn knownValues.includes(value) ? value : null;\n\t}\n\tif (typeof value !== \"string\") return null;\n\n\tlet key = normalizeBlendModeName(value);\n\n\t// A few common aliases that don't share a stem with the canonical key.\n\tconst aliases = {\n\t\tnone: \"none\",\n\t\tdodge: \"color_dodge\",\n\t\tburn: \"color_burn\",\n\t\thardlight: \"hard_light\",\n\t\tsoftlight: \"soft_light\",\n\t\tcolordodge: \"color_dodge\",\n\t\tcolorburn: \"color_burn\",\n\t\tnormalnpm: \"normal_npm\",\n\t\taddnpm: \"add_npm\",\n\t\tscreennpm: \"screen_npm\"\n\t};\n\tconst compact = key.replace(/_/g, \"\");\n\tif (aliases[compact]) key = aliases[compact];\n\n\tconst resolved = CONSTANTS.BLEND_MODES[key];\n\treturn is_real_number(resolved) ? resolved : null;\n}\n\nexport default {\n\t_blendMode: null,\n\n\t/**\n\t * Sets the blend mode used when compositing this effect onto the canvas.\n\t *\n\t * Accepts either a string name (case-insensitive, hyphens/underscores/spaces\n\t * tolerated) or a numeric PIXI.BLEND_MODES constant.\n\t *\n\t * \"normal\", \"add\", \"multiply\", \"screen\", \"subtract\", and \"erase\" render\n\t * correctly on the GPU's blend unit. The \"advanced\" modes (overlay,\n\t * soft-light, hard-light, color-dodge, color-burn, darken, lighten,\n\t * difference, exclusion, hue, saturation, color, luminosity) are exposed\n\t * by name in PIXI v7 but are not implemented by the renderer; requesting\n\t * them logs a one-time warning and falls back to normal blending.\n\t *\n\t * @example\n\t *   .blendMode(\"multiply\")\n\t *   .blendMode(\"add\")\n\t *   .blendMode(PIXI.BLEND_MODES.SCREEN)\n\t *\n\t * @param {number|string} mode\n\t * @returns this\n\t */\n\tblendMode(mode) {\n\t\tif (!is_real_number(mode) && typeof mode !== \"string\") {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"blendMode\",\n\t\t\t\t\"mode must be a string (e.g. \\\"multiply\\\") or a number (PIXI.BLEND_MODES constant)\"\n\t\t\t);\n\t\t}\n\t\tconst resolved = resolveBlendMode(mode);\n\t\tif (resolved === null) {\n\t\t\tconst valid = Object.keys(CONSTANTS.BLEND_MODES).join(\", \");\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"blendMode\",\n\t\t\t\t`unknown blend mode \"${mode}\". Valid modes are: ${valid}`\n\t\t\t);\n\t\t}\n\t\tif (CONSTANTS.UNSUPPORTED_BLEND_MODES.has(resolved)) {\n\t\t\tconst name = BLEND_MODE_NAMES.get(resolved) ?? String(mode);\n\t\t\tthrottled_custom_warning(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t`Effect | .blendMode(\"${name}\") is not supported by PIXI v7 and will render as normal blending. Supported modes: normal, add, multiply, screen, subtract, erase.`\n\t\t\t);\n\t\t}\n\t\tthis._blendMode = resolved;\n\t\treturn this;\n\t}\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\t_offset: null,\n\t_randomOffset: 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 (!inLocation || !(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    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, { uuid: false })\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 * as lib from \"../../lib/lib.js\";\r\n\r\nexport default {\r\n\r\n  _name: null,\r\n  _origin: null,\r\n\r\n  /**\r\n   * Causes the effect or sound to be named, which affects them differently. In the case of effects, names can be used\r\n   * in the place of \r\n   *\r\n   * @param {String} inName\r\n   * @returns {EffectSection}\r\n   */\r\n  name(inName) {\r\n    if (typeof inName !== \"string\")\r\n      throw this.sequence._customError(\r\n        this,\r\n        \"name\",\r\n        \"inName must be of type string\"\r\n      );\r\n    this._name = lib.safe_str(inName);\r\n    return this;\r\n  },\r\n\r\n  /**\r\n   *  This is for adding extra information to an sound, like the origin of the sound in the form of the item's uuid.\r\n   *  The method accepts a string or a Document that has an UUID.\r\n   *\r\n   * @param {string|document} inOrigin\r\n   * @returns {Section}\r\n   */\r\n  origin(inOrigin) {\r\n    inOrigin = lib.validate_document(inOrigin);\r\n    if (inOrigin instanceof foundry.abstract.Document) {\r\n      inOrigin = inOrigin?.uuid;\r\n      if (!inOrigin)\r\n        throw this.sequence._customError(\r\n          this,\r\n          \"origin\",\r\n          \"could not find the UUID for the given Document\"\r\n        );\r\n    }\r\n    if (typeof inOrigin !== \"string\")\r\n      throw this.sequence._customError(\r\n        this,\r\n        \"origin\",\r\n        \"inOrigin must be of type string\"\r\n      );\r\n    this._origin = inOrigin;\r\n    return this;\r\n  }\r\n\r\n}\r\n","import animation from \"./animation.js\";\nimport audio from \"./audio.js\";\nimport elevation from \"./elevation.js\";\nimport files from \"./files.js\";\nimport levels from \"./levels.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 blendMode from \"./blendMode.js\";\nimport location from \"./location.js\";\nimport offset from \"./offset.js\";\nimport text from \"./text.js\";\nimport name from \"./name.js\";\n\nexport default {\n  animation,\n  audio,\n  elevation,\n  files,\n  levels,\n  moves,\n  opacity,\n  rotation,\n  scale,\n  time,\n  users,\n  filter,\n  tint,\n  blendMode,\n  location,\n  offset,\n  text,\n  name\n};\n","import CrosshairsPlaceable from \"./CrosshairsPlaceable.js\";\r\nimport { get_object_canvas_data } from \"../../lib/canvas-lib.js\";\r\nimport CONSTANTS from \"../../constants.js\";\r\n\r\n/**\r\n *\r\n *\r\n * @class CrosshairsDocument\r\n * @mixes ClientDocumentMixin\r\n *\r\n */\r\nexport default class CrosshairsDocument extends MeasuredTemplateDocument {\r\n\r\n\tconstructor(config = {}, context = {}, crosshair = {}, callbacks = {}) {\r\n\t\t// rectangles start off as a horizontal/vertical unseen line without this initial rotation\r\n\t\tif (config.t === CONST.MEASURED_TEMPLATE_TYPES.RECTANGLE && !(config.direction % 90)) {\r\n\t\t\tconfig.direction = 45;\r\n\t\t}\r\n\t\tsuper(config, context);\r\n\t\tthis.crosshair = foundry.utils.mergeObject(CrosshairsDocument.defaultConfig, crosshair);\r\n\t\tthis.callbacks = callbacks;\r\n\t\tthis.originalConfig = foundry.utils.deepClone(config);\r\n\t}\r\n\r\n\tcrosshair = {};\r\n\t#layer = null;\r\n\tcachedPosition = null;\r\n\toriginalConfig = {};\r\n\r\n\tstatic get placeableClass() {\r\n\t\treturn CrosshairsPlaceable;\r\n\t}\r\n\r\n\tstatic get defaultConfig() {\r\n\t\treturn {\r\n\t\t\tborderAlpha: 0.75,\r\n\t\t\tfillAlpha: 0.25,\r\n\t\t\ttextureAlpha: 0.5,\r\n\t\t\ttextureScale: 1.0,\r\n\t\t\tgridHighlight: true,\r\n\t\t\ticon: {\r\n\t\t\t\ttexture: \"\",\r\n\t\t\t\tborderVisible: false\r\n\t\t\t},\r\n\t\t\tsnap: {\r\n\t\t\t\tposition: CONST.GRID_SNAPPING_MODES.CENTER,\r\n\t\t\t\tsize: CONST.GRID_SNAPPING_MODES.CENTER,\r\n\t\t\t\tresolution: 1,\r\n\t\t\t\tdirection: 0\r\n\t\t\t},\r\n\t\t\tlockDrag: true,\r\n\t\t\tdistanceMin: null,\r\n\t\t\tdistanceMax: null,\r\n\t\t\tlabel: {\r\n\t\t\t\ttext: \"\",\r\n\t\t\t\tdx: 0,\r\n\t\t\t\tdy: 0,\r\n\t\t\t},\r\n\t\t\tlocation: {\r\n\t\t\t\tobj: null,\r\n\t\t\t\tlimitMinRange: null,\r\n\t\t\t\tlimitMaxRange: null,\r\n\t\t\t\tshowRange: false,\r\n\t\t\t\tdisplayRangePoly: false,\r\n\t\t\t\trangePolyFillColor: null,\r\n\t\t\t\trangePolyLineColor: null,\r\n\t\t\t\trangePolyFillAlpha: null,\r\n\t\t\t\trangePolyLineAlpha: null,\r\n\t\t\t\tlockToEdge: false,\r\n\t\t\t\tlockToEdgeDirection: false,\r\n\t\t\t\toffset: { x: 0, y: 0 },\r\n\t\t\t\twallBehavior: CONSTANTS.PLACEMENT_RESTRICTIONS.ANYWHERE\r\n\t\t\t},\r\n\t\t\tlockManualRotation: false\r\n\t\t};\r\n\t};\r\n\r\n\tgetOrientation() {\r\n\t\tthis.cachedPosition = (!this.object || this.object?.destroyed) ? this.cachedPosition : {\r\n\t\t\tsource: get_object_canvas_data(this.object, { uuid: false }),\r\n\t\t\ttarget: this.t === CONST.MEASURED_TEMPLATE_TYPES.CONE || this.t === CONST.MEASURED_TEMPLATE_TYPES.RAY\r\n\t\t\t\t? get_object_canvas_data(this.object, { measure: true, uuid: false })\r\n\t\t\t\t: null\r\n\t\t};\r\n\t\treturn this.cachedPosition;\r\n\t}\r\n\r\n\tget documentName() {\r\n\t\treturn 'CrosshairsDocument';\r\n\t}\r\n\r\n\tget layer() {\r\n\t\tif (this.#layer) return this.#layer;\r\n\t\tconst create = (doc) => new this.constructor.placeableClass(doc);\r\n\t\tconst sink = {\r\n\t\t\tget(target, prop) {\r\n\t\t\t\tswitch (prop) {\r\n\t\t\t\t\tcase 'createObject':\r\n\t\t\t\t\t\treturn create;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\treturn target[prop];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tthis.#layer = new Proxy(canvas.activeLayer, sink);\r\n\t\treturn this.#layer;\r\n\t}\r\n\r\n\tget isEmbedded() {\r\n\t\treturn !!this.parent;\r\n\t}\r\n\r\n\tgetCrosshairShape(){\r\n\t\tconst {t, distance, direction, angle, width} = this;\r\n\t\tswitch ( t ) {\r\n\t\t\tcase \"circle\":\r\n\t\t\t\treturn foundry.canvas.placeables.MeasuredTemplate.getCircleShape(distance);\r\n\t\t\tcase \"cone\":\r\n\t\t\t\treturn foundry.canvas.placeables.MeasuredTemplate.getConeShape(distance, direction, angle);\r\n\t\t\tcase \"rect\":\r\n\t\t\t\treturn foundry.canvas.placeables.MeasuredTemplate.getRectShape(distance, direction);\r\n\t\t\tcase \"ray\":\r\n\t\t\t\treturn foundry.canvas.placeables.MeasuredTemplate.getRayShape(distance, direction, width);\r\n\t\t}\r\n\t}\r\n\r\n\ttoken = {};\r\n\r\n\tprepareDerivedData() {\r\n\t\tsuper.prepareDerivedData();\r\n\t\tconst gridUnits = this.distance / this.parent.grid.distance;\r\n\t\tthis.radius = gridUnits * this.parent.grid.size;\r\n\t\tthis.token = {};\r\n\t\tthis.token.width = gridUnits * 2;\r\n\t\tthis.token.height = gridUnits * 2;\r\n\t\tswitch (this.t) {\r\n\t\t\tcase 'rect':\r\n\t\t\t\tthis.token.x = this.x;\r\n\t\t\t\tthis.token.y = this.y;\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'circle':\r\n\t\t\tdefault:\r\n\t\t\t\tthis.token.x = this.x - this.radius;\r\n\t\t\t\tthis.token.y = this.y - this.radius;\r\n\t\t}\r\n\t}\r\n\r\n\tshow() {\r\n\t\tthis._destroyed = false;\r\n\t\tthis.#layer = null;\r\n\t\treturn this.object.show();\r\n\t}\r\n\r\n}\r\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\";\nimport CrosshairsPlaceable from \"../modules/sequencer-crosshair/CrosshairsPlaceable.js\";\nimport CrosshairsDocument from \"../modules/sequencer-crosshair/CrosshairsDocument.js\";\n\nexport default class EffectSection extends Section {\n\tconstructor(inSequence, inFile = \"\") {\n\t\tsuper(inSequence);\n\t\tthis._deserializedData = null;\n\t\tthis._file = inFile;\n\t\tthis._text = null;\n\t\tthis._source = null;\n\t\tthis._stretchTo = null;\n\t\tthis._attachTo = null;\n\t\tthis._copySprite = null;\n\t\tthis._anchor = null;\n\t\tthis._spriteAnchor = null;\n\t\tthis._randomOffset = null;\n\t\tthis._missed = null;\n\t\tthis._private = null;\n\t\tthis._randomMirrorX = null;\n\t\tthis._randomMirrorY = null;\n\t\tthis._mirrorX = null;\n\t\tthis._mirrorY = null;\n\t\tthis._playbackRate = null;\n\t\tthis._template = null;\n\t\tthis._overrides = [];\n\t\tthis._zIndex = null;\n\t\tthis._offset = null;\n\t\tthis._spriteOffset = null;\n\t\tthis._size = null;\n\t\tthis._syncGroup = null;\n\t\tthis._persist = null;\n\t\tthis._persistOptions = null;\n\t\tthis._zeroSpriteRotation = null;\n\t\tthis._extraEndDuration = null;\n\t\tthis._loopOptions = null;\n\t\tthis._tilingTexture = null;\n\t\tthis._snapToGrid = null;\n\t\tthis._scaleToObject = null;\n\t\tthis._screenSpace = null;\n\t\tthis._screenSpaceAboveUI = null;\n\t\tthis._screenSpaceAnchor = null;\n\t\tthis._screenSpacePosition = null;\n\t\tthis._screenSpaceScale = null;\n\t\tthis._elevation = null;\n\t\tthis._sortLayer = 800;\n\t\tthis._levels = null;\n\t\tthis._masks = [];\n\t\tthis._tiedDocuments = [];\n\t\tthis._selfMask = false;\n\t\tthis._temporaryEffect = false;\n\t\tthis._spriteRotation = 0;\n\t\tthis._randomSpriteRotation = false;\n\t\tthis._isRangedEffect = null;\n\t\tthis._offsetLegacy = null;\n\t\tthis._randomOffsetLegacy = null;\n\t\tthis._aboveLighting = null;\n\t\tthis._aboveInterface = null;\n\t\tthis._spriteScaleMin = 1.0;\n\t\tthis._spriteScaleMax = null;\n\t\tthis._isometric = null;\n\t\tthis._shapes = [];\n\t\tthis._xray = null;\n\t\tthis._constrainedByWalls = null;\n\t\tthis._playEffect = true;\n\t}\n\n\tstatic niceName = \"Effect\";\n\n\t/**\n\t * @private\n\t */\n\tget _target() {\n\t\treturn this._stretchTo || this._rotateTowards || this._moveTowards || false;\n\t}\n\n\tstatic debounceWarning() {\n\t\tlib.custom_warning(\n\t\t\t\"Sequencer\",\n\t\t\t\"Effect | This user does not have permissions to play effects. This can be configured in Sequencer's module settings.\"\n\t\t);\n\t}\n\n\t/**\n\t * Causes the effect to persist indefinitely on the canvas until _ended via SequencerEffectManager.endAllEffects() or\n\t * name the effect with .name() and then end it through SequencerEffectManager.endEffect()\n\t *\n\t * @param {Boolean} [inBool=true] inBool\n\t * @param {Object} [inOptions={}] inOptions\n\t * @returns {EffectSection}\n\t */\n\tpersist(inBool = true, inOptions = {}) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"persist\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"persist\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tid: foundry.utils.randomID(),\n\t\t\t\tpersistTokenPrototype: false\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\t\tif (typeof inOptions.persistTokenPrototype !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"persist\",\n\t\t\t\t\"inOptions.persistTokenPrototype must be of type boolean\"\n\t\t\t);\n\t\tthis._persist = inBool;\n\t\tthis._persistOptions = inOptions;\n\t\treturn this;\n\t}\n\n\tsyncGroup(inString) {\n\t\tif (typeof inString !== \"string\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"syncGroup\",\n\t\t\t\t\"inString must be of type string\"\n\t\t\t);\n\t\tthis._syncGroup = inString;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the effect to become temporary, which means it will not be stored in the flags of any object,\n\t * even if it .persist() is called\n\t *\n\t * @param {Boolean} inBool\n\t * @returns {EffectSection}\n\t */\n\ttemporary(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"temporary\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._temporaryEffect = inBool || this._temporaryEffect;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the effect's playback rate. A playback rate of 2.0 would make it play 2x as fast, 0.5 would make\n\t * it play half as fast.\n\t *\n\t * @param {Number} inNumber\n\t * @returns {EffectSection}\n\t */\n\tplaybackRate(inNumber = 1.0) {\n\t\tif (!lib.is_real_number(inNumber))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"playbackRate\",\n\t\t\t\t\"inNumber must be of type number\"\n\t\t\t);\n\t\tthis._playbackRate = inNumber;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the effect to target a location close to the .stretchTowards() location, but not on it.\n\t *\n\t * @param {Boolean} [inBool=true] inBool\n\t * @returns {EffectSection}\n\t */\n\tmissed(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"missed\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._missed = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a function that will run at the end of the effect serialization step, but before it is played. Allows direct\n\t * modifications of effect's data. For example, it could be manipulated to change which file will be used based\n\t * on the distance to the target.\n\t *\n\t * @param {Function} inFunc\n\t * @returns {EffectSection}\n\t */\n\taddOverride(inFunc) {\n\t\tif (!lib.is_function(inFunc))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"addOverride\",\n\t\t\t\t\"The given function needs to be an actual function.\"\n\t\t\t);\n\t\tthis._overrides.push(inFunc);\n\t\treturn this;\n\t}\n\n\t/**\n\t *  A smart method that can take a reference to an object, or a direct on the canvas to attach an effect to,\n\t *  or a string reference (see .name())\n\t *\n\t * @param {Object|String} inObject\n\t * @param {Object} inOptions\n\t * @returns {EffectSection}\n\t */\n\tattachTo(inObject, inOptions = {}) {\n\t\tif (!inObject || !(typeof inObject === \"object\" || typeof inObject === \"string\")) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t`inObject is invalid, and must be of type of object, string, placeable object, or document`\n\t\t\t);\n\t\t}\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\talign: \"center\",\n\t\t\t\tedge: \"on\",\n\t\t\t\tbindVisibility: true,\n\t\t\t\tbindAlpha: true,\n\t\t\t\tbindElevation: true,\n\t\t\t\tbindScale: true,\n\t\t\t\tbindRotation: true,\n\t\t\t\toffset: false,\n\t\t\t\trandomOffset: false,\n\t\t\t\tgridUnits: false,\n\t\t\t\tlocal: false,\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\n\t\tconst validatedObject = this._validateLocation(inObject);\n\t\tif (validatedObject === undefined)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t\"could not find given object\"\n\t\t\t);\n\n\t\tconst aligns = Object.keys(canvaslib.alignments);\n\t\tif (\n\t\t\ttypeof inOptions.align !== \"string\" ||\n\t\t\t!aligns.includes(inOptions.align)\n\t\t) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t`inOptions.align must be of type string, one of: ${aligns.join(\", \")}`\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\ttypeof inOptions.edge !== \"string\" ||\n\t\t\t!(\n\t\t\t\tinOptions.edge === \"on\" ||\n\t\t\t\tinOptions.edge === \"inner\" ||\n\t\t\t\tinOptions.edge === \"outer\"\n\t\t\t)\n\t\t) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t`inOptions.edge must of type string with the value of either \"on\", \"inner\", or \"outer\"`\n\t\t\t);\n\t\t}\n\t\tif (typeof inOptions.bindVisibility !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t`inOptions.bindVisibility must be of type boolean`\n\t\t\t);\n\t\tif (typeof inOptions.bindRotation !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t`inOptions.bindRotation must be of type boolean`\n\t\t\t);\n\t\tif (typeof inOptions.bindAlpha !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t\"inOptions.bindAlpha must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions.bindElevation !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t\"inOptions.bindElevation must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions.bindScale !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t\"inOptions.bindScale must be of type boolean\"\n\t\t\t);\n\t\tif (\n\t\t\t!(\n\t\t\t\ttypeof inOptions.randomOffset === \"boolean\" ||\n\t\t\t\tlib.is_real_number(inOptions.randomOffset)\n\t\t\t)\n\t\t)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t\"inOptions.randomOffset must be of type boolean or number\"\n\t\t\t);\n\n\t\tthis._source = validatedObject;\n\n\t\tif (inOptions.offset) {\n\t\t\tconst offsetData = this._validateOffset(\n\t\t\t\t\"attachTo\",\n\t\t\t\tinOptions.offset,\n\t\t\t\tinOptions\n\t\t\t);\n\t\t\tthis._offset = {\n\t\t\t\tsource: offsetData,\n\t\t\t\ttarget: this._offset?.target ?? false,\n\t\t\t};\n\t\t}\n\n\t\tthis._randomOffset = {\n\t\t\tsource: inOptions.randomOffset,\n\t\t\ttarget: this._randomOffset?.target ?? false,\n\t\t};\n\n\t\tthis._attachTo = {\n\t\t\tactive: !!validatedObject,\n\t\t\talign: inOptions.align,\n\t\t\tedge: inOptions.edge,\n\t\t\tbindVisibility: inOptions.bindVisibility,\n\t\t\tbindAlpha: inOptions.bindAlpha,\n\t\t\tbindScale: inOptions.bindScale,\n\t\t\tbindElevation: inOptions.bindElevation,\n\t\t\tbindRotation: inOptions.bindRotation,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/**\n\t *  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\t *  This effectively calculates the proper X scale for the effect to reach the target\n\t *\n\t * @param {Object|String} inLocation\n\t * @param {Object} inOptions\n\t * @returns {EffectSection}\n\t */\n\tstretchTo(inLocation, inOptions = {}) {\n\t\tif (!inLocation || !(typeof inLocation === \"object\" || typeof inLocation === \"string\")) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t`inLocation is invalid, and must be of type of object, string, placeable object, or document`\n\t\t\t);\n\t\t}\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tcacheLocation: false,\n\t\t\t\tattachTo: false,\n\t\t\t\tonlyX: false,\n\t\t\t\ttiling: false,\n\t\t\t\toffset: false,\n\t\t\t\trandomOffset: false,\n\t\t\t\tgridUnits: false,\n\t\t\t\tlocal: false,\n\t\t\t\trequiresLineOfSight: false,\n\t\t\t\thideLineOfSight: false,\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\t\tconst validatedObject = this._validateLocation(inLocation);\n\t\tif (validatedObject === undefined)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"could not find position of given object\"\n\t\t\t);\n\t\tif (typeof inOptions.cacheLocation !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"inOptions.cacheLocation must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions.attachTo !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"inOptions.attachTo must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions.onlyX !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"inOptions.onlyX must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions.tiling !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"inOptions.tiling must be of type boolean\"\n\t\t\t);\n\t\tif (\n\t\t\t!(\n\t\t\t\ttypeof inOptions.randomOffset === \"boolean\" ||\n\t\t\t\tlib.is_real_number(inOptions.randomOffset)\n\t\t\t)\n\t\t)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"inOptions.randomOffset must be of type boolean or number\"\n\t\t\t);\n\n\t\tif (inOptions.cacheLocation && inOptions.attachTo) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"cacheLocation and attachTo cannot both be true - pick one or the other\"\n\t\t\t);\n\t\t}\n\n\t\tif (typeof inOptions.requiresLineOfSight !== \"boolean\") {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"requiresLineOfSight must be of type boolean\"\n\t\t\t);\n\t\t}\n\n\t\tif (!inOptions.attachTo && inOptions.requiresLineOfSight) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"requiresLineOfSight requires that attachTo is true\"\n\t\t\t);\n\t\t}\n\n\t\tif (typeof inOptions.hideLineOfSight !== \"boolean\") {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"hideLineOfSight must be of type boolean\"\n\t\t\t);\n\t\t}\n\n\t\tif (!inOptions.requiresLineOfSight && inOptions.hideLineOfSight) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"hideLineOfSight requires that requiresLineOfSight is true\"\n\t\t\t);\n\t\t}\n\n\t\tif (inOptions.tiling) this.tilingTexture();\n\n\t\tif (inOptions.offset) {\n\t\t\tconst offsetData = this._validateOffset(\n\t\t\t\t\"stretchTo\",\n\t\t\t\tinOptions.offset,\n\t\t\t\tinOptions\n\t\t\t);\n\t\t\tthis._offset = {\n\t\t\t\tsource: this._offset?.source ?? false,\n\t\t\t\ttarget: offsetData,\n\t\t\t};\n\t\t}\n\n\t\tthis._randomOffset = {\n\t\t\tsource: this._randomOffset?.source ?? false,\n\t\t\ttarget: inOptions.randomOffset,\n\t\t};\n\n\t\tthis._stretchTo = {\n\t\t\ttarget: inOptions.cacheLocation\n\t\t\t\t? canvaslib.get_object_canvas_data(validatedObject, { measure: true, uuid: false })\n\t\t\t\t: validatedObject,\n\t\t\tattachTo: inOptions.attachTo,\n\t\t\tonlyX: inOptions.onlyX,\n\t\t\trequiresLineOfSight: inOptions.requiresLineOfSight,\n\t\t\thideLineOfSight: inOptions.hideLineOfSight,\n\t\t};\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the location to rotate the object to\n\t *\n\t * @param {object|string} inLocation\n\t * @param {object} inOptions\n\t * @returns this\n\t */\n\trotateTowards(inLocation, inOptions = {}) {\n\t\tif (!inLocation || !(typeof inLocation === \"object\" || typeof inLocation === \"string\")) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"inLocation\",\n\t\t\t\t`inLocation is invalid, and must be of type of object, string, placeable object, or document`\n\t\t\t);\n\t\t}\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\trotationOffset: 0,\n\t\t\t\tcacheLocation: false,\n\t\t\t\tattachTo: false,\n\t\t\t\toffset: false,\n\t\t\t\trandomOffset: false,\n\t\t\t\tlocal: false,\n\t\t\t\tgridUnits: false,\n\t\t\t\ttemplate: false,\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\t\tif (!lib.is_real_number(inOptions.rotationOffset))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"inOptions.rotationOffset must be of type number\"\n\t\t\t);\n\t\tif (typeof inOptions.attachTo !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"inOptions.attachTo must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions.cacheLocation !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"inOptions.cacheLocation must be of type boolean\"\n\t\t\t);\n\t\tconst validatedObject = this._validateLocation(inLocation);\n\t\tif (!validatedObject)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"could not find position of given object\"\n\t\t\t);\n\n\t\tif (inOptions.offset) {\n\t\t\tconst offsetData = this._validateOffset(\n\t\t\t\t\"attachTo\",\n\t\t\t\tinOptions.offset,\n\t\t\t\tinOptions\n\t\t\t);\n\t\t\tthis._offset = {\n\t\t\t\ttarget: offsetData ?? this._offset?.target ?? false,\n\t\t\t};\n\t\t}\n\n\t\tif (typeof inOptions.template !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"inOptions.template must be of type boolean\"\n\t\t\t);\n\n\t\tthis._randomOffset = {\n\t\t\ttarget: inOptions.randomOffset ?? this._randomOffset?.target ?? false,\n\t\t};\n\n\t\tthis._rotateTowards = {\n\t\t\ttarget: inOptions.cacheLocation\n\t\t\t\t? canvaslib.get_object_canvas_data(validatedObject, { measure: true, uuid: false })\n\t\t\t\t: validatedObject,\n\t\t\trotationOffset: inOptions.rotationOffset,\n\t\t\tcacheLocation: inOptions.cacheLocation,\n\t\t\tattachTo: inOptions.attachTo,\n\t\t\ttemplate: inOptions.template,\n\t\t};\n\n\t\treturn this;\n\t}\n\n\t/**\n\t *  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\t *\n\t * @param {Object} inObject\n\t * @param {Object} inOptions\n\t * @returns {EffectSection}\n\t */\n\tcopySprite(inObject, inOptions = {}) {\n\t\tif (\n\t\t\t!(\n\t\t\t\tinObject instanceof foundry.canvas.placeables.Token ||\n\t\t\t\tinObject instanceof foundry.canvas.placeables.Tile ||\n\t\t\t\tinObject instanceof TokenDocument ||\n\t\t\t\tinObject instanceof TileDocument\n\t\t\t)\n\t\t) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"copySprite\",\n\t\t\t\t\"inObject must be of type Token, Tile, TokenDocument, or TileDocument\"\n\t\t\t);\n\t\t}\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"copySprite\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\t\tinObject = inObject.document ?? inObject;\n\t\tif (!inObject?.texture?.src)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"copySprite\",\n\t\t\t\t\"could not find the image for the given object\"\n\t\t\t);\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tcacheLocation: false,\n\t\t\t\toffset: false,\n\t\t\t\trandomOffset: false,\n\t\t\t\tlocal: false,\n\t\t\t\tgridUnits: false,\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\t\tif (typeof inOptions.cacheLocation !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"copySprite\",\n\t\t\t\t\"inOptions.cacheLocation must be of type boolean\"\n\t\t\t);\n\t\tif (\n\t\t\t!(\n\t\t\t\ttypeof inOptions.randomOffset === \"boolean\" ||\n\t\t\t\tlib.is_real_number(inOptions.randomOffset)\n\t\t\t)\n\t\t)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"copySprite\",\n\t\t\t\t\"inOptions.randomOffset must be of type boolean or number\"\n\t\t\t);\n\n\t\tif (inOptions.offset) {\n\t\t\tconst offsetData = this._validateOffset(\n\t\t\t\t\"attachTo\",\n\t\t\t\tinOptions.offset,\n\t\t\t\tinOptions\n\t\t\t);\n\t\t\tthis._offset = {\n\t\t\t\tsource: offsetData,\n\t\t\t\ttarget: this._offset?.target ?? false,\n\t\t\t};\n\t\t}\n\n\t\tthis._randomOffset = {\n\t\t\tsource: inOptions.randomOffset,\n\t\t\ttarget: this._randomOffset?.target ?? false,\n\t\t};\n\n\t\tthis._copySprite = {\n\t\t\tobject: inObject,\n\t\t\toptions: inOptions,\n\t\t};\n\t\treturn this;\n\t}\n\n\tshape(inType, inOptions = {}) {\n\t\tif (typeof inType !== \"string\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"shape\",\n\t\t\t\t\"type must be of type string\"\n\t\t\t);\n\n\t\tif (!Object.values(CONSTANTS.SHAPES).includes(inType)) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"shape\",\n\t\t\t\t\"type must be one of: \" + Object.values(CONSTANTS.SHAPES).join(\", \")\n\t\t\t);\n\t\t}\n\n\t\tif (inType === CONSTANTS.SHAPES.POLY) {\n\t\t\tif (!Array.isArray(inOptions.points)) {\n\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\tthis,\n\t\t\t\t\t\"shape\",\n\t\t\t\t\t\"if creating polygon, inOptions.points must be of type array\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tinOptions.points = inOptions.points.map((point) => {\n\t\t\t\tif (Array.isArray(point)) {\n\t\t\t\t\tif (!is_real_number(point[0]) || !is_real_number(point[1])) {\n\t\t\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\"shape\",\n\t\t\t\t\t\t\t\"inOptions.points must be an array, containing an array of two numbers or objects with x and y number properties\"\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn point;\n\t\t\t\t}\n\t\t\t\tif (typeof point === \"object\") {\n\t\t\t\t\tif (!is_real_number(point?.x) || !is_real_number(point?.y)) {\n\t\t\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\"shape\",\n\t\t\t\t\t\t\t\"inOptions.points must be an array, containing an array of two numbers or objects with x and y number properties\"\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn [point.x, point.y];\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (inType === CONSTANTS.SHAPES.CIRC) {\n\t\t\tif (typeof inOptions.radius !== \"number\") {\n\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\tthis,\n\t\t\t\t\t\"shape\",\n\t\t\t\t\t\"if creating circle, inOptions.radius must be of type number\"\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (\n\t\t\tinType === CONSTANTS.SHAPES.RECT ||\n\t\t\tinType === CONSTANTS.SHAPES.RREC ||\n\t\t\tinType === CONSTANTS.SHAPES.ELIP\n\t\t) {\n\t\t\tif (inOptions.width ^ inOptions.height) {\n\t\t\t\tinOptions.width = inOptions.width ?? inOptions.height;\n\t\t\t\tinOptions.height = inOptions.height ?? inOptions.width;\n\t\t\t}\n\t\t\tif (typeof inOptions.width !== \"number\") {\n\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\tthis,\n\t\t\t\t\t\"shape\",\n\t\t\t\t\t`if creating rectangle, rounded rectangle, or an ellipse, inOptions.width must be of type number`\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (typeof inOptions.height !== \"number\") {\n\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\tthis,\n\t\t\t\t\t\"shape\",\n\t\t\t\t\t\"if creating rectangle, rounded rectangle, or an ellipse, inOptions.height must be of type number\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tinType === CONSTANTS.SHAPES.RREC &&\n\t\t\t\ttypeof inOptions.radius !== \"number\"\n\t\t\t) {\n\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\tthis,\n\t\t\t\t\t\"shape\",\n\t\t\t\t\t\"if creating rounded border rectangle, inOptions.radius must be of type number\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tinOptions.gridUnits !== undefined &&\n\t\t\ttypeof inOptions.gridUnits !== \"boolean\"\n\t\t) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"shape\",\n\t\t\t\t\"inOptions.gridUnits must be of type boolean\"\n\t\t\t);\n\t\t}\n\n\t\tif (inOptions.name && typeof inOptions.name !== \"string\") {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"shape\",\n\t\t\t\t\"inOptions.name must be of type string\"\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tinOptions.fillColor &&\n\t\t\t!is_real_number(inOptions.fillColor) &&\n\t\t\ttypeof inOptions.fillColor !== \"string\"\n\t\t) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"shape\",\n\t\t\t\t\"inOptions.fillColor must be of type string (hexadecimal) or number (decimal)\"\n\t\t\t);\n\t\t} else {\n\t\t\tinOptions.fillColor = lib.parseColor(inOptions.fillColor).decimal;\n\t\t}\n\n\t\tif (inOptions.fillAlpha && !is_real_number(inOptions.fillAlpha)) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"shape\",\n\t\t\t\t\"inOptions.fillAlpha must be of type number\"\n\t\t\t);\n\t\t}\n\n\t\tif (inOptions.alpha && !is_real_number(inOptions.alpha)) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"shape\",\n\t\t\t\t\"inOptions.alpha must be of type number\"\n\t\t\t);\n\t\t}\n\n\t\tif (inOptions.lineSize && !is_real_number(inOptions.lineSize)) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"shape\",\n\t\t\t\t\"inOptions.lineSize must be of type number\"\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tinOptions.lineColor &&\n\t\t\t!is_real_number(inOptions.lineColor) &&\n\t\t\ttypeof inOptions.lineColor !== \"string\"\n\t\t) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"shape\",\n\t\t\t\t\"inOptions.lineColor must be of type string (hexadecimal) or number (decimal)\"\n\t\t\t);\n\t\t} else {\n\t\t\tinOptions.lineColor = lib.parseColor(inOptions.lineColor).decimal;\n\t\t}\n\n\t\tif (inOptions.offset) {\n\t\t\tinOptions.offset = this._validateOffset(\n\t\t\t\t\"shape\",\n\t\t\t\tinOptions.offset,\n\t\t\t\tinOptions.offset\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tinOptions.texture !== undefined &&\n\t\t\ttypeof inOptions.texture !== \"string\"\n\t\t) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"shape\",\n\t\t\t\t\"inOptions.texture must be of type string\"\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tinOptions.isMask !== undefined &&\n\t\t\ttypeof inOptions.isMask !== \"boolean\"\n\t\t) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"shape\",\n\t\t\t\t\"inOptions.isMask must be of type boolean\"\n\t\t\t);\n\t\t}\n\n\t\tthis._shapes.push({\n\t\t\t...inOptions,\n\t\t\ttype: inType,\n\t\t});\n\n\t\treturn this;\n\t}\n\n\t/**\n\t *  Causes the effect's sprite to be offset relative to its location based on a given vector\n\t *\n\t * @param {Object} inOffset\n\t * @param {Object} inOptions\n\t * @returns {EffectSection}\n\t */\n\tspriteOffset(inOffset, inOptions = {}) {\n\t\tif (inOffset === undefined)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"spriteOffset\",\n\t\t\t\t\"inOffset must not be undefined\"\n\t\t\t);\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"spriteOffset\",\n\t\t\t\t\"options must be of type object\"\n\t\t\t);\n\t\tthis._spriteOffset = this._validateOffset(\n\t\t\t\"spriteOffset\",\n\t\t\tinOffset,\n\t\t\tinOptions\n\t\t);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the final effect location to be snapped to the grid\n\t *\n\t * @param {Boolean} inBool\n\t * @returns {EffectSection}\n\t */\n\tsnapToGrid(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"snapToGrid\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._snapToGrid = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the effect to be scaled to the target object's width\n\t *\n\t * @param {Number} inScale\n\t * @param {Object} inOptions\n\t * @returns {EffectSection}\n\t */\n\tscaleToObject(inScale = 1.0, inOptions = {}) {\n\t\tif (!lib.is_real_number(inScale))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"scaleToObject\",\n\t\t\t\t`inScale must be of type number!`\n\t\t\t);\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"scaleToObject\",\n\t\t\t\t\"inOptions must be of type object\"\n\t\t\t);\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tscale: inScale,\n\t\t\t\tconsiderTokenScale: false,\n\t\t\t\tuniform: false\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\t\tif (typeof inOptions.considerTokenScale !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"scaleToObject\",\n\t\t\t\t\"inOptions.considerTokenScale must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions.uniform !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"scaleToObject\",\n\t\t\t\t\"inOptions.uniform must be of type boolean\"\n\t\t\t);\n\t\tthis._scaleToObject = inOptions;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the width and the height of the effect in pixels, this size is set before any scaling\n\t *\n\t * @param {Number|Object<{width: {Number}, height: {Number}}>} inSize\n\t * @param {Object} inOptions\n\t * @returns {EffectSection}\n\t */\n\tsize(inSize, inOptions = {}) {\n\t\tif (!lib.is_real_number(inSize) && typeof inSize !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"size\",\n\t\t\t\t\"inSize must be of type number or object\"\n\t\t\t);\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"size\",\n\t\t\t\t\"inOptions must be of type object\"\n\t\t\t);\n\t\tif (lib.is_real_number(inSize)) {\n\t\t\tinSize = {\n\t\t\t\twidth: inSize,\n\t\t\t\theight: inSize,\n\t\t\t};\n\t\t}\n\n\t\tif ((inSize.width === undefined) ^ (inSize.height === undefined)) {\n\t\t\tif (inSize.width) {\n\t\t\t\tif (!lib.is_real_number(inSize.width))\n\t\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\"size\",\n\t\t\t\t\t\t\"inSize.width must be of type number or string 'auto'\"\n\t\t\t\t\t);\n\t\t\t\tinSize[\"height\"] = \"auto\";\n\t\t\t} else {\n\t\t\t\tif (!lib.is_real_number(inSize.height))\n\t\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\"size\",\n\t\t\t\t\t\t\"inSize.height must be of type number or string 'auto'\"\n\t\t\t\t\t);\n\t\t\t\tinSize[\"width\"] = \"auto\";\n\t\t\t}\n\t\t}\n\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tgridUnits: false,\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\n\t\tif (!lib.is_real_number(inSize.width) && inSize.width !== \"auto\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"size\",\n\t\t\t\t\"inSize.width must be of type number or string 'auto'\"\n\t\t\t);\n\t\tif (!lib.is_real_number(inSize.height) && inSize.height !== \"auto\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"size\",\n\t\t\t\t\"inSize.height must be of type number or string 'auto'\"\n\t\t\t);\n\t\tif (typeof inOptions.gridUnits !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"size\",\n\t\t\t\t\"inOptions.gridUnits must be of type boolean\"\n\t\t\t);\n\n\t\tthis._size = {\n\t\t\twidth: inSize.width ?? canvas.grid.size,\n\t\t\theight: inSize.height ?? canvas.grid.size,\n\t\t\t...inOptions,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/**\n\t *  This scales the sprite of the effect, and this method can take the following:\n\t *  - A number to set the scale uniformly\n\t *  - An object with x and y for non-uniform scaling\n\t *  - Two numbers which the Sequencer will randomly pick a uniform scale between\n\t *\n\t * @param {number|object} inScaleMin\n\t * @param {number} [inScaleMax] inScaleMax\n\t * @returns this\n\t */\n\tspriteScale(inScaleMin, inScaleMax) {\n\t\tif (!lib.is_real_number(inScaleMin) && typeof inScaleMin !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"spriteScale\",\n\t\t\t\t\"inScale must be of type number or object\"\n\t\t\t);\n\t\tif (lib.is_real_number(inScaleMin)) {\n\t\t\tif (inScaleMax && !lib.is_real_number(inScaleMax)) {\n\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\tthis,\n\t\t\t\t\t\"spriteScale\",\n\t\t\t\t\t\"if inScaleMin is a number, inScaleMax must also be of type number\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tthis._spriteScaleMin = inScaleMin;\n\t\tthis._spriteScaleMax = inScaleMax ?? false;\n\t\treturn this;\n\t}\n\n\t/**\n\t * 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\t * relative to the canvas's grid size. Start and end point defines padding at the left and right of the effect\n\t *\n\t * @param {Number} gridSize\n\t * @param {Number} startPoint\n\t * @param {Number} endPoint\n\t * @returns {EffectSection}\n\t */\n\ttemplate({ gridSize, startPoint, endPoint } = {}) {\n\t\tif (gridSize && !lib.is_real_number(gridSize))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"template\",\n\t\t\t\t\"gridSize must be of type number\"\n\t\t\t);\n\t\tif (startPoint && !lib.is_real_number(startPoint))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"template\",\n\t\t\t\t\"startPoint must be of type number\"\n\t\t\t);\n\t\tif (endPoint && !lib.is_real_number(endPoint))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"template\",\n\t\t\t\t\"endPoint must be of type number\"\n\t\t\t);\n\t\tif (!gridSize && !startPoint && !endPoint)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"template\",\n\t\t\t\t\"You need to define at least one parameter!\"\n\t\t\t);\n\t\tif (!this._template) this._template = {};\n\t\tif (gridSize) this._template[\"gridSize\"] = gridSize;\n\t\tif (startPoint) this._template[\"startPoint\"] = startPoint;\n\t\tif (endPoint) this._template[\"endPoint\"] = endPoint;\n\t\treturn this;\n\t}\n\n\t/**\n\t * This makes the texture of the effect tile, effectively repeat itself within the sprite's dimensions\n\t *\n\t * @param {Object|Number} scale\n\t * @param {Object} position\n\t * @returns {EffectSection}\n\t */\n\ttilingTexture(scale = { x: 1.0, y: 1.0 }, position = { x: 0, y: 0 }) {\n\t\tif (lib.is_real_number(scale)) {\n\t\t\tscale = { x: scale, y: scale };\n\t\t}\n\n\t\tscale = { x: scale?.x ?? 1.0, y: scale?.y ?? 1.0 };\n\n\t\tif (!lib.is_real_number(scale.x))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"tilingTexture\",\n\t\t\t\t`scale.x must be of type number!`\n\t\t\t);\n\t\tif (!lib.is_real_number(scale.y))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"tilingTexture\",\n\t\t\t\t`scale.y must be of type number!`\n\t\t\t);\n\n\t\tposition = { x: position?.x ?? 0, y: position?.y ?? 0 };\n\n\t\tif (!lib.is_real_number(position.x))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"tilingTexture\",\n\t\t\t\t`position.x must be of type number!`\n\t\t\t);\n\t\tif (!lib.is_real_number(position.y))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"tilingTexture\",\n\t\t\t\t`position.y must be of type number!`\n\t\t\t);\n\n\t\tthis._tilingTexture = {\n\t\t\tscale,\n\t\t\tposition,\n\t\t};\n\n\t\treturn this;\n\t}\n\n\t/**\n\t *  Anchors the sprite's container according to the given x and y coordinates, or uniformly based on a single number\n\t *\n\t * @param {Number|Object} inAnchor\n\t * @returns {EffectSection}\n\t */\n\tanchor(inAnchor) {\n\t\tif (lib.is_real_number(inAnchor)) {\n\t\t\tinAnchor = {\n\t\t\t\tx: inAnchor,\n\t\t\t\ty: inAnchor,\n\t\t\t};\n\t\t}\n\n\t\tinAnchor = {\n\t\t\tx: inAnchor?.x ?? 0.5,\n\t\t\ty: inAnchor?.y ?? 0.5,\n\t\t};\n\n\t\tif (!lib.is_real_number(inAnchor.x))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"anchor\",\n\t\t\t\t`inAnchor.x must be of type number!`\n\t\t\t);\n\t\tif (!lib.is_real_number(inAnchor.y))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"anchor\",\n\t\t\t\t`inAnchor.y must be of type number!`\n\t\t\t);\n\n\t\tthis._anchor = inAnchor;\n\t\treturn this;\n\t}\n\n\t/**\n\t *  Anchors the sprite according to the given x and y coordinates, or uniformly based on a single number\n\t *\n\t * @param {Number|Object} inAnchor\n\t * @returns {EffectSection}\n\t */\n\tspriteAnchor(inAnchor) {\n\t\tif (lib.is_real_number(inAnchor)) {\n\t\t\tinAnchor = {\n\t\t\t\tx: inAnchor,\n\t\t\t\ty: inAnchor,\n\t\t\t};\n\t\t}\n\n\t\tinAnchor = {\n\t\t\tx: inAnchor?.x ?? 0.5,\n\t\t\ty: inAnchor?.y ?? 0.5,\n\t\t};\n\n\t\tif (!lib.is_real_number(inAnchor.x))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"anchor\",\n\t\t\t\t`inAnchor.x must be of type number!`\n\t\t\t);\n\t\tif (!lib.is_real_number(inAnchor.y))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"anchor\",\n\t\t\t\t`inAnchor.y must be of type number!`\n\t\t\t);\n\n\t\tthis._spriteAnchor = inAnchor;\n\t\treturn this;\n\t}\n\n\t/**\n\t *  Centers the sprite, effectively giving it an anchor of {x: 0.5, y: 0.5}\n\t *\n\t *  Note: If this is used, it will override the anchor set by Aim Towards, which sets the sprite's anchor to the\n\t *  outermost edge of the location the sprite is played at\n\t *\n\t * @returns {EffectSection}\n\t */\n\tcenter() {\n\t\tthis.anchor(0.5);\n\t\treturn this;\n\t}\n\n\t/**\n\t * The sprite gets a randomized flipped X scale. If the scale on that axis was 1, it can\n\t * become 1 or -1, effectively mirroring the sprite on its horizontal axis\n\t *\n\t * @param {Boolean} inBool\n\t * @returns {EffectSection}\n\t */\n\trandomizeMirrorX(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"randomizeMirrorX\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._randomMirrorX = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * The sprite gets a randomized flipped Y scale. If the scale on that axis was 1, it can\n\t * become 1 or -1, effectively mirroring the sprite on its vertical axis\n\t *\n\t * @param {Boolean} inBool\n\t * @returns {EffectSection}\n\t */\n\trandomizeMirrorY(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"randomizeMirrorY\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._randomMirrorY = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * The sprite gets a flipped X scale. If the scale on that axis was 1, it will become 1 or -1, effectively\n\t * mirroring the sprite on its horizontal axis\n\t *\n\t * @param {Boolean} inBool\n\t * @returns {EffectSection}\n\t */\n\tmirrorX(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"mirrorX\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._mirrorX = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * The sprite gets a flipped Y scale. If the scale on that axis was 1, it will become 1 or -1, effectively\n\t * mirroring the sprite on its vertical axis\n\t *\n\t * @param {Boolean} inBool\n\t * @returns {EffectSection}\n\t */\n\tmirrorY(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"mirrorY\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._mirrorY = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the effect to play beneath most tokens\n\t *\n\t * @param {Boolean} inBool\n\t * @returns {EffectSection}\n\t */\n\tbelowTokens(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"belowTokens\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\treturn this.sortLayer(inBool ? 600 : 800);\n\t}\n\n\t/**\n\t * Causes the effect to play beneath most tiles\n\t *\n\t * @param {Boolean} inBool\n\t * @returns {EffectSection}\n\t */\n\tbelowTiles(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"belowTiles\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\treturn this.sortLayer(inBool ? 300 : 500);\n\t}\n\n\t/**\n\t * Causes the effect to be played on top of the vision mask\n\t *\n\t * @param {Boolean} inBool\n\t * @returns {EffectSection}\n\t */\n\taboveLighting(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"aboveLighting\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._aboveLighting = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the effect to be played on top of interface\n\t *\n\t * @param {Boolean} inBool\n\t * @returns {EffectSection}\n\t */\n\taboveInterface(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"aboveInterface\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._aboveInterface = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Changes the effect's sortLayer, potentially displaying effects below tiles, above tokens or even weather effects\n\t * in case of identical elevations\n\t *\n\t * @param {Number} inSortLayer\n\t * @param {Object} inOptions\n\t * @returns {EffectSection}\n\t */\n\tsortLayer(inSortLayer, inOptions = {}) {\n\t\tif (!lib.is_real_number(inSortLayer))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"sortLayer\",\n\t\t\t\t\"inSortLayer must be of type number\"\n\t\t\t);\n\t\tthis._sortLayer = inSortLayer;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the zIndex of the effect, potentially displaying it on top of other effects the same elevation and sort\n\t *\n\t * @param {Number} inZIndex\n\t * @returns {EffectSection}\n\t */\n\tzIndex(inZIndex) {\n\t\tif (!lib.is_real_number(inZIndex))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"zIndex\",\n\t\t\t\t\"inZIndex must be of type number\"\n\t\t\t);\n\t\tthis._zIndex = inZIndex;\n\t\treturn this;\n\t}\n\n\t/**\n\t * 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\t *\n\t * @param {Number} inExtraDuration\n\t * @returns {EffectSection}\n\t */\n\textraEndDuration(inExtraDuration) {\n\t\tif (!lib.is_real_number(inExtraDuration))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"extraEndDuration\",\n\t\t\t\t\"inExtraDuration must be of type number\"\n\t\t\t);\n\t\tthis._extraEndDuration = inExtraDuration;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Rotates the sprite\n\t *\n\t * @param {Number} inAngle\n\t * @returns {EffectSection}\n\t */\n\tspriteRotation(inAngle) {\n\t\tif (!lib.is_real_number(inAngle))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"spriteRotation\",\n\t\t\t\t\"inAngle must be of type number\"\n\t\t\t);\n\t\tthis._spriteRotation = inAngle;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Rotates the sprite\n\t *\n\t * @param {Boolean} inBool\n\t * @returns {EffectSection}\n\t */\n\trandomSpriteRotation(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"randomSpriteRotation\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._randomSpriteRotation = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the effect to not rotate should its container rotate\n\t *\n\t * @param {Boolean} [inBool=true] inBool\n\t * @returns {EffectSection}\n\t */\n\tzeroSpriteRotation(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"zeroSpriteRotation\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._zeroSpriteRotation = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Allows you to control the number of loops and the delays between each loop\n\t *\n\t * @param {Object} inOptions\n\t * @returns {EffectSection}\n\t */\n\tloopOptions(inOptions={}){\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"loopOptions\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\n\t\tif (inOptions.maxLoops !== undefined) {\n\t\t\tlib.custom_warning(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"Effect | loopOptions' maxLoops option is deprecated, please use loops instead\"\n\t\t\t);\n\t\t\tinOptions = { ...inOptions, loops: inOptions.loops ?? inOptions.maxLoops };\n\t\t\tdelete inOptions.maxLoops;\n\t\t}\n\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tloopDelay: 0,\n\t\t\t\tloops: 0,\n\t\t\t\tendOnLastLoop: false\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\n\t\tif (typeof inOptions.endOnLastLoop !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"loopOptions\",\n\t\t\t\t\"inOptions.endOnLastLoop must be of type boolean\"\n\t\t\t);\n\n\t\tif (typeof inOptions.loopDelay !== \"number\" || inOptions.loopDelay < 0)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"loopOptions\",\n\t\t\t\t\"inOptions.loopDelay must be of type number that is not below 0\"\n\t\t\t);\n\n\t\tif (typeof inOptions.loops !== \"number\" || inOptions.loops < 0)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"loopOptions\",\n\t\t\t\t\"inOptions.loops must be of type number that is not below 0\"\n\t\t\t);\n\n\t\tthis._loopOptions = inOptions;\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the effect to not show up in the Effect Manager UI - DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING\n\t *\n\t * @param inBool\n\t * @returns {EffectSection}\n\t */\n\tprivate(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"private\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._private = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the effect to be played in screen space instead of world space (where tokens are)\n\t *\n\t * @param {Boolean} [inBool=true] inBool\n\t * @returns {EffectSection}\n\t */\n\tscreenSpace(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpace\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._screenSpace = inBool;\n\t\tthis._screenSpaceAnchor = this._screenSpaceAnchor ?? { x: 0.5, y: 0.5 };\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the effect to be played above all of the UI elements\n\t *\n\t * @param {Boolean} [inBool=true] inBool\n\t * @returns {EffectSection}\n\t */\n\tscreenSpaceAboveUI(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpaceAboveUI\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._screenSpaceAboveUI = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t *  Positions the effect in a screen space position, offset from its .screenSpaceAnchor()\n\t *\n\t * @param {Object} inPosition\n\t * @returns {EffectSection}\n\t */\n\tscreenSpacePosition(inPosition) {\n\t\tinPosition = {\n\t\t\tx: inPosition?.x ?? 0,\n\t\t\ty: inPosition?.y ?? 0,\n\t\t};\n\t\tif (!lib.is_real_number(inPosition.x))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpacePosition\",\n\t\t\t\t`inPosition.x must be of type number!`\n\t\t\t);\n\t\tif (!lib.is_real_number(inPosition.y))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpacePosition\",\n\t\t\t\t`inPosition.y must be of type number!`\n\t\t\t);\n\t\tthis._screenSpacePosition = inPosition;\n\t\treturn this;\n\t}\n\n\t/**\n\t *  Anchors the sprite according to the given x and y coordinates, or uniformly based on a single number in screen space\n\t *\n\t * @param {Number|Object} inAnchor\n\t * @returns {EffectSection}\n\t */\n\tscreenSpaceAnchor(inAnchor) {\n\t\tif (lib.is_real_number(inAnchor)) {\n\t\t\tinAnchor = {\n\t\t\t\tx: inAnchor,\n\t\t\t\ty: inAnchor,\n\t\t\t};\n\t\t}\n\n\t\tinAnchor = {\n\t\t\tx: inAnchor?.x ?? 0.5,\n\t\t\ty: inAnchor?.y ?? 0.5,\n\t\t};\n\n\t\tif (!lib.is_real_number(inAnchor.x))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpaceAnchor\",\n\t\t\t\t`inAnchor.x must be of type number!`\n\t\t\t);\n\t\tif (!lib.is_real_number(inAnchor.y))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpaceAnchor\",\n\t\t\t\t`inAnchor.y must be of type number!`\n\t\t\t);\n\n\t\tthis._screenSpaceAnchor = inAnchor;\n\t\treturn this;\n\t}\n\n\t/**\n\t *  Sets up various properties relating to scale of the effect on the screen\n\t *\n\t * @param {Object} inOptions\n\t * @returns {EffectSection}\n\t */\n\tscreenSpaceScale(inOptions) {\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpaceScale\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tx: 1.0,\n\t\t\t\ty: 1.0,\n\t\t\t\tfitX: false,\n\t\t\t\tfitY: false,\n\t\t\t\tratioX: false,\n\t\t\t\tratioY: false,\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\n\t\tif (!lib.is_real_number(inOptions.x))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpaceScale\",\n\t\t\t\t`inOptions.x must be of type number!`\n\t\t\t);\n\t\tif (!lib.is_real_number(inOptions.y))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpaceScale\",\n\t\t\t\t`inOptions.y must be of type number!`\n\t\t\t);\n\t\tif (typeof inOptions.fitX !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpaceScale\",\n\t\t\t\t\"inOptions.fitX must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions.fitY !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpaceScale\",\n\t\t\t\t\"inOptions.fitY must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions.ratioX !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpaceScale\",\n\t\t\t\t\"inOptions.ratioX must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions.ratioY !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpaceScale\",\n\t\t\t\t\"inOptions.ratioY must be of type boolean\"\n\t\t\t);\n\n\t\tif (inOptions.ratioX && inOptions.ratioY)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"screenSpaceScale\",\n\t\t\t\t\"both ratioX and ratioY cannot be true, one axis must fit or be set directly\"\n\t\t\t);\n\n\t\tthis._screenSpaceScale = inOptions;\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Ties the effect to any number of documents in Foundry - if those get deleted, the effect is ended.\n\t *\n\t * @param {String|PlaceableObject|foundry.abstract.Document|Array<String|PlaceableObject|foundry.abstract.Document>} inDocuments\n\t * @returns {EffectSection}\n\t */\n\ttieToDocuments(inDocuments) {\n\t\tif (!Array.isArray(inDocuments)) {\n\t\t\tinDocuments = [inDocuments];\n\t\t}\n\t\tfor (let doc of inDocuments) {\n\t\t\tif (\n\t\t\t\ttypeof doc !== \"string\" &&\n\t\t\t\t!(doc instanceof foundry.canvas.placeables.PlaceableObject) &&\n\t\t\t\t!(doc instanceof foundry.abstract.Document)\n\t\t\t) {\n\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\tthis,\n\t\t\t\t\t\"tieToDocument\",\n\t\t\t\t\t\"inOrigin must be of type string, PlaceableObject, or Document, or an array thereof\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (typeof doc === \"string\") {\n\t\t\t\tconst obj = fromUuidSync(doc);\n\t\t\t\tif (!obj)\n\t\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\"tieToDocument\",\n\t\t\t\t\t\t`could not find document with UUID \"${doc}\"`\n\t\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tdoc = lib.validate_document(doc);\n\t\t\t\tif (doc instanceof foundry.abstract.Document) {\n\t\t\t\t\tdoc = doc?.uuid;\n\t\t\t\t\tif (!doc)\n\t\t\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\"tieToDocument\",\n\t\t\t\t\t\t\t\"could not find the UUID for the given object\"\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._tiedDocuments.push(doc);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t *  Masks the effect to the given object, objects, or raw PIXI shape. If no object is given, the effect will be\n\t *  masked to the source of the effect. Raw shapes (PIXI.Polygon, PIXI.Circle, PIXI.Rectangle) are masked in\n\t *  scene coordinates; combine with `Sequencer.Helpers.computeWallPolygon` for wall-aware clipping.\n\t *\n\t * @param {Token/TokenDocument/Tile/TileDocument/Drawing/DrawingDocument/MeasuredTemplate/MeasuredTemplateDocument/Region/RegionDocument/PIXI.Polygon/PIXI.Circle/PIXI.Rectangle/Array} inObject\n\t * @returns {Section}\n\t */\n\tmask(inObject) {\n\t\tif (!inObject) {\n\t\t\tthis._selfMask = true;\n\t\t\treturn this;\n\t\t}\n\n\t\tif (Array.isArray(inObject)) {\n\t\t\tfor (let obj of inObject) {\n\t\t\t\tthis.mask(obj);\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\n\t\tif (inObject instanceof PIXI.Polygon\n\t\t\t|| inObject instanceof PIXI.Circle\n\t\t\t|| inObject instanceof PIXI.Rectangle) {\n\t\t\tthis._masks.push({ __shape: canvaslib.serializeShape(inObject) });\n\t\t\treturn this;\n\t\t}\n\n\t\tconst validatedObject = this._validateLocation(inObject);\n\n\t\tconst isValidObject =\n\t\t\tvalidatedObject instanceof TokenDocument ||\n\t\t\tvalidatedObject instanceof TileDocument ||\n\t\t\tvalidatedObject instanceof DrawingDocument ||\n\t\t\tvalidatedObject instanceof MeasuredTemplateDocument ||\n\t\t\tvalidatedObject instanceof RegionDocument;\n\t\tif (!isValidObject) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"mask\",\n\t\t\t\t\"A foundry object was provided, but only Tokens, Tiles, Drawings, MeasuredTemplates, Regions, or raw PIXI shapes may be used to create effect masks\"\n\t\t\t);\n\t\t}\n\n\t\tthis._masks.push(lib.get_object_identifier(validatedObject));\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the effect to be visible through walls\n\t *\n\t * @param inBool\n\t * @returns {EffectSection}\n\t */\n\txray(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"xray\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._xray = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Clips the effect to a wall-bounded sweep from its source position, independent of the\n\t * Walled Templates module. The sweep is a full 360° polygon; pass `radius` to bound it.\n\t * Pass `false` to clear.\n\t *\n\t * @param {boolean|object} [inOptions=true]\n\t * @param {\"sight\"|\"sound\"|\"move\"|\"light\"} [inOptions.type=\"sight\"]   Collision type\n\t * @param {number|null} [inOptions.radius=null]                      Bounding circle radius in pixels\n\t * @param {{x: number, y: number}|null} [inOptions.origin=null]      Override origin; defaults to source position\n\t * @param {string|foundry.documents.Level|null} [inOptions.level=null]\n\t *        Foundry v14+. The scene level whose walls the sweep should consult. Accepts a\n\t *        level id, level name, or Level document. When omitted, the level is inferred\n\t *        from the attached source, then from `.onLevels()`, then from the effect's\n\t *        elevation extent. Ignored on Foundry v13.\n\t * @returns {EffectSection}\n\t */\n\tconstrainedByWalls(inOptions = true) {\n\t\tif (inOptions === false || inOptions === null) {\n\t\t\tthis._constrainedByWalls = null;\n\t\t\treturn this;\n\t\t}\n\t\tif (inOptions === true) inOptions = {};\n\t\tif (typeof inOptions !== \"object\") {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"constrainedByWalls\",\n\t\t\t\t\"inOptions must be of type object or boolean\"\n\t\t\t);\n\t\t}\n\n\t\tinOptions = foundry.utils.mergeObject({\n\t\t\ttype: \"sight\",\n\t\t\tradius: null,\n\t\t\torigin: null,\n\t\t\tlevel: null,\n\t\t}, inOptions);\n\n\t\tconst validTypes = [\"sight\", \"sound\", \"move\", \"light\"];\n\t\tif (!validTypes.includes(inOptions.type)) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"constrainedByWalls\",\n\t\t\t\t`inOptions.type must be one of ${validTypes.join(\", \")}`\n\t\t\t);\n\t\t}\n\t\tif (inOptions.radius !== null && !lib.is_real_number(inOptions.radius)) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"constrainedByWalls\",\n\t\t\t\t\"inOptions.radius must be a number or null\"\n\t\t\t);\n\t\t}\n\t\tif (inOptions.origin !== null) {\n\t\t\tif (typeof inOptions.origin !== \"object\"\n\t\t\t\t|| !lib.is_real_number(inOptions.origin.x)\n\t\t\t\t|| !lib.is_real_number(inOptions.origin.y)) {\n\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\tthis,\n\t\t\t\t\t\"constrainedByWalls\",\n\t\t\t\t\t\"inOptions.origin must be null or { x: number, y: number }\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (inOptions.level !== null) {\n\t\t\tif (typeof inOptions.level === \"object\" && typeof inOptions.level?.id === \"string\") {\n\t\t\t\tinOptions.level = inOptions.level.id;\n\t\t\t} else if (typeof inOptions.level !== \"string\") {\n\t\t\t\tthrow this.sequence._customError(\n\t\t\t\t\tthis,\n\t\t\t\t\t\"constrainedByWalls\",\n\t\t\t\t\t\"inOptions.level must be null, a level id/name, or a Level document\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis._constrainedByWalls = inOptions;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Declares which file to be played. This may also be an array of paths, which will be randomly picked from each\n\t * time the section is played.\n\t *\n\t * @param {string|array} inFile\n\t * @param {object} inOptions\n\t * @returns this\n\t */\n\tfile(inFile, inOptions = {}) {\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"file\",\n\t\t\t\t\"inOptions must be of type object\"\n\t\t\t);\n\t\tinOptions = foundry.utils.mergeObject({\n\t\t\tantialiasing: PIXI.SCALE_MODES.LINEAR\n\t\t}, inOptions)\n\t\tif(typeof inOptions.antialiasing !== \"number\" || !(inOptions.antialiasing >= 0 && inOptions.antialiasing <= 1)){\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"file\",\n\t\t\t\t\"inOptions.antialiasing must be of type number of 0 or 1 (see PIXI.SCALE_MODES)\"\n\t\t\t);\n\t\t}\n\t\tthis._file = inFile;\n\t\tthis._fileOptions = inOptions;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Configures the isometric configuration of this effect\n\t *\n\t * @param inOptions\n\t * @returns {EffectSection}\n\t */\n\tisometric(inOptions = {}) {\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"isometric\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\toverlay: false,\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\t\tif (typeof inOptions?.overlay !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"isometric\",\n\t\t\t\t\"inOptions.overlay must be of type boolean\"\n\t\t\t);\n\t\tthis._isometric = inOptions;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @private\n\t */\n\t_expressWarnings() {\n\t\tif (this._stretchTo && this._anchor?.x) {\n\t\t\tthis.sequence._showWarning(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"you have called .stretchTo() and .anchor() - stretchTo will manually set the X axis of the anchor and may not behave like you expect.\",\n\t\t\t\ttrue\n\t\t\t);\n\t\t}\n\t\tif (this._stretchTo && this._scaleToObject) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"You're trying to stretch towards an object, while scaling to fit another??? Make up your mind!\"\n\t\t\t);\n\t\t}\n\t\tif (this._stretchTo && this._randomRotation) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"You're trying to stretch towards an object, while trying to randomly rotate the effect? What?\"\n\t\t\t);\n\t\t}\n\t\tif (this._stretchTo && this._moveTowards) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"You're trying to stretch towards an object, while moving towards it? You're insane.\"\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\tthis._attachTo &&\n\t\t\tthis._stretchTo?.attachTo &&\n\t\t\t(this._startTime || this._endTime) &&\n\t\t\tthis._isRangedEffect\n\t\t) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"stretchTo\",\n\t\t\t\t\"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\t\t\t);\n\t\t}\n\n\t\tconst source = this._getSourceObject();\n\t\tconst target = this._getTargetObject();\n\n\t\tif (\n\t\t\t!this._screenSpace &&\n\t\t\tthis._persistOptions?.persistTokenPrototype &&\n\t\t\tthis._masks.filter((uuid) => uuid !== source).length > 0\n\t\t) {\n\t\t\tthis.sequence._showWarning(\n\t\t\t\tthis,\n\t\t\t\t\"persist\",\n\t\t\t\t\"You have applied persistTokenPrototype with multiple masks from objects in the scene - these will not be persisted across scenes!\",\n\t\t\t\ttrue\n\t\t\t);\n\t\t}\n\n\t\tif (!source && !target && !this._screenSpace) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"play\",\n\t\t\t\t\"Could not determine where to play the effect!\"\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * @OVERRIDE\n\t */\n\tasync preRun() {\n\n\t\tconst oldSource = this._source;\n\t\tconst crosshairSource = this.sequence?.crosshairs?.[this._source];\n\t\tif(typeof this._source === \"string\" && crosshairSource){\n\t\t\tthis._source = crosshairSource.uuid;\n\t\t}\n\t\tconst oldTarget = this._target?.target;\n\t\tconst crosshairTarget = this.sequence?.crosshairs?.[this._target?.target];\n\t\tif(typeof this._target?.target === \"string\" && crosshairTarget){\n\t\t\tthis._target.target = crosshairTarget.uuid;\n\t\t}\n\n\t\tif(this._attachTo && !this._attachTo.active && typeof this._source === \"string\" && crosshairSource){\n\t\t\tthis._attachTo.active = !!crosshairSource;\n\t\t}\n\n\t\tif (this._name && (oldSource !== this._source || oldTarget !== this._target?.target)) {\n\t\t\tthis.sequence.nameOffsetMap[this._name].source = this._getSourceObject();\n\t\t\tthis.sequence.nameOffsetMap[this._name].target = this._getTargetObject();\n\t\t}\n\n\t\tconst source = this._getSourceObject();\n\t\tif(this._persistOptions?.persistTokenPrototype && !(this._attachTo?.active || lib.is_UUID(source))){\n\t\t\tthis._persistOptions.persistTokenPrototype = false;\n\t\t}\n\t}\n\n\t/**\n\t * @OVERRIDE\n\t * @returns {Promise<void>}\n\t */\n\tasync run() {\n\t\tif (!lib.user_can_do(\"permissions-effect-create\") || !this._playEffect) {\n\t\t\tif (!lib.user_can_do(\"permissions-effect-create\")) {\n\t\t\t\tfoundry.utils.debounce(EffectSection.debounceWarning, 1000);\n\t\t\t}\n\t\t\treturn new Promise((resolve) => {\n\t\t\t\tresolve();\n\t\t\t});\n\t\t}\n\t\tif (!this._deserializedData) this._expressWarnings();\n\t\tconst data = await this._sanitizeEffectData();\n\t\tif (Hooks.call(\"preCreateSequencerEffect\", data) === false) return;\n\t\tlet push =\n\t\t\t!(data?.users?.length === 1 && data?.users?.includes(game.userId)) &&\n\t\t\t!this.sequence.local && !this.sequence.remote;\n\t\tlet canvasEffectData = await Sequencer.EffectManager.play(data, push);\n\t\tlet totalDuration = this._currentWaitTime;\n\t\tif (this._persist) {\n\t\t\ttotalDuration += await canvasEffectData.promise;\n\t\t} else {\n\t\t\ttotalDuration += await canvasEffectData.duration;\n\t\t}\n\t\tawait new Promise((resolve) => setTimeout(resolve, totalDuration));\n\t}\n\n\t/**\n\t * @private\n\t */\n\t_applyTraits() {\n\t\tObject.assign(this.constructor.prototype, traits.files);\n\t\tObject.assign(this.constructor.prototype, traits.audio);\n\t\tObject.assign(this.constructor.prototype, traits.elevation);\n\t\tObject.assign(this.constructor.prototype, traits.levels);\n\t\tObject.assign(this.constructor.prototype, traits.moves);\n\t\tObject.assign(this.constructor.prototype, traits.opacity);\n\t\tObject.assign(this.constructor.prototype, traits.rotation);\n\t\tObject.assign(this.constructor.prototype, traits.scale);\n\t\tObject.assign(this.constructor.prototype, traits.time);\n\t\tObject.assign(this.constructor.prototype, traits.users);\n\t\tObject.assign(this.constructor.prototype, traits.animation);\n\t\tObject.assign(this.constructor.prototype, traits.filter);\n\t\tObject.assign(this.constructor.prototype, traits.tint);\n\t\tObject.assign(this.constructor.prototype, traits.blendMode);\n\t\tObject.assign(this.constructor.prototype, traits.location);\n\t\tObject.assign(this.constructor.prototype, traits.offset);\n\t\tObject.assign(this.constructor.prototype, traits.text);\n\t\tObject.assign(this.constructor.prototype, traits.name);\n\t}\n\n\t/**\n\t * @private\n\t */\n\tasync _initialize() {\n\n\t\tthis._mirrorX = this._mirrorX || (this._randomMirrorX && Math.random() < 0.5)\n\t\tthis._mirrorY = this._mirrorY || (this._randomMirrorY && Math.random() < 0.5)\n\n\tif (this._copySprite && !this._file) {\n\n\t\tconst ringEnabled = this._copySprite.object instanceof TokenDocument\n\t\t\t&& this._copySprite.object.ring?.enabled;\n\n\t\tif (!ringEnabled) {\n\t\t\tthis._file = this._copySprite.object?.texture?.src ?? \"\";\n\t\t}\n\n\t\tif (this._source === null) {\n\t\t\tthis._source = this._validateLocation(this._copySprite.object);\n\t\t}\n\n\t\tif (this._size === null) {\n\t\t\tconst placeable = this._copySprite.object.object ?? null;\n\t\t\tconst meshWidth = placeable?.mesh?.width;\n\t\t\tconst meshHeight = placeable?.mesh?.height;\n\t\t\tconst hasMeshSize = Number.isFinite(meshWidth) && meshWidth > 0\n\t\t\t\t&& Number.isFinite(meshHeight) && meshHeight > 0;\n\n\t\t\tconst fallback = canvaslib.get_object_dimensions(this._copySprite.object);\n\t\t\tthis._size = {\n\t\t\t\twidth: hasMeshSize ? meshWidth : (fallback?.width ?? canvas.grid.size),\n\t\t\t\theight: hasMeshSize ? meshHeight : (fallback?.height ?? canvas.grid.size),\n\t\t\t\tgridUnits: false,\n\t\t\t};\n\t\t}\n\n\t\t\tif (\n\t\t\t\tthis._mirrorX === null &&\n\t\t\t\t(this._copySprite.object.mirrorX ||\n\t\t\t\t\t(this._copySprite.object?.tile && this._copySprite.object?.tile.scale.x < 0))\n\t\t\t) {\n\t\t\t\tthis._mirrorX = true;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tthis._mirrorY === null &&\n\t\t\t\t(this._copySprite.object.mirrorY ||\n\t\t\t\t\t(this._copySprite.object?.tile && this._copySprite.object?.tile.scale.y < 0))\n\t\t\t) {\n\t\t\t\tthis._mirrorY = true;\n\t\t\t}\n\n\t\t\tif (this._angle === null && this._copySprite.object?.rotation) {\n\t\t\t\tthis._angle = -this._copySprite.object.rotation;\n\t\t\t}\n\n\t\t\tthis._randomOffset = {\n\t\t\t\tsource: this._randomOffset?.source ?? this._copySprite.options.randomOffset,\n\t\t\t\ttarget: this._randomOffset?.target ?? false,\n\t\t\t};\n\t\t}\n\n\t\tif (this._name) {\n\n\t\t\tthis.sequence.nameOffsetMap ||= {};\n\n\t\t\tif (!this.sequence.nameOffsetMap[this._name]) {\n\t\t\t\tconst source = this._getSourceObject();\n\t\t\t\tconst target = this._getTargetObject();\n\n\t\t\t\tif (this._offsetLegacy && !this._offset) {\n\t\t\t\t\tthis._offset = {\n\t\t\t\t\t\tsource: !target ? this._offsetLegacy : false,\n\t\t\t\t\t\ttarget: !!target ? this._offsetLegacy : false,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (this._randomOffsetLegacy && !this._randomOffset) {\n\t\t\t\t\tthis._randomOffset = {\n\t\t\t\t\t\tsource: !target ? this._randomOffsetLegacy : false,\n\t\t\t\t\t\ttarget: !!target ? this._randomOffsetLegacy : false,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tthis.sequence.nameOffsetMap[this._name] = {\n\t\t\t\t\tseed: `${this._name}-${foundry.utils.randomID()}`,\n\t\t\t\t\tsource: source,\n\t\t\t\t\ttarget: target,\n\t\t\t\t\trandomOffset: this._randomOffset,\n\t\t\t\t\tangle: this._angle,\n\t\t\t\t\trandomRotation: this._randomRotation,\n\t\t\t\t\tmirrorX: this._mirrorX,\n\t\t\t\t\tmirrorY: this._mirrorY,\n\t\t\t\t\tmissed: this._missed,\n\t\t\t\t\toffset: this._offset,\n\t\t\t\t\trepetitions: this._repetitions,\n\t\t\t\t\ttwister: {},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\tif (\n\t\t!this._file &&\n\t\t!this._copySprite &&\n\t\t!this._text &&\n\t\t!this._shapes.length &&\n\t\tthis.sequence.softFail\n\t) {\n\t\tthis._playEffect = false;\n\t\treturn;\n\t}\n\n\tif (this._copySprite && !this._file) {\n\t\treturn;\n\t}\n\n\tlet fileData = this._file\n\t\t? await this._determineFile(this._file)\n\t\t: {\n\t\t\tfile: this._file,\n\t\t\tforcedIndex: false,\n\t\t\tcustomRange: false,\n\t\t};\n\n\t\tthis._isRangedEffect = fileData?.file?.rangeFind;\n\n\t\tif (fileData.customRange || fileData.file?.dbPath) return;\n\n\t\tlet exists = false;\n\t\ttry {\n\t\t\texists = await SequencerFileCache.srcExists(fileData.file);\n\t\t} catch (err) {\n\t\t}\n\n\t\tif (!exists) {\n\t\t\tif (this.sequence.softFail) {\n\t\t\t\tthis._playEffect = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"Play\",\n\t\t\t\t`Could not find file:<br>${fileData.file}`\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * @private\n\t */\n\t_getSourceObject() {\n\t\tif (!this._source || typeof this._source !== \"object\"){\n\t\t\treturn this._source;\n\t\t}\n\t\tif(this._source instanceof CrosshairsPlaceable || this._source instanceof CrosshairsDocument){\n\t\t\tconst doc = this._source?.document ?? this._source;\n\t\t\tif(this._attachTo) {\n\t\t\t\treturn lib.get_object_identifier(doc.object);\n\t\t\t}\n\t\t\treturn doc.getOrientation().source;\n\t\t}\n\t\tif (this._source?.cachedLocation || !this._attachTo) {\n\t\t\treturn canvaslib.get_object_canvas_data(this._source, { uuid: true });\n\t\t}\n\t\treturn (\n\t\t\tlib.get_object_identifier(this._source) ??\n\t\t\tcanvaslib.get_object_canvas_data(this._source, { uuid: true })\n\t\t);\n\t}\n\n\t/**\n\t * @private\n\t */\n\t_getTargetObject() {\n\t\tif (!this._target) return this._target;\n\t\tif (typeof this._target.target !== \"object\"){\n\t\t\treturn this._target.target;\n\t\t}\n\t\tif(this._target?.target instanceof CrosshairsPlaceable || this._target?.target instanceof CrosshairsDocument){\n\t\t\tconst doc = this._target?.target?.document ?? this._target?.target;\n\t\t\tif(this._stretchTo?.attachTo || this._rotateTowards?.attachTo){\n\t\t\t\treturn lib.get_object_identifier(doc.object);\n\t\t\t}\n\t\t\tconst orientation = doc.getOrientation();\n\t\t\treturn orientation.target ?? orientation.source;\n\t\t}\n\t\tif (\n\t\t\tthis._target?.target?.cachedLocation ||\n\t\t\t!(this._stretchTo?.attachTo || this._rotateTowards?.attachTo)\n\t\t) {\n\t\t\treturn canvaslib.get_object_canvas_data(this._target.target, { measure: true, uuid: true });\n\t\t}\n\t\treturn (\n\t\t\tlib.get_object_identifier(this._target.target) ??\n\t\t\tcanvaslib.get_object_canvas_data(this._target.target, { measure: true, uuid: true })\n\t\t);\n\t}\n\n\t/**\n\t * @private\n\t */\n\tasync _sanitizeEffectData() {\n\t\tif (this._deserializedData) {\n\t\t\tthis._deserializedData.creationTimestamp = +new Date();\n\t\t\tthis._deserializedData.remote = true;\n\t\t\treturn this._deserializedData;\n\t\t}\n\n\tlet file = \"\";\n\tlet forcedIndex = null;\n\tlet customRange = null;\n\n\tif (!this._copySprite || this._file) {\n\t\tconst fileData =\n\t\t\tthis._file && this._playEffect\n\t\t\t\t? await this._determineFile(this._file)\n\t\t\t\t: {\n\t\t\t\t\tfile: this._file,\n\t\t\t\t\tforcedIndex: false,\n\t\t\t\t\tcustomRange: false,\n\t\t\t\t};\n\t\tfile = fileData.file;\n\t\tforcedIndex = fileData.forcedIndex;\n\t\tcustomRange = fileData.customRange;\n\t}\n\n\t\tlet source = this._getSourceObject();\n\t\tlet target = this._getTargetObject();\n\n\t\tthis._temporaryEffect =\n\t\t\tthis._temporaryEffect ||\n\t\t\t(source instanceof foundry.abstract.Document ||\n\t\t\tsource instanceof foundry.canvas.placeables.MeasuredTemplate\n\t\t\t\t? !lib.is_UUID(source?.uuid)\n\t\t\t\t: this._temporaryEffect || false);\n\n\t\tif (this._offsetLegacy) {\n\t\t\tthis._offset = {\n\t\t\t\tsource:\n\t\t\t\t\t!target && this._offset?.source\n\t\t\t\t\t\t? this._offsetLegacy\n\t\t\t\t\t\t: this._offset?.source,\n\t\t\t\ttarget:\n\t\t\t\t\t!!target && this._offset?.target\n\t\t\t\t\t\t? this._offsetLegacy\n\t\t\t\t\t\t: this._offset?.target,\n\t\t\t};\n\t\t}\n\n\t\tif (this._randomOffsetLegacy) {\n\t\t\tthis._randomOffset = {\n\t\t\t\tsource:\n\t\t\t\t\t!target && this._randomOffset?.source\n\t\t\t\t\t\t? this._randomOffsetLegacy\n\t\t\t\t\t\t: this._randomOffset?.source,\n\t\t\t\ttarget:\n\t\t\t\t\t!!target && this._randomOffset?.target\n\t\t\t\t\t\t? this._randomOffsetLegacy\n\t\t\t\t\t\t: this._randomOffset?.target,\n\t\t\t};\n\t\t}\n\n\t\tif (this._selfMask) {\n\t\t\tthis._masks.push(\n\t\t\t\tlib.get_object_identifier(this._source) ??\n\t\t\t\tcanvaslib.get_object_canvas_data(this._source, { uuid: false })\n\t\t\t);\n\t\t}\n\n\t\tlet sceneId = game.user.viewedScene;\n\t\tif (lib.is_UUID(source)) {\n\t\t\tconst potentialSceneId = source.split(\".\")[1];\n\t\t\tif (game.scenes.get(potentialSceneId)) {\n\t\t\t\tsceneId = potentialSceneId;\n\t\t\t}\n\t\t} else if (lib.is_UUID(target)) {\n\t\t\tconst potentialSceneId = target.split(\".\")[1];\n\t\t\tif (game.scenes.get(potentialSceneId)) {\n\t\t\t\tsceneId = potentialSceneId;\n\t\t\t}\n\t\t}\n\n\t\tlet data = foundry.utils.duplicate({\n\t\t\t/**\n\t\t\t * Core properties\n\t\t\t */\n\t\t\t_id: foundry.utils.randomID(),\n\t\t\tflagVersion: flagManager.latestFlagVersion,\n\t\t\tsequenceId: this.sequence.id,\n\t\t\tcreationTimestamp: Date.now(),\n\t\t\tsceneId,\n\t\t\tcreatorUserId: game.userId,\n\t\t\tmoduleName: this.sequence.moduleName,\n\t\t\tusers: this._users ? Array.from(this._users) : false,\n\t\t\tname: this._name,\n\t\t\torigin: this._origin,\n\t\t\tindex: this.sequence.effectIndex,\n\t\t\trepetition: this._currentRepetition,\n\t\t\tprivate: this._private,\n\t\t\ttemporary: this._temporaryEffect,\n\t\t\ttiedDocuments: Array.from(new Set(this._tiedDocuments)),\n\t\t\tlocal: this.sequence.local,\n\t\t\tremote: this.sequence.remote,\n\n\t\t\t/**\n\t\t\t * Source/target properties\n\t\t\t */\n\t\t\tsource: source,\n\t\t\ttarget: target,\n\t\t\trotateTowards: this._rotateTowards,\n\t\t\tstretchTo: this._stretchTo\n\t\t\t\t? {\n\t\t\t\t\tattachTo: this._stretchTo.attachTo,\n\t\t\t\t\tonlyX: this._stretchTo.onlyX,\n\t\t\t\t\trequiresLineOfSight: this._stretchTo.requiresLineOfSight,\n\t\t\t\t\thideLineOfSight: this._stretchTo.hideLineOfSight,\n\t\t\t\t}\n\t\t\t\t: false,\n\t\t\tmoveTowards: this._moveTowards\n\t\t\t\t? {\n\t\t\t\t\tease: this._moveTowards.ease,\n\t\t\t\t\trotate: this._moveTowards.rotate,\n\t\t\t\t}\n\t\t\t\t: false,\n\n\t\tattachTo: this._attachTo,\n\t\tmissed: this._missed,\n\t\tcopySprite: this._copySprite ? {\n\t\t\tuuid: this._copySprite.object?.uuid,\n\t\t\t...this._copySprite.options\n\t\t} : false,\n\n\t\t/**\n\t\t * Sprite properties\n\t\t\t */\n\t\t\tfile: file?.dbPath ?? file,\n\t\t\tcustomRange,\n\t\t\tforcedIndex,\n\t\t\tfileOptions: this._fileOptions,\n\t\t\ttext: this._text,\n\t\t\ttilingTexture: this._tilingTexture,\n\t\t\tmasks: Array.from(new Set(this._masks)),\n\t\t\tshapes: this._shapes,\n\t\t\tvolume: this._volume,\n\t\t\tisometric: this._isometric,\n\t\t\tsyncGroup: this._syncGroup,\n\n\t\t\t// Transforms\n\t\t\tscale: this._getCalculatedScale(\"scale\"),\n\t\t\tspriteScale: this._getCalculatedScale(\"spriteScale\"),\n\t\t\tangle: this._angle,\n\t\t\tsize: this._size,\n\t\t\toffset: this._offset,\n\t\t\tanchor: this._anchor,\n\t\t\tspriteOffset: this._spriteOffset,\n\t\t\tspriteAnchor: this._spriteAnchor,\n\t\t\ttemplate: this._template,\n\t\t\tzeroSpriteRotation: this._zeroSpriteRotation,\n\t\t\trandomOffset: this._randomOffset,\n\t\t\trandomRotation: this._randomRotation,\n\t\t\tscaleToObject: this._scaleToObject,\n\t\t\televation: this._elevation,\n\t\t\tsortLayer: this._sortLayer,\n\t\t\tlevels: this._levels,\n\t\t\taboveLighting: this._aboveLighting,\n\t\t\taboveInterface: this._aboveInterface,\n\t\t\txray: this._xray,\n\t\t\tconstrainedByWalls: this._constrainedByWalls,\n\n\t\t\t// Appearance\n\t\t\tzIndex: this._zIndex,\n\t\t\topacity: lib.is_real_number(this._opacity) ? this._opacity : 1.0,\n\t\t\tfilters: this._filters,\n\t\t\tloopOptions: this._loopOptions,\n\t\t\tspriteRotation: this._spriteRotation,\n\t\t\trandomSpriteRotation: this._randomSpriteRotation,\n\t\t\ttint: this._tint?.decimal,\n\t\t\tblendMode: this._blendMode,\n\t\t\tflipX: this._mirrorX,\n\t\t\tflipY: this._mirrorY,\n\n\t\t\t/**\n\t\t\t * Time properties\n\t\t\t */\n\t\t\tduration: this._duration,\n\t\t\tpersist: this._persist,\n\t\t\tpersistOptions: this._persistOptions,\n\t\t\tplaybackRate: this._playbackRate,\n\t\t\textraEndDuration: this._extraEndDuration,\n\t\t\ttime:\n\t\t\t\tthis._startTime || this._endTime\n\t\t\t\t\t? {\n\t\t\t\t\t\tstart: lib.is_real_number(this._startTime)\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tvalue: this._startTime,\n\t\t\t\t\t\t\t\tisPerc: this._startPerc,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: false,\n\t\t\t\t\t\tend: lib.is_real_number(this._endTime)\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tvalue: this._endTime,\n\t\t\t\t\t\t\t\tisPerc: this._endPerc,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: false,\n\t\t\t\t\t\tisRange: this._isRange,\n\t\t\t\t\t}\n\t\t\t\t\t: false,\n\n\t\t\t/**\n\t\t\t * Animation properties\n\t\t\t */\n\t\t\tmoves: this._moveTowards,\n\t\t\tmoveSpeed: this._moveSpeed,\n\t\t\tfadeIn: this._fadeIn,\n\t\t\tfadeOut: this._fadeOut,\n\t\t\tscaleIn: this._scaleIn,\n\t\t\tscaleOut: this._scaleOut,\n\t\t\trotateIn: this._rotateIn,\n\t\t\trotateOut: this._rotateOut,\n\t\t\tfadeInAudio: this._fadeInAudio,\n\t\t\tfadeOutAudio: this._fadeOutAudio,\n\t\t\tanimations: this._animations,\n\n\t\t\t/**\n\t\t\t * Screenspace properties\n\t\t\t */\n\t\t\tscreenSpace: this._screenSpace,\n\t\t\tscreenSpaceAboveUI: this._screenSpaceAboveUI,\n\t\t\tscreenSpaceAnchor: this._screenSpaceAnchor,\n\t\t\tscreenSpacePosition: this._screenSpacePosition,\n\t\t\tscreenSpaceScale: this._screenSpaceScale,\n\n\t\t\tnameOffsetMap: this.sequence.nameOffsetMap,\n\t\t});\n\n\t\tfor (let override of this._overrides) {\n\t\t\tdata = await override(this, data);\n\t\t}\n\n\t\tif (\n\t\t\t(typeof data.file !== \"string\" || data.file === \"\") &&\n\t\t\t!data.text &&\n\t\t\t!data.shapes &&\n\t\t\t!data.customRange\n\t\t) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"file\",\n\t\t\t\t\"an effect must have a file, text, or have a shape!\"\n\t\t\t);\n\t\t}\n\n\t\t// TODO: Revisit this at some point?\n\t\t// data = Object.fromEntries(Object.entries(data).filter(entry => entry[1] !== null && entry[1] !== false));\n\n\t\treturn data;\n\t}\n\n\tasync _serialize() {\n\t\tconst data = await super._serialize();\n\t\tawait this.preRun();\n\t\tconst sectionData = await this._sanitizeEffectData();\n\t\treturn {\n\t\t\t...data,\n\t\t\ttype: \"effect\",\n\t\t\tsectionData,\n\t\t};\n\t}\n\n\tasync _deserialize(data) {\n\t\tthis._deserializedData = data.sectionData;\n\t\treturn super._deserialize(data);\n\t}\n\n\t/**\n\t * @private\n\t */\n\t_getCalculatedScale(type) {\n\t\tconst min = this[\"_\" + type + \"Min\"];\n\t\tconst max = this[\"_\" + type + \"Max\"];\n\n\t\tlet scale = min;\n\t\tif (lib.is_real_number(min)) {\n\t\t\tif (max && lib.is_real_number(max)) {\n\t\t\t\tscale = lib.random_float_between(min, max);\n\t\t\t}\n\t\t\tscale = {\n\t\t\t\tx: scale,\n\t\t\t\ty: scale,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tx: scale?.x ?? 1.0,\n\t\t\ty: scale?.y ?? 1.0,\n\t\t};\n\t}\n}\n","import * as lib from \"../lib/lib.js\";\nimport SequencerSoundManager from \"../modules/sequencer-sound-manager.js\";\nimport Section from \"./section.js\";\nimport traits from \"./traits/_traits.js\";\nimport CrosshairsPlaceable from \"../modules/sequencer-crosshair/CrosshairsPlaceable.js\";\nimport CrosshairsDocument from \"../modules/sequencer-crosshair/CrosshairsDocument.js\";\nimport * as canvaslib from \"../lib/canvas-lib.js\";\nimport flagManager from \"../utils/flag-manager.js\";\n\nclass SoundSection extends Section {\n\tconstructor(inSequence, inFile = \"\") {\n\t\tsuper(inSequence);\n\t\tthis._file = inFile;\n\t\tthis._volume = 0.8;\n\t\tthis._channel = \"interface\";\n\t\tthis._overrides = [];\n\t\tthis._locationOptions = {};\n\t\tthis._toLocation = false;\n\t\tthis._moveTowards = false;\n\t\tthis._global = false;\n\t\tthis._persist = false;\n\t\tthis._persistOptions = false;\n\t\tthis._loopOptions = false;\n\t\tthis._panSound = false;\n\t\tthis._extraEndDuration = false;\n\t\tthis._levels = null;\n\t\tthis._elevation = null;\n\t}\n\n\tget _target() {\n\t\treturn this._toLocation || this._moveTowards || false;\n\t}\n\n\tstatic niceName = \"Sound\";\n\n\t/**\n\t * Declares which file to be played. This may also be an array of paths, which will be randomly picked from each\n\t * time the section is played.\n\t *\n\t * @param {string|array} inFile\n\t * @returns this\n\t */\n\tfile(inFile) {\n\t\tthis._file = inFile;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a function that will run at the end of the sound serialization step, but before it is played. Allows direct\n\t * modifications of sound's data.\n\t *\n\t * @param {function} inFunc\n\t * @returns {SoundSection}\n\t */\n\taddOverride(inFunc) {\n\t\tif (!lib.is_function(inFunc))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"addOverride\",\n\t\t\t\t\"The given function needs to be an actual function.\",\n\t\t\t);\n\t\tthis._overrides.push(inFunc);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the radius (in scene units) within which the sound is audible. Requires `.atLocation()` to be set,\n\t * otherwise the sound remains global.\n\t *\n\t * @param {number} inNumber\n\t * @returns {SoundSection}\n\t */\n\tradius(inNumber) {\n\t\tif (!lib.is_real_number(inNumber))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"radius\",\n\t\t\t\t\"inNumber must be of type number\"\n\t\t\t);\n\t\tthis._locationOptions['radius'] = inNumber;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Whether the sound is completely blocked by walls. Requires `.atLocation()` to be set. If `true`, the\n\t * `.muffledEffect()` will have no effect.\n\t *\n\t * @param {boolean} [inBool=true]\n\t * @returns {SoundSection}\n\t */\n\tconstrainedByWalls(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"constrainedByWalls\",\n\t\t\t\t`inBool must be of type boolean`\n\t\t\t);\n\t\tthis._locationOptions['walls'] = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Whether the sound's volume is eased by the distance from its origin. Requires `.atLocation()` to be set.\n\t *\n\t * @param {boolean} [inBool=true]\n\t * @returns {SoundSection}\n\t */\n\tdistanceEasing(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"distanceEasing\",\n\t\t\t\t`inBool must be of type boolean`\n\t\t\t);\n\t\tthis._locationOptions['easing'] = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the audio channel the sound is played through. Accepts any channel name available on `game.audio` that\n\t * is an `AudioContext` (eg. `\"music\"`, `\"environment\"`, `\"interface\"`).\n\t *\n\t * @param {string} inString\n\t * @returns {SoundSection}\n\t */\n\taudioChannel(inString) {\n\t\tif (typeof inString !== \"string\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"audioChannel\",\n\t\t\t\t`inString must be of type string`\n\t\t\t);\n\t\tif (!(game.audio?.[inString] instanceof AudioContext)) {\n\t\t\tconst validChannels = Object.entries(game.audio)\n\t\t\t\t.filter(e => e[1] instanceof AudioContext)\n\t\t\t\t.map(e => e[0]);\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"audioChannel\",\n\t\t\t\t`inString must be of type ${validChannels.slice(0, -1).join(\", \")}, or ${validChannels.slice(-1)}`\n\t\t\t);\n\t\t}\n\t\tthis._channel = inString;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Whether GMs always hear the sound as if standing at its origin, regardless of token position. Requires\n\t * `.atLocation()` to be set.\n\t *\n\t * @param {boolean} [inBool=true]\n\t * @returns {SoundSection}\n\t */\n\talwaysForGMs(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"alwaysForGMs\",\n\t\t\t\t`inBool must be of type boolean`\n\t\t\t);\n\t\tthis._locationOptions['gmAlways'] = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Allows you to control the number of loops and the delays between each loop.\n\t *\n\t * @param {object} [inOptions]\n\t * @param {number} [inOptions.loopDelay=0] - delay (in ms) between each loop\n\t * @param {number} [inOptions.loops=0] - number of loops before ending, 0 for indefinite\n\t * @param {boolean} [inOptions.endOnLastLoop=false] - whether the sound should end when reaching the last loop\n\t * @returns {SoundSection}\n\t */\n\tloopOptions(inOptions={}){\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"loopOptions\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\n\t\tif (inOptions.maxLoops !== undefined) {\n\t\t\tlib.custom_warning(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t\"Sound | loopOptions' maxLoops option is deprecated, please use loops instead\"\n\t\t\t);\n\t\t\tinOptions = { ...inOptions, loops: inOptions.loops ?? inOptions.maxLoops };\n\t\t\tdelete inOptions.maxLoops;\n\t\t}\n\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tloopDelay: 0,\n\t\t\t\tloops: 0,\n\t\t\t\tendOnLastLoop: false\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\n\t\tif (typeof inOptions.endOnLastLoop !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"loopOptions\",\n\t\t\t\t\"inOptions.endOnLastLoop must be of type boolean\"\n\t\t\t);\n\n\t\tif (typeof inOptions.loopDelay !== \"number\" || inOptions.loopDelay < 0)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"loopOptions\",\n\t\t\t\t\"inOptions.loopDelay must be of type number that is not below 0\"\n\t\t\t);\n\n\t\tif (typeof inOptions.loops !== \"number\" || inOptions.loops < 0)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"loopOptions\",\n\t\t\t\t\"inOptions.loops must be of type number that is not below 0\"\n\t\t\t);\n\n\t\tthis._loopOptions = inOptions;\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets an audio effect to be applied while the sound is heard normally (no walls between source and listener).\n\t * Requires `.atLocation()` to be set.\n\t *\n\t * @param {object} [options]\n\t * @param {string} [options.type] - one of the keys in `CONFIG.soundEffects` (eg. `\"lowpass\"`, `\"highpass\"`, `\"reverb\"`)\n\t * @param {number} [options.intensity=0] - intensity of the effect\n\t * @returns {SoundSection}\n\t */\n\tbaseEffect(options = {}) {\n\t\toptions = foundry.utils.mergeObject({\n\t\t\ttype: \"\",\n\t\t\tintensity: 0\n\t\t}, options);\n\t\tif (typeof options.type !== \"string\" || !CONFIG.soundEffects[options.type])\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"baseEffect\",\n\t\t\t\t`options.type must be of type string, and one of ${Object.keys(CONFIG.soundEffects).join(\", \")}`\n\t\t\t);\n\t\tif (!lib.is_real_number(options.intensity))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"baseEffect\",\n\t\t\t\t\"options.intensity must be of type number\"\n\t\t\t);\n\t\tthis._locationOptions['baseEffect'] = {\n\t\t\ttype: options.type,\n\t\t\tintensity: options.intensity\n\t\t};\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets an audio effect to be applied while the sound is heard through a wall. Requires `.atLocation()` to be\n\t * set and `.constrainedByWalls()` to be `false` (the default).\n\t *\n\t * @param {object} [options]\n\t * @param {string} [options.type] - one of the keys in `CONFIG.soundEffects` (eg. `\"lowpass\"`, `\"highpass\"`, `\"reverb\"`)\n\t * @param {number} [options.intensity=0] - intensity of the effect\n\t * @returns {SoundSection}\n\t */\n\tmuffledEffect(options = {}) {\n\t\toptions = foundry.utils.mergeObject({\n\t\t\ttype: \"\",\n\t\t\tintensity: 0\n\t\t}, options);\n\t\tif (typeof options.type !== \"string\" || !CONFIG.soundEffects[options.type])\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"baseEffect\",\n\t\t\t\t`options.type must be of type string, and one of ${Object.keys(CONFIG.soundEffects).join(\", \")}`\n\t\t\t);\n\t\tif (!lib.is_real_number(options.intensity))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"baseEffect\",\n\t\t\t\t\"options.intensity must be of type number\"\n\t\t\t);\n\t\tthis._locationOptions['muffledEffect'] = {\n\t\t\ttype: options.type,\n\t\t\tintensity: options.intensity\n\t\t};\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the target location of the sound, used together with `.atLocation()` so the sound has a direction (for\n\t * `.panSound()`, distance falloff, etc).\n\t *\n\t * @param {object|string} inLocation - reference to a placeable, document, canvas coordinate, or a string name (see `.name()`)\n\t * @param {object} [inOptions]\n\t * @param {boolean} [inOptions.cacheLocation=false] - cache the target's location at sequence build time instead of resolving it at runtime\n\t * @param {object|boolean} [inOptions.offset=false] - offset the target by `{ x, y }`\n\t * @param {number|boolean} [inOptions.randomOffset=false] - offset the target by a random amount; if a number, used as a multiplier on the object size\n\t * @param {boolean} [inOptions.gridUnits=false] - treat the offset's `x` and `y` as grid units\n\t * @param {boolean} [inOptions.local=false] - offset relative to the sound's rotation rather than world axes\n\t * @returns {SoundSection}\n\t */\n\ttoLocation(inLocation, inOptions = {}) {\n\t\tif (!inLocation || !(typeof inLocation === \"object\" || typeof inLocation === \"string\")) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"toLocation\",\n\t\t\t\t`inLocation is invalid, and must be of type of object, string, placeable object, or document`\n\t\t\t);\n\t\t}\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"toLocation\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tcacheLocation: false,\n\t\t\t\toffset: false,\n\t\t\t\trandomOffset: false,\n\t\t\t\tgridUnits: false,\n\t\t\t\tlocal: false,\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\t\tinLocation = this._validateLocation(inLocation);\n\t\tif (inLocation === undefined)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"toLocation\",\n\t\t\t\t\"could not find position of given object\"\n\t\t\t);\n\t\tif (typeof inOptions.cacheLocation !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"toLocation\",\n\t\t\t\t\"inOptions.cacheLocation must be of type boolean\"\n\t\t\t);\n\t\tif (\n\t\t\t!(\n\t\t\t\ttypeof inOptions.randomOffset === \"boolean\" ||\n\t\t\t\tlib.is_real_number(inOptions.randomOffset)\n\t\t\t)\n\t\t)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"toLocation\",\n\t\t\t\t\"inOptions.randomOffset must be of type boolean or number\"\n\t\t\t);\n\n\t\tif (inOptions.offset) {\n\t\t\tconst offsetData = this._validateOffset(\n\t\t\t\t\"toLocation\",\n\t\t\t\tinOptions.offset,\n\t\t\t\tinOptions\n\t\t\t);\n\t\t\tthis._offset = {\n\t\t\t\tsource: this._offset?.source ?? false,\n\t\t\t\ttarget: offsetData,\n\t\t\t};\n\t\t}\n\n\t\tthis._randomOffset = {\n\t\t\tsource: this._randomOffset?.source ?? false,\n\t\t\ttarget: inOptions.randomOffset,\n\t\t};\n\n\t\tthis._toLocation =\n\t\t\tinOptions.cacheLocation && typeof inLocation !== \"string\"\n\t\t\t\t? canvaslib.get_object_canvas_data(inLocation, { uuid: false })\n\t\t\t\t: inLocation;\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Forces the sound to be heard globally, ignoring `.atLocation()`, `.radius()`, walls, and distance easing.\n\t *\n\t * @param {boolean} [inBool=true]\n\t * @returns {SoundSection}\n\t */\n\tglobalSound(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"globalSound\",\n\t\t\t\t`inBool must be of type boolean`\n\t\t\t);\n\t\tthis._global = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the sound to pan stereo (left/right) based on the position of the sound relative to the listener.\n\t *\n\t * @param {boolean} [inBool=true]\n\t * @param {object} [inOptions]\n\t * @param {number} [inOptions.innerEaseDistance=0] - distance within which the pan is at full strength\n\t * @param {number} [inOptions.outerEaseDistance=0] - distance beyond which the pan stops easing; must be greater than `innerEaseDistance` when both are non-zero\n\t * @returns {SoundSection}\n\t */\n\tpanSound(inBool = true, inOptions = {}) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"panSound\",\n\t\t\t\t`inBool must be of type boolean`\n\t\t\t);\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"panSound\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tinnerEaseDistance: 0,\n\t\t\t\touterEaseDistance: 0,\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\t\tif (typeof inOptions.innerEaseDistance !== \"number\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"panSound\",\n\t\t\t\t\"inOptions.innerEaseDistance must be of type number\"\n\t\t\t);\n\t\tif (typeof inOptions.outerEaseDistance !== \"number\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"panSound\",\n\t\t\t\t\"inOptions.outerEaseDistance must be of type number\"\n\t\t\t);\n\t\tif(inOptions.innerEaseDistance > 0 && inOptions.outerEaseDistance > 0 && inOptions.innerEaseDistance >= inOptions.outerEaseDistance){\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"panSound\",\n\t\t\t\t\"inOptions.innerEaseDistance must be less than inOptions.outerEaseDistance\"\n\t\t\t);\n\t\t}\n\t\tthis._panSound = {\n\t\t\tactive: inBool,\n\t\t\t...inOptions,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds extra time (in ms) before a persisted sound is considered ended. Only meaningful on `.persist()`ed sounds.\n\t *\n\t * @param {number} inExtraDuration\n\t * @returns {SoundSection}\n\t */\n\textraEndDuration(inExtraDuration){\n\t\tif (typeof inExtraDuration !== \"number\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"extraEndDuration\",\n\t\t\t\t\t\"inExtraDuration must be of type number\"\n\t\t\t);\n\t\tthis._extraEndDuration = inExtraDuration;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the sound to persist on the canvas. The sound can be ended later via the Sound Manager.\n\t *\n\t * @param {boolean} [inBool=true]\n\t * @param {object} [inOptions]\n\t * @param {boolean} [inOptions.persistTokenPrototype=false] - when attached to a token, persist the sound on the token's prototype data\n\t * @returns {SoundSection}\n\t */\n\tpersist(inBool = true, inOptions = {}) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"persist\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"persist\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tid: foundry.utils.randomID(),\n\t\t\t\tpersistTokenPrototype: false\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\t\tif (typeof inOptions.persistTokenPrototype !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"persist\",\n\t\t\t\t\"inOptions.persistTokenPrototype must be of type boolean\"\n\t\t\t);\n\t\tthis._persist = inBool;\n\t\tthis._persistOptions = inOptions;\n\t\treturn this;\n\t}\n\n\t/**\n\t *  A smart method that can take a reference to an object, or a direct on the canvas to attach an sound to,\n\t *  or a string reference (see .name())\n\t *\n\t * @param {Object|String} inObject\n\t * @param {Object} inOptions\n\t * @returns {SoundSection}\n\t */\n\tattachTo(inObject, inOptions = {}) {\n\t\tif (!inObject || !(typeof inObject === \"object\" || typeof inObject === \"string\")) {\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t`inObject is invalid, and must be of type of object, string, placeable object, or document`\n\t\t\t);\n\t\t}\n\t\tif (typeof inOptions !== \"object\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t`inOptions must be of type object`\n\t\t\t);\n\t\tinOptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tbindVisibility: true,\n\t\t\t\tbindElevation: true,\n\t\t\t},\n\t\t\tinOptions\n\t\t);\n\n\t\tconst validatedObject = this._validateLocation(inObject);\n\t\tif (validatedObject === undefined)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t\"could not find given object\"\n\t\t\t);\n\n\t\tif (typeof inOptions.bindVisibility !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t`inOptions.bindVisibility must be of type boolean`\n\t\t\t);\n\t\tif (typeof inOptions.bindElevation !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"attachTo\",\n\t\t\t\t\"inOptions.bindElevation must be of type boolean\"\n\t\t\t);\n\n\t\tthis._source = validatedObject;\n\n\t\tthis._attachTo = {\n\t\t\tactive: !!validatedObject,\n\t\t\tbindVisibility: inOptions.bindVisibility,\n\t\t\tbindElevation: inOptions.bindElevation,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/**\n\t * @private\n\t */\n\t_applyTraits() {\n\t\tObject.assign(this.constructor.prototype, traits.files);\n\t\tObject.assign(this.constructor.prototype, traits.audio);\n\t\tObject.assign(this.constructor.prototype, traits.elevation);\n\t\tObject.assign(this.constructor.prototype, traits.levels);\n\t\tObject.assign(this.constructor.prototype, traits.time);\n\t\tObject.assign(this.constructor.prototype, traits.users);\n\t\tObject.assign(this.constructor.prototype, traits.name);\n\t\tObject.assign(this.constructor.prototype, traits.location);\n\t\tObject.assign(this.constructor.prototype, traits.offset);\n\t\tObject.assign(this.constructor.prototype, traits.moves);\n\t}\n\n\t/**\n\t * @private\n\t */\n\tasync _initialize() {\n\t\tif (this._name) {\n\t\t\tthis.sequence.nameOffsetMap ||= {};\n\t\t\tif (!this.sequence.nameOffsetMap[this._name]) {\n\t\t\t\tconst source = this._getSourceObject();\n\t\t\t\tconst target = this._getTargetObject();\n\t\t\t\tthis.sequence.nameOffsetMap[this._name] = {\n\t\t\t\t\tseed: `${this._name}-${foundry.utils.randomID()}`,\n\t\t\t\t\tsource: source,\n\t\t\t\t\ttarget: target,\n\t\t\t\t\ttwister: {},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @OVERRIDE\n\t */\n\tasync preRun() {\n\t\tconst oldSource = this._source;\n\t\tconst crosshairSource = this.sequence?.crosshairs?.[this._source];\n\t\tif(typeof this._source === \"string\" && crosshairSource){\n\t\t\tthis._source = crosshairSource.uuid;\n\t\t}\n\t\tconst oldTarget = this._target?.target;\n\t\tconst crosshairTarget = this.sequence?.crosshairs?.[this._target?.target];\n\t\tif(typeof this._target?.target === \"string\" && crosshairTarget){\n\t\t\tthis._target.target = crosshairTarget.uuid;\n\t\t}\n\n\t\tif(this._attachTo && !this._attachTo.active && typeof this._source === \"string\" && crosshairSource){\n\t\t\tthis._attachTo.active = !!crosshairSource;\n\t\t}\n\n\t\tif (this._name && (oldSource !== this._source || oldTarget !== this._target?.target)) {\n\t\t\tthis.sequence.nameOffsetMap[this._name].source = this._getSourceObject();\n\t\t\tthis.sequence.nameOffsetMap[this._name].target = this._getTargetObject();\n\t\t}\n\n\t\tconst source = this._getSourceObject();\n\t\tif(this._persistOptions?.persistTokenPrototype && !(this._attachTo?.active || lib.is_UUID(source))){\n\t\t\tthis._persistOptions.persistTokenPrototype = false;\n\t\t}\n\t}\n\n\t/**\n\t * @OVERRIDE\n\t * @returns {Promise}\n\t */\n\tasync run() {\n\t\tconst playData = await this._sanitizeSoundData();\n\n\t\tif (!playData.play && this.sequence.softFail) {\n\t\t\treturn new Promise((reject) => {\n\t\t\t\treject();\n\t\t\t});\n\t\t}\n\n\t\tif (!playData?.play) {\n\t\t\tthis.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"Play\",\n\t\t\t\t`File not found: ${playData.file}`,\n\t\t\t);\n\t\t\treturn new Promise((reject) => reject());\n\t\t}\n\n\t\tif (Hooks.call(\"preCreateSequencerSound\", playData) === false) return;\n\n\t\tlet push =\n\t\t\t!(\n\t\t\t\tplayData?.users?.length === 1 && playData?.users?.includes(game.userId)\n\t\t\t) && !this.sequence.local && !this.sequence.remote;\n\n\t\tlet duration = await SequencerSoundManager.play(playData, push);\n\n\t\tawait new Promise((resolve) =>\n\t\t\tsetTimeout(resolve, this._currentWaitTime + duration),\n\t\t);\n\t}\n\n\t_getSourceObject() {\n\t\tif (!this._source || typeof this._source !== \"object\") {\n\t\t\treturn this._source;\n\t\t}\n\t\tif (this._source instanceof CrosshairsPlaceable || this._source instanceof CrosshairsDocument) {\n\t\t\tconst doc = this._source?.document ?? this._source;\n\t\t\tif(this._attachTo) {\n\t\t\t\treturn lib.get_object_identifier(doc.object);\n\t\t\t}\n\t\t\treturn doc.getOrientation().source;\n\t\t}\n\t\tif (this._source?.cachedLocation || !this._attachTo) {\n\t\t\treturn canvaslib.get_object_canvas_data(this._source, { uuid: true });\n\t\t}\n\t\treturn (\n\t\t\tlib.get_object_identifier(this._source) ??\n\t\t\tcanvaslib.get_object_canvas_data(this._source, { uuid: true })\n\t\t);\n\t}\n\n\t/**\n\t * @private\n\t */\n\t_getTargetObject() {\n\t\tlet target = this._target.target ?? this._target;\n\t\tif (!target || typeof target !== \"object\") {\n\t\t\treturn target;\n\t\t}\n\t\tif (target instanceof CrosshairsPlaceable || target instanceof CrosshairsDocument) {\n\t\t\tconst doc = target?.document ?? target;\n\t\t\treturn doc.getOrientation().source;\n\t\t}\n\t\tif (target?.cachedLocation) {\n\t\t\treturn canvaslib.get_object_canvas_data(target, { uuid: true });\n\t\t}\n\t\treturn (\n\t\t\tlib.get_object_identifier(target) ??\n\t\t\tcanvaslib.get_object_canvas_data(target, { uuid: true })\n\t\t);\n\t}\n\n\t/**\n\t * @returns {Promise}\n\t * @private\n\t */\n\tasync _sanitizeSoundData() {\n\t\tif (this._deserializedData) {\n\t\t\treturn this._deserializedData;\n\t\t}\n\n\t\tif (!this._file) {\n\t\t\treturn {\n\t\t\t\tplay: false,\n\t\t\t\tfile: false,\n\t\t\t};\n\t\t}\n\n\t\tlet { file, forcedIndex, customRange } = await this._determineFile(this._file);\n\n\t\tif (!file) {\n\t\t\treturn {\n\t\t\t\tplay: false,\n\t\t\t\tfile: false,\n\t\t\t\tcustomRange: false\n\t\t\t};\n\t\t}\n\n\t\tlet data = {\n\t\t\t_id: foundry.utils.randomID(),\n\t\t\tflagVersion: flagManager.latestFlagVersion,\n\t\t\tplay: true,\n\t\t\tfile: file.dbPath ?? file,\n\t\t\tforcedIndex,\n\t\t\tcustomRange,\n\t\t\tcreationTimestamp: Date.now(),\n\t\t\tcreatorUserId: game.user.id,\n\t\t\tsource: this._getSourceObject(),\n\t\t\ttarget: this._getTargetObject(),\n\t\t\tattachTo: this._attachTo,\n\t\t\tmoveTowards: this._moveTowards\n\t\t\t\t? {\n\t\t\t\t\tease: this._moveTowards.ease,\n\t\t\t\t\trotate: this._moveTowards.rotate,\n\t\t\t\t}\n\t\t\t\t: false,\n\t\t\toffset: this._offset,\n\t\t\trandomOffset: this._randomOffset,\n\t\t\tlocationOptions: this._locationOptions,\n\t\t\tloopOptions: this._loopOptions,\n\t\t\tvolume: this._volume,\n\t\t\tchannel: this._channel,\n\t\t\tglobal: this._global,\n\t\t\tfadeIn: this._fadeInAudio,\n\t\t\tfadeOut: this._fadeOutAudio,\n\t\t\ttime:\n\t\t\t\tthis._startTime || this._endTime\n\t\t\t\t\t? {\n\t\t\t\t\t\tstart: lib.is_real_number(this._startTime)\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tvalue: this._startTime,\n\t\t\t\t\t\t\t\tisPerc: this._startPerc,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: false,\n\t\t\t\t\t\tend: lib.is_real_number(this._endTime)\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tvalue: this._endTime,\n\t\t\t\t\t\t\t\tisPerc: this._endPerc,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: false,\n\t\t\t\t\t\tisRange: this._isRange,\n\t\t\t\t\t}\n\t\t\t\t\t: false,\n\t\t\tduration: this._duration,\n\t\t\tsceneId: this._source?.parent?.id || game.user.viewedScene,\n\t\t\tusers: this._users ? Array.from(this._users) : null,\n\t\t\tname: this._name,\n\t\t\torigin: this._origin,\n\t\t\tseed: `${this._name ?? \"sequencer-sound\"}-${foundry.utils.randomID()}-${this._currentRepetition}`,\n\t\t\tnameOffsetMap: this.sequence.nameOffsetMap,\n\t\t\tpersist: this._persist,\n\t\t\tpersistOptions: this._persistOptions,\n\t\t\tpanSound: this._panSound,\n\t\t\textraEndDuration: this._extraEndDuration,\n\t\t\tlevels: this._levels,\n\t\t\televation: this._elevation,\n\t\t};\n\n\t\tfor (let override of this._overrides) {\n\t\t\tdata = await override(this, data);\n\t\t}\n\n\t\treturn data;\n\t}\n\n\tasync _serialize() {\n\t\tconst data = await super._serialize();\n\t\tconst sectionData = await this._sanitizeSoundData();\n\t\treturn {\n\t\t\t...data,\n\t\t\ttype: \"sound\",\n\t\t\tsectionData,\n\t\t};\n\t}\n\n\tasync _deserialize(data) {\n\t\tthis._deserializedData = data.sectionData;\n\t\treturn super._deserialize(data);\n\t}\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\tstatic niceName = \"Animation\";\n\n\tconstructor(inSequence, inTarget) {\n\t\tsuper(inSequence);\n\t\tthis._teleportTo = false;\n\t\tthis._originObject = false;\n\t\tthis._moveSpeed = 23;\n\t\tthis._offset = { x: 0, y: 0 };\n\t\tthis._closestSquare = false;\n\t\tthis._snapToGrid = false;\n\t\tthis._hide = undefined;\n\t\tif (inTarget) this.on(inTarget);\n\t}\n\n\t/**\n\t * Sets the target object to be animated\n\t *\n\t * @param {object|string} inTarget\n\t * @returns {AnimationSection}\n\t */\n\ton(inTarget) {\n\t\tinTarget = this._validateLocation(inTarget);\n\t\tif (!inTarget)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"on\",\n\t\t\t\t\"could not find position of given object\"\n\t\t\t);\n\t\tthis._originObject = this._validateLocation(inTarget);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the location to teleport the target object to\n\t *\n\t * @param {object|string} inTarget\n\t * @param {object} options\n\t * @returns {AnimationSection}\n\t */\n\tteleportTo(inTarget, options = {}) {\n\t\toptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tdelay: 0,\n\t\t\t\trelativeToCenter: false,\n\t\t\t},\n\t\t\toptions\n\t\t);\n\t\tif (!lib.is_real_number(options.delay))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"teleportTo\",\n\t\t\t\t\"options.delay must be of type number\"\n\t\t\t);\n\t\tinTarget = this._validateLocation(inTarget);\n\t\tif (!inTarget)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"teleportTo\",\n\t\t\t\t\"could not find position of given object\"\n\t\t\t);\n\t\toptions.target = this._validateLocation(inTarget);\n\t\tthis._teleportTo = options;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Sets the location to rotate the object to\n\t *\n\t * @param {object|string} inLocation\n\t * @param {object} options\n\t * @returns this\n\t */\n\trotateTowards(inLocation, options = {}) {\n\t\toptions = foundry.utils.mergeObject(\n\t\t\t{\n\t\t\t\tduration: 0,\n\t\t\t\tease: \"linear\",\n\t\t\t\tdelay: 0,\n\t\t\t\trotationOffset: 0,\n\t\t\t\ttowardsCenter: true,\n\t\t\t\tcacheLocation: false,\n\t\t\t},\n\t\t\toptions\n\t\t);\n\t\tif (!lib.is_real_number(options.duration))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"options.duration must be of type number\"\n\t\t\t);\n\t\tif (typeof options.ease !== \"string\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"options.ease must be of type string\"\n\t\t\t);\n\t\tif (!lib.is_real_number(options.delay))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"options.delay must be of type number\"\n\t\t\t);\n\t\tif (!lib.is_real_number(options.rotationOffset))\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"options.rotationOffset must be of type number\"\n\t\t\t);\n\t\tif (typeof options.towardsCenter !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"options.towardsCenter must be of type boolean\"\n\t\t\t);\n\t\tif (typeof options.cacheLocation !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"options.cacheLocation must be of type boolean\"\n\t\t\t);\n\t\toptions.target = this._validateLocation(inLocation);\n\t\tif (!options.target)\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"rotateTowards\",\n\t\t\t\t\"could not find position of given object\"\n\t\t\t);\n\t\toptions.target = options.cacheLocation\n\t\t\t? canvaslib.get_object_position(options.target, { measure: true })\n\t\t\t: options.target;\n\t\tthis._rotateTowards = options;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the movement or teleportation to be offset in the X and/or Y axis\n\t *\n\t * @param {object} inOffset\n\t * @returns {AnimationSection}\n\t */\n\toffset(inOffset) {\n\t\tinOffset = foundry.utils.mergeObject({ x: 0, y: 0 }, inOffset);\n\t\tthis._offset = this._validateLocation(inOffset);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the movement or teleportation to pick the closest non-intersecting square, if the target is a token or tile\n\t *\n\t * @param {boolean} inBool\n\t * @returns {AnimationSection}\n\t */\n\tclosestSquare(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"closestSquare\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._closestSquare = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the final location to be snapped to the grid\n\t *\n\t * @param {boolean} inBool\n\t * @returns {AnimationSection}\n\t */\n\tsnapToGrid(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"snapToGrid\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._snapToGrid = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the object to become hidden\n\t *\n\t * @param {boolean} inBool\n\t * @returns {AnimationSection}\n\t */\n\thide(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"hide\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._hide = inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the object to become visible\n\t *\n\t * @param {boolean} inBool\n\t * @returns {AnimationSection}\n\t */\n\tshow(inBool = true) {\n\t\tif (typeof inBool !== \"boolean\")\n\t\t\tthrow this.sequence._customError(\n\t\t\t\tthis,\n\t\t\t\t\"show\",\n\t\t\t\t\"inBool must be of type boolean\"\n\t\t\t);\n\t\tthis._hide = !inBool;\n\t\treturn this;\n\t}\n\n\t/**\n\t * @private\n\t */\n\tasync run() {\n\t\treturn this._runAnimate();\n\t}\n\n\t/**\n\t * @private\n\t */\n\t_applyTraits() {\n\t\tObject.assign(this.constructor.prototype, traits.moves);\n\t\tObject.assign(this.constructor.prototype, traits.opacity);\n\t\tObject.assign(this.constructor.prototype, traits.rotation);\n\t\tObject.assign(this.constructor.prototype, traits.audio);\n\t\tObject.assign(this.constructor.prototype, traits.tint);\n\t}\n\n\t/**\n\t * @private\n\t */\n\tasync _updateObject(obj, updates, animate = false, animation = {}) {\n\t\tconst uuid = obj?.uuid ?? obj?.document?.uuid;\n\t\tawait sequencerSocket.executeAsGM(\n\t\t\tSOCKET_HANDLERS.UPDATE_DOCUMENT,\n\t\t\tuuid,\n\t\t\tupdates,\n\t\t\t{ animate, animation, teleport: !!this._teleportTo }\n\t\t);\n\t}\n\n\t/**\n\t * @private\n\t */\n\tasync _waitForTokenRefresh(obj) {\n\t\tlet token;\n\n\t\tif (obj instanceof foundry.canvas.placeables.Token) {\n\t\t\ttoken = obj;\n\t\t}\n\n\t\tif (obj instanceof TokenDocument) {\n\t\t\ttoken = obj.object;\n\t\t}\n\n\t\tif (token == null || token.mesh != null) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet refreshTokenID;\n\n\t\treturn await new Promise((resolve) => {\n\t\t\trefreshTokenID = Hooks.on(\"refreshToken\", async (tokenDoc) => {\n\t\t\t\tif (tokenDoc.document.actorId !== token.document.actorId || !token.mesh)\n\t\t\t\t\treturn;\n\t\t\t\tHooks.off(\"refreshToken\", refreshTokenID);\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * @private\n\t */\n\tasync preRun() {\n\t\tawait this._waitForTokenRefresh(this._originObject);\n\t}\n\n\t/**\n\t * @private\n\t */\n\t_getClosestSquare(origin, target) {\n\t\tlet originLoc = canvaslib.get_object_position(origin, { exact: true });\n\t\tlet targetLoc = canvaslib.get_object_position(target, { exact: true });\n\n\t\tlet originDimensions = canvaslib.get_object_dimensions(origin);\n\t\tlet targetDimensions = canvaslib.get_object_dimensions(target);\n\n\t\tlet originBottom = Math.max(\n\t\t\toriginDimensions.width - canvas.grid.size,\n\t\t\tcanvas.grid.size\n\t\t);\n\t\tlet originRight = Math.max(\n\t\t\toriginDimensions.height - canvas.grid.size,\n\t\t\tcanvas.grid.size\n\t\t);\n\n\t\tlet ray = new foundry.canvas.geometry.Ray(originLoc, targetLoc);\n\n\t\tlet dx = ray.dx;\n\t\tlet dy = ray.dy;\n\n\t\tif (dx > 0 && Math.abs(dx) > originRight) {\n\t\t\tdx -= originDimensions.width;\n\t\t} else if (dx < 0 && Math.abs(dx) > targetDimensions.width) {\n\t\t\tdx += targetDimensions.height;\n\t\t} else {\n\t\t\tdx = 0;\n\t\t}\n\n\t\tif (dy > 0 && Math.abs(dy) > originBottom) {\n\t\t\tdy -= originDimensions.height;\n\t\t} else if (dy < 0 && Math.abs(dy) > targetDimensions.height) {\n\t\t\tdy += targetDimensions.height;\n\t\t} else {\n\t\t\tdy = 0;\n\t\t}\n\n\t\tconst pos = {\n\t\t\tx: originLoc.x + dx,\n\t\t\ty: originLoc.y + dy,\n\t\t\televation: targetLoc?.elevation,\n\t\t};\n\n\t\tif (!pos.elevation) {\n\t\t\tdelete pos[\"elevation\"];\n\t\t}\n\n\t\treturn pos;\n\t}\n\n\t/**\n\t * This needs a rewrite, jeesus.\n\t */\n\tasync _runAnimate() {\n\t\tlet animData = {\n\t\t\tattributes: [],\n\t\t\tmaxFPS: 1000 / game.settings.get(\"core\", \"maxFPS\"),\n\t\t\tlastTimespan: performance.now(),\n\t\t\ttotalDt: 0,\n\t\t};\n\n\t\tif (typeof this._moveTowards?.target === \"string\" && this.sequence.nameOffsetMap[this._moveTowards?.target]) {\n\t\t\tthis._moveTowards.target = this.sequence.nameOffsetMap[this._moveTowards?.target].target ?? this.sequence.nameOffsetMap[this._moveTowards?.target].source;\n\t\t}\n\n\t\tif (typeof this._teleportTo?.target === \"string\" && this.sequence.nameOffsetMap[this._teleportTo?.target]) {\n\t\t\tthis._teleportTo.target = this.sequence.nameOffsetMap[this._teleportTo?.target].target ?? this.sequence.nameOffsetMap[this._teleportTo?.target].source;\n\t\t}\n\n\t\tif (typeof this._rotateTowards?.target === \"string\" && this.sequence.nameOffsetMap[this._rotateTowards?.target]) {\n\t\t\tthis._rotateTowards.target = this.sequence.nameOffsetMap[this._rotateTowards?.target].target ?? this.sequence.nameOffsetMap[this._rotateTowards?.target].source;\n\t\t}\n\n\t\tlet overallDuration = this._duration ? this._duration : 0;\n\t\tconst originLocation = canvaslib.get_object_position(this._originObject, {\n\t\t\texact: true,\n\t\t});\n\n\t\tif (this._rotateTowards) {\n\t\t\tlet offset =\n\t\t\t\t(this._angle ? this._angle : 0) + this._rotateTowards.rotationOffset;\n\n\t\t\tlet targetLoc =\n\t\t\t\tthis._moveTowards?.target ||\n\t\t\t\tthis._teleportTo?.target ||\n\t\t\t\tthis._originObject;\n\n\t\t\ttargetLoc = this._closestSquare\n\t\t\t\t? this._getClosestSquare(this._originObject, targetLoc)\n\t\t\t\t: canvaslib.get_object_position(targetLoc, { exact: true });\n\n\t\t\ttargetLoc.x += this._offset.x;\n\t\t\ttargetLoc.y += this._offset.y;\n\n\t\t\tif (this._snapToGrid) {\n\t\t\t\ttargetLoc = canvas.grid.getSnappedPoint(targetLoc, { mode: CONST.GRID_SNAPPING_MODES.CENTER, resolution: 1 })\n\t\t\t}\n\n\t\t\tif (this._originObject instanceof TokenDocument) {\n\t\t\t\tsetTimeout(async () => {\n\t\t\t\t\tlet startLocation = this._originObject.object?.center ?? targetLoc;\n\t\t\t\t\tlet targetLocation =\n\t\t\t\t\t\tthis._rotateTowards.target?.object ?? this._rotateTowards.target;\n\t\t\t\t\tif (this._rotateTowards.towardsCenter) {\n\t\t\t\t\t\ttargetLocation = targetLocation?.center ?? targetLocation;\n\t\t\t\t\t}\n\t\t\t\t\tlet ray = new foundry.canvas.geometry.Ray(startLocation, targetLocation);\n\t\t\t\t\tlet angle = Math.normalizeDegrees((ray.angle * 180) / Math.PI - 90);\n\t\t\t\t\tangle += offset;\n\t\t\t\t\tawait this._updateObject(\n\t\t\t\t\t\tthis._originObject,\n\t\t\t\t\t\t{ rotation: angle },\n\t\t\t\t\t\tthis._rotateTowards.duration > 0,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tduration: this._rotateTowards.duration\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}, this._rotateTowards.delay ?? 0);\n\t\t\t} else {\n\t\t\t\tanimData.attributes.push({\n\t\t\t\t\tname: \"rotationTowards\",\n\t\t\t\t\toffset: offset,\n\t\t\t\t\torigin: this._originObject,\n\t\t\t\t\toriginLocation: targetLoc,\n\t\t\t\t\ttarget:\n\t\t\t\t\t\tthis._rotateTowards.target?.object ?? this._rotateTowards.target,\n\t\t\t\t\ttowardsCenter: this._rotateTowards.towardsCenter,\n\t\t\t\t\tfrom: false,\n\t\t\t\t\tto: false,\n\t\t\t\t\tprogress: 0,\n\t\t\t\t\tdone: false,\n\t\t\t\t\tduration: this._rotateTowards.duration,\n\t\t\t\t\tdurationDone: 0,\n\t\t\t\t\tdelay: this._rotateTowards.delay,\n\t\t\t\t\tease: this._rotateTowards.ease,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet rotateDuration =\n\t\t\t\tthis._rotateTowards.duration + this._rotateTowards.delay;\n\n\t\t\toverallDuration =\n\t\t\t\toverallDuration > rotateDuration ? overallDuration : rotateDuration;\n\t\t}\n\n\t\tif (this._fadeIn) {\n\t\t\tlet to = lib.is_real_number(this._opacity) ? this._opacity : 1.0;\n\n\t\t\tif (this._originObject instanceof TokenDocument) {\n\t\t\t\tsetTimeout(async () => {\n\t\t\t\t\tawait this._updateObject(this._originObject, { alpha: to }, true, {\n\t\t\t\t\t\tduration: this._fadeIn.duration,\n\t\t\t\t\t\teasing: this._fadeIn.ease,\n\t\t\t\t\t});\n\t\t\t\t}, this._fadeIn.delay ?? 0);\n\t\t\t} else {\n\t\t\t\tanimData.attributes.push({\n\t\t\t\t\tname: \"alpha\",\n\t\t\t\t\tfrom: 0.0,\n\t\t\t\t\tto: to,\n\t\t\t\t\tprogress: 0,\n\t\t\t\t\tdone: false,\n\t\t\t\t\tduration: this._fadeIn.duration,\n\t\t\t\t\tdurationDone: 0,\n\t\t\t\t\tdelay: this._fadeIn.delay,\n\t\t\t\t\tease: this._fadeIn.ease,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet fadeDuration = this._fadeIn.duration + this._fadeIn.delay;\n\n\t\t\toverallDuration =\n\t\t\t\toverallDuration > fadeDuration ? overallDuration : fadeDuration;\n\t\t}\n\n\t\tif (this._fadeInAudio && this._originObject?.video?.volume !== undefined) {\n\t\t\tlet to = lib.is_real_number(this._volume) ? this._volume : 1.0;\n\n\t\t\tanimData.attributes.push({\n\t\t\t\tname: \"video.volume\",\n\t\t\t\tfrom: 0.0,\n\t\t\t\tto: to,\n\t\t\t\tprogress: 0,\n\t\t\t\tdone: false,\n\t\t\t\tduration: this._fadeInAudio.duration,\n\t\t\t\tdurationDone: 0,\n\t\t\t\tdelay: this._fadeInAudio.delay,\n\t\t\t\tease: this._fadeInAudio.ease,\n\t\t\t});\n\n\t\t\tlet fadeDuration = this._fadeInAudio.duration + this._fadeInAudio.delay;\n\n\t\t\toverallDuration =\n\t\t\t\toverallDuration > fadeDuration ? overallDuration : fadeDuration;\n\t\t}\n\n\t\tif (this._rotateIn) {\n\t\t\tlet from = this._angle ? this._angle : this._originObject.rotation;\n\t\t\tlet to = this._rotateIn.value;\n\n\t\t\tif (Math.abs(from - to) > 180) {\n\t\t\t\tif (to < 0) {\n\t\t\t\t\tto += 360;\n\t\t\t\t} else if (from > to) {\n\t\t\t\t\tfrom -= 360;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this._originObject instanceof TokenDocument) {\n\t\t\t\tsetTimeout(async () => {\n\t\t\t\t\tif (this._originObject.rotation !== from) {\n\t\t\t\t\t\tawait this._updateObject(\n\t\t\t\t\t\t\tthis._originObject,\n\t\t\t\t\t\t\t{ rotation: from },\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tawait this._updateObject(this._originObject, { rotation: to }, true, {\n\t\t\t\t\t\tduration: this._rotateIn.duration,\n\t\t\t\t\t});\n\t\t\t\t}, this._rotateIn.delay ?? 0);\n\t\t\t} else {\n\t\t\t\tanimData.attributes.push({\n\t\t\t\t\tname: \"rotation\",\n\t\t\t\t\tfrom: from,\n\t\t\t\t\tto: to,\n\t\t\t\t\tprogress: 0,\n\t\t\t\t\tdone: false,\n\t\t\t\t\tduration: this._rotateIn.duration,\n\t\t\t\t\tdurationDone: 0,\n\t\t\t\t\tdelay: this._rotateIn.delay,\n\t\t\t\t\tease: this._rotateIn.ease,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet rotateDuration = this._rotateIn.duration + this._rotateIn.delay;\n\n\t\t\toverallDuration =\n\t\t\t\toverallDuration > rotateDuration ? overallDuration : rotateDuration;\n\t\t}\n\n\t\tif (this._moveTowards) {\n\t\t\tlet originLocation = canvaslib.get_object_position(this._originObject, {\n\t\t\t\texact: true,\n\t\t\t});\n\t\t\tlet targetLocation = this._closestSquare\n\t\t\t\t? this._getClosestSquare(this._originObject, this._moveTowards.target)\n\t\t\t\t: canvaslib.get_object_position(this._moveTowards.target, {\n\t\t\t\t\texact: true,\n\t\t\t\t});\n\n\t\t\ttargetLocation.x += this._offset.x;\n\t\t\ttargetLocation.y += this._offset.y;\n\t\t\ttargetLocation.elevation =\n\t\t\t\ttargetLocation?.elevation ?? this._originObject?.elevation;\n\n\t\t\tif (this._moveTowards.relativeToCenter) {\n\t\t\t\tconst dimensions = canvaslib.get_object_dimensions(this._originObject);\n\t\t\t\ttargetLocation.x -= dimensions.width / 2;\n\t\t\t\ttargetLocation.y -= dimensions.height / 2;\n\t\t\t\tif (this._snapToGrid) {\n\t\t\t\t\ttargetLocation.x -= 0.01;\n\t\t\t\t\ttargetLocation.y -= 0.01;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this._snapToGrid) {\n\t\t\t\ttargetLocation = canvas.grid.getSnappedPoint(targetLocation, {\n\t\t\t\t\tmode: CONST.GRID_SNAPPING_MODES.VERTEX,\n\t\t\t\t\tresolution: 1\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tlet originalDx = targetLocation.x - originLocation.x;\n\t\t\tlet originalDy = targetLocation.y - originLocation.y;\n\t\t\tlet originalDistance = Math.sqrt(\n\t\t\t\toriginalDx * originalDx + originalDy * originalDy\n\t\t\t);\n\n\t\t\tlet duration = this._duration\n\t\t\t\t? this._duration\n\t\t\t\t: (originalDistance / this._moveSpeed) * animData.maxFPS;\n\n\t\t\tlet moveDuration = duration + this._moveTowards.delay;\n\n\t\t\toverallDuration =\n\t\t\t\toverallDuration > moveDuration ? overallDuration : moveDuration;\n\n\t\t\tif (this._originObject instanceof TokenDocument) {\n\t\t\t\tsetTimeout(async () => {\n\t\t\t\t\tawait this._updateObject(this._originObject, targetLocation, true, {\n\t\t\t\t\t\tmovementSpeed: this._moveSpeed,\n\t\t\t\t\t\tduration\n\t\t\t\t\t});\n\t\t\t\t}, this._moveTowards.delay ?? 0);\n\t\t\t} else {\n\t\t\t\tif (!(duration === 0 || originalDistance === 0)) {\n\t\t\t\t\tanimData.attributes.push({\n\t\t\t\t\t\tname: \"position\",\n\t\t\t\t\t\torigin: originLocation,\n\t\t\t\t\t\ttarget: targetLocation,\n\t\t\t\t\t\toriginalDistance: originalDistance,\n\t\t\t\t\t\tcurrentDistance: 0,\n\t\t\t\t\t\tprogress: 0,\n\t\t\t\t\t\tspeed: 0,\n\t\t\t\t\t\tduration: duration,\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tease: this._moveTowards.ease,\n\t\t\t\t\t\tdelay: this._moveTowards.delay,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this._fadeOut) {\n\t\t\tlet from = lib.is_real_number(this._opacity)\n\t\t\t\t? this._opacity\n\t\t\t\t: this._originObject.alpha ?? 1.0;\n\n\t\t\tif (this._originObject instanceof TokenDocument) {\n\t\t\t\tsetTimeout(async () => {\n\t\t\t\t\tawait this._updateObject(this._originObject, { alpha: 0 }, true, {\n\t\t\t\t\t\tduration: this._fadeOut.duration\n\t\t\t\t\t});\n\t\t\t\t}, this._fadeOut.delay ?? 0);\n\t\t\t} else {\n\t\t\t\tanimData.attributes.push({\n\t\t\t\t\tname: \"alpha\",\n\t\t\t\t\tfrom: from,\n\t\t\t\t\tto: 0.0,\n\t\t\t\t\tprogress: 0,\n\t\t\t\t\tdone: false,\n\t\t\t\t\tduration: this._fadeOut.duration,\n\t\t\t\t\tdurationDone: 0,\n\t\t\t\t\tdelay: overallDuration - this._fadeOut.duration,\n\t\t\t\t\tease: this._fadeOut.ease,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet fadeOutDuration = this._fadeOut.duration + this._fadeOut.delay;\n\n\t\t\toverallDuration =\n\t\t\t\toverallDuration > fadeOutDuration ? overallDuration : fadeOutDuration;\n\t\t}\n\n\t\tif (this._fadeOutAudio && this._originObject?.video?.volume !== undefined) {\n\t\t\tlet from = lib.is_real_number(this._volume)\n\t\t\t\t? this._volume\n\t\t\t\t: this._originObject.video.volume;\n\n\t\t\tanimData.attributes.push({\n\t\t\t\tname: \"video.volume\",\n\t\t\t\tfrom: from,\n\t\t\t\tto: 0.0,\n\t\t\t\tprogress: 0,\n\t\t\t\tdone: false,\n\t\t\t\tduration: this._fadeOutAudio.duration,\n\t\t\t\tdurationDone: 0,\n\t\t\t\tdelay: overallDuration - this._fadeOutAudio.duration,\n\t\t\t\tease: this._fadeOutAudio.ease,\n\t\t\t});\n\n\t\t\tlet fadeOutAudioDuration =\n\t\t\t\tthis._fadeOutAudio.duration + this._fadeOutAudio.delay;\n\n\t\t\toverallDuration =\n\t\t\t\toverallDuration > fadeOutAudioDuration\n\t\t\t\t\t? overallDuration\n\t\t\t\t\t: fadeOutAudioDuration;\n\t\t}\n\n\t\tif (this._rotateOut) {\n\t\t\tlet from = this._rotateOut.value;\n\t\t\tlet to = this._angle ? this._angle : this._originObject.rotation;\n\n\t\t\tif (this._rotateIn) from += this._rotateIn.value;\n\n\t\t\tif (Math.abs(from - to) > 180) {\n\t\t\t\tif (to < 0) {\n\t\t\t\t\tto += 360;\n\t\t\t\t} else if (from > to) {\n\t\t\t\t\tfrom -= 360;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this._originObject instanceof TokenDocument) {\n\t\t\t\tsetTimeout(async () => {\n\t\t\t\t\tif (this._originObject.rotation !== from) {\n\t\t\t\t\t\tawait this._updateObject(\n\t\t\t\t\t\t\tthis._originObject,\n\t\t\t\t\t\t\t{ rotation: from },\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tawait this._updateObject(this._originObject, { rotation: to }, true, {\n\t\t\t\t\t\tduration: this._rotateOut.duration\n\t\t\t\t\t});\n\t\t\t\t}, this._rotateOut.delay ?? 0);\n\t\t\t} else {\n\t\t\t\tanimData.attributes.push({\n\t\t\t\t\tname: \"rotation\",\n\t\t\t\t\tfrom: from,\n\t\t\t\t\tto: to,\n\t\t\t\t\tprogress: 0,\n\t\t\t\t\tdone: false,\n\t\t\t\t\tduration: this._rotateOut.duration,\n\t\t\t\t\tdurationDone: 0,\n\t\t\t\t\tdelay: overallDuration - this._rotateOut.duration,\n\t\t\t\t\tease: this._rotateOut.ease,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet rotateOutDuration = this._rotateOut.duration + this._rotateOut.delay;\n\n\t\t\toverallDuration =\n\t\t\t\toverallDuration > rotateOutDuration\n\t\t\t\t\t? overallDuration\n\t\t\t\t\t: rotateOutDuration;\n\t\t}\n\n\t\tif (this._teleportTo) {\n\t\t\tsetTimeout(async () => {\n\t\t\t\tlet targetLocation = this._closestSquare\n\t\t\t\t\t? this._getClosestSquare(this._originObject, this._teleportTo.target)\n\t\t\t\t\t: canvaslib.get_object_position(this._teleportTo.target, {\n\t\t\t\t\t\texact: true,\n\t\t\t\t\t});\n\t\t\t\tif (targetLocation.x === undefined) targetLocation.x = originLocation.x;\n\t\t\t\tif (targetLocation.y === undefined) targetLocation.y = originLocation.y;\n\t\t\t\tif (targetLocation.elevation === undefined)\n\t\t\t\t\ttargetLocation.elevation = originLocation.elevation;\n\t\t\t\ttargetLocation.x += this._offset.x;\n\t\t\t\ttargetLocation.y += this._offset.y;\n\t\t\t\ttargetLocation.elevation =\n\t\t\t\t\ttargetLocation?.elevation ?? this._originObject?.elevation;\n\t\t\t\tconst dimensions = canvaslib.get_object_dimensions(this._originObject);\n\t\t\t\tif (this._teleportTo.relativeToCenter) {\n\t\t\t\t\ttargetLocation.x -= dimensions.width / 2;\n\t\t\t\t\ttargetLocation.y -= dimensions.height / 2;\n\t\t\t\t\tif (this._snapToGrid) {\n\t\t\t\t\t\ttargetLocation.x -= 0.01;\n\t\t\t\t\t\ttargetLocation.y -= 0.01;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (this._snapToGrid) {\n\t\t\t\t\ttargetLocation.x -= dimensions.width / 2;\n\t\t\t\t\ttargetLocation.y -= dimensions.height / 2;\n\t\t\t\t\ttargetLocation = canvas.grid.getSnappedPoint(targetLocation, {\n\t\t\t\t\t\tmode: CONST.GRID_SNAPPING_MODES.VERTEX,\n\t\t\t\t\t\tresolution: 1\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tawait this._updateObject(this._originObject, targetLocation, false);\n\t\t\t}, this._teleportTo.delay);\n\t\t\tif (overallDuration <= this._teleportTo.delay) {\n\t\t\t\tthis._waitUntilFinished = true;\n\t\t\t}\n\t\t\toverallDuration =\n\t\t\t\toverallDuration > this._teleportTo.delay\n\t\t\t\t\t? overallDuration\n\t\t\t\t\t: this._teleportTo.delay;\n\t\t}\n\n\t\tlet updateAttributes = {};\n\t\tif (\n\t\t\tlib.is_real_number(this._angle) &&\n\t\t\t!this._rotateIn &&\n\t\t\t!this._rotateOut\n\t\t) {\n\t\t\tupdateAttributes[\"rotation\"] = this._angle;\n\t\t}\n\n\t\tif (lib.is_real_number(this._opacity) && !this._fadeIn && !this._fadeOut) {\n\t\t\tupdateAttributes[\"alpha\"] = this._opacity;\n\t\t}\n\n\t\tif (\n\t\t\tlib.is_real_number(this._volume) &&\n\t\t\t!this._fadeInAudio &&\n\t\t\t!this._fadeOutAudio &&\n\t\t\tthis._originObject?.video?.volume !== undefined\n\t\t) {\n\t\t\tupdateAttributes[\"video.volume\"] = this._volume;\n\t\t}\n\n\t\tif (this._tint) {\n\t\t\tupdateAttributes[\"texture.tint\"] = this._tint.hexadecimal;\n\t\t}\n\n\t\tif (this._hide !== undefined) {\n\t\t\tupdateAttributes[\"hidden\"] = this._hide;\n\t\t}\n\n\t\tif (Object.keys(updateAttributes).length) {\n\t\t\tawait lib.wait(1);\n\t\t\tawait this._updateObject(this._originObject, updateAttributes);\n\t\t\tawait lib.wait(1);\n\t\t}\n\n\treturn new Promise((resolve) => {\n\t\tlet resolved = false;\n\t\tconst safeResolve = () => {\n\t\t\tif (resolved) return;\n\t\t\tresolved = true;\n\t\t\tresolve();\n\t\t};\n\t\tthis._animate(animData, safeResolve);\n\t\tsetTimeout(\n\t\t\tsafeResolve,\n\t\t\tMath.max(0, overallDuration + this._currentWaitTime + animData.maxFPS)\n\t\t);\n\t});\n\t}\n\n\t/**\n\t * @private\n\t */\n\tasync _animate(animData, resolve, timespan) {\n\t\t// If it's not the first tick\n\t\tif (timespan) {\n\t\t\tlet animatedAttributes = {};\n\n\t\t\tlet dt = timespan - animData.lastTimespan;\n\n\t\t\t// Limit to set FPS\n\t\t\tif (dt >= animData.maxFPS) {\n\t\t\t\tanimData.totalDt += dt;\n\n\t\t\t\tfor (let attribute of animData.attributes) {\n\t\t\t\t\tif (attribute.done) continue;\n\n\t\t\t\t\tif (animData.totalDt < attribute.delay) continue;\n\n\t\t\t\t\tif (attribute.name === \"position\") {\n\t\t\t\t\t\tattribute.speed =\n\t\t\t\t\t\t\tattribute.originalDistance / (attribute.duration / dt);\n\n\t\t\t\t\t\tattribute.currentDistance += attribute.speed;\n\n\t\t\t\t\t\tattribute.progress =\n\t\t\t\t\t\t\tattribute.currentDistance / attribute.originalDistance;\n\n\t\t\t\t\t\tlet x = lib.interpolate(\n\t\t\t\t\t\t\tattribute.origin.x,\n\t\t\t\t\t\t\tattribute.target.x,\n\t\t\t\t\t\t\tattribute.progress,\n\t\t\t\t\t\t\tattribute.ease\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlet y = lib.interpolate(\n\t\t\t\t\t\t\tattribute.origin.y,\n\t\t\t\t\t\t\tattribute.target.y,\n\t\t\t\t\t\t\tattribute.progress,\n\t\t\t\t\t\t\tattribute.ease\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (attribute.currentDistance >= attribute.originalDistance) {\n\t\t\t\t\t\t\tx = attribute.target.x;\n\t\t\t\t\t\t\ty = attribute.target.y;\n\t\t\t\t\t\t\tattribute.done = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tanimatedAttributes[\"x\"] = x;\n\t\t\t\t\t\tanimatedAttributes[\"y\"] = y;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tattribute.name === \"rotationTowards\" &&\n\t\t\t\t\t\t\t!attribute.from &&\n\t\t\t\t\t\t\t!attribute.to\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tlet target = attribute.target;\n\t\t\t\t\t\t\tif (this._rotateTowards.towardsCenter)\n\t\t\t\t\t\t\t\ttarget = target?.center ?? target;\n\t\t\t\t\t\t\tlet ray = new foundry.canvas.geometry.Ray(attribute.originLocation, target);\n\t\t\t\t\t\t\tlet angle = (ray.angle * 180) / Math.PI - 90;\n\t\t\t\t\t\t\tangle += attribute.offset;\n\t\t\t\t\t\t\tattribute.from = attribute.origin.rotation;\n\t\t\t\t\t\t\tattribute.to = angle;\n\t\t\t\t\t\t\tif (Math.abs(attribute.from - attribute.to) > 180) {\n\t\t\t\t\t\t\t\tif (attribute.to < 0) {\n\t\t\t\t\t\t\t\t\tattribute.to += 360;\n\t\t\t\t\t\t\t\t} else if (attribute.from > attribute.to) {\n\t\t\t\t\t\t\t\t\tattribute.from -= 360;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tattribute.name = \"rotation\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tattribute.durationDone += dt;\n\n\t\t\t\t\t\tattribute.progress = attribute.durationDone / attribute.duration;\n\n\t\t\t\t\t\tlet val = lib.interpolate(\n\t\t\t\t\t\t\tattribute.from,\n\t\t\t\t\t\t\tattribute.to,\n\t\t\t\t\t\t\tattribute.progress,\n\t\t\t\t\t\t\tattribute.ease\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (attribute.progress >= 1.0) {\n\t\t\t\t\t\t\tval = attribute.to;\n\t\t\t\t\t\t\tattribute.done = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tanimatedAttributes[attribute.name] = val;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tif (Object.keys(animatedAttributes).length > 0) {\n\t\t\t\tawait this._updateObject(this._originObject, animatedAttributes);\n\t\t\t}\n\n\t\t\tanimData.attributes = animData.attributes.filter((a) => !a.done);\n\n\t\t\tif (animData.attributes.length === 0) {\n\t\t\t\tresolve();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tanimData.lastTimespan = timespan;\n\t\t\t}\n\t\t}\n\n\t\tlet self = this;\n\t\trequestAnimationFrame(function (timespan) {\n\t\t\tself._animate(animData, resolve, timespan);\n\t\t});\n\t}\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\";\nimport CrosshairsPlaceable from \"../modules/sequencer-crosshair/CrosshairsPlaceable.js\";\nimport CrosshairsDocument from \"../modules/sequencer-crosshair/CrosshairsDocument.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(foundry.utils.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] === undefined) ||\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\tasync preRun() {\n\t\tconst oldSource = this._source;\n\t\tconst crosshairSource = this.sequence?.crosshairs?.[this._source];\n\t\tif (typeof this._source === \"string\" && crosshairSource) {\n\t\t\tthis._source = crosshairSource.uuid;\n\t\t}\n\t\tif (this._name && oldSource !== this._source) {\n\t\t\tthis.sequence.nameOffsetMap[this._name].source = this._getSourceObject();\n\t\t}\n\t}\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.local && !this.sequence.remote;\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\t  if(this._source instanceof CrosshairsPlaceable || this._source instanceof CrosshairsDocument){\n\t\t  const doc = this._source?.document ?? this._source;\n\t\t  return doc.getOrientation().source;\n\t  }\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\t    nameOffsetMap: this.sequence.nameOffsetMap,\n\t    local: this.sequence.local,\n\t    remote: this.sequence.remote,\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\";\nimport CrosshairsPlaceable from \"../modules/sequencer-crosshair/CrosshairsPlaceable.js\";\nimport CrosshairsDocument from \"../modules/sequencer-crosshair/CrosshairsDocument.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._shake = null;\n    this._seed = lib.get_hash(foundry.utils.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  /**\n   * Shakes the canvas\n   *\n   * @param {number} duration\n   * @param {number} strength\n   * @param {number} frequency\n   * @param {number} fadeInDuration\n   * @param {number} fadeOutDuration\n   * @param {boolean} rotation\n   * @returns this\n   */\n  shake({\n    duration = 250,\n    strength = 20,\n    frequency = 10,\n    fadeInDuration = 0,\n    fadeOutDuration = 200,\n    rotation = true,\n  } = {}) {\n    if (!is_real_number(duration)) {\n      throw this.sequence._customError(\n        this,\n        \"shake\",\n        \"duration must be of type number\"\n      );\n    }\n    if (!is_real_number(strength)) {\n      throw this.sequence._customError(\n        this,\n        \"shake\",\n        \"strength must be of type number\"\n      );\n    }\n    if (!is_real_number(strength)) {\n      throw this.sequence._customError(\n        this,\n        \"shake\",\n        \"frequency must be of type number\"\n      );\n    }\n    if (!is_real_number(fadeInDuration)) {\n      throw this.sequence._customError(\n        this,\n        \"shake\",\n        \"fadeInDuration must be of type number\"\n      );\n    }\n    if (!is_real_number(fadeOutDuration)) {\n      throw this.sequence._customError(\n        this,\n        \"shake\",\n        \"fadeOutDuration must be of type number\"\n      );\n    }\n    if (typeof rotation !== \"boolean\") {\n      throw this.sequence._customError(\n        this,\n        \"shake\",\n        \"rotation must be of type boolean\"\n      );\n    }\n    this._shake = {\n      duration,\n      strength,\n      frequency,\n      fadeInDuration,\n      fadeOutDuration,\n      rotation,\n    };\n    return this;\n  }\n\n\tasync preRun() {\n\t\tconst oldSource = this._source;\n\t\tconst crosshairSource = this.sequence?.crosshairs?.[this._source];\n\t\tif (typeof this._source === \"string\" && crosshairSource) {\n\t\t\tthis._source = crosshairSource.uuid;\n\t\t}\n\t\tif (this._name && oldSource !== this._source) {\n\t\t\tthis.sequence.nameOffsetMap[this._name].source = this._getSourceObject();\n\t\t}\n\t}\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.local && !this.sequence.remote;\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\t  if(this._source instanceof CrosshairsPlaceable || this._source instanceof CrosshairsDocument){\n\t\t  const doc = this._source?.document ?? this._source;\n\t\t  return doc.getOrientation().source;\n\t  }\n    return (\n      lib.get_object_identifier(this._source) ??\n      canvaslib.get_object_canvas_data(this._source, { uuid: false })\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      shake: this._shake,\n\t    nameOffsetMap: this.sequence.nameOffsetMap,\n\t    local: this.sequence.local,\n\t    remote: this.sequence.remote,\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<void>}\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\";\r\nimport Section from \"./section.js\";\r\nimport CrosshairsDocument from \"../modules/sequencer-crosshair/CrosshairsDocument.js\";\r\nimport traits from \"./traits/_traits.js\";\r\nimport CONSTANTS from \"../constants.js\";\r\n\r\nexport default class CrosshairSection extends Section {\r\n\tconstructor(inSequence, inName = \"\") {\r\n\t\tsuper(inSequence);\r\n\t\tthis._name = inName;\r\n\t\tthis._type = CONST.MEASURED_TEMPLATE_TYPES.CIRCLE;\r\n\t\tthis._distance = canvas.grid.distance/2;\r\n\t\tthis._angle = 53.13;\r\n\t\tthis._width = canvas.grid.distance;\r\n\t\tthis._direction = 0;\r\n\t\tthis._borderColor = null;\r\n\t\tthis._fillColor = null;\r\n\t\tthis._persist = false;\r\n\t\tthis._config = CrosshairsDocument.defaultConfig;\r\n\t\tthis._waitUntilFinished = true;\r\n\t\tthis._callbacks = {};\r\n\t}\r\n\r\n\tstatic niceName = \"Crosshair\";\r\n\r\n\t/**\r\n\t * Sets the type of MeasurableTemplate to create, see CONST.MEASURED_TEMPLATE_TYPES\r\n\t */\r\n\ttype(inType = \"\") {\r\n\t\tif (typeof inType !== \"string\"){\r\n\t\t\tthrow this.sequence._customError(this, \"type\", \"inType must be of type string\");\r\n\t\t}\r\n\t\tif (!Object.values(CONST.MEASURED_TEMPLATE_TYPES).includes(inType)){\r\n\t\t\tthrow this.sequence._customError(this, \"type\", `inType must be one of valid types: ${Object.values(CONST.MEASURED_TEMPLATE_TYPES).join(\" \")} (see CONST.MEASURED_TEMPLATE_TYPES)`,);\r\n\t\t}\r\n\t\tthis._type = inType;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets a custom label to be set as a part of this crosshair\r\n\t */\r\n\tlabel(inText, inOptions = {}) {\r\n\t\tif (typeof inOptions !== \"object\"){\r\n\t\t\tthrow this.sequence._customError(this, \"label\", \"inOptions must be of type object\");\r\n\t\t}\r\n\t\tinOptions = foundry.utils.mergeObject({\r\n\t\t\tdx: CrosshairsDocument.defaultConfig.label.dx, dy: CrosshairsDocument.defaultConfig.label.dy\r\n\t\t}, inOptions,);\r\n\t\tif (typeof inText !== \"string\"){\r\n\t\t\tthrow this.sequence._customError(this, \"label\", \"inText must be of type string\");\r\n\t\t}\r\n\t\tif (!lib.is_real_number(inOptions.dx)){\r\n\t\t\tthrow this.sequence._customError(this, \"label\", \"inOptions.dx must be of type number\");\r\n\t\t}\r\n\t\tif (!lib.is_real_number(inOptions.dy)){\r\n\t\t\tthrow this.sequence._customError(this, \"label\", \"inOptions.dy must be of type number\");\r\n\t\t}\r\n\t\tthis._config[\"label\"][\"text\"] = inText;\r\n\t\tthis._config[\"label\"][\"dx\"] = inOptions.dx;\r\n\t\tthis._config[\"label\"][\"dy\"] = inOptions.dy;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets how the position of the crosshair should snap on the grid\r\n\t */\r\n\tsnapPosition(inSnap) {\r\n\t\tif (!lib.is_real_number(inSnap)){\r\n\t\t\tthrow this.sequence._customError(this, \"snapPosition\", \"inSnap must be of type number, see CONST.GRID_SNAPPING_MODES\");\r\n\t\t}\r\n\t\tthis._config[\"snap\"][\"position\"] = inSnap;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the distance for the crosshair - or radius for a circular crosshair\r\n\t */\r\n\tdistance(inDistance, inOptions = {}) {\r\n\t\tif (typeof inOptions !== \"object\"){\r\n\t\t\tthrow this.sequence._customError(this, \"distance\", \"inOptions must be of type object\");\r\n\t\t}\r\n\t\tinOptions = foundry.utils.mergeObject({\r\n\t\t\tmin: CrosshairsDocument.defaultConfig.distanceMin, max: CrosshairsDocument.defaultConfig.distanceMax\r\n\t\t}, inOptions,);\r\n\t\tif (!lib.is_real_number(inDistance)){\r\n\t\t\tthrow this.sequence._customError(this, \"distance\", \"inDistance must be of type number\");\r\n\t\t}\r\n\t\tif (inOptions.min !== null) {\r\n\t\t\tif (!lib.is_real_number(inOptions.min)){\r\n\t\t\t\tthrow this.sequence._customError(this, \"distance\", \"inOptions.min must be of type number\");\r\n\t\t\t}\r\n\t\t\tif (inOptions.min <= 0){\r\n\t\t\t\tthrow this.sequence._customError(this, \"distance\", \"inOptions.min must be a non-zero number\");\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tinOptions.min = inDistance;\r\n\t\t}\r\n\t\tif (inOptions.max !== null) {\r\n\t\t\tif (!lib.is_real_number(inOptions.max)){\r\n\t\t\t\tthrow this.sequence._customError(this, \"distance\", \"inOptions.max must be of type number\");\r\n\t\t\t}\r\n\t\t\tif (inOptions.max <= 0){\r\n\t\t\t\tthrow this.sequence._customError(this, \"distance\", \"inOptions.max must be a non-zero number\");\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tinOptions.max = inDistance;\r\n\t\t}\r\n\r\n\t\tif (inOptions.min > inOptions.max){\r\n\t\t\tthrow this.sequence._customError(this, \"distance\", \"inOptions.min cannot be larger than inOptions.max\");\r\n\t\t}\r\n\r\n\t\tthis._distance = inDistance;\r\n\t\tthis._config[\"distanceMin\"] = inOptions.min;\r\n\t\tthis._config[\"distanceMax\"] = inOptions.max;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Configures the angle of the crosshair - mostly used for the width of cone crosshairs\r\n\t */\r\n\tangle(inAngle) {\r\n\t\tif (!lib.is_real_number(inAngle)){\r\n\t\t\tthrow this.sequence._customError(this, \"angle\", \"inAngle must be of type number\");\r\n\t\t}\r\n\t\tthis._angle = inAngle;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Configures the width for the crosshair - used for ray crosshairs\r\n\t */\r\n\twidth(inWidth) {\r\n\t\tif (!lib.is_real_number(inWidth)){\r\n\t\t\tthrow this.sequence._customError(this, \"width\", \"inWidth must be of type number\");\r\n\t\t}\r\n\t\tthis._width = inWidth;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Configures the width for the crosshair - used for ray crosshairs\r\n\t */\r\n\tdirection(inDirection) {\r\n\t\tif (!lib.is_real_number(inDirection)){\r\n\t\t\tthrow this.sequence._customError(this, \"direction\", \"inDirection must be of type number\");\r\n\t\t}\r\n\t\tthis._direction = inDirection;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Configures the  increments the direction should snap along\r\n\t */\r\n\tsnapDirection(inSnapDirection) {\r\n\t\tif (!lib.is_real_number(inSnapDirection)){\r\n\t\t\tthrow this.sequence._customError(this, \"snapDirection\", \"inDirectionSnap must be of type number\");\r\n\t\t}\r\n\t\tthis._config[\"snap\"][\"direction\"] = inSnapDirection;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Toggles whether the crosshair can be manually rotated\r\n\t */\r\n\tlockManualRotation(inBool = true) {\r\n\t\tif (typeof inBool !== \"boolean\"){\r\n\t\t\tthrow this.sequence._customError(this, \"preventUserRotation\", \"inBool must be of type number\");\r\n\t\t}\r\n\t\tthis._config[\"lockManualRotation\"] = inBool;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Toggles whether the crosshair's end position can be dragged\r\n\t * @param inBool\r\n\t */\r\n\tlockDrag(inBool = true) {\r\n\t\tif (typeof inBool !== \"boolean\"){\r\n\t\t\tthrow this.sequence._customError(this, \"lockDrag\", \"inBool must be of type number\");\r\n\t\t}\r\n\t\tthis._config[\"lockDrag\"] = inBool;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Configures the custom icon to be used on the crosshair\r\n\t */\r\n\ticon(inTexture, inOptions = {}) {\r\n\t\tif (typeof inOptions !== \"object\"){\r\n\t\t\tthrow this.sequence._customError(this, \"icon\", \"inOptions must be of type object\");\r\n\t\t}\r\n\t\tinOptions = foundry.utils.mergeObject({ borderVisible: CrosshairsDocument.defaultConfig.icon.borderVisible }, inOptions,);\r\n\t\tif (typeof inTexture !== \"string\"){\r\n\t\t\tthrow this.sequence._customError(this, \"icon\", \"inTexture must be of type string\");\r\n\t\t}\r\n\t\tif (typeof inOptions.borderVisible !== \"boolean\"){\r\n\t\t\tthrow this.sequence._customError(this, \"icon\", \"inOptions.borderVisible must be of type boolean\");\r\n\t\t}\r\n\t\tthis._config[\"icon\"][\"texture\"] = inTexture;\r\n\t\tthis._config[\"icon\"][\"borderVisible\"] = inOptions.borderVisible;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the border color of the crosshair\r\n\t */\r\n\tborderColor(inColor, inOptions = {}) {\r\n\t\tif (typeof inOptions !== \"object\"){\r\n\t\t\tthrow this.sequence._customError(this, \"borderColor\", \"inOptions must be of type object\");\r\n\t\t}\r\n\t\tinOptions = foundry.utils.mergeObject({ alpha: CrosshairsDocument.defaultConfig.borderAlpha }, inOptions,);\r\n\t\tconst { alpha } = inOptions;\r\n\t\tif (!lib.is_real_number(alpha)) {\r\n\t\t\tthrow this.sequence._customError(this, \"borderAlpha\", \"inOptions.alpha must be of type number\");\r\n\t\t}\r\n\t\tthis._borderColor = lib.parseColor(inColor).hexadecimal;\r\n\t\tthis._config['borderAlpha'] = lib.normalize_alpha_number(alpha);\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the fill color of the crosshair\r\n\t */\r\n\tfillColor(inColor, inOptions = {}) {\r\n\t\tif (typeof inOptions !== \"object\"){\r\n\t\t\tthrow this.sequence._customError(this, \"fillColor\", \"inOptions must be of type object\");\r\n\t\t}\r\n\t\tinOptions = foundry.utils.mergeObject({ alpha: CrosshairsDocument.defaultConfig.fillAlpha }, inOptions,);\r\n\t\tconst { alpha } = inOptions;\r\n\t\tif (!lib.is_real_number(alpha)) {\r\n\t\t\tthrow this.sequence._customError(this, \"fillColor\", \"inOptions.alpha must be of type number\");\r\n\t\t}\r\n\t\tthis._config['fillAlpha'] = lib.normalize_alpha_number(alpha);\r\n\t\tthis._fillColor = lib.parseColor(inColor).hexadecimal;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the texture used by the crosshair\r\n\t */\r\n\ttexture(inTexture, inOptions = {}) {\r\n\t\tif (typeof inOptions !== \"object\"){\r\n\t\t\tthrow this.sequence._customError(this, \"texture\", \"inOptions must be of type object\");\r\n\t\t}\r\n\t\tinOptions = foundry.utils.mergeObject(\r\n\t\t\t{ \r\n\t\t\t\talpha: CrosshairsDocument.defaultConfig.textureAlpha,\r\n\t\t\t\tscale: CrosshairsDocument.defaultConfig.textureScale,\r\n\t\t\t}, \r\n\t\t\tinOptions,\r\n\t\t);\r\n\t\tconst { alpha, scale } = inOptions;\r\n\t\tif (!lib.is_real_number(alpha)) {\r\n\t\t\tthrow this.sequence._customError(this, \"texture\", \"inOptions.alpha must be of type number\");\r\n\t\t}\r\n\t\tif (!lib.is_real_number(scale)) {\r\n\t\t\tthrow this.sequence._customError(this, \"texture\", \"inOptions.scale must be of type number\");\r\n\t\t}\r\n\t\tif (typeof inTexture !== \"string\") {\r\n\t\t\tthrow this.sequence._customError(this, \"texture\", \"inTexture must be of type string\");\r\n\t\t}\r\n\t\tthis._texture = inTexture;\r\n\t\tthis._config['textureAlpha'] = lib.normalize_alpha_number(alpha);\r\n\t\tthis._config['textureScale'] = scale;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Configures the source location of the crosshair, usually to limit it around the target placeable object, or to\r\n\t * cause it to be limited within a certain range of the placeable object\r\n\t */\r\n\tlocation(inLocation, inOptions = {}) {\r\n\t\tif (!inLocation || typeof inLocation !== \"object\") {\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inLocation is invalid, and must be of type of placeable object, or document\");\r\n\t\t}\r\n\t\tif (typeof inOptions !== \"object\"){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions must be of type object\");\r\n\t\t}\r\n\t\tinOptions = foundry.utils.mergeObject({\r\n\t\t\tlimitMinRange: CrosshairsDocument.defaultConfig.location.limitMinRange,\r\n\t\t\tlimitMaxRange: CrosshairsDocument.defaultConfig.location.limitMaxRange,\r\n\t\t\tshowRange: CrosshairsDocument.defaultConfig.location.showRange,\r\n\t\t\tlockToEdge: CrosshairsDocument.defaultConfig.location.lockToEdge,\r\n\t\t\tlockToEdgeDirection: CrosshairsDocument.defaultConfig.location.lockToEdgeDirection,\r\n\t\t\toffset: CrosshairsDocument.defaultConfig.location.offset,\r\n\t\t\twallBehavior: CrosshairsDocument.defaultConfig.location.wallBehavior,\r\n\t\t\tdisplayRangePoly: CrosshairsDocument.defaultConfig.location.displayRangePoly,\r\n\t\t\trangePolyFillColor: CrosshairsDocument.defaultConfig.location.rangePolyFillColor,\r\n\t\t\trangePolyLineColor: CrosshairsDocument.defaultConfig.location.rangePolyLineColor,\r\n\t\t\trangePolyFillAlpha: CrosshairsDocument.defaultConfig.location.rangePolyFillAlpha,\r\n\t\t\trangePolyLineAlpha: CrosshairsDocument.defaultConfig.location.rangePolyLineAlpha,\r\n\t\t}, inOptions,);\r\n\t\tinLocation = this._validateLocation(inLocation);\r\n\t\tif (typeof inOptions.wallBehavior !== \"string\"){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.wallBehavior must be of type string\");\r\n\t\t}\r\n\t\tif (inLocation === undefined){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"could not find position of given object\");\r\n\t\t}\r\n\t\tif (inOptions.limitMinRange && !lib.is_real_number(inOptions.limitMinRange)){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.limitMinRange must be of type number\");\r\n\t\t}\r\n\t\tif (inOptions.limitMaxRange && !lib.is_real_number(inOptions.limitMaxRange)){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.limitMaxRange must be of type number\");\r\n\t\t}\r\n\t\tif (typeof inOptions.lockToEdge !== \"boolean\"){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.lockToEdge must be of type boolean\");\r\n\t\t}\r\n\t\tif (typeof inOptions.showRange !== \"boolean\"){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.showRange must be of type boolean\");\r\n\t\t}\r\n\t\tif (typeof inOptions.lockToEdgeDirection !== \"boolean\"){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.lockToEdgeDirection must be of type boolean\");\r\n\t\t}\r\n\t\tif (typeof inOptions.offset !== \"object\") {\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.offset must be of type of object\");\r\n\t\t}\r\n\t\tif (!lib.is_real_number(inOptions.offset.x)) {\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.offset.x must be of type of number\");\r\n\t\t}\r\n\t\tif (!lib.is_real_number(inOptions.offset.y)) {\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.offset.y must be of type of number\");\r\n\t\t}\r\n\t\tif (typeof inOptions.displayRangePoly !== \"boolean\"){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.displayRangePoly must be of type boolean\");\r\n\t\t}\r\n\t\tif (inOptions.rangePolyFillColor && !lib.is_real_number(inOptions.rangePolyFillColor)){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.rangePolyFillColor must be of type number (color, eg 0xFF0000)\");\r\n\t\t}\r\n\t\tif (inOptions.rangePolyLineColor && !lib.is_real_number(inOptions.rangePolyLineColor)){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.rangePolyLineColor must be of type number (color, eg 0xFF0000)\");\r\n\t\t}\r\n\t\tif (inOptions.rangePolyFillAlpha && !lib.is_real_number(inOptions.rangePolyFillAlpha)){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.rangePolyFillAlpha must be of type number\");\r\n\t\t}\r\n\t\tif (inOptions.rangePolyLineAlpha && !lib.is_real_number(inOptions.rangePolyLineAlpha)){\r\n\t\t\tthrow this.sequence._customError(this, \"location\", \"inOptions.rangePolyLineAlpha must be of type number\");\r\n\t\t}\r\n\t\tthis._config[\"location\"] = {\r\n\t\t\tobj: inLocation?.object ?? inLocation,\r\n\t\t\tlimitMinRange: inOptions.limitMinRange,\r\n\t\t\tlimitMaxRange: inOptions.limitMaxRange,\r\n\t\t\tlockToEdge: inOptions.lockToEdge,\r\n\t\t\tlockToEdgeDirection: inOptions.lockToEdgeDirection,\r\n\t\t\tshowRange: inOptions.showRange,\r\n\t\t\toffset: inOptions.offset,\r\n\t\t\twallBehavior: inOptions.wallBehavior,\r\n\t\t\tdisplayRangePoly: inOptions.displayRangePoly,\r\n\t\t\trangePolyFillColor: inOptions.rangePolyFillColor,\r\n\t\t\trangePolyLineColor: inOptions.rangePolyLineColor,\r\n\t\t\trangePolyFillAlpha: inOptions.rangePolyFillAlpha,\r\n\t\t\trangePolyLineAlpha: inOptions.rangePolyLineAlpha,\r\n\t\t};\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Causes the crosshair to spawn a measurable template identical to the crosshair\r\n\t */\r\n\tpersist(inBool = true) {\r\n\t\tif (typeof inBool !== \"boolean\"){\r\n\t\t\tthrow this.sequence._customError(this, \"persist\", \"inBool must be of type boolean\");\r\n\t\t}\r\n\t\tthis._persist = inBool;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Toggles whether this crosshair should highlight the grid\r\n\t */\r\n\tgridHighlight(inBool = true) {\r\n\t\tif (typeof inBool !== \"boolean\"){\r\n\t\t\tthrow this.sequence._customError(this, \"gridHighlight\", \"inBool must be of type boolean\");\r\n\t\t}\r\n\t\tthis._config['gridHighlight'] = inBool;\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Adds a callback function for certain crosshair events\r\n\t */\r\n\tcallback(inString, inCallback) {\r\n\t\tif (typeof inString !== \"string\" || !Object.values(CONSTANTS.CALLBACKS).some(str => str === inString)) {\r\n\t\t\tthrow this.sequence._customError(this, \"callback\", \"inString must be of type string and one of Sequencer.Crosshair.CALLBACKS\");\r\n\t\t}\r\n\t\tif (!lib.is_function(inCallback)) {\r\n\t\t\tthrow this.sequence._customError(this, \"callback\", \"inCallback must be of type Function\");\r\n\t\t}\r\n\t\tthis._callbacks[inString] = inCallback;\r\n\t\treturn this;\r\n\t}\r\n\r\n\tasync run() {\r\n\r\n\t\tconst reticle = new CrosshairsDocument({\r\n\t\t\tt: this._type,\r\n\t\t\tdistance: this._distance,\r\n\t\t\twidth: this._width,\r\n\t\t\tdirection: this._direction,\r\n\t\t\tangle: this._angle,\r\n\t\t\tborderColor: this._borderColor,\r\n\t\t\ttexture: this._texture,\r\n\t\t\tfillColor: this._fillColor,\r\n\t\t}, {\r\n\t\t\tparent: canvas.scene\r\n\t\t}, this._config, this._callbacks);\r\n\r\n\t\treturn reticle.show().then(async (result) => {\r\n\r\n\t\t\tif (!result) return;\r\n\r\n\t\t\tif (this._persist) {\r\n\t\t\t\tconst [template] = await canvas.scene.createEmbeddedDocuments(\"MeasuredTemplate\", [\r\n\t\t\t\t\treticle.toObject()\r\n\t\t\t\t]);\r\n\t\t\t\tthis.sequence.crosshairs[this._name] = template;\r\n\t\t\t}\r\n\r\n\t\t\tif (this._name) {\r\n\t\t\t\tthis.sequence.nameOffsetMap ||= {};\r\n\t\t\t\tthis.sequence.nameOffsetMap[this._name] = {\r\n\t\t\t\t\tseed: `${this._name}-${foundry.utils.randomID()}`,\r\n\t\t\t\t\ttwister: {},\r\n\t\t\t\t\tsource: this.sequence.crosshairs[this._name]?.uuid ?? reticle.getOrientation().source,\r\n\t\t\t\t\ttarget: this.sequence.crosshairs[this._name]?.uuid ?? reticle.getOrientation().target\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}).catch((err) => {\r\n\t\t\tthis.sequence._abort();\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * @private\r\n\t */\r\n\t_applyTraits() {\r\n\t\tObject.assign(this.constructor.prototype, traits.name);\r\n\t}\r\n\r\n}\r\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\";\nimport CrosshairSection from \"../sections/crosshair.js\";\nimport { get_object_canvas_data } from \"../lib/canvas-lib.js\";\nimport CrosshairsPlaceable from \"./sequencer-crosshair/CrosshairsPlaceable.js\";\nimport CrosshairsDocument from \"./sequencer-crosshair/CrosshairsDocument.js\";\n\nexport default class Sequence {\n\tconstructor(\n\t\toptions = {\n\t\t\tmoduleName: \"Sequencer\",\n\t\t\tsoftFail: false,\n\t\t},\n\t\tsoftFail = false\n\t) {\n\t\tthis.id = foundry.utils.randomID();\n\t\tthis.moduleName =\n\t\t\ttypeof options === \"string\"\n\t\t\t\t? options\n\t\t\t\t: options?.moduleName ?? \"Sequencer\";\n\t\tthis.softFail = options?.softFail ?? softFail;\n\t\tthis.sections = [];\n\t\tthis.nameOffsetMap = false;\n\t\tthis.crosshairs = {}\n\t\tthis.effectIndex = 0;\n\t\tthis.sectionToCreate = undefined;\n\t\tthis.remote = false;\n\t\tthis.local = false;\n\t\tthis._status = writable(CONSTANTS.STATUS.READY);\n\t\treturn lib.sequence_proxy_wrap(this);\n\t}\n\n\t/**\n\t * Plays all of this sequence's sections\n\t *\n\t * @returns {Promise}\n\t */\n\tasync play({ remote = false, preload = false, local = false } = {}) {\n\t\tthis.remote = remote;\n\t\tthis.local = local;\n\t\tif (remote) {\n\t\t\tconst data = await this.toJSON();\n\t\t\tsequencerSocket.executeForOthers(\n\t\t\t\tSOCKET_HANDLERS.RUN_SEQUENCE_LOCALLY,\n\t\t\t\tdata\n\t\t\t);\n\t\t\treturn new Sequence().fromJSON(data).play({ local: true });\n\t\t}\n\t\tHooks.callAll(\"createSequencerSequence\", this);\n\t\tlib.debug(\"Initializing sections\");\n\t\tconst initializationPromises = this.sections.map((section) => section._initialize())\n\t\tawait Promise.allSettled(initializationPromises)\n\t\tif (preload) {\n\t\t\tconst preloadFiles = this.sections.filter(section => !!section._file).map(section => section._file)\n\t\t\tif(local) {\n\t\t\t\tawait Sequencer.Preloader.preload(preloadFiles)\n\t\t\t}else {\n\t\t\t\tawait Sequencer.Preloader.preloadForClients(preloadFiles)\n\t\t\t}\n\t\t}\n\t\tSequenceManager.RunningSequences.add(this.id, this);\n\t\tthis.effectIndex = 0;\n\t\tlib.debug(\"Playing sections\");\n\t\tthis.status = CONSTANTS.STATUS.RUNNING;\n\t\tconst promises = [];\n\t\tfor (let section of this.sections) {\n\t\t\tif (section instanceof EffectSection) this.effectIndex++;\n\t\t\tif (section.shouldWaitUntilFinished) {\n\t\t\t\tpromises.push(await section._execute());\n\t\t\t} else {\n\t\t\t\tpromises.push(section._execute());\n\t\t\t}\n\t\t\tif (this.status === CONSTANTS.STATUS.ABORTED) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!section._isLastSection) {\n\t\t\t\tawait new Promise((resolve) => setTimeout(resolve, 3));\n\t\t\t}\n\t\t}\n\n\t\treturn Promise.allSettled(promises).then(() => {\n\t\t\tHooks.callAll(\"endedSequencerSequence\");\n\t\t\tlib.debug(\"Finished playing sections\");\n\t\t\tthis.status = CONSTANTS.STATUS.COMPLETE;\n\t\t});\n\t}\n\n\t/**\n\t * Creates a section that will run a function.\n\t *\n\t * @param {function} inFunc\n\t * @returns {Sequence} this\n\t */\n\tthenDo(inFunc) {\n\t\tconst func = lib.section_proxy_wrap(new FunctionSection(this, inFunc));\n\t\tthis.sections.push(func);\n\t\treturn func;\n\t}\n\n\t/**\n\t * Creates a section that will run a macro based on a name or a direct reference to a macro.\n\t *\n\t * @param {string|Macro} inMacro\n\t * @param {object} args\n\t * @returns {Sequence} this\n\t */\n\tmacro(inMacro, ...args) {\n\t\tlet macro;\n\t\tlet compendium = false;\n\t\tif (typeof inMacro === \"string\") {\n\t\t\tif (inMacro.startsWith(\"Compendium\")) {\n\t\t\t\tlet packArray = inMacro.split(\".\");\n\t\t\t\tlet pack = game.packs.get(`${packArray[1]}.${packArray[2]}`);\n\t\t\t\t// Catch invalid compendium pack\n\t\t\t\tif (!pack) {\n\t\t\t\t\tif (this.softFail) {\n\t\t\t\t\t\treturn this;\n\t\t\t\t\t}\n\t\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\t\tthis.moduleName,\n\t\t\t\t\t\t`macro - Compendium '${packArray[1]}.${packArray[2]}' was not found`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tmacro = packArray;\n\t\t\t\tcompendium = pack;\n\t\t\t} else {\n\t\t\t\tmacro = game.macros.getName(inMacro);\n\t\t\t\tif (!macro) {\n\t\t\t\t\tif (this.softFail) {\n\t\t\t\t\t\treturn this;\n\t\t\t\t\t}\n\t\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\t\tthis.moduleName,\n\t\t\t\t\t\t`macro - Macro '${inMacro}' was not found`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (inMacro instanceof Macro) {\n\t\t\tmacro = inMacro;\n\t\t} else {\n\t\t\tthrow lib.custom_error(\n\t\t\t\tthis.moduleName,\n\t\t\t\t`macro - inMacro must be of instance string or Macro`\n\t\t\t);\n\t\t}\n\n\t\targs = args.length ? args?.[0] : {};\n\t\tif (typeof args !== \"object\") {\n\t\t\tthrow lib.custom_error(\n\t\t\t\tthis.moduleName,\n\t\t\t\t`macro - Secondary argument must be an object`\n\t\t\t);\n\t\t}\n\n\t\tconst func = lib.section_proxy_wrap(\n\t\t\tnew FunctionSection(\n\t\t\t\tthis,\n\t\t\t\tasync () => {\n\t\t\t\t\tif (compendium) {\n\t\t\t\t\t\tconst macroIndex = (await compendium.getIndex())\n\t\t\t\t\t\t\t.find((i) => {\n\t\t\t\t\t\t\t\tif(macro[3] === \"Macro\"){\n\t\t\t\t\t\t\t\t\treturn macro[4] === i._id;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn i.name === macro[3]\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tconst macroData = macroIndex ? (await compendium.getDocument(macroIndex?._id)) : false;\n\t\t\t\t\t\tif (!macroData) {\n\t\t\t\t\t\t\tif (this.softFail) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthrow lib.custom_error(\n\t\t\t\t\t\t\t\tthis.moduleName,\n\t\t\t\t\t\t\t\t`macro - Macro '${macro[3]}' was not found in compendium '${macro[1]}.${macro[2]}'`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmacro = new Macro(macroData);\n\t\t\t\t\t\tmacro.ownership.default = CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER;\n\t\t\t\t\t}\n\n          await macro.execute(args);\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\t/**\n\t * Creates an animation. Until you call .then(), .effect(), .sound(), or .wait(), you'll be working on the Animation section.\n\t *\n\t * @param {Token|Tile} [inTarget=false] inTarget\n\t * @returns {AnimationSection}\n\t */\n\tanimation(inTarget) {\n\t\tconst animation = lib.section_proxy_wrap(\n\t\t\tnew AnimationSection(this, inTarget)\n\t\t);\n\t\tthis.sections.push(animation);\n\t\treturn animation;\n\t}\n\n\t/**\n\t * Creates a scrolling text. Until you call .then(), .effect(), .sound(), or .wait(), you'll be working on the Scrolling Text section.\n\t *\n\t * @param {Object|String|Boolean} [inTarget=false] inTarget\n\t * @param {String|Boolean} [inText=false] inText\n\t * @param {Object} [inTextOptions={}] inTextOptions\n\t * @returns {AnimationSection}\n\t */\n\tscrollingText(inTarget = false, inText = false, inTextOptions = {}) {\n\t\tconst scrolling = lib.section_proxy_wrap(\n\t\t\tnew ScrollingTextSection(this, inTarget, inText, inTextOptions)\n\t\t);\n\t\tthis.sections.push(scrolling);\n\t\treturn scrolling;\n\t}\n\n\t/**\n\t * Pans the canvas text. Until you call any other sections you'll be working on the Canvas Pan section.\n\t *\n\t * @param {Object|String|Boolean} [inTarget=false] inTarget\n\t * @param {Boolean|Number} inDuration\n\t * @param {Boolean|Number} inSpeed\n\t * @returns {AnimationSection}\n\t */\n\tcanvasPan(inTarget = false, inDuration = null, inSpeed = null) {\n\t\tconst panning = lib.section_proxy_wrap(\n\t\t\tnew CanvasPanSection(this, inTarget, inDuration ?? undefined)\n\t\t);\n\t\tif (inSpeed !== null) panning.speed(inSpeed);\n\t\tthis.sections.push(panning);\n\t\treturn panning;\n\t}\n\n\t/**\n\t * Creates a crosshair section. Until you call other Sequence methods, you will be working on the Crosshair section.\n\t *\n\t * @param {string} [inName] inName\n\t * @returns {Section}\n\t */\n\tcrosshair(inName = \"\") {\n\t\tconst crosshair = lib.section_proxy_wrap(new CrosshairSection(this, inName));\n\t\tthis.sections.push(crosshair);\n\t\treturn crosshair;\n\t}\n\n\t/**\n\t * Adds a location to the sequence and ties it to a string so that it may be used later\n\t * @param {string} inName\n\t * @param {object/PlaceableObject/Document} inLocation\n\t * @returns {Sequence} this\n\t */\n\taddNamedLocation(inName, inLocation){\n\t\tif (typeof inName !== \"string\")\n\t\t\tthrow lib.custom_error(this.moduleName, `addNamedLocation - inName must be of type string`);\n\t\tif (!(typeof inLocation === \"object\" || inLocation instanceof foundry.canvas.placeables.PlaceableObject || inLocation instanceof foundry.abstract.Document))\n\t\t\tthrow lib.custom_error(this.moduleName, `addNamedLocation - inLocation must be of type object, PlaceableObject, or Document`);\n\t\tif(inLocation instanceof CrosshairsPlaceable) inLocation = inLocation.document;\n\t\tthis.nameOffsetMap ||= {};\n\n\t\tconst sourceLocation = inLocation?.source ?? inLocation?.cachedPosition?.source ?? (\n\t\t\tinLocation instanceof CrosshairsDocument\n\t\t\t\t\t? inLocation.getOrientation().source\n\t\t\t\t\t: get_object_canvas_data(inLocation, { uuid: false })\n\t\t)\n\n\t\tconst targetLocation = inLocation?.target ?? inLocation?.cachedPosition?.target ?? (\n\t\t\tinLocation instanceof CrosshairsDocument\n\t\t\t\t\t? inLocation.getOrientation().target ?? sourceLocation\n\t\t\t\t\t: get_object_canvas_data(inLocation, { measure: true, uuid: false })\n\t\t)\n\n\t\tthis.nameOffsetMap[inName] = {\n\t\t\tseed: `${inName}-${foundry.utils.randomID()}`,\n\t\t\tsource: sourceLocation,\n\t\t\ttarget: targetLocation\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Causes the sequence to wait after the last section for as many milliseconds as you pass to this method. If given\n\t * a second number, a random wait time between the two given numbers will be generated.\n\t *\n\t * @param {number} [msMin=1] minMs\n\t * @param {number} [msMax=1] maxMs\n\t * @returns {Sequence} this\n\t */\n\twait(msMin = 1, msMax = 1) {\n\t\tif (msMin < 1)\n\t\t\tthrow lib.custom_error(\n\t\t\t\tthis.moduleName,\n\t\t\t\t`wait - Wait ms cannot be less than 1`\n\t\t\t);\n\t\tif (msMax < 1)\n\t\t\tthrow lib.custom_error(\n\t\t\t\tthis.moduleName,\n\t\t\t\t`wait - Max wait ms cannot be less than 1`\n\t\t\t);\n\t\tconst section = lib.section_proxy_wrap(new WaitSection(this, msMin, msMax));\n\t\tthis.sections.push(section);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Applies a preset to the sequence\n\t *\n\t * @param {string} presetName\n\t * @param {*} args\n\t * @returns {Sequence|FunctionSection|EffectSection|AnimationSection|SoundSection}\n\t */\n\tpreset(presetName, ...args) {\n\t\tif (typeof presetName !== \"string\") {\n\t\t\tthrow this._customError(this, \"name\", `inName must be of type string`);\n\t\t}\n\t\tconst preset = SequencerPresets.get(presetName);\n\t\tif (!preset) {\n\t\t\tlib.custom_warning(\n\t\t\t\t\"Sequencer\",\n\t\t\t\t`preset | Could not find preset with name \"${presetName}\"`\n\t\t\t);\n\t\t\treturn this;\n\t\t}\n\t\tconst lastSection = this.sections[this.sections.length - 1] || this;\n\t\treturn preset(lastSection, ...args);\n\t}\n\n\t/**\n\t * Adds the sections from a given Sequence to this Sequence\n\t *\n\t * @param {Sequence|FunctionSection|EffectSection|AnimationSection|SoundSection} inSequence\n\t * @returns {Sequence} this\n\t */\n\taddSequence(inSequence) {\n\t\tif (inSequence instanceof Section) inSequence = inSequence.sequence;\n\t\tif (!(inSequence instanceof Sequence)) {\n\t\t\tthrow lib.custom_error(\n\t\t\t\tthis.moduleName,\n\t\t\t\t`addSequence - could not find the sequence from the given parameter`\n\t\t\t);\n\t\t}\n\t\tconst newSections = inSequence.sections.map((section) => {\n\t\t\tconst newSection = Object.assign(\n\t\t\t\tObject.create(Object.getPrototypeOf(section)),\n\t\t\t\tsection\n\t\t\t);\n\t\t\tnewSection.sequence = this;\n\t\t\treturn newSection;\n\t\t});\n\t\tthis.sections = this.sections.concat(newSections);\n\t\treturn this;\n\t}\n\n\tasync toJSON() {\n\t\tconst data = {\n\t\t\toptions: { moduleName: this.moduleName, softFail: this.softFail },\n\t\t\tsections: [],\n\t\t};\n\t\tfor (const section of this.sections) {\n\t\t\tconst sectionData = await section._serialize();\n\t\t\tif (!sectionData.type) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Sequencer | toJson | ${section.constructor.name} does not support serialization!`\n\t\t\t\t);\n\t\t\t}\n\t\t\tdata.sections.push(sectionData);\n\t\t}\n\t\treturn data;\n\t}\n\n\tfromJSON(data) {\n\t\tthis.moduleName = data.options.moduleName;\n\t\tthis.softFail = data.options.softFail;\n\t\tthis.local = true;\n\t\tfor (const section of data.sections) {\n\t\t\tthis[section.type]()._deserialize(section);\n\t\t}\n\t\treturn this;\n\t}\n\n\t_createCustomSection(...args) {\n\t\tconst func = lib.section_proxy_wrap(\n\t\t\tnew this.sectionToCreate(this, ...args)\n\t\t);\n\t\tthis.sectionToCreate = undefined;\n\t\tthis.sections.push(func);\n\t\treturn func;\n\t}\n\n\t_showWarning(self, func, warning, notify = false) {\n\t\tlib.custom_warning(\n\t\t\tthis.moduleName,\n\t\t\t`${self.constructor.name.replace(\"Section\", \"\")} | ${func} - ${warning}`,\n\t\t\tnotify\n\t\t);\n\t}\n\n\t_customError(self, func, error) {\n\t\treturn lib.custom_error(\n\t\t\tthis.moduleName,\n\t\t\t`${self.constructor.name.replace(\"Section\", \"\")} | ${func} - ${error}`\n\t\t);\n\t}\n\n\tset status(inStatus) {\n\t\tthis._status.update((currentStatus) => {\n\t\t\tif (\n\t\t\t\tcurrentStatus === CONSTANTS.STATUS.READY ||\n\t\t\t\tcurrentStatus === CONSTANTS.STATUS.RUNNING\n\t\t\t) {\n\t\t\t\treturn inStatus;\n\t\t\t}\n\t\t\treturn currentStatus;\n\t\t});\n\t}\n\n\tget status() {\n\t\treturn get(this._status);\n\t}\n\n\tget statusStore() {\n\t\treturn this._status;\n\t}\n\n\t_abort() {\n\t\tthis.status = CONSTANTS.STATUS.ABORTED;\n\t\tfor (const section of this.sections) {\n\t\t\tsection._abortSection();\n\t\t}\n\t}\n}\n","import Section from \"../sections/section.js\";\nimport * as lib from \"../lib/lib.js\";\n\nclass SequencerSectionManager {\n\n\t#sections = {};\n\n\tget externalSections(){\n\t\treturn this.#sections;\n\t}\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.#sections[inMethodName] && !overwrite) {\n      throw lib.custom_error(\n        inModuleName,\n        `${inMethodName} is already a registered Section with the class ${this.#sections[inMethodName].constructor.name}`\n      );\n    }\n\n    coreMethods = coreMethods.concat(Object.keys(this.#sections));\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}<br>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.#sections[inMethodName] = inClass;\n\n    return true;\n  }\n}\n\nconst sectionManager = new SequencerSectionManager();\n\nexport default sectionManager;\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  libWrapper.register(CONSTANTS.MODULE_NAME, \"PIXI.BaseImageResource.prototype.upload\", 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-fix-pixi\")\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 { createJournalDatabase, custom_warning, debug, forceDeletionKeyWrapper } from \"./lib/lib.js\";\n\nexport default async function runMigrations() {\n  const sortedMigrations = Object.entries(migrations).sort((a, b) => {\n    if (foundry.utils.isNewerVersion(b[0], a[0])) return -1;\n    if (foundry.utils.isNewerVersion(a[0], b[0])) return 1;\n    return 0;\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)\n        .filter((token) => token.isOwner)\n        .filter((token, index) => {\n          if (tokenFilter) {\n            return tokenFilter(token, index);\n          }\n          const effects = foundry.utils.getProperty(token, CONSTANTS.EFFECTS_FLAG) ?? [];\n          const effectsOutOfDate = effects.filter((e) =>\n            foundry.utils.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)\n    .filter((actor) => actor.isOwner)\n    .filter((actor, index) => {\n      if (actorFilter) {\n        return actorFilter(actor, index);\n      }\n      const effects = foundry.utils.getProperty(actor, CONSTANTS.EFFECTS_FLAG) ?? [];\n      const effectsOutOfDate = effects.filter((e) =>\n        foundry.utils.isNewerVersion(version, e[1].flagVersion)\n      );\n      return effectsOutOfDate.length;\n    });\n}\n\nfunction getSequencerEffectActorsPrototypeToken(version, actorFilter = false) {\n  return Array.from(game.actors)\n    .filter((actor) => actor.isOwner)\n    .filter((actor, index) => {\n      if (actorFilter) {\n        return actorFilter(actor, index);\n      }\n      const effects = foundry.utils.getProperty(actor, \"prototypeToken.\" + CONSTANTS.EFFECTS_FLAG) ?? [];\n      const effectsOutOfDate = effects.filter((e) =>\n        foundry.utils.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        foundry.utils.getProperty(actor, \"prototypeToken.\" + CONSTANTS.EFFECTS_FLAG) ?? [];\n      const effectsOutOfDate = effects.filter((e) =>\n        foundry.utils.isNewerVersion(version, e[1].flagVersion)\n      );\n      return effectsOutOfDate.length;\n    });\n\n    const actorUpdateArray = actorsToUpdate.map((actor) => {\n      const effectsToMoveFromTokenPrototype = foundry.utils.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 = foundry.utils.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 = foundry.utils.getProperty(t, CONSTANTS.EFFECTS_FLAG) ?? [];\n      const prototypeTokenEffects =\n        foundry.utils.getProperty(actor, \"prototypeToken.\" + CONSTANTS.EFFECTS_FLAG) ?? [];\n      const effectsOutOfDate = effects.filter((e) =>\n        foundry.utils.isNewerVersion(version, e[1].flagVersion)\n      );\n      const prototypeEffectsOutOfDate = prototypeTokenEffects.filter((e) =>\n        foundry.utils.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 = foundry.utils.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        debug(\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      debug(\n        `Sequencer | Updated ${actorUpdateArray.length} actors' effects to version ${version}`\n      );\n      await Actor.updateDocuments(actorUpdateArray);\n    }\n  },\n\t\"3.4.4\": async (version) => {\n\t\tconst actorsToUpdate = getSequencerEffectActors(version, (actor) => {\n\t\t\tconst effects =\n\t\t\t\tfoundry.utils.getProperty(actor, \"prototypeToken.\" + CONSTANTS.EFFECTS_FLAG) ?? [];\n\t\t\tconst effectsOutOfDate = effects.filter((e) =>\n\t\t\t\tfoundry.utils.isNewerVersion(version, e[1].flagVersion)\n\t\t\t);\n\t\t\treturn effectsOutOfDate.length;\n\t\t});\n\n\t\tconst actorUpdateArray = actorsToUpdate.map((actor) => {\n\t\t\tconst actorEffects = foundry.utils.getProperty(actor, CONSTANTS.EFFECTS_FLAG) ?? [];\n\t\t\tconst prototypeTokenEffects = foundry.utils.getProperty(actor, \"prototypeToken.\" + CONSTANTS.EFFECTS_FLAG) ?? [];\n\t\t\tlet update = {\n\t\t\t\t_id: actor.id,\n\t\t\t\t[CONSTANTS.EFFECTS_FLAG]: actorEffects.concat(prototypeTokenEffects)\n\t\t\t}\n\t\t\tforceDeletionKeyWrapper(update, \"prototypeToken.\" + CONSTANTS.REMOVE_EFFECTS_FLAG);\n\t\t\treturn update;\n\t\t})\n\n\t\tif (actorUpdateArray.length) {\n\t\t\tdebug(\n\t\t\t\t`Sequencer | Updated ${actorUpdateArray.length} actors' effects to version ${version}`\n\t\t\t);\n\t\t\tawait Actor.updateDocuments(actorUpdateArray);\n\t\t}\n\t},\n\t\"4.0.0\": async (version) => {\n\t\tlet actorsToUpdate = getSequencerEffectActors(version);\n\n\t\tlet journalUpdate = {};\n\t\tconst actorUpdateArray = actorsToUpdate.map((actor) => {\n\t\t\tjournalUpdate[actor.uuid.replaceAll(\".\", \"-\")] = foundry.utils.getProperty(actor, CONSTANTS.EFFECTS_FLAG) ?? [];\n\t\t\tlet update = {\n\t\t\t\t_id: actor.id,\n\t\t\t}\n\t\t\tforceDeletionKeyWrapper(update, CONSTANTS.REMOVE_EFFECTS_FLAG);\n\t\t\treturn update;\n\t\t});\n\n\t\tlet tokensOnScenes = getSequencerEffectTokens(version);\n\t\tfor (const [scene, tokens] of tokensOnScenes) {\n\t\t\tconst updates = [];\n\t\t\tfor (const token of tokens) {\n\t\t\t\tjournalUpdate[token.uuid.replaceAll(\".\", \"-\")] = foundry.utils.getProperty(token, CONSTANTS.EFFECTS_FLAG);\n\t\t\t\tlet update = {\n\t\t\t\t\t_id: token.id,\n\t\t\t\t}\n\t\t\t\tforceDeletionKeyWrapper(update, CONSTANTS.REMOVE_EFFECTS_FLAG);\n\t\t\t\tupdates.push(update);\n\t\t\t}\n\n\t\t\tif (updates.length) {\n\t\t\t\tdebug(\n\t\t\t\t\t`Sequencer | Updated ${updates.length} tokens' effects on scene ${scene.id} to version ${version}`\n\t\t\t\t);\n\t\t\t\tawait scene.updateEmbeddedDocuments(\"Token\", updates);\n\t\t\t}\n\t\t}\n\n\t\tif (actorUpdateArray.length) {\n\t\t\tdebug(\n\t\t\t\t`Sequencer | Updated ${actorUpdateArray.length} actors' effects to version ${version}`\n\t\t\t);\n\t\t\tawait Actor.updateDocuments(actorUpdateArray);\n\t\t}\n\n\t\tif (Object.keys(journalUpdate).length === 0) return;\n\n\t\tconst journal = await createJournalDatabase();\n\t\tawait journal.update({\n\t\t\t[CONSTANTS.EFFECTS_FLAG]: journalUpdate\n\t\t});\n\t}\n};\n","import CrosshairsDocument from \"./CrosshairsDocument.js\";\r\nimport CrosshairsPlaceable from \"./CrosshairsPlaceable.js\";\r\n\r\nexport default class TokenCrosshairsDocument extends CrosshairsDocument {\r\n\t/**\r\n\t * @inheritdoc\r\n\t */\r\n\tconstructor(tokenPlaceable, context = {}, crosshair = {}, callbacks = {}) {\r\n\r\n\t\tconst tokenDoc = tokenPlaceable.document\r\n\r\n\t\tconst { distance, size } = context.parent.grid;\r\n\t\tconst rayBounds = new foundry.canvas.geometry.Ray(\r\n\t\t\t{ x: 0, y: 0 },\r\n\t\t\t{ x: tokenDoc.width * distance, y: tokenDoc.height * distance });\r\n\r\n\t\tconst initial = {\r\n\t\t\tt: 'rect',\r\n\t\t\t'icon.display': false,\r\n\t\t\tdirection: Math.toDegrees(rayBounds.angle),\r\n\t\t\tdistance: rayBounds.distance,\r\n\t\t};\r\n\r\n\t\tconst defaultCrosshair = foundry.utils.mergeObject(TokenCrosshairsDocument.defaultConfig, {\r\n\t\t\t\tdistanceMinMax: {\r\n\t\t\t\t\tmin: rayBounds.distance,\r\n\t\t\t\t\tmax: rayBounds.distance,\r\n\t\t\t\t},\r\n\t\t\t\tlocation: {\r\n\t\t\t\t\toffset: {\r\n\t\t\t\t\t\tx: (tokenDoc.width * size) / -2,\r\n\t\t\t\t\t\ty: (tokenDoc.height * size) / -2\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\ttoken: tokenPlaceable\r\n\t\t\t}\r\n\t\t)\r\n\r\n\t\tsuper(initial, context, foundry.utils.mergeObject(defaultCrosshair, crosshair), callbacks);\r\n\t}\r\n\r\n\tstatic get defaultConfig() {\r\n\t\treturn foundry.utils.mergeObject(super.defaultConfig, {\r\n\t\t\tgridHighlight: false,\r\n\t\t\tsnap: {\r\n\t\t\t\tposition: CONST.GRID_SNAPPING_MODES.VERTEX\r\n\t\t\t},\r\n\t\t\tlabel: {\r\n\t\t\t\tdisplay: false,\r\n\t\t\t},\r\n\t\t\tlockDrag: true,\r\n\t\t\talpha: 0.5\r\n\t\t});\r\n\t}\r\n\r\n\tstatic get placeableClass() {\r\n\t\treturn TokenCrosshair;\r\n\t}\r\n}\r\n\r\nclass TokenCrosshair extends CrosshairsPlaceable {\r\n\r\n\t#clonedToken = false\r\n\t#tokenRotation = 0;\r\n\r\n\t/**\r\n\t * @override\r\n\t */\r\n\t_refreshTemplate() {\r\n\t\tthis.template.clear();\r\n\t\tthis.#clonedToken.document.x = this.x;\r\n\t\tthis.#clonedToken.document.y = this.y;\r\n\t\tthis.#clonedToken.document.rotation = this.#tokenRotation;\r\n\t\tthis.#clonedToken.document.alpha = this.crosshair.alpha;\r\n\t\tthis.#clonedToken.renderFlags.set({ refreshPosition: true, refreshRotation: true, refreshMesh: true });\r\n\t\tthis.#clonedToken.initializeSources();\r\n\t}\r\n\r\n\t/**\r\n\t * @override\r\n\t */\r\n\tasync draw() {\r\n\t\tthis.#clonedToken = this.crosshair.token.clone();\r\n\t\tthis.#tokenRotation = this.#clonedToken.document.rotation;\r\n\t\tthis.#clonedToken.visible = false;\r\n\t\tthis.layer.preview.addChild(this.#clonedToken);\r\n\t\tawait this.#clonedToken.draw().then(c => c.visible = true);\r\n\t\treturn super.draw();\r\n\t}\r\n\r\n\t_destroy(options = {}) {\r\n\t\tsuper._destroy(options);\r\n\t\tthis.#clonedToken?.destroy();\r\n\t}\r\n\r\n\tupdateDirection(evt) {\r\n\t\tif (this.crosshair.lockManualRotation) return;\r\n\t\tconst scrollDelta = Math.sign(evt.deltaY);\r\n\t\tlet delta = this.crosshair.snap.direction ? this.crosshair.snap.direction * scrollDelta : scrollDelta * 10;\r\n\t\tif (delta < 0) delta += 360;\r\n\t\tif (delta > 360) delta -= 360;\r\n\t\tthis.#tokenRotation += delta;\r\n\t}\r\n\r\n\t_onConfirm(evt) {\r\n\t\tevt.preventDefault();\r\n\t\tcanvas.mouseInteractionManager.cancel(evt);\r\n\t\tif (this.isDrag) {\r\n\t\t\tthis.isDrag = false;\r\n\t\t\tcanvas.mouseInteractionManager.reset({\r\n\t\t\t\tinteractionData: true,\r\n\t\t\t\tstate: false,\r\n\t\t\t});\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tthis.document.updateSource({\r\n\t\t\tdirection: this.#tokenRotation\r\n\t\t})\r\n\t\treturn super._onConfirm(evt);\r\n\t}\r\n}\r\n","import CrosshairsDocument from \"./CrosshairsDocument.js\";\r\nimport TokenCrosshairsDocument from \"./TokenCrosshairsDocument.js\";\r\nimport CONSTANTS from \"../../constants.js\";\r\nimport CrosshairsPlaceable from \"./CrosshairsPlaceable.js\";\r\n\r\nexport default class Crosshair {\r\n\r\n\tstatic PLACEMENT_RESTRICTIONS = CONSTANTS.PLACEMENT_RESTRICTIONS;\r\n\tstatic CALLBACKS = CONSTANTS.CALLBACKS;\r\n\r\n\t/**\r\n\t * Show a configurable crosshair\r\n\t *\r\n\t * @param {CrosshairData/Object} config\r\n\t * @param {CrosshairCallbackData/Object} callbacks\r\n\t * @returns {Promise}\r\n\t */\r\n\tstatic show(config = {}, callbacks = {}) {\r\n\r\n\t\tconst reticle = new CrosshairsDocument({\r\n\t\t\tt: config.t ?? CONST.MEASURED_TEMPLATE_TYPES.CIRCLE,\r\n\t\t\tdistance: config?.distance ?? canvas.grid.distance / 2,\r\n\t\t\twidth: config?.width ?? canvas.grid.distance,\r\n\t\t\tborderColor: config.borderColor ?? \"#000000\",\r\n\t\t\tfillColor: config.fillColor ?? game.user.color,\r\n\t\t\ttexture: config.texture,\r\n\t\t\tangle: config.angle ?? 53.13, // Default for Foundry, it seems?\r\n\t\t\tdirection: config.direction ?? 0\r\n\t\t}, {\r\n\t\t\tparent: canvas.scene\r\n\t\t}, foundry.utils.mergeObject(CrosshairsDocument.defaultConfig, config), callbacks);\r\n\r\n\t\treturn reticle.show();\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Show a configurable crosshair based a PlaceableObject\r\n\t *\r\n\t * @param {PlaceableObject} obj\r\n\t * @param {CrosshairData/Object} config\r\n\t * @param {CrosshairCallbackData/Object} callbacks\r\n\t * @returns {Promise}\r\n\t */\r\n\tstatic showToken(obj, config = {}, callbacks = {}) {\r\n\r\n\t\tconst placeable = obj instanceof foundry.canvas.placeables.PlaceableObject ? obj : obj.object;\r\n\r\n\t\tconst controlled = placeable.controlled;\r\n\t\tplaceable.release();\r\n\r\n\t\tconst reticle = new TokenCrosshairsDocument(placeable, {\r\n\t\t\tparent: canvas.scene\r\n\t\t}, config, callbacks);\r\n\r\n\t\treturn reticle.show().finally(() => {\r\n\t\t\tif (controlled) placeable.control()\r\n\t\t});\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * @param {CrosshairsDocument} crosshair\r\n\t * @param {String/Array<string>} types\r\n\t * @param {(object: PlaceableObject, crosshair: CrosshairsDocument, shape: PIXI.Graphics) => boolean} filterMethod\r\n\t * @returns {Array<Document>/Record<String, Array<Document>>}\r\n\t */\r\n\tstatic collect(crosshair, types = \"Token\", filterMethod = this.containsCenter) {\r\n\r\n\t\tconst typesArray = Array.isArray(types) ? types : [types];\r\n\t\tconst crosshairDoc = crosshair instanceof CrosshairsPlaceable ? crosshair.document : crosshair;\r\n\t\tconst shape = crosshairDoc.getCrosshairShape();\r\n\t\tshape.x = crosshair.x;\r\n\t\tshape.y = crosshair.y;\r\n\r\n\t\tconst result = typesArray.reduce((acc, embeddedName) => {\r\n\t\t\tconst collection = crosshairDoc.parent.getEmbeddedCollection(embeddedName);\r\n\r\n\t\t\tacc[embeddedName] = collection.filter((document) => {\r\n\t\t\t\treturn filterMethod(document.object, crosshairDoc, shape);\r\n\t\t\t});\r\n\t\t\treturn acc;\r\n\t\t}, {});\r\n\r\n\t\t/* if we are only collecting one kind of placeable, only return one kind of placeable */\r\n\t\treturn Array.isArray(types) ? result : result[types];\r\n\r\n\t}\r\n\r\n\tstatic containsCenter(placeable, crosshair, shape) {\r\n\t\treturn shape.contains(placeable.center.x, placeable.center.y);\r\n\t}\r\n\r\n}\r\n","<script>\r\n\r\n\tlet { foundryApp, component } = $props();\r\n\r\n</script>\r\n\r\n<div class=\"standard-form\">\r\n\t<section>\r\n\t\t<svelte:component this={component}/>\r\n\t</section>\r\n\t<footer class=\"form-footer\">\r\n\t\t<button onclick={() => foundryApp.close()} type=\"submit\"><i class=\"fas fa-check\"></i> Okay</button>\r\n\t</footer>\r\n</div>\r\n","import { SvelteApplicationMixin } from \"../SvelteMixin.js\";\r\nimport SvelteDialogShell from \"./svelte-dialog.svelte\";\r\n\r\nexport default class SvelteDialog extends SvelteApplicationMixin(foundry.applications.api.ApplicationV2) {\r\n\r\n\tstatic DEFAULT_OPTIONS = {\r\n\t\tposition: {\r\n\t\t\twidth: 500,\r\n\t\t\theight: \"auto\",\r\n\t\t},\r\n\t\twindow: {\r\n\t\t\ttitle: \"Sequencer\",\r\n\t\t\tresizable: false,\r\n\t\t},\r\n\t}\r\n\troot = SvelteDialogShell;\r\n}","/**\n * marked v14.1.4 - a markdown parser\n * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)\n * https://github.com/markedjs/marked\n */\n\n/**\n * DO NOT EDIT THIS FILE\n * The code in this file is generated from files in ./src/\n */\n\n/**\n * Gets the original marked default options.\n */\nfunction _getDefaults() {\n    return {\n        async: false,\n        breaks: false,\n        extensions: null,\n        gfm: true,\n        hooks: null,\n        pedantic: false,\n        renderer: null,\n        silent: false,\n        tokenizer: null,\n        walkTokens: null,\n    };\n}\nlet _defaults = _getDefaults();\nfunction changeDefaults(newDefaults) {\n    _defaults = newDefaults;\n}\n\n/**\n * Helpers\n */\nconst escapeTest = /[&<>\"']/;\nconst escapeReplace = new RegExp(escapeTest.source, 'g');\nconst escapeTestNoEncode = /[<>\"']|&(?!(#\\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\\w+);)/;\nconst escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');\nconst escapeReplacements = {\n    '&': '&amp;',\n    '<': '&lt;',\n    '>': '&gt;',\n    '\"': '&quot;',\n    \"'\": '&#39;',\n};\nconst getEscapeReplacement = (ch) => escapeReplacements[ch];\nfunction escape$1(html, encode) {\n    if (encode) {\n        if (escapeTest.test(html)) {\n            return html.replace(escapeReplace, getEscapeReplacement);\n        }\n    }\n    else {\n        if (escapeTestNoEncode.test(html)) {\n            return html.replace(escapeReplaceNoEncode, getEscapeReplacement);\n        }\n    }\n    return html;\n}\nconst caret = /(^|[^\\[])\\^/g;\nfunction edit(regex, opt) {\n    let source = typeof regex === 'string' ? regex : regex.source;\n    opt = opt || '';\n    const obj = {\n        replace: (name, val) => {\n            let valSource = typeof val === 'string' ? val : val.source;\n            valSource = valSource.replace(caret, '$1');\n            source = source.replace(name, valSource);\n            return obj;\n        },\n        getRegex: () => {\n            return new RegExp(source, opt);\n        },\n    };\n    return obj;\n}\nfunction cleanUrl(href) {\n    try {\n        href = encodeURI(href).replace(/%25/g, '%');\n    }\n    catch {\n        return null;\n    }\n    return href;\n}\nconst noopTest = { exec: () => null };\nfunction splitCells(tableRow, count) {\n    // ensure that every cell-delimiting pipe has a space\n    // before it to distinguish it from an escaped pipe\n    const row = tableRow.replace(/\\|/g, (match, offset, str) => {\n        let escaped = false;\n        let curr = offset;\n        while (--curr >= 0 && str[curr] === '\\\\')\n            escaped = !escaped;\n        if (escaped) {\n            // odd number of slashes means | is escaped\n            // so we leave it alone\n            return '|';\n        }\n        else {\n            // add space before unescaped |\n            return ' |';\n        }\n    }), cells = row.split(/ \\|/);\n    let i = 0;\n    // First/last cell in a row cannot be empty if it has no leading/trailing pipe\n    if (!cells[0].trim()) {\n        cells.shift();\n    }\n    if (cells.length > 0 && !cells[cells.length - 1].trim()) {\n        cells.pop();\n    }\n    if (count) {\n        if (cells.length > count) {\n            cells.splice(count);\n        }\n        else {\n            while (cells.length < count)\n                cells.push('');\n        }\n    }\n    for (; i < cells.length; i++) {\n        // leading or trailing whitespace is ignored per the gfm spec\n        cells[i] = cells[i].trim().replace(/\\\\\\|/g, '|');\n    }\n    return cells;\n}\n/**\n * Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').\n * /c*$/ is vulnerable to REDOS.\n *\n * @param str\n * @param c\n * @param invert Remove suffix of non-c chars instead. Default falsey.\n */\nfunction rtrim(str, c, invert) {\n    const l = str.length;\n    if (l === 0) {\n        return '';\n    }\n    // Length of suffix matching the invert condition.\n    let suffLen = 0;\n    // Step left until we fail to match the invert condition.\n    while (suffLen < l) {\n        const currChar = str.charAt(l - suffLen - 1);\n        if (currChar === c && !invert) {\n            suffLen++;\n        }\n        else if (currChar !== c && invert) {\n            suffLen++;\n        }\n        else {\n            break;\n        }\n    }\n    return str.slice(0, l - suffLen);\n}\nfunction findClosingBracket(str, b) {\n    if (str.indexOf(b[1]) === -1) {\n        return -1;\n    }\n    let level = 0;\n    for (let i = 0; i < str.length; i++) {\n        if (str[i] === '\\\\') {\n            i++;\n        }\n        else if (str[i] === b[0]) {\n            level++;\n        }\n        else if (str[i] === b[1]) {\n            level--;\n            if (level < 0) {\n                return i;\n            }\n        }\n    }\n    return -1;\n}\n\nfunction outputLink(cap, link, raw, lexer) {\n    const href = link.href;\n    const title = link.title ? escape$1(link.title) : null;\n    const text = cap[1].replace(/\\\\([\\[\\]])/g, '$1');\n    if (cap[0].charAt(0) !== '!') {\n        lexer.state.inLink = true;\n        const token = {\n            type: 'link',\n            raw,\n            href,\n            title,\n            text,\n            tokens: lexer.inlineTokens(text),\n        };\n        lexer.state.inLink = false;\n        return token;\n    }\n    return {\n        type: 'image',\n        raw,\n        href,\n        title,\n        text: escape$1(text),\n    };\n}\nfunction indentCodeCompensation(raw, text) {\n    const matchIndentToCode = raw.match(/^(\\s+)(?:```)/);\n    if (matchIndentToCode === null) {\n        return text;\n    }\n    const indentToCode = matchIndentToCode[1];\n    return text\n        .split('\\n')\n        .map(node => {\n        const matchIndentInNode = node.match(/^\\s+/);\n        if (matchIndentInNode === null) {\n            return node;\n        }\n        const [indentInNode] = matchIndentInNode;\n        if (indentInNode.length >= indentToCode.length) {\n            return node.slice(indentToCode.length);\n        }\n        return node;\n    })\n        .join('\\n');\n}\n/**\n * Tokenizer\n */\nclass _Tokenizer {\n    options;\n    rules; // set by the lexer\n    lexer; // set by the lexer\n    constructor(options) {\n        this.options = options || _defaults;\n    }\n    space(src) {\n        const cap = this.rules.block.newline.exec(src);\n        if (cap && cap[0].length > 0) {\n            return {\n                type: 'space',\n                raw: cap[0],\n            };\n        }\n    }\n    code(src) {\n        const cap = this.rules.block.code.exec(src);\n        if (cap) {\n            const text = cap[0].replace(/^(?: {1,4}| {0,3}\\t)/gm, '');\n            return {\n                type: 'code',\n                raw: cap[0],\n                codeBlockStyle: 'indented',\n                text: !this.options.pedantic\n                    ? rtrim(text, '\\n')\n                    : text,\n            };\n        }\n    }\n    fences(src) {\n        const cap = this.rules.block.fences.exec(src);\n        if (cap) {\n            const raw = cap[0];\n            const text = indentCodeCompensation(raw, cap[3] || '');\n            return {\n                type: 'code',\n                raw,\n                lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, '$1') : cap[2],\n                text,\n            };\n        }\n    }\n    heading(src) {\n        const cap = this.rules.block.heading.exec(src);\n        if (cap) {\n            let text = cap[2].trim();\n            // remove trailing #s\n            if (/#$/.test(text)) {\n                const trimmed = rtrim(text, '#');\n                if (this.options.pedantic) {\n                    text = trimmed.trim();\n                }\n                else if (!trimmed || / $/.test(trimmed)) {\n                    // CommonMark requires space before trailing #s\n                    text = trimmed.trim();\n                }\n            }\n            return {\n                type: 'heading',\n                raw: cap[0],\n                depth: cap[1].length,\n                text,\n                tokens: this.lexer.inline(text),\n            };\n        }\n    }\n    hr(src) {\n        const cap = this.rules.block.hr.exec(src);\n        if (cap) {\n            return {\n                type: 'hr',\n                raw: rtrim(cap[0], '\\n'),\n            };\n        }\n    }\n    blockquote(src) {\n        const cap = this.rules.block.blockquote.exec(src);\n        if (cap) {\n            let lines = rtrim(cap[0], '\\n').split('\\n');\n            let raw = '';\n            let text = '';\n            const tokens = [];\n            while (lines.length > 0) {\n                let inBlockquote = false;\n                const currentLines = [];\n                let i;\n                for (i = 0; i < lines.length; i++) {\n                    // get lines up to a continuation\n                    if (/^ {0,3}>/.test(lines[i])) {\n                        currentLines.push(lines[i]);\n                        inBlockquote = true;\n                    }\n                    else if (!inBlockquote) {\n                        currentLines.push(lines[i]);\n                    }\n                    else {\n                        break;\n                    }\n                }\n                lines = lines.slice(i);\n                const currentRaw = currentLines.join('\\n');\n                const currentText = currentRaw\n                    // precede setext continuation with 4 spaces so it isn't a setext\n                    .replace(/\\n {0,3}((?:=+|-+) *)(?=\\n|$)/g, '\\n    $1')\n                    .replace(/^ {0,3}>[ \\t]?/gm, '');\n                raw = raw ? `${raw}\\n${currentRaw}` : currentRaw;\n                text = text ? `${text}\\n${currentText}` : currentText;\n                // parse blockquote lines as top level tokens\n                // merge paragraphs if this is a continuation\n                const top = this.lexer.state.top;\n                this.lexer.state.top = true;\n                this.lexer.blockTokens(currentText, tokens, true);\n                this.lexer.state.top = top;\n                // if there is no continuation then we are done\n                if (lines.length === 0) {\n                    break;\n                }\n                const lastToken = tokens[tokens.length - 1];\n                if (lastToken?.type === 'code') {\n                    // blockquote continuation cannot be preceded by a code block\n                    break;\n                }\n                else if (lastToken?.type === 'blockquote') {\n                    // include continuation in nested blockquote\n                    const oldToken = lastToken;\n                    const newText = oldToken.raw + '\\n' + lines.join('\\n');\n                    const newToken = this.blockquote(newText);\n                    tokens[tokens.length - 1] = newToken;\n                    raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;\n                    text = text.substring(0, text.length - oldToken.text.length) + newToken.text;\n                    break;\n                }\n                else if (lastToken?.type === 'list') {\n                    // include continuation in nested list\n                    const oldToken = lastToken;\n                    const newText = oldToken.raw + '\\n' + lines.join('\\n');\n                    const newToken = this.list(newText);\n                    tokens[tokens.length - 1] = newToken;\n                    raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;\n                    text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;\n                    lines = newText.substring(tokens[tokens.length - 1].raw.length).split('\\n');\n                    continue;\n                }\n            }\n            return {\n                type: 'blockquote',\n                raw,\n                tokens,\n                text,\n            };\n        }\n    }\n    list(src) {\n        let cap = this.rules.block.list.exec(src);\n        if (cap) {\n            let bull = cap[1].trim();\n            const isordered = bull.length > 1;\n            const list = {\n                type: 'list',\n                raw: '',\n                ordered: isordered,\n                start: isordered ? +bull.slice(0, -1) : '',\n                loose: false,\n                items: [],\n            };\n            bull = isordered ? `\\\\d{1,9}\\\\${bull.slice(-1)}` : `\\\\${bull}`;\n            if (this.options.pedantic) {\n                bull = isordered ? bull : '[*+-]';\n            }\n            // Get next list item\n            const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\\t ][^\\\\n]*)?(?:\\\\n|$))`);\n            let endsWithBlankLine = false;\n            // Check if current bullet point can start a new List Item\n            while (src) {\n                let endEarly = false;\n                let raw = '';\n                let itemContents = '';\n                if (!(cap = itemRegex.exec(src))) {\n                    break;\n                }\n                if (this.rules.block.hr.test(src)) { // End list if bullet was actually HR (possibly move into itemRegex?)\n                    break;\n                }\n                raw = cap[0];\n                src = src.substring(raw.length);\n                let line = cap[2].split('\\n', 1)[0].replace(/^\\t+/, (t) => ' '.repeat(3 * t.length));\n                let nextLine = src.split('\\n', 1)[0];\n                let blankLine = !line.trim();\n                let indent = 0;\n                if (this.options.pedantic) {\n                    indent = 2;\n                    itemContents = line.trimStart();\n                }\n                else if (blankLine) {\n                    indent = cap[1].length + 1;\n                }\n                else {\n                    indent = cap[2].search(/[^ ]/); // Find first non-space char\n                    indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent\n                    itemContents = line.slice(indent);\n                    indent += cap[1].length;\n                }\n                if (blankLine && /^[ \\t]*$/.test(nextLine)) { // Items begin with at most one blank line\n                    raw += nextLine + '\\n';\n                    src = src.substring(nextLine.length + 1);\n                    endEarly = true;\n                }\n                if (!endEarly) {\n                    const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\\\d{1,9}[.)])((?:[ \\t][^\\\\n]*)?(?:\\\\n|$))`);\n                    const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\\\* *){3,})(?:\\\\n+|$)`);\n                    const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\\`\\`\\`|~~~)`);\n                    const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);\n                    const htmlBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, 'i');\n                    // Check if following lines should be included in List Item\n                    while (src) {\n                        const rawLine = src.split('\\n', 1)[0];\n                        let nextLineWithoutTabs;\n                        nextLine = rawLine;\n                        // Re-align to follow commonmark nesting rules\n                        if (this.options.pedantic) {\n                            nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, '  ');\n                            nextLineWithoutTabs = nextLine;\n                        }\n                        else {\n                            nextLineWithoutTabs = nextLine.replace(/\\t/g, '    ');\n                        }\n                        // End list item if found code fences\n                        if (fencesBeginRegex.test(nextLine)) {\n                            break;\n                        }\n                        // End list item if found start of new heading\n                        if (headingBeginRegex.test(nextLine)) {\n                            break;\n                        }\n                        // End list item if found start of html block\n                        if (htmlBeginRegex.test(nextLine)) {\n                            break;\n                        }\n                        // End list item if found start of new bullet\n                        if (nextBulletRegex.test(nextLine)) {\n                            break;\n                        }\n                        // Horizontal rule found\n                        if (hrRegex.test(nextLine)) {\n                            break;\n                        }\n                        if (nextLineWithoutTabs.search(/[^ ]/) >= indent || !nextLine.trim()) { // Dedent if possible\n                            itemContents += '\\n' + nextLineWithoutTabs.slice(indent);\n                        }\n                        else {\n                            // not enough indentation\n                            if (blankLine) {\n                                break;\n                            }\n                            // paragraph continuation unless last line was a different block level element\n                            if (line.replace(/\\t/g, '    ').search(/[^ ]/) >= 4) { // indented code block\n                                break;\n                            }\n                            if (fencesBeginRegex.test(line)) {\n                                break;\n                            }\n                            if (headingBeginRegex.test(line)) {\n                                break;\n                            }\n                            if (hrRegex.test(line)) {\n                                break;\n                            }\n                            itemContents += '\\n' + nextLine;\n                        }\n                        if (!blankLine && !nextLine.trim()) { // Check if current line is blank\n                            blankLine = true;\n                        }\n                        raw += rawLine + '\\n';\n                        src = src.substring(rawLine.length + 1);\n                        line = nextLineWithoutTabs.slice(indent);\n                    }\n                }\n                if (!list.loose) {\n                    // If the previous item ended with a blank line, the list is loose\n                    if (endsWithBlankLine) {\n                        list.loose = true;\n                    }\n                    else if (/\\n[ \\t]*\\n[ \\t]*$/.test(raw)) {\n                        endsWithBlankLine = true;\n                    }\n                }\n                let istask = null;\n                let ischecked;\n                // Check for task list items\n                if (this.options.gfm) {\n                    istask = /^\\[[ xX]\\] /.exec(itemContents);\n                    if (istask) {\n                        ischecked = istask[0] !== '[ ] ';\n                        itemContents = itemContents.replace(/^\\[[ xX]\\] +/, '');\n                    }\n                }\n                list.items.push({\n                    type: 'list_item',\n                    raw,\n                    task: !!istask,\n                    checked: ischecked,\n                    loose: false,\n                    text: itemContents,\n                    tokens: [],\n                });\n                list.raw += raw;\n            }\n            // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic\n            list.items[list.items.length - 1].raw = list.items[list.items.length - 1].raw.trimEnd();\n            list.items[list.items.length - 1].text = list.items[list.items.length - 1].text.trimEnd();\n            list.raw = list.raw.trimEnd();\n            // Item child tokens handled here at end because we needed to have the final item to trim it first\n            for (let i = 0; i < list.items.length; i++) {\n                this.lexer.state.top = false;\n                list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);\n                if (!list.loose) {\n                    // Check if list should be loose\n                    const spacers = list.items[i].tokens.filter(t => t.type === 'space');\n                    const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\\n.*\\n/.test(t.raw));\n                    list.loose = hasMultipleLineBreaks;\n                }\n            }\n            // Set all items to loose if list is loose\n            if (list.loose) {\n                for (let i = 0; i < list.items.length; i++) {\n                    list.items[i].loose = true;\n                }\n            }\n            return list;\n        }\n    }\n    html(src) {\n        const cap = this.rules.block.html.exec(src);\n        if (cap) {\n            const token = {\n                type: 'html',\n                block: true,\n                raw: cap[0],\n                pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',\n                text: cap[0],\n            };\n            return token;\n        }\n    }\n    def(src) {\n        const cap = this.rules.block.def.exec(src);\n        if (cap) {\n            const tag = cap[1].toLowerCase().replace(/\\s+/g, ' ');\n            const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline.anyPunctuation, '$1') : '';\n            const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, '$1') : cap[3];\n            return {\n                type: 'def',\n                tag,\n                raw: cap[0],\n                href,\n                title,\n            };\n        }\n    }\n    table(src) {\n        const cap = this.rules.block.table.exec(src);\n        if (!cap) {\n            return;\n        }\n        if (!/[:|]/.test(cap[2])) {\n            // delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading\n            return;\n        }\n        const headers = splitCells(cap[1]);\n        const aligns = cap[2].replace(/^\\||\\| *$/g, '').split('|');\n        const rows = cap[3] && cap[3].trim() ? cap[3].replace(/\\n[ \\t]*$/, '').split('\\n') : [];\n        const item = {\n            type: 'table',\n            raw: cap[0],\n            header: [],\n            align: [],\n            rows: [],\n        };\n        if (headers.length !== aligns.length) {\n            // header and align columns must be equal, rows can be different.\n            return;\n        }\n        for (const align of aligns) {\n            if (/^ *-+: *$/.test(align)) {\n                item.align.push('right');\n            }\n            else if (/^ *:-+: *$/.test(align)) {\n                item.align.push('center');\n            }\n            else if (/^ *:-+ *$/.test(align)) {\n                item.align.push('left');\n            }\n            else {\n                item.align.push(null);\n            }\n        }\n        for (let i = 0; i < headers.length; i++) {\n            item.header.push({\n                text: headers[i],\n                tokens: this.lexer.inline(headers[i]),\n                header: true,\n                align: item.align[i],\n            });\n        }\n        for (const row of rows) {\n            item.rows.push(splitCells(row, item.header.length).map((cell, i) => {\n                return {\n                    text: cell,\n                    tokens: this.lexer.inline(cell),\n                    header: false,\n                    align: item.align[i],\n                };\n            }));\n        }\n        return item;\n    }\n    lheading(src) {\n        const cap = this.rules.block.lheading.exec(src);\n        if (cap) {\n            return {\n                type: 'heading',\n                raw: cap[0],\n                depth: cap[2].charAt(0) === '=' ? 1 : 2,\n                text: cap[1],\n                tokens: this.lexer.inline(cap[1]),\n            };\n        }\n    }\n    paragraph(src) {\n        const cap = this.rules.block.paragraph.exec(src);\n        if (cap) {\n            const text = cap[1].charAt(cap[1].length - 1) === '\\n'\n                ? cap[1].slice(0, -1)\n                : cap[1];\n            return {\n                type: 'paragraph',\n                raw: cap[0],\n                text,\n                tokens: this.lexer.inline(text),\n            };\n        }\n    }\n    text(src) {\n        const cap = this.rules.block.text.exec(src);\n        if (cap) {\n            return {\n                type: 'text',\n                raw: cap[0],\n                text: cap[0],\n                tokens: this.lexer.inline(cap[0]),\n            };\n        }\n    }\n    escape(src) {\n        const cap = this.rules.inline.escape.exec(src);\n        if (cap) {\n            return {\n                type: 'escape',\n                raw: cap[0],\n                text: escape$1(cap[1]),\n            };\n        }\n    }\n    tag(src) {\n        const cap = this.rules.inline.tag.exec(src);\n        if (cap) {\n            if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {\n                this.lexer.state.inLink = true;\n            }\n            else if (this.lexer.state.inLink && /^<\\/a>/i.test(cap[0])) {\n                this.lexer.state.inLink = false;\n            }\n            if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\\s|>)/i.test(cap[0])) {\n                this.lexer.state.inRawBlock = true;\n            }\n            else if (this.lexer.state.inRawBlock && /^<\\/(pre|code|kbd|script)(\\s|>)/i.test(cap[0])) {\n                this.lexer.state.inRawBlock = false;\n            }\n            return {\n                type: 'html',\n                raw: cap[0],\n                inLink: this.lexer.state.inLink,\n                inRawBlock: this.lexer.state.inRawBlock,\n                block: false,\n                text: cap[0],\n            };\n        }\n    }\n    link(src) {\n        const cap = this.rules.inline.link.exec(src);\n        if (cap) {\n            const trimmedUrl = cap[2].trim();\n            if (!this.options.pedantic && /^</.test(trimmedUrl)) {\n                // commonmark requires matching angle brackets\n                if (!(/>$/.test(trimmedUrl))) {\n                    return;\n                }\n                // ending angle bracket cannot be escaped\n                const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\\\');\n                if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {\n                    return;\n                }\n            }\n            else {\n                // find closing parenthesis\n                const lastParenIndex = findClosingBracket(cap[2], '()');\n                if (lastParenIndex > -1) {\n                    const start = cap[0].indexOf('!') === 0 ? 5 : 4;\n                    const linkLen = start + cap[1].length + lastParenIndex;\n                    cap[2] = cap[2].substring(0, lastParenIndex);\n                    cap[0] = cap[0].substring(0, linkLen).trim();\n                    cap[3] = '';\n                }\n            }\n            let href = cap[2];\n            let title = '';\n            if (this.options.pedantic) {\n                // split pedantic href and title\n                const link = /^([^'\"]*[^\\s])\\s+(['\"])(.*)\\2/.exec(href);\n                if (link) {\n                    href = link[1];\n                    title = link[3];\n                }\n            }\n            else {\n                title = cap[3] ? cap[3].slice(1, -1) : '';\n            }\n            href = href.trim();\n            if (/^</.test(href)) {\n                if (this.options.pedantic && !(/>$/.test(trimmedUrl))) {\n                    // pedantic allows starting angle bracket without ending angle bracket\n                    href = href.slice(1);\n                }\n                else {\n                    href = href.slice(1, -1);\n                }\n            }\n            return outputLink(cap, {\n                href: href ? href.replace(this.rules.inline.anyPunctuation, '$1') : href,\n                title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title,\n            }, cap[0], this.lexer);\n        }\n    }\n    reflink(src, links) {\n        let cap;\n        if ((cap = this.rules.inline.reflink.exec(src))\n            || (cap = this.rules.inline.nolink.exec(src))) {\n            const linkString = (cap[2] || cap[1]).replace(/\\s+/g, ' ');\n            const link = links[linkString.toLowerCase()];\n            if (!link) {\n                const text = cap[0].charAt(0);\n                return {\n                    type: 'text',\n                    raw: text,\n                    text,\n                };\n            }\n            return outputLink(cap, link, cap[0], this.lexer);\n        }\n    }\n    emStrong(src, maskedSrc, prevChar = '') {\n        let match = this.rules.inline.emStrongLDelim.exec(src);\n        if (!match)\n            return;\n        // _ can't be between two alphanumerics. \\p{L}\\p{N} includes non-english alphabet/numbers as well\n        if (match[3] && prevChar.match(/[\\p{L}\\p{N}]/u))\n            return;\n        const nextChar = match[1] || match[2] || '';\n        if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {\n            // unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below)\n            const lLength = [...match[0]].length - 1;\n            let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;\n            const endReg = match[0][0] === '*' ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;\n            endReg.lastIndex = 0;\n            // Clip maskedSrc to same section of string as src (move to lexer?)\n            maskedSrc = maskedSrc.slice(-1 * src.length + lLength);\n            while ((match = endReg.exec(maskedSrc)) != null) {\n                rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];\n                if (!rDelim)\n                    continue; // skip single * in __abc*abc__\n                rLength = [...rDelim].length;\n                if (match[3] || match[4]) { // found another Left Delim\n                    delimTotal += rLength;\n                    continue;\n                }\n                else if (match[5] || match[6]) { // either Left or Right Delim\n                    if (lLength % 3 && !((lLength + rLength) % 3)) {\n                        midDelimTotal += rLength;\n                        continue; // CommonMark Emphasis Rules 9-10\n                    }\n                }\n                delimTotal -= rLength;\n                if (delimTotal > 0)\n                    continue; // Haven't found enough closing delimiters\n                // Remove extra characters. *a*** -> *a*\n                rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);\n                // char length can be >1 for unicode characters;\n                const lastCharLength = [...match[0]][0].length;\n                const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);\n                // Create `em` if smallest delimiter has odd char count. *a***\n                if (Math.min(lLength, rLength) % 2) {\n                    const text = raw.slice(1, -1);\n                    return {\n                        type: 'em',\n                        raw,\n                        text,\n                        tokens: this.lexer.inlineTokens(text),\n                    };\n                }\n                // Create 'strong' if smallest delimiter has even char count. **a***\n                const text = raw.slice(2, -2);\n                return {\n                    type: 'strong',\n                    raw,\n                    text,\n                    tokens: this.lexer.inlineTokens(text),\n                };\n            }\n        }\n    }\n    codespan(src) {\n        const cap = this.rules.inline.code.exec(src);\n        if (cap) {\n            let text = cap[2].replace(/\\n/g, ' ');\n            const hasNonSpaceChars = /[^ ]/.test(text);\n            const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);\n            if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {\n                text = text.substring(1, text.length - 1);\n            }\n            text = escape$1(text, true);\n            return {\n                type: 'codespan',\n                raw: cap[0],\n                text,\n            };\n        }\n    }\n    br(src) {\n        const cap = this.rules.inline.br.exec(src);\n        if (cap) {\n            return {\n                type: 'br',\n                raw: cap[0],\n            };\n        }\n    }\n    del(src) {\n        const cap = this.rules.inline.del.exec(src);\n        if (cap) {\n            return {\n                type: 'del',\n                raw: cap[0],\n                text: cap[2],\n                tokens: this.lexer.inlineTokens(cap[2]),\n            };\n        }\n    }\n    autolink(src) {\n        const cap = this.rules.inline.autolink.exec(src);\n        if (cap) {\n            let text, href;\n            if (cap[2] === '@') {\n                text = escape$1(cap[1]);\n                href = 'mailto:' + text;\n            }\n            else {\n                text = escape$1(cap[1]);\n                href = text;\n            }\n            return {\n                type: 'link',\n                raw: cap[0],\n                text,\n                href,\n                tokens: [\n                    {\n                        type: 'text',\n                        raw: text,\n                        text,\n                    },\n                ],\n            };\n        }\n    }\n    url(src) {\n        let cap;\n        if (cap = this.rules.inline.url.exec(src)) {\n            let text, href;\n            if (cap[2] === '@') {\n                text = escape$1(cap[0]);\n                href = 'mailto:' + text;\n            }\n            else {\n                // do extended autolink path validation\n                let prevCapZero;\n                do {\n                    prevCapZero = cap[0];\n                    cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? '';\n                } while (prevCapZero !== cap[0]);\n                text = escape$1(cap[0]);\n                if (cap[1] === 'www.') {\n                    href = 'http://' + cap[0];\n                }\n                else {\n                    href = cap[0];\n                }\n            }\n            return {\n                type: 'link',\n                raw: cap[0],\n                text,\n                href,\n                tokens: [\n                    {\n                        type: 'text',\n                        raw: text,\n                        text,\n                    },\n                ],\n            };\n        }\n    }\n    inlineText(src) {\n        const cap = this.rules.inline.text.exec(src);\n        if (cap) {\n            let text;\n            if (this.lexer.state.inRawBlock) {\n                text = cap[0];\n            }\n            else {\n                text = escape$1(cap[0]);\n            }\n            return {\n                type: 'text',\n                raw: cap[0],\n                text,\n            };\n        }\n    }\n}\n\n/**\n * Block-Level Grammar\n */\nconst newline = /^(?:[ \\t]*(?:\\n|$))+/;\nconst blockCode = /^((?: {4}| {0,3}\\t)[^\\n]+(?:\\n(?:[ \\t]*(?:\\n|$))*)?)+/;\nconst fences = /^ {0,3}(`{3,}(?=[^`\\n]*(?:\\n|$))|~{3,})([^\\n]*)(?:\\n|$)(?:|([\\s\\S]*?)(?:\\n|$))(?: {0,3}\\1[~`]* *(?=\\n|$)|$)/;\nconst hr = /^ {0,3}((?:-[\\t ]*){3,}|(?:_[ \\t]*){3,}|(?:\\*[ \\t]*){3,})(?:\\n+|$)/;\nconst heading = /^ {0,3}(#{1,6})(?=\\s|$)(.*)(?:\\n+|$)/;\nconst bullet = /(?:[*+-]|\\d{1,9}[.)])/;\nconst lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\\n(?!\\s*?\\n|bull |blockCode|fences|blockquote|heading|html))+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/)\n    .replace(/bull/g, bullet) // lists can interrupt\n    .replace(/blockCode/g, /(?: {4}| {0,3}\\t)/) // indented code blocks can interrupt\n    .replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt\n    .replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt\n    .replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt\n    .replace(/html/g, / {0,3}<[^\\n>]+>\\n/) // block html can interrupt\n    .getRegex();\nconst _paragraph = /^([^\\n]+(?:\\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\\n)[^\\n]+)*)/;\nconst blockText = /^[^\\n]+/;\nconst _blockLabel = /(?!\\s*\\])(?:\\\\.|[^\\[\\]\\\\])+/;\nconst def = edit(/^ {0,3}\\[(label)\\]: *(?:\\n[ \\t]*)?([^<\\s][^\\s]*|<.*?>)(?:(?: +(?:\\n[ \\t]*)?| *\\n[ \\t]*)(title))? *(?:\\n+|$)/)\n    .replace('label', _blockLabel)\n    .replace('title', /(?:\"(?:\\\\\"?|[^\"\\\\])*\"|'[^'\\n]*(?:\\n[^'\\n]+)*\\n?'|\\([^()]*\\))/)\n    .getRegex();\nconst list = edit(/^( {0,3}bull)([ \\t][^\\n]+?)?(?:\\n|$)/)\n    .replace(/bull/g, bullet)\n    .getRegex();\nconst _tag = 'address|article|aside|base|basefont|blockquote|body|caption'\n    + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'\n    + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'\n    + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'\n    + '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title'\n    + '|tr|track|ul';\nconst _comment = /<!--(?:-?>|[\\s\\S]*?(?:-->|$))/;\nconst html = edit('^ {0,3}(?:' // optional indentation\n    + '<(script|pre|style|textarea)[\\\\s>][\\\\s\\\\S]*?(?:</\\\\1>[^\\\\n]*\\\\n+|$)' // (1)\n    + '|comment[^\\\\n]*(\\\\n+|$)' // (2)\n    + '|<\\\\?[\\\\s\\\\S]*?(?:\\\\?>\\\\n*|$)' // (3)\n    + '|<![A-Z][\\\\s\\\\S]*?(?:>\\\\n*|$)' // (4)\n    + '|<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?(?:\\\\]\\\\]>\\\\n*|$)' // (5)\n    + '|</?(tag)(?: +|\\\\n|/?>)[\\\\s\\\\S]*?(?:(?:\\\\n[ \\t]*)+\\\\n|$)' // (6)\n    + '|<(?!script|pre|style|textarea)([a-z][\\\\w-]*)(?:attribute)*? */?>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n[ \\t]*)+\\\\n|$)' // (7) open tag\n    + '|</(?!script|pre|style|textarea)[a-z][\\\\w-]*\\\\s*>(?=[ \\\\t]*(?:\\\\n|$))[\\\\s\\\\S]*?(?:(?:\\\\n[ \\t]*)+\\\\n|$)' // (7) closing tag\n    + ')', 'i')\n    .replace('comment', _comment)\n    .replace('tag', _tag)\n    .replace('attribute', / +[a-zA-Z:_][\\w.:-]*(?: *= *\"[^\"\\n]*\"| *= *'[^'\\n]*'| *= *[^\\s\"'=<>`]+)?/)\n    .getRegex();\nconst paragraph = edit(_paragraph)\n    .replace('hr', hr)\n    .replace('heading', ' {0,3}#{1,6}(?:\\\\s|$)')\n    .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs\n    .replace('|table', '')\n    .replace('blockquote', ' {0,3}>')\n    .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n')\n    .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt\n    .replace('html', '</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)')\n    .replace('tag', _tag) // pars can be interrupted by type (6) html blocks\n    .getRegex();\nconst blockquote = edit(/^( {0,3}> ?(paragraph|[^\\n]*)(?:\\n|$))+/)\n    .replace('paragraph', paragraph)\n    .getRegex();\n/**\n * Normal Block Grammar\n */\nconst blockNormal = {\n    blockquote,\n    code: blockCode,\n    def,\n    fences,\n    heading,\n    hr,\n    html,\n    lheading,\n    list,\n    newline,\n    paragraph,\n    table: noopTest,\n    text: blockText,\n};\n/**\n * GFM Block Grammar\n */\nconst gfmTable = edit('^ *([^\\\\n ].*)\\\\n' // Header\n    + ' {0,3}((?:\\\\| *)?:?-+:? *(?:\\\\| *:?-+:? *)*(?:\\\\| *)?)' // Align\n    + '(?:\\\\n((?:(?! *\\\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\\\n|$))*)\\\\n*|$)') // Cells\n    .replace('hr', hr)\n    .replace('heading', ' {0,3}#{1,6}(?:\\\\s|$)')\n    .replace('blockquote', ' {0,3}>')\n    .replace('code', '(?: {4}| {0,3}\\t)[^\\\\n]')\n    .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n')\n    .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt\n    .replace('html', '</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)')\n    .replace('tag', _tag) // tables can be interrupted by type (6) html blocks\n    .getRegex();\nconst blockGfm = {\n    ...blockNormal,\n    table: gfmTable,\n    paragraph: edit(_paragraph)\n        .replace('hr', hr)\n        .replace('heading', ' {0,3}#{1,6}(?:\\\\s|$)')\n        .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs\n        .replace('table', gfmTable) // interrupt paragraphs with table\n        .replace('blockquote', ' {0,3}>')\n        .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\\\n]*\\\\n)|~{3,})[^\\\\n]*\\\\n')\n        .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt\n        .replace('html', '</?(?:tag)(?: +|\\\\n|/?>)|<(?:script|pre|style|textarea|!--)')\n        .replace('tag', _tag) // pars can be interrupted by type (6) html blocks\n        .getRegex(),\n};\n/**\n * Pedantic grammar (original John Gruber's loose markdown specification)\n */\nconst blockPedantic = {\n    ...blockNormal,\n    html: edit('^ *(?:comment *(?:\\\\n|\\\\s*$)'\n        + '|<(tag)[\\\\s\\\\S]+?</\\\\1> *(?:\\\\n{2,}|\\\\s*$)' // closed tag\n        + '|<tag(?:\"[^\"]*\"|\\'[^\\']*\\'|\\\\s[^\\'\"/>\\\\s]*)*?/?> *(?:\\\\n{2,}|\\\\s*$))')\n        .replace('comment', _comment)\n        .replace(/tag/g, '(?!(?:'\n        + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'\n        + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'\n        + '\\\\b)\\\\w+(?!:|[^\\\\w\\\\s@]*@)\\\\b')\n        .getRegex(),\n    def: /^ *\\[([^\\]]+)\\]: *<?([^\\s>]+)>?(?: +([\"(][^\\n]+[\")]))? *(?:\\n+|$)/,\n    heading: /^(#{1,6})(.*)(?:\\n+|$)/,\n    fences: noopTest, // fences not supported\n    lheading: /^(.+?)\\n {0,3}(=+|-+) *(?:\\n+|$)/,\n    paragraph: edit(_paragraph)\n        .replace('hr', hr)\n        .replace('heading', ' *#{1,6} *[^\\n]')\n        .replace('lheading', lheading)\n        .replace('|table', '')\n        .replace('blockquote', ' {0,3}>')\n        .replace('|fences', '')\n        .replace('|list', '')\n        .replace('|html', '')\n        .replace('|tag', '')\n        .getRegex(),\n};\n/**\n * Inline-Level Grammar\n */\nconst escape = /^\\\\([!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_`{|}~])/;\nconst inlineCode = /^(`+)([^`]|[^`][\\s\\S]*?[^`])\\1(?!`)/;\nconst br = /^( {2,}|\\\\)\\n(?!\\s*$)/;\nconst inlineText = /^(`+|[^`])(?:(?= {2,}\\n)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*_]|\\b_|$)|[^ ](?= {2,}\\n)))/;\n// list of unicode punctuation marks, plus any missing characters from CommonMark spec\nconst _punctuation = '\\\\p{P}\\\\p{S}';\nconst punctuation = edit(/^((?![*_])[\\spunctuation])/, 'u')\n    .replace(/punctuation/g, _punctuation).getRegex();\n// sequences em should skip over [title](link), `code`, <html>\nconst blockSkip = /\\[[^[\\]]*?\\]\\((?:\\\\.|[^\\\\\\(\\)]|\\((?:\\\\.|[^\\\\\\(\\)])*\\))*\\)|`[^`]*?`|<[^<>]*?>/g;\nconst emStrongLDelim = edit(/^(?:\\*+(?:((?!\\*)[punct])|[^\\s*]))|^_+(?:((?!_)[punct])|([^\\s_]))/, 'u')\n    .replace(/punct/g, _punctuation)\n    .getRegex();\nconst emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\\\*[^_*]*?(?=__)' // Skip orphan inside strong\n    + '|[^*]+(?=[^*])' // Consume to delim\n    + '|(?!\\\\*)[punct](\\\\*+)(?=[\\\\s]|$)' // (1) #*** can only be a Right Delimiter\n    + '|[^punct\\\\s](\\\\*+)(?!\\\\*)(?=[punct\\\\s]|$)' // (2) a***#, a*** can only be a Right Delimiter\n    + '|(?!\\\\*)[punct\\\\s](\\\\*+)(?=[^punct\\\\s])' // (3) #***a, ***a can only be Left Delimiter\n    + '|[\\\\s](\\\\*+)(?!\\\\*)(?=[punct])' // (4) ***# can only be Left Delimiter\n    + '|(?!\\\\*)[punct](\\\\*+)(?!\\\\*)(?=[punct])' // (5) #***# can be either Left or Right Delimiter\n    + '|[^punct\\\\s](\\\\*+)(?=[^punct\\\\s])', 'gu') // (6) a***a can be either Left or Right Delimiter\n    .replace(/punct/g, _punctuation)\n    .getRegex();\n// (6) Not allowed for _\nconst emStrongRDelimUnd = edit('^[^_*]*?\\\\*\\\\*[^_*]*?_[^_*]*?(?=\\\\*\\\\*)' // Skip orphan inside strong\n    + '|[^_]+(?=[^_])' // Consume to delim\n    + '|(?!_)[punct](_+)(?=[\\\\s]|$)' // (1) #___ can only be a Right Delimiter\n    + '|[^punct\\\\s](_+)(?!_)(?=[punct\\\\s]|$)' // (2) a___#, a___ can only be a Right Delimiter\n    + '|(?!_)[punct\\\\s](_+)(?=[^punct\\\\s])' // (3) #___a, ___a can only be Left Delimiter\n    + '|[\\\\s](_+)(?!_)(?=[punct])' // (4) ___# can only be Left Delimiter\n    + '|(?!_)[punct](_+)(?!_)(?=[punct])', 'gu') // (5) #___# can be either Left or Right Delimiter\n    .replace(/punct/g, _punctuation)\n    .getRegex();\nconst anyPunctuation = edit(/\\\\([punct])/, 'gu')\n    .replace(/punct/g, _punctuation)\n    .getRegex();\nconst autolink = edit(/^<(scheme:[^\\s\\x00-\\x1f<>]*|email)>/)\n    .replace('scheme', /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/)\n    .replace('email', /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/)\n    .getRegex();\nconst _inlineComment = edit(_comment).replace('(?:-->|$)', '-->').getRegex();\nconst tag = edit('^comment'\n    + '|^</[a-zA-Z][\\\\w:-]*\\\\s*>' // self-closing tag\n    + '|^<[a-zA-Z][\\\\w-]*(?:attribute)*?\\\\s*/?>' // open tag\n    + '|^<\\\\?[\\\\s\\\\S]*?\\\\?>' // processing instruction, e.g. <?php ?>\n    + '|^<![a-zA-Z]+\\\\s[\\\\s\\\\S]*?>' // declaration, e.g. <!DOCTYPE html>\n    + '|^<!\\\\[CDATA\\\\[[\\\\s\\\\S]*?\\\\]\\\\]>') // CDATA section\n    .replace('comment', _inlineComment)\n    .replace('attribute', /\\s+[a-zA-Z:_][\\w.:-]*(?:\\s*=\\s*\"[^\"]*\"|\\s*=\\s*'[^']*'|\\s*=\\s*[^\\s\"'=<>`]+)?/)\n    .getRegex();\nconst _inlineLabel = /(?:\\[(?:\\\\.|[^\\[\\]\\\\])*\\]|\\\\.|`[^`]*`|[^\\[\\]\\\\`])*?/;\nconst link = edit(/^!?\\[(label)\\]\\(\\s*(href)(?:\\s+(title))?\\s*\\)/)\n    .replace('label', _inlineLabel)\n    .replace('href', /<(?:\\\\.|[^\\n<>\\\\])+>|[^\\s\\x00-\\x1f]*/)\n    .replace('title', /\"(?:\\\\\"?|[^\"\\\\])*\"|'(?:\\\\'?|[^'\\\\])*'|\\((?:\\\\\\)?|[^)\\\\])*\\)/)\n    .getRegex();\nconst reflink = edit(/^!?\\[(label)\\]\\[(ref)\\]/)\n    .replace('label', _inlineLabel)\n    .replace('ref', _blockLabel)\n    .getRegex();\nconst nolink = edit(/^!?\\[(ref)\\](?:\\[\\])?/)\n    .replace('ref', _blockLabel)\n    .getRegex();\nconst reflinkSearch = edit('reflink|nolink(?!\\\\()', 'g')\n    .replace('reflink', reflink)\n    .replace('nolink', nolink)\n    .getRegex();\n/**\n * Normal Inline Grammar\n */\nconst inlineNormal = {\n    _backpedal: noopTest, // only used for GFM url\n    anyPunctuation,\n    autolink,\n    blockSkip,\n    br,\n    code: inlineCode,\n    del: noopTest,\n    emStrongLDelim,\n    emStrongRDelimAst,\n    emStrongRDelimUnd,\n    escape,\n    link,\n    nolink,\n    punctuation,\n    reflink,\n    reflinkSearch,\n    tag,\n    text: inlineText,\n    url: noopTest,\n};\n/**\n * Pedantic Inline Grammar\n */\nconst inlinePedantic = {\n    ...inlineNormal,\n    link: edit(/^!?\\[(label)\\]\\((.*?)\\)/)\n        .replace('label', _inlineLabel)\n        .getRegex(),\n    reflink: edit(/^!?\\[(label)\\]\\s*\\[([^\\]]*)\\]/)\n        .replace('label', _inlineLabel)\n        .getRegex(),\n};\n/**\n * GFM Inline Grammar\n */\nconst inlineGfm = {\n    ...inlineNormal,\n    escape: edit(escape).replace('])', '~|])').getRegex(),\n    url: edit(/^((?:ftp|https?):\\/\\/|www\\.)(?:[a-zA-Z0-9\\-]+\\.?)+[^\\s<]*|^email/, 'i')\n        .replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)\n        .getRegex(),\n    _backpedal: /(?:[^?!.,:;*_'\"~()&]+|\\([^)]*\\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'\"~)]+(?!$))+/,\n    del: /^(~~?)(?=[^\\s~])((?:\\\\.|[^\\\\])*?(?:\\\\.|[^\\s~\\\\]))\\1(?=[^~]|$)/,\n    text: /^([`~]+|[^`~])(?:(?= {2,}\\n)|(?=[a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-]+@)|[\\s\\S]*?(?:(?=[\\\\<!\\[`*~_]|\\b_|https?:\\/\\/|ftp:\\/\\/|www\\.|$)|[^ ](?= {2,}\\n)|[^a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-](?=[a-zA-Z0-9.!#$%&'*+\\/=?_`{\\|}~-]+@)))/,\n};\n/**\n * GFM + Line Breaks Inline Grammar\n */\nconst inlineBreaks = {\n    ...inlineGfm,\n    br: edit(br).replace('{2,}', '*').getRegex(),\n    text: edit(inlineGfm.text)\n        .replace('\\\\b_', '\\\\b_| {2,}\\\\n')\n        .replace(/\\{2,\\}/g, '*')\n        .getRegex(),\n};\n/**\n * exports\n */\nconst block = {\n    normal: blockNormal,\n    gfm: blockGfm,\n    pedantic: blockPedantic,\n};\nconst inline = {\n    normal: inlineNormal,\n    gfm: inlineGfm,\n    breaks: inlineBreaks,\n    pedantic: inlinePedantic,\n};\n\n/**\n * Block Lexer\n */\nclass _Lexer {\n    tokens;\n    options;\n    state;\n    tokenizer;\n    inlineQueue;\n    constructor(options) {\n        // TokenList cannot be created in one go\n        this.tokens = [];\n        this.tokens.links = Object.create(null);\n        this.options = options || _defaults;\n        this.options.tokenizer = this.options.tokenizer || new _Tokenizer();\n        this.tokenizer = this.options.tokenizer;\n        this.tokenizer.options = this.options;\n        this.tokenizer.lexer = this;\n        this.inlineQueue = [];\n        this.state = {\n            inLink: false,\n            inRawBlock: false,\n            top: true,\n        };\n        const rules = {\n            block: block.normal,\n            inline: inline.normal,\n        };\n        if (this.options.pedantic) {\n            rules.block = block.pedantic;\n            rules.inline = inline.pedantic;\n        }\n        else if (this.options.gfm) {\n            rules.block = block.gfm;\n            if (this.options.breaks) {\n                rules.inline = inline.breaks;\n            }\n            else {\n                rules.inline = inline.gfm;\n            }\n        }\n        this.tokenizer.rules = rules;\n    }\n    /**\n     * Expose Rules\n     */\n    static get rules() {\n        return {\n            block,\n            inline,\n        };\n    }\n    /**\n     * Static Lex Method\n     */\n    static lex(src, options) {\n        const lexer = new _Lexer(options);\n        return lexer.lex(src);\n    }\n    /**\n     * Static Lex Inline Method\n     */\n    static lexInline(src, options) {\n        const lexer = new _Lexer(options);\n        return lexer.inlineTokens(src);\n    }\n    /**\n     * Preprocessing\n     */\n    lex(src) {\n        src = src\n            .replace(/\\r\\n|\\r/g, '\\n');\n        this.blockTokens(src, this.tokens);\n        for (let i = 0; i < this.inlineQueue.length; i++) {\n            const next = this.inlineQueue[i];\n            this.inlineTokens(next.src, next.tokens);\n        }\n        this.inlineQueue = [];\n        return this.tokens;\n    }\n    blockTokens(src, tokens = [], lastParagraphClipped = false) {\n        if (this.options.pedantic) {\n            src = src.replace(/\\t/g, '    ').replace(/^ +$/gm, '');\n        }\n        let token;\n        let lastToken;\n        let cutSrc;\n        while (src) {\n            if (this.options.extensions\n                && this.options.extensions.block\n                && this.options.extensions.block.some((extTokenizer) => {\n                    if (token = extTokenizer.call({ lexer: this }, src, tokens)) {\n                        src = src.substring(token.raw.length);\n                        tokens.push(token);\n                        return true;\n                    }\n                    return false;\n                })) {\n                continue;\n            }\n            // newline\n            if (token = this.tokenizer.space(src)) {\n                src = src.substring(token.raw.length);\n                if (token.raw.length === 1 && tokens.length > 0) {\n                    // if there's a single \\n as a spacer, it's terminating the last line,\n                    // so move it there so that we don't get unnecessary paragraph tags\n                    tokens[tokens.length - 1].raw += '\\n';\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            // code\n            if (token = this.tokenizer.code(src)) {\n                src = src.substring(token.raw.length);\n                lastToken = tokens[tokens.length - 1];\n                // An indented code block cannot interrupt a paragraph.\n                if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {\n                    lastToken.raw += '\\n' + token.raw;\n                    lastToken.text += '\\n' + token.text;\n                    this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            // fences\n            if (token = this.tokenizer.fences(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // heading\n            if (token = this.tokenizer.heading(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // hr\n            if (token = this.tokenizer.hr(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // blockquote\n            if (token = this.tokenizer.blockquote(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // list\n            if (token = this.tokenizer.list(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // html\n            if (token = this.tokenizer.html(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // def\n            if (token = this.tokenizer.def(src)) {\n                src = src.substring(token.raw.length);\n                lastToken = tokens[tokens.length - 1];\n                if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {\n                    lastToken.raw += '\\n' + token.raw;\n                    lastToken.text += '\\n' + token.raw;\n                    this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n                }\n                else if (!this.tokens.links[token.tag]) {\n                    this.tokens.links[token.tag] = {\n                        href: token.href,\n                        title: token.title,\n                    };\n                }\n                continue;\n            }\n            // table (gfm)\n            if (token = this.tokenizer.table(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // lheading\n            if (token = this.tokenizer.lheading(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // top-level paragraph\n            // prevent paragraph consuming extensions by clipping 'src' to extension start\n            cutSrc = src;\n            if (this.options.extensions && this.options.extensions.startBlock) {\n                let startIndex = Infinity;\n                const tempSrc = src.slice(1);\n                let tempStart;\n                this.options.extensions.startBlock.forEach((getStartIndex) => {\n                    tempStart = getStartIndex.call({ lexer: this }, tempSrc);\n                    if (typeof tempStart === 'number' && tempStart >= 0) {\n                        startIndex = Math.min(startIndex, tempStart);\n                    }\n                });\n                if (startIndex < Infinity && startIndex >= 0) {\n                    cutSrc = src.substring(0, startIndex + 1);\n                }\n            }\n            if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {\n                lastToken = tokens[tokens.length - 1];\n                if (lastParagraphClipped && lastToken?.type === 'paragraph') {\n                    lastToken.raw += '\\n' + token.raw;\n                    lastToken.text += '\\n' + token.text;\n                    this.inlineQueue.pop();\n                    this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                lastParagraphClipped = (cutSrc.length !== src.length);\n                src = src.substring(token.raw.length);\n                continue;\n            }\n            // text\n            if (token = this.tokenizer.text(src)) {\n                src = src.substring(token.raw.length);\n                lastToken = tokens[tokens.length - 1];\n                if (lastToken && lastToken.type === 'text') {\n                    lastToken.raw += '\\n' + token.raw;\n                    lastToken.text += '\\n' + token.text;\n                    this.inlineQueue.pop();\n                    this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            if (src) {\n                const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);\n                if (this.options.silent) {\n                    console.error(errMsg);\n                    break;\n                }\n                else {\n                    throw new Error(errMsg);\n                }\n            }\n        }\n        this.state.top = true;\n        return tokens;\n    }\n    inline(src, tokens = []) {\n        this.inlineQueue.push({ src, tokens });\n        return tokens;\n    }\n    /**\n     * Lexing/Compiling\n     */\n    inlineTokens(src, tokens = []) {\n        let token, lastToken, cutSrc;\n        // String with links masked to avoid interference with em and strong\n        let maskedSrc = src;\n        let match;\n        let keepPrevChar, prevChar;\n        // Mask out reflinks\n        if (this.tokens.links) {\n            const links = Object.keys(this.tokens.links);\n            if (links.length > 0) {\n                while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {\n                    if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {\n                        maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);\n                    }\n                }\n            }\n        }\n        // Mask out other blocks\n        while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {\n            maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);\n        }\n        // Mask out escaped characters\n        while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {\n            maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);\n        }\n        while (src) {\n            if (!keepPrevChar) {\n                prevChar = '';\n            }\n            keepPrevChar = false;\n            // extensions\n            if (this.options.extensions\n                && this.options.extensions.inline\n                && this.options.extensions.inline.some((extTokenizer) => {\n                    if (token = extTokenizer.call({ lexer: this }, src, tokens)) {\n                        src = src.substring(token.raw.length);\n                        tokens.push(token);\n                        return true;\n                    }\n                    return false;\n                })) {\n                continue;\n            }\n            // escape\n            if (token = this.tokenizer.escape(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // tag\n            if (token = this.tokenizer.tag(src)) {\n                src = src.substring(token.raw.length);\n                lastToken = tokens[tokens.length - 1];\n                if (lastToken && token.type === 'text' && lastToken.type === 'text') {\n                    lastToken.raw += token.raw;\n                    lastToken.text += token.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            // link\n            if (token = this.tokenizer.link(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // reflink, nolink\n            if (token = this.tokenizer.reflink(src, this.tokens.links)) {\n                src = src.substring(token.raw.length);\n                lastToken = tokens[tokens.length - 1];\n                if (lastToken && token.type === 'text' && lastToken.type === 'text') {\n                    lastToken.raw += token.raw;\n                    lastToken.text += token.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            // em & strong\n            if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // code\n            if (token = this.tokenizer.codespan(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // br\n            if (token = this.tokenizer.br(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // del (gfm)\n            if (token = this.tokenizer.del(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // autolink\n            if (token = this.tokenizer.autolink(src)) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // url (gfm)\n            if (!this.state.inLink && (token = this.tokenizer.url(src))) {\n                src = src.substring(token.raw.length);\n                tokens.push(token);\n                continue;\n            }\n            // text\n            // prevent inlineText consuming extensions by clipping 'src' to extension start\n            cutSrc = src;\n            if (this.options.extensions && this.options.extensions.startInline) {\n                let startIndex = Infinity;\n                const tempSrc = src.slice(1);\n                let tempStart;\n                this.options.extensions.startInline.forEach((getStartIndex) => {\n                    tempStart = getStartIndex.call({ lexer: this }, tempSrc);\n                    if (typeof tempStart === 'number' && tempStart >= 0) {\n                        startIndex = Math.min(startIndex, tempStart);\n                    }\n                });\n                if (startIndex < Infinity && startIndex >= 0) {\n                    cutSrc = src.substring(0, startIndex + 1);\n                }\n            }\n            if (token = this.tokenizer.inlineText(cutSrc)) {\n                src = src.substring(token.raw.length);\n                if (token.raw.slice(-1) !== '_') { // Track prevChar before string of ____ started\n                    prevChar = token.raw.slice(-1);\n                }\n                keepPrevChar = true;\n                lastToken = tokens[tokens.length - 1];\n                if (lastToken && lastToken.type === 'text') {\n                    lastToken.raw += token.raw;\n                    lastToken.text += token.text;\n                }\n                else {\n                    tokens.push(token);\n                }\n                continue;\n            }\n            if (src) {\n                const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);\n                if (this.options.silent) {\n                    console.error(errMsg);\n                    break;\n                }\n                else {\n                    throw new Error(errMsg);\n                }\n            }\n        }\n        return tokens;\n    }\n}\n\n/**\n * Renderer\n */\nclass _Renderer {\n    options;\n    parser; // set by the parser\n    constructor(options) {\n        this.options = options || _defaults;\n    }\n    space(token) {\n        return '';\n    }\n    code({ text, lang, escaped }) {\n        const langString = (lang || '').match(/^\\S*/)?.[0];\n        const code = text.replace(/\\n$/, '') + '\\n';\n        if (!langString) {\n            return '<pre><code>'\n                + (escaped ? code : escape$1(code, true))\n                + '</code></pre>\\n';\n        }\n        return '<pre><code class=\"language-'\n            + escape$1(langString)\n            + '\">'\n            + (escaped ? code : escape$1(code, true))\n            + '</code></pre>\\n';\n    }\n    blockquote({ tokens }) {\n        const body = this.parser.parse(tokens);\n        return `<blockquote>\\n${body}</blockquote>\\n`;\n    }\n    html({ text }) {\n        return text;\n    }\n    heading({ tokens, depth }) {\n        return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>\\n`;\n    }\n    hr(token) {\n        return '<hr>\\n';\n    }\n    list(token) {\n        const ordered = token.ordered;\n        const start = token.start;\n        let body = '';\n        for (let j = 0; j < token.items.length; j++) {\n            const item = token.items[j];\n            body += this.listitem(item);\n        }\n        const type = ordered ? 'ol' : 'ul';\n        const startAttr = (ordered && start !== 1) ? (' start=\"' + start + '\"') : '';\n        return '<' + type + startAttr + '>\\n' + body + '</' + type + '>\\n';\n    }\n    listitem(item) {\n        let itemBody = '';\n        if (item.task) {\n            const checkbox = this.checkbox({ checked: !!item.checked });\n            if (item.loose) {\n                if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {\n                    item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;\n                    if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {\n                        item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;\n                    }\n                }\n                else {\n                    item.tokens.unshift({\n                        type: 'text',\n                        raw: checkbox + ' ',\n                        text: checkbox + ' ',\n                    });\n                }\n            }\n            else {\n                itemBody += checkbox + ' ';\n            }\n        }\n        itemBody += this.parser.parse(item.tokens, !!item.loose);\n        return `<li>${itemBody}</li>\\n`;\n    }\n    checkbox({ checked }) {\n        return '<input '\n            + (checked ? 'checked=\"\" ' : '')\n            + 'disabled=\"\" type=\"checkbox\">';\n    }\n    paragraph({ tokens }) {\n        return `<p>${this.parser.parseInline(tokens)}</p>\\n`;\n    }\n    table(token) {\n        let header = '';\n        // header\n        let cell = '';\n        for (let j = 0; j < token.header.length; j++) {\n            cell += this.tablecell(token.header[j]);\n        }\n        header += this.tablerow({ text: cell });\n        let body = '';\n        for (let j = 0; j < token.rows.length; j++) {\n            const row = token.rows[j];\n            cell = '';\n            for (let k = 0; k < row.length; k++) {\n                cell += this.tablecell(row[k]);\n            }\n            body += this.tablerow({ text: cell });\n        }\n        if (body)\n            body = `<tbody>${body}</tbody>`;\n        return '<table>\\n'\n            + '<thead>\\n'\n            + header\n            + '</thead>\\n'\n            + body\n            + '</table>\\n';\n    }\n    tablerow({ text }) {\n        return `<tr>\\n${text}</tr>\\n`;\n    }\n    tablecell(token) {\n        const content = this.parser.parseInline(token.tokens);\n        const type = token.header ? 'th' : 'td';\n        const tag = token.align\n            ? `<${type} align=\"${token.align}\">`\n            : `<${type}>`;\n        return tag + content + `</${type}>\\n`;\n    }\n    /**\n     * span level renderer\n     */\n    strong({ tokens }) {\n        return `<strong>${this.parser.parseInline(tokens)}</strong>`;\n    }\n    em({ tokens }) {\n        return `<em>${this.parser.parseInline(tokens)}</em>`;\n    }\n    codespan({ text }) {\n        return `<code>${text}</code>`;\n    }\n    br(token) {\n        return '<br>';\n    }\n    del({ tokens }) {\n        return `<del>${this.parser.parseInline(tokens)}</del>`;\n    }\n    link({ href, title, tokens }) {\n        const text = this.parser.parseInline(tokens);\n        const cleanHref = cleanUrl(href);\n        if (cleanHref === null) {\n            return text;\n        }\n        href = cleanHref;\n        let out = '<a href=\"' + href + '\"';\n        if (title) {\n            out += ' title=\"' + title + '\"';\n        }\n        out += '>' + text + '</a>';\n        return out;\n    }\n    image({ href, title, text }) {\n        const cleanHref = cleanUrl(href);\n        if (cleanHref === null) {\n            return text;\n        }\n        href = cleanHref;\n        let out = `<img src=\"${href}\" alt=\"${text}\"`;\n        if (title) {\n            out += ` title=\"${title}\"`;\n        }\n        out += '>';\n        return out;\n    }\n    text(token) {\n        return 'tokens' in token && token.tokens ? this.parser.parseInline(token.tokens) : token.text;\n    }\n}\n\n/**\n * TextRenderer\n * returns only the textual part of the token\n */\nclass _TextRenderer {\n    // no need for block level renderers\n    strong({ text }) {\n        return text;\n    }\n    em({ text }) {\n        return text;\n    }\n    codespan({ text }) {\n        return text;\n    }\n    del({ text }) {\n        return text;\n    }\n    html({ text }) {\n        return text;\n    }\n    text({ text }) {\n        return text;\n    }\n    link({ text }) {\n        return '' + text;\n    }\n    image({ text }) {\n        return '' + text;\n    }\n    br() {\n        return '';\n    }\n}\n\n/**\n * Parsing & Compiling\n */\nclass _Parser {\n    options;\n    renderer;\n    textRenderer;\n    constructor(options) {\n        this.options = options || _defaults;\n        this.options.renderer = this.options.renderer || new _Renderer();\n        this.renderer = this.options.renderer;\n        this.renderer.options = this.options;\n        this.renderer.parser = this;\n        this.textRenderer = new _TextRenderer();\n    }\n    /**\n     * Static Parse Method\n     */\n    static parse(tokens, options) {\n        const parser = new _Parser(options);\n        return parser.parse(tokens);\n    }\n    /**\n     * Static Parse Inline Method\n     */\n    static parseInline(tokens, options) {\n        const parser = new _Parser(options);\n        return parser.parseInline(tokens);\n    }\n    /**\n     * Parse Loop\n     */\n    parse(tokens, top = true) {\n        let out = '';\n        for (let i = 0; i < tokens.length; i++) {\n            const anyToken = tokens[i];\n            // Run any renderer extensions\n            if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {\n                const genericToken = anyToken;\n                const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);\n                if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(genericToken.type)) {\n                    out += ret || '';\n                    continue;\n                }\n            }\n            const token = anyToken;\n            switch (token.type) {\n                case 'space': {\n                    out += this.renderer.space(token);\n                    continue;\n                }\n                case 'hr': {\n                    out += this.renderer.hr(token);\n                    continue;\n                }\n                case 'heading': {\n                    out += this.renderer.heading(token);\n                    continue;\n                }\n                case 'code': {\n                    out += this.renderer.code(token);\n                    continue;\n                }\n                case 'table': {\n                    out += this.renderer.table(token);\n                    continue;\n                }\n                case 'blockquote': {\n                    out += this.renderer.blockquote(token);\n                    continue;\n                }\n                case 'list': {\n                    out += this.renderer.list(token);\n                    continue;\n                }\n                case 'html': {\n                    out += this.renderer.html(token);\n                    continue;\n                }\n                case 'paragraph': {\n                    out += this.renderer.paragraph(token);\n                    continue;\n                }\n                case 'text': {\n                    let textToken = token;\n                    let body = this.renderer.text(textToken);\n                    while (i + 1 < tokens.length && tokens[i + 1].type === 'text') {\n                        textToken = tokens[++i];\n                        body += '\\n' + this.renderer.text(textToken);\n                    }\n                    if (top) {\n                        out += this.renderer.paragraph({\n                            type: 'paragraph',\n                            raw: body,\n                            text: body,\n                            tokens: [{ type: 'text', raw: body, text: body }],\n                        });\n                    }\n                    else {\n                        out += body;\n                    }\n                    continue;\n                }\n                default: {\n                    const errMsg = 'Token with \"' + token.type + '\" type was not found.';\n                    if (this.options.silent) {\n                        console.error(errMsg);\n                        return '';\n                    }\n                    else {\n                        throw new Error(errMsg);\n                    }\n                }\n            }\n        }\n        return out;\n    }\n    /**\n     * Parse Inline Tokens\n     */\n    parseInline(tokens, renderer) {\n        renderer = renderer || this.renderer;\n        let out = '';\n        for (let i = 0; i < tokens.length; i++) {\n            const anyToken = tokens[i];\n            // Run any renderer extensions\n            if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {\n                const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);\n                if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(anyToken.type)) {\n                    out += ret || '';\n                    continue;\n                }\n            }\n            const token = anyToken;\n            switch (token.type) {\n                case 'escape': {\n                    out += renderer.text(token);\n                    break;\n                }\n                case 'html': {\n                    out += renderer.html(token);\n                    break;\n                }\n                case 'link': {\n                    out += renderer.link(token);\n                    break;\n                }\n                case 'image': {\n                    out += renderer.image(token);\n                    break;\n                }\n                case 'strong': {\n                    out += renderer.strong(token);\n                    break;\n                }\n                case 'em': {\n                    out += renderer.em(token);\n                    break;\n                }\n                case 'codespan': {\n                    out += renderer.codespan(token);\n                    break;\n                }\n                case 'br': {\n                    out += renderer.br(token);\n                    break;\n                }\n                case 'del': {\n                    out += renderer.del(token);\n                    break;\n                }\n                case 'text': {\n                    out += renderer.text(token);\n                    break;\n                }\n                default: {\n                    const errMsg = 'Token with \"' + token.type + '\" type was not found.';\n                    if (this.options.silent) {\n                        console.error(errMsg);\n                        return '';\n                    }\n                    else {\n                        throw new Error(errMsg);\n                    }\n                }\n            }\n        }\n        return out;\n    }\n}\n\nclass _Hooks {\n    options;\n    block;\n    constructor(options) {\n        this.options = options || _defaults;\n    }\n    static passThroughHooks = new Set([\n        'preprocess',\n        'postprocess',\n        'processAllTokens',\n    ]);\n    /**\n     * Process markdown before marked\n     */\n    preprocess(markdown) {\n        return markdown;\n    }\n    /**\n     * Process HTML after marked is finished\n     */\n    postprocess(html) {\n        return html;\n    }\n    /**\n     * Process all tokens before walk tokens\n     */\n    processAllTokens(tokens) {\n        return tokens;\n    }\n    /**\n     * Provide function to tokenize markdown\n     */\n    provideLexer() {\n        return this.block ? _Lexer.lex : _Lexer.lexInline;\n    }\n    /**\n     * Provide function to parse tokens\n     */\n    provideParser() {\n        return this.block ? _Parser.parse : _Parser.parseInline;\n    }\n}\n\nclass Marked {\n    defaults = _getDefaults();\n    options = this.setOptions;\n    parse = this.parseMarkdown(true);\n    parseInline = this.parseMarkdown(false);\n    Parser = _Parser;\n    Renderer = _Renderer;\n    TextRenderer = _TextRenderer;\n    Lexer = _Lexer;\n    Tokenizer = _Tokenizer;\n    Hooks = _Hooks;\n    constructor(...args) {\n        this.use(...args);\n    }\n    /**\n     * Run callback for every token\n     */\n    walkTokens(tokens, callback) {\n        let values = [];\n        for (const token of tokens) {\n            values = values.concat(callback.call(this, token));\n            switch (token.type) {\n                case 'table': {\n                    const tableToken = token;\n                    for (const cell of tableToken.header) {\n                        values = values.concat(this.walkTokens(cell.tokens, callback));\n                    }\n                    for (const row of tableToken.rows) {\n                        for (const cell of row) {\n                            values = values.concat(this.walkTokens(cell.tokens, callback));\n                        }\n                    }\n                    break;\n                }\n                case 'list': {\n                    const listToken = token;\n                    values = values.concat(this.walkTokens(listToken.items, callback));\n                    break;\n                }\n                default: {\n                    const genericToken = token;\n                    if (this.defaults.extensions?.childTokens?.[genericToken.type]) {\n                        this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {\n                            const tokens = genericToken[childTokens].flat(Infinity);\n                            values = values.concat(this.walkTokens(tokens, callback));\n                        });\n                    }\n                    else if (genericToken.tokens) {\n                        values = values.concat(this.walkTokens(genericToken.tokens, callback));\n                    }\n                }\n            }\n        }\n        return values;\n    }\n    use(...args) {\n        const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };\n        args.forEach((pack) => {\n            // copy options to new object\n            const opts = { ...pack };\n            // set async to true if it was set to true before\n            opts.async = this.defaults.async || opts.async || false;\n            // ==-- Parse \"addon\" extensions --== //\n            if (pack.extensions) {\n                pack.extensions.forEach((ext) => {\n                    if (!ext.name) {\n                        throw new Error('extension name required');\n                    }\n                    if ('renderer' in ext) { // Renderer extensions\n                        const prevRenderer = extensions.renderers[ext.name];\n                        if (prevRenderer) {\n                            // Replace extension with func to run new extension but fall back if false\n                            extensions.renderers[ext.name] = function (...args) {\n                                let ret = ext.renderer.apply(this, args);\n                                if (ret === false) {\n                                    ret = prevRenderer.apply(this, args);\n                                }\n                                return ret;\n                            };\n                        }\n                        else {\n                            extensions.renderers[ext.name] = ext.renderer;\n                        }\n                    }\n                    if ('tokenizer' in ext) { // Tokenizer Extensions\n                        if (!ext.level || (ext.level !== 'block' && ext.level !== 'inline')) {\n                            throw new Error(\"extension level must be 'block' or 'inline'\");\n                        }\n                        const extLevel = extensions[ext.level];\n                        if (extLevel) {\n                            extLevel.unshift(ext.tokenizer);\n                        }\n                        else {\n                            extensions[ext.level] = [ext.tokenizer];\n                        }\n                        if (ext.start) { // Function to check for start of token\n                            if (ext.level === 'block') {\n                                if (extensions.startBlock) {\n                                    extensions.startBlock.push(ext.start);\n                                }\n                                else {\n                                    extensions.startBlock = [ext.start];\n                                }\n                            }\n                            else if (ext.level === 'inline') {\n                                if (extensions.startInline) {\n                                    extensions.startInline.push(ext.start);\n                                }\n                                else {\n                                    extensions.startInline = [ext.start];\n                                }\n                            }\n                        }\n                    }\n                    if ('childTokens' in ext && ext.childTokens) { // Child tokens to be visited by walkTokens\n                        extensions.childTokens[ext.name] = ext.childTokens;\n                    }\n                });\n                opts.extensions = extensions;\n            }\n            // ==-- Parse \"overwrite\" extensions --== //\n            if (pack.renderer) {\n                const renderer = this.defaults.renderer || new _Renderer(this.defaults);\n                for (const prop in pack.renderer) {\n                    if (!(prop in renderer)) {\n                        throw new Error(`renderer '${prop}' does not exist`);\n                    }\n                    if (['options', 'parser'].includes(prop)) {\n                        // ignore options property\n                        continue;\n                    }\n                    const rendererProp = prop;\n                    const rendererFunc = pack.renderer[rendererProp];\n                    const prevRenderer = renderer[rendererProp];\n                    // Replace renderer with func to run extension, but fall back if false\n                    renderer[rendererProp] = (...args) => {\n                        let ret = rendererFunc.apply(renderer, args);\n                        if (ret === false) {\n                            ret = prevRenderer.apply(renderer, args);\n                        }\n                        return ret || '';\n                    };\n                }\n                opts.renderer = renderer;\n            }\n            if (pack.tokenizer) {\n                const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);\n                for (const prop in pack.tokenizer) {\n                    if (!(prop in tokenizer)) {\n                        throw new Error(`tokenizer '${prop}' does not exist`);\n                    }\n                    if (['options', 'rules', 'lexer'].includes(prop)) {\n                        // ignore options, rules, and lexer properties\n                        continue;\n                    }\n                    const tokenizerProp = prop;\n                    const tokenizerFunc = pack.tokenizer[tokenizerProp];\n                    const prevTokenizer = tokenizer[tokenizerProp];\n                    // Replace tokenizer with func to run extension, but fall back if false\n                    // @ts-expect-error cannot type tokenizer function dynamically\n                    tokenizer[tokenizerProp] = (...args) => {\n                        let ret = tokenizerFunc.apply(tokenizer, args);\n                        if (ret === false) {\n                            ret = prevTokenizer.apply(tokenizer, args);\n                        }\n                        return ret;\n                    };\n                }\n                opts.tokenizer = tokenizer;\n            }\n            // ==-- Parse Hooks extensions --== //\n            if (pack.hooks) {\n                const hooks = this.defaults.hooks || new _Hooks();\n                for (const prop in pack.hooks) {\n                    if (!(prop in hooks)) {\n                        throw new Error(`hook '${prop}' does not exist`);\n                    }\n                    if (['options', 'block'].includes(prop)) {\n                        // ignore options and block properties\n                        continue;\n                    }\n                    const hooksProp = prop;\n                    const hooksFunc = pack.hooks[hooksProp];\n                    const prevHook = hooks[hooksProp];\n                    if (_Hooks.passThroughHooks.has(prop)) {\n                        // @ts-expect-error cannot type hook function dynamically\n                        hooks[hooksProp] = (arg) => {\n                            if (this.defaults.async) {\n                                return Promise.resolve(hooksFunc.call(hooks, arg)).then(ret => {\n                                    return prevHook.call(hooks, ret);\n                                });\n                            }\n                            const ret = hooksFunc.call(hooks, arg);\n                            return prevHook.call(hooks, ret);\n                        };\n                    }\n                    else {\n                        // @ts-expect-error cannot type hook function dynamically\n                        hooks[hooksProp] = (...args) => {\n                            let ret = hooksFunc.apply(hooks, args);\n                            if (ret === false) {\n                                ret = prevHook.apply(hooks, args);\n                            }\n                            return ret;\n                        };\n                    }\n                }\n                opts.hooks = hooks;\n            }\n            // ==-- Parse WalkTokens extensions --== //\n            if (pack.walkTokens) {\n                const walkTokens = this.defaults.walkTokens;\n                const packWalktokens = pack.walkTokens;\n                opts.walkTokens = function (token) {\n                    let values = [];\n                    values.push(packWalktokens.call(this, token));\n                    if (walkTokens) {\n                        values = values.concat(walkTokens.call(this, token));\n                    }\n                    return values;\n                };\n            }\n            this.defaults = { ...this.defaults, ...opts };\n        });\n        return this;\n    }\n    setOptions(opt) {\n        this.defaults = { ...this.defaults, ...opt };\n        return this;\n    }\n    lexer(src, options) {\n        return _Lexer.lex(src, options ?? this.defaults);\n    }\n    parser(tokens, options) {\n        return _Parser.parse(tokens, options ?? this.defaults);\n    }\n    parseMarkdown(blockType) {\n        // eslint-disable-next-line @typescript-eslint/no-explicit-any\n        const parse = (src, options) => {\n            const origOpt = { ...options };\n            const opt = { ...this.defaults, ...origOpt };\n            const throwError = this.onError(!!opt.silent, !!opt.async);\n            // throw error if an extension set async to true but parse was called with async: false\n            if (this.defaults.async === true && origOpt.async === false) {\n                return throwError(new Error('marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.'));\n            }\n            // throw error in case of non string input\n            if (typeof src === 'undefined' || src === null) {\n                return throwError(new Error('marked(): input parameter is undefined or null'));\n            }\n            if (typeof src !== 'string') {\n                return throwError(new Error('marked(): input parameter is of type '\n                    + Object.prototype.toString.call(src) + ', string expected'));\n            }\n            if (opt.hooks) {\n                opt.hooks.options = opt;\n                opt.hooks.block = blockType;\n            }\n            const lexer = opt.hooks ? opt.hooks.provideLexer() : (blockType ? _Lexer.lex : _Lexer.lexInline);\n            const parser = opt.hooks ? opt.hooks.provideParser() : (blockType ? _Parser.parse : _Parser.parseInline);\n            if (opt.async) {\n                return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src)\n                    .then(src => lexer(src, opt))\n                    .then(tokens => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens)\n                    .then(tokens => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens)\n                    .then(tokens => parser(tokens, opt))\n                    .then(html => opt.hooks ? opt.hooks.postprocess(html) : html)\n                    .catch(throwError);\n            }\n            try {\n                if (opt.hooks) {\n                    src = opt.hooks.preprocess(src);\n                }\n                let tokens = lexer(src, opt);\n                if (opt.hooks) {\n                    tokens = opt.hooks.processAllTokens(tokens);\n                }\n                if (opt.walkTokens) {\n                    this.walkTokens(tokens, opt.walkTokens);\n                }\n                let html = parser(tokens, opt);\n                if (opt.hooks) {\n                    html = opt.hooks.postprocess(html);\n                }\n                return html;\n            }\n            catch (e) {\n                return throwError(e);\n            }\n        };\n        return parse;\n    }\n    onError(silent, async) {\n        return (e) => {\n            e.message += '\\nPlease report this to https://github.com/markedjs/marked.';\n            if (silent) {\n                const msg = '<p>An error occurred:</p><pre>'\n                    + escape$1(e.message + '', true)\n                    + '</pre>';\n                if (async) {\n                    return Promise.resolve(msg);\n                }\n                return msg;\n            }\n            if (async) {\n                return Promise.reject(e);\n            }\n            throw e;\n        };\n    }\n}\n\nconst markedInstance = new Marked();\nfunction marked(src, opt) {\n    return markedInstance.parse(src, opt);\n}\n/**\n * Sets the default options.\n *\n * @param options Hash of options\n */\nmarked.options =\n    marked.setOptions = function (options) {\n        markedInstance.setOptions(options);\n        marked.defaults = markedInstance.defaults;\n        changeDefaults(marked.defaults);\n        return marked;\n    };\n/**\n * Gets the original marked default options.\n */\nmarked.getDefaults = _getDefaults;\nmarked.defaults = _defaults;\n/**\n * Use Extension\n */\nmarked.use = function (...args) {\n    markedInstance.use(...args);\n    marked.defaults = markedInstance.defaults;\n    changeDefaults(marked.defaults);\n    return marked;\n};\n/**\n * Run callback for every token\n */\nmarked.walkTokens = function (tokens, callback) {\n    return markedInstance.walkTokens(tokens, callback);\n};\n/**\n * Compiles markdown to HTML without enclosing `p` tag.\n *\n * @param src String of markdown source to be compiled\n * @param options Hash of options\n * @return String of compiled HTML\n */\nmarked.parseInline = markedInstance.parseInline;\n/**\n * Expose\n */\nmarked.Parser = _Parser;\nmarked.parser = _Parser.parse;\nmarked.Renderer = _Renderer;\nmarked.TextRenderer = _TextRenderer;\nmarked.Lexer = _Lexer;\nmarked.lexer = _Lexer.lex;\nmarked.Tokenizer = _Tokenizer;\nmarked.Hooks = _Hooks;\nmarked.parse = marked;\nconst options = marked.options;\nconst setOptions = marked.setOptions;\nconst use = marked.use;\nconst walkTokens = marked.walkTokens;\nconst parseInline = marked.parseInline;\nconst parse = marked;\nconst parser = _Parser.parse;\nconst lexer = _Lexer.lex;\n\nexport { _Hooks as Hooks, _Lexer as Lexer, Marked, _Parser as Parser, _Renderer as Renderer, _TextRenderer as TextRenderer, _Tokenizer as Tokenizer, _defaults as defaults, _getDefaults as getDefaults, lexer, marked, options, parse, parseInline, parser, setOptions, use, walkTokens };\n//# sourceMappingURL=marked.esm.js.map\n","export default \"## Changelog\\n\\n# Version 4.2.3\\n- *Sequencer* - Adjusted module typing (thank you MrVauxs on github!)\\n- *Effects* - Fixed position calculation on effects and sounds with tiles on v14 (thank you aljames-arctic on github!)\\n- *Effects* - Fixed custom PF2e template shapes not working with `.scaleToObject()`\\n- *Effects* - Fixed `.loopOptions()` with `loops` set not limiting the number of loops when combined with a `.duration()` longer than the effect file's own duration\\n\\n# Version 4.2.2\\n- *Effects* - Fixed `.copySprite()` not copying the sprites of tokens with scale on them\\n- *Effects* - Fixed `.mask()` not working on Tokens or Tiles\\n\\n# Version 4.2.1\\n- *Effects* - Fixed effects not appearing on scenes that only have the default scene level on Foundry v14\\n\\n# Version 4.2.0\\n- *Sequencer* - Fixed the Sequencer Manager not scrolling when the list of running effects and sounds was taller than the window\\n- *Effects* - Greatly improved lookup speed of effects that needed to be deleted across scenes\\n- *Effects* - Added `.onLevels()` to limit an effect to specific scene levels on Foundry v14\\n- *Effects* - Added support for `.elevation([bottom, top])` to give an effect a vertical elevation range that stays visible on every scene level it reaches on Foundry v14\\n- *Effects* - Added a `topInclusive` option to `.elevation([bottom, top])` that mirrors the same property on Foundry Regions, including the top boundary in the range so the effect counts as part of the level above\\n- *Effects* - Fixed `.zIndex()` not working with `.screenSpace()` effects\\n- *Effects* - Fixed effects showing across every scene level on Foundry v14\\n- *Effects* - Fixed `.copySprite()` no longer animating when used on animated webm tokens, and ignoring the token's Scale setting and copying at the grid footprint size instead of the visible size\\n- *Effects* - Fixed `.filter(\\\"ColorMatrix\\\", ...)` breaking when any of `hue`, `brightness`, `contrast`, or `saturate` was given `null` or `undefined`\\n- *Effects* - Fixed attached persistent effects not coming along when copy/pasting a token, drawing, tile, template, or region\\n- *Effects* - Tweaked `.blendMode()` to create a warning when using `\\\"overlay\\\"`, `\\\"soft-light\\\"`, `\\\"hard-light\\\"`, `\\\"color-dodge\\\"`, `\\\"color-burn\\\"`, `\\\"darken\\\"`, `\\\"lighten\\\"`, `\\\"difference\\\"`, `\\\"exclusion\\\"`, `\\\"hue\\\"`, `\\\"saturation\\\"`, `\\\"color\\\"`, or `\\\"luminosity\\\"`; as these modes are not available in Foundry's renderer\\n- *Sounds* - Added `.elevation()` to override or offset a positional sound's Z, used by the level-distance attenuation\\n- *Sounds* - Added `.onLevels()` to limit a sound to specific scene levels on Foundry v14\\n- *Sounds* - Fixed sounds played at a position not attenuating across scene levels on Foundry v14\\n- *Sounds* - Fixed attached persistent sounds not coming along when copy/pasting a token, drawing, tile, template, or region\\n\\n# Version 4.1.0\\n- *Sequencer* - Added Czech localization, and updated Polish localization (thank you, Lethrendis and Lioheart on github!)\\n- *Effects* - Added `.blendMode()` to effect sections, accepting either a string name (e.g. `\\\"multiply\\\"`, `\\\"screen\\\"`, `\\\"soft-light\\\"`) or the `PIXI.BLEND_MODES` const\\n- *Effects* - Added `.constrainedByWalls()` for clipping effects to wall-bounded line of sight, independent of the Walled Templates module\\n- *Effects* - Added `Sequencer.Helpers.computeWallPolygon()` and extended `.mask()` to accept raw `PIXI.Polygon`, `PIXI.Circle`, or `PIXI.Rectangle` shapes\\n- *Effects* - Fixed effects attached to or targeting a Region rendering below tiles that should sit beneath them\\n- *Effects* - Fixed `.mask()` rejecting Regions even though Regions were already supported by the effect mask renderer\\n- *Effects* - Fixed .atLocation(tile) placing effects at the tile's top-left instead of centering them on the tile (thanks aljames-arctic on GitHub)\\n\\n# Version 4.0.2\\n- *Sequencer* - Fixed the Effect Player's Alt hotkey leaving attach mode and stretch-to-attach stuck on after release\\n- *Sequencer* - Fixed `TypeError: Failed to fetch` (CORS) when previewing a remote asset (e.g. S3) in the Sequencer Database before playing it on the canvas\\n- *Sequencer* - Fixed `Sequencer.Presets.get()` freezing Foundry when given a dotted preset name whose fallbacks were not registered\\n- *Sequencer* - Fixed `.thenDo()` silently accepting non-function input and failing later mid-sequence with an unhelpful error\\n- *Sequencer* - Fixed `Sequencer.Database.registerEntries` with `override: true` not unmarking a module's previous private state\\n- *Sequencer* - Fixed declining the overwrite prompt while saving an Effect Player preset throwing a `ReferenceError`\\n- *Sequencer* - Fixed the Sequencer Database spritesheet preview leaking object URLs and failing to release frames when switching entries\\n- *Sequencer* - Fixed deprecation warnings by using `foundry.applications.apps.FilePicker`, `foundry.applications.api.DialogV2`, `foundry.canvas.containers.PreciseText`, `foundry.canvas.geometry.Ray`, and `ui.notifications` progress bars instead of their deprecated globals\\n- *Sequencer* - Fixed `.forUsers()` throwing when given `User` objects instead of user IDs, even though both are documented to work\\n- *Effects* - Fixed forced-index database keys ending in two or more digits (e.g. `effect.12`) playing the wrong frame\\n- *Effects* - Fixed `.zIndex()` having no effect on `.screenSpaceAboveUI()` effects\\n- *Effects* - Fixed sequences erroring out for users that did not have permission to play effects, or were excluded by `.forUsers()`\\n- *Effects* - Fixed sequences getting stuck waiting forever when an effect failed to load or was ended before it had finished setting up\\n- *Effects* - Fixed `.moveTowards()` with `cacheLocation: true` throwing instead of caching the target's position\\n- *Effects* - Fixed clicking overlapping effects in the Sequencer Manager not consistently selecting the visually top-most one\\n- *Effects* - Fixed effect assets being loaded twice and leaking the duplicate when the same file was spawned in rapid succession\\n- *Effects* - Fixed memory leak in spritesheet generation\\n- *Effects* - Fixed effect file cache where the most recently used files were evicted first instead of the least recently used\\n- *Sounds* - Fixed `.forUsers()` being ignored, causing sounds to play for every connected user instead of only the listed users\\n- *Sounds* - Fixed persistent sound data being saved into the wrong storage on world load, causing sounds to not migrate correctly between Sequencer versions\\n- *Sounds* - Fixed the `endedSequencerSound` hook never firing for persistent sounds when they end\\n- *Animations* - Fixed `.repeats()` on animation sections only running once and `_abort()` not interrupting a mid-flight animation\\n- *Crosshairs* - Fixed `.borderColor()` always throwing when called without an `alpha` option\\n- *Crosshairs* - Fixed `.repeats()` on crosshair sections only running once and `_abort()` not interrupting a pending placement\\n- *Crosshairs* - Fixed the crosshair clobbering other modules' canvas wheel handlers on activation and teardown\\n- *Crosshairs* - Fixed cancelling a crosshair with `.persist()` still creating a template on the scene at the cursor position\\n- *Canvas Pan* - Fixed `.canvasPan()` ignoring its `duration` and `speed` arguments when called positionally\\n- *Canvas Pan* - Fixed `.canvasPan().speed()` being ignored by the pan animation and mistiming any `.lockView()` or `.shake()` set on the same section\\n\\n# Version 4.0.1\\n- *Sequencer* - Reverted `Sequencer.Database.entryExists` to accept partial segment matches (e.g. `\\\"attack\\\"` matching `\\\"attack1\\\"`), which was unintentionally broken in 4.0.0. A console warning is now logged when a partial segment match occurs; this behavior will be tightened in a future version\\n- *Sequencer* - Added Portuguese localization (Thank you Kharmans on GitHub!)\\n- *Effects* - Fixed `.mask()` not working on Foundry v13 due to the mask filter's fragment shader not being passed to the PIXI filter constructor\\n- *Effects* - Fixed non-persistent effects not disappearing from the Sequencer Manager after finishing playback\\n\\n# Version 4.0.0\\n- *Sequencer* - Updated to support FoundryVTT v14\\n- *Sequencer* - Removed support for FoundryVTT v12\\n- *Sequencer* - Removed the socketlib dependency; Sequencer now manages its own data internally\\n- *Sequencer* - Introduced a new internal UI foundation with proper dark mode support\\n- *Sequencer* - Fixed `preloadForClients` blocking indefinitely when a client is tabbed away or disconnects mid-preload\\n- *Effects* - Reworked internal effect storage to use a centralized hidden journal, reducing token and actor update overhead and improving performance in effect-heavy games\\n- *Effects* - Removed deprecated methods, warnings are now errors\\n- *Effects* - Due to the changes to the storage of effect data, setting `local: true` on the Sequence's `play()` method will no longer make the effect entirely local, and still store it in the DB without anyone else seeing it\\n- *Effects* - Effects now visually \\\"punch through\\\" region highlights (matches how Foundry's own tokens behave with always displayed regions)\\n- *Effects* - `.sortLayer()`, `.zIndex()`, `.belowTokens()`, and `.belowTiles()` now work as documented on Foundry v13 & v14\\n- *Effects* - `.aboveLighting()` now actually anchors the effect above all lighting elements within the interface layer, but not its interface elements\\n- *Effects* - Fixed `.copySprite()` only capturing the subject texture on dynamic-ring tokens; the ring is now included via render-to-texture\\n- *Sounds* - Added `.persist()`, which causes the sound to persist on the scene, very cool!\\n- *Sounds* - Added `.attachTo()`, which attaches the sound to the target (only supports `bindVisibility` and `bindElevation` at this moment)\\n- *Sounds* - Added `.panSound()` which causes the sound to pan left and right when the token you have selected moves to the right or left of the sound\\n  - You can control the distance from which it starts panning with `innerEaseDistance`, which is how many grid units away from the source that the ease starts. Use `outerEaseDistance` to control where the sound will be fully panning - if `innerEaseDirstance` is set to 10, and `outerEaseDistance` is set to 30, within 10 grid units the sound will not be panning, between 10 and 30 it will slowly blend to a panning sound, and beyond 30 it will be fully panning\\n- *Sounds* - Added `.extraEndDuration()`, which adds additional ending duration to persisted sounds\\n- *Sounds* - Added `.loopOptions()`, which controls the looping options of the sounds\\n- *Sounds* - Added `.toLocation()`, which will evaluate the target location, but still play at the `.atLocation()` position - this is useful when the sound has multiple files for different ranges\\n- *Sounds* - Added `.moveTowards()`, which will cause the sound to move towards the target location - best **not** used with `.toLocation()`\\n- *Sounds* - Added `.globalSound()`, which prevents any `.atLocation()` sound from only playing on the canvas, and instead always plays globally.\\n- *Sounds* - Added support for the database range-finding implementation typically found in effects; sounds can be defined with 5ft, 15ft, 30ft, 60ft, and 90ft files, and using the above methods will select the correct sound file to play\\n- *Animations* - Fixed chained light animations reading the origin position before the previous animation's document update had committed, causing the second animation to start from the wrong location\\n\\nSequencer now has a Patreon if you wish to support its development! Join us now at:\\nhttps://www.patreon.com/cw/fantasycomputerworks\\n\\n# Version 3.6.11\\n- *Sequencer* - Fixed `remote` on `.play()` not forcing local on the executing user's machine\\n- *Sequencer* - Added a one-time dialog promoting our patreon\\n- *Effects* - Fixed `.copySprite()` using the wrong texture with `.file()` being set\\n\\n# Version 3.6.10\\n- *Effects* - Fixed `.copySprite()` not copying dynamic token rings (thank you ChasarooniZ on github!)\\n- *Effects* - Fixed `.rotateTowards()` with `attach: true` not working properly (thank you RobinCodesStuff on github!)\\n- *Effects* - Upgraded `.from()` into a loud deprecation - please use `.copySprite()` instead \\n- *Effects* - Upgraded `.attachTo()` with `followRotation` into a loud deprecation - please use `bindRotation` instead \\n- *Effects* - Upgraded `.noLoop()` into a loud deprecation - please use `.loopOptions({ loops: 1 })` instead\\n- *Scrolling Text* - Fixed inputting `\\\"CENTER\\\"` to `.anchor()` not working\\n- *Effects* - Fixed `.screenSpace()` on isometric scenes \\n\\n# Version 3.6.9\\n- *Animations* - Fixed animations not working at all\\n\\n# Version 3.6.8\\n- *Crosshairs* - Fix right click drag, when mouse up happens after holding cursor still (Thanks dmrickey on Github!)\\n- *Crosshairs* - Fixed some issues with limit max range on gridless scenes\\n- *Sequencer* - Updated all Sequencer types (Thanks LukeAbby on Github!)\\n- *Sequencer* - Made crosshair data types optional (Thanks MrVauxs on Github!)\\n- *Animations* - Removed token support for `ease` from the following methods due to Foundry removing support for custom easing of token movement:\\n  - `.moveTowards()`\\n  - `.rotateTowards()`\\n  - `.rotateIn()`\\n  - `.rotateOut()`\\n  - `.fadeIn()`\\n  - `.fadeOut()`\\n\\n# Version 3.6.7\\n- *Effects* - Fixed persistent effects not actually being persistent\\n- *Effects* - Fixed `.shape()`'s `fillColor` not liking `#000000` and overriding it to white\\n\\n# Version 3.6.2\\n- *Crosshairs* - Added `.texture()` (Thank you david aka claudekennilol on Discord!)\\n- *Crosshairs* - Added `alpha` as an option to `.border()` and `.fillColor()` (Thank you david aka claudekennilol on Discord!)\\n- *Sounds* - Fixed sounds with `.atLocation()` not working together with crosshairs \\n\\n# Version 3.6.1\\n- *Sequencer* - Fixed some lingering issues in Foundry v13\\n\\n## Version 3.6.0\\n- *Sequencer* - Updated Sequencer for Foundry v13 while still remaining compatible with v12\\n\\n## Version 3.5.4\\n- *Effects* - Fixed minor issue with isometric & walled templates plugin implementation\\n\\n## Version 3.5.3\\n- *Sequencer* - Fixed overly aggressive welcome chat message\\n- *Sequencer* - Sequencer will now fully prevent from launching if socketlib is not properly set up or installed \\n\\n## Version 3.5.2\\n- *Effects* - Fixed `complete` effect versions not playing correctly without `.persist()`\\n- *Effects* - Fixed isometric support with better plugin implementation\\n\\n## Version 3.5.1\\n- *Effects* - Fixed issue where effects would get \\\"stuck\\\" on scenes after being played through Automated Animations\\n- *Effects* - Fixed issue where the effect manager would break if opened with an effect that had pre-defined ranges in its `.file()` method \\n- *Effects* - Fixed .webm's with sounds would not play its sound if played as an effect \\n- *Crosshairs* - Fixed snap position resolution being undefined by default, causing it to not snap if not defined \\n- *Crosshairs* - Elaborated on some crosshairs function documentation\\n\\n## Version 3.5.0\\n- *Sequencer* - Updated TJS implementation to latest versions\\n- *Sequencer* - Updated Italian and Polish localization (thank you GregoryWarn and Lioheart on Github!)\\n- *Effects* - Improved the sprite sheet generator's premultiplied alpha handling (Thanks Codas!)\\n- *Effects* - Fixed issues with effects trying to play before the canvas had been fully initialized (Thanks Codas!)\\n\\n## Version 3.4.9\\n- *Sequencer* - Added tooltips to Sequencer database viewer buttons\\n- *Animations* - Fixed animation sections with tint throwing error due to missing import\\n- *Crosshairs* - Fixed resolution 0 resulting in Foundry crashing (due to internal Foundry handling of 0 resolution)\\n- *Effects* - Fixed `binary/octet-stream` not being considered a valid content type\\n- *Effects* - Fixed screenspace effects scaling based on the grid-size of the current scene (thank you Vauxs!)\\n- *Sounds* - Fixed once-off location-based sounds crashing Foundry  (thank you Vauxs!)\\n\\n# Version 3.4.8\\n- *Sequencer* - Added Italian localization (thanks GregoryWarn!)\\n- *Sequencer* - Added `override` to `Sequencer.Database.registerEntries` (thanks MrVauxs)\\n- *Effects* - Fixed `.tint()` not working in v12 (thanks MrVauxs)\\n- *Effects* - Added `.sortLayer()` to typing (thanks MrVauxs)\\n- *Sounds* - Fixed sound breaking because of missing offset function implementation (thanks MrVauxs)\\n- *Crosshairs* - Added grid-snapping resolution to the snap property (thanks Spappz)\\n\\n# Version 3.4.7\\n- *Effects* - Fixed `.stretchTo(target, { attachTo: true })` with range-finding effects not properly preloading its different files\\n- *Effects* - Fixed `.playbackRate()` not working well with `.fadeOut()` and similar `out` animations\\n- *Effects* - Fixed `.stretchTo`'s `tiling` option not working on scenes with non-100px grid sizes (thanks Codas!)\\n- *Sequencer* - Updated Polish localization (thanks Lioheart!)\\n\\n# Version 3.4.6\\n- *Effects* - Added `effect` as a valid `.animateProperty()` and `.loopProperty()` target\\n- *Effects* - Added `sourceOffset` and `targetOffset` to `.animateProperty()` and `.loopProperty()` property target\\n  - This is used as such: `.animateProperty(\\\"effect\\\", \\\"targetOffset.x\\\", { from: 0, to: 200, duration: 5000 })`\\n- *Effects* - Deprecated `.from()` in favor for `.copySprite()` which is a more descriptive method name\\n- *Effects* - Fixed `anchor` not being optional for `.shape()` (Thanks Codas!)\\n- *Effects* - Fixed `scale()` for tiling textures using `stretchTo()` overly stretching the effect (Thanks Codas!)\\n- *Effects* - Fixed some issues with caching of generated spritesheets (Thanks Codas!)\\n- *Effects* - Disabled spriteshet generation for animated tiling textures - too many visual defects at the moment (Thanks Codas!)\\n- *Sequencer* - Fixed audio controls in the Sequencer Database viewer (Thanks Vauxs!)\\n- *Sequencer* - Added audio filtering in the Sequencer Database viewer (Thanks Vauxs!)\\n- *Crosshairs* - Fixed issue with `updateCrosshair` causing label text to break the canvas\\n\\n# Version 3.4.5\\n- *Effects* - Added `anchor` as an optional argument to `.shape()` (see docs)\\n- *Effects* - Fixed `.shape()` not working if no `.file()` was used with `.screenSpace()` and `.screenSpaceScale({ fitX: true, fitY: true })`\\n- *Effects* - Fixed calculation of dimensions for canvas tiles (thanks Codas!)\\n- *Effects* - Fixed spritesheets generated by just-in-time conversion not having the correct framerate (thanks Codas!)\\n- *Effects* - Fixed `.stretchTo()` not having the correct scale after using `.scale()`\\n- *Crosshairs* - Fixed `Sequencer.Crosshair.collect()` being broken due to missing import \\n\\n# Version 3.4.4\\n- *Canvas Pan* - Added support for named locations with in-sequence crosshairs\\n- *Scrolling Text* - Added support for named locations with in-sequence crosshairs\\n- *Effects* - Fixed effects that should have been invisible to users being visible when utilizing `.attachTo()` with `bindVisibility` set to `true` (Thanks Codas!)\\n- *Effects* - Fixed `.file()` with specific range-based effects not correctly using the default grid template data (Thanks Codas!)\\n- *Effects* - Fixed `.aboveLighting()` being above lighting but not over certain elements\\n- *Effects* - Fixed some effects sticking around on tokens even after being deleted\\n- *Effects* - Added missing `anchor` documentation to the `.text()` method\\n\\n# Version 3.4.3\\n- *Sequencer* - Fixed slight performance issue with the Sequencer layer querying mouse position even when not active (thanks Codas!)\\n- *Effects* - Fixed `.shape()` and `.text()` not working on effects without an underlying sprite (thanks Codas!)\\n- *Effects* - Fixed `.xray()` not working (thanks Codas!)\\n- *Effects* - Fixed `.screenSpace()` not working due to upgrades to `.animateProperty()` messing with sprite width and such\\n- *Crosshairs* - Fixed `displayRangePoly` not working due to missing import\\n\\n# Version 3.4.2\\n- *Effects* - Fixed canvas breaking after playing some types of effects\\n\\n# Version 3.4.1\\n- *Effects* - Fixed effects with internal loops not playing & looping correctly (thanks Codas!)\\n- *Effects* - Tweaked just-in-time spritesheet generation to not scale resulting spritesheets as much (thanks Codas!) \\n\\n# Version 3.4.0\\n- *Sequencer* - Added support for custom FPS for flipbooks through an `_fps` database tag\\n- *Sequencer* - Added support for spritesheet type effects through linking the spritesheet `.json` manifest in the database\\n- *Sequencer* - Added a just-in-time compiler to transform webm video-based effects to gpu-optimized spritesheets\\n  - This greatly improves performance when many instances of the same persisted effects are playing at once\\n  - Persisted effects are automatically transformed to spritesheets in background threads. Once the compiled spritesheets are available, video effects are seamlessly replaced with spritesheets, greatly reducing the overhead for video decoding for those effects. Depending on size of the effect, spritesheet generation is expected to take anywhere from 5 seconds to 90 seconds. The size of generated Spritesheet textures is limited to 8192x8192px to maximize compatibility and limit memory usage\\n  - Generated spritesheets are cached client-side in a semi-persistent, file-based browser cache\\n  - Spritesheet generation for video files is only supported in trusted contexts (meaning https or hosted and connected locally on the same machine). This is a hard limitation by the browser vendors and not expected to be lifted in the future\\n- *Sequencer* - Tweaked `Sequencer.Presets.get()` to support fall-backs to lower-complexity named entries\\n  - If you have added a preset named `spell.ranged` and attempt to get a non-existent `spell.ranged.fire`, it will return the `spell.ranged` entry as a fallback\\n  - You can enable the previous behavior by passing `true` as a secondary argument, which causes the method to require an exact match\\n- *Crosshairs* - Added `displayRangePoly` to `.location()` and the `Sequencer.Crosshair.show()` API\\n- *Crosshairs* - Fixed some minor crosshair issues surrounding utilizing them for effects\\n- *Crosshairs* - Fixed `Sequencer.Crosshair.collect()` not working correctly with some crosshair shapes\\n- *Effects* - Fixed flipbook animations framerate being tied to canvas FPS\\n- *Effects* - Fixed offset from `.rotateTowards()` applying to the source location instead of the target\\n- *Effects* - Fixed effects with added text and `.rotateTowards()` having their anchor point moved to an unexpected location\\n- *Effects* - Fixed persisted `.stretchTo()` effects not correctly looping the effect in certain cases\\n- *Effects* - Fixed `.loopOptions()` not working correctly for persisted effects when combined with `.timeRange()`\\n- *Effects* - Fixed `.scaleOut()` end value being multiplied by a potentially set `.scaleIn()` value.\\n  - `scaleIn(0.25).scaleOut(2)` now scales the effect in from 0.25 to 1. Plays the animation at 1x size and then scales the animation out to 2x default animation size. Previously, the animation would scale out to 0.5x the default effect size.\\n- *Effects* - Fixed `attachTo()` not working on in-flight crosshairs\\n\\nBig thanks to Codas for his incredible work on the just-in-time compiler, general optimizations, and many fixes! Please support him at the following link: <https://ko-fi.com/Codas>\\n\\n# Version 3.3.8\\n- *Effects* - Fixed `screenSpace` being a required property instead of optional for `.animateProperty()` and `.loopProperty()`\\n\\n# Version 3.3.7\\n- *Sequencer* - Fully removed custom PIXI filters in favor of dedicated Sequencer implementation\\n- *Crosshairs* - Added `.width()` for ray-type crosshairs\\n- *Effects* - Added `screenspace` (boolean) parameter to `.animateProperty()` and `.loopProperty()`\\n  - This makes the values used in these methods for position, width, or height to take the screen-size into account, meaning an `.animateProperty()` with the x position going from 0.0 to 1.0 will have the effect move from the left side of the screen to the right\\n- *Effects* - Fixed `.screenSpace()` effects not supporting animating their width when `.screenSpaceScale({ fitX: true, fitY: true })` was set\\n- *Effects* - Fixed `.screenSpaceAboveUI()` not correctly setting its renderable status when effects were played on its layer  (thank you Codas!)\\n- *Effects* - Fixed `.shape()` not being affected by `.fadeIn()`, `.fadeOut()`, or `.opacity()`  (thank you Codas!)\\n\\n# Version 3.3.6\\n- *Sequencer* - Reverted PIXI filters plugin to more compatible version\\n- *Sounds* - Fixed `.startTime()` and `.endTime()` not working\\n\\n# Version 3.3.5\\n- *Effects* - Fixed `.screenSpaceAboveUI()` not correctly falling back to the below UI screenspace layer if the above UI layer is disabled\\n- *Animations* - Fixed named sequence-crosshairs not working as a target position\\n- *Sequencer* - Fixed minor Foundry v12 deprecation warnings\\n- *Sequencer* - Updated PIXI filters\\n\\n# Version 3.3.4\\n- *Crosshairs* - Fixed `.crosshair()`'s `.persist()` option not working with subsequent `.effect()` sections\\n- *Crosshairs* - Fixed typos on `.gridHighlight()` (thanks Vauxs!)\\n- *Crosshairs* - Fixed crosshair documentation and typing (thanks Vauxs and Spappz on github!)\\n- *Crosshairs* - Fixed `.crosshair()`'s default size being smaller than the grid\\n- *Effects* - Removed `.attachTo()` warning when using `.attachTo()` with a named location (specifically `.persist()`ing crosshairs)\\n- *Effects* - Fixed `.name()` not passing mirrorX/Y, rotation, and random rotation to the subsequent effects\\n- *Sounds* - Added `.audioChannel()` to sounds, which controls which output they are played through (thank you Oxy949 on github!)\\n\\n# Version 3.3.3\\n- *Crosshairs* - Added `Sequencer.Crosshair.CALLBACKS.STOP_COLLIDING` callback\\n- *Crosshairs* - Added `updateCrosshair` method to crosshairs\\n- *Crosshairs* - Fixed invalid placement positions being cached and then used even if the crosshair was placed somewhere else\\n- *Effects* - Fixed `.attachTo()`'s `align` not playing well with `.stretchTo()`\\n- *Effects* - Fixed `.persist(true, { persistTokenPrototype: true })` not storing more than one persistent effect on the token\\n\\n# Version 3.3.2\\n- *Sequencer* - Fixed `.thenDo()` typing (thank you Vauxs!)\\n- *Sequencer* - Tweaked `.addNamedLocation()` to better handle nonconforming inputs\\n- *Effects* - Fixed `.screenSpaceAboveUI()` not working with recent optimizations (thanks you Codas!)\\n- *Effects* - Fixed `.text()` not utilizing the `PreciseText` Foundry class\\n\\n# Version 3.3.1\\n- *Sequencer* - Added `.addNamedLocation()` which allows you to store and cache locations as a string for later use in the sequence\\n- *Effects* - Fixed `.tint()` and `.fadeIn()`/`.fadeOut()` not working properly (thank you Codas!)\\n- *Effects* - Fixed `.from()` breaking antialiasing on token textures\\n- *Animations* - Fixed using named locations and named crosshairs not working in animations\\n\\n# Version 3.3.0\\n- *Crosshairs* - Added crosshairs! It can be used with `Sequencer.Crosshair.show()` (like warpgate) or with `.crosshair()` on a sequence. See the documentation ([here](https://fantasycomputer.works/FoundryVTT-Sequencer/#/crosshair) and [here](https://fantasycomputer.works/FoundryVTT-Sequencer/#/api/crosshair)) for more info.\\n- *Sequencer* - Fixed issues with preloading arrays of files\\n- *Sequencer* - Added polish localization (thank you Lioheart!)\\n- *Effects* - Greatly improved effect efficiency by improving batching capabilities (thank you Codas, you're a legend)\\n\\nUnfortunately, Sequencer is now a V12 only module.\\n\\n## Version 3.2.17\\n- *Sequencer* - Updated types (Thanks Vauxs on github!)\\n- *Effects* - Fixed some issues with the vision masking shader relating to the batch batching optimizations (Thanks Codas on github!)\\n- *Effects* - Fixed above UI layer not working with recent render batching optimizations (Thanks Codas on github!)\\n\\n## Version 3.2.16\\n- *Effects* - Major improvements to the way that effects are rendered to better support render batching (thank you Codas, you damn legend!)\\n- *Effects* - Tweaked flag manager to better handle effects with broken IDs\\n- *Animations* - Fixed `.teleportTo()` triggering regions that react upon movement (thanks Michael on github!)\\n- *Sounds* - Fixed sounds not playing on the right channel in v12\\n- *Sounds* - Fixed sounds not working with `.fadeInAudio()` and `.fadeOutAudio()`\\n- *Sounds* - Fixed sounds with `.atLocation()` and `randomOffset` in v12 not synchronizing the exact location between clients \\n\\n## Version 3.2.15\\n- *Effects* - Fixed non-`.xray()` effects showing in the fog of war\\n- *Sounds* - Removed stray debugger\\n\\n## Version 3.2.14 Hotfix\\n- *Sounds* - Fixed sounds again (thank you, Vauxs!)\\n\\n## Version 3.2.13\\n- *Sequencer* - Tweaks and fixes to documentation (thank you, Vauxs!)\\n- *Effects* - Fixed templates getting deleted shortly after being used for an effect would cause a Foundry crash\\n- *Effects* - Fixed effects sticking around after documents that they were attached to had been deleted\\n- *Sounds* - Fixed sounds not working properly in certain macros\\n\\n## Version 3.2.12\\n- *Sequencer* - Further updates to typing information (thank you, Vauxs!)\\n- *Sequencer* - Tweaked `preload` optional argument on `Sequence#play` to batch preload files (thank you, Codas!)\\n- *Sequencer* - Fixed `local` optional argument on `Sequence#play` to actually only play effects and sounds locally\\n- *Sequencer* - Tweaked Sequencer Manager to be more robust and less error prone when invalid effects are active\\n- *Effects* - Added `absolute` optional argument to `.animateProperty()` and `.loopProperty()`\\n- *Effects* - Fixed some effects not playing in the correct location, which fixes effect position issues with the Isometric module\\n- *Sounds* - Fixed sounds not playing in v11 (thank you, Vauxs!)\\n- *Canvas Pan* - Fixed initiating a shake with a frequency or duration of 0 would cause the canvas to freeze\\n\\n## Version 3.2.11\\n- *Sequencer* - Updated `Sequence#play` to have two additional secondary parameters:\\n  - `preload: boolean` - causes any section with `.file()` entries to preload all files that would be played\\n  - `local: boolean` - causes sections to be played only locally to the user executing the sequence\\n- *Sequencer* - Improved typing information (thank you, Vauxs!)\\n- *Effects* - Fixed non-ASCII text breaking some effects played with Automated Animations due to its usage with the Effect Manager\\n- *Effects* - Fixed the alpha of tokens and tiles not being respected with `attachTo()`\\n- *Effects* - Fixed `.template()` on effects not overwriting database templates\\n- *Effects* - Fixed `CanvasEffect#addAnimatedProperties` causing errors when used twice in a row as it would try to incorrectly serialize entire PIXI sprites\\n\\n## Version 3.2.10\\n- *Sequencer* - Fixed `{ name }` filters on `Sequencer.EffectManager` and `Sequencer.SoundManager` methods not working with regex-like strings\\n- *Effects* - Tweaked and improved the animation engine to better handle stacked animations on the same property\\n- *Effects* - Fixed `.persist()`ing effects with internal loop assets not finishing the ending portion when the effect was ended\\n- *Effects* - Fixed one shot effects replaying the first frame before disappearing\\n- *Effects* - Fixed `.aboveInterface()` effects blocking mouse interactions\\n- *Effects* - Fixed some looping inconsistencies with `.loopOptions()`\\n- *Effects* - Fixed being unable to snap effects to the grid when moved with the Sequencer Player\\n\\n## Version 3.2.9\\n- *Effects* - Fixed effects with `.attachTo()` sometimes throwing errors and causing the scene to freeze\\n- *Effects* - Fixed `.mask()`ed effects not following measured templates correctly\\n\\n## Version 3.2.8\\n- *Sequencer* - Fixed Sequencer Manager throwing A DIFFERENT error when trying to see active\\n- *Effects* - Fixed `.persist()` effects not looping when first created (but would loop if enough time had passed & user had refreshed - very odd)\\n\\n## Version 3.2.7 Hotfix\\n- *Effects* - Fixed `.persist()` effects not looping\\n\\n## Version 3.2.6\\n- *Sequencer* - Fixed Sequencer Manager throwing an error when trying to see active Sequences\\n- *Effects* - Added `.sortLayer()` to be able to more directly control which layer the effect lands on (only in Foundry v12)\\n  - This also fixes `.belowTokens()` being below tiles\\n  - Thank you Codas on GitHub!\\n- *Effects* - Added `.loopOptions()` to allow users to control how an effect loops\\n- *Effects* - Deprecated `.noLoop()` in favor of the above, will be elevated to loud deprecation in a future major version\\n\\n## Version 3.2.5\\n- *Effects* - Updated documentation to include `.volume()`, `.fadeInAudio()`, and `.fadeOutAudio()`\\n- *Effects* - Fixed some issues with effect scaling when using `.loopProperty()` and `.animateProperty()`\\n- *Sounds* - Fixed `Sequencer.SoundManager.endAllSounds()` not ending all sounds\\n- *Sounds* - Fixed `Sequencer.SoundManager.endSounds()` sometimes not correctly ending the right sounds\\n- *Sounds* - Fixed calling `.sound()` would break sequences in both Foundry v11 and v12\\n\\n## Version 3.2.4\\n- *Sequencer* - Fixed `.preset()` not working when called directly on a sequence (thanks MrVauxs!)\\n- *Effects* - Added deprecation warning to `.file()` instead of an error when giving it a second boolean parameter\\n- *Effects* - Fixes to the isometric module - may still not be 100%, but it shouldn't error anymore\\n- *Sounds* - Fixed sounds not playing on v11 (again!)\\n\\n## Version 3.2.3 Hotfix\\n- *Effects* - Fixed issue with effects not playing their full duration\\n\\n## Version 3.2.2\\n- *Sequencer* - ACTUALLY fixed welcome message being posted multiple times in bigger worlds (will also get rid of duplicates)\\n- *Effects* - Fixed `.animateProperty()` and `.loopProperty()` not working when used on `alphaFilter`\\n- *Effects* - Fixed effects that were attached to temporary templates (like warpgate's crosshairs) not disappearing after the crosshair had been placed\\n- *Effects* - Fixed issue with `complete`-loop type effects not playing correctly\\n\\n## Version 3.2.1\\n- *Sequencer* - Fixed welcome message being posted multiple times on The Forge - my apologies for this\\n- *Sequencer* - Fixed `Sequencer.Preloader` not being properly set up (thanks Codas on github!)\\n- *Effects* - Added `antialiasing` optional argument to `.file()` - expects `PIXI.SCALEMODES.LINEAR` or `PIXI.SCALEMODES.NEAREST`\\n- *Effects* - Fixed `.moveTowards()` not working\\n- *Effects* - Fixed `.animateProperty()` and `.loopProperty()` not properly animating effects\\n- *Effects* - Fixed `.timeRange()` and `.endTime()` not working properly\\n- *Sounds* - Fixed `.atLocation()` incorrectly throwing errors when on Foundry v12 (thanks Codas on github!)\\n- *Sounds* - Fixed sounds not working on Foundry v11\\n\\n## Version 3.2.0\\n- *Sequencer* - Added support for FoundryVTT v12 while remaining backwards compatible with v11\\n- *Sequencer* - Added startup chat message with links to relevant external resources\\n- *Sequencer* - Added support for the [Isometric module](https://foundryvtt.com/packages/grape_juice-isometrics) (thanks grape_juice for their assistance with this integration!) \\n- *Sequencer* - Added `Sequencer.SoundManager` which is a sound interface that mirrors `Sequencer.EffectManager`\\n- *Effects* - Greatly improved responsiveness of attached effects actually following their targets more accurately\\n- *Effects* - Removed deprecated methods `.offset()` and `.randomOffset()` as those should now be done with the relevant location-based secondary parameters\\n- *Effects* - Added `.syncGroup()` which allows you to synchronize the playback of multiple effects in the same scene\\n- *Effects* - Tweaked `.scaleToObject()` to cache its target's scale when first created, unless paired with `.attachTo()` and `bindScale` (see below)\\n- *Effects* - Added `bindScale` (defaults to `true`) to `.attachTo()`, that if combined with `.scaleToObject()` it will always scale with the object\\n- *Effects* - Fixed `.tint()` not being applied when used with `.attachTo()` and `.stretchTo()` with `{ attachTo: true }`\\n- *Effects* - Tweaked `.attachTo()`'s `followRotation` to be named `bindRotation` (will remain backwards compatible until 3.3.0 before becoming deprecated)\\n- *Sounds* - Added support for the following methods (see the [`.sound()` documentation](https://fantasycomputer.works/FoundryVTT-Sequencer/#/api/sound) for more info):\\n  - `.name()`\\n  - `.origin()`\\n  - Below only in Foundry v12:\\n    - `.atLocation()`\\n    - `.radius()`\\n    - `.constrainedByWalls()`\\n    - `.distanceEasing()`\\n    - `.alwaysForGMs()`\\n    - `.baseEffect()`\\n    - `.muffledEffect()`\\n\\n## Version 3.1.4\\n- *Effects* - Added better support for the Walled Templates module\\n- *Effects* - Fixed effects becoming invisible when using both `offset` and `local` with just a source location and no target\\n- *Effects* - Fixed `.shape()`s `isMask` property not working when the shape type was set to `polygon`\\n- *Sounds* - Fixed \\\"End All Sounds\\\" button not working in the Sequencer Manager\\n\\n## Version 3.1.3\\n- *Sequencer* - Removed stray debugger, whoops\\n- *Animations* - Fixed `.rotateTowards()` being off by a few degrees\\n- *Effects* - Added `.temporary()`, which causes an effect to not set any flags on any objects, which means a refresh will make the effect disappear\\n- *Effects* - Fixed `.zIndex()` not working with `.screenSpace()`\\n- *Effects* - Fixed `offset`'s `local` modifier not applying correctly when using `.stretchTo()` and the like\\n\\n## Version 3.1.2\\n- *Sequencer* - Fixed Sequencer's ready hooks sometimes not firing when canvas was fully ready\\n- *Effects* - Improved persistent effects behavior when pasted across scenes \\n\\n## Version 3.1.1\\n- *Effects* - Fixed `.shape()` with `mask: true` not masking its parent\\n- *Effects* - Hopefully fixed issues surrounding effects sometimes not being cleared properly\\n- *Effects* - Fixed effects in v11 sometimes ending up in the top left corner after switching scenes\\n\\n## Version 3.1.0\\n- *Sequencer* - Fixed a bug in the database when copying some file paths would not work properly\\n- *Effects* - Added `.aboveInterface()`\\n\\n## Version 3.0.14\\n- *Sequencer* - Improved Database-to-Database binding when considering custom metadata\\n- *Animations* - Fixed cases where if a newly created token had `.animation()`s applied to them would sometimes fail due to `Token#mesh` not being initialized (Thanks LukeAbby & TMinz)\\n- *Effects* - Vastly improved `.mask()` performance and behavior all thanks to dev7355608!\\n- *Effects* - Fixed a rare case where range-finding effects would fail to determine the right video file to play\\n\\n## Version 3.0.13\\n- *Effects* - Added `.randomSpriteRotation()`\\n- *Effects* - Fixed a bug with cached locations and `.mask()`\\n- *Effects* - Fixed database-to-database mappings\\n\\n## Version 3.0.12\\n- *Sequencer* - Fixed console error caused by the clean-up of old expired effects (Thanks LukeAbby on Github!)\\n- *Sequencer* - Added `fullyQualified` secondary parameter to `Sequencer.Database.getPathsUnder()` (Thanks LukeAbby on Github!)\\n- *Animations* - Added support for elevation in `.teleportTo()`\\n- *Canvas Pan* - Fixed `.canvasPan()` not working other clients than the executing client\\n- *Effects* - Slightly adjusted how `.missed()` interacts with `.stretchTo()` when two tokens are right next to each other\\n- *Effects* - Fixed `.playbackRate()` causing effects to have the incorrect amount of playback time\\n- *Effects* - Fixed `.rotateTowards()` not working with `.text()`\\n\\n## Version 3.0.11\\n- *Sequencer* - Made PIXI fix settings default to being turned off\\n- *Sequencer* - Fixed strange interaction with `.preset()` not working when certain functions were called in the preset\\n- *Sequencer* - In Foundry v11, `.macro()` now requires the secondary parameter to be an object, as the behavior of Advanced Macros have been partially integrated in v11\\n- *Effects* - Fixed some persistent effects not being deleted from scenes after their attached sources were deleted\\n- *Effects* - Fixed effects targeting drawings not properly using the drawing position and dimensions\\n- *Effects* - Fixed `.playbackRate()` not working well with internal loops and `.persist()`\\n\\n## Version 3.0.10\\n- *Sequencer* - Fixed Effect Player not working in Foundry v11\\n- *Sequencer* - Fixed private modules showing up in the Database Viewer\\n\\n## Version 3.0.9\\n- *Canvas Pan* - Added `.shake()` which can be used to add camera shake to the canvas\\n- *Effects* - Fixed glow filter not working in v11\\n- *Effects* - Fixed `.belowTokens()` being below tiles as well\\n\\n## Version 3.0.8\\n- *Effects* - Fixed `stretchTo()` effects sometimes not being visible\\n\\n## Version 3.0.7\\n- *Effects* - Added `requiresLineOfSight` and `hideLineOfSight` to the secondary arguments of `.stretchTo()`\\n  - This requires `attachTo` to be true in `stretchTo()`\\n  - `requiresLineOfSight` causes the effect to immediately end if the line of sight between the source and target is broken\\n  - `hideLineOfSight` modifies the above behavior to temporarily hide the effect until the line of sight is unbroken\\n- *Effects* - Fixed the \\\"External Effect Opacity\\\" setting, which causes effects playing for other players to show up as faint for GMs to let them know that players has effects playing for them, but would not work if the opacity was set to 0\\n- *Effects* - Improved dual-attached effects performance\\n\\n## Version 3.0.6\\n- *Sequencer* - Fixed issue with Sequencer trying to make users migrate tokens and effects they do not own \\n- *Effects* - Fixed effects not updating reliably when the target's opacity and/or hidden status changes\\n\\n## Version 3.0.5\\n- *Effects* - Fixed support for google bucket files (it meant to be `video/x-webm` instead of `video/webm-x`)\\n- *Effects* - Fixed dual attached effects disappearing once going beyond the range of the initial effect\\n\\n## Version 3.0.4\\n- *Effects* - Added support for file buckets that contain `video/webm-x` files (mostly Google Buckets)\\n- *Effects* - Fixed `.scaleToObject()` taking into account token scale when it should not (unless `considerTokenScale` is set to `true`)\\n\\n## Version 3.0.3\\n- *Sequencer* - Fixed edge case with `.addSequence()` that would cause a sequence to ignore `softFail`\\n- *Effects & Sounds* - Removed secondary boolean argument for `.file()` as it is covered by the Sequence-wide soft fail\\n\\n### Version 3.0.2\\n- *Sequencer* - Added backwards compatibility to the old format of `new Sequence(moduleName, softFail)`\\n- *Sequencer* - Added `remote` support for `.wait()`\\n- *Sequencer* - Added `moduleName` and `softFail` support for `remote`\\n- *Animations* - Fixed `.snapToGrid()` sometimes not working well on hex scenes \\n- *Effects* - Fixed `.xray()` causing effects to disappear\\n- *Sounds* - Fixed `softFail` not working properly\\n\\n### Version 3.0.1\\n- *Effects* - Fixed `cacheLocation` not working on effect locations\\n- *Effects* - Fixed dual attached effects not working\\n\\n### Version 3.0.0\\n- *Sequencer* - Updated Sequencer Database Viewer:\\n  - Improved UI and added nested tree view\\n  - Added ctrl modifier to buttons that copy paths, which adds quotes around the copied paths\\n- *Sequencer* - Updated Sequencer Effect Player:\\n  - Improved UI based on the design of MatthijsKok on github - thanks a lot for the inspiration!\\n- *Sequencer* - Reworked the Sequencer Effect Manager to the Sequencer Manager:\\n  - Added the ability to stop running sounds\\n  - Added a Sequence view where you can see the sequences as they are running, and stop the entire execution or their individual sections\\n- *Sequencer* - Added `.scrollingText()` which allows playing scrolling text on the canvas for users\\n- *Sequencer* - Added `.canvasPan()` which allows panning the canvas for connected users\\n- *Sequencer* - Added `.toJSON()` and `.fromJSON()` to Sequences to be able to be serialized and deserialized; only sequences with effects, sounds, and scrolling texts can be serialized\\n- *Sequencer* - Added options to `.play()`, which may contain an object; currently supports `{ remote: true/false }` which will serialize the sequence (see above), and send it to each client for local playback, instead of the person running the sequence sending data to clients as it is being executed\\n- *Sequencer* - Added database support for `_timestamps` metadata on effect files, which will trigger the `sequencerEffectTimestamp` hook when effects reach the point of the timestamps for that file\\n- *Sequencer* - Added support for flipbook-type effects through a `_flipbook` database tag\\n- *Animations* - Improved playback of movement, fade in/out, and rotation animations on tokens\\n- *Effects* - Added `CanvasEffect#addAnimatedProperties`, which will allow you to easily add animations to properties of existing effects\\n- *Effects* - Improved screenspace above UI effect performance by not rendering the extra canvas when not in use\\n- *Effects* - Fixed screenspace effects being affected by the vision mask\\n- *Effects* - Fixed `.stretchTo()` effects would be visible when not in vision\\n- *Effects* - Fixed `.fadeOut()` and `.scaleOut()` not working at all\\n- *Effects* - Reworked how effects are replicated on linked tokens when `.persist()`'s `persistPrototypeToken` is enabled, improving performance\\n\\n### Version 2.414\\n- *Sequencer* - Included missing CSS file\\n\\n### Version 2.413\\n- *Sequencer* - Added support for database paths that resolve to other database paths\\n- *Sequencer* - Isolated Sequencer's styling so that it doesn't leak out into other modules or systems\\n- *Effects* - Fixed `.loopProperty()` not respecting `loops: 0`\\n- *Effects* - Fixed `.animateProperty()` not keeping track of relative values when animating the same property multiple times\\n- *Effects* - Fixed named screenspace effects without a specific location not playing and throwing errors\\n- *Sounds* - Fixed `softFail` not allowing sounds to softly fail\\n\\n### Version 2.412\\n- *Sequencer* - Added setting to hide/show the Sequencer buttons in the left sidebar when in the token controls\\n- *Animation* - Fixed `.moveTowards()` going into infinite loop if the source and targets are on top of each other\\n- *Effects* - Fixed `.shape()` taking grid size into account multiple times\\n- *Effects* - Fixed `.volume()`, `.fadeInAudio()`, and `.fadeOutAudio()` not working on webms with embedded audio \\n\\n### Version 2.411\\n- *Sequencer* - Fixed infinite recursion when using `.waitUntilFinished()` in the middle of a sequence\\n- *Sequencer* - Undid some minor issues in the database viewer\\n\\n### Version 2.410\\n- *Sequencer* - Added support for playing sounds in the Sequencer Database (thank you ZotyDev for the pull request!)\\n- *Sequencer* - Calling methods on the sequence that it does not have will be attempted to be cast to the last section\\n- *Sequencer* - You can now provide `false` as an argument to `.waitUntilFinished()`, which will negate its call\\n- *Effects* - Fixed animations on `alphaFilter`'s `alpha` not working\\n\\n### Version 2.49\\n- We don't talk about this version\\n\\n### Version 2.4.8\\n- *Effects* - Fixed rectangle measurable templates would be off by 45 degrees\\n- *Effects* - Fixed tokens with locked rotation would cause attached effects to be rotated anyway\\n- *Effects* - Fixed `.tint()` not applying to `.stretchTo()` effects\\n\\n### Version 2.4.7\\n- *Effects* - Actually fixed shapes\\n\\n### Version 2.4.6\\n- *Effects* - Fixed effects with only shapes would not play properly\\n- *Effects* - Fixed error when users tried to play effects even when `softFail` was set to `true`\\n\\n### Version 2.4.5\\n- *Effects* - Fixed effects playing on the same scene as the user's current scene, even if the target of the effect was on another scene\\n- *Effects* - Fixed `.from()` not working with the new `softFail` sequence parameter\\n- *Effects* - Fixed being able to pass non-valid parameters to `.atLocation()` and similar functions without errors\\n\\n### Version 2.4.4\\n- *Sequencer* - Tweaked the arguments to `new Sequence(\\\"moduleName\\\")` to `new Sequence(inOptions)` - it now takes a single object that can contain:\\n  - `moduleName` <string> - The name of the module that is creating this sequence - this is for other users to know which module used Sequencer\\n  - `softFail` <boolean> - Setting this to `true` causes any failures to find files for effects, sounds, or macros to softly fail, rather than halt the entire sequence\\n- *Effects* - Tweaked `.shape()`s parent to be the `spriteContainer` rather than the `sprite`, so that animations to the sprite doesn't affect the shapes\\n- *Effects* - Fixed `.shape()` not considering their offset with `isMask` enabled  \\n\\n### Version 2.4.3\\n- *Sequencer* - Switched `Disable Pixi Fix` to `Enable Pixi Fix` to make it more consistent with other settings\\n- *Sequencer* - Added `Enable Global Pixi Fix` which fixes the alpha on animated tiles if enabled (use with caution) \\n- *Effects* - Fixed `.atLocation()` and `.persist()` throwing errors and thus failing to persist the effect on the scene\\n- *Effects* - Slight tweaks to visibility logic of effects to be more consistent\\n- *Effects* - Tweaked `.attachTo()`'s `align` and `edge` to not consider token scale when determining the edge of the token\\n\\n### Version 2.4.2\\n- *Sequencer* - Added `Sequencer.Presets` which allows you to create and save reusable bits of sequences\\n- *Sequencer* - Added `.preset()` which allows you to use the aforementioned presets\\n- *Sequencer* - Added optional `considerTokenScale` to the optional `options` parameter to `.scaleToObject()`, you can set it to `true` in order for the visual effect to also consider the token scale\\n- *Sequencer* - Added support for persistent visual effects on \\\"fake\\\" tokens created by Multilevel Tokens (only supports effects that are applied to the prototype token) \\n- *Sequencer* - Slightly improved the speed of document updates when visual effects are first applied\\n- *Sequencer* - Added a throttled console warning when the Photosensitive Mode is enabled and a client is trying to play effects (only warns once every 10 seconds when effects are played)\\n- *Effects* - Fixed `.scaleToObject()` always taking token scale into account, which it shouldn't do by default\\n\\n### Version 2.4.1\\n- *Effects* - Fixed minor typo in `.mask()`\\n\\n### Version 2.4.0\\n- *Sequencer* - Added `Seqencer.EffectManager` to the autocomplete types\\n- *Sequencer* - Fixed minor issue with the Effect Manager sometimes trying to load non-existent effect data\\n- *Effects* - Added `.shape()`, which allows you to create simple shapes on the canvas\\n  - See: <https://fantasycomputer.works/FoundryVTT-Sequencer/#/api/effect?id=shape>\\n- *Effects* - Fixed `.attachTo()` would attempt to apply flags on temporary templates such as warpgate crosshairs\\n\\n### Version 2.3.21\\n- *Sequencer* - Fixed interaction with the `Advanced Macros` module past version 1.19.2 (Thanks MrVaux!)\\n- *Sequencer* - Fixed issue with `Sequencer.Helpers.shuffle_array` not handling complex arrays very well\\n- *Effects* - Fixed `.from()` not taking token scale into account\\n\\n### Version 2.3.20\\n- *Sounds* - Fixed sounds not working\\n\\n### Version 2.3.19\\n- *Sequencer* - Created a new wiki for Sequencer:\\n  - <https://fantasycomputer.works/FoundryVTT-Sequencer/> \\n- *Sequencer* - Added full support for Sequencer typings in the ***Monaco Macro Editor*** (thanks to laquasicinque for your initial work!)\\n- *Sequencer* - Changed all settings to use Foundry v10's `requiresReload` instead of reloading the app\\n- *Sequencer* - Removed compendium of sample macros, in favor of the new wiki\\n- *Effects* - Added further support for webm's loaded through S3 buckets (files with type `application/octet-stream` now supported)\\n- *Sounds* - Sounds' `.file()` now has a secondary parameter to allow a false-y primary input to soft fail, instead of halting the entire Sequence\\n\\n### Version 2.3.18\\n- *Sequencer* - Added support for Foundry's photosensitive setting, which disables all effects without impacting other functionality \\n- *Sequencer* - Fixed incompatibility with the Foundry team's ***A House Divided*** adventure, the scenes should no longer appear to have a dark overlay\\n- *Sequencer* - Updated `.macro()` to work with the latest version of the ***Advanced Macros*** module\\n\\n### Version 2.3.17\\n- *Effects* - Fixed `.tieToDocuments()` not working for embedded documents on unlinked tokens\\n\\n### Version 2.3.16\\n- *Effects* - Adjusted approach when ending effects when using `.tieToDocuments()`\\n\\n### Version 2.3.15\\n- *Sequencer* - Fixed registering similar named modules in the database would cause the second to not register properly \\n\\n### Version 2.3.14\\n- *Effects* - ACTUALLY fixed `.tieToDocuments()` (send help)\\n\\n### Version 2.3.13\\n- *Effects* - Fixed deeper issue with `.tieToDocuments()` as it was not recognizing actors or items as parents in respect to UUIDs\\n\\n### Version 2.3.12\\n- *Effects* - Fixed `.missed()` and `.stretchTo()`'s `randomOffset` having weird interactions when `.name()` was used to play effects at target locations\\n- *Effects* - Fixed `.tieToDocuments()` throwing errors and not removing effects when the tied documents were deleted \\n\\n### Version 2.3.11\\n- *Sequencer* - Added `Sequencer.Database.inverseFlattenedEntries` which is a map object with the key being the file path and the value being the database path for that file\\n- *Effects* - Added `bindElevation` (default `true`) as a secondary argument to `.attachTo()` which can be used to make effects not follow the target's elevation\\n- *Effects* - Made `.elevation()` be relative to the target of the effect by default, you can pass a secondary object with `absolute: true` to make it absolutely elevated on the scene\\n- *Effects* - Improved internal logic when trying to play effects on clients who have disabled them - previously it had a chance to throw an error when clients with effects disabled would run sequences that included effects (as they would not know the duration of the effect)\\n\\n### Version 2.3.10\\n- *Effects* - Fixed race condition when deleting multiple attached effects in a row would leave some lingering effects\\n\\n### Version 2.3.9\\n- *Effects* - Fixed effects sticking around after deleting the document they were attached to\\n- *Effects* - Fixed error when deleting documents relating to named effects\\n- *Effects* - Fixed setting the position of screenspace effects would not work\\n\\n### Version 2.3.8\\n- *Sequencer* - Removed double declaration of socketlib hook\\n- *Effects* - Fixed error if no scenes has been created yet\\n- *Effects* - Fixed screenspace effects not working without setting its location\\n- *Effects* - Fixed `.animateProperty()` not working very well with `width` and `height`\\n- *Effects* - Improved the way effects interacts with Foundry hooks (it is more efficient)\\n\\n### Version 2.3.7\\n- *Effects* - Fixed `.rotateTowards()`'s `rotationOffset` parameter not working properly\\n\\n### Version 2.3.6\\n- *Effects* - Fixed multiple `.attachTo()` and `.strechTo()` with `attach: true` sometimes causing crashes due to overloading Foundry's tick function\\n- *Effects* - Fixed ColorMatrix `hue` and `.animateProperty()` not working well together\\n- *Effects* - Fixed `.atLocation()` with `randomOffset: true` would cause weird effects with `.stretchTo()`\\n\\n### Version 2.3.5\\n- *Sequencer* - Removed Ouija Board example macros, this is now a separate module made by md-mention2reply, check it out!\\n    - <https://foundryvtt.com/packages/ouija-board-for-sequencer>\\n- *Sequencer* - Updated module manifest to be more V10 compatible\\n- *Effects* - Fixed ColorMatrix `hue` property to be able to be animated with `animateProperty()` and `.loopProperty()`\\n- *Effects* - Fixed `.mask()` not working with tiles or measurable templates\\n- *Effects* - Fixed mirror and random mirror X/Y not actually flipping the effect\\n\\n### Version 2.3.4\\n- *Animations* - Fixed `.rotateTowards()` throwing update error\\n\\n### Version 2.3.3\\n- *Effects* - Fixed code to remove deprecation warning when both `.mask()` and `.persist()` was used\\n- *Effects* - Fixed rare issue where the temporary template layer would not be initialized and would cause Sequencer to error and stop working \\n- *Effects* - Fixed Sequencer Effects Player deprecation warnings\\n- *Effects* - Added warning to console for players trying to play effects when they do not have permission to do so\\n  - I realize warnings is not desired in most cases, but this has been an ongoing point of support, so to preserve my own sanity, this is just how it is now.\\n\\n### Version 2.3.2 (Both Foundry V9 and V10)\\n- *Animation* - Fixed `.rotateTowards()` throwing errors\\n- *Effects* - Fixed `.loopProperty()` with property `scale` would incorrectly scale effect\\n\\n### Version 2.3.1\\n- *Effects* - Fixed `.from()` and `.mask()` throwing errors about missing files\\n\\n### Version 2.3.0 (V10 only)\\n- *Sequencer* - Added Spanish localization (thanks to Git-GoR!)\\n- *Effects* - Re-enabled `scale.x` and `scale.y` on `.animateProperty()` and `.loopProperty()` \\n- *Effects* - Deprecated `.belowTokens()` and `.belowTiles()` in favor of `.elevation()` due to fundamental changes in Foundry's V10 update. These methods will be removed in a future update\\n- *Effects* - Fully removed deprecated methods: `.addPostOverride()`, `.reachTowards()`, `.gridSize()`, `.startPoint()`, `.endPoint()`\\n\\n### Version 2.2.4\\n- *Effects* - Fixed `.rotateTowards()`'s `rotationOffset` parameter not working properly\\n- \\n### Version 2.2.3\\n- Re-released 2.2.2, git pulled a fast one and the changes in that version never got out\\n\\n### Version 2.2.2\\n- *Animation* - Fixed `.rotateTowards()` throwing errors (again)\\n- *Effects* - Fixed `.atLocation()` with `randomOffset: true` would cause weird effects with `.stretchTo()`\\n- *Effects* - Fixed error that would sometimes pop up during startup if the template layer has not been initialized\\n\\n### Version 2.2.1\\n- *Animation* - Fixed `.rotateTowards()` throwing errors\\n- *Effects* - Fixed `.loopProperty()` with property `scale` would incorrectly scale effect\\n- \\n### Version 2.2.0 (last V9 update, except maybe some bug fixes)\\n**Additions:**\\n- *Effects* - Added `.tieToDocuments()` which allows you to tie an effect to Foundry documents - such as Active Effects or Tokens. When these are deleted, the effect is automatically ended.\\n- *Effects* - Added secondary `offset` parameter to `.atLocation()`, `.attachTo()`, `.rotateTowards()`, `.from()`, and `.stretchTo()` which can be used to offset the location of the source or target\\n  - Note: This means that `.offset()` is becoming deprecated - it will remain for a few versions with a silent warning\\n- *Effects* - Added `.spriteScale()` which can be used to scale the sprite of the effect separately from `.scale()`\\n\\n**Tweaks:**\\n- *Animations* - Renamed `.rotateTowards()`'s secondary parameter's `offset` property to be more accurately named `rotationOffset`\\n- *Effects* - Upgraded `.animateProperty()` and `.loopProperty()` to be additive, which means two animations can now target the same property on the same effect\\n- *Effects* - Renamed `.rotateTowards()`'s secondary parameter's `offset` property to be more accurately named `rotationOffset`\\n\\n**Fixes:**\\n- *Sequencer* - Fixed issue where copying the file path of a Database entry that has multiple ranges would always copy the file path for the middle-most range\\n- *Sequencer* - Rewrote the database traversal method to be more robust and carry metadata down to lower children\\n- *Effects* - Fixed long-running issue with lag and performance impact from Sequencer on some computers - the cause was the `.screenSpace()` layers, which have now been reworked. A setting to disable the Above UI Screenspace effects layer has been added to further support impacted individuals.\\n- *Effects* - Fixed `randomOffset` secondary option on `.attachTo()` not working\\n- *Effects* - Fixed `.scaleToObject()` and `.scale()` not playing nicely together\\n- *Effects* - Fixed loop markers not properly working\\n\\n### Version 2.1.14\\n- *Sequencer* - Removed PIXI fix for Foundry .webm tiles to apply premultiplied alpha, native Foundry behavior is now active\\n- *Effects* - Fixed fatal canvas errors when `persistTokenPrototype` was active and masked to the target of the effect\\n- *Effects* - Added warning when using `persistTokenPrototype` with masks _other_ than masks applied to the source target\\n- *Effects* - Added support for `.file()` to override `.from()`'s file while keeping the other settings intact\\n- *Effects* - Improved robustness of placeable object document retrieval\\n\\n### Version 2.1.13\\n- *Sequencer* - Removed stray `console.log`\\n- *Sequencer* - Fixed Ouija board macro error, slightly improved effect positioning\\n- *Effects* - Added `.spriteRotation()` which allows you set the rotation of the effect in place - this differs from `.rotate()` in the sense that this is applied only locally to the sprite, after any other offsets or transformations\\n\\n### Version 2.1.12\\n- *Effects* - Fixed `.strechTo()` with parameter `attachTo: true` resulting in no stretching\\n\\n### Version 2.1.11\\n- *Effects* - Fixed effects attached to temporary templates causing errors in core Foundry code\\n- *Effects* - Effects attached to temporary objects (like warpgate cursors) are now propagated to other clients (call `.locally()` to make it only appear for the creator)\\n\\n### Version 2.1.10\\n- *Sequencer* - Fixed Sequencer Effect Manager not accepting Foundry documents as object references when filtering for effects\\n- *Sequencer* - Fixed Sequencer Effect Player showing private database entries\\n- *Effects* - Fixed attached effects not showing up for non-GMs\\n\\n### Version 2.1.9 \\n- *Sequencer* - Unlocked keybinds so that users may configure their own keybinds for Sequencer's layers\\n- *Sequencer* - Added support for `minDelay` and `maxDelay` on `.waitUntilFinished()`, so you can now have a random wait delay between sections\\n- *Effects* - Added `fromEnd` to `.animateProperty()` which causes the animation to play at the end of the effect's duration\\n- *Effects* - Added `gridUnits` support to `.animateProperty()` and `.loopProperty()` when using `position.x` or `position.y` as the animated target\\n- *Effects* - Added `gridUnits` as a secondary option to both `.offset()` and `.spriteOffset()`\\n- *Effects* - Fixed persistent prototype token effects not applying on every instance of its token\\n- *Effects* - Fixed `.playbackRate()` only adjusting effect duration, and not the actual playback rate\\n\\n### Version 2.1.8\\n- *Sequencer* - Added setting to allow clients to disable Sequencer's PIXI alpha fix for base textures\\n\\n### Version 2.1.7\\n- *Effects* - Fixed string normalization\\n\\n### Version 2.1.6\\n- *Sequencer* - Updated compendium of Sequencer macro samples\\n- *Effects* - Fixed finding effects by name with accents in them silently failing\\n- *Effects* - Fixed `.attachTo()` not following the target's rotation\\n\\n### Version 2.1.5\\n- *Effects* - Fixed switching scenes would sometimes break effects\\n\\n### Version 2.1.4\\n- *Effects* - Fixed issue with hovering over persistent effects attached to objects sometimes causing Foundry's layers to crash\\n- *Effects* - Fixed `.animateProperty()` and `.loopProperty()` applying grid-size ratio on animated scales\\n\\n### Version 2.1.3\\n- *Effects* - Fixed attached effects disappearing\\n- *Effects* - Fixed `.randomOffset()` not randomly offsetting effects (still deprecated, see 2.1.0 release notes)\\n\\n### Version 2.1.2 Hotfix\\n- *Effects* - Fixed effects sometimes not becoming visible\\n\\n### Version 2.1.1\\n- *Sequencer* - Fixed canvas layer bug that caused performance issues for some users\\n- *Sequencer* - Fixed missing default template causing some effects to not play properly\\n- Added `.aboveLighting()`, which causes the effect to always be visible, regardless of sight, fog of war, or walls.\\n  - Note that if an effect is attached to an object via `.attachTo()`, you may need to disable `bindVisibilty` if the object is hidden\\n- *Effects* - Fixed `.from()`, it now uses the object's image when the effect plays, rather than when the Sequence was first created\\n- *Effects* - Fixed highlight box when hovering over effects in the Effect Manager UI not taking effect rotation into account\\n- *Effects* - Fixed effects sometimes not fully following its attached object \\n\\n### Version 2.1.0\\n**Additions:**\\n- *Sequencer* - Added support for the Effect Manager to be able to manipulate effects on other scenes, which means you can now end effects on other scenes than the one you're on via the API\\n- *Sequencer* - Added secondary options parameter to `Sequencer.Database.getEntry`, where `softFail: true` will cause the method to not throw errors when an entry was not found. \\n- *Sequencer* - Added `Sequencer.EffectManager.getEffectPositionByName` which will allow you retrieve an effect's position by name, in real time\\n- *Effects* - Added `.mask()`, which can now clip-mask effects to only show them within tokens, templates, tiles, or drawings - this supports the [Walled Templates module](https://foundryvtt.com/packages/walledtemplates)!\\n- *Effects* - Added a secondary options parameter to `.persist()`, which can accept `persistTokenPrototype: true` to persist the effect on the token's prototype data, useful for active effect-based VFX\\n- *Effects* - Added vision masking - now token vision affects how much of an effect they can see\\n- *Effects* - Added `.xray()` which can be used to turn off vision masking on individual effects \\n- *Effects* - Added support in the Sequencer Database for internal effect loops, see the [documentation for more information](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/How-to:-Sequencer-Database#Internal-loops)\\n- *Effects* - Added `edge` option to `.attachTo()`, which can be set to `inner`, `on`, or `outer` to align the effect on the attached object's edge when used with `align` \\n- *Effects* - Added `.screenSpaceAboveUI()`, which causes `.screenSpace()` effects to play above _all_ UI elements in Foundry (use with caution)\\n- *Effects* - Added options parameter to `.scaleToObject()`, which can be passed `uniform: true` to cause the scaling to always be uniform (it picks the largest dimension of the object)\\n- *Macros* - Added the ability to reference compendiums when creating `.macro()`s in sequences\\n\\n**Fixes:**\\n- *Sequencer* - As `SequencerDatabase` was deprecated in 2.0.0 in favor of `Sequencer.Database`, the former has now been removed\\n- *Sequencer* - Adjusted Database methods with more validation so that searching with empty strings won't throw hard to read errors\\n- *Sequencer* - Removed bogus Effect Player warning about permissions that no longer reflects what Sequencer does\\n- *Sequencer* - Fixed some issues when copying and playing effects through the Database Viewer\\n- *Effects* - Fixed effects being invisible to players if the effect was created out of sight (thanks @dev7355608!)\\n- *Effects* - Fixed `align` on `.attachTo()` not working as expected when an effect's scale or size was set\\n- *Effects* - Fixed blur filter not taking given properties into account\\n- *Effects* - The following functions now have loud deprecation warnings:\\n    - `.addPostOverride()`\\n    - `.reachTowards()`\\n    - `.gridSize()`\\n    - `.startPoint()`\\n    - `.endPoint()`\\n- *Effects* - Deprecated `.randomOffset()` in favor of adding `randomOffset` as a secondary argument on `.atLocation()`, `.stretchTo()`, `.rotateTowards()`, and `.attachTo()`\\n\\n### Version 2.0.16\\n- *Sequencer* - Added japanese localization (thanks to the illustrious Brother Sharp#6921!)\\n\\n### Version 2.0.15\\n- *Effects* - Fixed errors relating to tiling textures\\n- *Effects* - Fixed drifting effect animations when FPS dropped\\n- *Effects* - Improved performance relating to always updating the position of the sprites, even when attached objects weren't moving\\n- *Effects* - Hopefully fixed some memory leaks relating to assets not being deleted properly \\n- *Effects* - Fixed attached effects' rotations being funky\\n- *Effects* - Fixed effects attached to temporary objects (such as the warpgate crosshair) would not be properly removed from the effect manager \\n\\n### Version 2.0.14\\n- *Database* - Fixed the database sometimes getting confused by paths that have `ft` in them without being range-finding\\n- *Effects* - Fixed double-attached effects sometimes resulting in the sprite freezing (or in rare cases, browser crashes), though this type of effect is still expensive!\\n- *Effects* - Fixed `rotateTowards` with `attachTo` enabled not respecting actual target position end position\\n- *Effects* - Fixed `.rotation()` with `.loopProperty()` on the `spriteContainer`'s `rotation` causing rotational strangeness\\n- *Effects* - Fixed `.repeat()` with partial database path not picking random images for each repetition\\n- *Sounds* - Fixed error when playing sounds\\n\\n### Version 2.0.13\\n- *Effects* - Fixed flipped tiles and measurable templates (with negative width or height) causing effects to not play on the correct location\\n- *Effects* - Fixed `.rotateTowards()` not following the rotation of attached objects\\n- *Sounds* - Fixed `.fadeInAudio()` and `.fadeOutAudio()` being broken\\n\\n### Version 2.0.12\\n- *Effects* - Fixed effects with only `.text()` and no `.file()` not working properly\\n- *Effects* - Fixed `.text()` combined with `.screenSpace()` would not be scaled properly \\n\\n### Version 2.0.11\\n- *Effects* - Fixed `.extraEndDuration()` not working properly when `.waitUntilFinished()` was provided a negative number\\n- *Effects* - Fixed `.noLoop()` effects sometimes not reaching their proper end time when `.endTime()`, `.endTimePerc()` or `.timeRange()` was used\\n\\n### Version 2.0.10\\n- *Sequencer* - Fixed error in `Database.validateEntries()`\\n- *Sequencer* - Updated `pre` hooks to cancel the action if any function return `false`\\n- *Sequencer* - Updated Rope and Chain macros in compendium\\n- *Effects* - Added `.tilingTexture()` - this will replace the `tiling` parameter on `.stretchTo()` in the long term\\n- *Effects* - Deleting the object an effect is attached to will now actually trigger the effect's `.fadeOut()`, `.scaleOut()` etc\\n\\n### Version 2.0.9 Hotfix\\n- *Effects* - Fixed nasty issue with rotation on effects\\n- *Effects* - Made all effects have an assumed internal grid size of 100\\n\\n### Version 2.0.8\\n- *Sequencer* - Added rope and chain sample macros to the Sequencer macro compendium\\n- *Sequencer* - Removed non-functional Chain Lightning macro from macro collection\\n- *Sequencer* - Added warnings to Preloader when it is given invalid parameters\\n- *Effects* - Added `tiling` as an option to `.stretchTo()`\\n- *Effects* - Fixed `.randomRotation()` not working with `.attachTo()`\\n- *Effects* - Fixed issue with effects with a defined width and height were still being scaled by the scene-effect grid size difference\\n\\n### Version 2.0.7\\n- *Sequencer* - Fixed broken macro in the Ouija example\\n- *Animations* - Fixed various animation methods not resulting accurate movement or teleportation\\n- *Effects* - Fixed `.randomRotation()` not working\\n\\n### Version 2.0.6\\n- *Sequencer* - Improved intelligence of webm cache \\n- *Effects* - Added `.private()` method to hide effects in the effect manager - DO NOT USE IF YOU DO NOT KNOW WHAT YOU ARE DOING\\n- *Effects* - Fixed issue where ending effects by name would cause other effects without a name to get _ended\\n- *Effects* - Fixed issue where filtering for effects with the Effect Manager would cause it to split the given name on each whitespace \\n\\n### Version 2.0.5 Hotfix Hotfix\\n- *Effects* - Hotfix for the hotfix. It's just hotfixes all the way down, man.\\n\\n### Version 2.0.4 Hotfix\\n- *Effects* - Fixed some modules causing Sequencer to complain \\n- *Effects* - Actually fixed copying objects would not copy the effects on it\\n\\n### Version 2.0.3\\n- *Effects* - Fixed some issues regarding file paths on ForgeVTT, though they did most of the legwork on their side\\n- *Effects* - Fixed issue where `.scaleToObject()` would fail to scale to the object properly\\n- *Effects* - Fixed Effect Manager not finding effects to end when it was only provided an object\\n- *Effects* - Fixed copying tokens and other objects with ongoing effects would not properly play it for everyone\\n- *Effects* - Fixed screenspace effects would sometimes not play properly \\n\\n### Version 2.0.2\\n- *Sequencer* - Fixed the preloader throwing error about recursion\\n- *Effects* - Fixed rotational animations not working properly\\n- *Effects* - Fixed the update interface not allowing attribute paths like core Foundry does\\n- *Effects* - Fixed effects lingering for other users after their attached objects were deleted\\n- *Effects* - Fixed issues with using `.from()` on tiles\\n\\n### Version 2.0.1\\n- *Sequencer* - Fixed preloader throwing error about missing functions\\n- *Sequencer* - Fixed Effect Manager complaining if trying to filter effects by name while some effects didn't have a valid name\\n- *Effects* - Added the ability to use Effects as elements to play other Effects on\\n- *Effects* - Added cache-busting for when the Sequencer .webm cache would get larger than 1GB\\n- *Effects* - Fixed persistent effects attached to WarpGate crosshairs throwing errors\\n- *Effects* - Fixed `cacheLocation` throwing errors regarding missing function\\n- *Effects* - Fixed `endedSequencerEffect` being called too late for users to be able to use its parameters\\n- *Effects* - Fixed error when deleting the object an effect was attached to through both `.attachTo()` and `.stretchTo()` \\n\\n### Version 2.0.0\\n**Breaking changes:**\\n- *Sequencer* - Sequencer now requires the `socketlib` module\\n- *Sequencer* - All existing persistent effects created using 1.X.X Sequencer will be updated to the 2.0.0 system, but it's nigh impossible to catch all the edge cases, so please report any strangeness!\\n- *Effects* - Removed support for audio methods on effects (hardly used and caused a whole host of problems)\\n- *Effects* - Deprecated `.reachTowards()` and renamed it to `.stretchTo()`. The deprecated method will be removed in 2.1.0.\\n- *Effects* - Deprecated `.addPostOverride()`, please use `.addOverride()` instead. The deprecated method will be removed in 2.1.0.\\n- *Effects* - Deprecated `.gridSize()`, `.startPoint()`, and `.endPoint()` in favor for `.template({ gridSize, startPoint, endPoint })`. The deprecated methods will be removed in 2.1.0.\\n- *Effects* - Removed deprecated method `.JB2A()`\\n\\n**Tweaks:**\\n- *Sounds & Effects* - Tweaked `.forUsers()` to also accept player names (case-sensitive) instead of just IDs\\n- *Effects* - Tweaked attached effects' layer handling - effects can now be attached but exist below _all_ Tokens, for example\\n- *Effects* - Tweaked `.filter()` to allow being called multiple times, which now layers the filters in the order they were created\\n\\n**Additions:**\\n- *Sequencer* - Added selection tool to the Effect Layer - select, move, reattach, and delete effects on the canvas!\\n- *Sequencer* - Added `updateEffects` to the Effect Manager's API\\n- *Sequencer* - Added `updateSequencerEffect` hook\\n- *Sequencer* - Added support to `.macro()`s to be able to supply additional arguments (requires the Advanced Macros module)\\n- *Sequencer* - Added wildcard support when filtering for named effects in the Effect Manager's API (such as `getEffects`, `endEffects`, etc)\\n- *Sequencer* - Added support to filter for `source` and `target` in the Effect Manager's API (such as `getEffects`, `endEffects`, etc)\\n- *Sequencer* - Added \\\"private\\\" boolean flag to `Sequencer.Database.registerEntries()` which causes the entries to not be visible in the Database Viewer and Effect Player\\n- *Sequencer* - Added Setting to be able to hide Sequencer's tools on the toolbar\\n- *Sequencer* - Added checkbox to Database Viewer to show all ranges of a single effect, which is by default set to false\\n- *Sequencer* - Added `Sequencer.Helpers`, a library of useful methods - check them out on the wiki: https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Sequencer-Helper-Functions\\n- *Animations* - Added `.hide()` and `.show()` to hide or show the animated object\\n- *Effects* - Added more secondary options parameters to `.stretchTo()`, which accepts:\\n    - At long last, this can now `attachTo` (boolean) to the given target. Combine with `.attachTo()` to link an effect between two tokens!\\n    - `onlyX` (boolean), if set to true, this will cause stretchTo to only stretch the X axis of the sprite towards the target (keeping Y at 1.0, or your given scale)\\n- *Effects* - Added support to `.file()` for an object map containing the feet range and filepath key-value pair. Check out the file wiki entry to understand what this means: https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Effects#file\\n- *Effects* - Added secondary options parameter to `.attachTo()`, which accepts:\\n    - `align` (string, default \\\"center\\\"), accepts `top-left`, `center`, `left`, `bottom-right`, etc. Read the wiki: https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Effects#attach-to\\n    - `bindVisibility` (boolean, default true), if set to false, the effect will not be hidden if the attached object is hidden\\n    - `bindAlpha` (boolean, default true), if set to false, the effect's alpha will be independent of the attached object\\n    - `followRotation` (boolean, default true), if set to false, the effect will not follow the rotation of the attached object\\n- *Effects* - Added options to `.size()` which allows for `{ gridUnits: true }` - this makes the size given to the method scale to the scene's grid, instead of setting the exact width and height\\n- *Effects* - Added the same option as above to `.animateProperty()` and `.loopProperty()`, which only works if you animate the `width` or `height`\\n\\n**Fixes:**\\n- *Sequencer* - Fixed module permissions settings being slightly wonky\\n- *Sequencer* - Fixed number inputs not throwing errors on `NaN` values\\n- *Animations* - Fixed users not being able to teleport or move tokens they do not own\\n- *Animations* - Fixed `.moveSpeed()` not affecting the duration of the animation\\n- *Animations* - Fixed `.delay()` not being respected\\n- *Effects* - Fixed memory leak where effect textures were not properly destroyed\\n- *Effects* - Adjusted `.origin()` to be able to accept a `Document` object to infer the UUID from\\n- *Effects* - Fixed `.from()` not taking mirror x/y into account on tokens\\n- *Effects* - Tokens with effects attached to them can now be _ended by anyone who can update the token (owners of the token, GMs, etc)\\n- *Effects* - Increased default resolution of `.text()` to 10 (should increase quality)\\n- *Effects* - Fixed `.screenSpace()` effects still being affected by grid size normalization\\n\\n### Version 1.3.5\\n- *Sequencer* - Fixed Permissions being broken in the latest Foundry update, and moved Sequencer specific permissions into module settings instead\\n- *Effects* - <img src=\\\"images/siren.gif\\\" width=\\\"18px\\\" height=\\\"18px\\\" alt=\\\"Siren\\\"> Breaking change <img src=\\\"images/siren.gif\\\" width=\\\"18px\\\" height=\\\"18px\\\" alt=\\\"Siren\\\"> - Fixed issue where setting the `.size()` of an effect and then scaling it would result in unexpected behavior. As a result, `.scaleIn()` and `.scaleOut()` now function as _multipliers_ to the existing scale on the effect\\n\\n### Version 1.3.4\\n- *Sequencer* - Added popup warning the first time a GM opens the Effect Player to tell them about the custom Permissions\\n- *Sequencer* - Added button to open Foundry's Permissions directly from the Effect Player how-to page\\n\\n### Version 1.3.3\\n- *Sounds* - Fixed `.fadeInAudio()` and `.fadeOutAudio()` being broken\\n\\n### Version 1.3.2\\n- *Sequencer* - Minor backend updates to flag handling\\n- *Effects* - Fixed static images failing to load in v9\\n- *Effects* - Fixed effects attached to tokens that were copied to another scene would not play\\n- *Effects* - Suppressed recent deprecation warnings until the next release\\n- *Effects* - Reverted some code that would break persisting effects\\n\\n### Version 1.3.1\\n- *Sequencer* - Fixed minor spelling issue\\n\\n### Version 1.3.0\\n- *Sequencer* - Sequencer is now v9 ready!\\n- *Sequencer* - Improved search accuracy functionality on the Effect Player\\n- *Animations* - Added `relativeToCenter` option to `.teleportTo()` and `.moveTowards()`, which will offset the location relative to the object's center, effectively centering the animated object on the location - use with `.snapToGrid()` for reliable snapping!\\n- *Animations* - Fixed `.fadeOut()`, `.fadeOutAudio()`, and `.rotateOut()` not correctly setting the duration of the animation, causing `.waitUntilFinished()` to not actually wait for the animation to finish\\n- *Effects* - Deprecated `.JB2A()` as the recommended workflow is now to use Database paths\\n\\n### Version 1.2.12 Hotfix\\n- *Effects* - Fixed `.animateProperty()` and `.loopProperty()` applying animations that were already complete\\n\\n### Version 1.2.11\\n- *Sequencer* - Added French localization (thanks to Elfenduil)\\n- *Sequencer* - Fixed error with `Sequencer.Database.validateEntries()` throwing an error\\n- *Effects* - Improved handling of the `Glow` filter when used with `.fadeIn()` and `.fadeOut()`\\n    - Due to this change, it is now recommended that if you use `.animateProperty()` or `.loopProperty()` on the `sprite`'s `alpha` property to instead use it on the `alphaFilter`'s `alpha` property\\n- *Macros* - Updated the Misty Step macro to be more generic and not specifically _require_ MidiQOL\\n\\n### Version 1.2.10\\n- *Sequencer* - Fixed misspelled permission which caused players to not be able to see the toolbar buttons\\n- *Sequencer* - Added `End All Effects` button to the Effect Manager\\n\\n### Version 1.2.9\\n- *Sequencer* - Removed error from the Effect Manager when no effects were removed\\n- *Effects* - Fixed `.randomOffset()` on tiles would result in pretty crazy behavior\\n\\n### Version 1.2.8\\n- *Sequencer* - Added sidebar tool permissions, you can now hide them from players\\n- *Effects* - Added `.origin()` which provides a way to tag an effect with a string you can then search for with the Effect Manager\\n- *Effects* - Added support for using both `.reachTowards()` and `.scale()` and will now scale the effect whilst keeping the range finding correct\\n\\n### Version 1.2.7 Hotfix\\n- *Sounds* - ACTUALLY Fixed sounds being broken\\n\\n### Version 1.2.6 Hotfix\\n- *Sounds* - Fixed sounds being broken\\n\\n### Version 1.2.5\\n- *Sequencer* - Made hooks `createSequencerEffect` and `endedSequencerEffect` instead supply the CanvasEffect itself, rather than its data\\n- *Effects* - Fixed bug that caused effects to linger for other clients after having been _ended\\n\\n### Version 1.2.4\\n- *Sequencer* - Fixed error caused by preload option on Sequencer Effect Player\\n- *Sequencer* - Fixed error when pressing ESC in the Sequencer Layer\\n- *Sequencer* - Fixed permissions not being loaded properly\\n- *Effects & Animations* - Added `.tint()` which allows you to tint effects, tokens, and tiles\\n\\n### Version 1.2.3\\n- *Sequencer* - Added granular permissions - check it out in Configure Settings -> Open Permissions Configuration\\n- *Sequencer* - Added localization support\\n- *Sequencer* - Fixed the Sequencer Player throwing an error if the layer was active while switching scene\\n\\n### Version 1.2.2\\n- *Sequencer* - Added Stretch or Move checkbox to Sequencer Player\\n- *Sequencer* - Added Move Speed input to Sequencer Player\\n\\n### Version 1.2.1\\n- *Sequencer* - Fixed file picker being broken\\n\\n### Version 1.2.0\\n- *Sequencer* - Added the [Sequencer Effect Player](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Sequencer-Effect-Player)!\\n- *Sequencer* - Refactored the Sequencer Animation Engine, which fixes some animation funkiness\\n- *Sequencer* - Fixed the Sequencer Preloader sometimes not succeeding and getting stuck\\n- *Animations* - Removed the `.snapToSquare()` method, use `.snapToGrid()` instead\\n- *Effects* - Added `.spriteOffset()` which allows you to add an offset to the effect's sprite's location\\n- *Effects* - Added optional boolean parameters to `.randomizeMirrorX()` and `.randomizeMirrorY()`\\n\\n### Version 1.1.5\\n- *Effects* - Fixed bug that caused all effects to stay transparent after playing an effect for specific user\\n- *Effects* - Fixed bug with `.missed()` and `.reachTowards()` failing to play any effect\\n- *Effects* - Fixed all effects sharing users\\n\\n### Version 1.1.4\\n- *Sequencer* - Fixed error in the Sequencer Preloader when pre-loading files from Database paths\\n- *Effects* - Fixed bug that caused persistent effects to end when a client connected after it was created\\n\\n### Version 1.1.3\\n- *Sequencer* - Added `sequencerEffectManagerReady` hook which is called when every effect has been set up on the scene that's currently loaded\\n- *Sequencer* - Added `validateEntries` method to the Sequencer Database, which is helpful for module creators to validate their asset collections to the database\\n- *Sequencer* - Added `getPathsUnder` method to the Sequencer Database, which retrieves valid collections under a certain database path\\n- *Sequencer* - Minor speed improvements to how the database retrieves files\\n- *Sequencer* - Removed the requirement for a user to be trusted to use the Database Viewer\\n- *Sequencer* - Fixed `Sequencer.EffectManager.endEffects` not throwing error when incorrect or incomplete parameters were given, and instead _ended all effects (whoops)\\n- *Effects* - Made user-created effects that were made to be displayed only for other users also show up for GMs, though saturated and with 50% opacity. This is to ensure no player-to-player abuse would occur\\n- *Effects* - Fixed scaled tokens causing effects to not play on the correct location\\n- *Effects* - Fixed temporary effects attached to warpgate cursors no longer stays around for longer than they should\\n\\n### Version 1.1.2\\n- *Sequencer* - Removed compatibility warning regarding Perfect Vision as the module was updated to support Sequencer\\n- *Sequencer* - Added warning when trying to register database collections under a module name containing dots (as it uses dot-notated paths)\\n\\n### Version 1.1.1\\n- *Sequencer* - Removed Hyperspace sample from compendiums, as it was getting too big\\n- *Sequencer* - Added compatibility warning if user has Perfect Vision installed\\n- *Sequencer* - Added warning for Hyperspace assets that are going to be removed in a future update, and instead put into a separate module:\\n    - https://foundryvtt.com/packages/nrsap by Nachtrose#9287 on Discord\\n- *Sequencer* - Prepared Sequencer for v9, it _should_ be compatible to test\\n- *Effects* - Added `.text()` which allows you to create text snippets on the canvas\\n- *Effects* - Added `.from()` which creates an effect based on the given object, effectively copying the object as an effect\\n- *Effects* - Added support for `.attachTo()` for temporary measured templates before they have been created, for use with WarpGate\\n- *Effects* - Removed warning when `.attachTo()` and `.atLocation()` are used on the same effect - `.attachTo()` always wins out\\n\\n### Version 1.1.0\\n- *Sequencer* - Added hooks:\\n    - `createSequencerSequence`\\n    - `endedSequencerSequence`\\n    - Effects:\\n        - `preCreateSequencerEffect` - Provides the effect's data\\n        - `createSequencerEffect` - Provides the effect's data\\n        - `endedSequencerEffect` - Provides the effect's data\\n    - Sounds:\\n        - `preCreateSequencerSound` - Provides the sound's data\\n        - `createSequencerSound` - Provides the sound's data\\n        - `endedSequencerSound` - Provides the sound's data\\n- *Sequencer* - Hook for `sequencer.ready` is becoming deprecated in favor for `sequencerReady`\\n- *Sequencer* - Vastly improved the speed of the Database Viewer (thanks to Naito#1235 on discord!)\\n- *Effects* - Added screen space layer for UI effects!\\n    - Added `.screenSpace()` which causes the effect to be played on the screen rather than in the game canvas\\n    - Added `.screenSpaceAnchor()` which causes the effect to anchor itself to a side on the screen space layer\\n    - Added `.screenSpacePosition()`, pretty straightforward what this does, sets the position of the effect in screen space\\n    - Added `.screenSpaceScale()` which can help you stretch and fit the effect to the screen, even on different screen sizes\\n- *Effects* - Added `.spriteAnchor()` which controls the effect's core anchor point within its container (defaults to 0.5 on X and Y)\\n- *Effects* - Added support on `.atLocation()` for a secondary options object, which currently accepts:\\n    - `cacheLocation: boolean` - causes the given object's location to be cached immediately rather than retrieved during the Sequence's runtime\\n- *Effects* - Added `.snapToGrid()` which snaps the effect to the given location's closest grid section\\n- *Effects* - Added `.scaleToObject()` which scales the effect to the bounds of the object, with an optional scalar on top of that\\n- *Effects* - Added `.zeroSpriteRotation()` which causes an effect's sprite to remain un-rotated when its container rotates in animations\\n- *Effects* - Tweaked `.size()` to also accept only one of height or width, the other will be automatically resized to keep the effect's ratio\\n- *Effects* - Fixed `.persist()`ing effects with an end duration that doesn't loop would not properly stop at its end duration\\n- *Effects* - Improved look of transparent .webm files\\n- *Animations* - Renamed `.snapToSquare()` method to `.snapToGrid()` - the old method will be fully removed in 1.2.0\\n- *Foundry* - Added libwrapper patch for .webm transparency not playing correctly in Foundry\\n- *Sequencer* - Updated some sample macros\\n- *Sequencer* - The `SequencerDatabase` accessor has been removed, and is now accessible with `Sequencer.Database`\\n- *Sequencer* - The `SequencerDatabaseViewer` accessor has been removed, and is now accessible with `Sequencer.DatabaseViewer`\\n- *Sequencer* - The `SequencerPreloader` accessor is deprecated, and is now accessible with `Sequencer.Preloader`\\n\\n### Version 1.0.3\\n- *Sequencer* - Added animated space backgrounds (thanks to Keirsti on the Foundry VTT discord server)\\n- *Sequencer* - Fixed Hyperspace macro placing the hyperspace intro and out incorrectly\\n\\n### Version 1.0.2 Hotfix\\n- *Sequencer* - Changed Effect Viewer icon to something less controversial\\n\\n### Version 1.0.1\\n- *Sequencer* - Renamed `.sequence()` method on Sequences to `.addSequence()` due to internal code conflicts\\n- *Effects* - Added `.filter()` - was technically added in 1.0.0, but was left undocumented\\n- *Effects* - Fixed `.size()` being scaled to account for grid size differences - it should now set the exact width/height in pixels\\n\\n### Version 1.0.0\\n- *Sequencer* - Added recent Sequencer tools to the menu in the top left - you can disable these in the module settings\\n- *Sequencer* - Added `Sequencer.EffectManager` to manage persistent effects - [read more here](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Sequencer-Effect-Manager)\\n- *Sequencer* - Added the ability for you to implement your own Sequencer functions - [read more here](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Sequencer-Section-Manager)\\n- *Sequencer* - `SequencerDatabase` is deprecated, and is now accessible with `Sequencer.Database` - 1.1.0 will remove the old path entirely\\n- *Sequencer* - `SequencerDatabaseViewer` is deprecated, and is now accessible with `Sequencer.DatabaseViewer` - 1.1.0 will remove the old path entirely\\n- *Sequencer* - `SequencerPreloader` is deprecated, and is now accessible with `Sequencer.Preloader` - 1.1.0 will remove the old path entirely\\n- *Sequencer* - Fixed Documents sometimes not properly resolving to their PlaceableObject\\n- *Sequencer* - Fixed settings not being client side - whoops\\n- *Effects* - Added `.attachTo()` which causes the effect to be attached to a given object\\n- *Effects* - Added `.persist()` which causes the effect to become permanent on the canvas until removed\\n- *Effects* - Added `.extraEndDuration()` which allows `.persist()`-ed effects to stick around for a bit longer instead of end immediately\\n- *Effects* - Tweaked `.missed()` to hit an area only facing the origin of the effect, if it had an origin and target\\n- *Effects & Sounds* - Added support for wildcard paths, like `modules/jb2a_patreon/Library/1st_Level/Bardic_Inspiration/BardicInspiration_01_*_400x400.webm`\\n\\n### Version 0.6.12\\n- *Sequencer* - Fixed an issue where the preloader would sometimes fail to preload\\n- *Effects* - Fixed effects not playing on hex grids\\n\\n### Version 0.6.11 Hotfix\\n- *Effects* - Fixed range-finding effects sometimes not picking the right distance\\n\\n### Version 0.6.10\\n- *Sequencer* - Improved the search speed of the Database Viewer\\n- *Sequencer* - Fixed previewing static images through the Database Viewer\\n- *Sequencer* - Fixed bugs that caused the Database to sometimes fail registering new files\\n- *Effects* - Fixed issue where `.delay()` would incorrectly contribute towards the effect's `.waitUntilFinished()` duration\\n\\n### Version 0.6.9 Hotfix\\n- *Sequencer* - Fixed the database sometimes failing to get the correct file\\n\\n### Version 0.6.8 Hotfix\\n- *Sequencer* - Fixed database not correctly finding range-based effects\\n\\n### Version 0.6.7\\n- *Effects & Sounds* - Fixed `.locally()` and `.forUsers()` sometimes erroneously remembering users between different effects & sounds\\n- *Effects* - Fixed `.scaleIn()` would not take a custom `.size()` into account\\n- *Effects* - Fixed static images sometimes not playing due to duration being set to 0ms\\n\\n### Version 0.6.6\\n- *Sequencer* - Added support for preloading files based on database paths\\n- *Effects & Sounds* - Added `.locally()` and `.forUsers()`, which allow you to control which users will have the effect and sounds played for them\\n- *Effects* - Improved positional handling of Tiles and TileDocuments\\n\\n### Version 0.6.5\\n- *Sequencer* - Updated Sequencer Database Viewer layout to be more user friendly\\n- *Effects* - Fixed bug with templates and raw positions not being respected\\n\\n### Version 0.6.4\\n- *Sequencer* - Added Sequencer Database Viewer to the module settings, it allows you to preview effects and copy any files registered with Sequencer by other modules\\n- *Sequencer* - Added client-side settings for users to be able to turn off effects and sounds being played locally\\n- *Effects & Sounds* - Fixed effects and sounds playing on scenes they did not originate from\\n- *Effects* - Added `.size()`, which sets the width and height of the effect in pixels\\n- *Effects* - Added `rotate` option to `.moveTowards()`, which defaults to true. If set to false, the effect will not rotate towards the end location.\\n- *Effects* - Fixed duration of effects using `.moveTowards()` not being calculated correctly\\n- *Effects* - Fixed static image effects' durations also not being calculated correctly\\n\\n### Version 0.6.3 Hotfix\\n- *Effects* - Fixed effects failing to play static images\\n\\n### Version 0.6.2\\n- *Sequencer* - Further small fixes to how the database registers files\\n\\n### Version 0.6.1\\n- *Sequencer* - Removed the need for `.playIf()` to have to be given a function or a boolean\\n- *Sequencer* - Fixed issues with the database when files were listed in arrays\\n\\n### Version 0.6.0\\n**Breaking:**\\n- *Effects* - <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\"> `.JB2A()` has been altered to set the gridsize to 200, as it was previously set to 100 - this will halve the size all JB2A on-the-spot effects, sorry! <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\">\\n\\n**Additions:**\\n- *Sequencer* - Added `SequencerPreloader` - you can now preload images, effects, and sounds for your players, read more on the [docs](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Sequencer-Preloader)\\n- *Sequencer* - Added support for templates and time ranges in database structure, more info on the [docs](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/How-to:-Sequencer-Database)\\n- *Effects* - Added support for static images such as webp, pngs, jpgs, etc\\n- *Effects & Sounds* - Added `.startTime()`, `.startTimePerc()`, `.endTime()`, `.endTimePerc()`, and `.timeRange()`, more info on the [docs](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Effects#start-time)\\n- *Sounds* - Added `.addOverride()`, `.baseFolder()`, and `.setMustache()` support to sounds\\n\\n**Updates & Fixes:**\\n- *Sequencer* - `.play()` now reliably resolves its promise at the end of the entire sequence\\n- *Effects* - *Vastly* improved effect caching and loading speed of effects and sounds\\n- *Effects* - Improved object position handling slightly when providing non-foundry class objects to `.atLocation()` and alike\\n- *Effects* - Generally improved compatibility with `TokenDocument` and Foundry D&D 5E documents when getting their positions\\n\\n### Version 0.5.9\\n- *Effects* - Added `.addPostOverride()` as an alternative to `.addOverride()`, which executes at the end of the effect data sanitation\\n- *Effects* - Fixed `.gridSize()`, `.startPoint()`, and `.endPoint()` not being respected and being overridden by internal logic\\n\\n### Version 0.5.8 Hotfix\\n- *Macros* - Fixed macros throwing error when playing sequence\\n\\n### Version 0.5.7\\n- *Effects* - Fixed templates sometimes not being found\\n- *Effects* - Re-added backwards compatibility with old macros that still use `data.distance` in overrides\\n\\n### Version 0.5.6\\n- *Sequencer* - Added alpha version of the Sequencer Database Viewer\\n- *Effects* - Added `.randomOffset()` which can add a random offset similar to `.missed()`, but *within* the bounds of the target token / tile / other. Check out the docs!\\n- *Effects* - Fixed `.waitUntilFinished()` not being respected\\n- *Effects* - Fixed `.offset()` throwing an error about a missing function\\n- *Effects* - Fixed `.repeats()` throwing an error, because the entire function went missing in the last update >.>\\n\\n### Version 0.5.5 Hotfix\\n- *Effects* - Fixed effects sometimes not playing\\n\\n### Version 0.5.4 Hotfix\\n- *Effects* - Fixed melee attacks not picking the right JB2A template\\n\\n### Version 0.5.3\\n- *Sequencer* - Added sound to the Hyperspeed Sample thanks to the wonderful AurelTristen over at [HellScape Tabletop Assets](https://www.patreon.com/HellScapeAssets) (even though they're not specifically focused on sound effects)\\n- *Effects* - Fixed major issue with JB2A templates, causing effects to pick the wrong ranged attacks & other shenanigans\\n- *Effects* - Fixed effect scale inconsistencies across scenes with different grid sizes\\n\\n### Version 0.5.2\\n- *Sequencer* - <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\"> Removed support for Foundry Version 0.7.x <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\">\\n- *Sequencer* - Refactored animations into a dedicated animation engine\\n- *Effects* - Added support for static image effects (.jpeg, .png, etc)\\n- *Effects* - Fixed grid size sometimes not being taken into account when playing effects with `.reachTowards()`\\n- *Sounds* - Vastly improved and fixed sound implementation, big thanks to ghost#2000!\\n- *Sounds* - <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\"> Removed support for `.fadeIn()` and `.fadeOut()` in Sounds <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\">\\n\\n### Version 0.5.1\\n- *Sequencer* - Added two sample scenes with macros and accompanying art:\\n    - An animated Oujia board made by md-mention2reply\\n    - A Star Wars inspired hyperspeed scene-switching scene, effects, and macro\\n- *Sequencer* - Removed Token Ease as dependency until we can solve its conflicts with other modules\\n- *Effects* - Fixed effects not auto-centering on tokens\\n- *Effects* - Fixed effects not finding the proper location when a previous effect's `.name()` was given\\n- *Animations* - Fixed `.rotate()`, `.opacity()`, and `.volume()`, now they work even without having to use their respective in/out functions\\n\\n### Version 0.5.0\\n- *Sequencer* - Module now depends on [Token Ease](https://github.com/fantasycalendar/FoundryVTT-TokenEase)\\n- *Sequencer* - Added the Sequencer Database to help content creators! Read more on the [database documentation](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Sequencer-Database) how to use it!\\n- *Effects & Sounds* - Added support for database collections to the `.file()` method - more info can be found in the [docs](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Effects#file)\\n- *Animations, Effects & Sounds* - Added the following functions:\\n    - `.audioVolume()`\\n    - `.fadeInAudio()`\\n    - `.fadeOutAudio()`\\n- *Effects* - Added support for delays on these methods (e.g. a delay of -500 means it will finish 500ms before the end of the duration):\\n    - `.rotateOut()`\\n    - `.fadeOut()`\\n    - `.scaleOut()`\\n    - `.fadeOutAudio()`\\n- *Animations* - Fixed `.rotateTowards()` to properly rotate towards the target without having to add an offset to properly line them up\\n- *Effects* - Made effects more intelligent when determining locations when given partial object data with `id` collections\\n- *Effects* - Fixed issues surrounding delays and fades\\n- *Sounds* - <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\"> `.fadeIn()` and `.fadeOut()` will become deprecated in a future version, please switch to `.fadeInAudio()` and `.fadeOutAudio()` <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\">\\n\\n### Version 0.4.6 Hotfix\\n- *Effects* - Fixed effects not playing on tokens on 0.7.10 and below\\n\\n### Version 0.4.5\\n- *Effects* - Added `.offset()` so that you can offset the effect - an optional parameter allows you to offset in local or canvas space\\n- *Animations* - Added `.snapToSquare()`, which causes the given object to be snapped to the square it is moving or teleported towards\\n- *Animations* - Fixed `.rotateIn()` and `.rotateOut()` not properly calculating rotation\\n- *Animations* - Adjusted `.rotateTowards()` to instead consider the target position as the rotation origin, rather than the object's current position\\n\\n### Version 0.4.4\\n- *Animations* - Added `.animation()` section - animate tokens and tiles! Check out the [documentation](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Animations) how to use it!\\n- *Effects* - Added official support for tiles in `.atLocation()`, `.moveTowards()`, etc\\n- *Effects* - Tweaked how effects get locations when dealing with raw template data\\n- *Sequencer* - Added `.sequence()` so you can combine multiple sequences into one\\n- *Sequencer* - Updated all sample macros to 0.8.x conventions\\n\\n### Version 0.4.3 Minor Fixes\\n- *Effects* - Removed error catch in `.file()` when providing it with something else than string or array\\n- *Effects* - Fixed `.belowTokens()` and `.belowTiles()` throwing errors if no boolean was provided\\n\\n### Version 0.4.2 Hotfix\\n- *Effects* - Added `.rotate()` which adds an offset to the effect's rotation\\n- *Effects* - Fixed `.moveTowards()` not respecting given easing\\n\\n### Version 0.4.1\\n- *Sequencer* - <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\"> **Breaking Changes**: Removed deprecated `.then()` method <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\">\\n- *Sequencer* - Tweaked `.play()` to now return a promise\\n- *Sequencer* - Reworked module class structure\\n- *Sequencer* - Added debug setting\\n\\n### Version 0.4.0\\n- *Sequencer* - Renamed `.then()` to `.thenDo()` due to JavaScript reasons — <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\"> `.then()` will be removed in 0.4.1 <img src=\\\"images/siren.gif\\\" width=\\\"12px\\\" height=\\\"12px\\\" alt=\\\"Siren\\\">\\n- *Sequencer* - Removed the requirement to pass `true` as a second argument to `.then()` (now `.thenDo()`) if the function was async, it will now wait for it to finish if it is an `async function`\\n- *Effects* - Added `.mirrorX()` and `.mirrorY()` to mirror the effect on that axis\\n- *Effects* - Improved `.JB2A()` to better handle melee weapon attacks\\n- *Effects* - Tweaked `.belowTiles()` and `.belowTokens()` to accept an optional boolean parameter whether the effect should play behind the respective element\\n- *Effects* - Tweaked effects to assume that .webms have a base 100px internal grid for size consistency\\n\\n### Version 0.3.13 Hotfix\\n- *Effects* - Fixed ANOTHER bug with `.belowTiles()` sometimes not playing below tiles\\n\\n### Version 0.3.12\\n- *Effects* - Added `.opacity()` which controls the alpha of the effect being played\\n- *Effects* - Fixed bug with `.belowTiles()` sometimes not playing below tiles\\n\\n### Version 0.3.11\\n- *Effects* - Added `.belowTiles()` to play effects below tiles\\n- *Effects* - Implemented better order handling - the effects created first will always be on top, each subsequent effect will be played below the previous\\n- *Effects* - Added `.zIndex()` for you to have direct control over the order of effects\\n- *Effects & Sounds* - Added `.duration()` which can override the duration of an effect or sound\\n- *Effects & Sounds* - Tweaked `.waitUntilFinished()` to accept a single number parameter as a delay or to end the effect or sound earlier - read more in the [documentation](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki#wait-until-finished)\\n- *Sounds* - Added support for `.fadeIn()` and `.fadeOut()` - easing sadly doesn't work for sounds yet\\n\\n### Version 0.3.10\\n- *Sequencer* - Added macro pack containing examples of Sequencer usages\\n- *Effects* - Added the following animated functions:\\n    - `.scaleIn()`\\n    - `.scaleOut()`\\n    - `.rotateIn()`\\n    - `.rotateOut()`\\n    - All of these can utilize any of the easings listed here: https://easings.net/\\n    - Read the [documentation](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki/Effects#scale-in) how to use these\\n- *Effects* - Added better error reporting when something goes wrong in the sequence\\n- *Effects* - Fixed bug with scale sometimes overriding `.reachTowards()`\\n\\n### Version 0.3.9\\n- *Effects* - Added `.belowTokens()` so you can now play effects, well, below tokens\\n- *Effects* - Fixed effects not replicating properly (AGAIN)\\n- *Effects* - Fixed effects not being able to use `.name()`d effects if they didn't miss - now any effect can be named and be used in future effects\\n\\n### Version 0.3.8 Hotfix\\n- *Effects* - Fixed effects that were supposed to be once-off instead looping\\n\\n### Version 0.3.7\\n- *Effects* - Added `.moveTowards()` and `.moveSpeed()` for missile-like behavior\\n- *Effects* - Tweaked the way the effects layer is applied to the canvas' layers\\n- *Effects* - Fixed major issue with the way effects that were using `.missed()` and `.name()` were cached\\n- *Sequencer* - Removed stray debug code\\n\\n### Version 0.3.6\\n- *Effects* - Added `.fadeIn()` and `.fadeOut()` - you can now make your effects look slightly nicer!\\n- *Effects* - Added support for cone and line templates with `.reachTowards()` and `.rotateTowards()` - it now reaches towards the end point of the template\\n- *Effects* - Added `.name()` to effects - this will cause the effect's position to be stored and can then be used with `.atLocation()`, `.reachTowards()`, and `.rotateTowards()` to refer to previous effects' locations\\n    - Example: naming an impact effect with `.name(\\\"hit_location\\\")` and making it miss with `.missed()`, and then have a subsequent effect use `.rotateTowards(\\\"hit_location\\\")` to rotate towards the previous effect's calculated location\\n- *Effects* - Fixed `.scale()` bug that caused it to not properly set the scale and then cause an error upon calling `.play()`\\n- *Effects* - Removed `.moves()` for future implementation\\n- *Sequencer* - Tweaked `.async()` and `.waitUntilFinished()` handling\\n    - They now act the same on effect and sounds that only play once, but if it `.repeats()`, `.async()` causes the effect or sound to wait between each repetition, `.waitUntilFinished()` causes the sequencer to wait until the effect or sound has finished executing all of its repetitions, which may or may not wait for each effect or sound to play with `.async()`\\n- *Sequencer* - Calling `.play()` now returns the sequence\\n- *Sequencer* - Removed `FXMaster` dependency and implemented a custom canvas layer and effects class\\n\\n### Version 0.3.5 Hotfix\\n- *Sequencer* - Fixed `.wait()` breaking due to the `.async()` and `.waitUntilFinished()` swap\\n\\n### Version 0.3.4 Hotfix\\n- *Effects* - Fixed issue that caused the wrong scale to be applied when using `.reachTowards()`\\n\\n### Version 0.3.3\\n- *Effects* - Added `.playIf()` ([docs](https://github.com/fantasycalendar/FoundryVTT-Sequencer/wiki#play-if)); this allows you to completely ignore playing an effect or sound, depending on a boolean or a function\\n- *Sounds* - Added support for `.async()` and `.waitUntilFinished()` for sounds - requires both to be `true` due to code weirdness, I'll be refactoring this in the future\\n- *Effects* - Refactored `.scale()` when it was provided with a minimum and maximum value, it now randomizes the scale of the effect when executed instead of when the method was called\\n- *Effects & Sounds* - Refactored `.file()` for both effects and sounds so that providing an array of files no longer immediately picks one from the array, but randomly picks a file each time the section is executed\\n- *Effects & Sounds* - Refactored how `.delay()` interacted with `.repeats()`, which should result in more consistent behavior\\n- *Sequencer* - Swapped the functionality of `.async()` and `.waitUntilFinished()`, and clarified in the docs\\n- *Sequencer* - Added support for random range within a `.wait()` block (like, `.wait(500, 1000)` etc)\\n\\n### Version 0.3.2 - 0.8.x ready!\\n* *Effects* - Added `.playbackRate()` to effects, you can now speed up the play rate of your effects\\n* *Sequencer* - Tweaked internal handling of `.async()` together with `.waitUntilFinished()` improved\\n* *Sequencer* - Tweaked to use `ready` instead of `init` to load module\\n\\n### Version 0.3.1\\n- *Effects* - Refactored `.randomizeMirror()` into `.randomizeMirrorX()` and `.randomizeMirrorY()`\\n- *Effects* - Refactored scaling algorithm for `.reachTowards()`\\n- *Sequencer* - Added support for random `.wait()` interval\\n\\n### Version 0.3.0\\n- *Effects* - Refactored `.aimTowards()` into `.rotateTowards()` and `.reachTowards()`\\n- *Effects* - Refactored how `.missed()` chooses the location to hit and now takes token size into account\\n- *Effects* - Added `.JB2A()` to automatically set the effect to handle their sprites in the best way possible\\n- *Effects* - Added `.randomizeMirror()` to randomly mirror sprites on the Y axis\\n- *Effects* - Added Mustache support in file names\\n\\n### Version 0.2.0\\n- *Sequencer* - Added support for executing macros\\n- *Sequencer* - Added support for playing sounds\\n- *Sequencer* - Wrapped classes in proxies to simplify fluid interface (gets rid of `.done()` on effects and sounds)\\n\\n### Version 0.1.0\\n- First implementation\\n\"","<script>\n\timport { marked } from \"marked\";\n\timport changelogText from \"../../../changelog.md?raw\";\n\n\tconst GITHUB_CHANGELOG_URL =\n\t\t\"https://github.com/fantasycalendar/FoundryVTT-Sequencer/blob/master/changelog.md\";\n\tconst PATREON_URL = \"https://patreon.com/cw/fantasycomputerworks\";\n\n\tfunction parseChangelog(raw) {\n\t\tconst firstHeader = raw.search(/^# Version /m);\n\t\tconst body = firstHeader >= 0 ? raw.slice(firstHeader) : raw;\n\n\t\tconst chunks = body.split(/^(?=# Version )/m).filter((c) => c.trim().length);\n\n\t\treturn chunks.map((chunk) => {\n\t\t\tconst headerMatch = chunk.match(/^# Version\\s+(.+?)\\s*$/m);\n\t\t\tconst version = headerMatch ? headerMatch[1].trim() : \"Unknown\";\n\t\t\tconst content = chunk.replace(/^# Version.*$/m, \"\").trim();\n\t\t\treturn {\n\t\t\t\tversion,\n\t\t\t\thtml: marked.parse(content),\n\t\t\t};\n\t\t});\n\t}\n\n\tlet error = $state(null);\n\tlet entries = $state([]);\n\n\ttry {\n\t\tentries = parseChangelog(changelogText);\n\t} catch (e) {\n\t\terror = e?.message ?? String(e);\n\t}\n\n\tconst loading = false;\n</script>\n\n<div class=\"sequencer-changelog\">\n\n\t<header class=\"sequencer-changelog-header\">\n\t\t<a\n\t\t\tclass=\"sequencer-changelog-header-link\"\n\t\t\thref={GITHUB_CHANGELOG_URL}\n\t\t\ttarget=\"_blank\"\n\t\t\trel=\"noopener noreferrer\"\n\t\t\ttitle=\"View the changelog on GitHub\"\n\t\t>\n\t\t\t<i class=\"fab fa-github\"></i> View on GitHub\n\t\t</a>\n\t\t<a\n\t\t\tclass=\"sequencer-changelog-header-link sequencer-changelog-header-patreon\"\n\t\t\thref={PATREON_URL}\n\t\t\ttarget=\"_blank\"\n\t\t\trel=\"noopener noreferrer\"\n\t\t\ttitle=\"Support Sequencer development on Patreon\"\n\t\t>\n\t\t\t<i class=\"fab fa-patreon\"></i> Support Sequencer\n\t\t</a>\n\t</header>\n\n\t<div class=\"sequencer-changelog-content\">\n\t\t{#if loading}\n\t\t\t<div class=\"sequencer-changelog-status\">\n\t\t\t\t<i class=\"fas fa-spinner fa-spin\"></i> Loading changelog...\n\t\t\t</div>\n\t\t{:else if error}\n\t\t\t<div class=\"sequencer-changelog-status sequencer-changelog-error\">\n\t\t\t\t<p>Failed to load changelog: {error}</p>\n\t\t\t\t<p>\n\t\t\t\t\t<a href={GITHUB_CHANGELOG_URL} target=\"_blank\" rel=\"noopener noreferrer\">\n\t\t\t\t\t\tView on GitHub\n\t\t\t\t\t</a>\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t{:else if entries.length === 0}\n\t\t\t<div class=\"sequencer-changelog-status\">No changelog entries found.</div>\n\t\t{:else}\n\t\t\t<div class=\"sequencer-changelog-entries\">\n\t\t\t\t{#each entries as entry, index (entry.version)}\n\t\t\t\t\t<details class=\"sequencer-changelog-entry\" open={index === 0}>\n\t\t\t\t\t\t<summary>\n\t\t\t\t\t\t\t<span class=\"sequencer-changelog-version\">v{entry.version}</span>\n\t\t\t\t\t\t\t{#if index === 0}\n\t\t\t\t\t\t\t\t<span class=\"sequencer-changelog-latest-badge\">Latest</span>\n\t\t\t\t\t\t\t{/if}\n\t\t\t\t\t\t\t<i class=\"fas fa-chevron-down sequencer-changelog-chevron\"></i>\n\t\t\t\t\t\t</summary>\n\t\t\t\t\t\t<div class=\"sequencer-changelog-body\">\n\t\t\t\t\t\t\t{@html entry.html}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</details>\n\t\t\t\t{/each}\n\t\t\t</div>\n\t\t{/if}\n\t</div>\n\n</div>\n","import \"./styles/module.scss\";\n\nimport { registerSettings, migrateSettings } from \"./settings.js\";\nimport registerLayers from \"./layers.js\";\nimport registerBatchShader from \"./batchShader.js\";\nimport registerHotkeys from \"./hotkeys.js\";\nimport registerTypes from \"../typings/typings.js\";\nimport { registerSocket, sequencerSocket } 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 * as canvaslib from \"./lib/canvas-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 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\nimport SequencerSoundManager from \"./modules/sequencer-sound-manager.js\";\nimport PasteManager from \"./modules/sequencer-paste-manager.js\";\nimport Crosshair from \"./modules/sequencer-crosshair/sequencer-crosshair.js\";\nimport PluginsManager from \"./utils/plugins-manager.js\";\nimport SvelteDialog from \"./formapplications/dialog/SvelteDialog.js\"\nimport ChangelogDialog from \"./formapplications/dialog/changelog-dialog.svelte\";\nimport flagManager from \"./utils/flag-manager.js\";\n\nconst PATREON_URL = \"https://patreon.com/cw/fantasycomputerworks\";\nconst DISCORD_URL = \"https://discord.gg/qFHQUwBZAz\";\n\nfunction showChangelog() {\n\treturn SvelteDialog.show({\n\t\tcomponent: ChangelogDialog,\n\t\tclasses: [\"sequencer-changelog-dialog\"],\n\t\twindow: { title: \"Sequencer Changelog\", icon: \"fas fa-clipboard-list\", resizable: true },\n\t\tposition: { width: 720, height: 600 },\n\t});\n}\n\nlet moduleValid = false;\nlet moduleReady = false;\nlet canvasReady = false;\nlet lastSceneId = null;\n\nHooks.once(\"init\", async function() {\n  // CONFIG.debug.hooks = true;\n  moduleValid = true;\n\tCONSTANTS.IS_V14 = foundry.utils.isNewerVersion(game.version, \"14\");\n  initializeModule();\n  registerSocket();\n\tflagManager.setup();\n\t// CONFIG.debug.hooks = true;\n});\n\nHooks.once(\"ready\", async function() {\n  for (const [name, func] of Object.entries(easeFunctions)) {\n    if (!foundry.canvas.animation.CanvasAnimation[name]) {\n      foundry.canvas.animation.CanvasAnimation[name] = func;\n    }\n  }\n\n  if (game.user.isGM) {\n    await runMigrations();\n    await migrateSettings();\n    await PlayerSettings.migrateOldPresets();\n\t  const database = await lib.createJournalDatabase();\n\t  flagManager._databaseId = database?.id ?? null;\n  }\n\n  SequencerFoundryReplicator.registerHooks();\n  InteractionManager.initialize();\n});\n\nHooks.on(\"canvasTearDown\", () => {\n  canvasReady = false;\n  SequencerEffectManager.tearDownPersistentEffects();\n\tSequencerSoundManager.tearDownPersistentSounds();\n});\n\nconst setupModule = foundry.utils.debounce(() => {\n  if (!moduleValid) return;\n  if (!moduleReady) {\n    moduleReady = true;\n    lib.debug(\"Ready to go!\");\n    Hooks.callAll(\"sequencer.ready\");\n    Hooks.callAll(\"sequencerReady\");\n  }\n  if (!canvasReady && game.canvas?.ready) {\n    canvasReady = true;\n    SequencerEffectManager.initializePersistentEffects();\n\t  SequencerSoundManager.initializePersistentSounds();\n  }\n}, 25);\n\nHooks.on(\"canvasReady\", () => {\n  const currentSceneId = canvas.scene?.id ?? null;\n  const isSceneSwitch = currentSceneId !== lastSceneId;\n  lastSceneId = currentSceneId;\n  setTimeout(setupModule, isSceneSwitch ? 450 : 100);\n});\n\nHooks.on(\"refreshToken\", setupModule);\nHooks.on(\"refreshDrawing\", setupModule);\nHooks.on(\"refreshTile\", setupModule);\nHooks.on(\"refreshMeasuredTemplate\", setupModule);\n\n/**\n * Creation & delete hooks for persistent effects\n */\nfunction initializeModule() {\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    SoundManager: SequencerSoundManager,\n    SectionManager: 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      computeWallPolygon: canvaslib.computeWallPolygon,\n    },\n\t  Crosshair: Crosshair,\n    showChangelog: showChangelog,\n  };\n\n  registerSettings();\n  registerLayers();\n  registerHotkeys();\n  registerLibwrappers();\n  registerBatchShader();\n\n  SequencerEffectManager.setup();\n  SequencerSoundManager.setup();\n\tPasteManager.setup();\n\n\tPluginsManager.initialize();\n\n\tHooks.on(\"renderChatMessageHTML\", (_message, html) => {\n\t\tconst links = html.querySelectorAll('[data-action=\"sequencer-show-changelog\"]');\n\t\tlinks.forEach((el) => {\n\t\t\tif (el.dataset.sequencerWired === \"1\") return;\n\t\t\tel.dataset.sequencerWired = \"1\";\n\t\t\tel.addEventListener(\"click\", (event) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tshowChangelog();\n\t\t\t});\n\t\t\tel.addEventListener(\"keydown\", (event) => {\n\t\t\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tshowChangelog();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t});\n}\n\n\nHooks.once(\"ready\", async () => {\n  displaySequencerUpdateNotice();\n});\n\nfunction getMajorMinor(version) {\n\tif (typeof version !== \"string\") return null;\n\tconst match = version.match(/^(\\d+)\\.(\\d+)/);\n\tif (!match) return null;\n\treturn `${match[1]}.${match[2]}`;\n}\n\nasync function displaySequencerUpdateNotice() {\n\n  if (!game.user.isGM) return;\n\n  const currentVersion = game.modules.get(CONSTANTS.MODULE_NAME)?.version;\n  if (!currentVersion) return;\n\n  const lastShown = game.settings.get(CONSTANTS.MODULE_NAME, \"update-notice-shown-version\") ?? \"0.0.0\";\n\n  const currentMM = getMajorMinor(currentVersion);\n  const lastMM = getMajorMinor(lastShown);\n\n  if (!currentMM) return;\n  if (lastMM && !foundry.utils.isNewerVersion(currentMM, lastMM)) {\n    if (lastShown !== currentVersion) {\n      await game.settings.set(CONSTANTS.MODULE_NAME, \"update-notice-shown-version\", currentVersion);\n    }\n    return;\n  }\n\n  await game.settings.set(CONSTANTS.MODULE_NAME, \"update-notice-shown-version\", currentVersion);\n\n  // Clean up older Sequencer update cards (keep only this newest one)\n  const oldMessageIds = game.messages.filter(message => {\n    return message.content.includes(\"sequencer-welcome\");\n  }).map(message => message.id);\n\n  if (oldMessageIds.length) {\n    await ChatMessage.deleteDocuments(oldMessageIds);\n  }\n\n  const gmIds = game.users.filter(u => u.isGM).map(u => u.id);\n\n  await ChatMessage.create({\n    whisper: gmIds,\n    content: `\n<div class=\"sequencer-welcome\">\n<img class=\"sequencer-welcome-image\" src=\"modules/sequencer/images/sequencer.png\"/>\n<div class=\"sequencer-welcome-divider\"></div>\n<p class=\"sequencer-welcome-title\">Sequencer updated to v${currentVersion}</p>\n<div class=\"sequencer-welcome-divider\"></div>\n<div class=\"sequencer-welcome-links\">\n<span class=\"sequencer-welcome-link\" role=\"button\" tabindex=\"0\" data-action=\"sequencer-show-changelog\"><i class=\"fas fa-clipboard-list\"></i> View changelog</span>\n<a target=\"_blank\" rel=\"noopener noreferrer\" href=\"${DISCORD_URL}\"><i class=\"fab fa-discord\"></i> Discord</a>\n<a target=\"_blank\" rel=\"noopener noreferrer\" href=\"${PATREON_URL}\"><i class=\"fab fa-patreon\"></i> Support on Patreon</a>\n</div>\n</div>`,\n  });\n\n}\n\n\nHooks.once(\"monaco-editor.ready\", registerTypes);\n"],"names":["lib.custom_error","lib.is_function","lib.debug","source","index","document","prop","name","tag","stack","e.invariant_violation","component","effect","derived","run","set","update","get","get_store","root","batch","flags","child","source_stacks","marked","e.effect_update_depth_exceeded","e","block","w.svelte_boundary_reset_noop","e.svelte_boundary_reset_onerror","error","boundary","location","e.async_derived_orphan","d","w.derived_inert","e.derived_references_self","e.state_unsafe_mutation","version","e.state_descriptors_fixed","s","value","key","e.state_prototype_fixed","array_prototype","includes","w.state_proxy_equality_mismatch","is","event","e.effect_orphan","e.effect_in_unowned_derived","e.effect_in_teardown","teardown","sibling","i","w.await_reactivity_loss","capture","delegated","html","text","frag","unmount","anchor_node","events","w.state_proxy_unmount","w.lifecycle_double_unmount","offscreen","branch","e.rune_outside_svelte","throw_rune_error","e.lifecycle_outside_component","e.lifecycle_legacy_only","fn","state","e.each_key_volatile","e.each_key_duplicate","item","link","node","action","w.select_multiple_invalid_value","batches","e.bind_invalid_checkbox_value","props","e.props_invalid_value","audio","scale","result","time","lib.getFiles","lib.is_real_number","lib.random_array_element","files","lib.interpolate","lib.make_array_unique","lib.custom_warning","lib\n        .str_to_search_regex_str","lib.flatten_object","$.prop","root_1","$.template_effect","$.set_class","$.untrack","root_3","$.set","$.sibling","$.event","$.html","$.set_attribute","$.deep_read_state","canvas","databaseStore","lib.str_to_search_regex_str","offset","$.mutable_source","$.get","$.mutate","keeps","data","$$anchor","$.set_style","selectedPackStore","packStore","visibleTreeStore","cleanSearchStore","entriesStore","$.each","root_2","root_4","$.component","$.bind_this","$.set_text","$.bind_select_value","$.store_set","$.bind_value","$.bind_checked","PATREON_URL","DatabaseShell","lib.wait","$.first_child","lib.get_object_identifier","animation","lib.deep_get","lib.deep_set","lib.clamp","canvaslib.get_object_dimensions","lib.forceDeletionKeyWrapper","lib.is_UUID","canvaslib.distance_between","listeners","soundlib.ease_pan_value","soundlib.calculate_pan_factor","elevation","lib.createMersenneTwister","canvaslib.get_object_position","canvaslib.getOffsetFromData","canvaslib.getPositionFromData","canvaslib.is_object_canvas_data","lib.get_object_from_scene","push","lib.safe_str","filters","lib.group_by","lib.random_float_between","lib.flip_negate","lib.user_can_do","lib\n      .make_array_unique","FlagManager","user","rotation","canvaslib.rotate_coordinate","filter","canvaslib.align","lib.throttled_custom_warning","canvaslib.calculate_missed_position","canvaslib.get_random_offset","canvaslib.rotateAroundPoint","obj","multiplier","lib.get_hash","canvaslib.validateAnimation","canvaslib.validateLoopingAnimation","canvaslib.is_position_within_bounds","proxy","canvaslib.createShape","canvaslib.get_object_vertical_extent","canvaslib.get_object_elevation","canvaslib.deserializeShape","canvaslib.create_drawing_mask_shape","shape","canvaslib.computeWallPolygon","scaleX","scaleY","lib.debug_error","moves","angle","x","y","align","lib.getCanvasMouse","canvaslib.get_mouse_position","canvaslib.get_closest_token","$$_import_SelectionManager","sound","hr","root_5","$.user_effect","$.action","users","$.index","$.derived_safe_equal","Sequence","$.state","$.proxy","EffectsUIShell","lib.random_int_between","lib.validate_document","lib.parseColor","canvaslib.get_object_canvas_data","canvaslib.alignments","canvaslib.serializeShape","originLocation","timespan","lib.normalize_alpha_number","lib.sequence_proxy_wrap","lib.section_proxy_wrap","$.delegated","SvelteDialogShell","list","tokens","args","ret","src","$.child","ChangelogDialog","lib.createJournalDatabase","SequencerSectionManager"],"mappings":"AAAA,MAAM,YAAY;AAAA,EAChB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EACnB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACP,OAAO;AAAA,IACL,SAAS;AAAA,IACT,WAAW;AAAA,EAEb;AAAA,EACA,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EACV;AAAA,EACE,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,EACb;AAAA,EAEC,wBAAwB;AAAA,IACvB,UAAU;AAAA,IACV,eAAe;AAAA,IACf,gBAAgB;AAAA,EAClB;AAAA,EAEC,WAAW;AAAA,IACV,MAAM;AAAA,IACN,Y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