diff --git a/dist/Abilities-Cws_x1it.js b/dist/Abilities-Cws_x1it.js new file mode 100644 index 0000000..2571e8b --- /dev/null +++ b/dist/Abilities-Cws_x1it.js @@ -0,0 +1,474 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, e as element, l as localize, a as empty, b as attr, c as insert, d as append, g as group_outros, t as transition_out, f as check_outros, h as transition_in, j as detach, k as component_subscribe, m as abilityGenerationMethod, n as getContext, o as onMount, p as getRules, q as tick, M as MODULE_ID, r as construct_svelte_component, u as create_component, v as mount_component, w as destroy_component, _ as __variableDynamicImportRuntimeHelper, x as log, y as set_store_value, z as ensure_array_like, A as noop, B as destroy_each, C as binding_callbacks, D as bind, E as add_flush_callback, F as text, G as set_data } from "./index-DP0Ud7KH.js"; +/* empty css */ +import { I as IconSelect } from "./IconSelect-BJAJvIXl.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[16] = list[i]; + return child_ctx; +} +function create_else_block(ctx) { + let ol; + let each_value = ensure_array_like( + /*options*/ + ctx[0] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + return { + c() { + ol = element("ol"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(ol, "class", "properties-list svelte-gas-7xdbzi"); + }, + m(target, anchor) { + insert(target, ol, anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(ol, null); + } + } + }, + p(ctx2, dirty) { + if (dirty & /*options*/ + 1) { + each_value = ensure_array_like( + /*options*/ + ctx2[0] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(ol, null); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(ol); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_if_block_1(ctx) { + let iconselect; + let updating_value; + let current; + function iconselect_value_binding(value) { + ctx[11](value); + } + let iconselect_props = { + class: "icon-select", + options: ( + /*options*/ + ctx[0] + ), + active: ( + /*active*/ + ctx[2] + ), + placeHolder: ( + /*placeHolder*/ + ctx[7] + ), + handler: ( + /*selectHandler*/ + ctx[6] + ), + id: "ability-generation-method-select" + }; + if ( + /*$abilityGenerationMethod*/ + ctx[1] !== void 0 + ) { + iconselect_props.value = /*$abilityGenerationMethod*/ + ctx[1]; + } + iconselect = new IconSelect({ props: iconselect_props }); + binding_callbacks.push(() => bind(iconselect, "value", iconselect_value_binding)); + return { + c() { + create_component(iconselect.$$.fragment); + }, + m(target, anchor) { + mount_component(iconselect, target, anchor); + current = true; + }, + p(ctx2, dirty) { + const iconselect_changes = {}; + if (dirty & /*options*/ + 1) iconselect_changes.options = /*options*/ + ctx2[0]; + if (dirty & /*active*/ + 4) iconselect_changes.active = /*active*/ + ctx2[2]; + if (!updating_value && dirty & /*$abilityGenerationMethod*/ + 2) { + updating_value = true; + iconselect_changes.value = /*$abilityGenerationMethod*/ + ctx2[1]; + add_flush_callback(() => updating_value = false); + } + iconselect.$set(iconselect_changes); + }, + i(local) { + if (current) return; + transition_in(iconselect.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(iconselect.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(iconselect, detaching); + } + }; +} +function create_each_block(ctx) { + let li; + let t_value = ( + /*option*/ + ctx[16].label + "" + ); + let t; + return { + c() { + li = element("li"); + t = text(t_value); + }, + m(target, anchor) { + insert(target, li, anchor); + append(li, t); + }, + p(ctx2, dirty) { + if (dirty & /*options*/ + 1 && t_value !== (t_value = /*option*/ + ctx2[16].label + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) { + detach(li); + } + } + }; +} +function create_if_block(ctx) { + let switch_instance; + let switch_instance_anchor; + let current; + var switch_value = ( + /*abilityModule*/ + ctx[3] + ); + function switch_props(ctx2, dirty) { + return {}; + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props()); + } + return { + c() { + if (switch_instance) create_component(switch_instance.$$.fragment); + switch_instance_anchor = empty(); + }, + m(target, anchor) { + if (switch_instance) mount_component(switch_instance, target, anchor); + insert(target, switch_instance_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if (dirty & /*abilityModule*/ + 8 && switch_value !== (switch_value = /*abilityModule*/ + ctx2[3])) { + if (switch_instance) { + group_outros(); + const old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, () => { + destroy_component(old_component, 1); + }); + check_outros(); + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props()); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); + } else { + switch_instance = null; + } + } + }, + i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(switch_instance_anchor); + } + if (switch_instance) destroy_component(switch_instance, detaching); + } + }; +} +function create_fragment(ctx) { + let div4; + let div3; + let div0; + let h3; + let current_block_type_index; + let if_block0; + let if_block0_anchor; + let div1; + let div2; + let current; + const if_block_creators = [create_if_block_1, create_else_block]; + const if_blocks = []; + function select_block_type(ctx2, dirty) { + if ( + /*options*/ + ctx2[0].length > 1 + ) return 0; + return 1; + } + current_block_type_index = select_block_type(ctx); + if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + let if_block1 = ( + /*$abilityGenerationMethod*/ + ctx[1] && create_if_block(ctx) + ); + return { + c() { + div4 = element("div"); + div3 = element("div"); + div0 = element("div"); + h3 = element("h3"); + h3.textContent = `${localize("GAS.Tabs.Abilities.HowCalculated")}`; + if_block0.c(); + if_block0_anchor = empty(); + if (if_block1) if_block1.c(); + div1 = element("div"); + div1.innerHTML = ``; + div2 = element("div"); + attr(h3, "class", "left"); + attr(div0, "class", "flex2 pr-sm col-a"); + attr(div1, "class", "flex0 border-right right-border-gradient-mask"); + attr(div2, "class", "flex3 left pl-md scroll col-b"); + attr(div3, "class", "flexrow svelte-gas-7xdbzi"); + attr(div4, "class", "content svelte-gas-7xdbzi"); + }, + m(target, anchor) { + insert(target, div4, anchor); + append(div4, div3); + append(div3, div0); + append(div0, h3); + if_blocks[current_block_type_index].m(div0, null); + append(div0, if_block0_anchor); + if (if_block1) if_block1.m(div0, null); + append(div3, div1); + append(div3, div2); + div2.innerHTML = /*richHTML*/ + ctx[4]; + current = true; + }, + p(ctx2, [dirty]) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx2); + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } else { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + if_block0 = if_blocks[current_block_type_index]; + if (!if_block0) { + if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block0.c(); + } else { + if_block0.p(ctx2, dirty); + } + transition_in(if_block0, 1); + if_block0.m(div0, if_block0_anchor); + } + if ( + /*$abilityGenerationMethod*/ + ctx2[1] + ) { + if (if_block1) { + if_block1.p(ctx2, dirty); + if (dirty & /*$abilityGenerationMethod*/ + 2) { + transition_in(if_block1, 1); + } + } else { + if_block1 = create_if_block(ctx2); + if_block1.c(); + transition_in(if_block1, 1); + if_block1.m(div0, null); + } + } else if (if_block1) { + group_outros(); + transition_out(if_block1, 1, 1, () => { + if_block1 = null; + }); + check_outros(); + } + if (!current || dirty & /*richHTML*/ + 16) div2.innerHTML = /*richHTML*/ + ctx2[4]; + }, + i(local) { + if (current) return; + transition_in(if_block0); + transition_in(if_block1); + current = true; + }, + o(local) { + transition_out(if_block0); + transition_out(if_block1); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div4); + } + if_blocks[current_block_type_index].d(); + if (if_block1) if_block1.d(); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let advancementComponents; + let richHTML; + let options; + let abilityModule; + let $abilityGenerationMethod; + let $actor; + component_subscribe($$self, abilityGenerationMethod, ($$value) => $$invalidate(1, $abilityGenerationMethod = $$value)); + const actor = getContext("#doc"); + component_subscribe($$self, actor, (value) => $$invalidate(10, $actor = value)); + const ruleConfig = { + journalId: "0AGfrwZRzSG0vNKb", + pageId: "yuSwUFIjK31Mr3DI" + }; + const importAdvancements = async () => { + for (const option of options) { + try { + const module = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../../molecules/dnd5e/AbilityEntry/ManualEntry.svelte": () => import("./ManualEntry-1SM2AKew.js"), "../../../molecules/dnd5e/AbilityEntry/PointBuy.svelte": () => import("./PointBuy-C3OrWmnB.js"), "../../../molecules/dnd5e/AbilityEntry/Roll.svelte": () => import("./Roll-CRZzV30g.js"), "../../../molecules/dnd5e/AbilityEntry/StandardArray.svelte": () => import("./StandardArray-CBELG86I.js") }), `../../../molecules/dnd5e/AbilityEntry/${option.type}.svelte`, 7); + $$invalidate(9, advancementComponents[option.type] = module.default, advancementComponents); + } catch (error) { + log.e(`Failed to load component for ${option.type}:`, error); + } + } + }; + const selectHandler = async (option) => { + $$invalidate(2, active = option.value ?? option ?? null); + await importAdvancements(); + tick(); + set_store_value(abilityGenerationMethod, $abilityGenerationMethod = active, $abilityGenerationMethod); + }; + let rules = "", active, placeHolder = "Ability Generation Method"; + onMount(async () => { + $$invalidate(8, rules = await getRules(ruleConfig)); + await tick(); + await importAdvancements(); + }); + function iconselect_value_binding(value) { + $abilityGenerationMethod = value; + abilityGenerationMethod.set($abilityGenerationMethod); + } + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$actor*/ + 1024) { + $actor.toObject(); + } + if ($$self.$$.dirty & /*rules*/ + 256) { + $$invalidate(4, richHTML = rules?.content || ""); + } + if ($$self.$$.dirty & /*options*/ + 1) { + if (options.length === 1) { + set_store_value(abilityGenerationMethod, $abilityGenerationMethod = options[0].value, $abilityGenerationMethod); + } + } + if ($$self.$$.dirty & /*$abilityGenerationMethod, advancementComponents, options*/ + 515) { + $$invalidate(3, abilityModule = $abilityGenerationMethod ? advancementComponents[options.find((option) => option.value === $abilityGenerationMethod).type] : null); + } + }; + $$invalidate(9, advancementComponents = {}); + $$invalidate(0, options = [ + { + value: 1, + label: "Manual Entry", + type: "ManualEntry", + setting: game.settings.get(MODULE_ID, "allowManualInput") + }, + { + value: 2, + label: "Point Buy", + type: "PointBuy", + setting: game.settings.get(MODULE_ID, "allowPointBuy") + }, + { + value: 3, + label: "Roll", + type: "Roll", + setting: game.settings.get(MODULE_ID, "allowRolling") + }, + { + value: 4, + label: "Standard Array", + type: "StandardArray", + setting: game.settings.get(MODULE_ID, "allowStandardArray") + } + ].filter((obj) => obj.setting)); + return [ + options, + $abilityGenerationMethod, + active, + abilityModule, + richHTML, + actor, + selectHandler, + placeHolder, + rules, + advancementComponents, + $actor, + iconselect_value_binding + ]; +} +class Abilities extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, {}); + } +} +export { + Abilities as default +}; +//# sourceMappingURL=Abilities-Cws_x1it.js.map diff --git a/dist/Abilities-Cws_x1it.js.map b/dist/Abilities-Cws_x1it.js.map new file mode 100644 index 0000000..6e0d877 --- /dev/null +++ b/dist/Abilities-Cws_x1it.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Abilities-Cws_x1it.js","sources":["../src/components/organisms/dnd5e/Tabs/Abilities.svelte"],"sourcesContent":["\n\n\n\n\n"],"names":["ctx"],"mappings":";;;;;;;;;;;;IA8FqY,IAAO,CAAA;AAAA,EAAA;;iCAAZ,QAAI,KAAA,GAAA;;;;;;;;;;;;AAAlC,aAAwF,QAAA,IAAA,MAAA;;;;;;;;;;;;UAArDA,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eAAe;AAAA;;MAGrD,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,MACN,SAAS,KAAK,SAAS,IAAI,WAAW,cAAc;AAAA;;MAGpD,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,MACN,SAAS,KAAK,SAAS,IAAI,WAAW,oBAAoB;AAAA;EAE5D,EAAA,OAAQ,SAAQ,IAAI,OAAO,CAAA;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/AbilityScoreImprovement-BmB9DNEX.js b/dist/AbilityScoreImprovement-BmB9DNEX.js new file mode 100644 index 0000000..a781108 --- /dev/null +++ b/dist/AbilityScoreImprovement-BmB9DNEX.js @@ -0,0 +1,226 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, z as ensure_array_like, e as element, b as attr, c as insert, A as noop, j as detach, B as destroy_each, o as onMount, F as text, d as append, G as set_data } from "./index-DP0Ud7KH.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[5] = list[i]; + return child_ctx; +} +function create_if_block(ctx) { + let span; + return { + c() { + span = element("span"); + span.textContent = "+"; + }, + m(target, anchor) { + insert(target, span, anchor); + }, + d(detaching) { + if (detaching) { + detach(span); + } + } + }; +} +function create_each_block(ctx) { + let div2; + let div0; + let span0; + let t0_value = ( + /*improvement*/ + ctx[5].label + "" + ); + let t0; + let div1; + let show_if = Number( + /*improvement*/ + ctx[5].value + ) > 0; + let span1; + let t1_value = ( + /*improvement*/ + ctx[5].value + "" + ); + let t1; + let if_block = show_if && create_if_block(); + return { + c() { + div2 = element("div"); + div0 = element("div"); + span0 = element("span"); + t0 = text(t0_value); + div1 = element("div"); + if (if_block) if_block.c(); + span1 = element("span"); + t1 = text(t1_value); + attr(span0, "class", "label"); + attr(div0, "class", "flex left"); + attr(span1, "class", "value"); + attr(div1, "class", "flex0 right"); + attr(div2, "class", "flexrow"); + }, + m(target, anchor) { + insert(target, div2, anchor); + append(div2, div0); + append(div0, span0); + append(span0, t0); + append(div2, div1); + if (if_block) if_block.m(div1, null); + append(div1, span1); + append(span1, t1); + }, + p(ctx2, dirty) { + if (dirty & /*improvements*/ + 2 && t0_value !== (t0_value = /*improvement*/ + ctx2[5].label + "")) set_data(t0, t0_value); + if (dirty & /*improvements*/ + 2) show_if = Number( + /*improvement*/ + ctx2[5].value + ) > 0; + if (show_if) { + if (if_block) ; + else { + if_block = create_if_block(); + if_block.c(); + if_block.m(div1, span1); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + if (dirty & /*improvements*/ + 2 && t1_value !== (t1_value = /*improvement*/ + ctx2[5].value + "")) set_data(t1, t1_value); + }, + d(detaching) { + if (detaching) { + detach(div2); + } + if (if_block) if_block.d(); + } + }; +} +function create_fragment(ctx) { + let div; + let div_data_type_value; + let each_value = ensure_array_like( + /*improvements*/ + ctx[1] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + return { + c() { + div = element("div"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(div, "class", "advancement mt-sm svelte-gas-o2pwds"); + attr(div, "data-type", div_data_type_value = /*advancement*/ + ctx[0].type); + }, + m(target, anchor) { + insert(target, div, anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div, null); + } + } + }, + p(ctx2, [dirty]) { + if (dirty & /*improvements, Number*/ + 2) { + each_value = ensure_array_like( + /*improvements*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, null); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + if (dirty & /*advancement*/ + 1 && div_data_type_value !== (div_data_type_value = /*advancement*/ + ctx2[0].type)) { + attr(div, "data-type", div_data_type_value); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_each(each_blocks, detaching); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let improvements; + let fixed; + let points; + let { advancement = null } = $$props; + function getNonZeroFixedValues(obj) { + if (!obj || typeof obj !== "object" || !obj.fixed) { + throw new Error("Invalid input object"); + } + const fixed2 = obj.fixed; + const nonZeroFixedArray = []; + for (const key in fixed2) { + if (fixed2.hasOwnProperty(key) && fixed2[key] !== 0) { + nonZeroFixedArray.push({ label: key, value: fixed2[key] }); + } + } + return nonZeroFixedArray; + } + onMount(async () => { + }); + $$self.$$set = ($$props2) => { + if ("advancement" in $$props2) $$invalidate(0, advancement = $$props2.advancement); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*advancement*/ + 1) { + $$invalidate(3, fixed = getNonZeroFixedValues(advancement.configuration)); + } + if ($$self.$$.dirty & /*advancement*/ + 1) { + $$invalidate(2, points = advancement.configuration.points); + } + if ($$self.$$.dirty & /*fixed*/ + 8) { + if (fixed) { + $$invalidate(1, improvements = fixed); + } + } + if ($$self.$$.dirty & /*points*/ + 4) { + if (points) $$invalidate(1, improvements = [{ label: "Points", value: Number(points) }]); + } + }; + $$invalidate(1, improvements = []); + return [advancement, improvements, points, fixed]; +} +class AbilityScoreImprovement extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { advancement: 0 }); + } +} +export { + AbilityScoreImprovement as default +}; +//# sourceMappingURL=AbilityScoreImprovement-BmB9DNEX.js.map diff --git a/dist/AbilityScoreImprovement-BmB9DNEX.js.map b/dist/AbilityScoreImprovement-BmB9DNEX.js.map new file mode 100644 index 0000000..2f5a294 --- /dev/null +++ b/dist/AbilityScoreImprovement-BmB9DNEX.js.map @@ -0,0 +1 @@ +{"version":3,"file":"AbilityScoreImprovement-BmB9DNEX.js","sources":["../src/components/molecules/dnd5e/Advancements/AbilityScore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rC,YAAA,IAAA,MAAM,sBAAsB;AAAA;UAGlCC,SAAQ,IAAI;UACZ,oBAAiB,CAAA;AAEZ,eAAA,OAAOA,QAAK;UACjBA,OAAM,eAAe,GAAG,KAAKA,OAAM,GAAG,MAAM,GAAC;AAC/C,0BAAkB,KAAI,EAAG,OAAO,KAAK,OAAOA,OAAM,GAAG,EAAA,CAAA;AAAA;;WAIlD;AAAA;AAeT,UAAO,YAAA;AAAA;;;;;;;sBAZJ,QAAQ,sBAAsB,YAAY,aAAa,CAAA;AAAA;;;sBACvD,SAAS,YAAY,cAAc,MAAA;AAAA;;;UAEhC,OAAK;AACT,qBAAA,GAAA,eAAe,KAAK;AAAA;;;;AAEhB,UAAA,OACJ,cAAA,GAAA,eACI,CAAA,EAAA,OAAO,UAAU,OAAO,OAAO,MAAM,EAAA,CAAA,CAAA;AAAA;;kBA3BxC,eAAY,CAAA,CAAA;;;;;;;;;"} \ No newline at end of file diff --git a/dist/Advancements-NN8C0jBF.js b/dist/Advancements-NN8C0jBF.js new file mode 100644 index 0000000..d4e4f6f --- /dev/null +++ b/dist/Advancements-NN8C0jBF.js @@ -0,0 +1,39 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, e as element, b as attr, c as insert, A as noop, j as detach, n as getContext, o as onMount } from "./index-DP0Ud7KH.js"; +function create_fragment(ctx) { + let div1; + return { + c() { + div1 = element("div"); + div1.innerHTML = `
`; + attr(div1, "class", "container"); + }, + m(target, anchor) { + insert(target, div1, anchor); + }, + p: noop, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div1); + } + } + }; +} +function instance($$self) { + getContext("#doc"); + onMount(() => { + Hooks.call("gas.renderAdvancement"); + }); + return []; +} +class Advancements extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, {}); + } +} +export { + Advancements as default +}; +//# sourceMappingURL=Advancements-NN8C0jBF.js.map diff --git a/dist/Advancements-NN8C0jBF.js.map b/dist/Advancements-NN8C0jBF.js.map new file mode 100644 index 0000000..6306658 --- /dev/null +++ b/dist/Advancements-NN8C0jBF.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Advancements-NN8C0jBF.js","sources":["../src/components/organisms/dnd5e/Tabs/Advancements.svelte"],"sourcesContent":["\n\n\n\n\n"],"names":[],"mappings":";;;;;;;;;;AA2BA,aAAuD,QAAA,MAAA,MAAA;AAAA;;;;;;;;;;;;AArBzC,aAAW,MAAM;AAe7B,UAAO,MAAA;AAEL,UAAM,KAAK,uBAAuB;AAAA;;;;;;;;;"} \ No newline at end of file diff --git a/dist/Background-CdPSlNd0.js b/dist/Background-CdPSlNd0.js new file mode 100644 index 0000000..ee8b30e --- /dev/null +++ b/dist/Background-CdPSlNd0.js @@ -0,0 +1,471 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, C as binding_callbacks, D as bind, e as element, F as text, u as create_component, b as attr, c as insert, d as append, v as mount_component, E as add_flush_callback, h as transition_in, g as group_outros, t as transition_out, f as check_outros, j as detach, w as destroy_component, k as component_subscribe, H as background, I as getPacksFromSettings, J as extractItemsFromPacksSync, n as getContext, o as onMount, q as tick, z as ensure_array_like, l as localize, B as destroy_each, r as construct_svelte_component, K as src_url_equal, L as getAdvancementValue, G as set_data, _ as __variableDynamicImportRuntimeHelper, y as set_store_value } from "./index-DP0Ud7KH.js"; +import { I as IconSelect } from "./IconSelect-BJAJvIXl.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[17] = list[i]; + return child_ctx; +} +function create_if_block(ctx) { + let h3; + let ul; + let current; + let each_value = ensure_array_like( + /*advancementArray*/ + ctx[5] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + const out = (i) => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + return { + c() { + h3 = element("h3"); + h3.textContent = `${localize("GAS.Advancements")}`; + ul = element("ul"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(h3, "class", "left"); + attr(ul, "class", "icon-list"); + }, + m(target, anchor) { + insert(target, h3, anchor); + insert(target, ul, anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(ul, null); + } + } + current = true; + }, + p(ctx2, dirty) { + if (dirty & /*advancementComponents, advancementArray*/ + 48) { + each_value = ensure_array_like( + /*advancementArray*/ + ctx2[5] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(ul, null); + } + } + group_outros(); + for (i = each_value.length; i < each_blocks.length; i += 1) { + out(i); + } + check_outros(); + } + }, + i(local) { + if (current) return; + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + current = true; + }, + o(local) { + each_blocks = each_blocks.filter(Boolean); + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + current = false; + }, + d(detaching) { + if (detaching) { + detach(h3); + detach(ul); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_each_block(ctx) { + let li; + let div2; + let div0; + let img; + let img_src_value; + let img_alt_value; + let div1; + let t_value = ( + /*advancement*/ + ctx[17].title + "" + ); + let t; + let div2_data_tooltip_value; + let div3; + let switch_instance; + let current; + var switch_value = ( + /*advancementComponents*/ + ctx[4][ + /*advancement*/ + ctx[17].type + ] + ); + function switch_props(ctx2, dirty) { + return { + props: { advancement: ( + /*advancement*/ + ctx2[17] + ) } + }; + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); + } + return { + c() { + li = element("li"); + div2 = element("div"); + div0 = element("div"); + img = element("img"); + div1 = element("div"); + t = text(t_value); + div3 = element("div"); + if (switch_instance) create_component(switch_instance.$$.fragment); + attr(img, "class", "icon"); + if (!src_url_equal(img.src, img_src_value = /*advancement*/ + ctx[17].icon)) attr(img, "src", img_src_value); + attr(img, "alt", img_alt_value = /*advancement*/ + ctx[17].title); + attr(div0, "class", "flex0 relative image"); + attr(div1, "class", "flex2"); + attr(div2, "class", "flexrow svelte-gas-a7sibl"); + attr(div2, "data-tooltip", div2_data_tooltip_value = getAdvancementValue( + /*advancement*/ + ctx[17], + "hint" + )); + attr(div2, "data-tooltip-class", "gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip"); + attr(div3, "class", "flexrow svelte-gas-a7sibl"); + attr(li, "class", "left"); + }, + m(target, anchor) { + insert(target, li, anchor); + append(li, div2); + append(div2, div0); + append(div0, img); + append(div2, div1); + append(div1, t); + append(li, div3); + if (switch_instance) mount_component(switch_instance, div3, null); + current = true; + }, + p(ctx2, dirty) { + if (!current || dirty & /*advancementArray*/ + 32 && !src_url_equal(img.src, img_src_value = /*advancement*/ + ctx2[17].icon)) { + attr(img, "src", img_src_value); + } + if (!current || dirty & /*advancementArray*/ + 32 && img_alt_value !== (img_alt_value = /*advancement*/ + ctx2[17].title)) { + attr(img, "alt", img_alt_value); + } + if ((!current || dirty & /*advancementArray*/ + 32) && t_value !== (t_value = /*advancement*/ + ctx2[17].title + "")) set_data(t, t_value); + if (!current || dirty & /*advancementArray*/ + 32 && div2_data_tooltip_value !== (div2_data_tooltip_value = getAdvancementValue( + /*advancement*/ + ctx2[17], + "hint" + ))) { + attr(div2, "data-tooltip", div2_data_tooltip_value); + } + if (dirty & /*advancementComponents, advancementArray*/ + 48 && switch_value !== (switch_value = /*advancementComponents*/ + ctx2[4][ + /*advancement*/ + ctx2[17].type + ])) { + if (switch_instance) { + group_outros(); + const old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, () => { + destroy_component(old_component, 1); + }); + check_outros(); + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx2)); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, div3, null); + } else { + switch_instance = null; + } + } else if (switch_value) { + const switch_instance_changes = {}; + if (dirty & /*advancementArray*/ + 32) switch_instance_changes.advancement = /*advancement*/ + ctx2[17]; + switch_instance.$set(switch_instance_changes); + } + }, + i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(li); + } + if (switch_instance) destroy_component(switch_instance); + } + }; +} +function create_fragment(ctx) { + let div7; + let div6; + let div3; + let div2; + let div0; + let t; + let div0_class_value; + let div1; + let iconselect; + let updating_value; + let div4; + let div5; + let current; + function iconselect_value_binding(value) { + ctx[9](value); + } + let iconselect_props = { + class: "icon-select", + options: ( + /*options*/ + ctx[6] + ), + active: ( + /*active*/ + ctx[2] + ), + placeHolder: ( + /*placeHolder*/ + ctx[7] + ), + handler: ( + /*selectHandler*/ + ctx[8] + ), + id: "background-select" + }; + if ( + /*value*/ + ctx[0] !== void 0 + ) { + iconselect_props.value = /*value*/ + ctx[0]; + } + iconselect = new IconSelect({ props: iconselect_props }); + binding_callbacks.push(() => bind(iconselect, "value", iconselect_value_binding)); + let if_block = ( + /*advancementArray*/ + ctx[5].length && create_if_block(ctx) + ); + return { + c() { + div7 = element("div"); + div6 = element("div"); + div3 = element("div"); + div2 = element("div"); + div0 = element("div"); + t = text("*"); + div1 = element("div"); + create_component(iconselect.$$.fragment); + if (if_block) if_block.c(); + div4 = element("div"); + div4.innerHTML = ``; + div5 = element("div"); + attr(div0, "class", div0_class_value = "flex0 required " + /*$background*/ + (ctx[1] ? "" : "active")); + attr(div1, "class", "flex3"); + attr(div2, "class", "flexrow svelte-gas-a7sibl"); + attr(div3, "class", "flex2 pr-sm col-a"); + attr(div4, "class", "flex0 border-right right-border-gradient-mask"); + attr(div5, "class", "flex3 left pl-md scroll col-b"); + attr(div6, "class", "flexrow svelte-gas-a7sibl"); + attr(div7, "class", "content svelte-gas-a7sibl"); + }, + m(target, anchor) { + insert(target, div7, anchor); + append(div7, div6); + append(div6, div3); + append(div3, div2); + append(div2, div0); + append(div0, t); + append(div2, div1); + mount_component(iconselect, div1, null); + if (if_block) if_block.m(div3, null); + append(div6, div4); + append(div6, div5); + div5.innerHTML = /*richHTML*/ + ctx[3]; + current = true; + }, + p(ctx2, [dirty]) { + if (!current || dirty & /*$background*/ + 2 && div0_class_value !== (div0_class_value = "flex0 required " + /*$background*/ + (ctx2[1] ? "" : "active"))) { + attr(div0, "class", div0_class_value); + } + const iconselect_changes = {}; + if (dirty & /*options*/ + 64) iconselect_changes.options = /*options*/ + ctx2[6]; + if (dirty & /*active*/ + 4) iconselect_changes.active = /*active*/ + ctx2[2]; + if (!updating_value && dirty & /*value*/ + 1) { + updating_value = true; + iconselect_changes.value = /*value*/ + ctx2[0]; + add_flush_callback(() => updating_value = false); + } + iconselect.$set(iconselect_changes); + if ( + /*advancementArray*/ + ctx2[5].length + ) { + if (if_block) { + if_block.p(ctx2, dirty); + if (dirty & /*advancementArray*/ + 32) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block(ctx2); + if_block.c(); + transition_in(if_block, 1); + if_block.m(div3, null); + } + } else if (if_block) { + group_outros(); + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + check_outros(); + } + if (!current || dirty & /*richHTML*/ + 8) div5.innerHTML = /*richHTML*/ + ctx2[3]; + }, + i(local) { + if (current) return; + transition_in(iconselect.$$.fragment, local); + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(iconselect.$$.fragment, local); + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div7); + } + destroy_component(iconselect); + if (if_block) if_block.d(); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let options; + let advancementComponents; + let html; + let advancementArray; + let $background; + component_subscribe($$self, background, ($$value) => $$invalidate(1, $background = $$value)); + let active = null, value = null, placeHolder = "Backgrounds"; + let packs = getPacksFromSettings("backgrounds"); + let allItems = extractItemsFromPacksSync(packs, ["name->label", "img", "type", "folder", "uuid->value", "_id"]); + let itemDefinitions = allItems.filter((x) => x.type == "background").sort((a, b) => a.label.localeCompare(b.label)); + getContext("#doc"); + let richHTML = ""; + const importAdvancements = async () => { + for (const advancement of advancementArray) { + try { + const module = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../../molecules/dnd5e/Advancements/AbilityScoreImprovement.svelte": () => import("./AbilityScoreImprovement-BmB9DNEX.js"), "../../../molecules/dnd5e/Advancements/Feat.svelte": () => import("./Feat-BpFE8O58.js"), "../../../molecules/dnd5e/Advancements/ItemChoice.svelte": () => import("./ItemChoice-CRxi93V_.js"), "../../../molecules/dnd5e/Advancements/ItemGrant.svelte": () => import("./ItemGrant-D2wJNtMk.js"), "../../../molecules/dnd5e/Advancements/ScaleValue.svelte": () => import("./ScaleValue-DYrODTcx.js"), "../../../molecules/dnd5e/Advancements/Size.svelte": () => import("./Size-DhLm1NsB.js"), "../../../molecules/dnd5e/Advancements/Trait.svelte": () => import("./Trait-DtI9SYqp.js") }), `../../../molecules/dnd5e/Advancements/${advancement.type}.svelte`, 7); + $$invalidate(4, advancementComponents[advancement.type] = module.default, advancementComponents); + } catch (error) { + log.e(`Failed to load component for ${advancement.type}:`, error); + } + } + }; + const selectHandler = async (option) => { + set_store_value(background, $background = await fromUuid(option), $background); + $$invalidate(2, active = option); + await tick(); + await importAdvancements(); + $$invalidate(3, richHTML = await TextEditor.enrichHTML(html)); + }; + onMount(async () => { + if ($background) { + $$invalidate(0, value = $background.uuid); + await tick(); + await importAdvancements(); + $$invalidate(3, richHTML = await TextEditor.enrichHTML(html)); + } + }); + function iconselect_value_binding(value$1) { + value = value$1; + $$invalidate(0, value); + } + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$background*/ + 2) { + html = $background?.system?.description.value || ""; + } + if ($$self.$$.dirty & /*$background*/ + 2) { + $$invalidate(5, advancementArray = $background?.advancement?.byId ? Object.entries($background.advancement.byId).map(([id, value2]) => ({ ...value2, id })) : []); + } + }; + $$invalidate(6, options = itemDefinitions); + $$invalidate(4, advancementComponents = {}); + allItems.filter((x) => x.type == "background"); + return [ + value, + $background, + active, + richHTML, + advancementComponents, + advancementArray, + options, + placeHolder, + selectHandler, + iconselect_value_binding + ]; +} +class Background extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, {}); + } +} +export { + Background as default +}; +//# sourceMappingURL=Background-CdPSlNd0.js.map diff --git a/dist/Background-CdPSlNd0.js.map b/dist/Background-CdPSlNd0.js.map new file mode 100644 index 0000000..ef59aa1 --- /dev/null +++ b/dist/Background-CdPSlNd0.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Background-CdPSlNd0.js","sources":["../src/components/organisms/dnd5e/Tabs/Background.svelte"],"sourcesContent":["\n\n\n\n\n"],"names":["ctx","value"],"mappings":";;;;;;;;;;;;;IA6Eub,IAAgB,CAAA;AAAA,EAAA;;iCAArB,QAAI,KAAA,GAAA;;;;;;;;;AAA9D,SAAA,cAAA,GAAA,SAAS,kBAAkB,CAAA;;;;;;;;;AAA7C,aAAoD,QAAA,IAAA,MAAA;AAAA,aAA6hB,QAAA,IAAA,MAAA;;;;;;;;;;;;;UAAhgBA,KAAgB,CAAA;AAAA,QAAA;;mCAArB,QAAI,KAAA,GAAA;;;;;;;;;;;;;4BAAJ,QAAI,IAAA,YAAA,QAAA,KAAA,GAAA;;;;;;;;qCAAJ,QAAI,KAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAqU,MAAA;AAAA;AAAA,IAAA,QAAY,QAAK;AAAA;;;;;;;;IAA2D,IAAqB,CAAA;AAAA;AAAA,MAAC,IAAW,EAAA,EAAC;AAAA,IAAI;AAAA;;;;;QAAkBA,KAAW,EAAA;AAAA,QAAA;AAAA;;;;;;;;;;;;;;;;AAAtN,UAAA,CAAA,cAAA,IAAA,KAAA;AAAA,MAAA,QAAY,IAAI,EAAA,MAAA,KAAA,OA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,UAAO,YAAA;QACD,aAAW;sBAEb,QAAQ,YAAY,IAAI;YAClB,KAAI;YACJ,mBAAkB;AACxB,mBAAA,GAAA,WAAiB,MAAA,WAAW,WAAW,IAAI,CAAA;AAAA;;;;;;;;;AArC5C,aAAO,aAAa,QAAQ,YAAY,SAAS;AAAA;;;sBAEjD,mBAAmB,aAAa,aAAa,OAC5C,OAAO,QAAQ,YAAY,YAAY,IAAI,EAAE,MAAM,IAAIC,MAAK,OACvD,EAAA,GAAAA,QACH,GAAE,EAAA;;;AAPP,eAAA,GAAE,UAAU,eAAe;kBACzB,wBAAqB,CAAA,CAAA;AAEP,WAAS,OAAQ,OAAM,EAAE,QAAQ,YAAY;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/Class-fcAq_lx5.js b/dist/Class-fcAq_lx5.js new file mode 100644 index 0000000..9c9f7be --- /dev/null +++ b/dist/Class-fcAq_lx5.js @@ -0,0 +1,1386 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, C as binding_callbacks, D as bind, e as element, F as text, u as create_component, b as attr, c as insert, d as append, v as mount_component, E as add_flush_callback, h as transition_in, g as group_outros, t as transition_out, f as check_outros, j as detach, w as destroy_component, k as component_subscribe, N as characterSubClass, O as characterClass, P as level, Q as subClassesForClass, I as getPacksFromSettings, J as extractItemsFromPacksSync, n as getContext, o as onMount, q as tick, l as localize, T as TJSSelect, a as empty, R as space, G as set_data, U as extractItemsFromPacksAsync, y as set_store_value, _ as __variableDynamicImportRuntimeHelper, z as ensure_array_like, B as destroy_each, A as noop, r as construct_svelte_component, K as src_url_equal, L as getAdvancementValue } from "./index-DP0Ud7KH.js"; +import { I as IconSelect } from "./IconSelect-BJAJvIXl.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[38] = list[i]; + return child_ctx; +} +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[38] = list[i]; + return child_ctx; +} +function create_if_block(ctx) { + let h3; + let div1; + let div0; + let tjsselect; + let if_block1_anchor; + let if_block2_anchor; + let current; + let if_block0 = ( + /*subclasses*/ + ctx[5].length && create_if_block_6(ctx) + ); + tjsselect = new TJSSelect({ + props: { + options: ( + /*levelOptions*/ + ctx[16] + ), + store: level, + styles: ( + /*selectStyles*/ + ctx[17] + ) + } + }); + tjsselect.$on( + "change", + /*levelSelectHandler*/ + ctx[18] + ); + let if_block1 = ( + /*classAdvancementArrayFiltered*/ + ctx[6] && create_if_block_4(ctx) + ); + let if_block2 = ( + /*subclasses*/ + ctx[5].length && create_if_block_1(ctx) + ); + return { + c() { + if (if_block0) if_block0.c(); + h3 = element("h3"); + h3.textContent = `${localize("GAS.Tabs.Classes.FilterByLevel")}`; + div1 = element("div"); + div0 = element("div"); + create_component(tjsselect.$$.fragment); + if (if_block1) if_block1.c(); + if_block1_anchor = empty(); + if (if_block2) if_block2.c(); + if_block2_anchor = empty(); + attr(h3, "class", "left mt-sm"); + attr(div0, "class", "flex2 left"); + attr(div1, "class", "flexrow svelte-gas-ahq1lz"); + }, + m(target, anchor) { + if (if_block0) if_block0.m(target, anchor); + insert(target, h3, anchor); + insert(target, div1, anchor); + append(div1, div0); + mount_component(tjsselect, div0, null); + if (if_block1) if_block1.m(target, anchor); + insert(target, if_block1_anchor, anchor); + if (if_block2) if_block2.m(target, anchor); + insert(target, if_block2_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if ( + /*subclasses*/ + ctx2[5].length + ) { + if (if_block0) { + if_block0.p(ctx2, dirty); + if (dirty[0] & /*subclasses*/ + 32) { + transition_in(if_block0, 1); + } + } else { + if_block0 = create_if_block_6(ctx2); + if_block0.c(); + transition_in(if_block0, 1); + if_block0.m(h3.parentNode, h3); + } + } else if (if_block0) { + group_outros(); + transition_out(if_block0, 1, 1, () => { + if_block0 = null; + }); + check_outros(); + } + if ( + /*classAdvancementArrayFiltered*/ + ctx2[6] + ) { + if (if_block1) { + if_block1.p(ctx2, dirty); + if (dirty[0] & /*classAdvancementArrayFiltered*/ + 64) { + transition_in(if_block1, 1); + } + } else { + if_block1 = create_if_block_4(ctx2); + if_block1.c(); + transition_in(if_block1, 1); + if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); + } + } else if (if_block1) { + group_outros(); + transition_out(if_block1, 1, 1, () => { + if_block1 = null; + }); + check_outros(); + } + if ( + /*subclasses*/ + ctx2[5].length + ) { + if (if_block2) { + if_block2.p(ctx2, dirty); + if (dirty[0] & /*subclasses*/ + 32) { + transition_in(if_block2, 1); + } + } else { + if_block2 = create_if_block_1(ctx2); + if_block2.c(); + transition_in(if_block2, 1); + if_block2.m(if_block2_anchor.parentNode, if_block2_anchor); + } + } else if (if_block2) { + group_outros(); + transition_out(if_block2, 1, 1, () => { + if_block2 = null; + }); + check_outros(); + } + }, + i(local) { + if (current) return; + transition_in(if_block0); + transition_in(tjsselect.$$.fragment, local); + transition_in(if_block1); + transition_in(if_block2); + current = true; + }, + o(local) { + transition_out(if_block0); + transition_out(tjsselect.$$.fragment, local); + transition_out(if_block1); + transition_out(if_block2); + current = false; + }, + d(detaching) { + if (detaching) { + detach(h3); + detach(div1); + detach(if_block1_anchor); + detach(if_block2_anchor); + } + if (if_block0) if_block0.d(detaching); + destroy_component(tjsselect); + if (if_block1) if_block1.d(detaching); + if (if_block2) if_block2.d(detaching); + } + }; +} +function create_if_block_6(ctx) { + let h3; + let div2; + let div0; + let t1; + let div0_class_value; + let div1; + let iconselect; + let updating_value; + let current; + function iconselect_value_binding_1(value) { + ctx[27](value); + } + let iconselect_props = { + class: "icon-select", + active: ( + /*subClassProp*/ + ctx[12] + ), + options: ( + /*subclasses*/ + ctx[5] + ), + placeHolder: ( + /*subclassesPlaceholder*/ + ctx[14] + ), + handler: ( + /*selectSubClassHandler*/ + ctx[20] + ), + id: "subClass-select", + truncateWidth: "17" + }; + if ( + /*subclassValue*/ + ctx[4] !== void 0 + ) { + iconselect_props.value = /*subclassValue*/ + ctx[4]; + } + iconselect = new IconSelect({ props: iconselect_props }); + binding_callbacks.push(() => bind(iconselect, "value", iconselect_value_binding_1)); + return { + c() { + h3 = element("h3"); + h3.textContent = `${localize("GAS.SubClass")}`; + div2 = element("div"); + div0 = element("div"); + t1 = text("*"); + div1 = element("div"); + create_component(iconselect.$$.fragment); + attr(h3, "class", "left mt-md"); + attr(div0, "class", div0_class_value = "flex0 required " + /*$characterSubClass*/ + (ctx[0] ? "" : "active")); + attr(div1, "class", "flex3"); + attr(div2, "class", "flexrow svelte-gas-ahq1lz"); + }, + m(target, anchor) { + insert(target, h3, anchor); + insert(target, div2, anchor); + append(div2, div0); + append(div0, t1); + append(div2, div1); + mount_component(iconselect, div1, null); + current = true; + }, + p(ctx2, dirty) { + if (!current || dirty[0] & /*$characterSubClass*/ + 1 && div0_class_value !== (div0_class_value = "flex0 required " + /*$characterSubClass*/ + (ctx2[0] ? "" : "active"))) { + attr(div0, "class", div0_class_value); + } + const iconselect_changes = {}; + if (dirty[0] & /*subClassProp*/ + 4096) iconselect_changes.active = /*subClassProp*/ + ctx2[12]; + if (dirty[0] & /*subclasses*/ + 32) iconselect_changes.options = /*subclasses*/ + ctx2[5]; + if (!updating_value && dirty[0] & /*subclassValue*/ + 16) { + updating_value = true; + iconselect_changes.value = /*subclassValue*/ + ctx2[4]; + add_flush_callback(() => updating_value = false); + } + iconselect.$set(iconselect_changes); + }, + i(local) { + if (current) return; + transition_in(iconselect.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(iconselect.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(h3); + detach(div2); + } + destroy_component(iconselect); + } + }; +} +function create_if_block_4(ctx) { + let h3; + let div0; + let div1; + let t3_value = localize("GAS.Level") + ""; + let t3; + let t4; + let t5; + let ul; + let current_block_type_index; + let if_block; + let current; + const if_block_creators = [create_if_block_5, create_else_block_1]; + const if_blocks = []; + function select_block_type(ctx2, dirty) { + if (!/*classAdvancementArrayFiltered*/ + ctx2[6].length) return 0; + return 1; + } + current_block_type_index = select_block_type(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + return { + c() { + h3 = element("h3"); + div0 = element("div"); + div0.textContent = `${localize("GAS.Tabs.Classes.Class")} ${localize("GAS.Advancements")}`; + div1 = element("div"); + t3 = text(t3_value); + t4 = space(); + t5 = text( + /*$level*/ + ctx[2] + ); + ul = element("ul"); + if_block.c(); + attr(div0, "class", "flex"); + attr(div1, "class", "flex0 div badge right inset ml-sm mb-xs svelte-gas-ahq1lz"); + attr(h3, "class", "left mt-sm flexrow svelte-gas-ahq1lz"); + attr(ul, "class", "icon-list"); + }, + m(target, anchor) { + insert(target, h3, anchor); + append(h3, div0); + append(h3, div1); + append(div1, t3); + append(div1, t4); + append(div1, t5); + insert(target, ul, anchor); + if_blocks[current_block_type_index].m(ul, null); + current = true; + }, + p(ctx2, dirty) { + if (!current || dirty[0] & /*$level*/ + 4) set_data( + t5, + /*$level*/ + ctx2[2] + ); + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx2); + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } else { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + if_block = if_blocks[current_block_type_index]; + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block.c(); + } else { + if_block.p(ctx2, dirty); + } + transition_in(if_block, 1); + if_block.m(ul, null); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(h3); + detach(ul); + } + if_blocks[current_block_type_index].d(); + } + }; +} +function create_else_block_1(ctx) { + let each_1_anchor; + let current; + let each_value_1 = ensure_array_like( + /*classAdvancementArrayFiltered*/ + ctx[6] + ); + let each_blocks = []; + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + const out = (i) => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + return { + c() { + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + each_1_anchor = empty(); + }, + m(target, anchor) { + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(target, anchor); + } + } + insert(target, each_1_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if (dirty[0] & /*classAdvancementArrayFiltered, classAdvancementComponents*/ + 576) { + each_value_1 = ensure_array_like( + /*classAdvancementArrayFiltered*/ + ctx2[6] + ); + let i; + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx2, each_value_1, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block_1(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); + } + } + group_outros(); + for (i = each_value_1.length; i < each_blocks.length; i += 1) { + out(i); + } + check_outros(); + } + }, + i(local) { + if (current) return; + for (let i = 0; i < each_value_1.length; i += 1) { + transition_in(each_blocks[i]); + } + current = true; + }, + o(local) { + each_blocks = each_blocks.filter(Boolean); + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + current = false; + }, + d(detaching) { + if (detaching) { + detach(each_1_anchor); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_if_block_5(ctx) { + let li; + return { + c() { + li = element("li"); + li.textContent = `${localize("GAS.NoAdvancements")}`; + attr(li, "class", "left"); + }, + m(target, anchor) { + insert(target, li, anchor); + }, + p: noop, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(li); + } + } + }; +} +function create_each_block_1(ctx) { + let li; + let div2; + let div0; + let img; + let img_src_value; + let img_alt_value; + let div1; + let t_value = ( + /*advancement*/ + ctx[38].title + "" + ); + let t; + let div2_data_tooltip_value; + let div3; + let switch_instance; + let li_data_type_value; + let current; + var switch_value = ( + /*classAdvancementComponents*/ + ctx[9][ + /*advancement*/ + ctx[38].type + ] + ); + function switch_props(ctx2, dirty) { + return { + props: { advancement: ( + /*advancement*/ + ctx2[38] + ) } + }; + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); + } + return { + c() { + li = element("li"); + div2 = element("div"); + div0 = element("div"); + img = element("img"); + div1 = element("div"); + t = text(t_value); + div3 = element("div"); + if (switch_instance) create_component(switch_instance.$$.fragment); + attr(img, "class", "icon"); + if (!src_url_equal(img.src, img_src_value = /*advancement*/ + ctx[38].icon)) attr(img, "src", img_src_value); + attr(img, "alt", img_alt_value = /*advancement*/ + ctx[38].title); + attr(div0, "class", "flex0 relative image"); + attr(div1, "class", "flex2"); + attr(div2, "class", "flexrow svelte-gas-ahq1lz"); + attr(div2, "data-tooltip", div2_data_tooltip_value = getAdvancementValue( + /*advancement*/ + ctx[38] + )); + attr(div2, "data-tooltip-class", "gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip"); + attr(div3, "class", "flexrow svelte-gas-ahq1lz"); + attr(li, "class", "left"); + attr(li, "data-type", li_data_type_value = /*advancement*/ + ctx[38].type); + }, + m(target, anchor) { + insert(target, li, anchor); + append(li, div2); + append(div2, div0); + append(div0, img); + append(div2, div1); + append(div1, t); + append(li, div3); + if (switch_instance) mount_component(switch_instance, div3, null); + current = true; + }, + p(ctx2, dirty) { + if (!current || dirty[0] & /*classAdvancementArrayFiltered*/ + 64 && !src_url_equal(img.src, img_src_value = /*advancement*/ + ctx2[38].icon)) { + attr(img, "src", img_src_value); + } + if (!current || dirty[0] & /*classAdvancementArrayFiltered*/ + 64 && img_alt_value !== (img_alt_value = /*advancement*/ + ctx2[38].title)) { + attr(img, "alt", img_alt_value); + } + if ((!current || dirty[0] & /*classAdvancementArrayFiltered*/ + 64) && t_value !== (t_value = /*advancement*/ + ctx2[38].title + "")) set_data(t, t_value); + if (!current || dirty[0] & /*classAdvancementArrayFiltered*/ + 64 && div2_data_tooltip_value !== (div2_data_tooltip_value = getAdvancementValue( + /*advancement*/ + ctx2[38] + ))) { + attr(div2, "data-tooltip", div2_data_tooltip_value); + } + if (dirty[0] & /*classAdvancementComponents, classAdvancementArrayFiltered*/ + 576 && switch_value !== (switch_value = /*classAdvancementComponents*/ + ctx2[9][ + /*advancement*/ + ctx2[38].type + ])) { + if (switch_instance) { + group_outros(); + const old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, () => { + destroy_component(old_component, 1); + }); + check_outros(); + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx2)); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, div3, null); + } else { + switch_instance = null; + } + } else if (switch_value) { + const switch_instance_changes = {}; + if (dirty[0] & /*classAdvancementArrayFiltered*/ + 64) switch_instance_changes.advancement = /*advancement*/ + ctx2[38]; + switch_instance.$set(switch_instance_changes); + } + if (!current || dirty[0] & /*classAdvancementArrayFiltered*/ + 64 && li_data_type_value !== (li_data_type_value = /*advancement*/ + ctx2[38].type)) { + attr(li, "data-type", li_data_type_value); + } + }, + i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(li); + } + if (switch_instance) destroy_component(switch_instance); + } + }; +} +function create_if_block_1(ctx) { + let if_block_anchor; + let current; + let if_block = ( + /*subClassAdvancementArrayFiltered*/ + ctx[7] && create_if_block_2(ctx) + ); + return { + c() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if ( + /*subClassAdvancementArrayFiltered*/ + ctx2[7] + ) { + if (if_block) { + if_block.p(ctx2, dirty); + if (dirty[0] & /*subClassAdvancementArrayFiltered*/ + 128) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block_2(ctx2); + if_block.c(); + transition_in(if_block, 1); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + group_outros(); + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + check_outros(); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if (if_block) if_block.d(detaching); + } + }; +} +function create_if_block_2(ctx) { + let h3; + let div0; + let div1; + let t3_value = localize("GAS.Level") + ""; + let t3; + let t4; + let t5; + let ul; + let current_block_type_index; + let if_block; + let current; + const if_block_creators = [create_if_block_3, create_else_block]; + const if_blocks = []; + function select_block_type_1(ctx2, dirty) { + if (!/*subClassAdvancementArrayFiltered*/ + ctx2[7].length) return 0; + return 1; + } + current_block_type_index = select_block_type_1(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + return { + c() { + h3 = element("h3"); + div0 = element("div"); + div0.textContent = `${localize("GAS.Tabs.Classes.SubClass")} ${localize("GAS.Advancements")}`; + div1 = element("div"); + t3 = text(t3_value); + t4 = space(); + t5 = text( + /*$level*/ + ctx[2] + ); + ul = element("ul"); + if_block.c(); + attr(div0, "class", "flex"); + attr(div1, "class", "flex0 div badge right inset ml-sm mb-xs svelte-gas-ahq1lz"); + attr(h3, "class", "left mt-sm flexrow svelte-gas-ahq1lz"); + attr(ul, "class", "icon-list"); + }, + m(target, anchor) { + insert(target, h3, anchor); + append(h3, div0); + append(h3, div1); + append(div1, t3); + append(div1, t4); + append(div1, t5); + insert(target, ul, anchor); + if_blocks[current_block_type_index].m(ul, null); + current = true; + }, + p(ctx2, dirty) { + if (!current || dirty[0] & /*$level*/ + 4) set_data( + t5, + /*$level*/ + ctx2[2] + ); + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type_1(ctx2); + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } else { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + if_block = if_blocks[current_block_type_index]; + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block.c(); + } else { + if_block.p(ctx2, dirty); + } + transition_in(if_block, 1); + if_block.m(ul, null); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(h3); + detach(ul); + } + if_blocks[current_block_type_index].d(); + } + }; +} +function create_else_block(ctx) { + let each_1_anchor; + let current; + let each_value = ensure_array_like( + /*subClassAdvancementArrayFiltered*/ + ctx[7] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + const out = (i) => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + return { + c() { + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + each_1_anchor = empty(); + }, + m(target, anchor) { + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(target, anchor); + } + } + insert(target, each_1_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if (dirty[0] & /*subClassAdvancementArrayFiltered, subClassAdvancementComponents*/ + 384) { + each_value = ensure_array_like( + /*subClassAdvancementArrayFiltered*/ + ctx2[7] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); + } + } + group_outros(); + for (i = each_value.length; i < each_blocks.length; i += 1) { + out(i); + } + check_outros(); + } + }, + i(local) { + if (current) return; + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + current = true; + }, + o(local) { + each_blocks = each_blocks.filter(Boolean); + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + current = false; + }, + d(detaching) { + if (detaching) { + detach(each_1_anchor); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_if_block_3(ctx) { + let li; + return { + c() { + li = element("li"); + li.textContent = `${localize("GAS.NoAdvancements")}`; + attr(li, "class", "left"); + }, + m(target, anchor) { + insert(target, li, anchor); + }, + p: noop, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(li); + } + } + }; +} +function create_each_block(ctx) { + let li; + let div2; + let div0; + let img; + let img_src_value; + let img_alt_value; + let div1; + let t_value = ( + /*advancement*/ + ctx[38].title + "" + ); + let t; + let div2_data_tooltip_value; + let div3; + let switch_instance; + let li_data_type_value; + let current; + var switch_value = ( + /*subClassAdvancementComponents*/ + ctx[8][ + /*advancement*/ + ctx[38].type + ] + ); + function switch_props(ctx2, dirty) { + return { + props: { advancement: ( + /*advancement*/ + ctx2[38] + ) } + }; + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); + } + return { + c() { + li = element("li"); + div2 = element("div"); + div0 = element("div"); + img = element("img"); + div1 = element("div"); + t = text(t_value); + div3 = element("div"); + if (switch_instance) create_component(switch_instance.$$.fragment); + attr(img, "class", "icon"); + if (!src_url_equal(img.src, img_src_value = /*advancement*/ + ctx[38].icon)) attr(img, "src", img_src_value); + attr(img, "alt", img_alt_value = /*advancement*/ + ctx[38].title); + attr(div0, "class", "flex0 relative image"); + attr(div1, "class", "flex2"); + attr(div2, "class", "flexrow svelte-gas-ahq1lz"); + attr(div2, "data-tooltip", div2_data_tooltip_value = getAdvancementValue( + /*advancement*/ + ctx[38] + )); + attr(div2, "data-tooltip-locked", "true"); + attr(div2, "data-tooltip-class", "gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip"); + attr(div3, "class", "flexrow svelte-gas-ahq1lz"); + attr(li, "class", "left"); + attr(li, "data-type", li_data_type_value = /*advancement*/ + ctx[38].type); + }, + m(target, anchor) { + insert(target, li, anchor); + append(li, div2); + append(div2, div0); + append(div0, img); + append(div2, div1); + append(div1, t); + append(li, div3); + if (switch_instance) mount_component(switch_instance, div3, null); + current = true; + }, + p(ctx2, dirty) { + if (!current || dirty[0] & /*subClassAdvancementArrayFiltered*/ + 128 && !src_url_equal(img.src, img_src_value = /*advancement*/ + ctx2[38].icon)) { + attr(img, "src", img_src_value); + } + if (!current || dirty[0] & /*subClassAdvancementArrayFiltered*/ + 128 && img_alt_value !== (img_alt_value = /*advancement*/ + ctx2[38].title)) { + attr(img, "alt", img_alt_value); + } + if ((!current || dirty[0] & /*subClassAdvancementArrayFiltered*/ + 128) && t_value !== (t_value = /*advancement*/ + ctx2[38].title + "")) set_data(t, t_value); + if (!current || dirty[0] & /*subClassAdvancementArrayFiltered*/ + 128 && div2_data_tooltip_value !== (div2_data_tooltip_value = getAdvancementValue( + /*advancement*/ + ctx2[38] + ))) { + attr(div2, "data-tooltip", div2_data_tooltip_value); + } + if (dirty[0] & /*subClassAdvancementComponents, subClassAdvancementArrayFiltered*/ + 384 && switch_value !== (switch_value = /*subClassAdvancementComponents*/ + ctx2[8][ + /*advancement*/ + ctx2[38].type + ])) { + if (switch_instance) { + group_outros(); + const old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, () => { + destroy_component(old_component, 1); + }); + check_outros(); + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx2)); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, div3, null); + } else { + switch_instance = null; + } + } else if (switch_value) { + const switch_instance_changes = {}; + if (dirty[0] & /*subClassAdvancementArrayFiltered*/ + 128) switch_instance_changes.advancement = /*advancement*/ + ctx2[38]; + switch_instance.$set(switch_instance_changes); + } + if (!current || dirty[0] & /*subClassAdvancementArrayFiltered*/ + 128 && li_data_type_value !== (li_data_type_value = /*advancement*/ + ctx2[38].type)) { + attr(li, "data-type", li_data_type_value); + } + }, + i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(li); + } + if (switch_instance) destroy_component(switch_instance); + } + }; +} +function create_fragment(ctx) { + let div7; + let div6; + let div3; + let div2; + let div0; + let t; + let div0_class_value; + let div1; + let iconselect; + let updating_value; + let div4; + let div5; + let current; + function iconselect_value_binding(value) { + ctx[26](value); + } + let iconselect_props = { + class: "icon-select", + active: ( + /*classProp*/ + ctx[11] + ), + options: ( + /*filteredClassIndex*/ + ctx[15] + ), + placeHolder: ( + /*classesPlaceholder*/ + ctx[13] + ), + handler: ( + /*selectClassHandler*/ + ctx[19] + ), + id: "characterClass-select" + }; + if ( + /*classValue*/ + ctx[3] !== void 0 + ) { + iconselect_props.value = /*classValue*/ + ctx[3]; + } + iconselect = new IconSelect({ props: iconselect_props }); + binding_callbacks.push(() => bind(iconselect, "value", iconselect_value_binding)); + let if_block = ( + /*$characterClass*/ + ctx[1] && create_if_block(ctx) + ); + return { + c() { + div7 = element("div"); + div6 = element("div"); + div3 = element("div"); + div2 = element("div"); + div0 = element("div"); + t = text("*"); + div1 = element("div"); + create_component(iconselect.$$.fragment); + if (if_block) if_block.c(); + div4 = element("div"); + div4.innerHTML = ``; + div5 = element("div"); + attr(div0, "class", div0_class_value = "flex0 required " + /*$characterClass*/ + (ctx[1] ? "" : "active")); + attr(div1, "class", "flex3"); + attr(div2, "class", "flexrow svelte-gas-ahq1lz"); + attr(div3, "class", "flex2 pr-sm col-a"); + attr(div4, "class", "flex0 border-right right-border-gradient-mask"); + attr(div5, "class", "flex3 left pl-md scroll col-b"); + attr(div6, "class", "flexrow svelte-gas-ahq1lz"); + attr(div7, "class", "content svelte-gas-ahq1lz"); + }, + m(target, anchor) { + insert(target, div7, anchor); + append(div7, div6); + append(div6, div3); + append(div3, div2); + append(div2, div0); + append(div0, t); + append(div2, div1); + mount_component(iconselect, div1, null); + if (if_block) if_block.m(div3, null); + append(div6, div4); + append(div6, div5); + div5.innerHTML = /*combinedHtml*/ + ctx[10]; + current = true; + }, + p(ctx2, dirty) { + if (!current || dirty[0] & /*$characterClass*/ + 2 && div0_class_value !== (div0_class_value = "flex0 required " + /*$characterClass*/ + (ctx2[1] ? "" : "active"))) { + attr(div0, "class", div0_class_value); + } + const iconselect_changes = {}; + if (dirty[0] & /*classProp*/ + 2048) iconselect_changes.active = /*classProp*/ + ctx2[11]; + if (!updating_value && dirty[0] & /*classValue*/ + 8) { + updating_value = true; + iconselect_changes.value = /*classValue*/ + ctx2[3]; + add_flush_callback(() => updating_value = false); + } + iconselect.$set(iconselect_changes); + if ( + /*$characterClass*/ + ctx2[1] + ) { + if (if_block) { + if_block.p(ctx2, dirty); + if (dirty[0] & /*$characterClass*/ + 2) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block(ctx2); + if_block.c(); + transition_in(if_block, 1); + if_block.m(div3, null); + } + } else if (if_block) { + group_outros(); + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + check_outros(); + } + if (!current || dirty[0] & /*combinedHtml*/ + 1024) div5.innerHTML = /*combinedHtml*/ + ctx2[10]; + }, + i(local) { + if (current) return; + transition_in(iconselect.$$.fragment, local); + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(iconselect.$$.fragment, local); + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div7); + } + destroy_component(iconselect); + if (if_block) if_block.d(); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let subClassProp; + let classProp; + let combinedHtml; + let classAdvancementComponents; + let subClassAdvancementComponents; + let $characterSubClass; + let $characterClass; + let $level; + let $subClassesForClass; + component_subscribe($$self, characterSubClass, ($$value) => $$invalidate(0, $characterSubClass = $$value)); + component_subscribe($$self, characterClass, ($$value) => $$invalidate(1, $characterClass = $$value)); + component_subscribe($$self, level, ($$value) => $$invalidate(2, $level = $$value)); + component_subscribe($$self, subClassesForClass, ($$value) => $$invalidate(29, $subClassesForClass = $$value)); + let richHTML = "", html = "", richSubClassHTML = "", activeClass = null, activeSubClass = null, classValue = null, subclassValue = null, subClassesIndex, subclasses, classesPlaceholder = "Classes", subclassesPlaceholder = "Subclasses", packs = getPacksFromSettings("classes"); + game.packs.get("dnd5e.subclasses"); + let subClassesPacks = getPacksFromSettings("subclasses"), classAdvancementArrayFiltered = [], subClassAdvancementArrayFiltered = [], mappedClassIndex = extractItemsFromPacksSync(packs, ["name->label", "img", "type", "folder", "uuid->value", "_id"]), filteredClassIndex = mappedClassIndex.filter((i) => { + return i.type == "class"; + }).sort((a, b) => a.label.localeCompare(b.label)); + const levelOptions = []; + for (let i = 1; i <= 20; i++) { + levelOptions.push({ label: "Level " + i, value: i }); + } + const selectStyles = {}; + getContext("#doc"); + const levelSelectHandler = async (option) => { + $$invalidate(25, subClassesIndex = await getFilteredSubclassIndex()); + await tick(); + importClassAdvancements(); + importSubClassAdvancements(); + }; + const getFilteredSubclassIndex = async () => { + let mappedSubClassIndex = await extractItemsFromPacksAsync(subClassesPacks, ["name->label", "img", "type", "folder", "uuid->value", "_id"], ["system.classIdentifier"]); + game.system.log.d("mappedSubClassIndex", mappedSubClassIndex); + mappedSubClassIndex = mappedSubClassIndex.filter((x) => { + game.system.log.d("subclass", x); + game.system.log.d("$characterClass.system.identifier", $characterClass.system.identifier); + return x.system.classIdentifier == $characterClass.system.identifier; + }); + const output = mappedSubClassIndex.flat().sort((a, b) => a.label.localeCompare(b.label)); + game.system.log.d("subclass output", output); + return output; + }; + const selectClassHandler = async (option) => { + $$invalidate(24, activeSubClass = null); + set_store_value(characterSubClass, $characterSubClass = null, $characterSubClass); + $$invalidate(4, subclassValue = null); + $$invalidate(7, subClassAdvancementArrayFiltered = []); + $$invalidate(22, richSubClassHTML = ""); + set_store_value(characterClass, $characterClass = await fromUuid(option), $characterClass); + $$invalidate(23, activeClass = option); + await tick(); + $$invalidate(25, subClassesIndex = await getFilteredSubclassIndex()); + set_store_value(subClassesForClass, $subClassesForClass = subClassesIndex, $subClassesForClass); + await tick(); + importClassAdvancements(); + $$invalidate(21, richHTML = await TextEditor.enrichHTML(html)); + }; + const importClassAdvancements = async () => { + for (const classAdvancement of classAdvancementArrayFiltered) { + try { + const module = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../../molecules/dnd5e/Advancements/AbilityScoreImprovement.svelte": () => import("./AbilityScoreImprovement-BmB9DNEX.js"), "../../../molecules/dnd5e/Advancements/Feat.svelte": () => import("./Feat-BpFE8O58.js"), "../../../molecules/dnd5e/Advancements/ItemChoice.svelte": () => import("./ItemChoice-CRxi93V_.js"), "../../../molecules/dnd5e/Advancements/ItemGrant.svelte": () => import("./ItemGrant-D2wJNtMk.js"), "../../../molecules/dnd5e/Advancements/ScaleValue.svelte": () => import("./ScaleValue-DYrODTcx.js"), "../../../molecules/dnd5e/Advancements/Size.svelte": () => import("./Size-DhLm1NsB.js"), "../../../molecules/dnd5e/Advancements/Trait.svelte": () => import("./Trait-DtI9SYqp.js") }), `../../../molecules/dnd5e/Advancements/${classAdvancement.type}.svelte`, 7); + $$invalidate(9, classAdvancementComponents[classAdvancement.type] = module.default, classAdvancementComponents); + } catch (error) { + log.e(`Failed to load component for ${classAdvancement.type}:`, error); + } + } + }; + const selectSubClassHandler = async (option) => { + set_store_value(characterSubClass, $characterSubClass = await fromUuid(option), $characterSubClass); + $$invalidate(24, activeSubClass = option); + await tick(); + importClassAdvancements(); + importSubClassAdvancements(); + $$invalidate(22, richSubClassHTML = await TextEditor.enrichHTML($characterSubClass.system.description.value)); + }; + const importSubClassAdvancements = async () => { + for (const subClassAdvancement of subClassAdvancementArrayFiltered) { + try { + const module = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../../molecules/dnd5e/Advancements/AbilityScoreImprovement.svelte": () => import("./AbilityScoreImprovement-BmB9DNEX.js"), "../../../molecules/dnd5e/Advancements/Feat.svelte": () => import("./Feat-BpFE8O58.js"), "../../../molecules/dnd5e/Advancements/ItemChoice.svelte": () => import("./ItemChoice-CRxi93V_.js"), "../../../molecules/dnd5e/Advancements/ItemGrant.svelte": () => import("./ItemGrant-D2wJNtMk.js"), "../../../molecules/dnd5e/Advancements/ScaleValue.svelte": () => import("./ScaleValue-DYrODTcx.js"), "../../../molecules/dnd5e/Advancements/Size.svelte": () => import("./Size-DhLm1NsB.js"), "../../../molecules/dnd5e/Advancements/Trait.svelte": () => import("./Trait-DtI9SYqp.js") }), `../../../molecules/dnd5e/Advancements/${subClassAdvancement.type}.svelte`, 7); + await tick(); + $$invalidate(8, subClassAdvancementComponents[subClassAdvancement.type] = module.default, subClassAdvancementComponents); + } catch (error) { + log.e(`Failed to load component for ${subClassAdvancement.type}:`, error); + } + } + }; + onMount(async () => { + if ($characterClass) { + game.system.log.d($characterClass); + $$invalidate(3, classValue = $characterClass.uuid); + await tick(); + importClassAdvancements(); + $$invalidate(21, richHTML = await TextEditor.enrichHTML(html)); + $$invalidate(25, subClassesIndex = await getFilteredSubclassIndex()); + } + if ($characterSubClass) { + $$invalidate(4, subclassValue = $characterSubClass.uuid); + await tick(); + importSubClassAdvancements(); + $$invalidate(22, richSubClassHTML = await TextEditor.enrichHTML($characterSubClass.system.description.value)); + } + }); + function iconselect_value_binding(value) { + classValue = value; + $$invalidate(3, classValue); + } + function iconselect_value_binding_1(value) { + subclassValue = value; + $$invalidate(4, subclassValue); + } + $$self.$$.update = () => { + if ($$self.$$.dirty[0] & /*$characterClass*/ + 2) { + html = $characterClass?.system?.description.value || ""; + } + if ($$self.$$.dirty[0] & /*activeSubClass*/ + 16777216) { + $$invalidate(12, subClassProp = activeSubClass); + } + if ($$self.$$.dirty[0] & /*activeClass*/ + 8388608) { + $$invalidate(11, classProp = activeClass); + } + if ($$self.$$.dirty[0] & /*richHTML, richSubClassHTML*/ + 6291456) { + $$invalidate(10, combinedHtml = richHTML + (richSubClassHTML ? `

${localize("GAS.SubClass")}

` + richSubClassHTML : "")); + } + if ($$self.$$.dirty[0] & /*subClassesIndex*/ + 33554432) { + if (subClassesIndex?.length) { + $$invalidate(5, subclasses = subClassesIndex.flat().sort((a, b) => a.label.localeCompare(b.label))); + } else { + $$invalidate(5, subclasses = []); + } + } + if ($$self.$$.dirty[0] & /*$characterSubClass, $level*/ + 5) { + if ($characterSubClass?.system?.advancement.length) { + $$invalidate(7, subClassAdvancementArrayFiltered = $characterSubClass.system.advancement.filter((value) => value.level === $level)); + } else { + $$invalidate(7, subClassAdvancementArrayFiltered = []); + } + } + if ($$self.$$.dirty[0] & /*$characterClass, $level*/ + 6) { + if ($characterClass?.system?.advancement.length) { + $$invalidate(6, classAdvancementArrayFiltered = $characterClass.system.advancement.filter((value) => value.level === $level)); + } else { + $$invalidate(6, classAdvancementArrayFiltered = []); + } + } + }; + $$invalidate(9, classAdvancementComponents = {}); + $$invalidate(8, subClassAdvancementComponents = {}); + return [ + $characterSubClass, + $characterClass, + $level, + classValue, + subclassValue, + subclasses, + classAdvancementArrayFiltered, + subClassAdvancementArrayFiltered, + subClassAdvancementComponents, + classAdvancementComponents, + combinedHtml, + classProp, + subClassProp, + classesPlaceholder, + subclassesPlaceholder, + filteredClassIndex, + levelOptions, + selectStyles, + levelSelectHandler, + selectClassHandler, + selectSubClassHandler, + richHTML, + richSubClassHTML, + activeClass, + activeSubClass, + subClassesIndex, + iconselect_value_binding, + iconselect_value_binding_1 + ]; +} +class Class extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, {}, null, [-1, -1]); + } +} +export { + Class as default +}; +//# sourceMappingURL=Class-fcAq_lx5.js.map diff --git a/dist/Class-fcAq_lx5.js.map b/dist/Class-fcAq_lx5.js.map new file mode 100644 index 0000000..35910e6 --- /dev/null +++ b/dist/Class-fcAq_lx5.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Class-fcAq_lx5.js","sources":["../src/components/organisms/dnd5e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YACjC,KAAI;AACV;uBACA,mBAAgB,MAAS,WAAW,WAClC,mBAAmB,OAAO,YAAY,KAAK,CAAA;AAAA;;;AAMkU,iBAAU;;;;AAAua,oBAAa;;;;;;AAzD9yB,aAAO,iBAAiB,QAAQ,YAAY,SAAS;AAAA;;;AACvD,mBAAA,IAAE,eAAe,cAAc;AAAA;;;AAC/B,mBAAA,IAAE,YAAY,WAAW;AAAA;;;AACvB,mBAAA,IAAA,eACD,YACC,0BACU,SAAS,cAAc,CAAW,UAAA,mBACzC,GAAE;AAAA;;;AAIP,UAAM,iBAAiB,QAAM;AAC5B,qBAAA,GAAA,aAAa,gBACV,KAAI,EACJ,KAAI,CAAE,GAAG,MAAM,EAAE,MAAM,cAAc,EAAE,KAAK,CAAA,CAAA;AAAA;wBAE/C,aAAU,CAAA,CAAA;AAAA;;;;UAGL,oBAAoB,QAAQ,YAAY,QAAM;AACnD,qBAAA,GAAA,mCACE,mBAAmB,OAAO,YAAY,OACnC,WAAU,MAAM,UAAU,MAAM,CAAA;AAAA;wBAGrC,mCAAgC,CAAA,CAAA;AAAA;;;;UAG3B,iBAAiB,QAAQ,YAAY,QAAM;AAChD,qBAAA,GAAA,gCAAgC,gBAAgB,OAAO,YAAY,OAChE,WAAU,MAAM,UAAU,MAAM,CAAA;AAAA;wBAGnC,gCAA6B,CAAA,CAAA;AAAA;;;kBAzB5B,6BAA0B,CAAA,CAAA;kBAC1B,gCAA6B,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/ExistingAbilities-CSTjZ0sf.js b/dist/ExistingAbilities-CSTjZ0sf.js new file mode 100644 index 0000000..df8105d --- /dev/null +++ b/dist/ExistingAbilities-CSTjZ0sf.js @@ -0,0 +1,473 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, e as element, l as localize, a as empty, b as attr, c as insert, d as append, g as group_outros, t as transition_out, f as check_outros, h as transition_in, j as detach, k as component_subscribe, m as abilityGenerationMethod, n as getContext, o as onMount, p as getRules, q as tick, M as MODULE_ID, r as construct_svelte_component, u as create_component, v as mount_component, w as destroy_component, _ as __variableDynamicImportRuntimeHelper, x as log, y as set_store_value, z as ensure_array_like, A as noop, B as destroy_each, C as binding_callbacks, D as bind, E as add_flush_callback, F as text, G as set_data } from "./index-DP0Ud7KH.js"; +/* empty css */ +import { I as IconSelect } from "./IconSelect-BJAJvIXl.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[16] = list[i]; + return child_ctx; +} +function create_else_block(ctx) { + let ol; + let each_value = ensure_array_like( + /*options*/ + ctx[0] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + return { + c() { + ol = element("ol"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(ol, "class", "properties-list svelte-gas-7xdbzi"); + }, + m(target, anchor) { + insert(target, ol, anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(ol, null); + } + } + }, + p(ctx2, dirty) { + if (dirty & /*options*/ + 1) { + each_value = ensure_array_like( + /*options*/ + ctx2[0] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(ol, null); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(ol); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_if_block_1(ctx) { + let iconselect; + let updating_value; + let current; + function iconselect_value_binding(value) { + ctx[11](value); + } + let iconselect_props = { + class: "icon-select", + options: ( + /*options*/ + ctx[0] + ), + active: ( + /*active*/ + ctx[2] + ), + placeHolder: ( + /*placeHolder*/ + ctx[7] + ), + handler: ( + /*selectHandler*/ + ctx[6] + ), + id: "ability-generation-method-select" + }; + if ( + /*$abilityGenerationMethod*/ + ctx[1] !== void 0 + ) { + iconselect_props.value = /*$abilityGenerationMethod*/ + ctx[1]; + } + iconselect = new IconSelect({ props: iconselect_props }); + binding_callbacks.push(() => bind(iconselect, "value", iconselect_value_binding)); + return { + c() { + create_component(iconselect.$$.fragment); + }, + m(target, anchor) { + mount_component(iconselect, target, anchor); + current = true; + }, + p(ctx2, dirty) { + const iconselect_changes = {}; + if (dirty & /*options*/ + 1) iconselect_changes.options = /*options*/ + ctx2[0]; + if (dirty & /*active*/ + 4) iconselect_changes.active = /*active*/ + ctx2[2]; + if (!updating_value && dirty & /*$abilityGenerationMethod*/ + 2) { + updating_value = true; + iconselect_changes.value = /*$abilityGenerationMethod*/ + ctx2[1]; + add_flush_callback(() => updating_value = false); + } + iconselect.$set(iconselect_changes); + }, + i(local) { + if (current) return; + transition_in(iconselect.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(iconselect.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(iconselect, detaching); + } + }; +} +function create_each_block(ctx) { + let li; + let t_value = ( + /*option*/ + ctx[16].label + "" + ); + let t; + return { + c() { + li = element("li"); + t = text(t_value); + }, + m(target, anchor) { + insert(target, li, anchor); + append(li, t); + }, + p(ctx2, dirty) { + if (dirty & /*options*/ + 1 && t_value !== (t_value = /*option*/ + ctx2[16].label + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) { + detach(li); + } + } + }; +} +function create_if_block(ctx) { + let switch_instance; + let switch_instance_anchor; + let current; + var switch_value = ( + /*abilityModule*/ + ctx[3] + ); + function switch_props(ctx2, dirty) { + return {}; + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props()); + } + return { + c() { + if (switch_instance) create_component(switch_instance.$$.fragment); + switch_instance_anchor = empty(); + }, + m(target, anchor) { + if (switch_instance) mount_component(switch_instance, target, anchor); + insert(target, switch_instance_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if (dirty & /*abilityModule*/ + 8 && switch_value !== (switch_value = /*abilityModule*/ + ctx2[3])) { + if (switch_instance) { + group_outros(); + const old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, () => { + destroy_component(old_component, 1); + }); + check_outros(); + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props()); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); + } else { + switch_instance = null; + } + } + }, + i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(switch_instance_anchor); + } + if (switch_instance) destroy_component(switch_instance, detaching); + } + }; +} +function create_fragment(ctx) { + let div4; + let div3; + let div0; + let h3; + let current_block_type_index; + let if_block0; + let if_block0_anchor; + let div1; + let div2; + let current; + const if_block_creators = [create_if_block_1, create_else_block]; + const if_blocks = []; + function select_block_type(ctx2, dirty) { + if ( + /*options*/ + ctx2[0].length > 1 + ) return 0; + return 1; + } + current_block_type_index = select_block_type(ctx); + if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + let if_block1 = ( + /*$abilityGenerationMethod*/ + ctx[1] && create_if_block(ctx) + ); + return { + c() { + div4 = element("div"); + div3 = element("div"); + div0 = element("div"); + h3 = element("h3"); + h3.textContent = `${localize("GAS.Tabs.Abilities.HowCalculated")}`; + if_block0.c(); + if_block0_anchor = empty(); + if (if_block1) if_block1.c(); + div1 = element("div"); + div1.innerHTML = ``; + div2 = element("div"); + attr(h3, "class", "left"); + attr(div0, "class", "flex2 pr-sm col-a"); + attr(div1, "class", "flex0 border-right right-border-gradient-mask"); + attr(div2, "class", "flex3 left pl-md scroll col-b"); + attr(div3, "class", "flexrow svelte-gas-7xdbzi"); + attr(div4, "class", "content svelte-gas-7xdbzi"); + }, + m(target, anchor) { + insert(target, div4, anchor); + append(div4, div3); + append(div3, div0); + append(div0, h3); + if_blocks[current_block_type_index].m(div0, null); + append(div0, if_block0_anchor); + if (if_block1) if_block1.m(div0, null); + append(div3, div1); + append(div3, div2); + div2.innerHTML = /*richHTML*/ + ctx[4]; + current = true; + }, + p(ctx2, [dirty]) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx2); + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } else { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + if_block0 = if_blocks[current_block_type_index]; + if (!if_block0) { + if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block0.c(); + } else { + if_block0.p(ctx2, dirty); + } + transition_in(if_block0, 1); + if_block0.m(div0, if_block0_anchor); + } + if ( + /*$abilityGenerationMethod*/ + ctx2[1] + ) { + if (if_block1) { + if_block1.p(ctx2, dirty); + if (dirty & /*$abilityGenerationMethod*/ + 2) { + transition_in(if_block1, 1); + } + } else { + if_block1 = create_if_block(ctx2); + if_block1.c(); + transition_in(if_block1, 1); + if_block1.m(div0, null); + } + } else if (if_block1) { + group_outros(); + transition_out(if_block1, 1, 1, () => { + if_block1 = null; + }); + check_outros(); + } + if (!current || dirty & /*richHTML*/ + 16) div2.innerHTML = /*richHTML*/ + ctx2[4]; + }, + i(local) { + if (current) return; + transition_in(if_block0); + transition_in(if_block1); + current = true; + }, + o(local) { + transition_out(if_block0); + transition_out(if_block1); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div4); + } + if_blocks[current_block_type_index].d(); + if (if_block1) if_block1.d(); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let advancementComponents; + let richHTML; + let options; + let abilityModule; + let $abilityGenerationMethod; + let $actor; + component_subscribe($$self, abilityGenerationMethod, ($$value) => $$invalidate(1, $abilityGenerationMethod = $$value)); + const actor = getContext("#doc"); + component_subscribe($$self, actor, (value) => $$invalidate(10, $actor = value)); + const ruleConfig = { + journalId: "0AGfrwZRzSG0vNKb", + pageId: "yuSwUFIjK31Mr3DI" + }; + const importAdvancements = async () => { + for (const option of options) { + try { + const module = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../../molecules/dnd5e/AbilityEntry/ManualEntry.svelte": () => import("./ManualEntry-1SM2AKew.js"), "../../../molecules/dnd5e/AbilityEntry/PointBuy.svelte": () => import("./PointBuy-C3OrWmnB.js"), "../../../molecules/dnd5e/AbilityEntry/Roll.svelte": () => import("./Roll-CRZzV30g.js"), "../../../molecules/dnd5e/AbilityEntry/StandardArray.svelte": () => import("./StandardArray-CBELG86I.js") }), `../../../molecules/dnd5e/AbilityEntry/${option.type}.svelte`, 7); + $$invalidate(9, advancementComponents[option.type] = module.default, advancementComponents); + } catch (error) { + log.e(`Failed to load component for ${option.type}:`, error); + } + } + }; + const selectHandler = async (option) => { + $$invalidate(2, active = option.value); + set_store_value(abilityGenerationMethod, $abilityGenerationMethod = option.value, $abilityGenerationMethod); + importAdvancements(); + }; + let rules = "", active, placeHolder = "Ability Generation Method"; + onMount(async () => { + $$invalidate(8, rules = await getRules(ruleConfig)); + await tick(); + await importAdvancements(); + }); + function iconselect_value_binding(value) { + $abilityGenerationMethod = value; + abilityGenerationMethod.set($abilityGenerationMethod); + } + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$actor*/ + 1024) { + $actor.toObject(); + } + if ($$self.$$.dirty & /*rules*/ + 256) { + $$invalidate(4, richHTML = rules?.content || ""); + } + if ($$self.$$.dirty & /*options*/ + 1) { + if (options.length === 1) { + set_store_value(abilityGenerationMethod, $abilityGenerationMethod = options[0].value, $abilityGenerationMethod); + } + } + if ($$self.$$.dirty & /*$abilityGenerationMethod, advancementComponents, options*/ + 515) { + $$invalidate(3, abilityModule = $abilityGenerationMethod ? advancementComponents[options.find((option) => option.value === $abilityGenerationMethod).type] : null); + } + }; + $$invalidate(9, advancementComponents = {}); + $$invalidate(0, options = [ + { + value: 1, + label: "Manual Entry", + type: "ManualEntry", + setting: game.settings.get(MODULE_ID, "allowManualInput") + }, + { + value: 2, + label: "Point Buy", + type: "PointBuy", + setting: game.settings.get(MODULE_ID, "allowPointBuy") + }, + { + value: 3, + label: "Roll", + type: "Roll", + setting: game.settings.get(MODULE_ID, "allowRolling") + }, + { + value: 4, + label: "Standard Array", + type: "StandardArray", + setting: game.settings.get(MODULE_ID, "allowStandardArray") + } + ].filter((obj) => obj.setting)); + return [ + options, + $abilityGenerationMethod, + active, + abilityModule, + richHTML, + actor, + selectHandler, + placeHolder, + rules, + advancementComponents, + $actor, + iconselect_value_binding + ]; +} +class ExistingAbilities extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, {}); + } +} +export { + ExistingAbilities as default +}; +//# sourceMappingURL=ExistingAbilities-CSTjZ0sf.js.map diff --git a/dist/ExistingAbilities-CSTjZ0sf.js.map b/dist/ExistingAbilities-CSTjZ0sf.js.map new file mode 100644 index 0000000..1a072fa --- /dev/null +++ b/dist/ExistingAbilities-CSTjZ0sf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ExistingAbilities-CSTjZ0sf.js","sources":["../src/components/organisms/dnd5e/Tabs/ExistingAbilities.svelte"],"sourcesContent":["\n\n\n\n\n"],"names":["ctx"],"mappings":";;;;;;;;;;;;IA0FqY,IAAO,CAAA;AAAA,EAAA;;iCAAZ,QAAI,KAAA,GAAA;;;;;;;;;;;;AAAlC,aAAwF,QAAA,IAAA,MAAA;;;;;;;;;;;;UAArDA,KAAO,CAAA;AAAA,QAAA;;mCAAZ,QAAI,KAAA,GAAA;;;;;;;;;;;;;wCAAJ;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAhJ,IAAa,CAAA;AAAA;AAAA;;;;IAAsD,IAAwB,CAAA,MAAA;AAAA,IAAA;;IAAxB,IAAwB,CAAA;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;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/Feat-BpFE8O58.js b/dist/Feat-BpFE8O58.js new file mode 100644 index 0000000..1789e6d --- /dev/null +++ b/dist/Feat-BpFE8O58.js @@ -0,0 +1,107 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, e as element, b as attr, c as insert, A as noop, j as detach, o as onMount, L as getAdvancementValue, F as text, d as append, G as set_data } from "./index-DP0Ud7KH.js"; +function create_if_block(ctx) { + let div1; + let div0; + let t_value = getAdvancementValue( + /*advancement*/ + ctx[0] + ) + ""; + let t; + return { + c() { + div1 = element("div"); + div0 = element("div"); + t = text(t_value); + attr(div0, "class", "flex left"); + attr(div1, "class", "flexrow"); + }, + m(target, anchor) { + insert(target, div1, anchor); + append(div1, div0); + append(div0, t); + }, + p(ctx2, dirty) { + if (dirty & /*advancement*/ + 1 && t_value !== (t_value = getAdvancementValue( + /*advancement*/ + ctx2[0] + ) + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) { + detach(div1); + } + } + }; +} +function create_fragment(ctx) { + let div; + let div_data_type_value; + let if_block = ( + /*advancement*/ + ctx[0].title === "Size" && create_if_block(ctx) + ); + return { + c() { + div = element("div"); + if (if_block) if_block.c(); + attr(div, "class", "advancement mt-sm svelte-gas-o2pwds"); + attr(div, "data-type", div_data_type_value = /*advancement*/ + ctx[0].type); + }, + m(target, anchor) { + insert(target, div, anchor); + if (if_block) if_block.m(div, null); + }, + p(ctx2, [dirty]) { + if ( + /*advancement*/ + ctx2[0].title === "Size" + ) { + if (if_block) { + if_block.p(ctx2, dirty); + } else { + if_block = create_if_block(ctx2); + if_block.c(); + if_block.m(div, null); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + if (dirty & /*advancement*/ + 1 && div_data_type_value !== (div_data_type_value = /*advancement*/ + ctx2[0].type)) { + attr(div, "data-type", div_data_type_value); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div); + } + if (if_block) if_block.d(); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let { advancement = null } = $$props; + onMount(async () => { + console.log("advancement" + advancement.type, advancement); + }); + $$self.$$set = ($$props2) => { + if ("advancement" in $$props2) $$invalidate(0, advancement = $$props2.advancement); + }; + return [advancement]; +} +class Feat extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { advancement: 0 }); + } +} +export { + Feat as default +}; +//# sourceMappingURL=Feat-BpFE8O58.js.map diff --git a/dist/Feat-BpFE8O58.js.map b/dist/Feat-BpFE8O58.js.map new file mode 100644 index 0000000..5b84aa9 --- /dev/null +++ b/dist/Feat-BpFE8O58.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Feat-BpFE8O58.js","sources":["../src/components/molecules/dnd5e/Advancements/Feat.svelte"],"sourcesContent":["\n\n\n\n"],"names":["ctx"],"mappings":";;;;AAa6I,MAAA,UAAA;AAAA;AAAA,IAAoB,IAAW,CAAA;AAAA,EAAA,IAAA;;;;;;;;;;;AAA5E,aAA0F,QAAA,MAAA,MAAA;AAArE,aAA+D,MAAA,IAAA;;;;AAAvC,UAAA;AAAA,MAAA,KAAA,aAAA,UAAA;AAAA;AAAA,QAAoBA,KAAW,CAAA;AAAA,MAAA,IAAA,IAAA,UAAA,GAAA,OAAA;AAAA;;;;;;;;;;;;;IAAzG,IAAW,CAAA,EAAC,UAAU,UAAM,gBAAA,GAAA;AAAA;;;;;;AAApD,WAAA,KAAA,aAAA;AAAA,MAAA,OAAY,IAAI;AAAA;;AAA3D,aAAoM,QAAA,KAAA,MAAA;;;;;;QAAjIA,KAAW,CAAA,EAAC,UAAU;AAAA,QAAM;;;;;;;;;;;;AAApD,UAAA;AAAA,MAAA,KAAA,yBAAA;AAAA,MAAAA,QAAY,OAAI;;;;;;;;;;;;;;;AAT9C,MAAA,EAAA,cAAc,KAAI,IAAA;AAE7B,UAAO,YAAA;AACL,YAAQ,IAAI,gBAAc,YAAY,MAAM,WAAW;AAAA;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/IconSelect-BJAJvIXl.js b/dist/IconSelect-BJAJvIXl.js new file mode 100644 index 0000000..acdb2e5 --- /dev/null +++ b/dist/IconSelect-BJAJvIXl.js @@ -0,0 +1,914 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, z as ensure_array_like, a2 as assign, e as element, a as empty, b as attr, a3 as toggle_class, a4 as set_attributes, c as insert, d as append, Z as listen, a5 as get_spread_update, A as noop, j as detach, B as destroy_each, a6 as run_all, a7 as compute_rest_props, o as onMount, a8 as onDestroy, a9 as exclude_internal_props, F as text, G as set_data, aa as truncate, a0 as is_function, K as src_url_equal, ab as null_to_empty } from "./index-DP0Ud7KH.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[15] = list[i]; + child_ctx[17] = i; + return child_ctx; +} +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[15] = list[i]; + child_ctx[17] = i; + return child_ctx; +} +function create_if_block_7(ctx) { + let div; + let t; + return { + c() { + div = element("div"); + t = text( + /*placeHolder*/ + ctx[3] + ); + attr(div, "class", "placeholder"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, t); + }, + p(ctx2, dirty) { + if (dirty & /*placeHolder*/ + 8) set_data( + t, + /*placeHolder*/ + ctx2[3] + ); + }, + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} +function create_if_block_4(ctx) { + let show_if = !/*noImg*/ + ctx[5] && !/*textOnly*/ + ctx[10]( + /*option*/ + ctx[15] + ) && /*shrinkIfNoIcon*/ + ctx[2]; + let div; + let t_value = truncate( + /*option*/ + ctx[15].label, + /*truncateWidth*/ + ctx[6] + ) + ""; + let t; + let if_block = show_if && create_if_block_5(ctx); + return { + c() { + if (if_block) if_block.c(); + div = element("div"); + t = text(t_value); + attr(div, "class", "option-label svelte-gas-1o166tm"); + }, + m(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert(target, div, anchor); + append(div, t); + }, + p(ctx2, dirty) { + if (dirty & /*noImg, options, shrinkIfNoIcon*/ + 38) show_if = !/*noImg*/ + ctx2[5] && !/*textOnly*/ + ctx2[10]( + /*option*/ + ctx2[15] + ) && /*shrinkIfNoIcon*/ + ctx2[2]; + if (show_if) { + if (if_block) { + if_block.p(ctx2, dirty); + } else { + if_block = create_if_block_5(ctx2); + if_block.c(); + if_block.m(div.parentNode, div); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + if (dirty & /*options, truncateWidth*/ + 66 && t_value !== (t_value = truncate( + /*option*/ + ctx2[15].label, + /*truncateWidth*/ + ctx2[6] + ) + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) { + detach(div); + } + if (if_block) if_block.d(detaching); + } + }; +} +function create_if_block_5(ctx) { + let div; + let div_class_value; + function select_block_type(ctx2, dirty) { + if ( + /*option*/ + ctx2[15].icon != void 0 + ) return create_if_block_6; + return create_else_block_1; + } + let current_block_type = select_block_type(ctx); + let if_block = current_block_type(ctx); + return { + c() { + div = element("div"); + if_block.c(); + attr(div, "class", div_class_value = "option-icon " + /*option*/ + (ctx[15].img ? ( + /*option*/ + ctx[15].img + ) : "") + " svelte-gas-1o166tm"); + }, + m(target, anchor) { + insert(target, div, anchor); + if_block.m(div, null); + }, + p(ctx2, dirty) { + if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) { + if_block.p(ctx2, dirty); + } else { + if_block.d(1); + if_block = current_block_type(ctx2); + if (if_block) { + if_block.c(); + if_block.m(div, null); + } + } + if (dirty & /*options*/ + 2 && div_class_value !== (div_class_value = "option-icon " + /*option*/ + (ctx2[15].img ? ( + /*option*/ + ctx2[15].img + ) : "") + " svelte-gas-1o166tm")) { + attr(div, "class", div_class_value); + } + }, + d(detaching) { + if (detaching) { + detach(div); + } + if_block.d(); + } + }; +} +function create_else_block_1(ctx) { + let img; + let img_src_value; + let img_alt_value; + return { + c() { + img = element("img"); + if (!src_url_equal(img.src, img_src_value = /*option*/ + ctx[15].img)) attr(img, "src", img_src_value); + attr(img, "alt", img_alt_value = /*option*/ + ctx[15].label); + attr(img, "class", "svelte-gas-1o166tm"); + }, + m(target, anchor) { + insert(target, img, anchor); + }, + p(ctx2, dirty) { + if (dirty & /*options*/ + 2 && !src_url_equal(img.src, img_src_value = /*option*/ + ctx2[15].img)) { + attr(img, "src", img_src_value); + } + if (dirty & /*options*/ + 2 && img_alt_value !== (img_alt_value = /*option*/ + ctx2[15].label)) { + attr(img, "alt", img_alt_value); + } + }, + d(detaching) { + if (detaching) { + detach(img); + } + } + }; +} +function create_if_block_6(ctx) { + let i; + let i_class_value; + return { + c() { + i = element("i"); + attr(i, "class", i_class_value = null_to_empty( + /*option*/ + ctx[15].icon + ) + " svelte-gas-1o166tm"); + }, + m(target, anchor) { + insert(target, i, anchor); + }, + p(ctx2, dirty) { + if (dirty & /*options*/ + 2 && i_class_value !== (i_class_value = null_to_empty( + /*option*/ + ctx2[15].icon + ) + " svelte-gas-1o166tm")) { + attr(i, "class", i_class_value); + } + }, + d(detaching) { + if (detaching) { + detach(i); + } + } + }; +} +function create_each_block_1(ctx) { + let if_block_anchor; + let if_block = ( + /*option*/ + ctx[15] && /*option*/ + ctx[15]?.value === /*value*/ + ctx[0] && create_if_block_4(ctx) + ); + return { + c() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p(ctx2, dirty) { + if ( + /*option*/ + ctx2[15] && /*option*/ + ctx2[15]?.value === /*value*/ + ctx2[0] + ) { + if (if_block) { + if_block.p(ctx2, dirty); + } else { + if_block = create_if_block_4(ctx2); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if (if_block) if_block.d(detaching); + } + }; +} +function create_if_block(ctx) { + let div; + let each_value = ensure_array_like( + /*options*/ + ctx[1] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + return { + c() { + div = element("div"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(div, "class", "options-dropdown dropshadow svelte-gas-1o166tm"); + attr(div, "id", "options-list"); + attr(div, "role", "listbox"); + }, + m(target, anchor) { + insert(target, div, anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div, null); + } + } + }, + p(ctx2, dirty) { + if (dirty & /*handleSelect, options, handleKeydown, undefined, textOnly, shrinkIfNoIcon, value*/ + 1159) { + each_value = ensure_array_like( + /*options*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, null); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + }, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_if_block_1(ctx) { + let div1; + let show_if = !/*textOnly*/ + ctx[10]( + /*option*/ + ctx[15] + ) && /*shrinkIfNoIcon*/ + ctx[2]; + let div0; + let t_value = ( + /*option*/ + ctx[15].label + "" + ); + let t; + let mounted; + let dispose; + let if_block = show_if && create_if_block_2(ctx); + return { + c() { + div1 = element("div"); + if (if_block) if_block.c(); + div0 = element("div"); + t = text(t_value); + attr(div0, "class", "option-label svelte-gas-1o166tm"); + attr(div1, "class", "option svelte-gas-1o166tm"); + attr(div1, "role", "option"); + attr(div1, "tabindex", "0"); + }, + m(target, anchor) { + insert(target, div1, anchor); + if (if_block) if_block.m(div1, null); + append(div1, div0); + append(div0, t); + if (!mounted) { + dispose = [ + listen(div1, "click", function() { + if (is_function( + /*handleSelect*/ + ctx[7]( + /*option*/ + ctx[15] + ) + )) ctx[7]( + /*option*/ + ctx[15] + ).apply(this, arguments); + }), + listen(div1, "keydown", handleKeydown) + ]; + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if (dirty & /*options, shrinkIfNoIcon*/ + 6) show_if = !/*textOnly*/ + ctx[10]( + /*option*/ + ctx[15] + ) && /*shrinkIfNoIcon*/ + ctx[2]; + if (show_if) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block_2(ctx); + if_block.c(); + if_block.m(div1, div0); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + if (dirty & /*options*/ + 2 && t_value !== (t_value = /*option*/ + ctx[15].label + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) { + detach(div1); + } + if (if_block) if_block.d(); + mounted = false; + run_all(dispose); + } + }; +} +function create_if_block_2(ctx) { + let div; + let div_class_value; + function select_block_type_1(ctx2, dirty) { + if ( + /*option*/ + ctx2[15].icon != void 0 + ) return create_if_block_3; + return create_else_block; + } + let current_block_type = select_block_type_1(ctx); + let if_block = current_block_type(ctx); + return { + c() { + div = element("div"); + if_block.c(); + attr(div, "class", div_class_value = "option-icon " + /*option*/ + (ctx[15].img ? ( + /*option*/ + ctx[15].img + ) : "") + " svelte-gas-1o166tm"); + }, + m(target, anchor) { + insert(target, div, anchor); + if_block.m(div, null); + }, + p(ctx2, dirty) { + if (current_block_type === (current_block_type = select_block_type_1(ctx2)) && if_block) { + if_block.p(ctx2, dirty); + } else { + if_block.d(1); + if_block = current_block_type(ctx2); + if (if_block) { + if_block.c(); + if_block.m(div, null); + } + } + if (dirty & /*options*/ + 2 && div_class_value !== (div_class_value = "option-icon " + /*option*/ + (ctx2[15].img ? ( + /*option*/ + ctx2[15].img + ) : "") + " svelte-gas-1o166tm")) { + attr(div, "class", div_class_value); + } + }, + d(detaching) { + if (detaching) { + detach(div); + } + if_block.d(); + } + }; +} +function create_else_block(ctx) { + let img; + let img_src_value; + let img_alt_value; + return { + c() { + img = element("img"); + if (!src_url_equal(img.src, img_src_value = /*option*/ + ctx[15].img)) attr(img, "src", img_src_value); + attr(img, "alt", img_alt_value = /*option*/ + ctx[15].label); + attr(img, "class", "svelte-gas-1o166tm"); + }, + m(target, anchor) { + insert(target, img, anchor); + }, + p(ctx2, dirty) { + if (dirty & /*options*/ + 2 && !src_url_equal(img.src, img_src_value = /*option*/ + ctx2[15].img)) { + attr(img, "src", img_src_value); + } + if (dirty & /*options*/ + 2 && img_alt_value !== (img_alt_value = /*option*/ + ctx2[15].label)) { + attr(img, "alt", img_alt_value); + } + }, + d(detaching) { + if (detaching) { + detach(img); + } + } + }; +} +function create_if_block_3(ctx) { + let i; + let i_class_value; + return { + c() { + i = element("i"); + attr(i, "class", i_class_value = null_to_empty( + /*option*/ + ctx[15].icon + ) + " svelte-gas-1o166tm"); + }, + m(target, anchor) { + insert(target, i, anchor); + }, + p(ctx2, dirty) { + if (dirty & /*options*/ + 2 && i_class_value !== (i_class_value = null_to_empty( + /*option*/ + ctx2[15].icon + ) + " svelte-gas-1o166tm")) { + attr(i, "class", i_class_value); + } + }, + d(detaching) { + if (detaching) { + detach(i); + } + } + }; +} +function create_each_block(ctx) { + let if_block_anchor; + let if_block = ( + /*option*/ + ctx[15] && /*option*/ + ctx[15]?.value !== /*value*/ + ctx[0] && create_if_block_1(ctx) + ); + return { + c() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p(ctx2, dirty) { + if ( + /*option*/ + ctx2[15] && /*option*/ + ctx2[15]?.value !== /*value*/ + ctx2[0] + ) { + if (if_block) { + if_block.p(ctx2, dirty); + } else { + if_block = create_if_block_1(ctx2); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if (if_block) if_block.d(detaching); + } + }; +} +function create_fragment(ctx) { + let div2; + let div1; + let if_block0_anchor; + let div0; + let mounted; + let dispose; + let if_block0 = ( + /*placeHolder*/ + ctx[3] && !/*value*/ + ctx[0] && create_if_block_7(ctx) + ); + let each_value_1 = ensure_array_like( + /*options*/ + ctx[1] + ); + let each_blocks = []; + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + let if_block1 = ( + /*isOpen*/ + ctx[8] && create_if_block(ctx) + ); + let div2_levels = [ + { class: "custom-select" }, + /*$$restProps*/ + ctx[11], + { id: ( + /*id*/ + ctx[4] + ) }, + { role: "combobox" }, + { "aria-expanded": ( + /*isOpen*/ + ctx[8] + ) }, + { "aria-haspopup": "listbox" }, + { "aria-controls": "options-list" }, + { tabindex: "0" } + ]; + let div_data_2 = {}; + for (let i = 0; i < div2_levels.length; i += 1) { + div_data_2 = assign(div_data_2, div2_levels[i]); + } + return { + c() { + div2 = element("div"); + div1 = element("div"); + if (if_block0) if_block0.c(); + if_block0_anchor = empty(); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + div0 = element("div"); + div0.innerHTML = ``; + if (if_block1) if_block1.c(); + attr(div0, "class", "chevron-icon svelte-gas-1o166tm"); + attr(div1, "class", "selected-option svelte-gas-1o166tm"); + attr(div1, "role", "button"); + attr( + div1, + "aria-expanded", + /*isOpen*/ + ctx[8] + ); + attr(div1, "aria-haspopup", "listbox"); + attr(div1, "tabindex", "0"); + toggle_class( + div1, + "selected", + /*isOpen*/ + ctx[8] + ); + set_attributes(div2, div_data_2); + toggle_class(div2, "svelte-gas-1o166tm", true); + }, + m(target, anchor) { + insert(target, div2, anchor); + append(div2, div1); + if (if_block0) if_block0.m(div1, null); + append(div1, if_block0_anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div1, null); + } + } + append(div1, div0); + if (if_block1) if_block1.m(div2, null); + if (!mounted) { + dispose = [ + listen( + div1, + "click", + /*toggleDropdown*/ + ctx[9] + ), + listen(div1, "keydown", handleKeydown) + ]; + mounted = true; + } + }, + p(ctx2, [dirty]) { + if ( + /*placeHolder*/ + ctx2[3] && !/*value*/ + ctx2[0] + ) { + if (if_block0) { + if_block0.p(ctx2, dirty); + } else { + if_block0 = create_if_block_7(ctx2); + if_block0.c(); + if_block0.m(div1, if_block0_anchor); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if (dirty & /*options, truncateWidth, undefined, noImg, textOnly, shrinkIfNoIcon, value*/ + 1127) { + each_value_1 = ensure_array_like( + /*options*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx2, each_value_1, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_1(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div1, div0); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value_1.length; + } + if (dirty & /*isOpen*/ + 256) { + attr( + div1, + "aria-expanded", + /*isOpen*/ + ctx2[8] + ); + } + if (dirty & /*isOpen*/ + 256) { + toggle_class( + div1, + "selected", + /*isOpen*/ + ctx2[8] + ); + } + if ( + /*isOpen*/ + ctx2[8] + ) { + if (if_block1) { + if_block1.p(ctx2, dirty); + } else { + if_block1 = create_if_block(ctx2); + if_block1.c(); + if_block1.m(div2, null); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + set_attributes(div2, div_data_2 = get_spread_update(div2_levels, [ + { class: "custom-select" }, + dirty & /*$$restProps*/ + 2048 && /*$$restProps*/ + ctx2[11], + dirty & /*id*/ + 16 && { id: ( + /*id*/ + ctx2[4] + ) }, + { role: "combobox" }, + dirty & /*isOpen*/ + 256 && { "aria-expanded": ( + /*isOpen*/ + ctx2[8] + ) }, + { "aria-haspopup": "listbox" }, + { "aria-controls": "options-list" }, + { tabindex: "0" } + ])); + toggle_class(div2, "svelte-gas-1o166tm", true); + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div2); + } + if (if_block0) if_block0.d(); + destroy_each(each_blocks, detaching); + if (if_block1) if_block1.d(); + mounted = false; + run_all(dispose); + } + }; +} +function handleKeydown(event) { + if (event.key === "Enter" || event.key === " ") { + event.preventDefault(); + if (event.currentTarget.getAttribute("role") === "option") { + this.handleSelect(event.currentTarget.option); + } else { + this.toggleDropdown(); + } + } +} +function isClickOutsideContainer(event, containerElement) { + const targetElement = event.target; + if (targetElement === containerElement) { + return false; + } + return !containerElement.contains(targetElement); +} +function instance($$self, $$props, $$invalidate) { + const omit_props_names = [ + "options", + "value", + "disabled", + "handler", + "shrinkIfNoIcon", + "placeHolder", + "id", + "noImg", + "truncateWidth", + "handleSelect" + ]; + let $$restProps = compute_rest_props($$props, omit_props_names); + let { options = [] } = $$props; + let { value = "" } = $$props; + let { disabled = false } = $$props; + let { handler = void 0 } = $$props; + let { shrinkIfNoIcon = true } = $$props; + let { placeHolder = false } = $$props; + let { id = void 0 } = $$props; + let { noImg = false } = $$props; + let { truncateWidth = 20 } = $$props; + let isOpen = false; + let { handleSelect = (option) => { + if (handler) { + if (handler(option.value)) { + $$invalidate(0, value = option.value); + } + } else { + console.warn("You need to pass a click handler in"); + } + toggleDropdown(); + } } = $$props; + function toggleDropdown() { + $$invalidate(8, isOpen = !isOpen); + } + function handleClickOutside(event) { + const isClickOutside = isClickOutsideContainer(event, document.getElementById(id)); + if (isClickOutside) { + $$invalidate(8, isOpen = false); + } + } + onMount(() => { + window.addEventListener("click", handleClickOutside); + }); + onDestroy(() => { + window.removeEventListener("click", handleClickOutside); + }); + let textOnly = (option) => { + return option.icon || option.img ? false : true; + }; + $$self.$$set = ($$new_props) => { + $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); + $$invalidate(11, $$restProps = compute_rest_props($$props, omit_props_names)); + if ("options" in $$new_props) $$invalidate(1, options = $$new_props.options); + if ("value" in $$new_props) $$invalidate(0, value = $$new_props.value); + if ("disabled" in $$new_props) $$invalidate(12, disabled = $$new_props.disabled); + if ("handler" in $$new_props) $$invalidate(13, handler = $$new_props.handler); + if ("shrinkIfNoIcon" in $$new_props) $$invalidate(2, shrinkIfNoIcon = $$new_props.shrinkIfNoIcon); + if ("placeHolder" in $$new_props) $$invalidate(3, placeHolder = $$new_props.placeHolder); + if ("id" in $$new_props) $$invalidate(4, id = $$new_props.id); + if ("noImg" in $$new_props) $$invalidate(5, noImg = $$new_props.noImg); + if ("truncateWidth" in $$new_props) $$invalidate(6, truncateWidth = $$new_props.truncateWidth); + if ("handleSelect" in $$new_props) $$invalidate(7, handleSelect = $$new_props.handleSelect); + }; + return [ + value, + options, + shrinkIfNoIcon, + placeHolder, + id, + noImg, + truncateWidth, + handleSelect, + isOpen, + toggleDropdown, + textOnly, + $$restProps, + disabled, + handler + ]; +} +class IconSelect extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { + options: 1, + value: 0, + disabled: 12, + handler: 13, + shrinkIfNoIcon: 2, + placeHolder: 3, + id: 4, + noImg: 5, + truncateWidth: 6, + handleSelect: 7 + }); + } +} +export { + IconSelect as I +}; +//# sourceMappingURL=IconSelect-BJAJvIXl.js.map diff --git a/dist/IconSelect-BJAJvIXl.js.map b/dist/IconSelect-BJAJvIXl.js.map new file mode 100644 index 0000000..ad180aa --- /dev/null +++ b/dist/IconSelect-BJAJvIXl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IconSelect-BJAJvIXl.js","sources":["../src/components/atoms/select/IconSelect.svelte"],"sourcesContent":["\n \n\n\n\n\n"],"names":["ctx"],"mappings":";;;;;;;;;;;;;;;;;;;;;QAoF6Y,IAAW,CAAA;AAAA,MAAA;;;;AAArC,aAA4C,QAAA,KAAA,MAAA;;;;;;;;QAAlBA,KAAW,CAAA;AAAA,MAAA;AAAA;;;;;;;;;AAAyF,MAAA,UAAA;AAAA,EAAA,IAAU,CAAA,KAAA;AAAA,EAAA,IAAS,EAAA;AAAA;AAAA,IAAA;;EAA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@@ -0,0 +1,331 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, e as element, b as attr, c as insert, A as noop, j as detach, o as onMount, z as ensure_array_like, F as text, d as append, G as set_data, B as destroy_each, L as getAdvancementValue, a as empty, K as src_url_equal } from "./index-DP0Ud7KH.js"; +import { h as handle_promise, u as update_await_block_branch } from "./await_block-DTNqOtSu.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[2] = list[i]; + return child_ctx; +} +function create_else_block(ctx) { + let div; + let h3; + let span0; + let span1; + let t1; + let t2; + let span2; + let ul; + let each_value = ensure_array_like( + /*advancement*/ + ctx[0].configuration.pool + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + return { + c() { + div = element("div"); + h3 = element("h3"); + span0 = element("span"); + span0.textContent = "Choose "; + span1 = element("span"); + t1 = text( + /*count*/ + ctx[1] + ); + t2 = text(" "); + span2 = element("span"); + span2.textContent = "from: "; + ul = element("ul"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(h3, "class", "flex left"); + attr(div, "class", "flexrow svelte-gas-1d3c77c"); + attr(ul, "class", "icon-list"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, h3); + append(h3, span0); + append(h3, span1); + append(span1, t1); + append(span1, t2); + append(h3, span2); + insert(target, ul, anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(ul, null); + } + } + }, + p(ctx2, dirty) { + if (dirty & /*count*/ + 2) set_data( + t1, + /*count*/ + ctx2[1] + ); + if (dirty & /*fromUuid, advancement*/ + 1) { + each_value = ensure_array_like( + /*advancement*/ + ctx2[0].configuration.pool + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(ul, null); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + }, + d(detaching) { + if (detaching) { + detach(div); + detach(ul); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_if_block(ctx) { + let div1; + let div0; + let t_value = getAdvancementValue( + /*advancement*/ + ctx[0], + "hint" + ) + ""; + let t; + return { + c() { + div1 = element("div"); + div0 = element("div"); + t = text(t_value); + attr(div0, "class", "flex left"); + attr(div1, "class", "flexrow svelte-gas-1d3c77c"); + }, + m(target, anchor) { + insert(target, div1, anchor); + append(div1, div0); + append(div0, t); + }, + p(ctx2, dirty) { + if (dirty & /*advancement*/ + 1 && t_value !== (t_value = getAdvancementValue( + /*advancement*/ + ctx2[0], + "hint" + ) + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) { + detach(div1); + } + } + }; +} +function create_catch_block(ctx) { + return { c: noop, m: noop, p: noop, d: noop }; +} +function create_then_block(ctx) { + let li; + let div2; + let div0; + let img; + let img_src_value; + let img_alt_value; + let div1; + let t_value = ( + /*item*/ + ctx[5].name + "" + ); + let t; + return { + c() { + li = element("li"); + div2 = element("div"); + div0 = element("div"); + img = element("img"); + div1 = element("div"); + t = text(t_value); + attr(img, "class", "icon"); + if (!src_url_equal(img.src, img_src_value = /*item*/ + ctx[5].img)) attr(img, "src", img_src_value); + attr(img, "alt", img_alt_value = /*item*/ + ctx[5].name); + attr(div0, "class", "flex0 relative image"); + attr(div1, "class", "flex2"); + attr(div2, "class", "flexrow svelte-gas-1d3c77c"); + attr(li, "class", "left"); + }, + m(target, anchor) { + insert(target, li, anchor); + append(li, div2); + append(div2, div0); + append(div0, img); + append(div2, div1); + append(div1, t); + }, + p(ctx2, dirty) { + if (dirty & /*advancement*/ + 1 && !src_url_equal(img.src, img_src_value = /*item*/ + ctx2[5].img)) { + attr(img, "src", img_src_value); + } + if (dirty & /*advancement*/ + 1 && img_alt_value !== (img_alt_value = /*item*/ + ctx2[5].name)) { + attr(img, "alt", img_alt_value); + } + if (dirty & /*advancement*/ + 1 && t_value !== (t_value = /*item*/ + ctx2[5].name + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) { + detach(li); + } + } + }; +} +function create_pending_block(ctx) { + return { c: noop, m: noop, p: noop, d: noop }; +} +function create_each_block(ctx) { + let await_block_anchor; + let promise; + let info = { + ctx, + current: null, + token: null, + hasCatch: false, + pending: create_pending_block, + then: create_then_block, + catch: create_catch_block, + value: 5 + }; + handle_promise(promise = fromUuid( + /*pool*/ + ctx[2].uuid + ), info); + return { + c() { + await_block_anchor = empty(); + info.block.c(); + }, + m(target, anchor) { + insert(target, await_block_anchor, anchor); + info.block.m(target, info.anchor = anchor); + info.mount = () => await_block_anchor.parentNode; + info.anchor = await_block_anchor; + }, + p(new_ctx, dirty) { + ctx = new_ctx; + info.ctx = ctx; + if (dirty & /*advancement*/ + 1 && promise !== (promise = fromUuid( + /*pool*/ + ctx[2].uuid + )) && handle_promise(promise, info)) ; + else { + update_await_block_branch(info, ctx, dirty); + } + }, + d(detaching) { + if (detaching) { + detach(await_block_anchor); + } + info.block.d(detaching); + info.token = null; + info = null; + } + }; +} +function create_fragment(ctx) { + let div; + let div_data_type_value; + function select_block_type(ctx2, dirty) { + if ( + /*advancement*/ + ctx2[0].title === "Cantrip" + ) return create_if_block; + return create_else_block; + } + let current_block_type = select_block_type(ctx); + let if_block = current_block_type(ctx); + return { + c() { + div = element("div"); + if_block.c(); + attr(div, "class", "advancement mt-sm svelte-gas-1d3c77c"); + attr(div, "data-type", div_data_type_value = /*advancement*/ + ctx[0].type); + }, + m(target, anchor) { + insert(target, div, anchor); + if_block.m(div, null); + }, + p(ctx2, [dirty]) { + if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) { + if_block.p(ctx2, dirty); + } else { + if_block.d(1); + if_block = current_block_type(ctx2); + if (if_block) { + if_block.c(); + if_block.m(div, null); + } + } + if (dirty & /*advancement*/ + 1 && div_data_type_value !== (div_data_type_value = /*advancement*/ + ctx2[0].type)) { + attr(div, "data-type", div_data_type_value); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div); + } + if_block.d(); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let count; + let { advancement = null } = $$props; + onMount(async () => { + }); + $$self.$$set = ($$props2) => { + if ("advancement" in $$props2) $$invalidate(0, advancement = $$props2.advancement); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*advancement*/ + 1) { + $$invalidate(1, count = advancement?.configuration?.choices?.[0] ? typeof advancement.configuration.choices[0] === "object" && advancement.configuration.choices[0] !== null ? advancement.configuration.choices[0].count : advancement.configuration.choices[0] : "-"); + } + }; + return [advancement, count]; +} +class ItemChoice extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { advancement: 0 }); + } +} +export { + ItemChoice as default +}; +//# sourceMappingURL=ItemChoice-CRxi93V_.js.map diff --git a/dist/ItemChoice-CRxi93V_.js.map b/dist/ItemChoice-CRxi93V_.js.map new file mode 100644 index 0000000..2aa1349 --- /dev/null +++ b/dist/ItemChoice-CRxi93V_.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ItemChoice-CRxi93V_.js","sources":["../src/components/molecules/dnd5e/Advancements/ItemChoice.svelte"],"sourcesContent":["\n\n\n\n"],"names":["ctx"],"mappings":";;;;;;;;;;;;;;;;;;IAkB+V,IAAW,CAAA,EAAC,cAAc;AAAA,EAAI;;iCAAnC,QAAI,KAAA,GAAA;;;;;;;;;;;;QAA5E,IAAK,CAAA;AAAA,MAAA;gBAAC,GAAK;;;;;;;;;;;;AAAjF,aAAsH,QAAA,KAAA,MAAA;AAAjG,aAA2F,KAAA,EAAA;AAArE,aAAoB,IAAA,KAAA;AAAA,aAAyB,IAAA,KAAA;;;AAAA,aAAmB,IAAA,KAAA;AAAW,aAAkT,QAAA,IAAA,MAAA;;;;;;;;;;;;QAAlWA,KAAK,CAAA;AAAA,MAAA;;;;;UAAwEA,KA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AAAA,KAAS,QAAA;;;;;;;;;;AAAvD,WAAA,KAAA,aAAA;AAAA,MAAA,OAAY,IAAI;AAAA;;AAA3D,aAA8nB,QAAA,KAAA,MAAA;;;;;;;;;;;;;;AAAnlB,UAAA;AAAA,MAAA,KAAA,yBAAA;AAAA,MAAAA,QAAY,OAAI;;;;;;;;;;;;;;;;AAd9C,MAAA,EAAA,cAAc,KAAI,IAAA;AAQ7B,UAAO,YAAA;AAAA;;;;;;;AANN,mBAAA,GAAE,QAAQ,aAAa,eAAe,UAAU,CAAC,IACvC,OAAA,YAAY,cAAc,QAAQ,CAAC,MAAM,YAAY,YAAY,cAAc,QAAQ,CAAC,MAAM,OACnG,YAAY,cAAc,QAAQ,CAAC,EAAE,QACrC,YAAY,cAAc,QAAQ,CAAC,IACrC,GAAG;AAAA;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/ItemGrant-D2wJNtMk.js b/dist/ItemGrant-D2wJNtMk.js new file mode 100644 index 0000000..270b614 --- /dev/null +++ b/dist/ItemGrant-D2wJNtMk.js @@ -0,0 +1,357 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, z as ensure_array_like, e as element, b as attr, c as insert, d as append, A as noop, j as detach, B as destroy_each, o as onMount, K as src_url_equal, F as text, G as set_data, a as empty } from "./index-DP0Ud7KH.js"; +import { h as handle_promise, u as update_await_block_branch } from "./await_block-DTNqOtSu.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[4] = list[i]; + return child_ctx; +} +function create_catch_block_1(ctx) { + return { c: noop, m: noop, p: noop, d: noop }; +} +function create_then_block(ctx) { + let div1; + let div0; + let img; + let img_src_value; + let img_alt_value; + function select_block_type(ctx2, dirty) { + if ( + /*item*/ + ctx2[4]?.link + ) return create_if_block; + return create_else_block; + } + let current_block_type = select_block_type(ctx); + let if_block = current_block_type(ctx); + return { + c() { + div1 = element("div"); + div0 = element("div"); + img = element("img"); + if_block.c(); + attr(img, "class", "icon"); + if (!src_url_equal(img.src, img_src_value = /*item*/ + ctx[4]?.img)) attr(img, "src", img_src_value); + attr(img, "alt", img_alt_value = /*item*/ + ctx[4]?.name); + attr(div0, "class", "flex0 relative image"); + attr(div1, "class", "flexrow gap-4"); + }, + m(target, anchor) { + insert(target, div1, anchor); + append(div1, div0); + append(div0, img); + if_block.m(div1, null); + }, + p(ctx2, dirty) { + if (dirty & /*items*/ + 2 && !src_url_equal(img.src, img_src_value = /*item*/ + ctx2[4]?.img)) { + attr(img, "src", img_src_value); + } + if (dirty & /*items*/ + 2 && img_alt_value !== (img_alt_value = /*item*/ + ctx2[4]?.name)) { + attr(img, "alt", img_alt_value); + } + if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) { + if_block.p(ctx2, dirty); + } else { + if_block.d(1); + if_block = current_block_type(ctx2); + if (if_block) { + if_block.c(); + if_block.m(div1, null); + } + } + }, + d(detaching) { + if (detaching) { + detach(div1); + } + if_block.d(); + } + }; +} +function create_else_block(ctx) { + let div; + let t_value = ( + /*item*/ + ctx[4]?.name + "" + ); + let t; + return { + c() { + div = element("div"); + t = text(t_value); + attr(div, "class", "flex2"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, t); + }, + p(ctx2, dirty) { + if (dirty & /*items*/ + 2 && t_value !== (t_value = /*item*/ + ctx2[4]?.name + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} +function create_if_block(ctx) { + let await_block_anchor; + let promise; + let info = { + ctx, + current: null, + token: null, + hasCatch: false, + pending: create_pending_block_1, + then: create_then_block_1, + catch: create_catch_block, + value: 7 + }; + handle_promise(promise = TextEditor.enrichHTML( + /*item*/ + ctx[4].link || "" + ), info); + return { + c() { + await_block_anchor = empty(); + info.block.c(); + }, + m(target, anchor) { + insert(target, await_block_anchor, anchor); + info.block.m(target, info.anchor = anchor); + info.mount = () => await_block_anchor.parentNode; + info.anchor = await_block_anchor; + }, + p(new_ctx, dirty) { + ctx = new_ctx; + info.ctx = ctx; + if (dirty & /*items*/ + 2 && promise !== (promise = TextEditor.enrichHTML( + /*item*/ + ctx[4].link || "" + )) && handle_promise(promise, info)) ; + else { + update_await_block_branch(info, ctx, dirty); + } + }, + d(detaching) { + if (detaching) { + detach(await_block_anchor); + } + info.block.d(detaching); + info.token = null; + info = null; + } + }; +} +function create_catch_block(ctx) { + return { c: noop, m: noop, p: noop, d: noop }; +} +function create_then_block_1(ctx) { + let div; + let raw_value = ( + /*Html*/ + ctx[7] + "" + ); + return { + c() { + div = element("div"); + attr(div, "class", "flex2"); + }, + m(target, anchor) { + insert(target, div, anchor); + div.innerHTML = raw_value; + }, + p(ctx2, dirty) { + if (dirty & /*items*/ + 2 && raw_value !== (raw_value = /*Html*/ + ctx2[7] + "")) div.innerHTML = raw_value; + }, + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} +function create_pending_block_1(ctx) { + return { c: noop, m: noop, p: noop, d: noop }; +} +function create_pending_block(ctx) { + return { c: noop, m: noop, p: noop, d: noop }; +} +function create_each_block(ctx) { + let li; + let promise; + let info = { + ctx, + current: null, + token: null, + hasCatch: false, + pending: create_pending_block, + then: create_then_block, + catch: create_catch_block_1, + value: 7 + }; + handle_promise(promise = TextEditor.enrichHTML( + /*item*/ + ctx[4]?.system?.description?.value || "" + ), info); + return { + c() { + li = element("li"); + info.block.c(); + attr(li, "class", "left"); + }, + m(target, anchor) { + insert(target, li, anchor); + info.block.m(li, info.anchor = null); + info.mount = () => li; + info.anchor = null; + }, + p(new_ctx, dirty) { + ctx = new_ctx; + info.ctx = ctx; + if (dirty & /*items*/ + 2 && promise !== (promise = TextEditor.enrichHTML( + /*item*/ + ctx[4]?.system?.description?.value || "" + )) && handle_promise(promise, info)) ; + else { + update_await_block_branch(info, ctx, dirty); + } + }, + d(detaching) { + if (detaching) { + detach(li); + } + info.block.d(); + info.token = null; + info = null; + } + }; +} +function create_fragment(ctx) { + let div; + let ul; + let div_data_type_value; + let each_value = ensure_array_like( + /*items*/ + ctx[1] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + return { + c() { + div = element("div"); + ul = element("ul"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(ul, "class", "icon-list"); + attr(div, "class", "advancement mt-sm"); + attr(div, "data-type", div_data_type_value = /*advancement*/ + ctx[0].type); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, ul); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div, null); + } + } + }, + p(ctx2, [dirty]) { + if (dirty & /*TextEditor, items*/ + 2) { + each_value = ensure_array_like( + /*items*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, null); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + if (dirty & /*advancement*/ + 1 && div_data_type_value !== (div_data_type_value = /*advancement*/ + ctx2[0].type)) { + attr(div, "data-type", div_data_type_value); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_each(each_blocks, detaching); + } + }; +} +async function getItemsFromUUIDs(uuids) { + const itemPromises = uuids.map(async (uuid) => { + const item = await fromUuid(uuid); + return item; + }); + return Promise.all(itemPromises); +} +function instance($$self, $$props, $$invalidate) { + let items; + let { advancement = null } = $$props; + let initialId = null; + async function getItems() { + if (advancement.configuration.items && Array.isArray(advancement.configuration.items)) { + $$invalidate(1, items = await getItemsFromUUIDs(advancement.configuration.items.map((item) => item.uuid))); + } + } + onMount(async () => { + $$invalidate(2, initialId = advancement.id); + }); + $$self.$$set = ($$props2) => { + if ("advancement" in $$props2) $$invalidate(0, advancement = $$props2.advancement); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*advancement, initialId*/ + 5) { + if (advancement.id != initialId) { + getItems(); + $$invalidate(2, initialId = advancement.id); + } + } + }; + $$invalidate(1, items = []); + return [advancement, items, initialId]; +} +class ItemGrant extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { advancement: 0 }); + } +} +export { + ItemGrant as default +}; +//# sourceMappingURL=ItemGrant-D2wJNtMk.js.map diff --git a/dist/ItemGrant-D2wJNtMk.js.map b/dist/ItemGrant-D2wJNtMk.js.map new file mode 100644 index 0000000..c952f94 --- /dev/null +++ b/dist/ItemGrant-D2wJNtMk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ItemGrant-D2wJNtMk.js","sources":["../src/components/molecules/dnd5e/Advancements/ItemGrant.svelte"],"sourcesContent":["\n\n\n\n"],"names":["ctx"],"mappings":";;;;;;;;;;;;;;;;;AAkCgV;AAAA;AAAA,MAAAA,SAAM;AAAA,KAAI,QAAA;;;;;;;;;;;;AAApD,UAAA,CAAA,cAAA,IAAA,KAAA;AAAA,MAAA,QAAM,GAAG,EAAA,MAAA,KAAA,OAAA,aAAA;AAAS,WAAA,KAAA,OAAA;AAAA,MAAA,QAAM,IAAI;;;;;AAAjH,aAAyS,QAAA,MAAA,MAAA;AAA9Q,aAA+F,MAAA,IAAA;AAA7D,aAAuD,MAAA,GAAA;;;;AAA/B,UAAA;AAAA,MAAA,KAAA,CAAA,cAAA,IAAA,KAAA;AAAA,MAAAA,SAAM,GAAG,GAAA;;;AAAS,UAAA;AAAA,MAAA,KAAA,mBAAA;AAAA,MAAAA,SAAM,OAAI;;;;;;;;;;;;;;;;;;;;;;;;AAA4J,MAAA;AAAA;AAAA,IAAA,QAAM,OAAI;AAAA;;;;;;;;;AAA9B,aAAqC,QAAA,KAAA,MAAA;;;;AAAjB,UAAA;AAAA,MAAA,KAAA,aAAA;AAAA,MAAAA,SAAM,OAAI,IAAA,UAAA,GAAA,OAAA;AAAA;;;;;;;;;;;;;;;;;;;;;AAArI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EAAA,cAAc,KAAI,IAAA;AAGzB,MAAA,YAAY;iBAUD,WAAQ;AACjB,QAAA,YAAY,cAAc,SAAS,MAAM,QAAQ,YAAY,cAAc,KAAK,GAAA;AAClF,mBAAA,GAAA,QAAc,MAAA,kBAAkB,YAAY,cAAc,MAAM,IAAI,UAAQ,KAAK,IAAI,CAAA,CAAA;AAAA;;AASzF,UAAO,YAAA;oBACL,YAAY,YAAY,EAAE;AAAA;;;;;;;AANrB,UAAA,YAAY,MAAM,WAAS;AAChC;wBACA,YAAY,YAAY,EAAE;AAAA;;;kBAnBzB,QAAK,CAAA,CAAA;;;;;;;;;"} \ No newline at end of file diff --git a/dist/LevelUp-CEmyazSj.js b/dist/LevelUp-CEmyazSj.js new file mode 100644 index 0000000..6de59ff --- /dev/null +++ b/dist/LevelUp-CEmyazSj.js @@ -0,0 +1,1242 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, a as empty, c as insert, A as noop, j as detach, k as component_subscribe, V as newClassLevel, O as characterClass, W as activeClass, X as isMultiClass, o as onMount, Y as ucfirst, e as element, F as text, R as space, b as attr, K as src_url_equal, d as append, G as set_data, Z as listen, y as set_store_value, z as ensure_array_like, h as transition_in, g as group_outros, f as check_outros, t as transition_out, B as destroy_each, N as characterSubClass, P as level, I as getPacksFromSettings, J as extractItemsFromPacksSync, n as getContext, q as tick, l as localize, C as binding_callbacks, D as bind, u as create_component, v as mount_component, E as add_flush_callback, w as destroy_component, _ as __variableDynamicImportRuntimeHelper, x as log, $ as extractMapIteratorObjectProperties, a0 as is_function } from "./index-DP0Ud7KH.js"; +import { I as IconSelect } from "./IconSelect-BJAJvIXl.js"; +import LevelUpExistingClassLeftCol from "./LevelUpExistingClassLeftCol-Dij9sL0P.js"; +const globals = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : ( + // @ts-ignore Node typings have this + global +); +function create_if_block$1(ctx) { + let div6; + let div0; + let img; + let img_src_value; + let div5; + let div1; + let t0_value = ucfirst( + /*classKey*/ + ctx[2] + ) + ""; + let t0; + let t1; + let div3; + let div2; + let t2; + let t3; + let div4; + let if_block0_anchor; + let if_block0 = !/*$activeClass*/ + ctx[3] && create_if_block_2$1(); + let if_block1 = ( + /*$activeClass*/ + ctx[3] && !/*$isMultiClass*/ + ctx[4] && create_if_block_1$1(ctx) + ); + return { + c() { + div6 = element("div"); + div0 = element("div"); + img = element("img"); + div5 = element("div"); + div1 = element("div"); + t0 = text(t0_value); + t1 = space(); + div3 = element("div"); + div2 = element("div"); + t2 = text( + /*level*/ + ctx[1] + ); + t3 = space(); + div4 = element("div"); + if (if_block0) if_block0.c(); + if_block0_anchor = empty(); + if (if_block1) if_block1.c(); + attr(img, "height", "40"); + attr(img, "width", "40"); + if (!src_url_equal(img.src, img_src_value = /*src*/ + ctx[0])) attr(img, "src", img_src_value); + attr(div0, "class", "flex0 icon svelte-gas-1gqtihq"); + attr(div1, "class", "flex3 left pa-xs"); + attr(div2, "class", "lozenge pa-xs svelte-gas-1gqtihq"); + attr(div3, "class", "flex0 right mr-sm"); + attr(div4, "class", "flex0 right pr-md py-xs"); + attr(div5, "class", "flex3 flexrow"); + attr(div6, "class", "flexrow class-row svelte-gas-1gqtihq"); + }, + m(target, anchor) { + insert(target, div6, anchor); + append(div6, div0); + append(div0, img); + append(div6, div5); + append(div5, div1); + append(div1, t0); + append(div1, t1); + append(div5, div3); + append(div3, div2); + append(div2, t2); + append(div2, t3); + append(div5, div4); + if (if_block0) if_block0.m(div4, null); + append(div4, if_block0_anchor); + if (if_block1) if_block1.m(div4, null); + }, + p(ctx2, dirty) { + if (dirty & /*src*/ + 1 && !src_url_equal(img.src, img_src_value = /*src*/ + ctx2[0])) { + attr(img, "src", img_src_value); + } + if (dirty & /*classKey*/ + 4 && t0_value !== (t0_value = ucfirst( + /*classKey*/ + ctx2[2] + ) + "")) set_data(t0, t0_value); + if (dirty & /*level*/ + 2) set_data( + t2, + /*level*/ + ctx2[1] + ); + if (!/*$activeClass*/ + ctx2[3]) { + if (if_block0) ; + else { + if_block0 = create_if_block_2$1(); + if_block0.c(); + if_block0.m(div4, if_block0_anchor); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if ( + /*$activeClass*/ + ctx2[3] && !/*$isMultiClass*/ + ctx2[4] + ) { + if (if_block1) { + if_block1.p(ctx2, dirty); + } else { + if_block1 = create_if_block_1$1(ctx2); + if_block1.c(); + if_block1.m(div4, null); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + }, + d(detaching) { + if (detaching) { + detach(div6); + } + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + } + }; +} +function create_if_block_2$1(ctx) { + let i; + return { + c() { + i = element("i"); + attr(i, "class", "fas fa-plus"); + }, + m(target, anchor) { + insert(target, i, anchor); + }, + d(detaching) { + if (detaching) { + detach(i); + } + } + }; +} +function create_if_block_1$1(ctx) { + let i; + let mounted; + let dispose; + return { + c() { + i = element("i"); + attr(i, "class", "fas fa-times"); + }, + m(target, anchor) { + insert(target, i, anchor); + if (!mounted) { + dispose = listen( + i, + "click", + /*cancelLevelUp*/ + ctx[5] + ); + mounted = true; + } + }, + p: noop, + d(detaching) { + if (detaching) { + detach(i); + } + mounted = false; + dispose(); + } + }; +} +function create_fragment$1(ctx) { + let if_block_anchor; + let if_block = ( + /*src*/ + ctx[0] && /*level*/ + ctx[1] && /*classKey*/ + ctx[2] && create_if_block$1(ctx) + ); + return { + c() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p(ctx2, [dirty]) { + if ( + /*src*/ + ctx2[0] && /*level*/ + ctx2[1] && /*classKey*/ + ctx2[2] + ) { + if (if_block) { + if_block.p(ctx2, dirty); + } else { + if_block = create_if_block$1(ctx2); + if_block.c(); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if (if_block) if_block.d(detaching); + } + }; +} +function instance$1($$self, $$props, $$invalidate) { + let $newClassLevel; + let $characterClass; + let $activeClass; + let $isMultiClass; + component_subscribe($$self, newClassLevel, ($$value) => $$invalidate(6, $newClassLevel = $$value)); + component_subscribe($$self, characterClass, ($$value) => $$invalidate(7, $characterClass = $$value)); + component_subscribe($$self, activeClass, ($$value) => $$invalidate(3, $activeClass = $$value)); + component_subscribe($$self, isMultiClass, ($$value) => $$invalidate(4, $isMultiClass = $$value)); + let { src = false } = $$props; + let { level: level2 = false } = $$props; + let { classKey = false } = $$props; + const cancelLevelUp = () => { + set_store_value(activeClass, $activeClass = false, $activeClass); + set_store_value(characterClass, $characterClass = false, $characterClass); + set_store_value(newClassLevel, $newClassLevel = false, $newClassLevel); + }; + onMount(() => { + }); + $$self.$$set = ($$props2) => { + if ("src" in $$props2) $$invalidate(0, src = $$props2.src); + if ("level" in $$props2) $$invalidate(1, level2 = $$props2.level); + if ("classKey" in $$props2) $$invalidate(2, classKey = $$props2.classKey); + }; + return [src, level2, classKey, $activeClass, $isMultiClass, cancelLevelUp]; +} +class LevelUpButtonInnards extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$1, create_fragment$1, safe_not_equal, { src: 0, level: 1, classKey: 2 }); + } +} +const { Boolean: Boolean_1 } = globals; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[48] = list[i]; + child_ctx[50] = i; + return child_ctx; +} +function create_else_block(ctx) { + let div; + let levelupbuttoninnards; + let div_class_value; + let div_aria_label_value; + let div_data_tooltip_value; + let current; + let mounted; + let dispose; + levelupbuttoninnards = new LevelUpButtonInnards({ + props: { + src: ( + /*getCharacterClass*/ + ctx[16]( + /*classKey*/ + ctx[48] + )?.img + ), + level: ( + /*classLevels*/ + ctx[2][ + /*index*/ + ctx[50] + ] + ), + classKey: ( + /*classKey*/ + ctx[48] + ) + } + }); + return { + c() { + div = element("div"); + create_component(levelupbuttoninnards.$$.fragment); + attr(div, "class", div_class_value = "class-row " + /*existingClassesCssClassForRow*/ + ctx[15]( + /*classKey*/ + ctx[48] + ) + " svelte-gas-xasakp"); + attr(div, "role", "button"); + attr(div, "aria-role", "button"); + attr(div, "aria-label", div_aria_label_value = localize("GAS.LevelUp.Button") + " " + /*classKey*/ + ctx[48]); + attr(div, "data-tooltip", div_data_tooltip_value = localize("GAS.LevelUp.Button") + " " + /*classKey*/ + ctx[48]); + }, + m(target, anchor) { + insert(target, div, anchor); + mount_component(levelupbuttoninnards, div, null); + current = true; + if (!mounted) { + dispose = listen(div, "mousedown", function() { + if (is_function( + /*clickAddLevel*/ + ctx[20]( + /*classKey*/ + ctx[48] + ) + )) ctx[20]( + /*classKey*/ + ctx[48] + ).apply(this, arguments); + }); + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + const levelupbuttoninnards_changes = {}; + if (dirty[0] & /*classKeys*/ + 2) levelupbuttoninnards_changes.src = /*getCharacterClass*/ + ctx[16]( + /*classKey*/ + ctx[48] + )?.img; + if (dirty[0] & /*classLevels*/ + 4) levelupbuttoninnards_changes.level = /*classLevels*/ + ctx[2][ + /*index*/ + ctx[50] + ]; + if (dirty[0] & /*classKeys*/ + 2) levelupbuttoninnards_changes.classKey = /*classKey*/ + ctx[48]; + levelupbuttoninnards.$set(levelupbuttoninnards_changes); + if (!current || dirty[0] & /*classKeys*/ + 2 && div_class_value !== (div_class_value = "class-row " + /*existingClassesCssClassForRow*/ + ctx[15]( + /*classKey*/ + ctx[48] + ) + " svelte-gas-xasakp")) { + attr(div, "class", div_class_value); + } + if (!current || dirty[0] & /*classKeys*/ + 2 && div_aria_label_value !== (div_aria_label_value = localize("GAS.LevelUp.Button") + " " + /*classKey*/ + ctx[48])) { + attr(div, "aria-label", div_aria_label_value); + } + if (!current || dirty[0] & /*classKeys*/ + 2 && div_data_tooltip_value !== (div_data_tooltip_value = localize("GAS.LevelUp.Button") + " " + /*classKey*/ + ctx[48])) { + attr(div, "data-tooltip", div_data_tooltip_value); + } + }, + i(local) { + if (current) return; + transition_in(levelupbuttoninnards.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(levelupbuttoninnards.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_component(levelupbuttoninnards); + mounted = false; + dispose(); + } + }; +} +function create_if_block_4(ctx) { + let div; + let levelupbuttoninnards; + let div_class_value; + let current; + levelupbuttoninnards = new LevelUpButtonInnards({ + props: { + src: ( + /*getCharacterClass*/ + ctx[16]( + /*classKey*/ + ctx[48] + )?.img + ), + level: ( + /*classLevels*/ + ctx[2][ + /*index*/ + ctx[50] + ] + ), + classKey: ( + /*classKey*/ + ctx[48] + ) + } + }); + return { + c() { + div = element("div"); + create_component(levelupbuttoninnards.$$.fragment); + attr(div, "class", div_class_value = "class-row " + /*existingClassesCssClassForRow*/ + ctx[15]( + /*classKey*/ + ctx[48] + ) + " svelte-gas-xasakp"); + }, + m(target, anchor) { + insert(target, div, anchor); + mount_component(levelupbuttoninnards, div, null); + current = true; + }, + p(ctx2, dirty) { + const levelupbuttoninnards_changes = {}; + if (dirty[0] & /*classKeys*/ + 2) levelupbuttoninnards_changes.src = /*getCharacterClass*/ + ctx2[16]( + /*classKey*/ + ctx2[48] + )?.img; + if (dirty[0] & /*classLevels*/ + 4) levelupbuttoninnards_changes.level = /*classLevels*/ + ctx2[2][ + /*index*/ + ctx2[50] + ]; + if (dirty[0] & /*classKeys*/ + 2) levelupbuttoninnards_changes.classKey = /*classKey*/ + ctx2[48]; + levelupbuttoninnards.$set(levelupbuttoninnards_changes); + if (!current || dirty[0] & /*classKeys*/ + 2 && div_class_value !== (div_class_value = "class-row " + /*existingClassesCssClassForRow*/ + ctx2[15]( + /*classKey*/ + ctx2[48] + ) + " svelte-gas-xasakp")) { + attr(div, "class", div_class_value); + } + }, + i(local) { + if (current) return; + transition_in(levelupbuttoninnards.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(levelupbuttoninnards.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_component(levelupbuttoninnards); + } + }; +} +function create_each_block(ctx) { + let current_block_type_index; + let if_block; + let if_block_anchor; + let current; + const if_block_creators = [create_if_block_4, create_else_block]; + const if_blocks = []; + function select_block_type(ctx2, dirty) { + if ( + /*$activeClass*/ + ctx2[4] && !/*$newClassLevel*/ + ctx2[11] + ) return 0; + return 1; + } + current_block_type_index = select_block_type(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + return { + c() { + if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if_blocks[current_block_type_index].m(target, anchor); + insert(target, if_block_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx2); + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } else { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + if_block = if_blocks[current_block_type_index]; + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block.c(); + } else { + if_block.p(ctx2, dirty); + } + transition_in(if_block, 1); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if_blocks[current_block_type_index].d(detaching); + } + }; +} +function create_if_block_2(ctx) { + let h1; + let div; + let iconselect; + let updating_value; + let current; + let if_block = ( + /*classProp*/ + ctx[10] && create_if_block_3(ctx) + ); + function iconselect_value_binding(value) { + ctx[29](value); + } + let iconselect_props = { + class: "icon-select", + options: ( + /*filteredClassIndex*/ + ctx[6] + ), + placeHolder: ( + /*classesPlaceholder*/ + ctx[12] + ), + handler: ( + /*selectClassHandler*/ + ctx[18] + ), + id: "characterClass-select" + }; + if ( + /*classValue*/ + ctx[5] !== void 0 + ) { + iconselect_props.value = /*classValue*/ + ctx[5]; + } + iconselect = new IconSelect({ props: iconselect_props }); + binding_callbacks.push(() => bind(iconselect, "value", iconselect_value_binding)); + return { + c() { + h1 = element("h1"); + div = element("div"); + div.textContent = "Add Multiclass"; + if (if_block) if_block.c(); + create_component(iconselect.$$.fragment); + attr(div, "class", "flex2 left"); + attr(h1, "class", "flexrow mt-md svelte-gas-xasakp"); + }, + m(target, anchor) { + insert(target, h1, anchor); + append(h1, div); + if (if_block) if_block.m(h1, null); + mount_component(iconselect, target, anchor); + current = true; + }, + p(ctx2, dirty) { + if ( + /*classProp*/ + ctx2[10] + ) { + if (if_block) { + if_block.p(ctx2, dirty); + } else { + if_block = create_if_block_3(ctx2); + if_block.c(); + if_block.m(h1, null); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + const iconselect_changes = {}; + if (dirty[0] & /*filteredClassIndex*/ + 64) iconselect_changes.options = /*filteredClassIndex*/ + ctx2[6]; + if (!updating_value && dirty[0] & /*classValue*/ + 32) { + updating_value = true; + iconselect_changes.value = /*classValue*/ + ctx2[5]; + add_flush_callback(() => updating_value = false); + } + iconselect.$set(iconselect_changes); + }, + i(local) { + if (current) return; + transition_in(iconselect.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(iconselect.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(h1); + } + if (if_block) if_block.d(); + destroy_component(iconselect, detaching); + } + }; +} +function create_if_block_3(ctx) { + let div; + let button; + let mounted; + let dispose; + return { + c() { + div = element("div"); + button = element("button"); + button.innerHTML = ``; + attr(button, "class", "pr-none mt-sm gold-button svelte-gas-xasakp"); + attr(button, "type", "button"); + attr(button, "role", "button"); + attr(div, "class", "flex0"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, button); + if (!mounted) { + dispose = listen( + button, + "mousedown", + /*clickCancelMulticlass*/ + ctx[19] + ); + mounted = true; + } + }, + p: noop, + d(detaching) { + if (detaching) { + detach(div); + } + mounted = false; + dispose(); + } + }; +} +function create_if_block(ctx) { + let if_block_anchor; + let current; + let if_block = ( + /*activeClassObj*/ + ctx[7] && create_if_block_1(ctx) + ); + return { + c() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if ( + /*activeClassObj*/ + ctx2[7] + ) { + if (if_block) { + if_block.p(ctx2, dirty); + if (dirty[0] & /*activeClassObj*/ + 128) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block_1(ctx2); + if_block.c(); + transition_in(if_block, 1); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + group_outros(); + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + check_outros(); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if (if_block) if_block.d(detaching); + } + }; +} +function create_if_block_1(ctx) { + let h3; + let t0_value = ( + /*activeClassObj*/ + ctx[7].name + "" + ); + let t0; + let t1; + let t2_value = ( + /*levelOptions*/ + ctx[13][1].label + "" + ); + let t2; + let levelupexisting; + let current; + levelupexisting = new LevelUpExistingClassLeftCol({ + props: { + classAdvancementArrayFiltered: ( + /*classAdvancementArrayFiltered*/ + ctx[8] + ), + level: ( + /*getLevel*/ + ctx[17]( + /*activeClassKey*/ + ctx[0] + ) + ) + } + }); + return { + c() { + h3 = element("h3"); + t0 = text(t0_value); + t1 = space(); + t2 = text(t2_value); + create_component(levelupexisting.$$.fragment); + }, + m(target, anchor) { + insert(target, h3, anchor); + append(h3, t0); + append(h3, t1); + append(h3, t2); + mount_component(levelupexisting, target, anchor); + current = true; + }, + p(ctx2, dirty) { + if ((!current || dirty[0] & /*activeClassObj*/ + 128) && t0_value !== (t0_value = /*activeClassObj*/ + ctx2[7].name + "")) set_data(t0, t0_value); + const levelupexisting_changes = {}; + if (dirty[0] & /*classAdvancementArrayFiltered*/ + 256) levelupexisting_changes.classAdvancementArrayFiltered = /*classAdvancementArrayFiltered*/ + ctx2[8]; + if (dirty[0] & /*activeClassKey*/ + 1) levelupexisting_changes.level = /*getLevel*/ + ctx2[17]( + /*activeClassKey*/ + ctx2[0] + ); + levelupexisting.$set(levelupexisting_changes); + }, + i(local) { + if (current) return; + transition_in(levelupexisting.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(levelupexisting.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(h3); + } + destroy_component(levelupexisting, detaching); + } + }; +} +function create_fragment(ctx) { + let div4; + let div3; + let div0; + let h1; + let each_1_anchor; + let if_block0_anchor; + let div1; + let div2; + let current; + let each_value = ensure_array_like( + /*classKeys*/ + ctx[1] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + const out = (i) => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + let if_block0 = !/*$newClassLevel*/ + ctx[11] && create_if_block_2(ctx); + let if_block1 = ( + /*$characterClass*/ + ctx[3] && create_if_block(ctx) + ); + return { + c() { + div4 = element("div"); + div3 = element("div"); + div0 = element("div"); + h1 = element("h1"); + h1.textContent = "Existing Classes"; + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + each_1_anchor = empty(); + if (if_block0) if_block0.c(); + if_block0_anchor = empty(); + if (if_block1) if_block1.c(); + div1 = element("div"); + div1.innerHTML = ``; + div2 = element("div"); + attr(h1, "class", "flex"); + attr(div0, "class", "flex2 pr-sm col-a"); + attr(div1, "class", "flex0 border-right right-border-gradient-mask"); + attr(div2, "class", "flex3 left pl-md scroll col-b"); + attr(div3, "class", "flexrow svelte-gas-xasakp"); + attr(div4, "class", "content svelte-gas-xasakp"); + }, + m(target, anchor) { + insert(target, div4, anchor); + append(div4, div3); + append(div3, div0); + append(div0, h1); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div0, null); + } + } + append(div0, each_1_anchor); + if (if_block0) if_block0.m(div0, null); + append(div0, if_block0_anchor); + if (if_block1) if_block1.m(div0, null); + append(div3, div1); + append(div3, div2); + div2.innerHTML = /*combinedHtml*/ + ctx[9]; + current = true; + }, + p(ctx2, dirty) { + if (dirty[0] & /*existingClassesCssClassForRow, classKeys, getCharacterClass, classLevels, $activeClass, $newClassLevel, clickAddLevel*/ + 1148950) { + each_value = ensure_array_like( + /*classKeys*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(div0, each_1_anchor); + } + } + group_outros(); + for (i = each_value.length; i < each_blocks.length; i += 1) { + out(i); + } + check_outros(); + } + if (!/*$newClassLevel*/ + ctx2[11]) { + if (if_block0) { + if_block0.p(ctx2, dirty); + if (dirty[0] & /*$newClassLevel*/ + 2048) { + transition_in(if_block0, 1); + } + } else { + if_block0 = create_if_block_2(ctx2); + if_block0.c(); + transition_in(if_block0, 1); + if_block0.m(div0, if_block0_anchor); + } + } else if (if_block0) { + group_outros(); + transition_out(if_block0, 1, 1, () => { + if_block0 = null; + }); + check_outros(); + } + if ( + /*$characterClass*/ + ctx2[3] + ) { + if (if_block1) { + if_block1.p(ctx2, dirty); + if (dirty[0] & /*$characterClass*/ + 8) { + transition_in(if_block1, 1); + } + } else { + if_block1 = create_if_block(ctx2); + if_block1.c(); + transition_in(if_block1, 1); + if_block1.m(div0, null); + } + } else if (if_block1) { + group_outros(); + transition_out(if_block1, 1, 1, () => { + if_block1 = null; + }); + check_outros(); + } + if (!current || dirty[0] & /*combinedHtml*/ + 512) div2.innerHTML = /*combinedHtml*/ + ctx2[9]; + }, + i(local) { + if (current) return; + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + transition_in(if_block0); + transition_in(if_block1); + current = true; + }, + o(local) { + each_blocks = each_blocks.filter(Boolean_1); + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + transition_out(if_block0); + transition_out(if_block1); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div4); + } + destroy_each(each_blocks, detaching); + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let html; + let classProp; + let combinedHtml; + let classAdvancementComponents; + let subClassAdvancementComponents; + let subClassAdvancementArrayFiltered; + let classAdvancementArrayFiltered; + let classKeys; + let classLevels; + let activeClassObj; + let activeClassIndex; + let filteredClassIndex; + let $characterSubClass; + let $characterClass; + let $actor; + let $activeClass; + let $level; + let $newClassLevel; + let $isMultiClass; + component_subscribe($$self, characterSubClass, ($$value) => $$invalidate(26, $characterSubClass = $$value)); + component_subscribe($$self, characterClass, ($$value) => $$invalidate(3, $characterClass = $$value)); + component_subscribe($$self, activeClass, ($$value) => $$invalidate(4, $activeClass = $$value)); + component_subscribe($$self, level, ($$value) => $$invalidate(28, $level = $$value)); + component_subscribe($$self, newClassLevel, ($$value) => $$invalidate(11, $newClassLevel = $$value)); + component_subscribe($$self, isMultiClass, ($$value) => $$invalidate(38, $isMultiClass = $$value)); + let richHTML = "", richSubClassHTML = "", activeClassKey = null, activeSubClass = null, classValue = null, subClassesIndex, classesPlaceholder = "Classes", packs = getPacksFromSettings("classes"); + game.packs.get("dnd5e.subclasses"); + let subClassesPacks = getPacksFromSettings("subclasses"), mappedClassIndex = extractItemsFromPacksSync(packs, ["name->label", "img", "type", "folder", "uuid->value", "_id"]); + const levelOptions = []; + for (let i = 1; i <= 20; i++) { + levelOptions.push({ label: "Level " + i, value: i }); + } + const actor = getContext("#doc"); + component_subscribe($$self, actor, (value) => $$invalidate(27, $actor = value)); + const importClassAdvancements = async () => { + for (const classAdvancement of classAdvancementArrayFiltered) { + try { + const module = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../../molecules/dnd5e/Advancements/AbilityScoreImprovement.svelte": () => import("./AbilityScoreImprovement-BmB9DNEX.js"), "../../../molecules/dnd5e/Advancements/Feat.svelte": () => import("./Feat-BpFE8O58.js"), "../../../molecules/dnd5e/Advancements/ItemChoice.svelte": () => import("./ItemChoice-CRxi93V_.js"), "../../../molecules/dnd5e/Advancements/ItemGrant.svelte": () => import("./ItemGrant-D2wJNtMk.js"), "../../../molecules/dnd5e/Advancements/ScaleValue.svelte": () => import("./ScaleValue-DYrODTcx.js"), "../../../molecules/dnd5e/Advancements/Size.svelte": () => import("./Size-DhLm1NsB.js"), "../../../molecules/dnd5e/Advancements/Trait.svelte": () => import("./Trait-DtI9SYqp.js") }), `../../../molecules/dnd5e/Advancements/${classAdvancement.type}.svelte`, 7); + classAdvancementComponents[classAdvancement.type] = module.default; + } catch (error) { + log.e(`Failed to load component for ${classAdvancement.type}:`, error); + } + } + }; + const importSubClassAdvancements = async () => { + for (const subClassAdvancement of subClassAdvancementArrayFiltered) { + try { + const module = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../../molecules/dnd5e/Advancements/AbilityScoreImprovement.svelte": () => import("./AbilityScoreImprovement-BmB9DNEX.js"), "../../../molecules/dnd5e/Advancements/Feat.svelte": () => import("./Feat-BpFE8O58.js"), "../../../molecules/dnd5e/Advancements/ItemChoice.svelte": () => import("./ItemChoice-CRxi93V_.js"), "../../../molecules/dnd5e/Advancements/ItemGrant.svelte": () => import("./ItemGrant-D2wJNtMk.js"), "../../../molecules/dnd5e/Advancements/ScaleValue.svelte": () => import("./ScaleValue-DYrODTcx.js"), "../../../molecules/dnd5e/Advancements/Size.svelte": () => import("./Size-DhLm1NsB.js"), "../../../molecules/dnd5e/Advancements/Trait.svelte": () => import("./Trait-DtI9SYqp.js") }), `../../../molecules/dnd5e/Advancements/${subClassAdvancement.type}.svelte`, 7); + await tick(); + subClassAdvancementComponents[subClassAdvancement.type] = module.default; + } catch (error) { + log.e(`Failed to load component for ${subClassAdvancement.type}:`, error); + } + } + }; + function existingClassesCssClassForRow(classKey) { + let css = getCharacterClass(classKey).uuid === $activeClass ? "active" : ""; + if ($isMultiClass) { + css += " gold-button-disabled"; + } else { + css += " gold-button"; + } + return css; + } + const getFilteredSubclassIndex = async () => { + const filteredSubClassIndex = []; + for (let subClassesPack of subClassesPacks) { + let index = await subClassesPack.getIndex({ fields: ["system.classIdentifier"] }); + if (!subClassesPack) continue; + let mappedSubClassIndex = extractMapIteratorObjectProperties(index.entries(), ["name->label", "img", "type", "folder", "uuid->value", "system", "_id"]); + filteredSubClassIndex.push(mappedSubClassIndex?.filter((x) => x.system.classIdentifier == $characterClass.system.identifier)); + } + const output = filteredSubClassIndex.flat().sort((a, b) => a.label.localeCompare(b.label)); + return output; + }; + const getCharacterClass = (classKey) => { + return $actor._classes[classKey]; + }; + function getLevel(classKey) { + const level2 = $newClassLevel ? $newClassLevel : getCharacterClass(classKey)?.system?.levels; + return level2; + } + const selectClassHandler = async (option) => { + $$invalidate(23, activeSubClass = null); + set_store_value(characterSubClass, $characterSubClass = null, $characterSubClass); + subClassAdvancementArrayFiltered = []; + $$invalidate(22, richSubClassHTML = ""); + set_store_value(characterClass, $characterClass = await fromUuid(option), $characterClass); + set_store_value(activeClass, $activeClass = option, $activeClass); + await tick(); + $$invalidate(24, subClassesIndex = await getFilteredSubclassIndex()); + await tick(); + importClassAdvancements(); + $$invalidate(21, richHTML = await TextEditor.enrichHTML(html)); + }; + const clickCancelMulticlass = async () => { + set_store_value(activeClass, $activeClass = false, $activeClass); + $$invalidate(5, classValue = null); + $$invalidate(23, activeSubClass = null); + $$invalidate(0, activeClassKey = null); + set_store_value(characterClass, $characterClass = false, $characterClass); + }; + async function clickAddLevel(classKey) { + if ($isMultiClass) return; + const isUnset = Boolean($activeClass) && Boolean($newClassLevel); + if (isUnset) return; + const uuid = getCharacterClass(classKey).uuid; + $$invalidate(23, activeSubClass = null); + set_store_value(characterSubClass, $characterSubClass = null, $characterSubClass); + subClassAdvancementArrayFiltered = []; + $$invalidate(22, richSubClassHTML = ""); + set_store_value(characterClass, $characterClass = await fromUuid(uuid), $characterClass); + set_store_value(activeClass, $activeClass = uuid, $activeClass); + $$invalidate(0, activeClassKey = classKey); + newClassLevel.set($actor._classes[classKey]?.system?.levels + 1); + await tick(); + $$invalidate(24, subClassesIndex = await getFilteredSubclassIndex()); + await tick(); + importClassAdvancements(); + $$invalidate(21, richHTML = await TextEditor.enrichHTML(html)); + } + onMount(async () => { + if ($characterClass) { + $$invalidate(5, classValue = $characterClass.uuid); + await tick(); + importClassAdvancements(); + $$invalidate(21, richHTML = await TextEditor.enrichHTML(html)); + $$invalidate(24, subClassesIndex = await getFilteredSubclassIndex()); + } + if ($characterSubClass) { + $characterSubClass.uuid; + await tick(); + importSubClassAdvancements(); + $$invalidate(22, richSubClassHTML = await TextEditor.enrichHTML($characterSubClass.system.description.value)); + } + }); + function iconselect_value_binding(value) { + classValue = value; + $$invalidate(5, classValue); + } + $$self.$$.update = () => { + if ($$self.$$.dirty[0] & /*$characterClass*/ + 8) { + html = $characterClass?.system?.description.value || ""; + } + if ($$self.$$.dirty[0] & /*activeSubClass*/ + 8388608) ; + if ($$self.$$.dirty[0] & /*$activeClass*/ + 16) { + $$invalidate(10, classProp = $activeClass); + } + if ($$self.$$.dirty[0] & /*richHTML, richSubClassHTML*/ + 6291456) { + $$invalidate(9, combinedHtml = richHTML + (richSubClassHTML ? `

${localize("GAS.SubClass")}

` + richSubClassHTML : "")); + } + if ($$self.$$.dirty[0] & /*subClassesIndex*/ + 16777216) { + if (subClassesIndex?.length) { + subClassesIndex.flat().sort((a, b) => a.label.localeCompare(b.label)); + } + } + if ($$self.$$.dirty[0] & /*$characterSubClass, $level*/ + 335544320) { + subClassAdvancementArrayFiltered = $characterSubClass?.advancement?.byId ? Object.entries($characterSubClass.advancement.byId).filter(([id, value]) => value.level === $level).map(([id, value]) => ({ ...value, id })) : []; + } + if ($$self.$$.dirty[0] & /*$characterClass, $level*/ + 268435464) { + $$invalidate(8, classAdvancementArrayFiltered = $characterClass?.advancement?.byId ? Object.entries($characterClass.advancement.byId).filter(([id, value]) => value.level === $level).map(([id, value]) => ({ ...value, id })) : []); + } + if ($$self.$$.dirty[0] & /*$actor*/ + 134217728) { + $$invalidate(1, classKeys = Object.keys($actor._classes)); + } + if ($$self.$$.dirty[0] & /*classKeys, $actor, $activeClass*/ + 134217746) { + $$invalidate(2, classLevels = classKeys.map((classKey) => { + const classObj = $actor._classes[classKey]; + return classObj.uuid == $activeClass ? classObj.system.levels + 1 : classObj.system.levels; + })); + } + if ($$self.$$.dirty[0] & /*$actor, activeClassKey*/ + 134217729) { + $$invalidate(7, activeClassObj = $actor._classes[activeClassKey]); + } + if ($$self.$$.dirty[0] & /*classKeys, activeClassKey*/ + 3) { + $$invalidate(25, activeClassIndex = classKeys.indexOf(activeClassKey)); + } + if ($$self.$$.dirty[0] & /*classLevels, activeClassIndex*/ + 33554436) { + classLevels[activeClassIndex]; + } + if ($$self.$$.dirty[0] & /*classKeys*/ + 2) { + $$invalidate(6, filteredClassIndex = mappedClassIndex.filter((i) => { + return i.type == "class"; + }).sort((a, b) => a.label.localeCompare(b.label))); + } + }; + classAdvancementComponents = {}; + subClassAdvancementComponents = {}; + return [ + activeClassKey, + classKeys, + classLevels, + $characterClass, + $activeClass, + classValue, + filteredClassIndex, + activeClassObj, + classAdvancementArrayFiltered, + combinedHtml, + classProp, + $newClassLevel, + classesPlaceholder, + levelOptions, + actor, + existingClassesCssClassForRow, + getCharacterClass, + getLevel, + selectClassHandler, + clickCancelMulticlass, + clickAddLevel, + richHTML, + richSubClassHTML, + activeSubClass, + subClassesIndex, + activeClassIndex, + $characterSubClass, + $actor, + $level, + iconselect_value_binding + ]; +} +class LevelUp extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, {}, null, [-1, -1]); + } +} +export { + LevelUp as default +}; +//# sourceMappingURL=LevelUp-CEmyazSj.js.map diff --git a/dist/LevelUp-CEmyazSj.js.map b/dist/LevelUp-CEmyazSj.js.map new file mode 100644 index 0000000..ed16ab5 --- /dev/null +++ b/dist/LevelUp-CEmyazSj.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LevelUp-CEmyazSj.js","sources":["../node_modules/svelte/src/runtime/internal/globals.js","../src/components/atoms/button/LevelUpButtonInnards.svelte","../src/components/organisms/dnd5e/Tabs/LevelUp.svelte"],"sourcesContent":["/** @type {typeof globalThis} */\nexport const globals =\n\ttypeof window !== 'undefined'\n\t\t? window\n\t\t: typeof globalThis !== 'undefined'\n\t\t? globalThis\n\t\t: // @ts-ignore Node typings have this\n\t\t global;\n","\n\n\n\n\n","\n\n\n\n\n"],"names":["create_if_block_2","create_if_block_1","ctx","create_if_block","level"],"mappings":";;;AACO,MAAM,UACZ,OAAO,WAAW,cACf,SACA,OAAO,eAAe,cACtB;AAAA;AAAA,EAEA;AAAA;;;;;;;;ACayL,MAAA,WAAA;AAAA;AAAA,IAAQ,IAAQ,CAAA;AAAA,EAAA,IAAA;;;;;;;;;;EAAkI,IAAY,CAAA,KAAAA,oBAAA;AAAsC,MAAA;AAAA;AAAA,IAAA;IAAiB,IAAa,CAAA,KAAAC,oBAAA,GAAA;AAAA;;;;;;;;;;;;;;QAA9I,IAAK,CAAA;AAAA,MAAA;;;;;;;;;MAA/J,IAAG,CAAA,CAAA,EAAA,MAAA,KAAA,OAAA,aAAA;;;;;;;;;;AAA5F,aAAgd,QAAA,MAAA,MAAA;AAAjb,aAAsE,MAAA,IAAA;AAA9C,aAAwC,MAAA,GAAA;AAAM,aAAqW,MAAA,IAAA;AAA1U,aAAwD,MAAA,IAAA;;;AAAA,aAA8E,MAAA,IAAA;AAA/C,aAAyC,MAAA,IAAA;;;AAAM,aAA8L,MAAA,IAAA;;;;;;;;MAA3WC,KAAG,CAAA,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AAA,KAAM,CAAA,GAAG,MAAM,EAAE,MAAM,cAAc,EAAE,KAAK,CAAA,CAAA;AAAA;;AArC9C,+BAA0B,CAAA;AAC1B,kCAA6B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/LevelUpExistingClassLeftCol-Dij9sL0P.js b/dist/LevelUpExistingClassLeftCol-Dij9sL0P.js new file mode 100644 index 0000000..dac6ffd --- /dev/null +++ b/dist/LevelUpExistingClassLeftCol-Dij9sL0P.js @@ -0,0 +1,418 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, e as element, b as attr, c as insert, h as transition_in, g as group_outros, t as transition_out, f as check_outros, j as detach, o as onMount, q as tick, _ as __variableDynamicImportRuntimeHelper, z as ensure_array_like, a as empty, B as destroy_each, l as localize, A as noop, r as construct_svelte_component, F as text, u as create_component, K as src_url_equal, L as getAdvancementValue, d as append, v as mount_component, G as set_data, w as destroy_component } from "./index-DP0Ud7KH.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[4] = list[i]; + return child_ctx; +} +function create_if_block(ctx) { + let ul; + let current_block_type_index; + let if_block; + let current; + const if_block_creators = [create_if_block_1, create_else_block]; + const if_blocks = []; + function select_block_type(ctx2, dirty) { + if (!/*classAdvancementArrayFiltered*/ + ctx2[0].length) return 0; + return 1; + } + current_block_type_index = select_block_type(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + return { + c() { + ul = element("ul"); + if_block.c(); + attr(ul, "class", "icon-list"); + }, + m(target, anchor) { + insert(target, ul, anchor); + if_blocks[current_block_type_index].m(ul, null); + current = true; + }, + p(ctx2, dirty) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx2); + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } else { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + if_block = if_blocks[current_block_type_index]; + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block.c(); + } else { + if_block.p(ctx2, dirty); + } + transition_in(if_block, 1); + if_block.m(ul, null); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(ul); + } + if_blocks[current_block_type_index].d(); + } + }; +} +function create_else_block(ctx) { + let each_1_anchor; + let current; + let each_value = ensure_array_like( + /*classAdvancementArrayFiltered*/ + ctx[0] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + const out = (i) => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + return { + c() { + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + each_1_anchor = empty(); + }, + m(target, anchor) { + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(target, anchor); + } + } + insert(target, each_1_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if (dirty & /*classAdvancementArrayFiltered, classAdvancementComponents*/ + 3) { + each_value = ensure_array_like( + /*classAdvancementArrayFiltered*/ + ctx2[0] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); + } + } + group_outros(); + for (i = each_value.length; i < each_blocks.length; i += 1) { + out(i); + } + check_outros(); + } + }, + i(local) { + if (current) return; + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + current = true; + }, + o(local) { + each_blocks = each_blocks.filter(Boolean); + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + current = false; + }, + d(detaching) { + if (detaching) { + detach(each_1_anchor); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_if_block_1(ctx) { + let li; + return { + c() { + li = element("li"); + li.textContent = `${localize("GAS.NoAdvancements")}`; + attr(li, "class", "left"); + }, + m(target, anchor) { + insert(target, li, anchor); + }, + p: noop, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(li); + } + } + }; +} +function create_each_block(ctx) { + let li; + let div2; + let div0; + let img; + let img_src_value; + let img_alt_value; + let div1; + let t_value = ( + /*advancement*/ + ctx[4].title + "" + ); + let t; + let div2_data_tooltip_value; + let div3; + let switch_instance; + let li_data_type_value; + let current; + var switch_value = ( + /*classAdvancementComponents*/ + ctx[1][ + /*advancement*/ + ctx[4].type + ] + ); + function switch_props(ctx2, dirty) { + return { + props: { advancement: ( + /*advancement*/ + ctx2[4] + ) } + }; + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); + } + return { + c() { + li = element("li"); + div2 = element("div"); + div0 = element("div"); + img = element("img"); + div1 = element("div"); + t = text(t_value); + div3 = element("div"); + if (switch_instance) create_component(switch_instance.$$.fragment); + attr(img, "class", "icon"); + if (!src_url_equal(img.src, img_src_value = /*advancement*/ + ctx[4].icon)) attr(img, "src", img_src_value); + attr(img, "alt", img_alt_value = /*advancement*/ + ctx[4].title); + attr(div0, "class", "flex0 relative image"); + attr(div1, "class", "flex2"); + attr(div2, "class", "flexrow"); + attr(div2, "data-tooltip", div2_data_tooltip_value = getAdvancementValue( + /*advancement*/ + ctx[4], + "hint" + )); + attr(div2, "data-tooltip-class", "gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip"); + attr(div3, "class", "flexrow"); + attr(li, "class", "left"); + attr(li, "data-type", li_data_type_value = /*advancement*/ + ctx[4].type); + }, + m(target, anchor) { + insert(target, li, anchor); + append(li, div2); + append(div2, div0); + append(div0, img); + append(div2, div1); + append(div1, t); + append(li, div3); + if (switch_instance) mount_component(switch_instance, div3, null); + current = true; + }, + p(ctx2, dirty) { + if (!current || dirty & /*classAdvancementArrayFiltered*/ + 1 && !src_url_equal(img.src, img_src_value = /*advancement*/ + ctx2[4].icon)) { + attr(img, "src", img_src_value); + } + if (!current || dirty & /*classAdvancementArrayFiltered*/ + 1 && img_alt_value !== (img_alt_value = /*advancement*/ + ctx2[4].title)) { + attr(img, "alt", img_alt_value); + } + if ((!current || dirty & /*classAdvancementArrayFiltered*/ + 1) && t_value !== (t_value = /*advancement*/ + ctx2[4].title + "")) set_data(t, t_value); + if (!current || dirty & /*classAdvancementArrayFiltered*/ + 1 && div2_data_tooltip_value !== (div2_data_tooltip_value = getAdvancementValue( + /*advancement*/ + ctx2[4], + "hint" + ))) { + attr(div2, "data-tooltip", div2_data_tooltip_value); + } + if (dirty & /*classAdvancementComponents, classAdvancementArrayFiltered*/ + 3 && switch_value !== (switch_value = /*classAdvancementComponents*/ + ctx2[1][ + /*advancement*/ + ctx2[4].type + ])) { + if (switch_instance) { + group_outros(); + const old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, () => { + destroy_component(old_component, 1); + }); + check_outros(); + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx2)); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, div3, null); + } else { + switch_instance = null; + } + } else if (switch_value) { + const switch_instance_changes = {}; + if (dirty & /*classAdvancementArrayFiltered*/ + 1) switch_instance_changes.advancement = /*advancement*/ + ctx2[4]; + switch_instance.$set(switch_instance_changes); + } + if (!current || dirty & /*classAdvancementArrayFiltered*/ + 1 && li_data_type_value !== (li_data_type_value = /*advancement*/ + ctx2[4].type)) { + attr(li, "data-type", li_data_type_value); + } + }, + i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(li); + } + if (switch_instance) destroy_component(switch_instance); + } + }; +} +function create_fragment(ctx) { + let div; + let current; + let if_block = ( + /*classAdvancementArrayFiltered*/ + ctx[0] && create_if_block(ctx) + ); + return { + c() { + div = element("div"); + if (if_block) if_block.c(); + attr(div, "class", "component"); + }, + m(target, anchor) { + insert(target, div, anchor); + if (if_block) if_block.m(div, null); + current = true; + }, + p(ctx2, [dirty]) { + if ( + /*classAdvancementArrayFiltered*/ + ctx2[0] + ) { + if (if_block) { + if_block.p(ctx2, dirty); + if (dirty & /*classAdvancementArrayFiltered*/ + 1) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block(ctx2); + if_block.c(); + transition_in(if_block, 1); + if_block.m(div, null); + } + } else if (if_block) { + group_outros(); + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + check_outros(); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + if (if_block) if_block.d(); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let classAdvancementComponents; + let { classAdvancementArrayFiltered = [] } = $$props; + let { level = 0 } = $$props; + const importClassAdvancements = async () => { + for (const classAdvancement of classAdvancementArrayFiltered) { + try { + const module = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../../molecules/dnd5e/Advancements/AbilityScoreImprovement.svelte": () => import("./AbilityScoreImprovement-BmB9DNEX.js"), "../../../molecules/dnd5e/Advancements/Feat.svelte": () => import("./Feat-BpFE8O58.js"), "../../../molecules/dnd5e/Advancements/ItemChoice.svelte": () => import("./ItemChoice-CRxi93V_.js"), "../../../molecules/dnd5e/Advancements/ItemGrant.svelte": () => import("./ItemGrant-D2wJNtMk.js"), "../../../molecules/dnd5e/Advancements/ScaleValue.svelte": () => import("./ScaleValue-DYrODTcx.js"), "../../../molecules/dnd5e/Advancements/Size.svelte": () => import("./Size-DhLm1NsB.js"), "../../../molecules/dnd5e/Advancements/Trait.svelte": () => import("./Trait-DtI9SYqp.js") }), `../../../molecules/dnd5e/Advancements/${classAdvancement.type}.svelte`, 7); + $$invalidate(1, classAdvancementComponents[classAdvancement.type] = module.default, classAdvancementComponents); + } catch (error) { + log.e(`Failed to load component for ${classAdvancement.type}:`, error); + } + } + }; + onMount(async () => { + await tick(); + await importClassAdvancements(); + }); + $$self.$$set = ($$props2) => { + if ("classAdvancementArrayFiltered" in $$props2) $$invalidate(0, classAdvancementArrayFiltered = $$props2.classAdvancementArrayFiltered); + if ("level" in $$props2) $$invalidate(2, level = $$props2.level); + }; + $$invalidate(1, classAdvancementComponents = {}); + return [classAdvancementArrayFiltered, classAdvancementComponents, level]; +} +class LevelUpExistingClassLeftCol extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { + classAdvancementArrayFiltered: 0, + level: 2 + }); + } +} +export { + LevelUpExistingClassLeftCol as default +}; +//# sourceMappingURL=LevelUpExistingClassLeftCol-Dij9sL0P.js.map diff --git a/dist/LevelUpExistingClassLeftCol-Dij9sL0P.js.map b/dist/LevelUpExistingClassLeftCol-Dij9sL0P.js.map new file mode 100644 index 0000000..7a518b4 --- /dev/null +++ b/dist/LevelUpExistingClassLeftCol-Dij9sL0P.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LevelUpExistingClassLeftCol-Dij9sL0P.js","sources":["../src/components/organisms/dnd5e/Tabs/LevelUpExistingClassLeftCol.svelte"],"sourcesContent":["\n\n\n\n\n"],"names":["ctx"],"mappings":";;;;;;;;;;;;;;AA6BsF,QAAA;AAAA,IAAAA,QAA8B,OAAM,QAAA;;;;;;;;;;;;AAAhE,aAA2rB,QAAA,IAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAtjB,IAA6B,CAAA;AAAA,EAAA;;iCAAlC,QAAI,KAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;UAACA,KAA6B,CAAA;AAAA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1SM2AKew.js @@ -0,0 +1,399 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, z as ensure_array_like, e as element, b as attr, c as insert, d as append, A as noop, j as detach, B as destroy_each, k as component_subscribe, a1 as race, ac as createEventDispatcher, n as getContext, o as onMount, F as text, Z as listen, a0 as is_function, G as set_data, ad as Timing } from "./index-DP0Ud7KH.js"; +/* empty css */ +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[11] = list[i]; + child_ctx[13] = i; + return child_ctx; +} +function create_if_block_1(ctx) { + let span; + return { + c() { + span = element("span"); + span.textContent = "+"; + }, + m(target, anchor) { + insert(target, span, anchor); + }, + d(detaching) { + if (detaching) { + detach(span); + } + } + }; +} +function create_if_block(ctx) { + let span; + return { + c() { + span = element("span"); + span.textContent = "+"; + }, + m(target, anchor) { + insert(target, span, anchor); + }, + d(detaching) { + if (detaching) { + detach(span); + } + } + }; +} +function create_each_block(ctx) { + let div5; + let div0; + let t0_value = ( + /*ability*/ + ctx[11][1].label + "" + ); + let t0; + let div1; + let span0; + let t1_value = ( + /*abilityAdvancements*/ + (ctx[0]?.[ + /*ability*/ + ctx[11][1].abbreviation + ] || 0) + "" + ); + let t1; + let div2; + let input; + let input_name_value; + let input_id_value; + let input_value_value; + let div3; + let t2_value = (Number( + /*abilityAdvancements*/ + ctx[0]?.[ + /*ability*/ + ctx[11][1].abbreviation + ] + ) || 0) + Number( + /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[11][1].abbreviation + ]?.value || 0 + ) + ""; + let t2; + let div4; + let span1; + let t3_value = ( + /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[11][1].abbreviation + ]?.mod + "" + ); + let t3; + let mounted; + let dispose; + let if_block0 = ( + /*abilityAdvancements*/ + ctx[0]?.[ + /*ability*/ + ctx[11][1].abbreviation + ] > 0 && create_if_block_1() + ); + let if_block1 = ( + /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[11][1].abbreviation + ]?.mod > 0 && create_if_block() + ); + return { + c() { + div5 = element("div"); + div0 = element("div"); + t0 = text(t0_value); + div1 = element("div"); + if (if_block0) if_block0.c(); + span0 = element("span"); + t1 = text(t1_value); + div2 = element("div"); + input = element("input"); + div3 = element("div"); + t2 = text(t2_value); + div4 = element("div"); + if (if_block1) if_block1.c(); + span1 = element("span"); + t3 = text(t3_value); + attr(div0, "class", "flex2 left"); + attr(div1, "class", "flex1 center align-text-with-input svelte-gas-1dbvf21"); + attr(input, "class", "center small"); + attr(input, "name", input_name_value = /*ability*/ + ctx[11][1].abbreviation); + attr(input, "id", input_id_value = /*ability*/ + ctx[11][1].abbreviation); + attr(input, "type", "number"); + input.value = input_value_value = /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[11][1].abbreviation + ]?.value; + attr(div2, "class", "flex1 center"); + attr(div3, "class", "flex1 center align-text-with-input svelte-gas-1dbvf21"); + attr(div4, "class", "flex1 center align-text-with-input svelte-gas-1dbvf21"); + attr(div5, "class", "flexrow mb-sm"); + }, + m(target, anchor) { + insert(target, div5, anchor); + append(div5, div0); + append(div0, t0); + append(div5, div1); + if (if_block0) if_block0.m(div1, null); + append(div1, span0); + append(span0, t1); + append(div5, div2); + append(div2, input); + append(div5, div3); + append(div3, t2); + append(div5, div4); + if (if_block1) if_block1.m(div4, null); + append(div4, span1); + append(span1, t3); + if (!mounted) { + dispose = listen(input, "input", function() { + if (is_function( + /*updateDebounce*/ + ctx[4]( + /*ability*/ + ctx[11][1].abbreviation, + event + ) + )) ctx[4]( + /*ability*/ + ctx[11][1].abbreviation, + event + ).apply(this, arguments); + }); + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if (dirty & /*systemAbilitiesArray*/ + 2 && t0_value !== (t0_value = /*ability*/ + ctx[11][1].label + "")) set_data(t0, t0_value); + if ( + /*abilityAdvancements*/ + ctx[0]?.[ + /*ability*/ + ctx[11][1].abbreviation + ] > 0 + ) { + if (if_block0) ; + else { + if_block0 = create_if_block_1(); + if_block0.c(); + if_block0.m(div1, span0); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if (dirty & /*abilityAdvancements, systemAbilitiesArray*/ + 3 && t1_value !== (t1_value = /*abilityAdvancements*/ + (ctx[0]?.[ + /*ability*/ + ctx[11][1].abbreviation + ] || 0) + "")) set_data(t1, t1_value); + if (dirty & /*systemAbilitiesArray*/ + 2 && input_name_value !== (input_name_value = /*ability*/ + ctx[11][1].abbreviation)) { + attr(input, "name", input_name_value); + } + if (dirty & /*systemAbilitiesArray*/ + 2 && input_id_value !== (input_id_value = /*ability*/ + ctx[11][1].abbreviation)) { + attr(input, "id", input_id_value); + } + if (dirty & /*$doc, systemAbilitiesArray*/ + 6 && input_value_value !== (input_value_value = /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[11][1].abbreviation + ]?.value) && input.value !== input_value_value) { + input.value = input_value_value; + } + if (dirty & /*abilityAdvancements, systemAbilitiesArray, $doc*/ + 7 && t2_value !== (t2_value = (Number( + /*abilityAdvancements*/ + ctx[0]?.[ + /*ability*/ + ctx[11][1].abbreviation + ] + ) || 0) + Number( + /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[11][1].abbreviation + ]?.value || 0 + ) + "")) set_data(t2, t2_value); + if ( + /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[11][1].abbreviation + ]?.mod > 0 + ) { + if (if_block1) ; + else { + if_block1 = create_if_block(); + if_block1.c(); + if_block1.m(div4, span1); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + if (dirty & /*$doc, systemAbilitiesArray*/ + 6 && t3_value !== (t3_value = /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[11][1].abbreviation + ]?.mod + "")) set_data(t3, t3_value); + }, + d(detaching) { + if (detaching) { + detach(div5); + } + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + mounted = false; + dispose(); + } + }; +} +function create_fragment(ctx) { + let div6; + let h5; + let div5; + let each_value = ensure_array_like( + /*systemAbilitiesArray*/ + ctx[1] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + return { + c() { + div6 = element("div"); + h5 = element("h5"); + h5.innerHTML = `
Ability
Race / Feat
Base Score
Score
Modifier
`; + div5 = element("div"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(h5, "class", "flexrow mb-sm"); + attr(div5, "class", "indent"); + attr(div6, "class", "attribute-entry mt-sm"); + }, + m(target, anchor) { + insert(target, div6, anchor); + append(div6, h5); + append(div6, div5); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div5, null); + } + } + }, + p(ctx2, [dirty]) { + if (dirty & /*$doc, systemAbilitiesArray, Number, abilityAdvancements, updateDebounce, event*/ + 23) { + each_value = ensure_array_like( + /*systemAbilitiesArray*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div5, null); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div6); + } + destroy_each(each_blocks, detaching); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let systemAbilities; + let systemAbilitiesArray; + let abilityAdvancements; + let $race; + let $doc; + component_subscribe($$self, race, ($$value) => $$invalidate(7, $race = $$value)); + let { document = false } = $$props; + createEventDispatcher(); + const doc = document || getContext("#doc"); + component_subscribe($$self, doc, (value) => $$invalidate(2, $doc = value)); + const updateDebounce = Timing.debounce(updateValue, 300); + function updateValue(attr2, event2) { + const options = { + system: { + abilities: { + [attr2]: { value: Number(event2.target.value) } + } + } + }; + $doc.updateSource(options); + doc.set($doc); + } + onMount(async () => { + }); + $$self.$$set = ($$props2) => { + if ("document" in $$props2) $$invalidate(5, document = $$props2.document); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*systemAbilities*/ + 64) { + $$invalidate(1, systemAbilitiesArray = Object.entries(systemAbilities)); + } + if ($$self.$$.dirty & /*$race*/ + 128) { + $$invalidate(0, abilityAdvancements = $race?.advancement?.byType?.AbilityScoreImprovement?.[0].configuration?.fixed); + } + }; + $$invalidate(6, systemAbilities = game.system.config.abilities); + return [ + abilityAdvancements, + systemAbilitiesArray, + $doc, + doc, + updateDebounce, + document, + systemAbilities, + $race + ]; +} +class ManualEntry extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { document: 5 }); + } +} +export { + ManualEntry as default +}; +//# sourceMappingURL=ManualEntry-1SM2AKew.js.map diff --git a/dist/ManualEntry-1SM2AKew.js.map b/dist/ManualEntry-1SM2AKew.js.map new file mode 100644 index 0000000..49afa9b --- /dev/null +++ b/dist/ManualEntry-1SM2AKew.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ManualEntry-1SM2AKew.js","sources":["../src/components/molecules/dnd5e/AbilityEntry/ManualEntry.svelte"],"sourcesContent":["\n\n\n\n"],"names":["ctx","attr","event"],"mappings":";;;;;;;;;;;;;;;;AA2B8f,aAAc,QAAA,MAAA,MAAA;AAAA;;;;;;;;;;;;;;;;AAA2nB,aAAc,QAAA,MAAA,MAAA;AAAA;;;;;;;;;;;;;IAAtxB,IAAO,EAAA,EAAC,CAAC,EAAE,QAAK;AAAA;;;;AAAyI,MAAA;AAAA;AAAA,KAAA;;MAAsB,IAAO,EAAA,EAAC,CAAC,EAAE;AAAA,IAAY,KAAK,KAAC;AAAA;;;;;;;;kBAAsU;AAAA;AAAA,IAAO,IAAmB,CAAA;AAAA;AAAA,MAAG,IAAO,EAAA,EAAC,CAAC,EAAE;AAAA,IAAY;AAAA,EAAA,KAAM,KAAK;AAAA;AAAA,IAAO,IAAI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;;;UAAj9BA,KAAoB,CAAA;AAAA,QAAA;;mCAAzB,QAAI,KAAA,GAAA;;;;;;;;;;;;;wCAAJ;AAAA;;;;;;;;;;;;;;;;;;;AArBlR,MAAA,EAAA,WAAW,MAAK,IAAA;AAEV,wBAAqB;AAChC,QAAA,MAAM,YAAY,WAAW,MAAM;;AACnC,QAAA,iBAAiB,OAAO,SAAS,aAAa,GAAG;WAE9C,YAAYC,OAAMC,QAAK;UACxB,UAAO;AAAA,MAAI,QAAM;AAAA,QAAG,WAAS;AAAA,WAAKD,KAAI,GAAA,EAAI,OAAO,OAAOC,OAAM,OAAO,KAAK,EAAA;AAAA;;;AAChF,SAAK,aAAa,OAAO;;;AAS3B,UAAO,YAAA;AAAA;;;;;;;sBAJJ,uBAAuB,OAAO,QAAQ,eAAe,CAAA;AAAA;;;AAErD,mBAAA,GAAA,sBAAsB,OAAO,aAAa,QAAQ,0BAA0B,CAAC,EAAE,eAAe,KAAA;AAAA;;AAHhG,eAAA,GAAE,kBAAkB,KAAK,OAAO,OAAO,SAAA;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/PointBuy-C3OrWmnB.js b/dist/PointBuy-C3OrWmnB.js new file mode 100644 index 0000000..7b3c1d7 --- /dev/null +++ b/dist/PointBuy-C3OrWmnB.js @@ -0,0 +1,701 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, z as ensure_array_like, e as element, b as attr, c as insert, d as append, A as noop, j as detach, B as destroy_each, k as component_subscribe, ae as pointBuy, a1 as race, af as abilityRolls, ac as createEventDispatcher, n as getContext, o as onMount, ag as POINT_BUY_COSTS, y as set_store_value, M as MODULE_ID, F as text, Z as listen, a0 as is_function, G as set_data, a6 as run_all, ad as Timing, l as localize } from "./index-DP0Ud7KH.js"; +/* empty css */ +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[18] = list[i]; + child_ctx[20] = i; + return child_ctx; +} +function create_if_block_3(ctx) { + let span; + return { + c() { + span = element("span"); + span.textContent = "+"; + }, + m(target, anchor) { + insert(target, span, anchor); + }, + d(detaching) { + if (detaching) { + detach(span); + } + } + }; +} +function create_if_block_2(ctx) { + let span; + return { + c() { + span = element("span"); + span.textContent = "+"; + }, + m(target, anchor) { + insert(target, span, anchor); + }, + d(detaching) { + if (detaching) { + detach(span); + } + } + }; +} +function create_each_block(ctx) { + let div8; + let div0; + let t0_value = ( + /*ability*/ + ctx[18][1].label + "" + ); + let t0; + let div1; + let span0; + let t1_value = ( + /*abilityAdvancements*/ + (ctx[5]?.[ + /*ability*/ + ctx[18][1].abbreviation + ] || 0) + "" + ); + let t1; + let div5; + let input; + let input_value_value; + let input_name_value; + let input_id_value; + let div4; + let div2; + let i0; + let div3; + let i1; + let div6; + let t2_value = (Number( + /*abilityAdvancements*/ + ctx[5]?.[ + /*ability*/ + ctx[18][1].abbreviation + ] + ) || 0) + Number( + /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.value || 0 + ) + ""; + let t2; + let div7; + let span1; + let t3_value = ( + /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.mod + "" + ); + let t3; + let mounted; + let dispose; + let if_block0 = ( + /*abilityAdvancements*/ + ctx[5]?.[ + /*ability*/ + ctx[18][1].abbreviation + ] > 0 && create_if_block_3() + ); + let if_block1 = ( + /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.mod > 0 && create_if_block_2() + ); + return { + c() { + div8 = element("div"); + div0 = element("div"); + t0 = text(t0_value); + div1 = element("div"); + if (if_block0) if_block0.c(); + span0 = element("span"); + t1 = text(t1_value); + div5 = element("div"); + input = element("input"); + div4 = element("div"); + div2 = element("div"); + i0 = element("i"); + div3 = element("div"); + i1 = element("i"); + div6 = element("div"); + t2 = text(t2_value); + div7 = element("div"); + if (if_block1) if_block1.c(); + span1 = element("span"); + t3 = text(t3_value); + attr(div0, "class", "flex2 left"); + attr(div1, "class", "flex1 center align-text-with-input svelte-gas-1wexvvn"); + attr(input, "class", "left small mainscore svelte-gas-1wexvvn"); + input.disabled = true; + attr(input, "type", "number"); + input.value = input_value_value = /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.value; + attr(input, "name", input_name_value = /*ability*/ + ctx[18][1].abbreviation); + attr(input, "id", input_id_value = /*ability*/ + ctx[18][1].abbreviation); + attr(i0, "class", "fas fa-chevron-up"); + attr(i0, "alt", "Decrease"); + attr(div2, "class", "up chevron svelte-gas-1wexvvn"); + attr(i1, "class", "fas fa-chevron-down"); + attr(i1, "alt", "Increase"); + attr(div3, "class", "down chevron svelte-gas-1wexvvn"); + attr(div4, "class", "controls svelte-gas-1wexvvn"); + attr(div5, "class", "flex1 center relative"); + attr(div6, "class", "flex1 center align-text-with-input svelte-gas-1wexvvn"); + attr(div7, "class", "flex1 center align-text-with-input svelte-gas-1wexvvn"); + attr(div8, "class", "flexrow mb-sm"); + }, + m(target, anchor) { + insert(target, div8, anchor); + append(div8, div0); + append(div0, t0); + append(div8, div1); + if (if_block0) if_block0.m(div1, null); + append(div1, span0); + append(span0, t1); + append(div8, div5); + append(div5, input); + append(div5, div4); + append(div4, div2); + append(div2, i0); + append(div4, div3); + append(div3, i1); + append(div8, div6); + append(div6, t2); + append(div8, div7); + if (if_block1) if_block1.m(div7, null); + append(div7, span1); + append(span1, t3); + if (!mounted) { + dispose = [ + listen(i0, "click", function() { + if (is_function( + /*updateDebounce*/ + ctx[7]( + /*ability*/ + ctx[18][1].abbreviation, + { + target: { + value: Number( + /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.value + ) + 1 + } + } + ) + )) ctx[7]( + /*ability*/ + ctx[18][1].abbreviation, + { + target: { + value: Number( + /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.value + ) + 1 + } + } + ).apply(this, arguments); + }), + listen(i1, "click", function() { + if (is_function( + /*updateDebounce*/ + ctx[7]( + /*ability*/ + ctx[18][1].abbreviation, + { + target: { + value: Number( + /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.value + ) - 1 + } + } + ) + )) ctx[7]( + /*ability*/ + ctx[18][1].abbreviation, + { + target: { + value: Number( + /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.value + ) - 1 + } + } + ).apply(this, arguments); + }) + ]; + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if (dirty & /*systemAbilitiesArray*/ + 4 && t0_value !== (t0_value = /*ability*/ + ctx[18][1].label + "")) set_data(t0, t0_value); + if ( + /*abilityAdvancements*/ + ctx[5]?.[ + /*ability*/ + ctx[18][1].abbreviation + ] > 0 + ) { + if (if_block0) ; + else { + if_block0 = create_if_block_3(); + if_block0.c(); + if_block0.m(div1, span0); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if (dirty & /*abilityAdvancements, systemAbilitiesArray*/ + 36 && t1_value !== (t1_value = /*abilityAdvancements*/ + (ctx[5]?.[ + /*ability*/ + ctx[18][1].abbreviation + ] || 0) + "")) set_data(t1, t1_value); + if (dirty & /*$doc, systemAbilitiesArray*/ + 12 && input_value_value !== (input_value_value = /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.value) && input.value !== input_value_value) { + input.value = input_value_value; + } + if (dirty & /*systemAbilitiesArray*/ + 4 && input_name_value !== (input_name_value = /*ability*/ + ctx[18][1].abbreviation)) { + attr(input, "name", input_name_value); + } + if (dirty & /*systemAbilitiesArray*/ + 4 && input_id_value !== (input_id_value = /*ability*/ + ctx[18][1].abbreviation)) { + attr(input, "id", input_id_value); + } + if (dirty & /*abilityAdvancements, systemAbilitiesArray, $doc*/ + 44 && t2_value !== (t2_value = (Number( + /*abilityAdvancements*/ + ctx[5]?.[ + /*ability*/ + ctx[18][1].abbreviation + ] + ) || 0) + Number( + /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.value || 0 + ) + "")) set_data(t2, t2_value); + if ( + /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.mod > 0 + ) { + if (if_block1) ; + else { + if_block1 = create_if_block_2(); + if_block1.c(); + if_block1.m(div7, span1); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + if (dirty & /*$doc, systemAbilitiesArray*/ + 12 && t3_value !== (t3_value = /*$doc*/ + ctx[3].system.abilities[ + /*ability*/ + ctx[18][1].abbreviation + ]?.mod + "")) set_data(t3, t3_value); + }, + d(detaching) { + if (detaching) { + detach(div8); + } + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + mounted = false; + run_all(dispose); + } + }; +} +function create_else_block(ctx) { + let input; + let input_class_value; + return { + c() { + input = element("input"); + attr(input, "class", input_class_value = "score center small " + /*pointBuyClass*/ + ctx[4] + " svelte-gas-1wexvvn"); + input.disabled = true; + attr(input, "type", "number"); + input.value = /*scoreTotal*/ + ctx[1]; + }, + m(target, anchor) { + insert(target, input, anchor); + }, + p(ctx2, dirty) { + if (dirty & /*pointBuyClass*/ + 16 && input_class_value !== (input_class_value = "score center small " + /*pointBuyClass*/ + ctx2[4] + " svelte-gas-1wexvvn")) { + attr(input, "class", input_class_value); + } + if (dirty & /*scoreTotal*/ + 2 && input.value !== /*scoreTotal*/ + ctx2[1]) { + input.value = /*scoreTotal*/ + ctx2[1]; + } + }, + d(detaching) { + if (detaching) { + detach(input); + } + } + }; +} +function create_if_block_1(ctx) { + let span; + return { + c() { + span = element("span"); + span.textContent = "N/A"; + attr(span, "class", "red svelte-gas-1wexvvn"); + attr(span, "data-tooltip", localize("GAS.Setting.AbilityEntry.AllowPointBuy.InvalidTotal")); + }, + m(target, anchor) { + insert(target, span, anchor); + }, + p: noop, + d(detaching) { + if (detaching) { + detach(span); + } + } + }; +} +function create_if_block(ctx) { + let hr; + let button; + let mounted; + let dispose; + return { + c() { + hr = element("hr"); + button = element("button"); + button.textContent = "Reset scores"; + attr(button, "class", "btn btn-primary"); + }, + m(target, anchor) { + insert(target, hr, anchor); + insert(target, button, anchor); + if (!mounted) { + dispose = listen( + button, + "click", + /*reset*/ + ctx[8] + ); + mounted = true; + } + }, + p: noop, + d(detaching) { + if (detaching) { + detach(hr); + detach(button); + } + mounted = false; + dispose(); + } + }; +} +function create_fragment(ctx) { + let div11; + let h5; + let div10; + let hr; + let div9; + let div5; + let div6; + let show_if_1; + let div7; + let div8; + let input; + let show_if = isNaN( + /*scoreTotal*/ + ctx[1] + ); + let each_value = ensure_array_like( + /*systemAbilitiesArray*/ + ctx[2] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + function select_block_type(ctx2, dirty) { + if (dirty & /*scoreTotal*/ + 2) show_if_1 = null; + if (show_if_1 == null) show_if_1 = !!isNaN( + /*scoreTotal*/ + ctx2[1] + ); + if (show_if_1) return create_if_block_1; + return create_else_block; + } + let current_block_type = select_block_type(ctx, -1); + let if_block0 = current_block_type(ctx); + let if_block1 = show_if && create_if_block(ctx); + return { + c() { + div11 = element("div"); + h5 = element("h5"); + h5.innerHTML = `
Ability
Race / Feat
Base Score
Score
Modifier
`; + div10 = element("div"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + hr = element("hr"); + div9 = element("div"); + div5 = element("div"); + div5.textContent = "Points total: "; + div6 = element("div"); + if_block0.c(); + div7 = element("div"); + div7.textContent = "/ "; + div8 = element("div"); + input = element("input"); + if (if_block1) if_block1.c(); + attr(h5, "class", "flexrow mb-sm"); + attr(div5, "class", "flex1"); + attr(div6, "class", "flex"); + attr(div7, "class", "flex0"); + attr(input, "class", "center small"); + input.disabled = true; + attr(input, "type", "number"); + input.value = /*pointBuyLimit*/ + ctx[0]; + attr(div8, "class", "flex1"); + attr(div9, "class", "flexrow justify-flexrow-vertical"); + attr(div10, "class", "indent"); + attr(div11, "class", "attribute-entry mt-sm"); + }, + m(target, anchor) { + insert(target, div11, anchor); + append(div11, h5); + append(div11, div10); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div10, null); + } + } + append(div10, hr); + append(div10, div9); + append(div9, div5); + append(div9, div6); + if_block0.m(div6, null); + append(div9, div7); + append(div9, div8); + append(div8, input); + if (if_block1) if_block1.m(div10, null); + }, + p(ctx2, [dirty]) { + if (dirty & /*$doc, systemAbilitiesArray, Number, abilityAdvancements, updateDebounce*/ + 172) { + each_value = ensure_array_like( + /*systemAbilitiesArray*/ + ctx2[2] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div10, hr); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + if (current_block_type === (current_block_type = select_block_type(ctx2, dirty)) && if_block0) { + if_block0.p(ctx2, dirty); + } else { + if_block0.d(1); + if_block0 = current_block_type(ctx2); + if (if_block0) { + if_block0.c(); + if_block0.m(div6, null); + } + } + if (dirty & /*pointBuyLimit*/ + 1 && input.value !== /*pointBuyLimit*/ + ctx2[0]) { + input.value = /*pointBuyLimit*/ + ctx2[0]; + } + if (dirty & /*scoreTotal*/ + 2) show_if = isNaN( + /*scoreTotal*/ + ctx2[1] + ); + if (show_if) { + if (if_block1) { + if_block1.p(ctx2, dirty); + } else { + if_block1 = create_if_block(ctx2); + if_block1.c(); + if_block1.m(div10, null); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div11); + } + destroy_each(each_blocks, detaching); + if_block0.d(); + if (if_block1) if_block1.d(); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let systemAbilities; + let systemAbilitiesArray; + let abilityAdvancements; + let scoreTotal; + let pointBuyLimit; + let activeClass; + let pointBuyClass; + let $pointBuy; + let $doc; + let $race; + let $abilityRolls; + component_subscribe($$self, pointBuy, ($$value) => $$invalidate(14, $pointBuy = $$value)); + component_subscribe($$self, race, ($$value) => $$invalidate(12, $race = $$value)); + component_subscribe($$self, abilityRolls, ($$value) => $$invalidate(15, $abilityRolls = $$value)); + let { document = false } = $$props; + createEventDispatcher(); + const doc = document || getContext("#doc"); + component_subscribe($$self, doc, (value) => $$invalidate(3, $doc = value)); + const updateDebounce = Timing.debounce(updateValue, 100); + function updateValue(attr2, event) { + if (event.target.value < 8) return false; + if (event.target.value > 15) return false; + const options = { + system: { + abilities: { + [attr2]: { value: Number(event.target.value) } + } + } + }; + $doc.updateSource(options); + doc.set($doc); + } + function reset() { + set_store_value(abilityRolls, $abilityRolls = {}, $abilityRolls); + const options = { system: { abilities: {} } }; + systemAbilitiesArray.forEach((ability) => { + options.system.abilities[ability[1].abbreviation] = { value: 10 }; + }); + $doc.updateSource(options); + doc.set($doc); + } + onMount(async () => { + }); + $$self.$$set = ($$props2) => { + if ("document" in $$props2) $$invalidate(9, document = $$props2.document); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*systemAbilities*/ + 2048) { + $$invalidate(2, systemAbilitiesArray = Object.entries(systemAbilities)); + } + if ($$self.$$.dirty & /*$race*/ + 4096) { + $$invalidate(5, abilityAdvancements = $race?.advancement?.byType?.AbilityScoreImprovement?.[0].configuration?.fixed); + } + if ($$self.$$.dirty & /*systemAbilitiesArray, $doc*/ + 12) { + $$invalidate(1, scoreTotal = systemAbilitiesArray.reduce((acc, ability) => acc + POINT_BUY_COSTS[Number($doc.system.abilities[ability[1].abbreviation]?.value)], 0)); + } + if ($$self.$$.dirty & /*scoreTotal, pointBuyLimit*/ + 3) { + $$invalidate(10, activeClass = scoreTotal !== pointBuyLimit ? " active" : ""); + } + if ($$self.$$.dirty & /*scoreTotal, pointBuyLimit, activeClass*/ + 1027) { + $$invalidate(4, pointBuyClass = scoreTotal > pointBuyLimit ? "red" + activeClass : "green" + activeClass); + } + if ($$self.$$.dirty & /*scoreTotal, pointBuyLimit*/ + 3) { + set_store_value(pointBuy, $pointBuy = { scoreTotal, pointBuyLimit }, $pointBuy); + } + }; + $$invalidate(11, systemAbilities = game.system.config.abilities); + $$invalidate(0, pointBuyLimit = game.settings.get(MODULE_ID, "pointBuyLimit")); + return [ + pointBuyLimit, + scoreTotal, + systemAbilitiesArray, + $doc, + pointBuyClass, + abilityAdvancements, + doc, + updateDebounce, + reset, + document, + activeClass, + systemAbilities, + $race + ]; +} +class PointBuy extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { document: 9 }); + } +} +export { + PointBuy as default +}; +//# sourceMappingURL=PointBuy-C3OrWmnB.js.map diff --git a/dist/PointBuy-C3OrWmnB.js.map b/dist/PointBuy-C3OrWmnB.js.map new file mode 100644 index 0000000..d405b97 --- /dev/null +++ b/dist/PointBuy-C3OrWmnB.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PointBuy-C3OrWmnB.js","sources":["../src/components/molecules/dnd5e/AbilityEntry/PointBuy.svelte"],"sourcesContent":["\n\n\n\n"],"names":["ctx","attr"],"mappings":";;;;;;;;;;;;;;;;AAiD8f,aAAc,QAAA,MAAA,MAAA;AAAA;;;;;;;;;;;;;;;;AAA2iC,aAAc,QAAA,MAAA,MAAA;AAAA;;;;;;;;;;;;;IAAtsC,IAAO,EAAA,EAAC,CAAC,EAAE,QAAK;AAAA;;;;AAAyI,MAAA;AAAA;AAAA,KAAA;;MAAsB,IAAO,EAAA,EAAC,CAAC,EAAE;AAAA,IAAY,KAAK,KAAC;AAAA;;;;;;;;;;;;;kBAAsvB;AAAA;AAAA,IAAO,IAAmB,CAAA;AAAA;AAAA,MAAG,IAAO,EAAA,EAAC,CAAC,EAAE;AAAA,IAAY;AAAA,EAAA,KAAM,KAAK;AAAA;AAAA,IAAO,I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A,MAAI,QAAM;AAAA,QAAG,WAAS;AAAA,WAAKA,KAAI,GAAA,EAAI,OAAO,OAAO,MAAM,OAAO,KAAK,EAAA;AAAA;;;AAChF,SAAK,aAAa,OAAO;;;WAIlB,QAAK;kCACZ,gBAAa,CAAA,GAAA,aAAA;UACP,UAAO,EAAI,QAAM,EAAG,WAAS,CAAA,EAAA,EAAA;AACnC,yBAAqB,QAAQ,aAAO;AAClC,cAAQ,OAAO,UAAU,QAAQ,CAAC,EAAE,YAAY,IAAK,EAAA,OAAO;;AAE9D,SAAK,aAAa,OAAO;;;AAiB3B,UAAO,YAAA;AAAA;;;;;;;sBAXJ,uBAAuB,OAAO,QAAQ,eAAe,CAAA;AAAA;;;AAErD,mBAAA,GAAA,sBAAsB,OAAO,aAAa,QAAQ,0BAA0B,CAAC,EAAE,eAAe,KAAA;AAAA;;;AAC9F,mBAAA,GAAA,aAAa,qBAAqB,OAAQ,CAAA,KAAK,YAAY,MAAM,gBAAgB,OAAO,KAAK,OAAO,UAAU,QAAQ,CAAC,EAAE,YAAY,GAAG,KAAK,IAAI,CAAC,CAAA;AAAA;;;AAEpJ,mBAAA,IAAE,cAAc,eAAe,gBAAgB,YAAY,EAAE;AAAA;;;AAC3D,mBAAA,GAAA,gBAAgB,aAAa,gBAAgB,QAAM,cAAa,UAAQ,WAAA;AAAA;;;AAExE,sBAAA,UAAA,YAAa,EAAA,YAAY,cAAa,GAAA,SAAA;AAAA;;AATxC,eAAA,IAAE,kBAAkB,KAAK,OAAO,OAAO,SAAA;AAKvC,eAAA,GAAE,gBAAgB,KAAK,SAAS,IAAI,WAAW,eAAe,CAAA;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/Race-CfTxV0Jo.js b/dist/Race-CfTxV0Jo.js new file mode 100644 index 0000000..f74f977 --- /dev/null +++ b/dist/Race-CfTxV0Jo.js @@ -0,0 +1,992 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, C as binding_callbacks, D as bind, e as element, F as text, u as create_component, b as attr, c as insert, d as append, v as mount_component, E as add_flush_callback, h as transition_in, g as group_outros, t as transition_out, f as check_outros, j as detach, w as destroy_component, k as component_subscribe, a1 as race, I as getPacksFromSettings, J as extractItemsFromPacksSync, n as getContext, o as onMount, q as tick, a as empty, R as space, G as set_data, z as ensure_array_like, l as localize, B as destroy_each, r as construct_svelte_component, K as src_url_equal, L as getAdvancementValue, _ as __variableDynamicImportRuntimeHelper, y as set_store_value } from "./index-DP0Ud7KH.js"; +import { I as IconSelect } from "./IconSelect-BJAJvIXl.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[27] = list[i]; + return child_ctx; +} +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[4] = list[i]; + return child_ctx; +} +function get_each_context_2(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[5] = list[i]; + return child_ctx; +} +function create_if_block(ctx) { + let if_block0_anchor; + let if_block1_anchor; + let if_block2_anchor; + let if_block3_anchor; + let current; + let if_block0 = ( + /*source*/ + ctx[2] && create_if_block_4(ctx) + ); + let if_block1 = ( + /*filteredMovement*/ + ctx[13] && create_if_block_3(ctx) + ); + let if_block2 = ( + /*filteredSenses*/ + ctx[12] && create_if_block_2(ctx) + ); + let if_block3 = ( + /*advancementArray*/ + ctx[1] && create_if_block_1(ctx) + ); + return { + c() { + if (if_block0) if_block0.c(); + if_block0_anchor = empty(); + if (if_block1) if_block1.c(); + if_block1_anchor = empty(); + if (if_block2) if_block2.c(); + if_block2_anchor = empty(); + if (if_block3) if_block3.c(); + if_block3_anchor = empty(); + }, + m(target, anchor) { + if (if_block0) if_block0.m(target, anchor); + insert(target, if_block0_anchor, anchor); + if (if_block1) if_block1.m(target, anchor); + insert(target, if_block1_anchor, anchor); + if (if_block2) if_block2.m(target, anchor); + insert(target, if_block2_anchor, anchor); + if (if_block3) if_block3.m(target, anchor); + insert(target, if_block3_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if ( + /*source*/ + ctx2[2] + ) { + if (if_block0) { + if_block0.p(ctx2, dirty); + } else { + if_block0 = create_if_block_4(ctx2); + if_block0.c(); + if_block0.m(if_block0_anchor.parentNode, if_block0_anchor); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if ( + /*filteredMovement*/ + ctx2[13] + ) { + if (if_block1) { + if_block1.p(ctx2, dirty); + } else { + if_block1 = create_if_block_3(ctx2); + if_block1.c(); + if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + if ( + /*filteredSenses*/ + ctx2[12] + ) { + if (if_block2) { + if_block2.p(ctx2, dirty); + } else { + if_block2 = create_if_block_2(ctx2); + if_block2.c(); + if_block2.m(if_block2_anchor.parentNode, if_block2_anchor); + } + } else if (if_block2) { + if_block2.d(1); + if_block2 = null; + } + if ( + /*advancementArray*/ + ctx2[1] + ) { + if (if_block3) { + if_block3.p(ctx2, dirty); + if (dirty[0] & /*advancementArray*/ + 2) { + transition_in(if_block3, 1); + } + } else { + if_block3 = create_if_block_1(ctx2); + if_block3.c(); + transition_in(if_block3, 1); + if_block3.m(if_block3_anchor.parentNode, if_block3_anchor); + } + } else if (if_block3) { + group_outros(); + transition_out(if_block3, 1, 1, () => { + if_block3 = null; + }); + check_outros(); + } + }, + i(local) { + if (current) return; + transition_in(if_block3); + current = true; + }, + o(local) { + transition_out(if_block3); + current = false; + }, + d(detaching) { + if (detaching) { + detach(if_block0_anchor); + detach(if_block1_anchor); + detach(if_block2_anchor); + detach(if_block3_anchor); + } + if (if_block0) if_block0.d(detaching); + if (if_block1) if_block1.d(detaching); + if (if_block2) if_block2.d(detaching); + if (if_block3) if_block3.d(detaching); + } + }; +} +function create_if_block_4(ctx) { + let ol; + let li; + let t0; + let t1; + let t2; + let t3; + let t4_value = ( + /*type*/ + ctx[10].value ? ", " + /*type*/ + ctx[10].value : "" + ); + let t4; + let t5; + return { + c() { + ol = element("ol"); + li = element("li"); + t0 = text( + /*book*/ + ctx[9] + ); + t1 = space(); + t2 = text( + /*page*/ + ctx[8] + ); + t3 = space(); + t4 = text(t4_value); + t5 = space(); + attr(ol, "class", "properties-list svelte-gas-a7sibl"); + }, + m(target, anchor) { + insert(target, ol, anchor); + append(ol, li); + append(li, t0); + append(li, t1); + append(li, t2); + append(li, t3); + append(li, t4); + append(li, t5); + }, + p(ctx2, dirty) { + if (dirty[0] & /*book*/ + 512) set_data( + t0, + /*book*/ + ctx2[9] + ); + if (dirty[0] & /*page*/ + 256) set_data( + t2, + /*page*/ + ctx2[8] + ); + if (dirty[0] & /*type*/ + 1024 && t4_value !== (t4_value = /*type*/ + ctx2[10].value ? ", " + /*type*/ + ctx2[10].value : "")) set_data(t4, t4_value); + }, + d(detaching) { + if (detaching) { + detach(ol); + } + } + }; +} +function create_if_block_3(ctx) { + let h3; + let ol; + let each_value_2 = ensure_array_like( + /*filteredMovement*/ + ctx[13] + ); + let each_blocks = []; + for (let i = 0; i < each_value_2.length; i += 1) { + each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i)); + } + return { + c() { + h3 = element("h3"); + h3.textContent = `${localize("GAS.Tabs.Races.Movement")}`; + ol = element("ol"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(h3, "class", "left"); + attr(ol, "class", "properties-list svelte-gas-a7sibl"); + }, + m(target, anchor) { + insert(target, h3, anchor); + insert(target, ol, anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(ol, null); + } + } + }, + p(ctx2, dirty) { + if (dirty[0] & /*units, filteredMovement*/ + 10240) { + each_value_2 = ensure_array_like( + /*filteredMovement*/ + ctx2[13] + ); + let i; + for (i = 0; i < each_value_2.length; i += 1) { + const child_ctx = get_each_context_2(ctx2, each_value_2, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_2(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(ol, null); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value_2.length; + } + }, + d(detaching) { + if (detaching) { + detach(h3); + detach(ol); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_each_block_2(ctx) { + let li; + let t0_value = ( + /*movement*/ + ctx[5].label + "" + ); + let t0; + let t1; + let t2_value = ( + /*movement*/ + ctx[5].value + "" + ); + let t2; + let t3; + let t4; + return { + c() { + li = element("li"); + t0 = text(t0_value); + t1 = text(" : "); + t2 = text(t2_value); + t3 = space(); + t4 = text( + /*units*/ + ctx[11] + ); + attr(li, "class", "left"); + }, + m(target, anchor) { + insert(target, li, anchor); + append(li, t0); + append(li, t1); + append(li, t2); + append(li, t3); + append(li, t4); + }, + p(ctx2, dirty) { + if (dirty[0] & /*filteredMovement*/ + 8192 && t0_value !== (t0_value = /*movement*/ + ctx2[5].label + "")) set_data(t0, t0_value); + if (dirty[0] & /*filteredMovement*/ + 8192 && t2_value !== (t2_value = /*movement*/ + ctx2[5].value + "")) set_data(t2, t2_value); + if (dirty[0] & /*units*/ + 2048) set_data( + t4, + /*units*/ + ctx2[11] + ); + }, + d(detaching) { + if (detaching) { + detach(li); + } + } + }; +} +function create_if_block_2(ctx) { + let h3; + let ol; + let each_value_1 = ensure_array_like( + /*filteredSenses*/ + ctx[12] + ); + let each_blocks = []; + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + return { + c() { + h3 = element("h3"); + h3.textContent = `${localize("GAS.Tabs.Races.Senses")}`; + ol = element("ol"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(h3, "class", "left"); + attr(ol, "class", "properties-list svelte-gas-a7sibl"); + }, + m(target, anchor) { + insert(target, h3, anchor); + insert(target, ol, anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(ol, null); + } + } + }, + p(ctx2, dirty) { + if (dirty[0] & /*units, filteredSenses*/ + 6144) { + each_value_1 = ensure_array_like( + /*filteredSenses*/ + ctx2[12] + ); + let i; + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx2, each_value_1, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_1(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(ol, null); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value_1.length; + } + }, + d(detaching) { + if (detaching) { + detach(h3); + detach(ol); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_each_block_1(ctx) { + let li; + let t0_value = ( + /*senses*/ + ctx[4].label + "" + ); + let t0; + let t1; + let t2_value = ( + /*senses*/ + ctx[4].value + "" + ); + let t2; + let t3; + let t4; + return { + c() { + li = element("li"); + t0 = text(t0_value); + t1 = text(" : "); + t2 = text(t2_value); + t3 = space(); + t4 = text( + /*units*/ + ctx[11] + ); + attr(li, "class", "left"); + }, + m(target, anchor) { + insert(target, li, anchor); + append(li, t0); + append(li, t1); + append(li, t2); + append(li, t3); + append(li, t4); + }, + p(ctx2, dirty) { + if (dirty[0] & /*filteredSenses*/ + 4096 && t0_value !== (t0_value = /*senses*/ + ctx2[4].label + "")) set_data(t0, t0_value); + if (dirty[0] & /*filteredSenses*/ + 4096 && t2_value !== (t2_value = /*senses*/ + ctx2[4].value + "")) set_data(t2, t2_value); + if (dirty[0] & /*units*/ + 2048) set_data( + t4, + /*units*/ + ctx2[11] + ); + }, + d(detaching) { + if (detaching) { + detach(li); + } + } + }; +} +function create_if_block_1(ctx) { + let h3; + let ul; + let current; + let each_value = ensure_array_like( + /*advancementArray*/ + ctx[1] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + const out = (i) => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + return { + c() { + h3 = element("h3"); + h3.textContent = `${localize("GAS.Advancements")}`; + ul = element("ul"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(h3, "class", "left"); + attr(ul, "class", "icon-list"); + }, + m(target, anchor) { + insert(target, h3, anchor); + insert(target, ul, anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(ul, null); + } + } + current = true; + }, + p(ctx2, dirty) { + if (dirty[0] & /*advancementComponents, advancementArray*/ + 16386) { + each_value = ensure_array_like( + /*advancementArray*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(ul, null); + } + } + group_outros(); + for (i = each_value.length; i < each_blocks.length; i += 1) { + out(i); + } + check_outros(); + } + }, + i(local) { + if (current) return; + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + current = true; + }, + o(local) { + each_blocks = each_blocks.filter(Boolean); + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + current = false; + }, + d(detaching) { + if (detaching) { + detach(h3); + detach(ul); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_each_block(ctx) { + let li; + let div2; + let div0; + let img; + let img_src_value; + let img_alt_value; + let div1; + let t_value = ( + /*advancement*/ + ctx[27].title + "" + ); + let t; + let div2_data_tooltip_value; + let div3; + let switch_instance; + let current; + var switch_value = ( + /*advancementComponents*/ + ctx[14][ + /*advancement*/ + ctx[27].type + ] + ); + function switch_props(ctx2, dirty) { + return { + props: { advancement: ( + /*advancement*/ + ctx2[27] + ) } + }; + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); + } + return { + c() { + li = element("li"); + div2 = element("div"); + div0 = element("div"); + img = element("img"); + div1 = element("div"); + t = text(t_value); + div3 = element("div"); + if (switch_instance) create_component(switch_instance.$$.fragment); + attr(img, "class", "icon"); + if (!src_url_equal(img.src, img_src_value = /*advancement*/ + ctx[27].icon)) attr(img, "src", img_src_value); + attr(img, "alt", img_alt_value = /*advancement*/ + ctx[27].title); + attr(div0, "class", "flex0 relative image"); + attr(div1, "class", "flex2"); + attr(div2, "class", "flexrow svelte-gas-a7sibl"); + attr(div2, "data-tooltip", div2_data_tooltip_value = getAdvancementValue( + /*advancement*/ + ctx[27], + "hint" + )); + attr(div2, "data-tooltip-class", "gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip"); + attr(div3, "class", "flexrow svelte-gas-a7sibl"); + attr(li, "class", "left"); + }, + m(target, anchor) { + insert(target, li, anchor); + append(li, div2); + append(div2, div0); + append(div0, img); + append(div2, div1); + append(div1, t); + append(li, div3); + if (switch_instance) mount_component(switch_instance, div3, null); + current = true; + }, + p(ctx2, dirty) { + if (!current || dirty[0] & /*advancementArray*/ + 2 && !src_url_equal(img.src, img_src_value = /*advancement*/ + ctx2[27].icon)) { + attr(img, "src", img_src_value); + } + if (!current || dirty[0] & /*advancementArray*/ + 2 && img_alt_value !== (img_alt_value = /*advancement*/ + ctx2[27].title)) { + attr(img, "alt", img_alt_value); + } + if ((!current || dirty[0] & /*advancementArray*/ + 2) && t_value !== (t_value = /*advancement*/ + ctx2[27].title + "")) set_data(t, t_value); + if (!current || dirty[0] & /*advancementArray*/ + 2 && div2_data_tooltip_value !== (div2_data_tooltip_value = getAdvancementValue( + /*advancement*/ + ctx2[27], + "hint" + ))) { + attr(div2, "data-tooltip", div2_data_tooltip_value); + } + if (dirty[0] & /*advancementComponents, advancementArray*/ + 16386 && switch_value !== (switch_value = /*advancementComponents*/ + ctx2[14][ + /*advancement*/ + ctx2[27].type + ])) { + if (switch_instance) { + group_outros(); + const old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, () => { + destroy_component(old_component, 1); + }); + check_outros(); + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx2)); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, div3, null); + } else { + switch_instance = null; + } + } else if (switch_value) { + const switch_instance_changes = {}; + if (dirty[0] & /*advancementArray*/ + 2) switch_instance_changes.advancement = /*advancement*/ + ctx2[27]; + switch_instance.$set(switch_instance_changes); + } + }, + i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(li); + } + if (switch_instance) destroy_component(switch_instance); + } + }; +} +function create_fragment(ctx) { + let div7; + let div6; + let div3; + let div2; + let div0; + let t; + let div0_class_value; + let div1; + let iconselect; + let updating_value; + let div4; + let div5; + let current; + function iconselect_value_binding(value) { + ctx[20](value); + } + let iconselect_props = { + class: "mb-md icon-select", + options: ( + /*options*/ + ctx[15] + ), + active: ( + /*active*/ + ctx[6] + ), + placeHolder: ( + /*placeHolder*/ + ctx[16] + ), + handler: ( + /*selectHandler*/ + ctx[18] + ), + id: "race-select" + }; + if ( + /*value*/ + ctx[0] !== void 0 + ) { + iconselect_props.value = /*value*/ + ctx[0]; + } + iconselect = new IconSelect({ props: iconselect_props }); + binding_callbacks.push(() => bind(iconselect, "value", iconselect_value_binding)); + let if_block = ( + /*value*/ + ctx[0] && create_if_block(ctx) + ); + return { + c() { + div7 = element("div"); + div6 = element("div"); + div3 = element("div"); + div2 = element("div"); + div0 = element("div"); + t = text("*"); + div1 = element("div"); + create_component(iconselect.$$.fragment); + if (if_block) if_block.c(); + div4 = element("div"); + div4.innerHTML = ``; + div5 = element("div"); + attr(div0, "class", div0_class_value = "flex0 required " + /*$race*/ + (ctx[3] ? "" : "active")); + attr(div1, "class", "flex3"); + attr(div2, "class", "flexrow svelte-gas-a7sibl"); + attr(div3, "class", "flex2 pr-sm col-a"); + attr(div4, "class", "flex0 border-right right-border-gradient-mask"); + attr(div5, "class", "flex3 left pl-md scroll col-b"); + attr(div6, "class", "flexrow svelte-gas-a7sibl"); + attr(div7, "class", "content svelte-gas-a7sibl"); + }, + m(target, anchor) { + insert(target, div7, anchor); + append(div7, div6); + append(div6, div3); + append(div3, div2); + append(div2, div0); + append(div0, t); + append(div2, div1); + mount_component(iconselect, div1, null); + if (if_block) if_block.m(div3, null); + append(div6, div4); + append(div6, div5); + div5.innerHTML = /*richHTML*/ + ctx[7]; + current = true; + }, + p(ctx2, dirty) { + if (!current || dirty[0] & /*$race*/ + 8 && div0_class_value !== (div0_class_value = "flex0 required " + /*$race*/ + (ctx2[3] ? "" : "active"))) { + attr(div0, "class", div0_class_value); + } + const iconselect_changes = {}; + if (dirty[0] & /*options*/ + 32768) iconselect_changes.options = /*options*/ + ctx2[15]; + if (dirty[0] & /*active*/ + 64) iconselect_changes.active = /*active*/ + ctx2[6]; + if (!updating_value && dirty[0] & /*value*/ + 1) { + updating_value = true; + iconselect_changes.value = /*value*/ + ctx2[0]; + add_flush_callback(() => updating_value = false); + } + iconselect.$set(iconselect_changes); + if ( + /*value*/ + ctx2[0] + ) { + if (if_block) { + if_block.p(ctx2, dirty); + if (dirty[0] & /*value*/ + 1) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block(ctx2); + if_block.c(); + transition_in(if_block, 1); + if_block.m(div3, null); + } + } else if (if_block) { + group_outros(); + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + check_outros(); + } + if (!current || dirty[0] & /*richHTML*/ + 128) div5.innerHTML = /*richHTML*/ + ctx2[7]; + }, + i(local) { + if (current) return; + transition_in(iconselect.$$.fragment, local); + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(iconselect.$$.fragment, local); + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div7); + } + destroy_component(iconselect); + if (if_block) if_block.d(); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let options; + let html; + let movement; + let senses; + let advancementComponents; + let filteredMovement; + let filteredSenses; + let units; + let type; + let source; + let book; + let page; + let advancementArray; + let $race; + let $actor; + component_subscribe($$self, race, ($$value) => $$invalidate(3, $race = $$value)); + let active = null, value = null, placeHolder = "Races", richHTML = ""; + let packs = getPacksFromSettings("races"); + let allRaceItems = extractItemsFromPacksSync(packs, ["name->label", "img", "type", "folder", "uuid->value", "_id"]); + game.system.log.d("allRaceItems", allRaceItems); + let raceDefinitions = allRaceItems.filter((x) => x.type == "race").sort((a, b) => a.label.localeCompare(b.label)); + const actor = getContext("#doc"); + component_subscribe($$self, actor, (value2) => $$invalidate(19, $actor = value2)); + const importAdvancements = async () => { + for (const advancement of advancementArray) { + try { + const module = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../../molecules/dnd5e/Advancements/AbilityScoreImprovement.svelte": () => import("./AbilityScoreImprovement-BmB9DNEX.js"), "../../../molecules/dnd5e/Advancements/Feat.svelte": () => import("./Feat-BpFE8O58.js"), "../../../molecules/dnd5e/Advancements/ItemChoice.svelte": () => import("./ItemChoice-CRxi93V_.js"), "../../../molecules/dnd5e/Advancements/ItemGrant.svelte": () => import("./ItemGrant-D2wJNtMk.js"), "../../../molecules/dnd5e/Advancements/ScaleValue.svelte": () => import("./ScaleValue-DYrODTcx.js"), "../../../molecules/dnd5e/Advancements/Size.svelte": () => import("./Size-DhLm1NsB.js"), "../../../molecules/dnd5e/Advancements/Trait.svelte": () => import("./Trait-DtI9SYqp.js") }), `../../../molecules/dnd5e/Advancements/${advancement.type}.svelte`, 7); + $$invalidate(14, advancementComponents[advancement.type] = module.default, advancementComponents); + } catch (error) { + log.e(`Failed to load component for ${advancement.type}:`, error); + } + } + }; + const selectHandler = async (option) => { + set_store_value(race, $race = await fromUuid(option), $race); + $$invalidate(6, active = option); + await tick(); + await importAdvancements(); + $$invalidate(7, richHTML = await TextEditor.enrichHTML(html)); + }; + onMount(async () => { + if ($race) { + $$invalidate(0, value = $race.uuid); + } + await tick(); + await importAdvancements(); + $$invalidate(7, richHTML = await TextEditor.enrichHTML(html)); + }); + function iconselect_value_binding(value$1) { + value = value$1; + $$invalidate(0, value); + } + $$self.$$.update = () => { + if ($$self.$$.dirty[0] & /*$actor*/ + 524288) { + $actor.toObject(); + } + if ($$self.$$.dirty[0] & /*$race*/ + 8) { + html = $race?.system?.description?.value || ""; + } + if ($$self.$$.dirty[0] & /*$race*/ + 8) { + $$invalidate(5, movement = $race?.system?.movement); + } + if ($$self.$$.dirty[0] & /*$race*/ + 8) { + $$invalidate(4, senses = $race?.system?.senses); + } + if ($$self.$$.dirty[0] & /*movement*/ + 32) { + $$invalidate(13, filteredMovement = movement ? Object.keys(movement).filter((key) => key !== "units" && movement[key]).map((key) => ({ label: key, value: movement[key] })) : []); + } + if ($$self.$$.dirty[0] & /*senses*/ + 16) { + $$invalidate(12, filteredSenses = senses ? Object.keys(senses).filter((key) => key !== "units" && senses[key]).map((key) => ({ label: key, value: senses[key] })) : []); + } + if ($$self.$$.dirty[0] & /*$race*/ + 8) { + $$invalidate(11, units = $race?.system?.movement?.units || ""); + } + if ($$self.$$.dirty[0] & /*$race*/ + 8) { + $$invalidate(10, type = $race?.system?.type || ""); + } + if ($$self.$$.dirty[0] & /*$race*/ + 8) { + $$invalidate(2, source = $race?.system?.source || ""); + } + if ($$self.$$.dirty[0] & /*source*/ + 4) { + $$invalidate(9, book = source?.book || ""); + } + if ($$self.$$.dirty[0] & /*source*/ + 4) { + $$invalidate(8, page = source?.page ? ", p. " + source.page : ""); + } + if ($$self.$$.dirty[0] & /*$race*/ + 8) { + $$invalidate(1, advancementArray = $race?.system?.advancement ? $race.system.advancement.filter((value2) => !(value2.type == "Trait" && value2.title == "Dwarven Resilience")) : []); + } + if ($$self.$$.dirty[0] & /*advancementArray*/ + 2) { + game.system.log.d(advancementArray); + } + }; + $$invalidate(15, options = raceDefinitions); + $$invalidate(14, advancementComponents = {}); + return [ + value, + advancementArray, + source, + $race, + senses, + movement, + active, + richHTML, + page, + book, + type, + units, + filteredSenses, + filteredMovement, + advancementComponents, + options, + placeHolder, + actor, + selectHandler, + $actor, + iconselect_value_binding + ]; +} +class Race extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, {}, null, [-1, -1]); + } +} +export { + Race as default +}; +//# sourceMappingURL=Race-CfTxV0Jo.js.map diff --git a/dist/Race-CfTxV0Jo.js.map b/dist/Race-CfTxV0Jo.js.map new file mode 100644 index 0000000..389a8ac --- /dev/null +++ b/dist/Race-CfTxV0Jo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Race-CfTxV0Jo.js","sources":["../src/components/organisms/dnd5e/Tabs/Race.svelte"],"sourcesContent":["\n\n\n\n\n"],"names":["ctx","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;IAuGmV,IAAM,CAAA,KAAA,kBAAA,GAAA;AAAA;;;IAAyG,IAAgB,EAAA,KAAA,kBAAA,GAAA;AAAA;;;IAAmN,IAAc,EAAA,KAAA,kBAAA,GAAA;AAAA;;;IAAyM,IAAgB,CAAA,KAAA,kBAAA,GAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;QAAzjBA,KAAM,CAAA;AAAA,QAAA;;;;;;;;;;;;;;QAAyGA,KAAgB,EAAA;AAAA,QAAA;;;;;;;;;;;;;;QAAmNA,KAAc,EAAA;AAAA,QAAA;;;;;;;;;;;;;;QAAyMA,KAAgB,CAAA;AAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAngB,MAAA;AAAA;AAAA,IAAA,QAAK,QAAQ;AAAA,IAAO,IAAI,EAAA,EAAC,QAAQ;AAAA;;;;;;;;;QAA/C,IAAI,CAAA;AAAA,MAAA;;;;QAAG,IAAI,CAAA;AAAA,MAAA;;;;;;;AAA5C,aAA8F,QAAA,IAAA,MAAA;AAAlE,aAA6D,IAAA,EAAA;;;;;;;;;;;;;QAAxDA,KAAI,CAAA;AAAA,MA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line at end of file diff --git a/dist/Roll-CRZzV30g.js b/dist/Roll-CRZzV30g.js new file mode 100644 index 0000000..bf08431 --- /dev/null +++ b/dist/Roll-CRZzV30g.js @@ -0,0 +1,426 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, z as ensure_array_like, e as element, b as attr, c as insert, d as append, A as noop, j as detach, B as destroy_each, k as component_subscribe, a1 as race, af as abilityRolls, ac as createEventDispatcher, n as getContext, o as onMount, M as MODULE_ID, F as text, Z as listen, a0 as is_function, G as set_data, y as set_store_value } from "./index-DP0Ud7KH.js"; +/* empty css */ +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[14] = list[i]; + child_ctx[16] = i; + return child_ctx; +} +function create_if_block_1(ctx) { + let span; + return { + c() { + span = element("span"); + span.textContent = "+"; + }, + m(target, anchor) { + insert(target, span, anchor); + }, + d(detaching) { + if (detaching) { + detach(span); + } + } + }; +} +function create_if_block(ctx) { + let span; + return { + c() { + span = element("span"); + span.textContent = "+"; + }, + m(target, anchor) { + insert(target, span, anchor); + }, + d(detaching) { + if (detaching) { + detach(span); + } + } + }; +} +function create_each_block(ctx) { + let div6; + let div0; + let t0_value = ( + /*ability*/ + ctx[14][1].label + "" + ); + let t0; + let div1; + let span0; + let t1_value = ( + /*abilityAdvancements*/ + (ctx[0]?.[ + /*ability*/ + ctx[14][1].abbreviation + ] || 0) + "" + ); + let t1; + let div2; + let input; + let input_value_value; + let input_name_value; + let input_id_value; + let div3; + let t2_value = (Number( + /*abilityAdvancements*/ + ctx[0]?.[ + /*ability*/ + ctx[14][1].abbreviation + ] + ) || 0) + Number( + /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.value || 0 + ) + ""; + let t2; + let div4; + let span1; + let t3_value = ( + /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.mod + "" + ); + let t3; + let div5; + let i; + let div5_class_value; + let mounted; + let dispose; + let if_block0 = ( + /*abilityAdvancements*/ + ctx[0]?.[ + /*ability*/ + ctx[14][1].abbreviation + ] > 0 && create_if_block_1() + ); + let if_block1 = ( + /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.mod > 0 && create_if_block() + ); + return { + c() { + div6 = element("div"); + div0 = element("div"); + t0 = text(t0_value); + div1 = element("div"); + if (if_block0) if_block0.c(); + span0 = element("span"); + t1 = text(t1_value); + div2 = element("div"); + input = element("input"); + div3 = element("div"); + t2 = text(t2_value); + div4 = element("div"); + if (if_block1) if_block1.c(); + span1 = element("span"); + t3 = text(t3_value); + div5 = element("div"); + i = element("i"); + attr(div0, "class", "flex2 left"); + attr(div1, "class", "flex1 center align-text-with-input svelte-gas-r2rzbl"); + attr(input, "class", "center small"); + input.disabled = true; + attr(input, "type", "number"); + input.value = input_value_value = /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.value; + attr(input, "name", input_name_value = /*ability*/ + ctx[14][1].abbreviation); + attr(input, "id", input_id_value = /*ability*/ + ctx[14][1].abbreviation); + attr(div2, "class", "flex1 center relative"); + attr(div3, "class", "flex1 center align-text-with-input svelte-gas-r2rzbl"); + attr(div4, "class", "flex1 center align-text-with-input svelte-gas-r2rzbl"); + attr(i, "class", "fas fa-dice"); + attr(div5, "class", div5_class_value = "flex0 center justify-flexrow-vertical controls " + /*$abilityRolls*/ + (ctx[3][ + /*ability*/ + ctx[14][1].abbreviation + ] ? "" : "active") + " svelte-gas-r2rzbl"); + attr(div5, "alt", "Roll"); + attr(div6, "class", "flexrow mb-sm"); + }, + m(target, anchor) { + insert(target, div6, anchor); + append(div6, div0); + append(div0, t0); + append(div6, div1); + if (if_block0) if_block0.m(div1, null); + append(div1, span0); + append(span0, t1); + append(div6, div2); + append(div2, input); + append(div6, div3); + append(div3, t2); + append(div6, div4); + if (if_block1) if_block1.m(div4, null); + append(div4, span1); + append(span1, t3); + append(div6, div5); + append(div5, i); + if (!mounted) { + dispose = listen(div5, "click", function() { + if (is_function( + /*roll*/ + ctx[5]( + /*ability*/ + ctx[14][1].abbreviation + ) + )) ctx[5]( + /*ability*/ + ctx[14][1].abbreviation + ).apply(this, arguments); + }); + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if (dirty & /*systemAbilitiesArray*/ + 2 && t0_value !== (t0_value = /*ability*/ + ctx[14][1].label + "")) set_data(t0, t0_value); + if ( + /*abilityAdvancements*/ + ctx[0]?.[ + /*ability*/ + ctx[14][1].abbreviation + ] > 0 + ) { + if (if_block0) ; + else { + if_block0 = create_if_block_1(); + if_block0.c(); + if_block0.m(div1, span0); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if (dirty & /*abilityAdvancements, systemAbilitiesArray*/ + 3 && t1_value !== (t1_value = /*abilityAdvancements*/ + (ctx[0]?.[ + /*ability*/ + ctx[14][1].abbreviation + ] || 0) + "")) set_data(t1, t1_value); + if (dirty & /*$doc, systemAbilitiesArray*/ + 6 && input_value_value !== (input_value_value = /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.value) && input.value !== input_value_value) { + input.value = input_value_value; + } + if (dirty & /*systemAbilitiesArray*/ + 2 && input_name_value !== (input_name_value = /*ability*/ + ctx[14][1].abbreviation)) { + attr(input, "name", input_name_value); + } + if (dirty & /*systemAbilitiesArray*/ + 2 && input_id_value !== (input_id_value = /*ability*/ + ctx[14][1].abbreviation)) { + attr(input, "id", input_id_value); + } + if (dirty & /*abilityAdvancements, systemAbilitiesArray, $doc*/ + 7 && t2_value !== (t2_value = (Number( + /*abilityAdvancements*/ + ctx[0]?.[ + /*ability*/ + ctx[14][1].abbreviation + ] + ) || 0) + Number( + /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.value || 0 + ) + "")) set_data(t2, t2_value); + if ( + /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.mod > 0 + ) { + if (if_block1) ; + else { + if_block1 = create_if_block(); + if_block1.c(); + if_block1.m(div4, span1); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + if (dirty & /*$doc, systemAbilitiesArray*/ + 6 && t3_value !== (t3_value = /*$doc*/ + ctx[2].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.mod + "")) set_data(t3, t3_value); + if (dirty & /*$abilityRolls, systemAbilitiesArray*/ + 10 && div5_class_value !== (div5_class_value = "flex0 center justify-flexrow-vertical controls " + /*$abilityRolls*/ + (ctx[3][ + /*ability*/ + ctx[14][1].abbreviation + ] ? "" : "active") + " svelte-gas-r2rzbl")) { + attr(div5, "class", div5_class_value); + } + }, + d(detaching) { + if (detaching) { + detach(div6); + } + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + mounted = false; + dispose(); + } + }; +} +function create_fragment(ctx) { + let div6; + let h5; + let div5; + let each_value = ensure_array_like( + /*systemAbilitiesArray*/ + ctx[1] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + return { + c() { + div6 = element("div"); + h5 = element("h5"); + h5.innerHTML = `
Ability
Race / Feat
Base Score
Score
Modifier
`; + div5 = element("div"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(h5, "class", "flexrow mb-sm"); + attr(div5, "class", "indent"); + attr(div6, "class", "attribute-entry mt-sm"); + }, + m(target, anchor) { + insert(target, div6, anchor); + append(div6, h5); + append(div6, div5); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div5, null); + } + } + }, + p(ctx2, [dirty]) { + if (dirty & /*$abilityRolls, systemAbilitiesArray, roll, $doc, Number, abilityAdvancements*/ + 47) { + each_value = ensure_array_like( + /*systemAbilitiesArray*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div5, null); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div6); + } + destroy_each(each_blocks, detaching); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let systemAbilities; + let systemAbilitiesArray; + let abilityAdvancements; + let $race; + let $doc; + let $abilityRolls; + component_subscribe($$self, race, ($$value) => $$invalidate(8, $race = $$value)); + component_subscribe($$self, abilityRolls, ($$value) => $$invalidate(3, $abilityRolls = $$value)); + let { document = false } = $$props; + createEventDispatcher(); + const doc = document || getContext("#doc"); + component_subscribe($$self, doc, (value) => $$invalidate(2, $doc = value)); + let formula; + async function roll(attr2) { + const roll2 = await new Roll(formula).evaluate(); + await roll2.toMessage(); + set_store_value(abilityRolls, $abilityRolls = !$abilityRolls ? {} : $abilityRolls, $abilityRolls); + set_store_value(abilityRolls, $abilityRolls[attr2] = roll2.total, $abilityRolls); + const options = { + system: { + abilities: { [attr2]: { value: Number(roll2.total) } } + } + }; + $doc.updateSource(options); + doc.set($doc); + } + onMount(async () => { + formula = game.settings.get(MODULE_ID, "abiiltyRollFormula"); + }); + $$self.$$set = ($$props2) => { + if ("document" in $$props2) $$invalidate(6, document = $$props2.document); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*systemAbilities*/ + 128) { + $$invalidate(1, systemAbilitiesArray = Object.entries(systemAbilities)); + } + if ($$self.$$.dirty & /*$race*/ + 256) { + $$invalidate(0, abilityAdvancements = $race?.advancement?.byType?.AbilityScoreImprovement?.[0].configuration?.fixed); + } + }; + $$invalidate(7, systemAbilities = game.system.config.abilities); + return [ + abilityAdvancements, + systemAbilitiesArray, + $doc, + $abilityRolls, + doc, + roll, + document, + systemAbilities, + $race + ]; +} +class Roll_1 extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { document: 6 }); + } +} +export { + Roll_1 as default +}; +//# sourceMappingURL=Roll-CRZzV30g.js.map diff --git a/dist/Roll-CRZzV30g.js.map b/dist/Roll-CRZzV30g.js.map new file mode 100644 index 0000000..6967445 --- /dev/null +++ b/dist/Roll-CRZzV30g.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Roll-CRZzV30g.js","sources":["../src/components/molecules/dnd5e/AbilityEntry/Roll.svelte"],"sourcesContent":["\n\n\n\n"],"names":["ctx","attr","roll"],"mappings":";;;;;;;;;;;;;;;;AA+CwjB,aAAc,QAAA,MAAA,MAAA;AAAA;;;;;;;;;;;;;;;;AAAilB,aAAc,QAAA,MAAA,MAAA;AAAA;;;;;;;;;;;;;IAA5uB,IAAO,EAAA,EAAC,CAAC,EAAE,QAAK;AAAA;;;;AAAyI,MAAA;AAAA;AAAA,KAAA;;MAAsB,IAAO,EAAA,EAAC,CAAC,EAAE;AAAA,IAAY,KAAK,KAAC;AAAA;;;;;;;;kBAA4R;AAAA;AAAA,IAAO,IAAmB,CAAA;AAAA;AAAA,MAAG,IAAO,EAAA,EAAC,CAAC,EAAE;AAAA,IAAY;AAAA,EAAA,KAAM,KAAK;AAAA;AAAA,IAAO,IAAI,CAAA,EAAC,OAAO;AAAA;AAAA,MAAU,IAAO,EAAA,EAAC,CAAC,EAAE;AAAA,IAAY,GAAG,SAAS;AAAA,EAAC,IAAA;;;;;;IAAgJ,IAAI,CAAA,EAAC,OAAO;AAAA;AAAA,MAAU,IAAO,EAAA,EAAC,CAAC,EAAE;AAAA,IAAY,GAAG,MAAG;AAAA;;;;;;;AAA/tB,MAAA;AAAA;AAAA,IAAA;;MAAsB,IAAO,EAAA,EAAC,CAAC,EAAE;AAAA,IAAY,IAAI,KAAC,kBAAA;AAAA;AAAwiB,MAAA;AAAA;AAAA,IAAA,IAAK,CAAA,EAAA,OAAO;AAAA;AAAA,MAAU,IAAQ,EAAA,EAAA,CAAC,EAAE;AAAA,IAAY,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;;;;;wCAAJ;AAAA;;;;;;;;;;;;;;;;;;;;;AAxC5U,MAAA,EAAA,WAAW,MAAK,IAAA;AAEV,wBAAqB;AAChC,QAAA,MAAM,YAAY,WAAW,MAAM;;MAErC;AAWW,iBAAA,KAAKC,OAAI;AAChB,UAAAC,QAAiB,MAAA,IAAA,KAAK,OAAO,EAAE,SAAQ;AACvC,UAAAA,MAAK;kCAEX,gBAAa,CAAI,gBAAa,KAAQ,eAAC,aAAA;AACvC,oBAAA,cAAA,cAAcD,KAAI,IAAIC,MAAK,OAAA,aAAA;UAGrB,UAAO;AAAA,MAAI,QAAM;AAAA,QAAG,WAAS,EAAA,CAAKD,KAAI,GAAI,EAAA,OAAO,OAAOC,MAAK,KAAK,IAAA;AAAA;;AACxE,SAAK,aAAa,OAAO;;;AAU3B,UAAO,YAAA;AACL,cAAU,KAAK,SAAS,IAAI,WAAW,oBAAoB;AAAA;;;;;;;sBAL1D,uBAAuB,OAAO,QAAQ,eAAe,CAAA;AAAA;;;AAErD,mBAAA,GAAA,sBAAsB,OAAO,aAAa,QAAQ,0BAA0B,CAAC,EAAE,eAAe,KAAA;AAAA;;AAHhG,eAAA,GAAE,kBAAkB,KAAK,OAAO,OAAO,SAAA;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/ScaleValue-DYrODTcx.js b/dist/ScaleValue-DYrODTcx.js new file mode 100644 index 0000000..45d2b80 --- /dev/null +++ b/dist/ScaleValue-DYrODTcx.js @@ -0,0 +1,21 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, o as onMount } from "./index-DP0Ud7KH.js"; +function instance($$self, $$props, $$invalidate) { + let { advancement = null } = $$props; + onMount(async () => { + console.log("advancement" + advancement.type, advancement); + }); + $$self.$$set = ($$props2) => { + if ("advancement" in $$props2) $$invalidate(0, advancement = $$props2.advancement); + }; + return [advancement]; +} +class ScaleValue extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, null, safe_not_equal, { advancement: 0 }); + } +} +export { + ScaleValue as default +}; +//# sourceMappingURL=ScaleValue-DYrODTcx.js.map diff --git a/dist/ScaleValue-DYrODTcx.js.map b/dist/ScaleValue-DYrODTcx.js.map new file mode 100644 index 0000000..f66c71e --- /dev/null +++ b/dist/ScaleValue-DYrODTcx.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ScaleValue-DYrODTcx.js","sources":["../src/components/molecules/dnd5e/Advancements/ScaleValue.svelte"],"sourcesContent":["\n\n\n\n"],"names":[],"mappings":";;AAGa,MAAA,EAAA,cAAc,KAAI,IAAA;AAE7B,UAAO,YAAA;AACL,YAAQ,IAAI,gBAAc,YAAY,MAAM,WAAW;AAAA;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/Size-DhLm1NsB.js b/dist/Size-DhLm1NsB.js new file mode 100644 index 0000000..ffcb648 --- /dev/null +++ b/dist/Size-DhLm1NsB.js @@ -0,0 +1,276 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, e as element, b as attr, c as insert, A as noop, j as detach, o as onMount, L as getAdvancementValue, a as empty, d as append, F as text, G as set_data, z as ensure_array_like, B as destroy_each } from "./index-DP0Ud7KH.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[2] = list[i]; + return child_ctx; +} +function create_if_block(ctx) { + let div; + let show_if = getAdvancementValue( + /*advancement*/ + ctx[0], + "hint" + ); + let if_block0_anchor; + let if_block0 = show_if && create_if_block_2(ctx); + let if_block1 = ( + /*sizes*/ + ctx[1]?.size > 0 && create_if_block_1(ctx) + ); + return { + c() { + div = element("div"); + if (if_block0) if_block0.c(); + if_block0_anchor = empty(); + if (if_block1) if_block1.c(); + attr(div, "class", "flexrow"); + }, + m(target, anchor) { + insert(target, div, anchor); + if (if_block0) if_block0.m(div, null); + append(div, if_block0_anchor); + if (if_block1) if_block1.m(div, null); + }, + p(ctx2, dirty) { + if (dirty & /*advancement*/ + 1) show_if = getAdvancementValue( + /*advancement*/ + ctx2[0], + "hint" + ); + if (show_if) { + if (if_block0) { + if_block0.p(ctx2, dirty); + } else { + if_block0 = create_if_block_2(ctx2); + if_block0.c(); + if_block0.m(div, if_block0_anchor); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if ( + /*sizes*/ + ctx2[1]?.size > 0 + ) { + if (if_block1) { + if_block1.p(ctx2, dirty); + } else { + if_block1 = create_if_block_1(ctx2); + if_block1.c(); + if_block1.m(div, null); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + }, + d(detaching) { + if (detaching) { + detach(div); + } + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + } + }; +} +function create_if_block_2(ctx) { + let div; + let t_value = getAdvancementValue( + /*advancement*/ + ctx[0], + "hint" + ) + ""; + let t; + return { + c() { + div = element("div"); + t = text(t_value); + attr(div, "class", "flex left"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, t); + }, + p(ctx2, dirty) { + if (dirty & /*advancement*/ + 1 && t_value !== (t_value = getAdvancementValue( + /*advancement*/ + ctx2[0], + "hint" + ) + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} +function create_if_block_1(ctx) { + let div; + let each_value = ensure_array_like( + /*sizes*/ + ctx[1] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + return { + c() { + div = element("div"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(div, "class", "flex0"); + }, + m(target, anchor) { + insert(target, div, anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div, null); + } + } + }, + p(ctx2, dirty) { + if (dirty & /*game, sizes*/ + 2) { + each_value = ensure_array_like( + /*sizes*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div, null); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + }, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_each_block(ctx) { + let div; + let t_value = game.system.config.actorSizes[ + /*size*/ + ctx[2] + ].label + ""; + let t; + return { + c() { + div = element("div"); + t = text(t_value); + attr(div, "class", "flex0 right badge svelte-gas-ecnfij"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, t); + }, + p(ctx2, dirty) { + if (dirty & /*sizes*/ + 2 && t_value !== (t_value = game.system.config.actorSizes[ + /*size*/ + ctx2[2] + ].label + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} +function create_fragment(ctx) { + let div; + let div_data_type_value; + let if_block = ( + /*advancement*/ + ctx[0].title === "Size" && create_if_block(ctx) + ); + return { + c() { + div = element("div"); + if (if_block) if_block.c(); + attr(div, "class", "advancement mt-sm svelte-gas-ecnfij"); + attr(div, "data-type", div_data_type_value = /*advancement*/ + ctx[0].type); + }, + m(target, anchor) { + insert(target, div, anchor); + if (if_block) if_block.m(div, null); + }, + p(ctx2, [dirty]) { + if ( + /*advancement*/ + ctx2[0].title === "Size" + ) { + if (if_block) { + if_block.p(ctx2, dirty); + } else { + if_block = create_if_block(ctx2); + if_block.c(); + if_block.m(div, null); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + if (dirty & /*advancement*/ + 1 && div_data_type_value !== (div_data_type_value = /*advancement*/ + ctx2[0].type)) { + attr(div, "data-type", div_data_type_value); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div); + } + if (if_block) if_block.d(); + } + }; +} +function instance($$self, $$props, $$invalidate) { + let sizes; + let { advancement = null } = $$props; + onMount(async () => { + }); + $$self.$$set = ($$props2) => { + if ("advancement" in $$props2) $$invalidate(0, advancement = $$props2.advancement); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*advancement*/ + 1) { + $$invalidate(1, sizes = advancement.configuration.sizes); + } + }; + return [advancement, sizes]; +} +class Size extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { advancement: 0 }); + } +} +export { + Size as default +}; +//# sourceMappingURL=Size-DhLm1NsB.js.map diff --git a/dist/Size-DhLm1NsB.js.map b/dist/Size-DhLm1NsB.js.map new file mode 100644 index 0000000..f395c43 --- /dev/null +++ b/dist/Size-DhLm1NsB.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Size-DhLm1NsB.js","sources":["../src/components/molecules/dnd5e/Advancements/Size.svelte"],"sourcesContent":["\n\n\n\n"],"names":["ctx"],"mappings":";;;;;;;;gBAe0H;AAAA;AAAA,IAAoB,IAAW,CAAA;AAAA,IAAE;AAAA,EAAM;;;;;IAAmF,IAAK,CAAA,GAAE,OAAO,KAAC,kBAAA,GAAA;AAAA;;;;;;;;;;AAAnK,aAAoT,QAAA,KAAA,MAAA;;;;;;;mBAA1R;AAAA;AAAA,QAAoBA,KAAW,CAAA;AAAA,QAAE;AAAA,MAAM;;;;;;;;;;;;;;;QAAmFA,KAAK,CAAA,GAAE,OAAO;AAAA,QAAC;;;;;;;;;;;;;;;;;;;;;;;;gBAAxE;AAAA;AAAA,IAAoB,IAAW,CAAA;AAAA,IAAE;AAAA,EAAM,IAAA;;;;;;;;;AAA/D,aAAuE,QAAA,KAAA,MAAA;;;;;kCAA/C;AAAA;AAAA,QAAoBA,KAAW,CAAA;AAAA,QAAE;AAAA,MAAM,IAAA,IAAA,UAAA,GAAA,OAAA;AAAA;;;;;;;;;;;;IAA4D,IAAK,CAAA;AAAA,EAAA;;iCAAV,QAAI,KAAA,GAAA;;;;;;;;;;;;AAAzB,aAAqI,QAAA,KAAA,MAAA;;;;;;;;;;;;UAA3GA,KAAK,CAAA;AAAA,QAAA;;mCAAV,QAAI,KAAA,GAAA;;;;;;;;;;;;;wCAAJ;AAAA;;;;;;;;;;;;gBAAmD,KAAK,OAAO,OAAO;AAAA;AAAA,IAAW,IAAI,CAAA;AAAA,EAAA,EAAE,QAAK;;;;;;;;;AAAzE,aAAgF,QAAA,KAAA,MAAA;;;;;kCAAhD,KAAK,OAAO,OAAO;AAAA;AAAA,QAAWA,KAAI,CAAA;AAAA,MAAA,EAAE,QAAK,IAAA,UAAA,GAAA,OAAA;AAAA;;;;;;;;;;;;;IAAlT,IAAW,CAAA,EAAC,UAAU,UAAM,gBAAA,GAAA;AAAA;;;;;;AAApD,WAAA,KAAA,aAAA;AAAA,MAAA,OAAY,IAAI;AAAA;;AAA3D,aAA8Z,QAAA,KAAA,MAAA;;;;;;QAA3VA,KAAW,CAAA,EAAC,UAAU;AAAA,QAAM;;;;;;;;;;;;AAApD,UAAA;AAAA,MAAA,KAAA,yBAAA;AAAA,MAAAA,QAAY,OAAI;;;;;;;;;;;;;;;;AAX9C,MAAA,EAAA,cAAc,KAAI,IAAA;AAI7B,UAAO,YAAA;AAAA;;;;;;;sBAFJ,QAAQ,YAAY,cAAc,KAAK;AAAA;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/Spells-r1-NCKP_.js b/dist/Spells-r1-NCKP_.js new file mode 100644 index 0000000..0f63816 --- /dev/null +++ b/dist/Spells-r1-NCKP_.js @@ -0,0 +1,81 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, e as element, b as attr, c as insert, d as append, A as noop, j as detach, n as getContext, k as component_subscribe, o as onMount, p as getRules, q as tick } from "./index-DP0Ud7KH.js"; +function create_fragment(ctx) { + let div4; + let div3; + let div0; + let div1; + let div2; + return { + c() { + div4 = element("div"); + div3 = element("div"); + div0 = element("div"); + div1 = element("div"); + div1.innerHTML = ``; + div2 = element("div"); + attr(div0, "class", "flex2 pr-sm col-a"); + attr(div1, "class", "flex0 border-right right-border-gradient-mask"); + attr(div2, "class", "flex3 left pl-md scroll col-b"); + attr(div3, "class", "flexrow svelte-gas-lfe2zn"); + attr(div4, "class", "content svelte-gas-lfe2zn"); + }, + m(target, anchor) { + insert(target, div4, anchor); + append(div4, div3); + append(div3, div0); + append(div3, div1); + append(div3, div2); + div2.innerHTML = /*richHTML*/ + ctx[0]; + }, + p(ctx2, [dirty]) { + if (dirty & /*richHTML*/ + 1) div2.innerHTML = /*richHTML*/ + ctx2[0]; + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div4); + } + } + }; +} +function instance($$self, $$props, $$invalidate) { + let html; + let $actor; + const actor = getContext("#doc"); + component_subscribe($$self, actor, (value) => $$invalidate(3, $actor = value)); + const ruleConfig = { + journalId: "QvPDSUsAiEn3hD8s", + pageId: "evx9TWix4wYU51a5" + }; + let rules = "", richHTML = ""; + onMount(async () => { + $$invalidate(2, rules = await getRules(ruleConfig)); + await tick(); + $$invalidate(0, richHTML = await TextEditor.enrichHTML(html)); + }); + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$actor*/ + 8) { + $actor.toObject(); + } + if ($$self.$$.dirty & /*rules*/ + 4) { + html = rules?.content || ""; + } + }; + return [richHTML, actor, rules, $actor]; +} +class Spells extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, {}); + } +} +export { + Spells as default +}; +//# sourceMappingURL=Spells-r1-NCKP_.js.map diff --git a/dist/Spells-r1-NCKP_.js.map b/dist/Spells-r1-NCKP_.js.map new file mode 100644 index 0000000..aa28d91 --- /dev/null +++ b/dist/Spells-r1-NCKP_.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Spells-r1-NCKP_.js","sources":["../src/components/organisms/dnd5e/Tabs/Spells.svelte"],"sourcesContent":["\n \n\n\n"],"names":["ctx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuBA,aAA6N,QAAA,MAAA,MAAA;AAAxM,aAAmM,MAAA,IAAA;AAA9K,aAAqC,MAAA,IAAA;AAAA,aAAkE,MAAA,IAAA;AAAA,aAAiE,MAAA,IAAA;;MAAf,IAAQ,CAAA;AAAA;;;;MAARA,KAAQ,CAAA;AAAA;;;;;;;;;;;;;QAhBnM,QAAQ,WAAW,MAAM;;QACzB,aAAU;AAAA,IAAK,WAAW;AAAA,IAAoB,QAAQ;AAAA;AAExD,MAAA,QAAQ,IAAI,WAAW;AAK3B,UAAO,YAAA;oBACH,QAAK,MAAS,SAAS,UAAU,CAAA;UAC3B,KAAI;AACV,iBAAA,GAAA,WAAiB,MAAA,WAAW,WAAW,IAAI,CAAA;AAAA;;;;AAN9B,aAAO,SAAQ;AAAA;;;AAC7B,aAAO,OAAO,WAAW;AAAA;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/StandardArray-CBELG86I.js b/dist/StandardArray-CBELG86I.js new file mode 100644 index 0000000..6f580f5 --- /dev/null +++ b/dist/StandardArray-CBELG86I.js @@ -0,0 +1,596 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, z as ensure_array_like, e as element, a as empty, b as attr, c as insert, d as append, A as noop, j as detach, B as destroy_each, k as component_subscribe, ah as isStandardArrayValues, a1 as race, af as abilityRolls, ac as createEventDispatcher, n as getContext, o as onMount, y as set_store_value, ai as STANDARD_ARRAY, F as text, G as set_data, Z as listen, ad as Timing, a0 as is_function } from "./index-DP0Ud7KH.js"; +/* empty css */ +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[14] = list[i]; + child_ctx[16] = i; + return child_ctx; +} +function create_if_block_4(ctx) { + let span; + return { + c() { + span = element("span"); + span.textContent = "+"; + }, + m(target, anchor) { + insert(target, span, anchor); + }, + d(detaching) { + if (detaching) { + detach(span); + } + } + }; +} +function create_if_block_3(ctx) { + let i; + let mounted; + let dispose; + return { + c() { + i = element("i"); + attr(i, "class", "fas fa-chevron-up"); + attr(i, "alt", "Decrease"); + }, + m(target, anchor) { + insert(target, i, anchor); + if (!mounted) { + dispose = listen(i, "click", function() { + if (is_function( + /*updateDebounce*/ + ctx[5]( + /*ability*/ + ctx[14][1].abbreviation, + 1 + ) + )) ctx[5]( + /*ability*/ + ctx[14][1].abbreviation, + 1 + ).apply(this, arguments); + }); + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + }, + d(detaching) { + if (detaching) { + detach(i); + } + mounted = false; + dispose(); + } + }; +} +function create_if_block_2(ctx) { + let i; + let mounted; + let dispose; + return { + c() { + i = element("i"); + attr(i, "class", "fas fa-chevron-down"); + attr(i, "alt", "Increase"); + }, + m(target, anchor) { + insert(target, i, anchor); + if (!mounted) { + dispose = listen(i, "click", function() { + if (is_function( + /*updateDebounce*/ + ctx[5]( + /*ability*/ + ctx[14][1].abbreviation, + -1 + ) + )) ctx[5]( + /*ability*/ + ctx[14][1].abbreviation, + -1 + ).apply(this, arguments); + }); + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + }, + d(detaching) { + if (detaching) { + detach(i); + } + mounted = false; + dispose(); + } + }; +} +function create_if_block_1(ctx) { + let span; + return { + c() { + span = element("span"); + span.textContent = "+"; + }, + m(target, anchor) { + insert(target, span, anchor); + }, + d(detaching) { + if (detaching) { + detach(span); + } + } + }; +} +function create_each_block(ctx) { + let div8; + let div0; + let t0_value = ( + /*ability*/ + ctx[14][1].label + "" + ); + let t0; + let div1; + let span0; + let t1_value = ( + /*abilityAdvancements*/ + (ctx[2]?.[ + /*ability*/ + ctx[14][1].abbreviation + ] || 0) + "" + ); + let t1; + let div5; + let input; + let input_value_value; + let div4; + let div2; + let div3; + let div6; + let t2_value = (Number( + /*abilityAdvancements*/ + ctx[2]?.[ + /*ability*/ + ctx[14][1].abbreviation + ] + ) || 0) + Number( + /*$doc*/ + ctx[1].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.value || 0 + ) + ""; + let t2; + let div7; + let span1; + let t3_value = ( + /*$doc*/ + ctx[1].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.mod + "" + ); + let t3; + let if_block0 = ( + /*abilityAdvancements*/ + ctx[2]?.[ + /*ability*/ + ctx[14][1].abbreviation + ] > 0 && create_if_block_4() + ); + let if_block1 = ( + /*index*/ + ctx[16] != 0 && create_if_block_3(ctx) + ); + let if_block2 = ( + /*index*/ + ctx[16] != 5 && create_if_block_2(ctx) + ); + let if_block3 = ( + /*$doc*/ + ctx[1].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.mod > 0 && create_if_block_1() + ); + return { + c() { + div8 = element("div"); + div0 = element("div"); + t0 = text(t0_value); + div1 = element("div"); + if (if_block0) if_block0.c(); + span0 = element("span"); + t1 = text(t1_value); + div5 = element("div"); + input = element("input"); + div4 = element("div"); + div2 = element("div"); + if (if_block1) if_block1.c(); + div3 = element("div"); + if (if_block2) if_block2.c(); + div6 = element("div"); + t2 = text(t2_value); + div7 = element("div"); + if (if_block3) if_block3.c(); + span1 = element("span"); + t3 = text(t3_value); + attr(div0, "class", "flex2 left"); + attr(div1, "class", "flex1 center align-text-with-input svelte-gas-1i9wvmn"); + attr(input, "class", "left small mainscore svelte-gas-1i9wvmn"); + input.disabled = true; + attr(input, "type", "number"); + input.value = input_value_value = /*$doc*/ + ctx[1].system.abilities[ + /*ability*/ + ctx[14][1].abbreviation + ]?.value; + attr(div2, "class", "up chevron svelte-gas-1i9wvmn"); + attr(div3, "class", "down chevron svelte-gas-1i9wvmn"); + attr(div4, "class", "controls svelte-gas-1i9wvmn"); + attr(div5, "class", "flex1 center relative"); + attr(div6, "class", "flex1 center align-text-with-input svelte-gas-1i9wvmn"); + attr(div7, "class", "flex1 center align-text-with-input svelte-gas-1i9wvmn"); + attr(div8, "class", "flexrow mb-sm"); + }, + m(target, anchor) { + insert(target, div8, anchor); + append(div8, div0); + append(div0, t0); + append(div8, div1); + if (if_block0) if_block0.m(div1, null); + append(div1, span0); + append(span0, t1); + append(div8, div5); + append(div5, input); + append(div5, div4); + append(div4, div2); + if (if_block1) if_block1.m(div2, null); + append(div4, div3); + if (if_block2) if_block2.m(div3, null); + append(div8, div6); + append(div6, t2); + append(div8, div7); + if (if_block3) if_block3.m(div7, null); + append(div7, span1); + append(span1, t3); + }, + p(ctx2, dirty) { + if (dirty & /*systemAbilitiesArray*/ + 1 && t0_value !== (t0_value = /*ability*/ + ctx2[14][1].label + "")) set_data(t0, t0_value); + if ( + /*abilityAdvancements*/ + ctx2[2]?.[ + /*ability*/ + ctx2[14][1].abbreviation + ] > 0 + ) { + if (if_block0) ; + else { + if_block0 = create_if_block_4(); + if_block0.c(); + if_block0.m(div1, span0); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if (dirty & /*abilityAdvancements, systemAbilitiesArray*/ + 5 && t1_value !== (t1_value = /*abilityAdvancements*/ + (ctx2[2]?.[ + /*ability*/ + ctx2[14][1].abbreviation + ] || 0) + "")) set_data(t1, t1_value); + if (dirty & /*$doc, systemAbilitiesArray*/ + 3 && input_value_value !== (input_value_value = /*$doc*/ + ctx2[1].system.abilities[ + /*ability*/ + ctx2[14][1].abbreviation + ]?.value) && input.value !== input_value_value) { + input.value = input_value_value; + } + if ( + /*index*/ + ctx2[16] != 0 + ) if_block1.p(ctx2, dirty); + if ( + /*index*/ + ctx2[16] != 5 + ) if_block2.p(ctx2, dirty); + if (dirty & /*abilityAdvancements, systemAbilitiesArray, $doc*/ + 7 && t2_value !== (t2_value = (Number( + /*abilityAdvancements*/ + ctx2[2]?.[ + /*ability*/ + ctx2[14][1].abbreviation + ] + ) || 0) + Number( + /*$doc*/ + ctx2[1].system.abilities[ + /*ability*/ + ctx2[14][1].abbreviation + ]?.value || 0 + ) + "")) set_data(t2, t2_value); + if ( + /*$doc*/ + ctx2[1].system.abilities[ + /*ability*/ + ctx2[14][1].abbreviation + ]?.mod > 0 + ) { + if (if_block3) ; + else { + if_block3 = create_if_block_1(); + if_block3.c(); + if_block3.m(div7, span1); + } + } else if (if_block3) { + if_block3.d(1); + if_block3 = null; + } + if (dirty & /*$doc, systemAbilitiesArray*/ + 3 && t3_value !== (t3_value = /*$doc*/ + ctx2[1].system.abilities[ + /*ability*/ + ctx2[14][1].abbreviation + ]?.mod + "")) set_data(t3, t3_value); + }, + d(detaching) { + if (detaching) { + detach(div8); + } + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + if (if_block2) if_block2.d(); + if (if_block3) if_block3.d(); + } + }; +} +function create_if_block(ctx) { + let hr; + let button; + let mounted; + let dispose; + return { + c() { + hr = element("hr"); + button = element("button"); + button.textContent = "Reset to Standard Array"; + attr(button, "class", "btn btn-primary"); + }, + m(target, anchor) { + insert(target, hr, anchor); + insert(target, button, anchor); + if (!mounted) { + dispose = listen( + button, + "click", + /*reset*/ + ctx[6] + ); + mounted = true; + } + }, + p: noop, + d(detaching) { + if (detaching) { + detach(hr); + detach(button); + } + mounted = false; + dispose(); + } + }; +} +function create_fragment(ctx) { + let div6; + let h5; + let div5; + let each_1_anchor; + let each_value = ensure_array_like( + /*systemAbilitiesArray*/ + ctx[0] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + let if_block = !/*$isStandardArrayValues*/ + ctx[3] && create_if_block(ctx); + return { + c() { + div6 = element("div"); + h5 = element("h5"); + h5.innerHTML = `
Ability
Race / Feat
Base Score
Score
Modifier
`; + div5 = element("div"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + each_1_anchor = empty(); + if (if_block) if_block.c(); + attr(h5, "class", "flexrow mb-sm"); + attr(div5, "class", "indent"); + attr(div6, "class", "attribute-entry mt-sm"); + }, + m(target, anchor) { + insert(target, div6, anchor); + append(div6, h5); + append(div6, div5); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div5, null); + } + } + append(div5, each_1_anchor); + if (if_block) if_block.m(div5, null); + }, + p(ctx2, [dirty]) { + if (dirty & /*$doc, systemAbilitiesArray, Number, abilityAdvancements, updateDebounce*/ + 39) { + each_value = ensure_array_like( + /*systemAbilitiesArray*/ + ctx2[0] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(div5, each_1_anchor); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + if (!/*$isStandardArrayValues*/ + ctx2[3]) { + if (if_block) { + if_block.p(ctx2, dirty); + } else { + if_block = create_if_block(ctx2); + if_block.c(); + if_block.m(div5, null); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div6); + } + destroy_each(each_blocks, detaching); + if (if_block) if_block.d(); + } + }; +} +function arraysMatch(array1, array2) { + if (array1.length !== array2.length) return false; + const sortedArray1 = array1.slice().sort((a, b) => a - b); + const sortedArray2 = array2.slice().sort((a, b) => a - b); + return sortedArray1.every((value, index) => value === sortedArray2[index]); +} +function instance($$self, $$props, $$invalidate) { + let systemAbilities; + let systemAbilitiesArray; + let abilityAdvancements; + let $doc; + let $isStandardArrayValues; + let $race; + let $abilityRolls; + component_subscribe($$self, isStandardArrayValues, ($$value) => $$invalidate(3, $isStandardArrayValues = $$value)); + component_subscribe($$self, race, ($$value) => $$invalidate(9, $race = $$value)); + component_subscribe($$self, abilityRolls, ($$value) => $$invalidate(11, $abilityRolls = $$value)); + let { document = false } = $$props; + createEventDispatcher(); + const doc = document || getContext("#doc"); + component_subscribe($$self, doc, (value) => $$invalidate(1, $doc = value)); + const updateDebounce = Timing.debounce(updateValue, 100); + async function updateValue(attr2, value) { + const abilities = Object.keys(STANDARD_ARRAY); + const index = abilities.indexOf(attr2); + switch (value) { + case -1: + if (index < abilities.length - 1) { + const nextAbility = abilities[index + 1]; + const options = { + system: { + abilities: { + [attr2]: { + value: $doc.system.abilities[nextAbility].value + }, + [nextAbility]: { value: $doc.system.abilities[attr2].value } + } + } + }; + await $doc.updateSource(options); + doc.set($doc); + } + break; + default: + if (index > 0) { + const nextAbility = abilities[index - 1]; + const options = { + system: { + abilities: { + [attr2]: { + value: $doc.system.abilities[nextAbility].value + }, + [nextAbility]: { value: $doc.system.abilities[attr2].value } + } + } + }; + await $doc.updateSource(options); + doc.set($doc); + } + break; + } + } + function reset() { + set_store_value(abilityRolls, $abilityRolls = {}, $abilityRolls); + const options = { system: { abilities: {} } }; + systemAbilitiesArray.forEach((ability) => { + options.system.abilities[ability[1].abbreviation] = { + value: STANDARD_ARRAY[ability[1].abbreviation] + }; + }); + $doc.updateSource(options); + doc.set($doc); + } + onMount(async () => { + if (systemAbilitiesArray.every((ability) => $doc.system.abilities[ability[1].abbreviation]?.value === 10)) { + reset(); + } + }); + $$self.$$set = ($$props2) => { + if ("document" in $$props2) $$invalidate(7, document = $$props2.document); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*systemAbilities*/ + 256) { + $$invalidate(0, systemAbilitiesArray = Object.entries(systemAbilities)); + } + if ($$self.$$.dirty & /*$race*/ + 512) { + $$invalidate(2, abilityAdvancements = $race?.advancement?.byType?.AbilityScoreImprovement?.[0].configuration?.fixed); + } + if ($$self.$$.dirty & /*systemAbilitiesArray, $doc*/ + 3) { + set_store_value(isStandardArrayValues, $isStandardArrayValues = arraysMatch(Object.values(STANDARD_ARRAY), systemAbilitiesArray.map((ability) => $doc.system.abilities[ability[1].abbreviation]?.value)), $isStandardArrayValues); + } + }; + $$invalidate(8, systemAbilities = game.system.config.abilities); + return [ + systemAbilitiesArray, + $doc, + abilityAdvancements, + $isStandardArrayValues, + doc, + updateDebounce, + reset, + document, + systemAbilities, + $race + ]; +} +class StandardArray extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { document: 7 }); + } +} +export { + StandardArray as default +}; +//# sourceMappingURL=StandardArray-CBELG86I.js.map diff --git a/dist/StandardArray-CBELG86I.js.map b/dist/StandardArray-CBELG86I.js.map new file mode 100644 index 0000000..a87ca3f --- /dev/null +++ b/dist/StandardArray-CBELG86I.js.map @@ -0,0 +1 @@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AK,OAAO,KAAK,OAAO,UAAUA,KAAI,EAAE,MAAK;AAAA;;;gBAKzD,KAAK,aAAa,OAAO;;;;;;WAY9B,QAAK;kCACZ,gBAAa,CAAA,GAAA,aAAA;UAEP,UAAO,EAAK,QAAM,EAAI,WAAS,CAAA,EAAA,EAAA;AACrC,yBAAqB,QAAS,aAAO;AACnC,cAAQ,OAAO,UAAU,QAAQ,CAAC,EAAE,YAAY,IAAA;AAAA,QAC9C,OAAO,eAAe,QAAQ,CAAC,EAAE,YAAY;AAAA;;AAGjD,SAAK,aAAa,OAAO;;;AAyC3B,UAAO,YAAA;AAMH,QAAA,qBAAqB,MAClB,aACC,KAAK,OAAO,UAAU,QAAQ,CAAC,EAAE,YAAY,GAAG,UAAU,EAAE,GAAA;AAGhE;;;;;;;;;sBAtCD,uBAAuB,OAAO,QAAQ,eAAe,CAAA;AAAA;;;AAErD,mBAAA,GAAA,sBACD,OAAO,aAAa,QAAQ,0BAA0B,CAAC,EAAE,eACrD,KAAK;AAAA;;;AAOR,sBAAA,uBAAA,yBAAyB,YAC1B,OAAO,OAAO,cAAc,GAC5B,qBAAqB,IAClB,aAAY,KAAK,OAAO,UAAU,QAAQ,CAAC,EAAE,YAAY,GAAG,KAAK,CAAA,GAAA,sBAAA;AAAA;;AAfrE,eAAA,GAAE,kBAAkB,KAAK,OAAO,OAAO,SAAS;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/Trait-DtI9SYqp.js b/dist/Trait-DtI9SYqp.js new file mode 100644 index 0000000..40c90ff --- /dev/null +++ b/dist/Trait-DtI9SYqp.js @@ -0,0 +1,668 @@ +import { S as SvelteComponent, i as init, s as safe_not_equal, e as element, a as empty, b as attr, c as insert, d as append, A as noop, j as detach, o as onMount, z as ensure_array_like, B as destroy_each, F as text, G as set_data, Y as ucfirst, an as writable } from "./index-DP0Ud7KH.js"; +function get_each_context(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[9] = list[i]; + return child_ctx; +} +function get_each_context_1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[12] = list[i]; + return child_ctx; +} +function get_each_context_2(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[15] = list[i]; + return child_ctx; +} +function create_if_block_4(ctx) { + let each_1_anchor; + let each_value_2 = ensure_array_like( + /*grants*/ + ctx[1] + ); + let each_blocks = []; + for (let i = 0; i < each_value_2.length; i += 1) { + each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i)); + } + return { + c() { + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + each_1_anchor = empty(); + }, + m(target, anchor) { + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(target, anchor); + } + } + insert(target, each_1_anchor, anchor); + }, + p(ctx2, dirty) { + if (dirty & /*grants*/ + 2) { + each_value_2 = ensure_array_like( + /*grants*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value_2.length; i += 1) { + const child_ctx = get_each_context_2(ctx2, each_value_2, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_2(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value_2.length; + } + }, + d(detaching) { + if (detaching) { + detach(each_1_anchor); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_if_block_5(ctx) { + let div; + let t_value = ( + /*grant*/ + ctx[15].value + "" + ); + let t; + return { + c() { + div = element("div"); + t = text(t_value); + attr(div, "class", "flex0 right badge inset nowrap svelte-gas-1ytcpk3"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, t); + }, + p(ctx2, dirty) { + if (dirty & /*grants*/ + 2 && t_value !== (t_value = /*grant*/ + ctx2[15].value + "")) set_data(t, t_value); + }, + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} +function create_each_block_2(ctx) { + let div1; + let div0; + let t_value = ( + /*grant*/ + ctx[15].label + "" + ); + let t; + let if_block = ( + /*grant*/ + ctx[15].value && create_if_block_5(ctx) + ); + return { + c() { + div1 = element("div"); + div0 = element("div"); + t = text(t_value); + if (if_block) if_block.c(); + attr(div0, "class", "flex left"); + attr(div1, "class", "flexrow"); + }, + m(target, anchor) { + insert(target, div1, anchor); + append(div1, div0); + append(div0, t); + if (if_block) if_block.m(div1, null); + }, + p(ctx2, dirty) { + if (dirty & /*grants*/ + 2 && t_value !== (t_value = /*grant*/ + ctx2[15].label + "")) set_data(t, t_value); + if ( + /*grant*/ + ctx2[15].value + ) { + if (if_block) { + if_block.p(ctx2, dirty); + } else { + if_block = create_if_block_5(ctx2); + if_block.c(); + if_block.m(div1, null); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + }, + d(detaching) { + if (detaching) { + detach(div1); + } + if (if_block) if_block.d(); + } + }; +} +function create_if_block(ctx) { + let each_1_anchor; + let each_value = ensure_array_like( + /*choices*/ + ctx[3] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); + } + return { + c() { + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + each_1_anchor = empty(); + }, + m(target, anchor) { + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(target, anchor); + } + } + insert(target, each_1_anchor, anchor); + }, + p(ctx2, dirty) { + if (dirty & /*choices, game, fromAll*/ + 12) { + each_value = ensure_array_like( + /*choices*/ + ctx2[3] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value.length; + } + }, + d(detaching) { + if (detaching) { + detach(each_1_anchor); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_else_block_1(ctx) { + let div2; + let div0; + let span0; + let span1; + let div1; + return { + c() { + div2 = element("div"); + div0 = element("div"); + span0 = element("span"); + span0.textContent = "Choose "; + span1 = element("span"); + span1.textContent = `${/*choice*/ + ctx[9].count} `; + div1 = element("div"); + div1.textContent = "any"; + attr(div0, "class", "flex"); + attr(div1, "class", "flex0 badge inset right svelte-gas-1ytcpk3"); + attr(div2, "class", "flexrow"); + }, + m(target, anchor) { + insert(target, div2, anchor); + append(div2, div0); + append(div0, span0); + append(div0, span1); + append(div2, div1); + }, + p: noop, + d(detaching) { + if (detaching) { + detach(div2); + } + } + }; +} +function create_if_block_1(ctx) { + let div; + let h3; + let span0; + let span1; + let span2; + let each_1_anchor; + let each_value_1 = ensure_array_like( + /*choice*/ + ctx[9].pool + ); + let each_blocks = []; + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); + } + return { + c() { + div = element("div"); + h3 = element("h3"); + span0 = element("span"); + span0.textContent = "Choose "; + span1 = element("span"); + span1.textContent = ` ${/*choice*/ + ctx[9].count}  `; + span2 = element("span"); + span2.textContent = "of the following:"; + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + each_1_anchor = empty(); + attr(h3, "class", "flex"); + attr(div, "class", "flexrow"); + }, + m(target, anchor) { + insert(target, div, anchor); + append(div, h3); + append(h3, span0); + append(h3, span1); + append(h3, span2); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(target, anchor); + } + } + insert(target, each_1_anchor, anchor); + }, + p(ctx2, dirty) { + if (dirty & /*game, choices*/ + 8) { + each_value_1 = ensure_array_like( + /*choice*/ + ctx2[9].pool + ); + let i; + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1(ctx2, each_value_1, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + } else { + each_blocks[i] = create_each_block_1(child_ctx); + each_blocks[i].c(); + each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); + } + } + for (; i < each_blocks.length; i += 1) { + each_blocks[i].d(1); + } + each_blocks.length = each_value_1.length; + } + }, + d(detaching) { + if (detaching) { + detach(div); + detach(each_1_anchor); + } + destroy_each(each_blocks, detaching); + } + }; +} +function create_if_block_2(ctx) { + let if_block_anchor; + function select_block_type_1(ctx2, dirty) { + if ( + /*pool*/ + ctx2[12].type == "tool" + ) return create_if_block_3; + return create_else_block; + } + let current_block_type = select_block_type_1(ctx); + let if_block = current_block_type(ctx); + return { + c() { + if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p(ctx2, dirty) { + if_block.p(ctx2, dirty); + }, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if_block.d(detaching); + } + }; +} +function create_else_block(ctx) { + let div; + return { + c() { + div = element("div"); + div.textContent = `${ucfirst( + /*pool*/ + ctx[12].value + )}`; + attr(div, "class", "flex0 right badge inset svelte-gas-1ytcpk3"); + }, + m(target, anchor) { + insert(target, div, anchor); + }, + p: noop, + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} +function create_if_block_3(ctx) { + let div; + return { + c() { + div = element("div"); + div.textContent = `${game.system.config.toolProficiencies[ + /*pool*/ + ctx[12].value + ]}`; + attr(div, "class", "flex0 right badge inset nowrap svelte-gas-1ytcpk3"); + }, + m(target, anchor) { + insert(target, div, anchor); + }, + p: noop, + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} +function create_each_block_1(ctx) { + let div1; + let div0; + let if_block = ( + /*pool*/ + ctx[12].value && create_if_block_2(ctx) + ); + return { + c() { + div1 = element("div"); + div0 = element("div"); + div0.textContent = `${/*pool*/ + ctx[12].label}`; + if (if_block) if_block.c(); + attr(div0, "class", "flex left"); + attr(div1, "class", "flexrow"); + }, + m(target, anchor) { + insert(target, div1, anchor); + append(div1, div0); + if (if_block) if_block.m(div1, null); + }, + p(ctx2, dirty) { + if ( + /*pool*/ + ctx2[12].value + ) if_block.p(ctx2, dirty); + }, + d(detaching) { + if (detaching) { + detach(div1); + } + if (if_block) if_block.d(); + } + }; +} +function create_each_block(ctx) { + let if_block_anchor; + function select_block_type(ctx2, dirty) { + if (!/*fromAll*/ + ctx2[2]( + /*choice*/ + ctx2[9].pool + )) return create_if_block_1; + return create_else_block_1; + } + let current_block_type = select_block_type(ctx); + let if_block = current_block_type(ctx); + return { + c() { + if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + }, + p(ctx2, dirty) { + if_block.p(ctx2, dirty); + }, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if_block.d(detaching); + } + }; +} +function create_fragment(ctx) { + let div; + let if_block0_anchor; + let div_data_type_value; + let if_block0 = ( + /*grants*/ + ctx[1].length > 0 && create_if_block_4(ctx) + ); + let if_block1 = ( + /*choices*/ + ctx[3].length > 0 && create_if_block(ctx) + ); + return { + c() { + div = element("div"); + if (if_block0) if_block0.c(); + if_block0_anchor = empty(); + if (if_block1) if_block1.c(); + attr(div, "class", "advancement mt-sm svelte-gas-1ytcpk3"); + attr(div, "data-type", div_data_type_value = /*advancement*/ + ctx[0].type); + }, + m(target, anchor) { + insert(target, div, anchor); + if (if_block0) if_block0.m(div, null); + append(div, if_block0_anchor); + if (if_block1) if_block1.m(div, null); + }, + p(ctx2, [dirty]) { + if ( + /*grants*/ + ctx2[1].length > 0 + ) { + if (if_block0) { + if_block0.p(ctx2, dirty); + } else { + if_block0 = create_if_block_4(ctx2); + if_block0.c(); + if_block0.m(div, if_block0_anchor); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if ( + /*choices*/ + ctx2[3].length > 0 + ) if_block1.p(ctx2, dirty); + if (dirty & /*advancement*/ + 1 && div_data_type_value !== (div_data_type_value = /*advancement*/ + ctx2[0].type)) { + attr(div, "data-type", div_data_type_value); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div); + } + if (if_block0) if_block0.d(); + if (if_block1) if_block1.d(); + } + }; +} +function getBaseItemUUID(identifier) { + if (!identifier) { + return null; + } + game.system.log.d("identifier", identifier); + let pack = CONFIG.DND5E.sourcePacks.ITEMS; + let [scope, collection, id] = identifier.split("."); + if (scope && collection) pack = `${scope}.${collection}`; + if (!id) id = identifier; + return `Compendium.${pack}.Item.${id}`; +} +function instance($$self, $$props, $$invalidate) { + let { advancement = null } = $$props; + let grants = []; + const morphPool = (p) => { + const arr = Array.from(p); + const nuarr = arr.map((x) => { + const split = x.split(":"); + if (split[2]) { + return { + all: false, + label: split[2], + value: split[1], + type: split[0] + }; + } + return { + all: true, + label: split[0], + value: split[1] + }; + }); + return nuarr; + }; + const fromAll = (p) => { + return p.some((x) => { + return x.all; + }); + }; + let choices = advancement.configuration.choices.map((c) => { + return { count: c.count, pool: morphPool(c.pool) }; + }); + const item = writable(null); + const fetchAndSetItem = async (uuid) => { + const itemObj = await fromUuid(uuid); + item.set(itemObj); + }; + const processGrant = async (grant) => { + const split = grant.split(":"); + switch (split[0]) { + case "languages": + return { + label: ucfirst(split[1]), + value: ucfirst(split[2]) + }; + case "tool": + if (split[2]) { + return { + label: ucfirst(split[2]), + value: game.system.config.toolProficiencies[split[1]] + }; + } else { + const uuid = getBaseItemUUID(CONFIG.DND5E.toolIds[split[1]]); + await fetchAndSetItem(uuid); + let fetchedItem; + item.subscribe((value) => { + fetchedItem = value; + })(); + return { + label: fetchedItem?.name, + value: game.system.config.toolProficiencies[split[1]] + }; + } + case "saves": + return { + label: game.system.config.abilities[split[1]].label, + value: null + }; + case "armor": + return { + label: game.system.config.armorProficiencies[split[1]], + value: null + }; + case "weapon": + if (split[2]) { + return { + label: ucfirst(split[2]), + value: game.system.config.weaponProficiencies[split[1]] + }; + } else { + return { + label: game.system.config.weaponProficiencies[split[1]], + value: null + }; + } + case "dr": + return { + label: game.system.config.damageTypes[split[1]].label, + value: split[1] + }; + default: + return { + label: game.system.config[split[0]][split[1]].label, + value: "" + }; + } + }; + const initializeGrants = async () => { + const grantPromises = Array.from(advancement.configuration.grants).map(processGrant); + $$invalidate(1, grants = await Promise.all(grantPromises)); + }; + onMount(async () => { + if (advancement.configuration.grants.size > 0) { + await initializeGrants(); + } + }); + $$self.$$set = ($$props2) => { + if ("advancement" in $$props2) $$invalidate(0, advancement = $$props2.advancement); + }; + return [advancement, grants, fromAll, choices]; +} +class Trait extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance, create_fragment, safe_not_equal, { advancement: 0 }); + } +} +export { + Trait as default +}; +//# sourceMappingURL=Trait-DtI9SYqp.js.map diff --git a/dist/Trait-DtI9SYqp.js.map b/dist/Trait-DtI9SYqp.js.map new file mode 100644 index 0000000..8df1421 --- /dev/null +++ b/dist/Trait-DtI9SYqp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Trait-DtI9SYqp.js","sources":["../src/components/molecules/dnd5e/Advancements/Trait.svelte"],"sourcesContent":["\n\n\n\n \n "],"names":["ctx"],"mappings":";;;;;;;;;;;;;;;;;;;;IA8G4F,IAAM,CAAA;AAAA,EAAA;;mCAAX,QAAI,KAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;UAACA,KAAM,CAAA;AAAA,QAAA;;qCAAX,QAAI,KAAA,GAAA;;;;;;;;;;;;;0CAAJ;AAAA;;;;;;;;;;;;AAAkJ,MAAA;AAAA;AAAA,IAAA,QAAM,QAAK;AAAA;;;;;;;;;AAAxD,aAA+D,QAAA,KAAA,MAAA;;;;AAAlB,UAAA;AAAA,MAAA,KAAA,aAAA;AAAA,MAAAA,SAAM,QAAK,IAAA,UAAA,GAAA,OAAA;AAAA;;;;;;;;;;;AAA3F,MAAA;AAAA;AAAA,IAAA,QAAM,QAAK;AAAA;;AAAY,MAAA;AAAA;AAAA,IAAA,QAAM,SAAK,kBAAA,GAAA;AAAA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0BAAc;AAAA;;YAEP,OAAO,aAAa;AAAA,YAAM,OAAO,KAAK,OAAO,OAAO,kBAAkB,MAAM,CAAC,CAAA;AAAA;;WAErF;;UACM,OAAO,KAAK,OAAO,OAAO,UAAU,MAAM,CAAC,GAAG;AAAA,UAAO,OAAO;AAAA;WAClE;;UACM,OAAO,KAAK,OAAO,OAAO,mBAAmB,MAAM,CAAC,CAAA;AAAA,UAAI,OAAO;AAAA;WACrE;AACA,YAAA,MAAM,CAAC,GAAA;;YACC,OAAO,QAAQ,MAAM,CAAC,CAAA;AAAA,YAAI,OAAO,KAAK,OAAO,OAAO,oBAAoB,MAAM,CAAC,CAAA;AAAA;;;YAE/E,OAAO,KAAK,OAAO,OAAO,oBAAoB,MAAM,CAAC,CAAA;AAAA,YAAI,OAAO;AAAA;;WAExE;;UACM,OAAO,KAAK,OAAO,OAAO,YAAY,MAAM,CAAC,GAAG;AAAA,UAAO,OAAO,MAAM,CAAC;AAAA;;;UAG5E,OAAO,KAAK,OAAO,OAAO,MAAM,CAAC,CAAG,EAAA,MAAM,CAAC,GAAG;AAAA,UAC9C,OAAO;AAAA;;;QAKT,mBAAgB,YAAA;AAEd,UAAA,gBAAgB,MAAM,KAAK,YAAY,cAAc,MAAM,EAAE,IAAI,YAAY;AACnF,iBAAA,GAAA,SAAe,MAAA,QAAQ,IAAI,aAAa,CAAA;AAAA;AAI1C,UAAO,YAAA;AAED,QAAA,YAAY,cAAc,OAAO,OAAO,GAAC;YACrC,iBAAgB;AAAA;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/await_block-DTNqOtSu.js b/dist/await_block-DTNqOtSu.js new file mode 100644 index 0000000..4206954 --- /dev/null +++ b/dist/await_block-DTNqOtSu.js @@ -0,0 +1,86 @@ +import { aj as is_promise, ak as get_current_component, al as set_current_component, g as group_outros, t as transition_out, f as check_outros, h as transition_in, am as flush } from "./index-DP0Ud7KH.js"; +function handle_promise(promise, info) { + const token = info.token = {}; + function update(type, index, key, value) { + if (info.token !== token) return; + info.resolved = value; + let child_ctx = info.ctx; + if (key !== void 0) { + child_ctx = child_ctx.slice(); + child_ctx[key] = value; + } + const block = type && (info.current = type)(child_ctx); + let needs_flush = false; + if (info.block) { + if (info.blocks) { + info.blocks.forEach((block2, i) => { + if (i !== index && block2) { + group_outros(); + transition_out(block2, 1, 1, () => { + if (info.blocks[i] === block2) { + info.blocks[i] = null; + } + }); + check_outros(); + } + }); + } else { + info.block.d(1); + } + block.c(); + transition_in(block, 1); + block.m(info.mount(), info.anchor); + needs_flush = true; + } + info.block = block; + if (info.blocks) info.blocks[index] = block; + if (needs_flush) { + flush(); + } + } + if (is_promise(promise)) { + const current_component = get_current_component(); + promise.then( + (value) => { + set_current_component(current_component); + update(info.then, 1, info.value, value); + set_current_component(null); + }, + (error) => { + set_current_component(current_component); + update(info.catch, 2, info.error, error); + set_current_component(null); + if (!info.hasCatch) { + throw error; + } + } + ); + if (info.current !== info.pending) { + update(info.pending, 0); + return true; + } + } else { + if (info.current !== info.then) { + update(info.then, 1, info.value, promise); + return true; + } + info.resolved = /** @type {T} */ + promise; + } +} +function update_await_block_branch(info, ctx, dirty) { + const child_ctx = ctx.slice(); + const { resolved } = info; + if (info.current === info.then) { + child_ctx[info.value] = resolved; + } + if (info.current === info.catch) { + child_ctx[info.error] = resolved; + } + info.block.p(child_ctx, dirty); +} +export { + handle_promise as h, + update_await_block_branch as u +}; +//# sourceMappingURL=await_block-DTNqOtSu.js.map diff --git a/dist/await_block-DTNqOtSu.js.map b/dist/await_block-DTNqOtSu.js.map new file mode 100644 index 0000000..12d1461 --- /dev/null +++ b/dist/await_block-DTNqOtSu.js.map @@ -0,0 +1 @@ +{"version":3,"file":"await_block-DTNqOtSu.js","sources":["../node_modules/svelte/src/runtime/internal/await_block.js"],"sourcesContent":["import { is_promise } from './utils.js';\nimport { check_outros, group_outros, transition_in, transition_out } from './transitions.js';\nimport { flush } from './scheduler.js';\nimport { get_current_component, set_current_component } from './lifecycle.js';\n\n/**\n * @template T\n * @param {Promise} promise\n * @param {import('./private.js').PromiseInfo} info\n * @returns {boolean}\n */\nexport function handle_promise(promise, info) {\n\tconst token = (info.token = {});\n\t/**\n\t * @param {import('./private.js').FragmentFactory} type\n\t * @param {0 | 1 | 2} index\n\t * @param {number} [key]\n\t * @param {any} [value]\n\t * @returns {void}\n\t */\n\tfunction update(type, index, key, value) {\n\t\tif (info.token !== token) return;\n\t\tinfo.resolved = value;\n\t\tlet child_ctx = info.ctx;\n\t\tif (key !== undefined) {\n\t\t\tchild_ctx = child_ctx.slice();\n\t\t\tchild_ctx[key] = value;\n\t\t}\n\t\tconst block = type && (info.current = type)(child_ctx);\n\t\tlet needs_flush = false;\n\t\tif (info.block) {\n\t\t\tif (info.blocks) {\n\t\t\t\tinfo.blocks.forEach((block, i) => {\n\t\t\t\t\tif (i !== index && block) {\n\t\t\t\t\t\tgroup_outros();\n\t\t\t\t\t\ttransition_out(block, 1, 1, () => {\n\t\t\t\t\t\t\tif (info.blocks[i] === block) {\n\t\t\t\t\t\t\t\tinfo.blocks[i] = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcheck_outros();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tinfo.block.d(1);\n\t\t\t}\n\t\t\tblock.c();\n\t\t\ttransition_in(block, 1);\n\t\t\tblock.m(info.mount(), info.anchor);\n\t\t\tneeds_flush = true;\n\t\t}\n\t\tinfo.block = block;\n\t\tif (info.blocks) info.blocks[index] = block;\n\t\tif (needs_flush) {\n\t\t\tflush();\n\t\t}\n\t}\n\tif (is_promise(promise)) {\n\t\tconst current_component = get_current_component();\n\t\tpromise.then(\n\t\t\t(value) => {\n\t\t\t\tset_current_component(current_component);\n\t\t\t\tupdate(info.then, 1, info.value, value);\n\t\t\t\tset_current_component(null);\n\t\t\t},\n\t\t\t(error) => {\n\t\t\t\tset_current_component(current_component);\n\t\t\t\tupdate(info.catch, 2, info.error, error);\n\t\t\t\tset_current_component(null);\n\t\t\t\tif (!info.hasCatch) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t// if we previously had a then/catch block, destroy it\n\t\tif (info.current !== info.pending) {\n\t\t\tupdate(info.pending, 0);\n\t\t\treturn true;\n\t\t}\n\t} else {\n\t\tif (info.current !== info.then) {\n\t\t\tupdate(info.then, 1, info.value, promise);\n\t\t\treturn true;\n\t\t}\n\t\tinfo.resolved = /** @type {T} */ (promise);\n\t}\n}\n\n/** @returns {void} */\nexport function update_await_block_branch(info, ctx, dirty) {\n\tconst child_ctx = ctx.slice();\n\tconst { resolved } = info;\n\tif (info.current === info.then) {\n\t\tchild_ctx[info.value] = resolved;\n\t}\n\tif (info.current === info.catch) {\n\t\tchild_ctx[info.error] = resolved;\n\t}\n\tinfo.block.p(child_ctx, dirty);\n}\n"],"names":["block"],"mappings":";AAWO,SAAS,eAAe,SAAS,MAAM;AAC7C,QAAM,QAAS,KAAK,QAAQ,CAAE;AAQ9B,WAAS,OAAO,MAAM,OAAO,KAAK,OAAO;AACxC,QAAI,KAAK,UAAU,MAAO;AAC1B,SAAK,WAAW;AAChB,QAAI,YAAY,KAAK;AACrB,QAAI,QAAQ,QAAW;AACtB,kBAAY,UAAU;AACtB,gBAAU,GAAG,IAAI;AAAA,IACjB;AACD,UAAM,QAAQ,SAAS,KAAK,UAAU,MAAM,SAAS;AACrD,QAAI,cAAc;AAClB,QAAI,KAAK,OAAO;AACf,UAAI,KAAK,QAAQ;AAChB,aAAK,OAAO,QAAQ,CAACA,QAAO,MAAM;AACjC,cAAI,MAAM,SAASA,QAAO;AACzB;AACA,2BAAeA,QAAO,GAAG,GAAG,MAAM;AACjC,kBAAI,KAAK,OAAO,CAAC,MAAMA,QAAO;AAC7B,qBAAK,OAAO,CAAC,IAAI;AAAA,cACjB;AAAA,YACR,CAAO;AACD;UACA;AAAA,QACN,CAAK;AAAA,MACL,OAAU;AACN,aAAK,MAAM,EAAE,CAAC;AA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js new file mode 100644 index 0000000..3f4e0cc --- /dev/null +++ b/dist/index-DP0Ud7KH.js @@ -0,0 +1,29043 @@ +function noop() { +} +const identity = (x) => x; +function assign(tar, src) { + for (const k in src) tar[k] = src[k]; + return ( + /** @type {T & S} */ + tar + ); +} +function is_promise(value) { + return !!value && (typeof value === "object" || typeof value === "function") && typeof /** @type {any} */ + value.then === "function"; +} +function run(fn) { + return fn(); +} +function blank_object() { + return /* @__PURE__ */ Object.create(null); +} +function run_all(fns) { + fns.forEach(run); +} +function is_function(thing) { + return typeof thing === "function"; +} +function safe_not_equal(a, b) { + return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function"; +} +let src_url_equal_anchor; +function src_url_equal(element_src, url2) { + if (element_src === url2) return true; + if (!src_url_equal_anchor) { + src_url_equal_anchor = document.createElement("a"); + } + src_url_equal_anchor.href = url2; + return element_src === src_url_equal_anchor.href; +} +function is_empty(obj) { + return Object.keys(obj).length === 0; +} +function subscribe(store, ...callbacks) { + if (store == null) { + for (const callback of callbacks) { + callback(void 0); + } + return noop; + } + const unsub = store.subscribe(...callbacks); + return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; +} +function get_store_value(store) { + let value; + subscribe(store, (_) => value = _)(); + return value; +} +function component_subscribe(component, store, callback) { + component.$$.on_destroy.push(subscribe(store, callback)); +} +function create_slot(definition, ctx, $$scope, fn) { + if (definition) { + const slot_ctx = get_slot_context(definition, ctx, $$scope, fn); + return definition[0](slot_ctx); + } +} +function get_slot_context(definition, ctx, $$scope, fn) { + return definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx; +} +function get_slot_changes(definition, $$scope, dirty, fn) { + if (definition[2] && fn) { + const lets = definition[2](fn(dirty)); + if ($$scope.dirty === void 0) { + return lets; + } + if (typeof lets === "object") { + const merged = []; + const len = Math.max($$scope.dirty.length, lets.length); + for (let i = 0; i < len; i += 1) { + merged[i] = $$scope.dirty[i] | lets[i]; + } + return merged; + } + return $$scope.dirty | lets; + } + return $$scope.dirty; +} +function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) { + if (slot_changes) { + const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn); + slot.p(slot_context, slot_changes); + } +} +function get_all_dirty_from_scope($$scope) { + if ($$scope.ctx.length > 32) { + const dirty = []; + const length = $$scope.ctx.length / 32; + for (let i = 0; i < length; i++) { + dirty[i] = -1; + } + return dirty; + } + return -1; +} +function exclude_internal_props(props) { + const result = {}; + for (const k in props) if (k[0] !== "$") result[k] = props[k]; + return result; +} +function compute_rest_props(props, keys) { + const rest = {}; + keys = new Set(keys); + for (const k in props) if (!keys.has(k) && k[0] !== "$") rest[k] = props[k]; + return rest; +} +function null_to_empty(value) { + return value == null ? "" : value; +} +function set_store_value(store, ret, value) { + store.set(value); + return ret; +} +function action_destroyer(action_result) { + return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; +} +const is_client = typeof window !== "undefined"; +let now = is_client ? () => window.performance.now() : () => Date.now(); +let raf = is_client ? (cb) => requestAnimationFrame(cb) : noop; +const tasks = /* @__PURE__ */ new Set(); +function run_tasks(now2) { + tasks.forEach((task) => { + if (!task.c(now2)) { + tasks.delete(task); + task.f(); + } + }); + if (tasks.size !== 0) raf(run_tasks); +} +function loop(callback) { + let task; + if (tasks.size === 0) raf(run_tasks); + return { + promise: new Promise((fulfill) => { + tasks.add(task = { c: callback, f: fulfill }); + }), + abort() { + tasks.delete(task); + } + }; +} +function append(target, node) { + target.appendChild(node); +} +function get_root_for_style(node) { + if (!node) return document; + const root = node.getRootNode ? node.getRootNode() : node.ownerDocument; + if (root && /** @type {ShadowRoot} */ + root.host) { + return ( + /** @type {ShadowRoot} */ + root + ); + } + return node.ownerDocument; +} +function append_empty_stylesheet(node) { + const style_element = element("style"); + style_element.textContent = "/* empty */"; + append_stylesheet(get_root_for_style(node), style_element); + return style_element.sheet; +} +function append_stylesheet(node, style) { + append( + /** @type {Document} */ + node.head || node, + style + ); + return style.sheet; +} +function insert(target, node, anchor) { + target.insertBefore(node, anchor || null); +} +function detach(node) { + if (node.parentNode) { + node.parentNode.removeChild(node); + } +} +function destroy_each(iterations, detaching) { + for (let i = 0; i < iterations.length; i += 1) { + if (iterations[i]) iterations[i].d(detaching); + } +} +function element(name) { + return document.createElement(name); +} +function svg_element(name) { + return document.createElementNS("http://www.w3.org/2000/svg", name); +} +function text(data) { + return document.createTextNode(data); +} +function space() { + return text(" "); +} +function empty() { + return text(""); +} +function listen(node, event, handler, options) { + node.addEventListener(event, handler, options); + return () => node.removeEventListener(event, handler, options); +} +function prevent_default(fn) { + return function(event) { + event.preventDefault(); + return fn.call(this, event); + }; +} +function stop_propagation(fn) { + return function(event) { + event.stopPropagation(); + return fn.call(this, event); + }; +} +function attr(node, attribute, value) { + if (value == null) node.removeAttribute(attribute); + else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value); +} +const always_set_through_set_attribute = ["width", "height"]; +function set_attributes(node, attributes) { + const descriptors = Object.getOwnPropertyDescriptors(node.__proto__); + for (const key in attributes) { + if (attributes[key] == null) { + node.removeAttribute(key); + } else if (key === "style") { + node.style.cssText = attributes[key]; + } else if (key === "__value") { + node.value = node[key] = attributes[key]; + } else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) { + node[key] = attributes[key]; + } else { + attr(node, key, attributes[key]); + } + } +} +function to_number(value) { + return value === "" ? null : +value; +} +function children(element2) { + return Array.from(element2.childNodes); +} +function set_data(text2, data) { + data = "" + data; + if (text2.data === data) return; + text2.data = /** @type {string} */ + data; +} +function set_input_value(input, value) { + input.value = value == null ? "" : value; +} +function set_style(node, key, value, important) { + if (value == null) { + node.style.removeProperty(key); + } else { + node.style.setProperty(key, value, ""); + } +} +function select_option(select, value, mounting) { + for (let i = 0; i < select.options.length; i += 1) { + const option = select.options[i]; + if (option.__value === value) { + option.selected = true; + return; + } + } + if (!mounting || value !== void 0) { + select.selectedIndex = -1; + } +} +function select_value(select) { + const selected_option = select.querySelector(":checked"); + return selected_option && selected_option.__value; +} +function toggle_class(element2, name, toggle) { + element2.classList.toggle(name, !!toggle); +} +function custom_event(type2, detail, { bubbles = false, cancelable = false } = {}) { + return new CustomEvent(type2, { detail, bubbles, cancelable }); +} +class HtmlTag { + /** + * @private + * @default false + */ + is_svg = false; + /** parent for creating node */ + e = void 0; + /** html tag nodes */ + n = void 0; + /** target */ + t = void 0; + /** anchor */ + a = void 0; + constructor(is_svg = false) { + this.is_svg = is_svg; + this.e = this.n = null; + } + /** + * @param {string} html + * @returns {void} + */ + c(html) { + this.h(html); + } + /** + * @param {string} html + * @param {HTMLElement | SVGElement} target + * @param {HTMLElement | SVGElement} anchor + * @returns {void} + */ + m(html, target, anchor = null) { + if (!this.e) { + if (this.is_svg) + this.e = svg_element( + /** @type {keyof SVGElementTagNameMap} */ + target.nodeName + ); + else + this.e = element( + /** @type {keyof HTMLElementTagNameMap} */ + target.nodeType === 11 ? "TEMPLATE" : target.nodeName + ); + this.t = target.tagName !== "TEMPLATE" ? target : ( + /** @type {HTMLTemplateElement} */ + target.content + ); + this.c(html); + } + this.i(anchor); + } + /** + * @param {string} html + * @returns {void} + */ + h(html) { + this.e.innerHTML = html; + this.n = Array.from( + this.e.nodeName === "TEMPLATE" ? this.e.content.childNodes : this.e.childNodes + ); + } + /** + * @returns {void} */ + i(anchor) { + for (let i = 0; i < this.n.length; i += 1) { + insert(this.t, this.n[i], anchor); + } + } + /** + * @param {string} html + * @returns {void} + */ + p(html) { + this.d(); + this.h(html); + this.i(this.a); + } + /** + * @returns {void} */ + d() { + this.n.forEach(detach); + } +} +function construct_svelte_component(component, props) { + return new component(props); +} +const managed_styles = /* @__PURE__ */ new Map(); +let active = 0; +function hash(str) { + let hash2 = 5381; + let i = str.length; + while (i--) hash2 = (hash2 << 5) - hash2 ^ str.charCodeAt(i); + return hash2 >>> 0; +} +function create_style_information(doc, node) { + const info = { stylesheet: append_empty_stylesheet(node), rules: {} }; + managed_styles.set(doc, info); + return info; +} +function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) { + const step = 16.666 / duration; + let keyframes = "{\n"; + for (let p = 0; p <= 1; p += step) { + const t = a + (b - a) * ease(p); + keyframes += p * 100 + `%{${fn(t, 1 - t)}} +`; + } + const rule = keyframes + `100% {${fn(b, 1 - b)}} +}`; + const name = `__svelte_${hash(rule)}_${uid}`; + const doc = get_root_for_style(node); + const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc, node); + if (!rules[name]) { + rules[name] = true; + stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length); + } + const animation = node.style.animation || ""; + node.style.animation = `${animation ? `${animation}, ` : ""}${name} ${duration}ms linear ${delay}ms 1 both`; + active += 1; + return name; +} +function delete_rule(node, name) { + const previous = (node.style.animation || "").split(", "); + const next = previous.filter( + name ? (anim) => anim.indexOf(name) < 0 : (anim) => anim.indexOf("__svelte") === -1 + // remove all Svelte animations + ); + const deleted = previous.length - next.length; + if (deleted) { + node.style.animation = next.join(", "); + active -= deleted; + if (!active) clear_rules(); + } +} +function clear_rules() { + raf(() => { + if (active) return; + managed_styles.forEach((info) => { + const { ownerNode } = info.stylesheet; + if (ownerNode) detach(ownerNode); + }); + managed_styles.clear(); + }); +} +let current_component; +function set_current_component(component) { + current_component = component; +} +function get_current_component() { + if (!current_component) throw new Error("Function called outside component initialization"); + return current_component; +} +function onMount(fn) { + get_current_component().$$.on_mount.push(fn); +} +function onDestroy(fn) { + get_current_component().$$.on_destroy.push(fn); +} +function createEventDispatcher() { + const component = get_current_component(); + return (type2, detail, { cancelable = false } = {}) => { + const callbacks = component.$$.callbacks[type2]; + if (callbacks) { + const event = custom_event( + /** @type {string} */ + type2, + detail, + { cancelable } + ); + callbacks.slice().forEach((fn) => { + fn.call(component, event); + }); + return !event.defaultPrevented; + } + return true; + }; +} +function setContext(key, context) { + get_current_component().$$.context.set(key, context); + return context; +} +function getContext(key) { + return get_current_component().$$.context.get(key); +} +function bubble(component, event) { + const callbacks = component.$$.callbacks[event.type]; + if (callbacks) { + callbacks.slice().forEach((fn) => fn.call(this, event)); + } +} +const dirty_components = []; +const binding_callbacks = []; +let render_callbacks = []; +const flush_callbacks = []; +const resolved_promise = /* @__PURE__ */ Promise.resolve(); +let update_scheduled = false; +function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } +} +function tick() { + schedule_update(); + return resolved_promise; +} +function add_render_callback(fn) { + render_callbacks.push(fn); +} +function add_flush_callback(fn) { + flush_callbacks.push(fn); +} +const seen_callbacks = /* @__PURE__ */ new Set(); +let flushidx = 0; +function flush() { + if (flushidx !== 0) { + return; + } + const saved_component = current_component; + do { + try { + while (flushidx < dirty_components.length) { + const component = dirty_components[flushidx]; + flushidx++; + set_current_component(component); + update(component.$$); + } + } catch (e) { + dirty_components.length = 0; + flushidx = 0; + throw e; + } + set_current_component(null); + dirty_components.length = 0; + flushidx = 0; + while (binding_callbacks.length) binding_callbacks.pop()(); + for (let i = 0; i < render_callbacks.length; i += 1) { + const callback = render_callbacks[i]; + if (!seen_callbacks.has(callback)) { + seen_callbacks.add(callback); + callback(); + } + } + render_callbacks.length = 0; + } while (dirty_components.length); + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + update_scheduled = false; + seen_callbacks.clear(); + set_current_component(saved_component); +} +function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + const dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } +} +function flush_render_callbacks(fns) { + const filtered = []; + const targets = []; + render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c)); + targets.forEach((c) => c()); + render_callbacks = filtered; +} +let promise; +function wait() { + if (!promise) { + promise = Promise.resolve(); + promise.then(() => { + promise = null; + }); + } + return promise; +} +function dispatch(node, direction, kind) { + node.dispatchEvent(custom_event(`${direction ? "intro" : "outro"}${kind}`)); +} +const outroing = /* @__PURE__ */ new Set(); +let outros; +function group_outros() { + outros = { + r: 0, + c: [], + p: outros + // parent group + }; +} +function check_outros() { + if (!outros.r) { + run_all(outros.c); + } + outros = outros.p; +} +function transition_in(block, local) { + if (block && block.i) { + outroing.delete(block); + block.i(local); + } +} +function transition_out(block, local, detach2, callback) { + if (block && block.o) { + if (outroing.has(block)) return; + outroing.add(block); + outros.c.push(() => { + outroing.delete(block); + if (callback) { + if (detach2) block.d(1); + callback(); + } + }); + block.o(local); + } else if (callback) { + callback(); + } +} +const null_transition = { duration: 0 }; +function create_in_transition(node, fn, params) { + const options = { direction: "in" }; + let config = fn(node, params, options); + let running = false; + let animation_name; + let task; + let uid = 0; + function cleanup() { + if (animation_name) delete_rule(node, animation_name); + } + function go() { + const { + delay = 0, + duration = 300, + easing = identity, + tick: tick2 = noop, + css + } = config || null_transition; + if (css) animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++); + tick2(0, 1); + const start_time = now() + delay; + const end_time = start_time + duration; + if (task) task.abort(); + running = true; + add_render_callback(() => dispatch(node, true, "start")); + task = loop((now2) => { + if (running) { + if (now2 >= end_time) { + tick2(1, 0); + dispatch(node, true, "end"); + cleanup(); + return running = false; + } + if (now2 >= start_time) { + const t = easing((now2 - start_time) / duration); + tick2(t, 1 - t); + } + } + return running; + }); + } + let started = false; + return { + start() { + if (started) return; + started = true; + delete_rule(node); + if (is_function(config)) { + config = config(options); + wait().then(go); + } else { + go(); + } + }, + invalidate() { + started = false; + }, + end() { + if (running) { + cleanup(); + running = false; + } + } + }; +} +function create_out_transition(node, fn, params) { + const options = { direction: "out" }; + let config = fn(node, params, options); + let running = true; + let animation_name; + const group = outros; + group.r += 1; + let original_inert_value; + function go() { + const { + delay = 0, + duration = 300, + easing = identity, + tick: tick2 = noop, + css + } = config || null_transition; + if (css) animation_name = create_rule(node, 1, 0, duration, delay, easing, css); + const start_time = now() + delay; + const end_time = start_time + duration; + add_render_callback(() => dispatch(node, false, "start")); + if ("inert" in node) { + original_inert_value = /** @type {HTMLElement} */ + node.inert; + node.inert = true; + } + loop((now2) => { + if (running) { + if (now2 >= end_time) { + tick2(0, 1); + dispatch(node, false, "end"); + if (!--group.r) { + run_all(group.c); + } + return false; + } + if (now2 >= start_time) { + const t = easing((now2 - start_time) / duration); + tick2(1 - t, t); + } + } + return running; + }); + } + if (is_function(config)) { + wait().then(() => { + config = config(options); + go(); + }); + } else { + go(); + } + return { + end(reset) { + if (reset && "inert" in node) { + node.inert = original_inert_value; + } + if (reset && config.tick) { + config.tick(1, 0); + } + if (running) { + if (animation_name) delete_rule(node, animation_name); + running = false; + } + } + }; +} +function ensure_array_like(array_like_or_iterator) { + return array_like_or_iterator?.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator); +} +function destroy_block(block, lookup) { + block.d(1); + lookup.delete(block.key); +} +function outro_and_destroy_block(block, lookup) { + transition_out(block, 1, 1, () => { + lookup.delete(block.key); + }); +} +function update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block2, next, get_context) { + let o = old_blocks.length; + let n = list.length; + let i = o; + const old_indexes = {}; + while (i--) old_indexes[old_blocks[i].key] = i; + const new_blocks = []; + const new_lookup = /* @__PURE__ */ new Map(); + const deltas = /* @__PURE__ */ new Map(); + const updates = []; + i = n; + while (i--) { + const child_ctx = get_context(ctx, list, i); + const key = get_key(child_ctx); + let block = lookup.get(key); + if (!block) { + block = create_each_block2(key, child_ctx); + block.c(); + } else { + updates.push(() => block.p(child_ctx, dirty)); + } + new_lookup.set(key, new_blocks[i] = block); + if (key in old_indexes) deltas.set(key, Math.abs(i - old_indexes[key])); + } + const will_move = /* @__PURE__ */ new Set(); + const did_move = /* @__PURE__ */ new Set(); + function insert2(block) { + transition_in(block, 1); + block.m(node, next); + lookup.set(block.key, block); + next = block.first; + n--; + } + while (o && n) { + const new_block = new_blocks[n - 1]; + const old_block = old_blocks[o - 1]; + const new_key = new_block.key; + const old_key = old_block.key; + if (new_block === old_block) { + next = new_block.first; + o--; + n--; + } else if (!new_lookup.has(old_key)) { + destroy(old_block, lookup); + o--; + } else if (!lookup.has(new_key) || will_move.has(new_key)) { + insert2(new_block); + } else if (did_move.has(old_key)) { + o--; + } else if (deltas.get(new_key) > deltas.get(old_key)) { + did_move.add(new_key); + insert2(new_block); + } else { + will_move.add(old_key); + o--; + } + } + while (o--) { + const old_block = old_blocks[o]; + if (!new_lookup.has(old_block.key)) destroy(old_block, lookup); + } + while (n) insert2(new_blocks[n - 1]); + run_all(updates); + return new_blocks; +} +function get_spread_update(levels, updates) { + const update2 = {}; + const to_null_out = {}; + const accounted_for = { $$scope: 1 }; + let i = levels.length; + while (i--) { + const o = levels[i]; + const n = updates[i]; + if (n) { + for (const key in o) { + if (!(key in n)) to_null_out[key] = 1; + } + for (const key in n) { + if (!accounted_for[key]) { + update2[key] = n[key]; + accounted_for[key] = 1; + } + } + levels[i] = n; + } else { + for (const key in o) { + accounted_for[key] = 1; + } + } + } + for (const key in to_null_out) { + if (!(key in update2)) update2[key] = void 0; + } + return update2; +} +function get_spread_object(spread_props) { + return typeof spread_props === "object" && spread_props !== null ? spread_props : {}; +} +function bind(component, name, callback) { + const index = component.$$.props[name]; + if (index !== void 0) { + component.$$.bound[index] = callback; + callback(component.$$.ctx[index]); + } +} +function create_component(block) { + block && block.c(); +} +function mount_component(component, target, anchor) { + const { fragment, after_update } = component.$$; + fragment && fragment.m(target, anchor); + add_render_callback(() => { + const new_on_destroy = component.$$.on_mount.map(run).filter(is_function); + if (component.$$.on_destroy) { + component.$$.on_destroy.push(...new_on_destroy); + } else { + run_all(new_on_destroy); + } + component.$$.on_mount = []; + }); + after_update.forEach(add_render_callback); +} +function destroy_component(component, detaching) { + const $$ = component.$$; + if ($$.fragment !== null) { + flush_render_callbacks($$.after_update); + run_all($$.on_destroy); + $$.fragment && $$.fragment.d(detaching); + $$.on_destroy = $$.fragment = null; + $$.ctx = []; + } +} +function make_dirty(component, i) { + if (component.$$.dirty[0] === -1) { + dirty_components.push(component); + schedule_update(); + component.$$.dirty.fill(0); + } + component.$$.dirty[i / 31 | 0] |= 1 << i % 31; +} +function init(component, options, instance2, create_fragment2, not_equal, props, append_styles = null, dirty = [-1]) { + const parent_component = current_component; + set_current_component(component); + const $$ = component.$$ = { + fragment: null, + ctx: [], + // state + props, + update: noop, + not_equal, + bound: blank_object(), + // lifecycle + on_mount: [], + on_destroy: [], + on_disconnect: [], + before_update: [], + after_update: [], + context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), + // everything else + callbacks: blank_object(), + dirty, + skip_bound: false, + root: options.target || parent_component.$$.root + }; + append_styles && append_styles($$.root); + let ready = false; + $$.ctx = instance2 ? instance2(component, options.props || {}, (i, ret, ...rest) => { + const value = rest.length ? rest[0] : ret; + if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { + if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); + if (ready) make_dirty(component, i); + } + return ret; + }) : []; + $$.update(); + ready = true; + run_all($$.before_update); + $$.fragment = create_fragment2 ? create_fragment2($$.ctx) : false; + if (options.target) { + if (options.hydrate) { + const nodes = children(options.target); + $$.fragment && $$.fragment.l(nodes); + nodes.forEach(detach); + } else { + $$.fragment && $$.fragment.c(); + } + if (options.intro) transition_in(component.$$.fragment); + mount_component(component, options.target, options.anchor); + flush(); + } + set_current_component(parent_component); +} +class SvelteComponent { + /** + * ### PRIVATE API + * + * Do not use, may change at any time + * + * @type {any} + */ + $$ = void 0; + /** + * ### PRIVATE API + * + * Do not use, may change at any time + * + * @type {any} + */ + $$set = void 0; + /** @returns {void} */ + $destroy() { + destroy_component(this, 1); + this.$destroy = noop; + } + /** + * @template {Extract} K + * @param {K} type + * @param {((e: Events[K]) => void) | null | undefined} callback + * @returns {() => void} + */ + $on(type2, callback) { + if (!is_function(callback)) { + return noop; + } + const callbacks = this.$$.callbacks[type2] || (this.$$.callbacks[type2] = []); + callbacks.push(callback); + return () => { + const index = callbacks.indexOf(callback); + if (index !== -1) callbacks.splice(index, 1); + }; + } + /** + * @param {Partial} props + * @returns {void} + */ + $set(props) { + if (this.$$set && !is_empty(props)) { + this.$$.skip_bound = true; + this.$$set(props); + this.$$.skip_bound = false; + } + } +} +const PUBLIC_VERSION = "4"; +if (typeof window !== "undefined") + (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION); +function cubicOut(t) { + const f = t - 1; + return f * f * f + 1; +} +function fade(node, { delay = 0, duration = 400, easing = identity } = {}) { + const o = +getComputedStyle(node).opacity; + return { + delay, + duration, + easing, + css: (t) => `opacity: ${t * o}` + }; +} +function set(obj, key, val) { + if (typeof val.value === "object") val.value = klona(val.value); + if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") { + Object.defineProperty(obj, key, val); + } else obj[key] = val.value; +} +function klona(x) { + if (typeof x !== "object") return x; + var i = 0, k, list, tmp, str = Object.prototype.toString.call(x); + if (str === "[object Object]") { + tmp = Object.create(x.__proto__ || null); + } else if (str === "[object Array]") { + tmp = Array(x.length); + } else if (str === "[object Set]") { + tmp = /* @__PURE__ */ new Set(); + x.forEach(function(val) { + tmp.add(klona(val)); + }); + } else if (str === "[object Map]") { + tmp = /* @__PURE__ */ new Map(); + x.forEach(function(val, key) { + tmp.set(klona(key), klona(val)); + }); + } else if (str === "[object Date]") { + tmp = /* @__PURE__ */ new Date(+x); + } else if (str === "[object RegExp]") { + tmp = new RegExp(x.source, x.flags); + } else if (str === "[object DataView]") { + tmp = new x.constructor(klona(x.buffer)); + } else if (str === "[object ArrayBuffer]") { + tmp = x.slice(0); + } else if (str.slice(-6) === "Array]") { + tmp = new x.constructor(x); + } + if (tmp) { + for (list = Object.getOwnPropertySymbols(x); i < list.length; i++) { + set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i])); + } + for (i = 0, list = Object.getOwnPropertyNames(x); i < list.length; i++) { + if (Object.hasOwnProperty.call(tmp, k = list[i]) && tmp[k] === x[k]) continue; + set(tmp, k, Object.getOwnPropertyDescriptor(x, k)); + } + } + return tmp || x; +} +const s_TAG_OBJECT = "[object Object]"; +function deepMerge(target = {}, ...sourceObj) { + if (Object.prototype.toString.call(target) !== s_TAG_OBJECT) { + throw new TypeError(`deepMerge error: 'target' is not an 'object'.`); + } + for (let cntr = 0; cntr < sourceObj.length; cntr++) { + if (Object.prototype.toString.call(sourceObj[cntr]) !== s_TAG_OBJECT) { + throw new TypeError(`deepMerge error: 'sourceObj[${cntr}]' is not an 'object'.`); + } + } + return _deepMerge(target, ...sourceObj); +} +function hasGetter(object, accessor) { + if (typeof object !== "object" || object === null || object === void 0) { + return false; + } + const iDescriptor = Object.getOwnPropertyDescriptor(object, accessor); + if (iDescriptor !== void 0 && iDescriptor.get !== void 0) { + return true; + } + for (let o = Object.getPrototypeOf(object); o; o = Object.getPrototypeOf(o)) { + const descriptor = Object.getOwnPropertyDescriptor(o, accessor); + if (descriptor !== void 0 && descriptor.get !== void 0) { + return true; + } + } + return false; +} +function hasPrototype(target, Prototype) { + if (typeof target !== "function") { + return false; + } + if (target === Prototype) { + return true; + } + for (let proto = Object.getPrototypeOf(target); proto; proto = Object.getPrototypeOf(proto)) { + if (proto === Prototype) { + return true; + } + } + return false; +} +function isIterable(value) { + if (value === null || value === void 0 || typeof value !== "object") { + return false; + } + return Symbol.iterator in value; +} +function isObject(value) { + return value !== null && typeof value === "object" && !Array.isArray(value); +} +function isPlainObject(value) { + if (Object.prototype.toString.call(value) !== s_TAG_OBJECT) { + return false; + } + const prototype = Object.getPrototypeOf(value); + return prototype === null || prototype === Object.prototype; +} +function safeAccess(data, accessor, defaultValue) { + if (typeof data !== "object") { + return defaultValue; + } + if (typeof accessor !== "string") { + return defaultValue; + } + const access = accessor.split("."); + for (let cntr = 0; cntr < access.length; cntr++) { + if (typeof data[access[cntr]] === "undefined" || data[access[cntr]] === null) { + return defaultValue; + } + data = data[access[cntr]]; + } + return data; +} +function safeSet(data, accessor, value, operation = "set", createMissing = true) { + if (typeof data !== "object") { + throw new TypeError(`safeSet Error: 'data' is not an 'object'.`); + } + if (typeof accessor !== "string") { + throw new TypeError(`safeSet Error: 'accessor' is not a 'string'.`); + } + const access = accessor.split("."); + for (let cntr = 0; cntr < access.length; cntr++) { + if (Array.isArray(data)) { + const number = +access[cntr]; + if (!Number.isInteger(number) || number < 0) { + return false; + } + } + if (cntr === access.length - 1) { + switch (operation) { + case "add": + data[access[cntr]] += value; + break; + case "div": + data[access[cntr]] /= value; + break; + case "mult": + data[access[cntr]] *= value; + break; + case "set": + data[access[cntr]] = value; + break; + case "set-undefined": + if (typeof data[access[cntr]] === "undefined") { + data[access[cntr]] = value; + } + break; + case "sub": + data[access[cntr]] -= value; + break; + } + } else { + if (createMissing && typeof data[access[cntr]] === "undefined") { + data[access[cntr]] = {}; + } + if (data[access[cntr]] === null || typeof data[access[cntr]] !== "object") { + return false; + } + data = data[access[cntr]]; + } + } + return true; +} +function _deepMerge(target = {}, ...sourceObj) { + for (let cntr = 0; cntr < sourceObj.length; cntr++) { + const obj = sourceObj[cntr]; + for (const prop in obj) { + if (Object.prototype.hasOwnProperty.call(obj, prop)) { + if (prop.startsWith("-=")) { + delete target[prop.slice(2)]; + continue; + } + target[prop] = Object.prototype.hasOwnProperty.call(target, prop) && target[prop]?.constructor === Object && obj[prop]?.constructor === Object ? _deepMerge({}, target[prop], obj[prop]) : obj[prop]; + } + } + } + return target; +} +class A11yHelper { + /** + * Apply focus to the HTMLElement targets in a given A11yFocusSource data object. An iterable list `options.focusEl` + * can contain HTMLElements or selector strings. If multiple focus targets are provided in a list then the first + * valid target found will be focused. If focus target is a string then a lookup via `document.querySelector` is + * performed. In this case you should provide a unique selector for the desired focus target. + * + * Note: The body of this method is postponed to the next clock tick to allow any changes in the DOM to occur that + * might alter focus targets before applying. + * + * @param {A11yFocusSource|{ focusSource: A11yFocusSource }} options - The focus options instance to apply. + */ + static applyFocusSource(options) { + if (!isObject(options)) { + return; + } + const focusOpts = isObject(options?.focusSource) ? options.focusSource : options; + setTimeout(() => { + const debug = typeof focusOpts.debug === "boolean" ? focusOpts.debug : false; + if (isIterable(focusOpts.focusEl)) { + if (debug) { + console.debug(`A11yHelper.applyFocusSource debug - Attempting to apply focus target: `, focusOpts.focusEl); + } + for (const target of focusOpts.focusEl) { + if (target instanceof HTMLElement && target.isConnected) { + target.focus(); + if (debug) { + console.debug(`A11yHelper.applyFocusSource debug - Applied focus to target: `, target); + } + break; + } else if (typeof target === "string") { + const element2 = document.querySelector(target); + if (element2 instanceof HTMLElement && element2.isConnected) { + element2.focus(); + if (debug) { + console.debug(`A11yHelper.applyFocusSource debug - Applied focus to target: `, element2); + } + break; + } else if (debug) { + console.debug(`A11yHelper.applyFocusSource debug - Could not query selector: `, target); + } + } + } + } else if (debug) { + console.debug(`A11yHelper.applyFocusSource debug - No focus targets defined.`); + } + }, 0); + } + /** + * Returns first focusable element within a specified element. + * + * @param {HTMLElement|Document} [element=document] - Optional element to start query. + * + * @param {object} [options] - Optional parameters. + * + * @param {Iterable} [options.ignoreClasses] - Iterable list of classes to ignore elements. + * + * @param {Set} [options.ignoreElements] - Set of elements to ignore. + * + * @returns {HTMLElement} First focusable child element + */ + static getFirstFocusableElement(element2 = document, options) { + const focusableElements = this.getFocusableElements(element2, options); + return focusableElements.length > 0 ? focusableElements[0] : void 0; + } + /** + * Returns all focusable elements within a specified element. + * + * @param {HTMLElement|Document} [element=document] Optional element to start query. + * + * @param {object} [options] - Optional parameters. + * + * @param {boolean} [options.anchorHref=true] - When true anchors must have an HREF. + * + * @param {Iterable} [options.ignoreClasses] - Iterable list of classes to ignore elements. + * + * @param {Set} [options.ignoreElements] - Set of elements to ignore. + * + * @param {string} [options.selectors] - Custom list of focusable selectors for `querySelectorAll`. + * + * @returns {Array} Child keyboard focusable + */ + static getFocusableElements(element2 = document, { anchorHref = true, ignoreClasses, ignoreElements, selectors } = {}) { + if (!(element2 instanceof HTMLElement) && !(element2 instanceof Document)) { + throw new TypeError(`'element' is not a HTMLElement or Document instance.`); + } + if (typeof anchorHref !== "boolean") { + throw new TypeError(`'anchorHref' is not a boolean.`); + } + if (ignoreClasses !== void 0 && !isIterable(ignoreClasses)) { + throw new TypeError(`'ignoreClasses' is not an iterable list.`); + } + if (ignoreElements !== void 0 && !(ignoreElements instanceof Set)) { + throw new TypeError(`'ignoreElements' is not a Set.`); + } + if (selectors !== void 0 && typeof selectors !== "string") { + throw new TypeError(`'selectors' is not a string.`); + } + const selectorQuery = selectors ?? this.#getFocusableSelectors(anchorHref); + const allElements = [...element2.querySelectorAll(selectorQuery)]; + if (ignoreElements && ignoreClasses) { + return allElements.filter((el) => { + let hasIgnoreClass = false; + for (const ignoreClass of ignoreClasses) { + if (el.classList.contains(ignoreClass)) { + hasIgnoreClass = true; + break; + } + } + return !hasIgnoreClass && !ignoreElements.has(el) && el.style.display !== "none" && el.style.visibility !== "hidden" && !el.hasAttribute("disabled") && !el.hasAttribute("inert") && el.getAttribute("aria-hidden") !== "true"; + }); + } else if (ignoreClasses) { + return allElements.filter((el) => { + let hasIgnoreClass = false; + for (const ignoreClass of ignoreClasses) { + if (el.classList.contains(ignoreClass)) { + hasIgnoreClass = true; + break; + } + } + return !hasIgnoreClass && el.style.display !== "none" && el.style.visibility !== "hidden" && !el.hasAttribute("disabled") && !el.hasAttribute("inert") && el.getAttribute("aria-hidden") !== "true"; + }); + } else if (ignoreElements) { + return allElements.filter((el) => { + return !ignoreElements.has(el) && el.style.display !== "none" && el.style.visibility !== "hidden" && !el.hasAttribute("disabled") && !el.hasAttribute("inert") && el.getAttribute("aria-hidden") !== "true"; + }); + } else { + return allElements.filter((el) => { + return el.style.display !== "none" && el.style.visibility !== "hidden" && !el.hasAttribute("disabled") && !el.hasAttribute("inert") && el.getAttribute("aria-hidden") !== "true"; + }); + } + } + /** + * Returns the default focusable selectors query. + * + * @param {boolean} [anchorHref=true] - When true anchors must have an HREF. + * + * @returns {string} Focusable selectors for `querySelectorAll`. + */ + static #getFocusableSelectors(anchorHref = true) { + return `button, [contenteditable=""], [contenteditable="true"], details summary:not([tabindex="-1"]), embed, a${anchorHref ? "[href]" : ""}, iframe, object, input:not([type=hidden]), select, textarea, [tabindex]:not([tabindex="-1"])`; + } + /** + * Gets a A11yFocusSource object from the given DOM event allowing for optional X / Y screen space overrides. + * Browsers (Firefox / Chrome) forwards a mouse event for the context menu keyboard button. Provides detection of + * when the context menu event is from the keyboard. Firefox as of (1/23) does not provide the correct screen space + * coordinates, so for keyboard context menu presses coordinates are generated from the centroid point of the + * element. + * + * A default fallback element or selector string may be provided to provide the focus target. If the event comes from + * the keyboard however the source focused element is inserted as the target with the fallback value appended to the + * list of focus targets. When A11yFocusSource is applied by {@link A11yHelper.applyFocusSource} the target focus + * list is iterated through until a connected target is found and focus applied. + * + * @param {object} options - Options + * + * @param {KeyboardEvent|MouseEvent} [options.event] - The source DOM event. + * + * @param {boolean} [options.debug] - When true {@link A11yHelper.applyFocusSource} logs focus target data. + * + * @param {HTMLElement|string} [options.focusEl] - A specific HTMLElement or selector string as the focus target. + * + * @param {number} [options.x] - Used when an event isn't provided; integer of event source in screen space. + * + * @param {number} [options.y] - Used when an event isn't provided; integer of event source in screen space. + * + * @returns {A11yFocusSource} A A11yFocusSource object. + * + * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1426671 + * @see https://bugzilla.mozilla.org/show_bug.cgi?id=314314 + * + * TODO: Evaluate / test against touch input devices. + */ + static getFocusSource({ event, x, y, focusEl, debug = false }) { + if (focusEl !== void 0 && !(focusEl instanceof HTMLElement) && typeof focusEl !== "string") { + throw new TypeError( + `A11yHelper.getFocusSource error: 'focusEl' is not a HTMLElement or string.` + ); + } + if (debug !== void 0 && typeof debug !== "boolean") { + throw new TypeError(`A11yHelper.getFocusSource error: 'debug' is not a boolean.`); + } + if (event === void 0) { + if (typeof x !== "number") { + throw new TypeError(`A11yHelper.getFocusSource error: 'event' not defined and 'x' is not a number.`); + } + if (typeof y !== "number") { + throw new TypeError(`A11yHelper.getFocusSource error: 'event' not defined and 'y' is not a number.`); + } + return { + debug, + focusEl: focusEl !== void 0 ? [focusEl] : void 0, + x, + y + }; + } + if (!(event instanceof KeyboardEvent) && !(event instanceof MouseEvent)) { + throw new TypeError(`A11yHelper.getFocusSource error: 'event' is not a KeyboardEvent or MouseEvent.`); + } + if (x !== void 0 && !Number.isInteger(x)) { + throw new TypeError(`A11yHelper.getFocusSource error: 'x' is not a number.`); + } + if (y !== void 0 && !Number.isInteger(y)) { + throw new TypeError(`A11yHelper.getFocusSource error: 'y' is not a number.`); + } + const targetEl = event.target; + if (!(targetEl instanceof HTMLElement)) { + throw new TypeError(`A11yHelper.getFocusSource error: 'event.target' is not an HTMLElement.`); + } + const result = { debug }; + if (event instanceof MouseEvent) { + if (event?.button !== 2 && event.type === "contextmenu") { + const rect = targetEl.getBoundingClientRect(); + result.x = x ?? rect.left + rect.width / 2; + result.y = y ?? rect.top + rect.height / 2; + result.focusEl = focusEl !== void 0 ? [targetEl, focusEl] : [targetEl]; + result.source = "keyboard"; + } else { + result.x = x ?? event.pageX; + result.y = y ?? event.pageY; + result.focusEl = focusEl !== void 0 ? [focusEl] : void 0; + } + } else { + const rect = targetEl.getBoundingClientRect(); + result.x = x ?? rect.left + rect.width / 2; + result.y = y ?? rect.top + rect.height / 2; + result.focusEl = focusEl !== void 0 ? [targetEl, focusEl] : [targetEl]; + result.source = "keyboard"; + } + return result; + } + /** + * Returns first focusable element within a specified element. + * + * @param {HTMLElement|Document} [element=document] - Optional element to start query. + * + * @param {object} [options] - Optional parameters. + * + * @param {Iterable} [options.ignoreClasses] - Iterable list of classes to ignore elements. + * + * @param {Set} [options.ignoreElements] - Set of elements to ignore. + * + * @returns {HTMLElement} First focusable child element + */ + static getLastFocusableElement(element2 = document, options) { + const focusableElements = this.getFocusableElements(element2, options); + return focusableElements.length > 0 ? focusableElements[focusableElements.length - 1] : void 0; + } + /** + * Tests if the given element is focusable. + * + * @param {HTMLElement} [el] - Element to test. + * + * @param {object} [options] - Optional parameters. + * + * @param {boolean} [options.anchorHref=true] - When true anchors must have an HREF. + * + * @param {Iterable} [options.ignoreClasses] - Iterable list of classes to ignore elements. + * + * @returns {boolean} Element is focusable. + */ + static isFocusable(el, { anchorHref = true, ignoreClasses } = {}) { + if (el === void 0 || el === null || !(el instanceof HTMLElement) || el?.hidden || !el?.isConnected) { + return false; + } + if (typeof anchorHref !== "boolean") { + throw new TypeError(`'anchorHref' is not a boolean.`); + } + if (ignoreClasses !== void 0 && !isIterable(ignoreClasses)) { + throw new TypeError(`'ignoreClasses' is not an iterable list.`); + } + const contenteditableAttr = el.getAttribute("contenteditable"); + const contenteditableFocusable = typeof contenteditableAttr === "string" && (contenteditableAttr === "" || contenteditableAttr === "true"); + const tabindexAttr = el.getAttribute("tabindex"); + const tabindexFocusable = typeof tabindexAttr === "string" && tabindexAttr !== "-1"; + const isAnchor = el instanceof HTMLAnchorElement; + if (contenteditableFocusable || tabindexFocusable || isAnchor || el instanceof HTMLButtonElement || el instanceof HTMLDetailsElement || el instanceof HTMLEmbedElement || el instanceof HTMLIFrameElement || el instanceof HTMLInputElement || el instanceof HTMLObjectElement || el instanceof HTMLSelectElement || el instanceof HTMLTextAreaElement) { + if (isAnchor && anchorHref && typeof el.getAttribute("href") !== "string") { + return false; + } + return el.style.display !== "none" && el.style.visibility !== "hidden" && !el.hasAttribute("disabled") && !el.hasAttribute("inert") && el.getAttribute("aria-hidden") !== "true"; + } + return false; + } + /** + * Convenience method to check if the given data is a valid focus source. + * + * @param {HTMLElement|string} data - Either an HTMLElement or selector string. + * + * @returns {boolean} Is valid focus source. + */ + static isFocusSource(data) { + return data instanceof HTMLElement || typeof data === "string"; + } +} +class StyleParse { + static #regexPixels = /(\d+)\s*px/; + /** + * Parses a pixel string / computed styles. Ex. `100px` returns `100`. + * + * @param {string} value - Value to parse. + * + * @returns {number|undefined} The integer component of a pixel string. + */ + static pixels(value) { + if (typeof value !== "string") { + return void 0; + } + const isPixels = this.#regexPixels.test(value); + const number = parseInt(value); + return isPixels && Number.isFinite(number) ? number : void 0; + } +} +class TJSStyleManager { + /** @type {CSSStyleRule} */ + #cssRule; + /** @type {string} */ + #docKey; + /** @type {string} */ + #selector; + /** @type {HTMLStyleElement} */ + #styleElement; + /** @type {number} */ + #version; + /** + * + * @param {object} opts - Options. + * + * @param {string} opts.docKey - Required key providing a link to a specific style sheet element. + * + * @param {string} [opts.selector=:root] - Selector element. + * + * @param {Document} [opts.document] - Target document to load styles into. + * + * @param {number} [opts.version] - An integer representing the version / level of styles being managed. + */ + constructor({ docKey, selector = ":root", document: document2 = globalThis.document, version: version2 } = {}) { + if (typeof docKey !== "string") { + throw new TypeError(`StyleManager error: 'docKey' is not a string.`); + } + if (typeof selector !== "string") { + throw new TypeError(`StyleManager error: 'selector' is not a string.`); + } + if (version2 !== void 0 && !Number.isSafeInteger(version2) && version2 < 1) { + throw new TypeError(`StyleManager error: 'version' is defined and is not a positive integer >= 1.`); + } + this.#selector = selector; + this.#docKey = docKey; + this.#version = version2; + if (document2[this.#docKey] === void 0) { + this.#styleElement = document2.createElement("style"); + document2.head.append(this.#styleElement); + this.#styleElement._STYLE_MANAGER_VERSION = version2; + this.#styleElement.sheet.insertRule(`${selector} {}`, 0); + this.#cssRule = this.#styleElement.sheet.cssRules[0]; + document2[docKey] = this.#styleElement; + } else { + this.#styleElement = document2[docKey]; + this.#cssRule = this.#styleElement.sheet.cssRules[0]; + if (version2) { + const existingVersion = this.#styleElement._STYLE_MANAGER_VERSION ?? 0; + if (version2 > existingVersion) { + this.#cssRule.style.cssText = ""; + } + } + } + } + /** + * @returns {string} Provides an accessor to get the `cssText` for the style sheet. + */ + get cssText() { + return this.#cssRule.style.cssText; + } + /** + * @returns {number} Returns the version of this instance. + */ + get version() { + return this.#version; + } + /** + * Provides a copy constructor to duplicate an existing TJSStyleManager instance into a new document. + * + * Note: This is used to support the `PopOut` module. + * + * @param {Document} [document] Target browser document to clone into. + * + * @returns {TJSStyleManager} New style manager instance. + */ + clone(document2 = globalThis.document) { + const newStyleManager = new TJSStyleManager({ + selector: this.#selector, + docKey: this.#docKey, + document: document2, + version: this.#version + }); + newStyleManager.#cssRule.style.cssText = this.#cssRule.style.cssText; + return newStyleManager; + } + get() { + const cssText = this.#cssRule.style.cssText; + const result = {}; + if (cssText !== "") { + for (const entry of cssText.split(";")) { + if (entry !== "") { + const values = entry.split(":"); + result[values[0].trim()] = values[1]; + } + } + } + return result; + } + /** + * Gets a particular CSS variable. + * + * @param {string} key - CSS variable property key. + * + * @returns {string} Returns CSS variable value. + */ + getProperty(key) { + if (typeof key !== "string") { + throw new TypeError(`StyleManager error: 'key' is not a string.`); + } + return this.#cssRule.style.getPropertyValue(key); + } + /** + * Set rules by property / value; useful for CSS variables. + * + * @param {{ [key: string]: string }} rules - An object with property / value string pairs to load. + * + * @param {boolean} [overwrite=true] - When true overwrites any existing values. + */ + setProperties(rules, overwrite = true) { + if (!isObject(rules)) { + throw new TypeError(`StyleManager error: 'rules' is not an object.`); + } + if (typeof overwrite !== "boolean") { + throw new TypeError(`StyleManager error: 'overwrite' is not a boolean.`); + } + if (overwrite) { + for (const [key, value] of Object.entries(rules)) { + this.#cssRule.style.setProperty(key, value); + } + } else { + for (const [key, value] of Object.entries(rules)) { + if (this.#cssRule.style.getPropertyValue(key) === "") { + this.#cssRule.style.setProperty(key, value); + } + } + } + } + /** + * Sets a particular property. + * + * @param {string} key - CSS variable property key. + * + * @param {string} value - CSS variable value. + * + * @param {boolean} [overwrite=true] - Overwrite any existing value. + */ + setProperty(key, value, overwrite = true) { + if (typeof key !== "string") { + throw new TypeError(`StyleManager error: 'key' is not a string.`); + } + if (typeof value !== "string") { + throw new TypeError(`StyleManager error: 'value' is not a string.`); + } + if (typeof overwrite !== "boolean") { + throw new TypeError(`StyleManager error: 'overwrite' is not a boolean.`); + } + if (overwrite) { + this.#cssRule.style.setProperty(key, value); + } else { + if (this.#cssRule.style.getPropertyValue(key) === "") { + this.#cssRule.style.setProperty(key, value); + } + } + } + /** + * Removes the property keys specified. If `keys` is an iterable list then all property keys in the list are removed. + * + * @param {Iterable} keys - The property keys to remove. + */ + removeProperties(keys) { + if (!isIterable(keys)) { + throw new TypeError(`StyleManager error: 'keys' is not an iterable list.`); + } + for (const key of keys) { + if (typeof key === "string") { + this.#cssRule.style.removeProperty(key); + } + } + } + /** + * Removes a particular CSS variable. + * + * @param {string} key - CSS variable property key. + * + * @returns {string} CSS variable value when removed. + */ + removeProperty(key) { + if (typeof key !== "string") { + throw new TypeError(`StyleManager error: 'key' is not a string.`); + } + return this.#cssRule.style.removeProperty(key); + } +} +const cssVariables$1 = new TJSStyleManager({ docKey: "#__trl-root-styles", version: 1 }); +class Hashing { + static #regexUuidv = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i; + /** + * Provides a solid string hashing algorithm. + * + * Sourced from: https://stackoverflow.com/a/52171480 + * + * @param {string} str - String to hash. + * + * @param {number} seed - A seed value altering the hash. + * + * @returns {number} Hash code. + */ + static hashCode(str, seed = 0) { + if (typeof str !== "string") { + return 0; + } + let h1 = 3735928559 ^ seed, h2 = 1103547991 ^ seed; + for (let ch, i = 0; i < str.length; i++) { + ch = str.charCodeAt(i); + h1 = Math.imul(h1 ^ ch, 2654435761); + h2 = Math.imul(h2 ^ ch, 1597334677); + } + h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909); + h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909); + return 4294967296 * (2097151 & h2) + (h1 >>> 0); + } + /** + * Validates that the given string is formatted as a UUIDv4 string. + * + * @param {string} uuid - UUID string to test. + * + * @returns {boolean} Is UUIDv4 string. + */ + static isUuidv4(uuid) { + return this.#regexUuidv.test(uuid); + } + /** + * Generates a UUID v4 compliant ID. Please use a complete UUID generation package for guaranteed compliance. + * + * This code is an evolution of the following Gist. + * https://gist.github.com/jed/982883 + * + * There is a public domain / free copy license attached to it that is not a standard OSS license... + * https://gist.github.com/jed/982883#file-license-txt + * + * @returns {string} UUIDv4 + */ + static uuidv4() { + return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (c) => (c ^ (globalThis.crypto ?? globalThis.msCrypto).getRandomValues( + new Uint8Array(1) + )[0] & 15 >> c / 4).toString(16)); + } +} +class Timing { + /** + * Wraps a callback in a debounced timeout. + * + * Delay execution of the callback function until the function has not been called for the given delay in milliseconds. + * + * @param {Function} callback - A function to execute once the debounced threshold has been passed. + * + * @param {number} delay - An amount of time in milliseconds to delay. + * + * @returns {Function} A wrapped function that can be called to debounce execution. + */ + static debounce(callback, delay) { + let timeoutId; + return function(...args) { + globalThis.clearTimeout(timeoutId); + timeoutId = globalThis.setTimeout(() => { + callback.apply(this, args); + }, delay); + }; + } + /** + * @param {object} opts - Optional parameters. + * + * @param {Function} opts.single - Single click callback. + * + * @param {Function} opts.double - Double click callback. + * + * @param {number} [opts.delay=400] - Double click delay. + * + * @returns {(event: Event) => void} The gated double-click handler. + */ + static doubleClick({ single, double, delay = 400 }) { + let clicks = 0; + let timeoutId; + return (event) => { + clicks++; + if (clicks === 1) { + timeoutId = globalThis.setTimeout(() => { + if (typeof single === "function") { + single(event); + } + clicks = 0; + }, delay); + } else { + globalThis.clearTimeout(timeoutId); + if (typeof double === "function") { + double(event); + } + clicks = 0; + } + }; + } +} +function isReadableStore(store) { + if (store === null || store === void 0) { + return false; + } + switch (typeof store) { + case "function": + case "object": + return typeof store.subscribe === "function"; + } + return false; +} +function isUpdatableStore(store) { + if (store === null || store === void 0) { + return false; + } + switch (typeof store) { + case "function": + case "object": + return typeof store.subscribe === "function" && typeof store.update === "function"; + } + return false; +} +function isWritableStore(store) { + if (store === null || store === void 0) { + return false; + } + switch (typeof store) { + case "function": + case "object": + return typeof store.subscribe === "function" && typeof store.set === "function"; + } + return false; +} +function subscribeIgnoreFirst(store, update2) { + let firedFirst = false; + return store.subscribe((value) => { + if (!firedFirst) { + firedFirst = true; + } else { + update2(value); + } + }); +} +function subscribeFirstRest(store, first, update2) { + let firedFirst = false; + return store.subscribe((value) => { + if (!firedFirst) { + firedFirst = true; + first(value); + } else { + update2(value); + } + }); +} +function resizeObserver(node, target) { + ResizeObserverManager.add(node, target); + return { + /** + * @param {ResizeObserverTarget} newTarget - An object or function to update with observed width & height changes. + */ + update: (newTarget) => { + ResizeObserverManager.remove(node, target); + target = newTarget; + ResizeObserverManager.add(node, target); + }, + destroy: () => { + ResizeObserverManager.remove(node, target); + } + }; +} +resizeObserver.updateCache = function(el) { + if (!(el instanceof HTMLElement)) { + throw new TypeError(`resizeObserverUpdate error: 'el' is not an HTMLElement.`); + } + const subscribers = s_MAP.get(el); + if (Array.isArray(subscribers)) { + const computed = globalThis.getComputedStyle(el); + const borderBottom = StyleParse.pixels(el.style.borderBottom) ?? StyleParse.pixels(computed.borderBottom) ?? 0; + const borderLeft = StyleParse.pixels(el.style.borderLeft) ?? StyleParse.pixels(computed.borderLeft) ?? 0; + const borderRight = StyleParse.pixels(el.style.borderRight) ?? StyleParse.pixels(computed.borderRight) ?? 0; + const borderTop = StyleParse.pixels(el.style.borderTop) ?? StyleParse.pixels(computed.borderTop) ?? 0; + const paddingBottom = StyleParse.pixels(el.style.paddingBottom) ?? StyleParse.pixels(computed.paddingBottom) ?? 0; + const paddingLeft = StyleParse.pixels(el.style.paddingLeft) ?? StyleParse.pixels(computed.paddingLeft) ?? 0; + const paddingRight = StyleParse.pixels(el.style.paddingRight) ?? StyleParse.pixels(computed.paddingRight) ?? 0; + const paddingTop = StyleParse.pixels(el.style.paddingTop) ?? StyleParse.pixels(computed.paddingTop) ?? 0; + const additionalWidth = borderLeft + borderRight + paddingLeft + paddingRight; + const additionalHeight = borderTop + borderBottom + paddingTop + paddingBottom; + for (const subscriber of subscribers) { + subscriber.styles.additionalWidth = additionalWidth; + subscriber.styles.additionalHeight = additionalHeight; + s_UPDATE_SUBSCRIBER(subscriber, subscriber.contentWidth, subscriber.contentHeight); + } + } +}; +const s_MAP = /* @__PURE__ */ new Map(); +class ResizeObserverManager { + /** + * Add an HTMLElement and ResizeObserverTarget instance for monitoring. Create cached style attributes for the + * given element include border & padding dimensions for offset width / height calculations. + * + * @param {HTMLElement} el - The element to observe. + * + * @param {ResizeObserverTarget} target - A target that contains one of several mechanisms for updating resize data. + */ + static add(el, target) { + const updateType = s_GET_UPDATE_TYPE(target); + if (updateType === 0) { + throw new Error(`'target' does not match supported ResizeObserverManager update mechanisms.`); + } + const computed = globalThis.getComputedStyle(el); + const borderBottom = StyleParse.pixels(el.style.borderBottom) ?? StyleParse.pixels(computed.borderBottom) ?? 0; + const borderLeft = StyleParse.pixels(el.style.borderLeft) ?? StyleParse.pixels(computed.borderLeft) ?? 0; + const borderRight = StyleParse.pixels(el.style.borderRight) ?? StyleParse.pixels(computed.borderRight) ?? 0; + const borderTop = StyleParse.pixels(el.style.borderTop) ?? StyleParse.pixels(computed.borderTop) ?? 0; + const paddingBottom = StyleParse.pixels(el.style.paddingBottom) ?? StyleParse.pixels(computed.paddingBottom) ?? 0; + const paddingLeft = StyleParse.pixels(el.style.paddingLeft) ?? StyleParse.pixels(computed.paddingLeft) ?? 0; + const paddingRight = StyleParse.pixels(el.style.paddingRight) ?? StyleParse.pixels(computed.paddingRight) ?? 0; + const paddingTop = StyleParse.pixels(el.style.paddingTop) ?? StyleParse.pixels(computed.paddingTop) ?? 0; + const data = { + updateType, + target, + // Stores most recent contentRect.width and contentRect.height values from ResizeObserver. + contentWidth: 0, + contentHeight: 0, + // Convenience data for total border & padding for offset width & height calculations. + styles: { + additionalWidth: borderLeft + borderRight + paddingLeft + paddingRight, + additionalHeight: borderTop + borderBottom + paddingTop + paddingBottom + } + }; + if (s_MAP.has(el)) { + const subscribers = s_MAP.get(el); + subscribers.push(data); + } else { + s_MAP.set(el, [data]); + } + s_RESIZE_OBSERVER.observe(el); + } + /** + * Removes all targets from monitoring when just an element is provided otherwise removes a specific target + * from the monitoring map. If no more targets remain then the element is removed from monitoring. + * + * @param {HTMLElement} el - Element to remove from monitoring. + * + * @param {ResizeObserverTarget} [target] - A specific target to remove from monitoring. + */ + static remove(el, target = void 0) { + const subscribers = s_MAP.get(el); + if (Array.isArray(subscribers)) { + const index = subscribers.findIndex((entry) => entry.target === target); + if (index >= 0) { + s_UPDATE_SUBSCRIBER(subscribers[index], void 0, void 0); + subscribers.splice(index, 1); + } + if (subscribers.length === 0) { + s_MAP.delete(el); + s_RESIZE_OBSERVER.unobserve(el); + } + } + } +} +const s_UPDATE_TYPES = { + none: 0, + attribute: 1, + function: 2, + resizeObserved: 3, + setContentBounds: 4, + setDimension: 5, + storeObject: 6, + storesObject: 7 +}; +const s_RESIZE_OBSERVER = new ResizeObserver((entries) => { + for (const entry of entries) { + const subscribers = s_MAP.get(entry?.target); + if (Array.isArray(subscribers)) { + const contentWidth = entry.contentRect.width; + const contentHeight = entry.contentRect.height; + for (const subscriber of subscribers) { + s_UPDATE_SUBSCRIBER(subscriber, contentWidth, contentHeight); + } + } + } +}); +function s_GET_UPDATE_TYPE(target) { + if (target?.resizeObserved instanceof Function) { + return s_UPDATE_TYPES.resizeObserved; + } + if (target?.setDimension instanceof Function) { + return s_UPDATE_TYPES.setDimension; + } + if (target?.setContentBounds instanceof Function) { + return s_UPDATE_TYPES.setContentBounds; + } + const targetType = typeof target; + if (targetType !== null && (targetType === "object" || targetType === "function")) { + if (isUpdatableStore(target.resizeObserved)) { + return s_UPDATE_TYPES.storeObject; + } + const stores = target?.stores; + if (isObject(stores) || typeof stores === "function") { + if (isUpdatableStore(stores.resizeObserved)) { + return s_UPDATE_TYPES.storesObject; + } + } + } + if (targetType !== null && targetType === "object") { + return s_UPDATE_TYPES.attribute; + } + if (targetType === "function") { + return s_UPDATE_TYPES.function; + } + return s_UPDATE_TYPES.none; +} +function s_UPDATE_SUBSCRIBER(subscriber, contentWidth, contentHeight) { + const styles2 = subscriber.styles; + subscriber.contentWidth = contentWidth; + subscriber.contentHeight = contentHeight; + const offsetWidth = Number.isFinite(contentWidth) ? contentWidth + styles2.additionalWidth : void 0; + const offsetHeight = Number.isFinite(contentHeight) ? contentHeight + styles2.additionalHeight : void 0; + const target = subscriber.target; + switch (subscriber.updateType) { + case s_UPDATE_TYPES.attribute: + target.contentWidth = contentWidth; + target.contentHeight = contentHeight; + target.offsetWidth = offsetWidth; + target.offsetHeight = offsetHeight; + break; + case s_UPDATE_TYPES.function: + target?.(offsetWidth, offsetHeight, contentWidth, contentHeight); + break; + case s_UPDATE_TYPES.resizeObserved: + target.resizeObserved?.(offsetWidth, offsetHeight, contentWidth, contentHeight); + break; + case s_UPDATE_TYPES.setContentBounds: + target.setContentBounds?.(contentWidth, contentHeight); + break; + case s_UPDATE_TYPES.setDimension: + target.setDimension?.(offsetWidth, offsetHeight); + break; + case s_UPDATE_TYPES.storeObject: + target.resizeObserved.update((object) => { + object.contentHeight = contentHeight; + object.contentWidth = contentWidth; + object.offsetHeight = offsetHeight; + object.offsetWidth = offsetWidth; + return object; + }); + break; + case s_UPDATE_TYPES.storesObject: + target.stores.resizeObserved.update((object) => { + object.contentHeight = contentHeight; + object.contentWidth = contentWidth; + object.offsetHeight = offsetHeight; + object.offsetWidth = offsetWidth; + return object; + }); + break; + } +} +function applyScrolltop(element2, store) { + if (!isWritableStore(store)) { + throw new TypeError(`applyScrolltop error: 'store' must be a writable Svelte store.`); + } + function storeUpdate(value) { + if (!Number.isFinite(value)) { + return; + } + setTimeout(() => element2.scrollTop = value, 0); + } + let unsubscribe = store.subscribe(storeUpdate); + const resizeControl = resizeObserver(element2, Timing.debounce(() => { + if (element2.isConnected) { + store.set(element2.scrollTop); + } + }, 500)); + function onScroll(event) { + store.set(event.target.scrollTop); + } + const debounceFn = Timing.debounce((e) => onScroll(e), 500); + element2.addEventListener("scroll", debounceFn); + return { + /** + * @param {import('svelte/store').Writable} newStore - A writable store that stores the element scrollTop. + */ + update: (newStore) => { + unsubscribe(); + store = newStore; + if (!isWritableStore(store)) { + throw new TypeError(`applyScrolltop.update error: 'store' must be a writable Svelte store.`); + } + unsubscribe = store.subscribe(storeUpdate); + }, + destroy: () => { + element2.removeEventListener("scroll", debounceFn); + unsubscribe(); + resizeControl.destroy(); + } + }; +} +function applyStyles(node, properties) { + function setProperties() { + if (!isObject(properties)) { + return; + } + for (const prop of Object.keys(properties)) { + node.style.setProperty(`${prop}`, properties[prop]); + } + } + setProperties(); + return { + /** + * @param {Record} newProperties - Key / value object of properties to set. + */ + update: (newProperties) => { + properties = newProperties; + setProperties(); + } + }; +} +function lerp(start, end, amount) { + return (1 - amount) * start + amount * end; +} +class TJSDefaultTransition { + static #options = {}; + static #default = () => void 0; + /** + * @returns {() => undefined} Default empty transition. + */ + static get default() { + return this.#default; + } + /** + * @returns {{}} Default empty options. + */ + static get options() { + return this.#options; + } +} +function create_else_block$6(ctx) { + let div; + let applyStyles_action; + let div_intro; + let div_outro; + let current; + let mounted; + let dispose; + const default_slot_template = ( + /*#slots*/ + ctx[20].default + ); + const default_slot = create_slot( + default_slot_template, + ctx, + /*$$scope*/ + ctx[19], + null + ); + return { + c() { + div = element("div"); + if (default_slot) default_slot.c(); + attr(div, "class", "tjs-glass-pane-background svelte-gas-hqedxf"); + set_style( + div, + "background", + /*background*/ + ctx[5] + ); + }, + m(target, anchor) { + insert(target, div, anchor); + if (default_slot) { + default_slot.m(div, null); + } + ctx[23](div); + current = true; + if (!mounted) { + dispose = action_destroyer(applyStyles_action = applyStyles.call( + null, + div, + /*styles*/ + ctx[7] + )); + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if (default_slot) { + if (default_slot.p && (!current || dirty & /*$$scope*/ + 524288)) { + update_slot_base( + default_slot, + default_slot_template, + ctx, + /*$$scope*/ + ctx[19], + !current ? get_all_dirty_from_scope( + /*$$scope*/ + ctx[19] + ) : get_slot_changes( + default_slot_template, + /*$$scope*/ + ctx[19], + dirty, + null + ), + null + ); + } + } + if (applyStyles_action && is_function(applyStyles_action.update) && dirty & /*styles*/ + 128) applyStyles_action.update.call( + null, + /*styles*/ + ctx[7] + ); + if (dirty & /*background*/ + 32) { + set_style( + div, + "background", + /*background*/ + ctx[5] + ); + } + }, + i(local) { + if (current) return; + transition_in(default_slot, local); + add_render_callback(() => { + if (!current) return; + if (div_outro) div_outro.end(1); + div_intro = create_in_transition( + div, + /*inTransition*/ + ctx[1], + /*inTransitionOptions*/ + ctx[3] + ); + div_intro.start(); + }); + current = true; + }, + o(local) { + transition_out(default_slot, local); + if (div_intro) div_intro.invalidate(); + div_outro = create_out_transition( + div, + /*outTransition*/ + ctx[2], + /*outTransitionOptions*/ + ctx[4] + ); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + if (default_slot) default_slot.d(detaching); + ctx[23](null); + if (detaching && div_outro) div_outro.end(); + mounted = false; + dispose(); + } + }; +} +function create_if_block$b(ctx) { + let div0; + let applyStyles_action; + let div0_intro; + let div0_outro; + let t; + let div1; + let current; + let mounted; + let dispose; + const default_slot_template = ( + /*#slots*/ + ctx[20].default + ); + const default_slot = create_slot( + default_slot_template, + ctx, + /*$$scope*/ + ctx[19], + null + ); + return { + c() { + div0 = element("div"); + t = space(); + div1 = element("div"); + if (default_slot) default_slot.c(); + attr(div0, "class", "tjs-glass-pane-background svelte-gas-hqedxf"); + set_style( + div0, + "background", + /*background*/ + ctx[5] + ); + attr(div1, "class", "tjs-glass-pane-container svelte-gas-hqedxf"); + }, + m(target, anchor) { + insert(target, div0, anchor); + ctx[21](div0); + insert(target, t, anchor); + insert(target, div1, anchor); + if (default_slot) { + default_slot.m(div1, null); + } + ctx[22](div1); + current = true; + if (!mounted) { + dispose = action_destroyer(applyStyles_action = applyStyles.call( + null, + div0, + /*styles*/ + ctx[7] + )); + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if (applyStyles_action && is_function(applyStyles_action.update) && dirty & /*styles*/ + 128) applyStyles_action.update.call( + null, + /*styles*/ + ctx[7] + ); + if (dirty & /*background*/ + 32) { + set_style( + div0, + "background", + /*background*/ + ctx[5] + ); + } + if (default_slot) { + if (default_slot.p && (!current || dirty & /*$$scope*/ + 524288)) { + update_slot_base( + default_slot, + default_slot_template, + ctx, + /*$$scope*/ + ctx[19], + !current ? get_all_dirty_from_scope( + /*$$scope*/ + ctx[19] + ) : get_slot_changes( + default_slot_template, + /*$$scope*/ + ctx[19], + dirty, + null + ), + null + ); + } + } + }, + i(local) { + if (current) return; + add_render_callback(() => { + if (!current) return; + if (div0_outro) div0_outro.end(1); + div0_intro = create_in_transition( + div0, + /*inTransition*/ + ctx[1], + /*inTransitionOptions*/ + ctx[3] + ); + div0_intro.start(); + }); + transition_in(default_slot, local); + current = true; + }, + o(local) { + if (div0_intro) div0_intro.invalidate(); + div0_outro = create_out_transition( + div0, + /*outTransition*/ + ctx[2], + /*outTransitionOptions*/ + ctx[4] + ); + transition_out(default_slot, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div0); + detach(t); + detach(div1); + } + ctx[21](null); + if (detaching && div0_outro) div0_outro.end(); + if (default_slot) default_slot.d(detaching); + ctx[22](null); + mounted = false; + dispose(); + } + }; +} +function create_fragment$m(ctx) { + let div; + let current_block_type_index; + let if_block; + let current; + let mounted; + let dispose; + const if_block_creators = [create_if_block$b, create_else_block$6]; + const if_blocks = []; + function select_block_type(ctx2, dirty) { + if ( + /*slotSeparate*/ + ctx2[0] + ) return 0; + return 1; + } + current_block_type_index = select_block_type(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + return { + c() { + div = element("div"); + if_block.c(); + attr( + div, + "id", + /*id*/ + ctx[6] + ); + attr(div, "class", "tjs-glass-pane svelte-gas-hqedxf"); + set_style( + div, + "z-index", + /*zIndex*/ + ctx[8] + ); + }, + m(target, anchor) { + insert(target, div, anchor); + if_blocks[current_block_type_index].m(div, null); + ctx[24](div); + current = true; + if (!mounted) { + dispose = [ + listen( + window, + "contextmenu", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "dblclick", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "keydown", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "keyup", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "mousedown", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "mousemove", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "mouseup", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "pointerdown", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "pointermove", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "pointerup", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "touchend", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "touchmove", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "touchstart", + /*swallow*/ + ctx[12], + true + ), + listen( + window, + "wheel", + /*swallow*/ + ctx[12], + true + ) + ]; + mounted = true; + } + }, + p(ctx2, [dirty]) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx2); + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } else { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + if_block = if_blocks[current_block_type_index]; + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block.c(); + } else { + if_block.p(ctx2, dirty); + } + transition_in(if_block, 1); + if_block.m(div, null); + } + if (!current || dirty & /*id*/ + 64) { + attr( + div, + "id", + /*id*/ + ctx2[6] + ); + } + if (dirty & /*zIndex*/ + 256) { + set_style( + div, + "z-index", + /*zIndex*/ + ctx2[8] + ); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + if_blocks[current_block_type_index].d(); + ctx[24](null); + mounted = false; + run_all(dispose); + } + }; +} +function instance$m($$self, $$props, $$invalidate) { + let { $$slots: slots = {}, $$scope } = $$props; + let { background: background2 = "#50505080" } = $$props; + let { captureInput = true } = $$props; + let { closeOnInput = void 0 } = $$props; + let { id: id2 = void 0 } = $$props; + let { slotSeparate = void 0 } = $$props; + let { styles: styles2 = void 0 } = $$props; + let { zIndex = Number.MAX_SAFE_INTEGER } = $$props; + const dispatch2 = createEventDispatcher(); + let backgroundEl, containerEl, glassPaneEl; + let { transition = void 0 } = $$props; + let { inTransition = void 0 } = $$props; + let { outTransition = void 0 } = $$props; + let { transitionOptions = void 0 } = $$props; + let { inTransitionOptions = TJSDefaultTransition.options } = $$props; + let { outTransitionOptions = TJSDefaultTransition.options } = $$props; + let oldTransition = void 0; + let oldTransitionOptions = void 0; + function swallow(event) { + const targetEl = event.target; + if (targetEl !== glassPaneEl && targetEl !== backgroundEl && targetEl !== containerEl && glassPaneEl.contains(targetEl)) { + return; + } + if (captureInput) { + event.preventDefault(); + event.stopImmediatePropagation(); + } + if (event?.type === "pointerdown" && closeOnInput) { + dispatch2("close:glasspane"); + } + } + function div0_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + backgroundEl = $$value; + $$invalidate(9, backgroundEl); + }); + } + function div1_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + containerEl = $$value; + $$invalidate(10, containerEl); + }); + } + function div_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + backgroundEl = $$value; + $$invalidate(9, backgroundEl); + }); + } + function div_binding_1($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + glassPaneEl = $$value; + $$invalidate(11, glassPaneEl); + }); + } + $$self.$$set = ($$props2) => { + if ("background" in $$props2) $$invalidate(5, background2 = $$props2.background); + if ("captureInput" in $$props2) $$invalidate(13, captureInput = $$props2.captureInput); + if ("closeOnInput" in $$props2) $$invalidate(14, closeOnInput = $$props2.closeOnInput); + if ("id" in $$props2) $$invalidate(6, id2 = $$props2.id); + if ("slotSeparate" in $$props2) $$invalidate(0, slotSeparate = $$props2.slotSeparate); + if ("styles" in $$props2) $$invalidate(7, styles2 = $$props2.styles); + if ("zIndex" in $$props2) $$invalidate(8, zIndex = $$props2.zIndex); + if ("transition" in $$props2) $$invalidate(15, transition = $$props2.transition); + if ("inTransition" in $$props2) $$invalidate(1, inTransition = $$props2.inTransition); + if ("outTransition" in $$props2) $$invalidate(2, outTransition = $$props2.outTransition); + if ("transitionOptions" in $$props2) $$invalidate(16, transitionOptions = $$props2.transitionOptions); + if ("inTransitionOptions" in $$props2) $$invalidate(3, inTransitionOptions = $$props2.inTransitionOptions); + if ("outTransitionOptions" in $$props2) $$invalidate(4, outTransitionOptions = $$props2.outTransitionOptions); + if ("$$scope" in $$props2) $$invalidate(19, $$scope = $$props2.$$scope); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*slotSeparate*/ + 1) { + $$invalidate(0, slotSeparate = typeof slotSeparate === "boolean" ? slotSeparate : false); + } + if ($$self.$$.dirty & /*oldTransition, transition*/ + 163840) { + if (oldTransition !== transition) { + const newTransition = typeof transition === "function" ? transition : void 0; + $$invalidate(1, inTransition = newTransition); + $$invalidate(2, outTransition = newTransition); + $$invalidate(17, oldTransition = newTransition); + } + } + if ($$self.$$.dirty & /*oldTransitionOptions, transitionOptions*/ + 327680) { + if (oldTransitionOptions !== transitionOptions) { + const newOptions = transitionOptions !== TJSDefaultTransition.options && isObject(transitionOptions) ? transitionOptions : TJSDefaultTransition.options; + $$invalidate(3, inTransitionOptions = newOptions); + $$invalidate(4, outTransitionOptions = newOptions); + $$invalidate(18, oldTransitionOptions = newOptions); + } + } + if ($$self.$$.dirty & /*inTransition*/ + 2) { + if (typeof inTransition !== "function") { + $$invalidate(1, inTransition = void 0); + } + } + if ($$self.$$.dirty & /*outTransition*/ + 4) { + if (typeof outTransition !== "function") { + $$invalidate(2, outTransition = void 0); + } + } + if ($$self.$$.dirty & /*inTransitionOptions*/ + 8) { + if (!isObject(inTransitionOptions)) { + $$invalidate(3, inTransitionOptions = TJSDefaultTransition.options); + } + } + if ($$self.$$.dirty & /*outTransitionOptions*/ + 16) { + if (!isObject(outTransitionOptions)) { + $$invalidate(4, outTransitionOptions = TJSDefaultTransition.options); + } + } + }; + return [ + slotSeparate, + inTransition, + outTransition, + inTransitionOptions, + outTransitionOptions, + background2, + id2, + styles2, + zIndex, + backgroundEl, + containerEl, + glassPaneEl, + swallow, + captureInput, + closeOnInput, + transition, + transitionOptions, + oldTransition, + oldTransitionOptions, + $$scope, + slots, + div0_binding, + div1_binding, + div_binding, + div_binding_1 + ]; +} +class TJSGlassPane extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$m, create_fragment$m, safe_not_equal, { + background: 5, + captureInput: 13, + closeOnInput: 14, + id: 6, + slotSeparate: 0, + styles: 7, + zIndex: 8, + transition: 15, + inTransition: 1, + outTransition: 2, + transitionOptions: 16, + inTransitionOptions: 3, + outTransitionOptions: 4 + }); + } +} +const subscriber_queue = []; +function readable(value, start) { + return { + subscribe: writable(value, start).subscribe + }; +} +function writable(value, start = noop) { + let stop; + const subscribers = /* @__PURE__ */ new Set(); + function set2(new_value) { + if (safe_not_equal(value, new_value)) { + value = new_value; + if (stop) { + const run_queue = !subscriber_queue.length; + for (const subscriber of subscribers) { + subscriber[1](); + subscriber_queue.push(subscriber, value); + } + if (run_queue) { + for (let i = 0; i < subscriber_queue.length; i += 2) { + subscriber_queue[i][0](subscriber_queue[i + 1]); + } + subscriber_queue.length = 0; + } + } + } + } + function update2(fn) { + set2(fn(value)); + } + function subscribe2(run2, invalidate = noop) { + const subscriber = [run2, invalidate]; + subscribers.add(subscriber); + if (subscribers.size === 1) { + stop = start(set2, update2) || noop; + } + run2(value); + return () => { + subscribers.delete(subscriber); + if (subscribers.size === 0 && stop) { + stop(); + stop = null; + } + }; + } + return { set: set2, update: update2, subscribe: subscribe2 }; +} +function derived(stores, fn, initial_value) { + const single = !Array.isArray(stores); + const stores_array = single ? [stores] : stores; + if (!stores_array.every(Boolean)) { + throw new Error("derived() expects stores as input, got a falsy value"); + } + const auto = fn.length < 2; + return readable(initial_value, (set2, update2) => { + let started = false; + const values = []; + let pending = 0; + let cleanup = noop; + const sync = () => { + if (pending) { + return; + } + cleanup(); + const result = fn(single ? values[0] : values, set2, update2); + if (auto) { + set2(result); + } else { + cleanup = is_function(result) ? result : noop; + } + }; + const unsubscribers = stores_array.map( + (store, i) => subscribe( + store, + (value) => { + values[i] = value; + pending &= ~(1 << i); + if (started) { + sync(); + } + }, + () => { + pending |= 1 << i; + } + ) + ); + started = true; + sync(); + return function stop() { + run_all(unsubscribers); + cleanup(); + started = false; + }; + }); +} +class AppShellContextInternal { + /** @type {InternalAppStores} */ + #stores; + constructor() { + this.#stores = { + elementContent: writable(void 0), + elementRoot: writable(void 0) + }; + Object.freeze(this.#stores); + Object.seal(this); + } + /** + * @returns {InternalAppStores} The internal context stores for elementContent / elementRoot + */ + get stores() { + return this.#stores; + } +} +function isHMRProxy(comp) { + const instanceName = comp?.constructor?.name; + if (typeof instanceName === "string" && (instanceName.startsWith("Proxy<") || instanceName === "ProxyComponent")) { + return true; + } + const prototypeName = comp?.prototype?.constructor?.name; + return typeof prototypeName === "string" && (prototypeName.startsWith("Proxy<") || prototypeName === "ProxyComponent"); +} +function isSvelteComponent(comp) { + if (comp === null || comp === void 0 || typeof comp !== "function") { + return false; + } + const prototypeName = comp?.prototype?.constructor?.name; + if (typeof prototypeName === "string" && (prototypeName.startsWith("Proxy<") || prototypeName === "ProxyComponent")) { + return true; + } + return typeof window !== "undefined" ? typeof comp.prototype.$destroy === "function" && typeof comp.prototype.$on === "function" : ( + // client-side + typeof comp.render === "function" + ); +} +async function outroAndDestroy(instance2) { + return new Promise((resolve) => { + if (instance2.$$.fragment && instance2.$$.fragment.o) { + group_outros(); + transition_out(instance2.$$.fragment, 0, 0, () => { + instance2.$destroy(); + resolve(); + }); + check_outros(); + } else { + instance2.$destroy(); + resolve(); + } + }); +} +function parseTJSSvelteConfig(config, thisArg = void 0) { + if (!isObject(config)) { + throw new TypeError(`parseSvelteConfig - 'config' is not an object: +${JSON.stringify(config)}.`); + } + if (!isSvelteComponent(config.class)) { + throw new TypeError( + `parseSvelteConfig - 'class' is not a Svelte component constructor for config: +${JSON.stringify(config)}.` + ); + } + if (config.hydrate !== void 0 && typeof config.hydrate !== "boolean") { + throw new TypeError( + `parseSvelteConfig - 'hydrate' is not a boolean for config: +${JSON.stringify(config)}.` + ); + } + if (config.intro !== void 0 && typeof config.intro !== "boolean") { + throw new TypeError( + `parseSvelteConfig - 'intro' is not a boolean for config: +${JSON.stringify(config)}.` + ); + } + if (config.target !== void 0 && typeof config.target !== "string" && !(config.target instanceof HTMLElement) && !(config.target instanceof ShadowRoot) && !(config.target instanceof DocumentFragment)) { + throw new TypeError( + `parseSvelteConfig - 'target' is not a string, HTMLElement, ShadowRoot, or DocumentFragment for config: +${JSON.stringify(config)}.` + ); + } + if (config.anchor !== void 0 && typeof config.anchor !== "string" && !(config.anchor instanceof HTMLElement) && !(config.anchor instanceof ShadowRoot) && !(config.anchor instanceof DocumentFragment)) { + throw new TypeError( + `parseSvelteConfig - 'anchor' is not a string, HTMLElement, ShadowRoot, or DocumentFragment for config: +${JSON.stringify(config)}.` + ); + } + if (config.context !== void 0 && typeof config.context !== "function" && !(config.context instanceof Map) && !isObject(config.context)) { + throw new TypeError( + `parseSvelteConfig - 'context' is not a Map, function or object for config: +${JSON.stringify(config)}.` + ); + } + if (config.selectorTarget !== void 0 && typeof config.selectorTarget !== "string") { + throw new TypeError( + `parseSvelteConfig - 'selectorTarget' is not a string for config: +${JSON.stringify(config)}.` + ); + } + if (config.options !== void 0 && !isObject(config.options)) { + throw new TypeError( + `parseSvelteConfig - 'options' is not an object for config: +${JSON.stringify(config)}.` + ); + } + if (config.options !== void 0) { + if (config.options.injectApp !== void 0 && typeof config.options.injectApp !== "boolean") { + throw new TypeError( + `parseSvelteConfig - 'options.injectApp' is not a boolean for config: +${JSON.stringify(config)}.` + ); + } + if (config.options.injectEventbus !== void 0 && typeof config.options.injectEventbus !== "boolean") { + throw new TypeError( + `parseSvelteConfig - 'options.injectEventbus' is not a boolean for config: +${JSON.stringify(config)}.` + ); + } + if (config.options.selectorElement !== void 0 && typeof config.options.selectorElement !== "string") { + throw new TypeError( + `parseSvelteConfig - 'selectorElement' is not a string for config: +${JSON.stringify(config)}.` + ); + } + } + const svelteConfig = { ...config }; + delete svelteConfig.options; + let externalContext = {}; + if (typeof svelteConfig.context === "function") { + const contextFunc = svelteConfig.context; + delete svelteConfig.context; + const result = contextFunc.call(thisArg); + if (isObject(result)) { + externalContext = { ...result }; + } else { + throw new Error(`parseSvelteConfig - 'context' is a function that did not return an object for config: +${JSON.stringify(config)}`); + } + } else if (svelteConfig.context instanceof Map) { + externalContext = Object.fromEntries(svelteConfig.context); + delete svelteConfig.context; + } else if (isObject(svelteConfig.context)) { + externalContext = svelteConfig.context; + delete svelteConfig.context; + } + svelteConfig.props = s_PROCESS_PROPS(svelteConfig.props, thisArg, config); + if (Array.isArray(svelteConfig.children)) { + const children2 = []; + for (let cntr = 0; cntr < svelteConfig.children.length; cntr++) { + const child = svelteConfig.children[cntr]; + if (!isSvelteComponent(child.class)) { + throw new Error(`parseSvelteConfig - 'class' is not a Svelte component for child[${cntr}] for config: +${JSON.stringify(config)}`); + } + child.props = s_PROCESS_PROPS(child.props, thisArg, config); + children2.push(child); + } + if (children2.length > 0) { + externalContext.children = children2; + } + delete svelteConfig.children; + } else if (isObject(svelteConfig.children)) { + if (!isSvelteComponent(svelteConfig.children.class)) { + throw new Error(`parseSvelteConfig - 'class' is not a Svelte component for children object for config: +${JSON.stringify(config)}`); + } + svelteConfig.children.props = s_PROCESS_PROPS(svelteConfig.children.props, thisArg, config); + externalContext.children = [svelteConfig.children]; + delete svelteConfig.children; + } + if (!(svelteConfig.context instanceof Map)) { + svelteConfig.context = /* @__PURE__ */ new Map(); + } + svelteConfig.context.set("#external", externalContext); + return svelteConfig; +} +function s_PROCESS_PROPS(props, thisArg, config) { + if (typeof props === "function") { + const result = props.call(thisArg); + if (isObject(result)) { + return result; + } else { + throw new Error(`parseSvelteConfig - 'props' is a function that did not return an object for config: +${JSON.stringify(config)}`); + } + } else if (isObject(props)) { + return props; + } else if (props !== void 0) { + throw new Error( + `parseSvelteConfig - 'props' is not a function or an object for config: +${JSON.stringify(config)}` + ); + } + return {}; +} +function localize(stringId, data) { + const result = !isObject(data) ? globalThis.game.i18n.localize(stringId) : globalThis.game.i18n.format(stringId, data); + return result !== void 0 ? result : ""; +} +function writableDerived(origins, derive, reflect, initial) { + var childDerivedSetter, originValues, blockNextDerive = false; + var reflectOldValues = reflect.length >= 2; + var wrappedDerive = (got, set2, update3) => { + childDerivedSetter = set2; + if (reflectOldValues) { + originValues = got; + } + if (!blockNextDerive) { + let returned = derive(got, set2, update3); + if (derive.length < 2) { + set2(returned); + } else { + return returned; + } + } + blockNextDerive = false; + }; + var childDerived = derived(origins, wrappedDerive, initial); + var singleOrigin = !Array.isArray(origins); + function doReflect(reflecting) { + var setWith = reflect(reflecting, originValues); + if (singleOrigin) { + blockNextDerive = true; + origins.set(setWith); + } else { + setWith.forEach((value, i) => { + blockNextDerive = true; + origins[i].set(value); + }); + } + blockNextDerive = false; + } + var tryingSet = false; + function update2(fn) { + var isUpdated, mutatedBySubscriptions, oldValue, newValue; + if (tryingSet) { + newValue = fn(get_store_value(childDerived)); + childDerivedSetter(newValue); + return; + } + var unsubscribe = childDerived.subscribe((value) => { + if (!tryingSet) { + oldValue = value; + } else if (!isUpdated) { + isUpdated = true; + } else { + mutatedBySubscriptions = true; + } + }); + newValue = fn(oldValue); + tryingSet = true; + childDerivedSetter(newValue); + unsubscribe(); + tryingSet = false; + if (mutatedBySubscriptions) { + newValue = get_store_value(childDerived); + } + if (isUpdated) { + doReflect(newValue); + } + } + return { + subscribe: childDerived.subscribe, + set(value) { + update2(() => value); + }, + update: update2 + }; +} +function propertyStore(origin, propName) { + if (!Array.isArray(propName)) { + return writableDerived( + origin, + (object) => object[propName], + (reflecting, object) => { + object[propName] = reflecting; + return object; + } + ); + } else { + let props = propName.concat(); + return writableDerived( + origin, + (value) => { + for (let i = 0; i < props.length; ++i) { + value = value[props[i]]; + } + return value; + }, + (reflecting, object) => { + let target = object; + for (let i = 0; i < props.length - 1; ++i) { + target = target[props[i]]; + } + target[props[props.length - 1]] = reflecting; + return object; + } + ); + } +} +const EPSILON = 1e-6; +const IDENTITY_4X4 = new Float32Array([ + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1 +]); +class Mat4 extends Float32Array { + /** + * The number of bytes in a {@link Mat4}. + */ + static BYTE_LENGTH = 16 * Float32Array.BYTES_PER_ELEMENT; + /** + * Create a {@link Mat4}. + */ + constructor(...values) { + switch (values.length) { + case 16: + super(values); + break; + case 2: + super(values[0], values[1], 16); + break; + case 1: + const v = values[0]; + if (typeof v === "number") { + super([ + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v, + v + ]); + } else { + super(v, 0, 16); + } + break; + default: + super(IDENTITY_4X4); + break; + } + } + //============ + // Attributes + //============ + /** + * A string representation of `this` + * Equivalent to `Mat4.str(this);` + */ + get str() { + return Mat4.str(this); + } + //=================== + // Instance methods + //=================== + /** + * Copy the values from another {@link Mat4} into `this`. + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Set `this` to the identity matrix + * Equivalent to Mat4.identity(this) + * + * @returns `this` + */ + identity() { + this.set(IDENTITY_4X4); + return this; + } + /** + * Multiplies this {@link Mat4} against another one + * Equivalent to `Mat4.multiply(this, this, b);` + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `this` + */ + multiply(b) { + return Mat4.multiply(this, this, b); + } + /** + * Alias for {@link Mat4.multiply} + */ + mul(b) { + return this; + } + /** + * Transpose this {@link Mat4} + * Equivalent to `Mat4.transpose(this, this);` + * + * @returns `this` + */ + transpose() { + return Mat4.transpose(this, this); + } + /** + * Inverts this {@link Mat4} + * Equivalent to `Mat4.invert(this, this);` + * + * @returns `this` + */ + invert() { + return Mat4.invert(this, this); + } + /** + * Translate this {@link Mat4} by the given vector + * Equivalent to `Mat4.translate(this, this, v);` + * + * @param v - The {@link Vec3} to translate by + * @returns `this` + */ + translate(v) { + return Mat4.translate(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the given axis + * Equivalent to `Mat4.rotate(this, this, rad, axis);` + * + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` + */ + rotate(rad, axis) { + return Mat4.rotate(this, this, rad, axis); + } + /** + * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization + * Equivalent to `Mat4.scale(this, this, v);` + * + * @param v - The {@link Vec3} to scale the matrix by + * @returns `this` + */ + scale(v) { + return Mat4.scale(this, this, v); + } + /** + * Rotates this {@link Mat4} by the given angle around the X axis + * Equivalent to `Mat4.rotateX(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateX(rad) { + return Mat4.rotateX(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Y axis + * Equivalent to `Mat4.rotateY(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateY(rad) { + return Mat4.rotateY(this, this, rad); + } + /** + * Rotates this {@link Mat4} by the given angle around the Z axis + * Equivalent to `Mat4.rotateZ(this, this, rad);` + * + * @param rad - the angle to rotate the matrix by + * @returns `this` + */ + rotateZ(rad) { + return Mat4.rotateZ(this, this, rad); + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);` + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveNO(fovy, aspect, near, far) { + return Mat4.perspectiveNO(this, fovy, aspect, near, far); + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);` + * + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `this` + */ + perspectiveZO(fovy, aspect, near, far) { + return Mat4.perspectiveZO(this, fovy, aspect, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);` + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoNO(left, right, bottom, top, near, far) { + return Mat4.orthoNO(this, left, right, bottom, top, near, far); + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);` + * + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `this` + */ + orthoZO(left, right, bottom, top, near, far) { + return Mat4.orthoZO(this, left, right, bottom, top, near, far); + } + //================ + // Static methods + //================ + /** + * Creates a new, identity {@link Mat4} + * @category Static + * + * @returns A new {@link Mat4} + */ + static create() { + return new Mat4(); + } + /** + * Creates a new {@link Mat4} initialized with values from an existing matrix + * @category Static + * + * @param a - Matrix to clone + * @returns A new {@link Mat4} + */ + static clone(a) { + return new Mat4(a); + } + /** + * Copy the values from one {@link Mat4} to another + * @category Static + * + * @param out - The receiving Matrix + * @param a - Matrix to copy + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Create a new mat4 with the given values + * @category Static + * + * @param values - Matrix components + * @returns A new {@link Mat4} + */ + static fromValues(...values) { + return new Mat4(...values); + } + /** + * Set the components of a mat4 to the given values + * @category Static + * + * @param out - The receiving matrix + * @param values - Matrix components + * @returns `out` + */ + static set(out, ...values) { + out[0] = values[0]; + out[1] = values[1]; + out[2] = values[2]; + out[3] = values[3]; + out[4] = values[4]; + out[5] = values[5]; + out[6] = values[6]; + out[7] = values[7]; + out[8] = values[8]; + out[9] = values[9]; + out[10] = values[10]; + out[11] = values[11]; + out[12] = values[12]; + out[13] = values[13]; + out[14] = values[14]; + out[15] = values[15]; + return out; + } + /** + * Set a {@link Mat4} to the identity matrix + * @category Static + * + * @param out - The receiving Matrix + * @returns `out` + */ + static identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Transpose the values of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static transpose(out, a) { + if (out === a) { + const a01 = a[1], a02 = a[2], a03 = a[3]; + const a12 = a[6], a13 = a[7]; + const a23 = a[11]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a01; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a02; + out[9] = a12; + out[11] = a[14]; + out[12] = a03; + out[13] = a13; + out[14] = a23; + } else { + out[0] = a[0]; + out[1] = a[4]; + out[2] = a[8]; + out[3] = a[12]; + out[4] = a[1]; + out[5] = a[5]; + out[6] = a[9]; + out[7] = a[13]; + out[8] = a[2]; + out[9] = a[6]; + out[10] = a[10]; + out[11] = a[14]; + out[12] = a[3]; + out[13] = a[7]; + out[14] = a[11]; + out[15] = a[15]; + } + return out; + } + /** + * Inverts a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static invert(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + /** + * Calculates the adjugate of a {@link Mat4} + * @category Static + * + * @param out - the receiving matrix + * @param a - the source matrix + * @returns `out` + */ + static adjoint(out, a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b00 = a00 * a11 - a01 * a10; + const b01 = a00 * a12 - a02 * a10; + const b02 = a00 * a13 - a03 * a10; + const b03 = a01 * a12 - a02 * a11; + const b04 = a01 * a13 - a03 * a11; + const b05 = a02 * a13 - a03 * a12; + const b06 = a20 * a31 - a21 * a30; + const b07 = a20 * a32 - a22 * a30; + const b08 = a20 * a33 - a23 * a30; + const b09 = a21 * a32 - a22 * a31; + const b10 = a21 * a33 - a23 * a31; + const b11 = a22 * a33 - a23 * a32; + out[0] = a11 * b11 - a12 * b10 + a13 * b09; + out[1] = a02 * b10 - a01 * b11 - a03 * b09; + out[2] = a31 * b05 - a32 * b04 + a33 * b03; + out[3] = a22 * b04 - a21 * b05 - a23 * b03; + out[4] = a12 * b08 - a10 * b11 - a13 * b07; + out[5] = a00 * b11 - a02 * b08 + a03 * b07; + out[6] = a32 * b02 - a30 * b05 - a33 * b01; + out[7] = a20 * b05 - a22 * b02 + a23 * b01; + out[8] = a10 * b10 - a11 * b08 + a13 * b06; + out[9] = a01 * b08 - a00 * b10 - a03 * b06; + out[10] = a30 * b04 - a31 * b02 + a33 * b00; + out[11] = a21 * b02 - a20 * b04 - a23 * b00; + out[12] = a11 * b07 - a10 * b09 - a12 * b06; + out[13] = a00 * b09 - a01 * b07 + a02 * b06; + out[14] = a31 * b01 - a30 * b03 - a32 * b00; + out[15] = a20 * b03 - a21 * b01 + a22 * b00; + return out; + } + /** + * Calculates the determinant of a {@link Mat4} + * @category Static + * + * @param a - the source matrix + * @returns determinant of a + */ + static determinant(a) { + const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + const b0 = a00 * a11 - a01 * a10; + const b1 = a00 * a12 - a02 * a10; + const b2 = a01 * a12 - a02 * a11; + const b3 = a20 * a31 - a21 * a30; + const b4 = a20 * a32 - a22 * a30; + const b5 = a21 * a32 - a22 * a31; + const b6 = a00 * b5 - a01 * b4 + a02 * b3; + const b7 = a10 * b5 - a11 * b4 + a12 * b3; + const b8 = a20 * b2 - a21 * b1 + a22 * b0; + const b9 = a30 * b2 - a31 * b1 + a32 * b0; + return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9; + } + /** + * Multiplies two {@link Mat4}s + * @category Static + * + * @param out - The receiving Matrix + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static multiply(out, a, b) { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const a30 = a[12]; + const a31 = a[13]; + const a32 = a[14]; + const a33 = a[15]; + let b0 = b[0]; + let b1 = b[1]; + let b2 = b[2]; + let b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + /** + * Alias for {@link Mat4.multiply} + * @category Static + */ + static mul(out, a, b) { + return out; + } + /** + * Translate a {@link Mat4} by the given vector + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to translate + * @param v - vector to translate by + * @returns `out` + */ + static translate(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + /** + * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param v - the {@link Vec3} to scale the matrix by + * @returns `out` + **/ + static scale(out, a, v) { + const x = v[0]; + const y = v[1]; + const z = v[2]; + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + /** + * Rotates a {@link Mat4} by the given angle around the given axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` + */ + static rotate(out, a, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4]; + const a11 = a[5]; + const a12 = a[6]; + const a13 = a[7]; + const a20 = a[8]; + const a21 = a[9]; + const a22 = a[10]; + const a23 = a[11]; + const b00 = x * x * t + c; + const b01 = y * x * t + z * s; + const b02 = z * x * t - y * s; + const b10 = x * y * t - z * s; + const b11 = y * y * t + c; + const b12 = z * y * t + x * s; + const b20 = x * z * t + y * s; + const b21 = y * z * t - x * s; + const b22 = z * z * t + c; + out[0] = a00 * b00 + a10 * b01 + a20 * b02; + out[1] = a01 * b00 + a11 * b01 + a21 * b02; + out[2] = a02 * b00 + a12 * b01 + a22 * b02; + out[3] = a03 * b00 + a13 * b01 + a23 * b02; + out[4] = a00 * b10 + a10 * b11 + a20 * b12; + out[5] = a01 * b10 + a11 * b11 + a21 * b12; + out[6] = a02 * b10 + a12 * b11 + a22 * b12; + out[7] = a03 * b10 + a13 * b11 + a23 * b12; + out[8] = a00 * b20 + a10 * b21 + a20 * b22; + out[9] = a01 * b20 + a11 * b21 + a21 * b22; + out[10] = a02 * b20 + a12 * b21 + a22 * b22; + out[11] = a03 * b20 + a13 * b21 + a23 * b22; + if (a !== out) { + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + return out; + } + /** + * Rotates a matrix by the given angle around the X axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateX(out, a, rad) { + let s = Math.sin(rad); + let c = Math.cos(rad); + let a10 = a[4]; + let a11 = a[5]; + let a12 = a[6]; + let a13 = a[7]; + let a20 = a[8]; + let a21 = a[9]; + let a22 = a[10]; + let a23 = a[11]; + if (a !== out) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + /** + * Rotates a matrix by the given angle around the Y axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateY(out, a, rad) { + let s = Math.sin(rad); + let c = Math.cos(rad); + let a00 = a[0]; + let a01 = a[1]; + let a02 = a[2]; + let a03 = a[3]; + let a20 = a[8]; + let a21 = a[9]; + let a22 = a[10]; + let a23 = a[11]; + if (a !== out) { + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + /** + * Rotates a matrix by the given angle around the Z axis + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to rotate + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static rotateZ(out, a, rad) { + let s = Math.sin(rad); + let c = Math.cos(rad); + let a00 = a[0]; + let a01 = a[1]; + let a02 = a[2]; + let a03 = a[3]; + let a10 = a[4]; + let a11 = a[5]; + let a12 = a[6]; + let a13 = a[7]; + if (a !== out) { + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } + out[0] = a00 * c + a10 * s; + out[1] = a01 * c + a11 * s; + out[2] = a02 * c + a12 * s; + out[3] = a03 * c + a13 * s; + out[4] = a10 * c - a00 * s; + out[5] = a11 * c - a01 * s; + out[6] = a12 * c - a02 * s; + out[7] = a13 * c - a03 * s; + return out; + } + /** + * Creates a {@link Mat4} from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Translation vector + * @returns `out` + */ + static fromTranslation(out, v) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param v - Scaling vector + * @returns `out` + */ + static fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a {@link Mat4} from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * @category Static + * + * @param out - {@link Mat4} receiving operation result + * @param rad - the angle to rotate the matrix by + * @param axis - the axis to rotate around + * @returns `out` + */ + static fromRotation(out, rad, axis) { + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + let len = Math.sqrt(x * x + y * y + z * z); + if (len < EPSILON) { + return null; + } + len = 1 / len; + x *= len; + y *= len; + z *= len; + const s = Math.sin(rad); + const c = Math.cos(rad); + const t = 1 - c; + out[0] = x * x * t + c; + out[1] = y * x * t + z * s; + out[2] = z * x * t - y * s; + out[3] = 0; + out[4] = x * y * t - z * s; + out[5] = y * y * t + c; + out[6] = z * y * t + x * s; + out[7] = 0; + out[8] = x * z * t + y * s; + out[9] = y * z * t - x * s; + out[10] = z * z * t + c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromXRotation(out, rad) { + let s = Math.sin(rad); + let c = Math.cos(rad); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = c; + out[6] = s; + out[7] = 0; + out[8] = 0; + out[9] = -s; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromYRotation(out, rad) { + let s = Math.sin(rad); + let c = Math.cos(rad); + out[0] = c; + out[1] = 0; + out[2] = -s; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = s; + out[9] = 0; + out[10] = c; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * @category Static + * + * @param out - mat4 receiving operation result + * @param rad - the angle to rotate the matrix by + * @returns `out` + */ + static fromZRotation(out, rad) { + const s = Math.sin(rad); + const c = Math.cos(rad); + out[0] = c; + out[1] = s; + out[2] = 0; + out[3] = 0; + out[4] = -s; + out[5] = c; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @returns `out` + */ + static fromRotationTranslation(out, q, v) { + const x = q[0]; + const y = q[1]; + const z = q[2]; + const w = q[3]; + const x2 = x + x; + const y2 = y + y; + const z2 = z + z; + const xx = x * x2; + const xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Sets a {@link Mat4} from a {@link Quat2}. + * @category Static + * + * @param out - Matrix + * @param a - Dual Quaternion + * @returns `out` + */ + static fromQuat2(out, a) { + let translation = [0, 0, 0]; + const bx = -a[0]; + const by = -a[1]; + const bz = -a[2]; + const bw = a[3]; + const ax = a[4]; + const ay = a[5]; + const az = a[6]; + const aw = a[7]; + let magnitude = bx * bx + by * by + bz * bz + bw * bw; + if (magnitude > 0) { + translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; + translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; + translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; + } else { + translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; + translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; + translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + } + Mat4.fromRotationTranslation(out, a, translation); + return out; + } + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive translation component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getTranslation(out, mat) { + out[0] = mat[12]; + out[1] = mat[13]; + out[2] = mat[14]; + return out; + } + /** + * Returns the scaling factor component of a transformation + * matrix. If a matrix is built with fromRotationTranslationScale + * with a normalized Quaternion paramter, the returned vector will be + * the same as the scaling vector + * originally supplied. + * @category Static + * + * @param {vec3} out Vector to receive scaling factor component + * @param {ReadonlyMat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + static getScaling(out, mat) { + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + return out; + } + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @category Static + * + * @param out - Quaternion to receive the rotation component + * @param mat - Matrix to be decomposed (input) + * @return `out` + */ + static getRotation(out, mat) { + Mat4.getScaling(tmpVec3$1, mat); + const is1 = 1 / tmpVec3$1[0]; + const is2 = 1 / tmpVec3$1[1]; + const is3 = 1 / tmpVec3$1[2]; + const sm11 = mat[0] * is1; + const sm12 = mat[1] * is2; + const sm13 = mat[2] * is3; + const sm21 = mat[4] * is1; + const sm22 = mat[5] * is2; + const sm23 = mat[6] * is3; + const sm31 = mat[8] * is1; + const sm32 = mat[9] * is2; + const sm33 = mat[10] * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out[3] = 0.25 * S; + out[0] = (sm23 - sm32) / S; + out[1] = (sm31 - sm13) / S; + out[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out[3] = (sm23 - sm32) / S; + out[0] = 0.25 * S; + out[1] = (sm12 + sm21) / S; + out[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out[3] = (sm31 - sm13) / S; + out[0] = (sm12 + sm21) / S; + out[1] = 0.25 * S; + out[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out[3] = (sm12 - sm21) / S; + out[0] = (sm31 + sm13) / S; + out[1] = (sm23 + sm32) / S; + out[2] = 0.25 * S; + } + return out; + } + /** + * Decomposes a transformation matrix into its rotation, translation + * and scale components. Returns only the rotation component + * @category Static + * + * @param out_r - Quaternion to receive the rotation component + * @param out_t - Vector to receive the translation vector + * @param out_s - Vector to receive the scaling factor + * @param mat - Matrix to be decomposed (input) + * @returns `out_r` + */ + static decompose(out_r, out_t, out_s, mat) { + out_t[0] = mat[12]; + out_t[1] = mat[13]; + out_t[2] = mat[14]; + const m11 = mat[0]; + const m12 = mat[1]; + const m13 = mat[2]; + const m21 = mat[4]; + const m22 = mat[5]; + const m23 = mat[6]; + const m31 = mat[8]; + const m32 = mat[9]; + const m33 = mat[10]; + out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + const is1 = 1 / out_s[0]; + const is2 = 1 / out_s[1]; + const is3 = 1 / out_s[2]; + const sm11 = m11 * is1; + const sm12 = m12 * is2; + const sm13 = m13 * is3; + const sm21 = m21 * is1; + const sm22 = m22 * is2; + const sm23 = m23 * is3; + const sm31 = m31 * is1; + const sm32 = m32 * is2; + const sm33 = m33 * is3; + const trace = sm11 + sm22 + sm33; + let S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1) * 2; + out_r[3] = 0.25 * S; + out_r[0] = (sm23 - sm32) / S; + out_r[1] = (sm31 - sm13) / S; + out_r[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1 + sm11 - sm22 - sm33) * 2; + out_r[3] = (sm23 - sm32) / S; + out_r[0] = 0.25 * S; + out_r[1] = (sm12 + sm21) / S; + out_r[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1 + sm22 - sm11 - sm33) * 2; + out_r[3] = (sm31 - sm13) / S; + out_r[0] = (sm12 + sm21) / S; + out_r[1] = 0.25 * S; + out_r[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1 + sm33 - sm11 - sm22) * 2; + out_r[3] = (sm12 - sm21) / S; + out_r[0] = (sm31 + sm13) / S; + out_r[1] = (sm23 + sm32) / S; + out_r[2] = 0.25 * S; + } + return out_r; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale); + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @returns `out` + */ + static fromRotationTranslationScale(out, q, v, s) { + const x = q[0]; + const y = q[1]; + const z = q[2]; + const w = q[3]; + const x2 = x + x; + const y2 = y + y; + const z2 = z + z; + const xx = x * x2; + const xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Rotation quaternion + * @param v - Translation vector + * @param s - Scaling vector + * @param o - The origin vector around which to scale and rotate + * @returns `out` + */ + static fromRotationTranslationScaleOrigin(out, q, v, s, o) { + const x = q[0]; + const y = q[1]; + const z = q[2]; + const w = q[3]; + const x2 = x + x; + const y2 = y + y; + const z2 = z + z; + const xx = x * x2; + const xy = x * y2; + const xz = x * z2; + const yy = y * y2; + const yz = y * z2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + const sx = s[0]; + const sy = s[1]; + const sz = s[2]; + const ox = o[0]; + const oy = o[1]; + const oz = o[2]; + const out0 = (1 - (yy + zz)) * sx; + const out1 = (xy + wz) * sx; + const out2 = (xz - wy) * sx; + const out4 = (xy - wz) * sy; + const out5 = (1 - (xx + zz)) * sy; + const out6 = (yz + wx) * sy; + const out8 = (xz + wy) * sz; + const out9 = (yz - wx) * sz; + const out10 = (1 - (xx + yy)) * sz; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * @category Static + * + * @param out - mat4 receiving operation result + * @param q - Quaternion to create matrix from + * @returns `out` + */ + static fromQuat(out, q) { + const x = q[0]; + const y = q[1]; + const z = q[2]; + const w = q[3]; + const x2 = x + x; + const y2 = y + y; + const z2 = z + z; + const xx = x * x2; + const yx = y * x2; + const yy = y * y2; + const zx = z * x2; + const zy = z * y2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a frustum matrix with the given bounds + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static frustum(out, left, right, bottom, top, near, far) { + const rl = 1 / (right - left); + const tb = 1 / (top - bottom); + const nf = 1 / (near - far); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near * 2 * nf; + out[15] = 0; + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveNO(out, fovy, aspect, near, far) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + /** + * Alias for {@link Mat4.perspectiveNO} + * @category Static + * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly + */ + static perspective(out, fovy, aspect, near, far) { + return out; + } + /** + * Generates a perspective projection matrix suitable for WebGPU with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fovy - Vertical field of view in radians + * @param aspect - Aspect ratio. typically viewport width/height + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum, can be null or Infinity + * @returns `out` + */ + static perspectiveZO(out, fovy, aspect, near, far) { + const f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + const nf = 1 / (near - far); + out[10] = far * nf; + out[14] = far * near * nf; + } else { + out[10] = -1; + out[14] = -near; + } + return out; + } + /** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experiemental WebVR API. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + * @deprecated + */ + static perspectiveFromFieldOfView(out, fov, near, far) { + const upTan = Math.tan(fov.upDegrees * Math.PI / 180); + const downTan = Math.tan(fov.downDegrees * Math.PI / 180); + const leftTan = Math.tan(fov.leftDegrees * Math.PI / 180); + const rightTan = Math.tan(fov.rightDegrees * Math.PI / 180); + const xScale = 2 / (leftTan + rightTan); + const yScale = 2 / (upTan + downTan); + out[0] = xScale; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = yScale; + out[6] = 0; + out[7] = 0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near / (near - far); + out[15] = 0; + return out; + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoNO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + } + /** + * Alias for {@link Mat4.orthoNO} + * @category Static + * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly + */ + static ortho(out, left, right, bottom, top, near, far) { + return out; + } + /** + * Generates a orthogonal projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], + * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param left - Left bound of the frustum + * @param right - Right bound of the frustum + * @param bottom - Bottom bound of the frustum + * @param top - Top bound of the frustum + * @param near - Near bound of the frustum + * @param far - Far bound of the frustum + * @returns `out` + */ + static orthoZO(out, left, right, bottom, top, near, far) { + const lr = 1 / (left - right); + const bt = 1 / (bottom - top); + const nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = near * nf; + out[15] = 1; + return out; + } + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. + * If you want a matrix that actually makes an object look at another object, you should use targetTo instead. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param center - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static lookAt(out, eye, center, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + const centerx = center[0]; + const centery = center[1]; + const centerz = center[2]; + if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) { + return Mat4.identity(out); + } + let z0 = eyex - centerx; + let z1 = eyey - centery; + let z2 = eyez - centerz; + let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + let y0 = z1 * x2 - z2 * x1; + let y1 = z2 * x0 - z0 * x2; + let y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + /** + * Generates a matrix that makes something look at something else. + * @category Static + * + * @param out - mat4 frustum matrix will be written into + * @param eye - Position of the viewer + * @param target - Point the viewer is looking at + * @param up - vec3 pointing up + * @returns `out` + */ + static targetTo(out, eye, target, up) { + const eyex = eye[0]; + const eyey = eye[1]; + const eyez = eye[2]; + const upx = up[0]; + const upy = up[1]; + const upz = up[2]; + let z0 = eyex - target[0]; + let z1 = eyey - target[1]; + let z2 = eyez - target[2]; + let len = z0 * z0 + z1 * z1 + z2 * z2; + if (len > 0) { + len = 1 / Math.sqrt(len); + z0 *= len; + z1 *= len; + z2 *= len; + } + let x0 = upy * z2 - upz * z1; + let x1 = upz * z0 - upx * z2; + let x2 = upx * z1 - upy * z0; + len = x0 * x0 + x1 * x1 + x2 * x2; + if (len > 0) { + len = 1 / Math.sqrt(len); + x0 *= len; + x1 *= len; + x2 *= len; + } + out[0] = x0; + out[1] = x1; + out[2] = x2; + out[3] = 0; + out[4] = z1 * x2 - z2 * x1; + out[5] = z2 * x0 - z0 * x2; + out[6] = z0 * x1 - z1 * x0; + out[7] = 0; + out[8] = z0; + out[9] = z1; + out[10] = z2; + out[11] = 0; + out[12] = eyex; + out[13] = eyey; + out[14] = eyez; + out[15] = 1; + return out; + } + /** + * Returns Frobenius norm of a {@link Mat4} + * @category Static + * + * @param a - the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + static frob(a) { + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15]); + } + /** + * Adds two {@link Mat4}'s + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + out[3] = a[3] + b[3]; + out[4] = a[4] + b[4]; + out[5] = a[5] + b[5]; + out[6] = a[6] + b[6]; + out[7] = a[7] + b[7]; + out[8] = a[8] + b[8]; + out[9] = a[9] + b[9]; + out[10] = a[10] + b[10]; + out[11] = a[11] + b[11]; + out[12] = a[12] + b[12]; + out[13] = a[13] + b[13]; + out[14] = a[14] + b[14]; + out[15] = a[15] + b[15]; + return out; + } + /** + * Subtracts matrix b from matrix a + * @category Static + * + * @param out - the receiving matrix + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + out[3] = a[3] - b[3]; + out[4] = a[4] - b[4]; + out[5] = a[5] - b[5]; + out[6] = a[6] - b[6]; + out[7] = a[7] - b[7]; + out[8] = a[8] - b[8]; + out[9] = a[9] - b[9]; + out[10] = a[10] - b[10]; + out[11] = a[11] - b[11]; + out[12] = a[12] - b[12]; + out[13] = a[13] - b[13]; + out[14] = a[14] - b[14]; + out[15] = a[15] - b[15]; + return out; + } + /** + * Alias for {@link Mat4.subtract} + * @category Static + */ + static sub(out, a, b) { + return out; + } + /** + * Multiply each element of the matrix by a scalar. + * @category Static + * + * @param out - the receiving matrix + * @param a - the matrix to scale + * @param b - amount to scale the matrix's elements by + * @returns `out` + */ + static multiplyScalar(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + out[3] = a[3] * b; + out[4] = a[4] * b; + out[5] = a[5] * b; + out[6] = a[6] * b; + out[7] = a[7] * b; + out[8] = a[8] * b; + out[9] = a[9] * b; + out[10] = a[10] * b; + out[11] = a[11] * b; + out[12] = a[12] * b; + out[13] = a[13] * b; + out[14] = a[14] * b; + out[15] = a[15] * b; + return out; + } + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b's elements by before adding + * @returns `out` + */ + static multiplyScalarAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + out[3] = a[3] + b[3] * scale; + out[4] = a[4] + b[4] * scale; + out[5] = a[5] + b[5] * scale; + out[6] = a[6] + b[6] * scale; + out[7] = a[7] + b[7] * scale; + out[8] = a[8] + b[8] * scale; + out[9] = a[9] + b[9] * scale; + out[10] = a[10] + b[10] * scale; + out[11] = a[11] + b[11] * scale; + out[12] = a[12] + b[12] * scale; + out[13] = a[13] + b[13] * scale; + out[14] = a[14] + b[14] * scale; + out[15] = a[15] + b[15] * scale; + return out; + } + /** + * Returns whether or not two {@link Mat4}s have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; + } + /** + * Returns whether or not two {@link Mat4}s have approximately the same elements in the same position. + * @category Static + * + * @param a - The first matrix. + * @param b - The second matrix. + * @returns True if the matrices are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const a3 = a[3]; + const a4 = a[4]; + const a5 = a[5]; + const a6 = a[6]; + const a7 = a[7]; + const a8 = a[8]; + const a9 = a[9]; + const a10 = a[10]; + const a11 = a[11]; + const a12 = a[12]; + const a13 = a[13]; + const a14 = a[14]; + const a15 = a[15]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + const b3 = b[3]; + const b4 = b[4]; + const b5 = b[5]; + const b6 = b[6]; + const b7 = b[7]; + const b8 = b[8]; + const b9 = b[9]; + const b10 = b[10]; + const b11 = b[11]; + const b12 = b[12]; + const b13 = b[13]; + const b14 = b[14]; + const b15 = b[15]; + return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)); + } + /** + * Returns a string representation of a {@link Mat4} + * @category Static + * + * @param a - matrix to represent as a string + * @returns string representation of the matrix + */ + static str(a) { + return `Mat4(${a.join(", ")})`; + } +} +const tmpVec3$1 = [0, 0, 0]; +Mat4.prototype.mul = Mat4.prototype.multiply; +Mat4.sub = Mat4.subtract; +Mat4.mul = Mat4.multiply; +Mat4.perspective = Mat4.perspectiveNO; +Mat4.ortho = Mat4.orthoNO; +class Vec3 extends Float32Array { + /** + * The number of bytes in a {@link Vec3}. + */ + static BYTE_LENGTH = 3 * Float32Array.BYTES_PER_ELEMENT; + /** + * Create a {@link Vec3}. + */ + constructor(...values) { + switch (values.length) { + case 3: + super(values); + break; + case 2: + super(values[0], values[1], 3); + break; + case 1: { + const v = values[0]; + if (typeof v === "number") { + super([v, v, v]); + } else { + super(v, 0, 3); + } + break; + } + default: + super(3); + break; + } + } + //============ + // Attributes + //============ + // Getters and setters to make component access read better. + // These are likely to be a little bit slower than direct array access. + /** + * The x component of the vector. Equivalent to `this[0];` + * @category Vector components + */ + get x() { + return this[0]; + } + set x(value) { + this[0] = value; + } + /** + * The y component of the vector. Equivalent to `this[1];` + * @category Vector components + */ + get y() { + return this[1]; + } + set y(value) { + this[1] = value; + } + /** + * The z component of the vector. Equivalent to `this[2];` + * @category Vector components + */ + get z() { + return this[2]; + } + set z(value) { + this[2] = value; + } + // Alternate set of getters and setters in case this is being used to define + // a color. + /** + * The r component of the vector. Equivalent to `this[0];` + * @category Color components + */ + get r() { + return this[0]; + } + set r(value) { + this[0] = value; + } + /** + * The g component of the vector. Equivalent to `this[1];` + * @category Color components + */ + get g() { + return this[1]; + } + set g(value) { + this[1] = value; + } + /** + * The b component of the vector. Equivalent to `this[2];` + * @category Color components + */ + get b() { + return this[2]; + } + set b(value) { + this[2] = value; + } + /** + * The magnitude (length) of this. + * Equivalent to `Vec3.magnitude(this);` + * + * Magnitude is used because the `length` attribute is already defined by + * `Float32Array` to mean the number of elements in the array. + */ + get magnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + */ + get mag() { + return this.magnitude; + } + /** + * The squared magnitude (length) of `this`. + * Equivalent to `Vec3.squaredMagnitude(this);` + */ + get squaredMagnitude() { + const x = this[0]; + const y = this[1]; + const z = this[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredMagnitude} + */ + get sqrMag() { + return this.squaredMagnitude; + } + /** + * A string representation of `this` + * Equivalent to `Vec3.str(this);` + */ + get str() { + return Vec3.str(this); + } + //=================== + // Instances methods + //=================== + /** + * Copy the values from another {@link Vec3} into `this`. + * + * @param a the source vector + * @returns `this` + */ + copy(a) { + this.set(a); + return this; + } + /** + * Adds a {@link Vec3} to `this`. + * Equivalent to `Vec3.add(this, this, b);` + * + * @param b - The vector to add to `this` + * @returns `this` + */ + add(b) { + this[0] += b[0]; + this[1] += b[1]; + this[2] += b[2]; + return this; + } + /** + * Subtracts a {@link Vec3} from `this`. + * Equivalent to `Vec3.subtract(this, this, b);` + * + * @param b - The vector to subtract from `this` + * @returns `this` + */ + subtract(b) { + this[0] -= b[0]; + this[1] -= b[1]; + this[2] -= b[2]; + return this; + } + /** + * Alias for {@link Vec3.subtract} + */ + sub(b) { + return this; + } + /** + * Multiplies `this` by a {@link Vec3}. + * Equivalent to `Vec3.multiply(this, this, b);` + * + * @param b - The vector to multiply `this` by + * @returns `this` + */ + multiply(b) { + this[0] *= b[0]; + this[1] *= b[1]; + this[2] *= b[2]; + return this; + } + /** + * Alias for {@link Vec3.multiply} + */ + mul(b) { + return this; + } + /** + * Divides `this` by a {@link Vec3}. + * Equivalent to `Vec3.divide(this, this, b);` + * + * @param b - The vector to divide `this` by + * @returns `this` + */ + divide(b) { + this[0] /= b[0]; + this[1] /= b[1]; + this[2] /= b[2]; + return this; + } + /** + * Alias for {@link Vec3.divide} + */ + div(b) { + return this; + } + /** + * Scales `this` by a scalar number. + * Equivalent to `Vec3.scale(this, this, b);` + * + * @param b - Amount to scale `this` by + * @returns `this` + */ + scale(b) { + this[0] *= b; + this[1] *= b; + this[2] *= b; + return this; + } + /** + * Calculates `this` scaled by a scalar value then adds the result to `this`. + * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);` + * + * @param b - The vector to add to `this` + * @param scale - The amount to scale `b` by before adding + * @returns `this` + */ + scaleAndAdd(b, scale) { + this[0] += b[0] * scale; + this[1] += b[1] * scale; + this[2] += b[2] * scale; + return this; + } + /** + * Calculates the euclidian distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.distance(this, b);` + * + * @param b - The vector to calculate the distance to + * @returns Distance between `this` and `b` + */ + distance(b) { + return Vec3.distance(this, b); + } + /** + * Alias for {@link Vec3.distance} + */ + dist(b) { + return 0; + } + /** + * Calculates the squared euclidian distance between another {@link Vec3} and `this`. + * Equivalent to `Vec3.squaredDistance(this, b);` + * + * @param b The vector to calculate the squared distance to + * @returns Squared distance between `this` and `b` + */ + squaredDistance(b) { + return Vec3.squaredDistance(this, b); + } + /** + * Alias for {@link Vec3.squaredDistance} + */ + sqrDist(b) { + return 0; + } + /** + * Negates the components of `this`. + * Equivalent to `Vec3.negate(this, this);` + * + * @returns `this` + */ + negate() { + this[0] *= -1; + this[1] *= -1; + this[2] *= -1; + return this; + } + /** + * Inverts the components of `this`. + * Equivalent to `Vec3.inverse(this, this);` + * + * @returns `this` + */ + invert() { + this[0] = 1 / this[0]; + this[1] = 1 / this[1]; + this[2] = 1 / this[2]; + return this; + } + /** + * Calculates the dot product of this and another {@link Vec3}. + * Equivalent to `Vec3.dot(this, b);` + * + * @param b - The second operand + * @returns Dot product of `this` and `b` + */ + dot(b) { + return this[0] * b[0] + this[1] * b[1] + this[2] * b[2]; + } + /** + * Normalize `this`. + * Equivalent to `Vec3.normalize(this, this);` + * + * @returns `this` + */ + normalize() { + return Vec3.normalize(this, this); + } + //================ + // Static methods + //================ + /** + * Creates a new, empty vec3 + * @category Static + * + * @returns a new 3D vector + */ + static create() { + return new Vec3(); + } + /** + * Creates a new vec3 initialized with values from an existing vector + * @category Static + * + * @param a - vector to clone + * @returns a new 3D vector + */ + static clone(a) { + return new Vec3(a); + } + /** + * Calculates the magnitude (length) of a {@link Vec3} + * @category Static + * + * @param a - Vector to calculate magnitude of + * @returns Magnitude of a + */ + static magnitude(a) { + let x = a[0]; + let y = a[1]; + let z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + */ + static mag(a) { + return 0; + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs + * + * @param a - vector to calculate length of + * @returns length of a + */ + // @ts-ignore: Length conflicts with Function.length + static length(a) { + return 0; + } + /** + * Alias for {@link Vec3.magnitude} + * @category Static + * @deprecated Use {@link Vec3.mag} + */ + static len(a) { + return 0; + } + /** + * Creates a new vec3 initialized with the given values + * @category Static + * + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns a new 3D vector + */ + static fromValues(x, y, z) { + return new Vec3(x, y, z); + } + /** + * Copy the values from one vec3 to another + * @category Static + * + * @param out - the receiving vector + * @param a - the source vector + * @returns `out` + */ + static copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * @category Static + * + * @param out - the receiving vector + * @param x - X component + * @param y - Y component + * @param z - Z component + * @returns `out` + */ + static set(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Adds two {@link Vec3}s + * @category Static + * + * @param out - The receiving vector + * @param a - The first operand + * @param b - The second operand + * @returns `out` + */ + static add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + /** + * Subtracts vector b from vector a + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Alias for {@link Vec3.subtract} + * @category Static + */ + static sub(out, a, b) { + return [0, 0, 0]; + } + /** + * Multiplies two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static multiply(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + /** + * Alias for {@link Vec3.multiply} + * @category Static + */ + static mul(out, a, b) { + return [0, 0, 0]; + } + /** + * Divides two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static divide(out, a, b) { + out[0] = a[0] / b[0]; + out[1] = a[1] / b[1]; + out[2] = a[2] / b[2]; + return out; + } + /** + * Alias for {@link Vec3.divide} + * @category Static + */ + static div(out, a, b) { + return [0, 0, 0]; + } + /** + * Math.ceil the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to ceil + * @returns `out` + */ + static ceil(out, a) { + out[0] = Math.ceil(a[0]); + out[1] = Math.ceil(a[1]); + out[2] = Math.ceil(a[2]); + return out; + } + /** + * Math.floor the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to floor + * @returns `out` + */ + static floor(out, a) { + out[0] = Math.floor(a[0]); + out[1] = Math.floor(a[1]); + out[2] = Math.floor(a[2]); + return out; + } + /** + * Returns the minimum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + /** + * Returns the maximum of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + /** + * symmetric round the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to round + * @returns `out` + */ + /*static round(out: Vec3Like, a: Readonly): Vec3Like { + out[0] = glMatrix.round(a[0]); + out[1] = glMatrix.round(a[1]); + out[2] = glMatrix.round(a[2]); + return out; + }*/ + /** + * Scales a vec3 by a scalar number + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to scale + * @param scale - amount to scale the vector by + * @returns `out` + */ + static scale(out, a, scale) { + out[0] = a[0] * scale; + out[1] = a[1] * scale; + out[2] = a[2] * scale; + return out; + } + /** + * Adds two vec3's after scaling the second operand by a scalar value + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param scale - the amount to scale b by before adding + * @returns `out` + */ + static scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + /** + * Calculates the euclidian distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns distance between a and b + */ + static distance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + /** + * Alias for {@link Vec3.distance} + */ + static dist(a, b) { + return 0; + } + /** + * Calculates the squared euclidian distance between two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns squared distance between a and b + */ + static squaredDistance(a, b) { + const x = b[0] - a[0]; + const y = b[1] - a[1]; + const z = b[2] - a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredDistance} + */ + static sqrDist(a, b) { + return 0; + } + /** + * Calculates the squared length of a vec3 + * @category Static + * + * @param a - vector to calculate squared length of + * @returns squared length of a + */ + static squaredLength(a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + return x * x + y * y + z * z; + } + /** + * Alias for {@link Vec3.squaredLength} + */ + static sqrLen(a, b) { + return 0; + } + /** + * Negates the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to negate + * @returns `out` + */ + static negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + /** + * Returns the inverse of the components of a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to invert + * @returns `out` + */ + static inverse(out, a) { + out[0] = 1 / a[0]; + out[1] = 1 / a[1]; + out[2] = 1 / a[2]; + return out; + } + /** + * Normalize a vec3 + * @category Static + * + * @param out - the receiving vector + * @param a - vector to normalize + * @returns `out` + */ + static normalize(out, a) { + const x = a[0]; + const y = a[1]; + const z = a[2]; + let len = x * x + y * y + z * z; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * @category Static + * + * @param a - the first operand + * @param b - the second operand + * @returns dot product of a and b + */ + static dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @returns `out` + */ + static cross(out, a, b) { + const ax = a[0], ay = a[1], az = a[2]; + const bx = b[0], by = b[1], bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Performs a linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static lerp(out, a, b, t) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + /** + * Performs a spherical linear interpolation between two vec3's + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static slerp(out, a, b, t) { + const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1)); + const sinTotal = Math.sin(angle); + const ratioA = Math.sin((1 - t) * angle) / sinTotal; + const ratioB = Math.sin(t * angle) / sinTotal; + out[0] = ratioA * a[0] + ratioB * b[0]; + out[1] = ratioA * a[1] + ratioB * b[1]; + out[2] = ratioA * a[2] + ratioB * b[2]; + return out; + } + /** + * Performs a hermite interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static hermite(out, a, b, c, d, t) { + const factorTimes2 = t * t; + const factor1 = factorTimes2 * (2 * t - 3) + 1; + const factor2 = factorTimes2 * (t - 2) + t; + const factor3 = factorTimes2 * (t - 1); + const factor4 = factorTimes2 * (3 - 2 * t); + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Performs a bezier interpolation with two control points + * @category Static + * + * @param out - the receiving vector + * @param a - the first operand + * @param b - the second operand + * @param c - the third operand + * @param d - the fourth operand + * @param t - interpolation amount, in the range [0-1], between the two inputs + * @returns `out` + */ + static bezier(out, a, b, c, d, t) { + const inverseFactor = 1 - t; + const inverseFactorTimesTwo = inverseFactor * inverseFactor; + const factorTimes2 = t * t; + const factor1 = inverseFactorTimesTwo * inverseFactor; + const factor2 = 3 * t * inverseFactorTimesTwo; + const factor3 = 3 * factorTimes2 * inverseFactor; + const factor4 = factorTimes2 * t; + out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; + out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; + out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; + return out; + } + /** + * Generates a random vector with the given scale + * @category Static + * + * @param out - the receiving vector + * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns `out` + */ + /*static random(out: Vec3Like, scale) { + scale = scale === undefined ? 1.0 : scale; + + let r = glMatrix.RANDOM() * 2.0 * Math.PI; + let z = glMatrix.RANDOM() * 2.0 - 1.0; + let zScale = Math.sqrt(1.0 - z * z) * scale; + + out[0] = Math.cos(r) * zScale; + out[1] = Math.sin(r) * zScale; + out[2] = z * scale; + return out; + }*/ + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - matrix to transform with + * @returns `out` + */ + static transformMat4(out, a, m) { + const x = a[0], y = a[1], z = a[2]; + const w = m[3] * x + m[7] * y + m[11] * z + m[15] || 1; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + /** + * Transforms the vec3 with a mat3. + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param m - the 3x3 matrix to transform with + * @returns `out` + */ + static transformMat3(out, a, m) { + let x = a[0], y = a[1], z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * @category Static + * + * @param out - the receiving vector + * @param a - the vector to transform + * @param q - quaternion to transform with + * @returns `out` + */ + static transformQuat(out, a, q) { + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const w2 = q[3] * 2; + const x = a[0]; + const y = a[1]; + const z = a[2]; + const uvx = qy * z - qz * y; + const uvy = qz * x - qx * z; + const uvz = qx * y - qy * x; + const uuvx = (qy * uvz - qz * uvy) * 2; + const uuvy = (qz * uvx - qx * uvz) * 2; + const uuvz = (qx * uvy - qy * uvx) * 2; + out[0] = x + uvx * w2 + uuvx; + out[1] = y + uvy * w2 + uuvy; + out[2] = z + uvz * w2 + uuvz; + return out; + } + /** + * Rotate a 3D vector around the x-axis + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateX(out, a, b, rad) { + const by = b[1]; + const bz = b[2]; + const py = a[1] - by; + const pz = a[2] - bz; + out[0] = a[0]; + out[1] = py * Math.cos(rad) - pz * Math.sin(rad) + by; + out[2] = py * Math.sin(rad) + pz * Math.cos(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the y-axis + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateY(out, a, b, rad) { + const bx = b[0]; + const bz = b[2]; + const px = a[0] - bx; + const pz = a[2] - bz; + out[0] = pz * Math.sin(rad) + px * Math.cos(rad) + bx; + out[1] = a[1]; + out[2] = pz * Math.cos(rad) - px * Math.sin(rad) + bz; + return out; + } + /** + * Rotate a 3D vector around the z-axis + * @param out - The receiving vec3 + * @param a - The vec3 point to rotate + * @param b - The origin of the rotation + * @param rad - The angle of rotation in radians + * @returns `out` + */ + static rotateZ(out, a, b, rad) { + const bx = b[0]; + const by = b[1]; + const px = a[0] - bx; + const py = a[1] - by; + out[0] = px * Math.cos(rad) - py * Math.sin(rad) + bx; + out[1] = px * Math.sin(rad) + py * Math.cos(rad) + by; + out[2] = b[2]; + return out; + } + /** + * Get the angle between two 3D vectors + * @param a - The first operand + * @param b - The second operand + * @returns The angle in radians + */ + static angle(a, b) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)); + const cosine = mag && Vec3.dot(a, b) / mag; + return Math.acos(Math.min(Math.max(cosine, -1), 1)); + } + /** + * Set the components of a vec3 to zero + * @category Static + * + * @param out - the receiving vector + * @returns `out` + */ + static zero(out) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + return out; + } + /** + * Returns a string representation of a vector + * @category Static + * + * @param a - vector to represent as a string + * @returns string representation of the vector + */ + static str(a) { + return `Vec3(${a.join(", ")})`; + } + /** + * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * @category Static + * + * @param a - The first vector. + * @param b - The second vector. + * @returns True if the vectors are equal, false otherwise. + */ + static equals(a, b) { + const a0 = a[0]; + const a1 = a[1]; + const a2 = a[2]; + const b0 = b[0]; + const b1 = b[1]; + const b2 = b[2]; + return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)); + } +} +Vec3.prototype.sub = Vec3.prototype.subtract; +Vec3.prototype.mul = Vec3.prototype.multiply; +Vec3.prototype.div = Vec3.prototype.divide; +Vec3.prototype.dist = Vec3.prototype.distance; +Vec3.prototype.sqrDist = Vec3.prototype.squaredDistance; +Vec3.sub = Vec3.subtract; +Vec3.mul = Vec3.multiply; +Vec3.div = Vec3.divide; +Vec3.dist = Vec3.distance; +Vec3.sqrDist = Vec3.squaredDistance; +Vec3.sqrLen = Vec3.squaredLength; +Vec3.mag = Vec3.magnitude; +Vec3.length = Vec3.magnitude; +Vec3.len = Vec3.magnitude; +async function nextAnimationFrame(cntr = 1) { + if (!Number.isInteger(cntr) || cntr < 1) { + throw new TypeError(`nextAnimationFrame error: 'cntr' must be a positive integer greater than 0.`); + } + let currentTime = performance.now(); + for (; --cntr >= 0; ) { + currentTime = await new Promise((resolve) => requestAnimationFrame(resolve)); + } + return currentTime; +} +function clamp(value = 0, min = 0, max = 0) { + return Math.min(Math.max(value, min), max); +} +function degToRad(deg) { + return deg * (Math.PI / 180); +} +class AnimationControl { + /** @type {object} */ + #animationData; + /** @type {Promise} */ + #finishedPromise; + #willFinish; + /** + * Defines a static empty / void animation control. + * + * @type {AnimationControl} + */ + static #voidControl = new AnimationControl(null); + /** + * Provides a static void / undefined AnimationControl that is automatically resolved. + * + * @returns {AnimationControl} Void AnimationControl + */ + static get voidControl() { + return this.#voidControl; + } + /** + * @param {object|null} [animationData] - Animation data from {@link AnimationAPI}. + * + * @param {boolean} [willFinish] - Promise that tracks animation finished state. + */ + constructor(animationData, willFinish = false) { + this.#animationData = animationData; + this.#willFinish = willFinish; + if (isObject(animationData)) { + animationData.control = this; + } + } + /** + * Get a promise that resolves when animation is finished. + * + * @returns {Promise} + */ + get finished() { + if (!(this.#finishedPromise instanceof Promise)) { + this.#finishedPromise = this.#willFinish ? new Promise((resolve) => this.#animationData.resolve = resolve) : Promise.resolve(); + } + return this.#finishedPromise; + } + /** + * Returns whether this animation is currently active / animating. + * + * Note: a delayed animation may not be started / active yet. Use {@link AnimationControl.isFinished} to determine + * if an animation is actually finished. + * + * @returns {boolean} Animation active state. + */ + get isActive() { + return this.#animationData.active; + } + /** + * Returns whether this animation is completely finished. + * + * @returns {boolean} Animation finished state. + */ + get isFinished() { + return this.#animationData.finished; + } + /** + * Cancels the animation. + */ + cancel() { + const animationData = this.#animationData; + if (animationData === null || animationData === void 0) { + return; + } + animationData.cancelled = true; + } +} +class AnimationManager { + /** + * @type {object[]} + */ + static activeList = []; + /** + * @type {object[]} + */ + static newList = []; + /** + * @type {number} + */ + static current; + /** + * Add animation data. + * + * @param {object} data - + */ + static add(data) { + const now2 = performance.now(); + data.start = now2 + (AnimationManager.current - now2); + AnimationManager.newList.push(data); + } + /** + * Manage all animation + */ + static animate() { + const current = AnimationManager.current = performance.now(); + if (AnimationManager.activeList.length === 0 && AnimationManager.newList.length === 0) { + globalThis.requestAnimationFrame(AnimationManager.animate); + return; + } + if (AnimationManager.newList.length) { + for (let cntr = AnimationManager.newList.length; --cntr >= 0; ) { + const data = AnimationManager.newList[cntr]; + if (data.cancelled) { + AnimationManager.newList.splice(cntr, 1); + data.cleanup(data); + } + if (data.active) { + AnimationManager.newList.splice(cntr, 1); + AnimationManager.activeList.push(data); + } + } + } + for (let cntr = AnimationManager.activeList.length; --cntr >= 0; ) { + const data = AnimationManager.activeList[cntr]; + if (data.cancelled || data.el !== void 0 && !data.el.isConnected) { + AnimationManager.activeList.splice(cntr, 1); + data.cleanup(data); + continue; + } + data.current = current - data.start; + if (data.current >= data.duration) { + for (let dataCntr = data.keys.length; --dataCntr >= 0; ) { + const key = data.keys[dataCntr]; + data.newData[key] = data.destination[key]; + } + data.position.set(data.newData); + AnimationManager.activeList.splice(cntr, 1); + data.cleanup(data); + continue; + } + const easedTime = data.ease(data.current / data.duration); + for (let dataCntr = data.keys.length; --dataCntr >= 0; ) { + const key = data.keys[dataCntr]; + data.newData[key] = data.interpolate(data.initial[key], data.destination[key], easedTime); + } + data.position.set(data.newData); + } + globalThis.requestAnimationFrame(AnimationManager.animate); + } + /** + * Cancels all animations for given TJSPosition instance. + * + * @param {import('../').TJSPosition} position - TJSPosition instance. + */ + static cancel(position) { + for (let cntr = AnimationManager.activeList.length; --cntr >= 0; ) { + const data = AnimationManager.activeList[cntr]; + if (data.position === position) { + AnimationManager.activeList.splice(cntr, 1); + data.cancelled = true; + data.cleanup(data); + } + } + for (let cntr = AnimationManager.newList.length; --cntr >= 0; ) { + const data = AnimationManager.newList[cntr]; + if (data.position === position) { + AnimationManager.newList.splice(cntr, 1); + data.cancelled = true; + data.cleanup(data); + } + } + } + /** + * Cancels all active and delayed animations. + */ + static cancelAll() { + for (let cntr = AnimationManager.activeList.length; --cntr >= 0; ) { + const data = AnimationManager.activeList[cntr]; + data.cancelled = true; + data.cleanup(data); + } + for (let cntr = AnimationManager.newList.length; --cntr >= 0; ) { + const data = AnimationManager.newList[cntr]; + data.cancelled = true; + data.cleanup(data); + } + AnimationManager.activeList.length = 0; + AnimationManager.newList.length = 0; + } + /** + * Gets all {@link AnimationControl} instances for a given TJSPosition instance. + * + * @param {import('../index.js').TJSPosition} position - TJSPosition instance. + * + * @returns {import('#runtime/util/animate').TJSBasicAnimation[]} All scheduled AnimationControl instances for the + * given TJSPosition instance. + */ + static getScheduled(position) { + const results = []; + for (let cntr = AnimationManager.activeList.length; --cntr >= 0; ) { + const data = AnimationManager.activeList[cntr]; + if (data.position === position) { + results.push(data.control); + } + } + for (let cntr = AnimationManager.newList.length; --cntr >= 0; ) { + const data = AnimationManager.newList[cntr]; + if (data.position === position) { + results.push(data.control); + } + } + return results; + } +} +AnimationManager.animate(); +const animateKeys = /* @__PURE__ */ new Set([ + // Main keys + "left", + "top", + "maxWidth", + "maxHeight", + "minWidth", + "minHeight", + "width", + "height", + "rotateX", + "rotateY", + "rotateZ", + "scale", + "translateX", + "translateY", + "translateZ", + "zIndex", + // Aliases + "rotation" +]); +const transformKeys = ["rotateX", "rotateY", "rotateZ", "scale", "translateX", "translateY", "translateZ"]; +Object.freeze(transformKeys); +const relativeRegex = /^([-+*])=(-?[\d]*\.?[\d]+)$/; +const numericDefaults = { + // Other keys + height: 0, + left: 0, + maxHeight: null, + maxWidth: null, + minHeight: null, + minWidth: null, + top: 0, + transformOrigin: null, + width: 0, + zIndex: null, + rotateX: 0, + rotateY: 0, + rotateZ: 0, + scale: 1, + translateX: 0, + translateY: 0, + translateZ: 0, + rotation: 0 +}; +Object.freeze(numericDefaults); +function setNumericDefaults(data) { + if (data.rotateX === null) { + data.rotateX = 0; + } + if (data.rotateY === null) { + data.rotateY = 0; + } + if (data.rotateZ === null) { + data.rotateZ = 0; + } + if (data.translateX === null) { + data.translateX = 0; + } + if (data.translateY === null) { + data.translateY = 0; + } + if (data.translateZ === null) { + data.translateZ = 0; + } + if (data.scale === null) { + data.scale = 1; + } + if (data.rotation === null) { + data.rotation = 0; + } +} +const transformKeysBitwise = { + rotateX: 1, + rotateY: 2, + rotateZ: 4, + scale: 8, + translateX: 16, + translateY: 32, + translateZ: 64 +}; +Object.freeze(transformKeysBitwise); +const transformOriginDefault = "top left"; +const transformOrigins = [ + "top left", + "top center", + "top right", + "center left", + "center", + "center right", + "bottom left", + "bottom center", + "bottom right" +]; +Object.freeze(transformOrigins); +function convertRelative(positionData, position) { + for (const key in positionData) { + if (animateKeys.has(key)) { + const value = positionData[key]; + if (typeof value !== "string") { + continue; + } + if (value === "auto" || value === "inherit") { + continue; + } + const regexResults = relativeRegex.exec(value); + if (!regexResults) { + throw new Error( + `convertRelative error: malformed relative key (${key}) with value (${value})` + ); + } + const current = position[key]; + switch (regexResults[1]) { + case "-": + positionData[key] = current - parseFloat(regexResults[2]); + break; + case "+": + positionData[key] = current + parseFloat(regexResults[2]); + break; + case "*": + positionData[key] = current * parseFloat(regexResults[2]); + break; + } + } + } +} +class AnimationAPI { + /** @type {import('../').TJSPositionData} */ + #data; + /** @type {import('../').TJSPosition} */ + #position; + /** + * Tracks the number of animation control instances that are active. + * + * @type {number} + */ + #instanceCount = 0; + /** + * Provides a bound function to pass as data to AnimationManager to invoke `AnimationAPI.#cleanupInstance`. + * + * @type {Function} + */ + #cleanup; + /** + * @param {import('../index.js').TJSPosition} position - + * + * @param {import('../index.js').TJSPositionData} data - + */ + constructor(position, data) { + this.#position = position; + this.#data = data; + this.#cleanup = this.#cleanupInstance.bind(this); + } + /** + * Returns whether there are scheduled animations whether active or delayed for this TJSPosition. + * + * @returns {boolean} Are there active animation instances. + */ + get isScheduled() { + return this.#instanceCount > 0; + } + /** + * Adds / schedules an animation w/ the AnimationManager. This contains the final steps common to all tweens. + * + * @param {object} initial - + * + * @param {object} destination - + * + * @param {number} duration - + * + * @param {HTMLElement} el - + * + * @param {number} delay - + * + * @param {Function} ease - + * + * @param {Function} interpolate - + * + * @returns {import('#runtime/util/animate').TJSBasicAnimation} The associated animation control. + */ + #addAnimation(initial, destination, duration, el, delay, ease, interpolate) { + setNumericDefaults(initial); + setNumericDefaults(destination); + for (const key in initial) { + if (!Number.isFinite(initial[key])) { + delete initial[key]; + } + } + const keys = Object.keys(initial); + const newData = Object.assign({ immediateElementUpdate: true }, initial); + if (keys.length === 0) { + return AnimationControl.voidControl; + } + const animationData = { + active: true, + cleanup: this.#cleanup, + cancelled: false, + control: void 0, + current: 0, + destination, + duration: duration * 1e3, + // Internally the AnimationManager works in ms. + ease, + el, + finished: false, + initial, + interpolate, + keys, + newData, + position: this.#position, + resolve: void 0, + start: void 0 + }; + if (delay > 0) { + animationData.active = false; + setTimeout(() => { + if (!animationData.cancelled) { + animationData.active = true; + const now2 = performance.now(); + animationData.start = now2 + (AnimationManager.current - now2); + } + }, delay * 1e3); + } + this.#instanceCount++; + AnimationManager.add(animationData); + return new AnimationControl(animationData, true); + } + /** + * Cancels all animation instances for this TJSPosition instance. + */ + cancel() { + AnimationManager.cancel(this.#position); + } + /** + * Cleans up an animation instance. + * + * @param {object} data - Animation data for an animation instance. + */ + #cleanupInstance(data) { + this.#instanceCount--; + data.active = false; + data.finished = true; + if (typeof data.resolve === "function") { + data.resolve(data.cancelled); + } + } + /** + * Returns all currently scheduled AnimationControl instances for this TJSPosition instance. + * + * @returns {import('#runtime/util/animate').TJSBasicAnimation[]} All currently scheduled animation controls for + * this TJSPosition instance. + */ + getScheduled() { + return AnimationManager.getScheduled(this.#position); + } + /** + * Provides a tween from given position data to the current position. + * + * @param {import('../index.js').TJSPositionDataExtended} fromData - The starting position. + * + * @param {object} [opts] - Optional parameters. + * + * @param {number} [opts.delay=0] - Delay in seconds before animation starts. + * + * @param {number} [opts.duration=1] - Duration in seconds. + * + * @param {Function} [opts.ease=cubicOut] - Easing function. + * + * @param {Function} [opts.interpolate=lerp] - Interpolation function. + * + * @returns {import('#runtime/util/animate').TJSBasicAnimation} A control object that can cancel animation and + * provides a `finished` Promise. + */ + from(fromData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {}) { + if (!isObject(fromData)) { + throw new TypeError(`AnimationAPI.from error: 'fromData' is not an object.`); + } + const position = this.#position; + const parent = position.parent; + if (parent !== void 0 && typeof parent?.options?.positionable === "boolean" && !parent?.options?.positionable) { + return AnimationControl.voidControl; + } + const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget; + const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0; + if (!Number.isFinite(delay) || delay < 0) { + throw new TypeError(`AnimationAPI.from error: 'delay' is not a positive number.`); + } + if (!Number.isFinite(duration) || duration < 0) { + throw new TypeError(`AnimationAPI.from error: 'duration' is not a positive number.`); + } + if (typeof ease !== "function") { + throw new TypeError(`AnimationAPI.from error: 'ease' is not a function.`); + } + if (typeof interpolate !== "function") { + throw new TypeError(`AnimationAPI.from error: 'interpolate' is not a function.`); + } + const initial = {}; + const destination = {}; + const data = this.#data; + for (const key in fromData) { + if (data[key] !== void 0 && fromData[key] !== data[key]) { + initial[key] = fromData[key]; + destination[key] = data[key]; + } + } + convertRelative(initial, data); + return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate); + } + /** + * Provides a tween from given position data to the current position. + * + * @param {import('../index.js').TJSPositionDataExtended} fromData - The starting position. + * + * @param {import('../index.js').TJSPositionDataExtended} toData - The ending position. + * + * @param {object} [opts] - Optional parameters. + * + * @param {number} [opts.delay=0] - Delay in seconds before animation starts. + * + * @param {number} [opts.duration=1] - Duration in seconds. + * + * @param {Function} [opts.ease=cubicOut] - Easing function. + * + * @param {Function} [opts.interpolate=lerp] - Interpolation function. + * + * @returns {import('#runtime/util/animate').TJSBasicAnimation} A control object that can cancel animation and + * provides a `finished` Promise. + */ + fromTo(fromData, toData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {}) { + if (!isObject(fromData)) { + throw new TypeError(`AnimationAPI.fromTo error: 'fromData' is not an object.`); + } + if (!isObject(toData)) { + throw new TypeError(`AnimationAPI.fromTo error: 'toData' is not an object.`); + } + const parent = this.#position.parent; + if (parent !== void 0 && typeof parent?.options?.positionable === "boolean" && !parent?.options?.positionable) { + return AnimationControl.voidControl; + } + const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget; + const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0; + if (!Number.isFinite(delay) || delay < 0) { + throw new TypeError(`AnimationAPI.fromTo error: 'delay' is not a positive number.`); + } + if (!Number.isFinite(duration) || duration < 0) { + throw new TypeError(`AnimationAPI.fromTo error: 'duration' is not a positive number.`); + } + if (typeof ease !== "function") { + throw new TypeError(`AnimationAPI.fromTo error: 'ease' is not a function.`); + } + if (typeof interpolate !== "function") { + throw new TypeError(`AnimationAPI.fromTo error: 'interpolate' is not a function.`); + } + const initial = {}; + const destination = {}; + const data = this.#data; + for (const key in fromData) { + if (toData[key] === void 0) { + console.warn( + `AnimationAPI.fromTo warning: key ('${key}') from 'fromData' missing in 'toData'; skipping this key.` + ); + continue; + } + if (data[key] !== void 0) { + initial[key] = fromData[key]; + destination[key] = toData[key]; + } + } + convertRelative(initial, data); + convertRelative(destination, data); + return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate); + } + /** + * Provides a tween to given position data from the current position. + * + * @param {import('../index.js').TJSPositionDataExtended} toData - The destination position. + * + * @param {object} [opts] - Optional parameters. + * + * @param {number} [opts.delay=0] - Delay in seconds before animation starts. + * + * @param {number} [opts.duration=1] - Duration in seconds. + * + * @param {Function} [opts.ease=cubicOut] - Easing function. + * + * @param {Function} [opts.interpolate=lerp] - Interpolation function. + * + * @returns {import('#runtime/util/animate').TJSBasicAnimation} A control object that can cancel animation and + * provides a `finished` Promise. + */ + to(toData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {}) { + if (!isObject(toData)) { + throw new TypeError(`AnimationAPI.to error: 'toData' is not an object.`); + } + const parent = this.#position.parent; + if (parent !== void 0 && typeof parent?.options?.positionable === "boolean" && !parent?.options?.positionable) { + return AnimationControl.voidControl; + } + const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget; + const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0; + if (!Number.isFinite(delay) || delay < 0) { + throw new TypeError(`AnimationAPI.to error: 'delay' is not a positive number.`); + } + if (!Number.isFinite(duration) || duration < 0) { + throw new TypeError(`AnimationAPI.to error: 'duration' is not a positive number.`); + } + if (typeof ease !== "function") { + throw new TypeError(`AnimationAPI.to error: 'ease' is not a function.`); + } + if (typeof interpolate !== "function") { + throw new TypeError(`AnimationAPI.to error: 'interpolate' is not a function.`); + } + const initial = {}; + const destination = {}; + const data = this.#data; + for (const key in toData) { + if (data[key] !== void 0 && toData[key] !== data[key]) { + destination[key] = toData[key]; + initial[key] = data[key]; + } + } + convertRelative(destination, data); + return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate); + } + /** + * Returns a function that provides an optimized way to constantly update a to-tween. + * + * @param {Iterable} keys - The keys for quickTo. + * + * @param {object} [opts] - Optional parameters. + * + * @param {number} [opts.duration=1] - Duration in seconds. + * + * @param {Function} [opts.ease=cubicOut] - Easing function. + * + * @param {Function} [opts.interpolate=lerp] - Interpolation function. + * + * @returns {import('../index.js').quickToCallback} quick-to tween function. + */ + quickTo(keys, { duration = 1, ease = cubicOut, interpolate = lerp } = {}) { + if (!isIterable(keys)) { + throw new TypeError(`AnimationAPI.quickTo error: 'keys' is not an iterable list.`); + } + const parent = this.#position.parent; + if (parent !== void 0 && typeof parent?.options?.positionable === "boolean" && !parent?.options?.positionable) { + throw new Error(`AnimationAPI.quickTo error: 'parent' is not positionable.`); + } + if (!Number.isFinite(duration) || duration < 0) { + throw new TypeError(`AnimationAPI.quickTo error: 'duration' is not a positive number.`); + } + if (typeof ease !== "function") { + throw new TypeError(`AnimationAPI.quickTo error: 'ease' is not a function.`); + } + if (typeof interpolate !== "function") { + throw new TypeError(`AnimationAPI.quickTo error: 'interpolate' is not a function.`); + } + const initial = {}; + const destination = {}; + const data = this.#data; + for (const key of keys) { + if (typeof key !== "string") { + throw new TypeError(`AnimationAPI.quickTo error: key is not a string.`); + } + if (!animateKeys.has(key)) { + throw new Error(`AnimationAPI.quickTo error: key ('${key}') is not animatable.`); + } + if (data[key] !== void 0) { + destination[key] = data[key]; + initial[key] = data[key]; + } + } + const keysArray = [...keys]; + Object.freeze(keysArray); + const newData = Object.assign({ immediateElementUpdate: true }, initial); + const animationData = { + active: true, + cleanup: this.#cleanup, + cancelled: false, + control: void 0, + current: 0, + destination, + duration: duration * 1e3, + // Internally the AnimationManager works in ms. + ease, + el: void 0, + finished: true, + // Note: start in finished state to add to AnimationManager on first callback. + initial, + interpolate, + keys, + newData, + position: this.#position, + resolve: void 0, + start: void 0 + }; + const quickToCB = (...args) => { + const argsLength = args.length; + if (argsLength === 0) { + return; + } + for (let cntr = keysArray.length; --cntr >= 0; ) { + const key = keysArray[cntr]; + if (data[key] !== void 0) { + initial[key] = data[key]; + } + } + if (isObject(args[0])) { + const objData = args[0]; + for (const key in objData) { + if (destination[key] !== void 0) { + destination[key] = objData[key]; + } + } + } else { + for (let cntr = 0; cntr < argsLength && cntr < keysArray.length; cntr++) { + const key = keysArray[cntr]; + if (destination[key] !== void 0) { + destination[key] = args[cntr]; + } + } + } + convertRelative(destination, data); + setNumericDefaults(initial); + setNumericDefaults(destination); + const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget; + animationData.el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0; + if (animationData.finished) { + animationData.finished = false; + animationData.active = true; + animationData.current = 0; + this.#instanceCount++; + AnimationManager.add(animationData); + } else { + const now2 = performance.now(); + animationData.start = now2 + (AnimationManager.current - now2); + animationData.current = 0; + } + }; + quickToCB.keys = keysArray; + quickToCB.options = ({ duration: duration2, ease: ease2, interpolate: interpolate2 } = {}) => { + if (duration2 !== void 0 && (!Number.isFinite(duration2) || duration2 < 0)) { + throw new TypeError(`AnimationAPI.quickTo.options error: 'duration' is not a positive number.`); + } + if (ease2 !== void 0 && typeof ease2 !== "function") { + throw new TypeError(`AnimationAPI.quickTo.options error: 'ease' is not a function.`); + } + if (interpolate2 !== void 0 && typeof interpolate2 !== "function") { + throw new TypeError(`AnimationAPI.quickTo.options error: 'interpolate' is not a function.`); + } + if (duration2 >= 0) { + animationData.duration = duration2 * 1e3; + } + if (ease2) { + animationData.ease = ease2; + } + if (interpolate2) { + animationData.interpolate = interpolate2; + } + return quickToCB; + }; + return quickToCB; + } +} +class AnimationGroupControl { + /** @type {import('./AnimationControl').AnimationControl[]} */ + #animationControls; + /** @type {Promise[]>} */ + #finishedPromise; + /** + * Defines a static empty / void animation control. + * + * @type {AnimationGroupControl} + */ + static #voidControl = new AnimationGroupControl(null); + /** + * Provides a static void / undefined AnimationGroupControl that is automatically resolved. + * + * @returns {AnimationGroupControl} Void AnimationGroupControl + */ + static get voidControl() { + return this.#voidControl; + } + /** + * @param {import('./AnimationControl').AnimationControl[]} animationControls - An array of AnimationControl + * instances. + */ + constructor(animationControls) { + this.#animationControls = animationControls; + } + /** + * Get a promise that resolves when all animations are finished. + * + * @returns {Promise[]>|Promise} Finished Promise for all animations. + */ + get finished() { + const animationControls = this.#animationControls; + if (animationControls === null || animationControls === void 0) { + return Promise.resolve(); + } + if (!(this.#finishedPromise instanceof Promise)) { + const promises = []; + for (let cntr = animationControls.length; --cntr >= 0; ) { + promises.push(animationControls[cntr].finished); + } + this.#finishedPromise = Promise.all(promises); + } + return this.#finishedPromise; + } + /** + * Returns whether there are active animation instances for this group. + * + * Note: a delayed animation may not be started / active yet. Use {@link AnimationGroupControl.isFinished} to + * determine if all animations in the group are finished. + * + * @returns {boolean} Are there active animation instances. + */ + get isActive() { + const animationControls = this.#animationControls; + if (animationControls === null || animationControls === void 0) { + return false; + } + for (let cntr = animationControls.length; --cntr >= 0; ) { + if (animationControls[cntr].isActive) { + return true; + } + } + return false; + } + /** + * Returns whether all animations in the group are finished. + * + * @returns {boolean} Are all animation instances finished. + */ + get isFinished() { + const animationControls = this.#animationControls; + if (animationControls === null || animationControls === void 0) { + return true; + } + for (let cntr = animationControls.length; --cntr >= 0; ) { + if (!animationControls[cntr].isFinished) { + return false; + } + } + return false; + } + /** + * Cancels the all animations. + */ + cancel() { + const animationControls = this.#animationControls; + if (animationControls === null || animationControls === void 0) { + return; + } + for (let cntr = this.#animationControls.length; --cntr >= 0; ) { + this.#animationControls[cntr].cancel(); + } + } +} +class AnimationGroupAPI { + /** + * Checks of the given object is a TJSPosition instance by checking for AnimationAPI. + * + * @param {*} object - Any data. + * + * @returns {boolean} Is TJSPosition. + */ + static #isPosition(object) { + return isObject(object) && object.animate instanceof AnimationAPI; + } + /** + * Cancels any animation for given TJSPosition data. + * + * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position - + */ + static cancel(position) { + if (isIterable(position)) { + let index = -1; + for (const entry of position) { + index++; + const actualPosition = this.#isPosition(entry) ? entry : entry.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.cancel warning: No Position instance found at index: ${index}.`); + continue; + } + AnimationManager.cancel(actualPosition); + } + } else { + const actualPosition = this.#isPosition(position) ? position : position.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.cancel warning: No Position instance found.`); + return; + } + AnimationManager.cancel(actualPosition); + } + } + /** + * Cancels all TJSPosition animation. + */ + static cancelAll() { + AnimationManager.cancelAll(); + } + /** + * Gets all animation controls for the given position data. + * + * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position - + * + * @returns {{ position: import('../').TJSPosition, data: object | void, controls: import('./AnimationControl').AnimationControl[]}[]} Results array. + */ + static getScheduled(position) { + const results = []; + if (isIterable(position)) { + let index = -1; + for (const entry of position) { + index++; + const isPosition = this.#isPosition(entry); + const actualPosition = isPosition ? entry : entry.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.getScheduled warning: No Position instance found at index: ${index}.`); + continue; + } + const controls = AnimationManager.getScheduled(actualPosition); + results.push({ position: actualPosition, data: isPosition ? void 0 : entry, controls }); + } + } else { + const isPosition = this.#isPosition(position); + const actualPosition = isPosition ? position : position.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.getScheduled warning: No Position instance found.`); + return results; + } + const controls = AnimationManager.getScheduled(actualPosition); + results.push({ position: actualPosition, data: isPosition ? void 0 : position, controls }); + } + return results; + } + /** + * Provides the `from` animation tween for one or more TJSPosition instances as a group. + * + * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position - + * + * @param {object|Function} fromData - + * + * @param {object|Function} options - + * + * @returns {import('#runtime/util/animate').TJSBasicAnimation} Basic animation control. + */ + static from(position, fromData, options) { + if (!isObject(fromData) && typeof fromData !== "function") { + throw new TypeError(`AnimationGroupAPI.from error: 'fromData' is not an object or function.`); + } + if (options !== void 0 && !isObject(options) && typeof options !== "function") { + throw new TypeError(`AnimationGroupAPI.from error: 'options' is not an object or function.`); + } + const animationControls = []; + let index = -1; + let callbackOptions; + const hasDataCallback = typeof fromData === "function"; + const hasOptionCallback = typeof options === "function"; + const hasCallback = hasDataCallback || hasOptionCallback; + if (hasCallback) { + callbackOptions = { index, position: void 0, data: void 0 }; + } + let actualFromData = fromData; + let actualOptions = options; + if (isIterable(position)) { + for (const entry of position) { + index++; + const isPosition = this.#isPosition(entry); + const actualPosition = isPosition ? entry : entry.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.from warning: No Position instance found at index: ${index}.`); + continue; + } + if (hasCallback) { + callbackOptions.index = index; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : entry; + } + if (hasDataCallback) { + actualFromData = fromData(callbackOptions); + if (actualFromData === null || actualFromData === void 0) { + continue; + } + if (!isObject(actualFromData)) { + throw new TypeError(`AnimationGroupAPI.from error: fromData callback function iteration(${index}) failed to return an object.`); + } + } + if (hasOptionCallback) { + actualOptions = options(callbackOptions); + if (actualOptions === null || actualOptions === void 0) { + continue; + } + if (!isObject(actualOptions)) { + throw new TypeError(`AnimationGroupAPI.from error: options callback function iteration(${index}) failed to return an object.`); + } + } + animationControls.push(actualPosition.animate.from(actualFromData, actualOptions)); + } + } else { + const isPosition = this.#isPosition(position); + const actualPosition = isPosition ? position : position.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.from warning: No Position instance found.`); + return AnimationGroupControl.voidControl; + } + if (hasCallback) { + callbackOptions.index = 0; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : position; + } + if (hasDataCallback) { + actualFromData = fromData(callbackOptions); + if (!isObject(actualFromData)) { + throw new TypeError( + `AnimationGroupAPI.from error: fromData callback function failed to return an object.` + ); + } + } + if (hasOptionCallback) { + actualOptions = options(callbackOptions); + if (!isObject(actualOptions)) { + throw new TypeError( + `AnimationGroupAPI.from error: options callback function failed to return an object.` + ); + } + } + animationControls.push(actualPosition.animate.from(actualFromData, actualOptions)); + } + return new AnimationGroupControl(animationControls); + } + /** + * Provides the `fromTo` animation tween for one or more TJSPosition instances as a group. + * + * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position - + * + * @param {object|Function} fromData - + * + * @param {object|Function} toData - + * + * @param {object|Function} options - + * + * @returns {import('#runtime/util/animate').TJSBasicAnimation} Basic animation control. + */ + static fromTo(position, fromData, toData, options) { + if (!isObject(fromData) && typeof fromData !== "function") { + throw new TypeError(`AnimationGroupAPI.fromTo error: 'fromData' is not an object or function.`); + } + if (!isObject(toData) && typeof toData !== "function") { + throw new TypeError(`AnimationGroupAPI.fromTo error: 'toData' is not an object or function.`); + } + if (options !== void 0 && !isObject(options) && typeof options !== "function") { + throw new TypeError(`AnimationGroupAPI.fromTo error: 'options' is not an object or function.`); + } + const animationControls = []; + let index = -1; + let callbackOptions; + const hasFromCallback = typeof fromData === "function"; + const hasToCallback = typeof toData === "function"; + const hasOptionCallback = typeof options === "function"; + const hasCallback = hasFromCallback || hasToCallback || hasOptionCallback; + if (hasCallback) { + callbackOptions = { index, position: void 0, data: void 0 }; + } + let actualFromData = fromData; + let actualToData = toData; + let actualOptions = options; + if (isIterable(position)) { + for (const entry of position) { + index++; + const isPosition = this.#isPosition(entry); + const actualPosition = isPosition ? entry : entry.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.fromTo warning: No Position instance found at index: ${index}.`); + continue; + } + if (hasCallback) { + callbackOptions.index = index; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : entry; + } + if (hasFromCallback) { + actualFromData = fromData(callbackOptions); + if (actualFromData === null || actualFromData === void 0) { + continue; + } + if (!isObject(actualFromData)) { + throw new TypeError(`AnimationGroupAPI.fromTo error: fromData callback function iteration(${index}) failed to return an object.`); + } + } + if (hasToCallback) { + actualToData = toData(callbackOptions); + if (actualToData === null || actualToData === void 0) { + continue; + } + if (!isObject(actualToData)) { + throw new TypeError(`AnimationGroupAPI.fromTo error: toData callback function iteration(${index}) failed to return an object.`); + } + } + if (hasOptionCallback) { + actualOptions = options(callbackOptions); + if (actualOptions === null || actualOptions === void 0) { + continue; + } + if (!isObject(actualOptions)) { + throw new TypeError(`AnimationGroupAPI.fromTo error: options callback function iteration(${index}) failed to return an object.`); + } + } + animationControls.push(actualPosition.animate.fromTo(actualFromData, actualToData, actualOptions)); + } + } else { + const isPosition = this.#isPosition(position); + const actualPosition = isPosition ? position : position.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.fromTo warning: No Position instance found.`); + return AnimationGroupControl.voidControl; + } + if (hasCallback) { + callbackOptions.index = 0; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : position; + } + if (hasFromCallback) { + actualFromData = fromData(callbackOptions); + if (!isObject(actualFromData)) { + throw new TypeError( + `AnimationGroupAPI.fromTo error: fromData callback function failed to return an object.` + ); + } + } + if (hasToCallback) { + actualToData = toData(callbackOptions); + if (!isObject(actualToData)) { + throw new TypeError( + `AnimationGroupAPI.fromTo error: toData callback function failed to return an object.` + ); + } + } + if (hasOptionCallback) { + actualOptions = options(callbackOptions); + if (!isObject(actualOptions)) { + throw new TypeError( + `AnimationGroupAPI.fromTo error: options callback function failed to return an object.` + ); + } + } + animationControls.push(actualPosition.animate.fromTo(actualFromData, actualToData, actualOptions)); + } + return new AnimationGroupControl(animationControls); + } + /** + * Provides the `to` animation tween for one or more TJSPosition instances as a group. + * + * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position - + * + * @param {object|Function} toData - + * + * @param {object|Function} options - + * + * @returns {import('#runtime/util/animate').TJSBasicAnimation} Basic animation control. + */ + static to(position, toData, options) { + if (!isObject(toData) && typeof toData !== "function") { + throw new TypeError(`AnimationGroupAPI.to error: 'toData' is not an object or function.`); + } + if (options !== void 0 && !isObject(options) && typeof options !== "function") { + throw new TypeError(`AnimationGroupAPI.to error: 'options' is not an object or function.`); + } + const animationControls = []; + let index = -1; + let callbackOptions; + const hasDataCallback = typeof toData === "function"; + const hasOptionCallback = typeof options === "function"; + const hasCallback = hasDataCallback || hasOptionCallback; + if (hasCallback) { + callbackOptions = { index, position: void 0, data: void 0 }; + } + let actualToData = toData; + let actualOptions = options; + if (isIterable(position)) { + for (const entry of position) { + index++; + const isPosition = this.#isPosition(entry); + const actualPosition = isPosition ? entry : entry.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.to warning: No Position instance found at index: ${index}.`); + continue; + } + if (hasCallback) { + callbackOptions.index = index; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : entry; + } + if (hasDataCallback) { + actualToData = toData(callbackOptions); + if (actualToData === null || actualToData === void 0) { + continue; + } + if (!isObject(actualToData)) { + throw new TypeError(`AnimationGroupAPI.to error: toData callback function iteration(${index}) failed to return an object.`); + } + } + if (hasOptionCallback) { + actualOptions = options(callbackOptions); + if (actualOptions === null || actualOptions === void 0) { + continue; + } + if (!isObject(actualOptions)) { + throw new TypeError(`AnimationGroupAPI.to error: options callback function iteration(${index}) failed to return an object.`); + } + } + animationControls.push(actualPosition.animate.to(actualToData, actualOptions)); + } + } else { + const isPosition = this.#isPosition(position); + const actualPosition = isPosition ? position : position.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.to warning: No Position instance found.`); + return AnimationGroupControl.voidControl; + } + if (hasCallback) { + callbackOptions.index = 0; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : position; + } + if (hasDataCallback) { + actualToData = toData(callbackOptions); + if (!isObject(actualToData)) { + throw new TypeError( + `AnimationGroupAPI.to error: toData callback function failed to return an object.` + ); + } + } + if (hasOptionCallback) { + actualOptions = options(callbackOptions); + if (!isObject(actualOptions)) { + throw new TypeError( + `AnimationGroupAPI.to error: options callback function failed to return an object.` + ); + } + } + animationControls.push(actualPosition.animate.to(actualToData, actualOptions)); + } + return new AnimationGroupControl(animationControls); + } + /** + * Provides the `to` animation tween for one or more TJSPosition instances as a group. + * + * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position - + * + * @param {Iterable} keys - + * + * @param {object|Function} options - + * + * @returns {import('../').quickToCallback} Basic animation control. + */ + static quickTo(position, keys, options) { + if (!isIterable(keys)) { + throw new TypeError(`AnimationGroupAPI.quickTo error: 'keys' is not an iterable list.`); + } + if (options !== void 0 && !isObject(options) && typeof options !== "function") { + throw new TypeError(`AnimationGroupAPI.quickTo error: 'options' is not an object or function.`); + } + const quickToCallbacks = []; + let index = -1; + const hasOptionCallback = typeof options === "function"; + const callbackOptions = { index, position: void 0, data: void 0 }; + let actualOptions = options; + if (isIterable(position)) { + for (const entry of position) { + index++; + const isPosition = this.#isPosition(entry); + const actualPosition = isPosition ? entry : entry.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.quickTo warning: No Position instance found at index: ${index}.`); + continue; + } + callbackOptions.index = index; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : entry; + if (hasOptionCallback) { + actualOptions = options(callbackOptions); + if (actualOptions === null || actualOptions === void 0) { + continue; + } + if (!isObject(actualOptions)) { + throw new TypeError(`AnimationGroupAPI.quickTo error: options callback function iteration(${index}) failed to return an object.`); + } + } + quickToCallbacks.push(actualPosition.animate.quickTo(keys, actualOptions)); + } + } else { + const isPosition = this.#isPosition(position); + const actualPosition = isPosition ? position : position.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.quickTo warning: No Position instance found.`); + return () => null; + } + callbackOptions.index = 0; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : position; + if (hasOptionCallback) { + actualOptions = options(callbackOptions); + if (!isObject(actualOptions)) { + throw new TypeError( + `AnimationGroupAPI.quickTo error: options callback function failed to return an object.` + ); + } + } + quickToCallbacks.push(actualPosition.animate.quickTo(keys, actualOptions)); + } + const keysArray = [...keys]; + Object.freeze(keysArray); + const quickToCB = (...args) => { + const argsLength = args.length; + if (argsLength === 0) { + return; + } + if (typeof args[0] === "function") { + const dataCallback = args[0]; + index = -1; + let cntr = 0; + if (isIterable(position)) { + for (const entry of position) { + index++; + const isPosition = this.#isPosition(entry); + const actualPosition = isPosition ? entry : entry.position; + if (!this.#isPosition(actualPosition)) { + continue; + } + callbackOptions.index = index; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : entry; + const toData = dataCallback(callbackOptions); + if (toData === null || toData === void 0) { + continue; + } + const toDataIterable = isIterable(toData); + if (!Number.isFinite(toData) && !toDataIterable && !isObject(toData)) { + throw new TypeError(`AnimationGroupAPI.quickTo error: toData callback function iteration(${index}) failed to return a finite number, iterable list, or object.`); + } + if (toDataIterable) { + quickToCallbacks[cntr++](...toData); + } else { + quickToCallbacks[cntr++](toData); + } + } + } else { + const isPosition = this.#isPosition(position); + const actualPosition = isPosition ? position : position.position; + if (!this.#isPosition(actualPosition)) { + return; + } + callbackOptions.index = 0; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : position; + const toData = dataCallback(callbackOptions); + if (toData === null || toData === void 0) { + return; + } + const toDataIterable = isIterable(toData); + if (!Number.isFinite(toData) && !toDataIterable && !isObject(toData)) { + throw new TypeError(`AnimationGroupAPI.quickTo error: toData callback function iteration(${index}) failed to return a finite number, iterable list, or object.`); + } + if (toDataIterable) { + quickToCallbacks[cntr++](...toData); + } else { + quickToCallbacks[cntr++](toData); + } + } + } else { + for (let cntr = quickToCallbacks.length; --cntr >= 0; ) { + quickToCallbacks[cntr](...args); + } + } + }; + quickToCB.keys = keysArray; + quickToCB.options = (options2) => { + if (options2 !== void 0 && !isObject(options2) && typeof options2 !== "function") { + throw new TypeError(`AnimationGroupAPI.quickTo error: 'options' is not an object or function.`); + } + if (isObject(options2)) { + for (let cntr = quickToCallbacks.length; --cntr >= 0; ) { + quickToCallbacks[cntr].options(options2); + } + } else if (typeof options2 === "function") { + if (isIterable(position)) { + index = -1; + let cntr = 0; + for (const entry of position) { + index++; + const isPosition = this.#isPosition(entry); + const actualPosition = isPosition ? entry : entry.position; + if (!this.#isPosition(actualPosition)) { + console.warn( + `AnimationGroupAPI.quickTo.options warning: No Position instance found at index: ${index}.` + ); + continue; + } + callbackOptions.index = index; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : entry; + actualOptions = options2(callbackOptions); + if (actualOptions === null || actualOptions === void 0) { + continue; + } + if (!isObject(actualOptions)) { + throw new TypeError( + `AnimationGroupAPI.quickTo.options error: options callback function iteration(${index}) failed to return an object.` + ); + } + quickToCallbacks[cntr++].options(actualOptions); + } + } else { + const isPosition = this.#isPosition(position); + const actualPosition = isPosition ? position : position.position; + if (!this.#isPosition(actualPosition)) { + console.warn(`AnimationGroupAPI.quickTo.options warning: No Position instance found.`); + return quickToCB; + } + callbackOptions.index = 0; + callbackOptions.position = position; + callbackOptions.data = isPosition ? void 0 : position; + actualOptions = options2(callbackOptions); + if (!isObject(actualOptions)) { + throw new TypeError( + `AnimationGroupAPI.quickTo error: options callback function failed to return an object.` + ); + } + quickToCallbacks[0].options(actualOptions); + } + } + return quickToCB; + }; + return quickToCB; + } +} +class Centered { + /** + * @type {HTMLElement} + */ + #element; + /** + * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not + * performance oriented. If manually set this height is used instead of `offsetHeight`. + * + * @type {number} + */ + #height; + /** + * Set from an optional value in the constructor to lock accessors preventing modification. + */ + #lock; + /** + * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not + * performance oriented. If manually set this width is used instead of `offsetWidth`. + * + * @type {number} + */ + #width; + /** + * @param {object} [options] - Initial options. + * + * @param {HTMLElement} [options.element] - Target element. + * + * @param {boolean} [options.lock=false] - Lock parameters from being set. + * + * @param {number} [options.width] - Manual width. + * + * @param {number} [options.height] - Manual height. + */ + constructor({ element: element2, lock = false, width, height } = {}) { + this.element = element2; + this.width = width; + this.height = height; + this.#lock = typeof lock === "boolean" ? lock : false; + } + /** + * @returns {HTMLElement|undefined|null} Target element. + */ + get element() { + return this.#element; + } + /** + * @returns {number} Get manual height. + */ + get height() { + return this.#height; + } + /** + * @returns {number} Get manual width. + */ + get width() { + return this.#width; + } + /** + * @param {HTMLElement|undefined|null} element - Set target element. + */ + set element(element2) { + if (this.#lock) { + return; + } + if (element2 === void 0 || element2 === null || element2 instanceof HTMLElement) { + this.#element = element2; + } else { + throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`); + } + } + /** + * @param {number} height - Set manual height. + */ + set height(height) { + if (this.#lock) { + return; + } + if (height === void 0 || Number.isFinite(height)) { + this.#height = height; + } else { + throw new TypeError(`'height' is not a finite number or undefined.`); + } + } + /** + * @param {number} width - Set manual width. + */ + set width(width) { + if (this.#lock) { + return; + } + if (width === void 0 || Number.isFinite(width)) { + this.#width = width; + } else { + throw new TypeError(`'width' is not a finite number or undefined.`); + } + } + /** + * Set manual width & height. + * + * @param {number} width - New manual width. + * + * @param {number} height - New manual height. + */ + setDimension(width, height) { + if (this.#lock) { + return; + } + if (width === void 0 || Number.isFinite(width)) { + this.#width = width; + } else { + throw new TypeError(`'width' is not a finite number or undefined.`); + } + if (height === void 0 || Number.isFinite(height)) { + this.#height = height; + } else { + throw new TypeError(`'height' is not a finite number or undefined.`); + } + } + /** + * Get the left constraint based on any manual target values or the browser inner width. + * + * @param {number} width - Target width. + * + * @returns {number} Calculated left constraint. + */ + getLeft(width) { + const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth; + return (boundsWidth - width) / 2; + } + /** + * Get the top constraint based on any manual target values or the browser inner height. + * + * @param {number} height - Target height. + * + * @returns {number} Calculated top constraint. + */ + getTop(height) { + const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight; + return (boundsHeight - height) / 2; + } +} +class PositionChangeSet { + constructor() { + this.left = false; + this.top = false; + this.width = false; + this.height = false; + this.maxHeight = false; + this.maxWidth = false; + this.minHeight = false; + this.minWidth = false; + this.zIndex = false; + this.transform = false; + this.transformOrigin = false; + } + hasChange() { + return this.left || this.top || this.width || this.height || this.maxHeight || this.maxWidth || this.minHeight || this.minWidth || this.zIndex || this.transform || this.transformOrigin; + } + set(value) { + this.left = value; + this.top = value; + this.width = value; + this.height = value; + this.maxHeight = value; + this.maxWidth = value; + this.minHeight = value; + this.minWidth = value; + this.zIndex = value; + this.transform = value; + this.transformOrigin = value; + } +} +class TJSPositionData { + constructor({ + height = null, + left = null, + maxHeight = null, + maxWidth = null, + minHeight = null, + minWidth = null, + rotateX = null, + rotateY = null, + rotateZ = null, + scale = null, + translateX = null, + translateY = null, + translateZ = null, + top = null, + transformOrigin = null, + width = null, + zIndex = null + } = {}) { + this.height = height; + this.left = left; + this.maxHeight = maxHeight; + this.maxWidth = maxWidth; + this.minHeight = minHeight; + this.minWidth = minWidth; + this.rotateX = rotateX; + this.rotateY = rotateY; + this.rotateZ = rotateZ; + this.scale = scale; + this.top = top; + this.transformOrigin = transformOrigin; + this.translateX = translateX; + this.translateY = translateY; + this.translateZ = translateZ; + this.width = width; + this.zIndex = zIndex; + Object.seal(this); + } + /** + * Copies given data to this instance. + * + * @param {TJSPositionData} data - Copy from this instance. + * + * @returns {TJSPositionData} This instance. + */ + copy(data) { + this.height = data.height; + this.left = data.left; + this.maxHeight = data.maxHeight; + this.maxWidth = data.maxWidth; + this.minHeight = data.minHeight; + this.minWidth = data.minWidth; + this.rotateX = data.rotateX; + this.rotateY = data.rotateY; + this.rotateZ = data.rotateZ; + this.scale = data.scale; + this.top = data.top; + this.transformOrigin = data.transformOrigin; + this.translateX = data.translateX; + this.translateY = data.translateY; + this.translateZ = data.translateZ; + this.width = data.width; + this.zIndex = data.zIndex; + return this; + } +} +class PositionStateAPI { + /** @type {import('./TJSPositionData').TJSPositionData} */ + #data; + /** + * @type {Map} + */ + #dataSaved = /* @__PURE__ */ new Map(); + /** @type {import('./').TJSPosition} */ + #position; + /** @type {import('./transform').TJSTransforms} */ + #transforms; + constructor(position, data, transforms) { + this.#position = position; + this.#data = data; + this.#transforms = transforms; + } + /** + * Returns any stored save state by name. + * + * @param {object} options - Options + * + * @param {string} options.name - Saved data set name. + * + * @returns {import('./').TJSPositionDataExtended} The saved data set. + */ + get({ name }) { + if (typeof name !== "string") { + throw new TypeError(`Position - getSave error: 'name' is not a string.`); + } + return this.#dataSaved.get(name); + } + /** + * Returns any associated default data. + * + * @returns {import('./').TJSPositionDataExtended} Associated default data. + */ + getDefault() { + return this.#dataSaved.get("#defaultData"); + } + /** + * Removes and returns any position state by name. + * + * @param {object} options - Options. + * + * @param {string} options.name - Name to remove and retrieve. + * + * @returns {import('./').TJSPositionDataExtended} Saved position data. + */ + remove({ name }) { + if (typeof name !== "string") { + throw new TypeError(`Position - remove: 'name' is not a string.`); + } + const data = this.#dataSaved.get(name); + this.#dataSaved.delete(name); + return data; + } + /** + * Resets data to default values and invokes set. + * + * @param {object} [opts] - Optional parameters. + * + * @param {boolean} [opts.keepZIndex=false] - When true keeps current z-index. + * + * @param {boolean} [opts.invokeSet=true] - When true invokes set method. + * + * @returns {boolean} Operation successful. + */ + reset({ keepZIndex = false, invokeSet = true } = {}) { + const defaultData = this.#dataSaved.get("#defaultData"); + if (!isObject(defaultData)) { + return false; + } + if (this.#position.animate.isScheduled) { + this.#position.animate.cancel(); + } + const zIndex = this.#position.zIndex; + const data = Object.assign({}, defaultData); + if (keepZIndex) { + data.zIndex = zIndex; + } + this.#transforms.reset(data); + if (this.#position.parent?.reactive?.minimized) { + this.#position.parent?.maximize?.({ animate: false, duration: 0 }); + } + if (invokeSet) { + setTimeout(() => this.#position.set(data), 0); + } + return true; + } + /** + * Restores a saved positional state returning the data. Several optional parameters are available + * to control whether the restore action occurs silently (no store / inline styles updates), animates + - * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to} + * allows specification of the duration, easing, and interpolate functions along with configuring a Promise to be + * returned if awaiting the end of the animation. + * + * @param {object} params - Parameters + * + * @param {string} params.name - Saved data set name. + * + * @param {boolean} [params.remove=false] - Remove data set. + * + * @param {Iterable} [params.properties] - Specific properties to set / animate. + * + * @param {boolean} [params.silent] - Set position data directly; no store or style updates. + * + * @param {boolean} [params.async=false] - If animating return a Promise that resolves with any saved data. + * + * @param {boolean} [params.animateTo=false] - Animate to restore data. + * + * @param {number} [params.duration=0.1] - Duration in seconds. + * + * @param {Function} [params.ease=linear] - Easing function. + * + * @param {Function} [params.interpolate=lerp] - Interpolation function. + * + * @returns {import('./').TJSPositionDataExtended | Promise} Saved position + * data. + */ + restore({ + name, + remove = false, + properties, + silent = false, + async = false, + animateTo = false, + duration = 0.1, + ease = identity, + interpolate = lerp + }) { + if (typeof name !== "string") { + throw new TypeError(`Position - restore error: 'name' is not a string.`); + } + const dataSaved = this.#dataSaved.get(name); + if (dataSaved) { + if (remove) { + this.#dataSaved.delete(name); + } + let data = dataSaved; + if (isIterable(properties)) { + data = {}; + for (const property of properties) { + data[property] = dataSaved[property]; + } + } + if (silent) { + for (const property in data) { + this.#data[property] = data[property]; + } + return dataSaved; + } else if (animateTo) { + if (data.transformOrigin !== this.#position.transformOrigin) { + this.#position.transformOrigin = data.transformOrigin; + } + if (async) { + return this.#position.animate.to(data, { duration, ease, interpolate }).finished.then(() => dataSaved); + } else { + this.#position.animate.to(data, { duration, ease, interpolate }); + } + } else { + this.#position.set(data); + } + } + return dataSaved; + } + /** + * Saves current position state with the opportunity to add extra data to the saved state. + * + * @param {object} opts - Options. + * + * @param {string} opts.name - name to index this saved data. + * + * @param {...*} [opts.extra] - Extra data to add to saved data. + * + * @returns {import('./').TJSPositionData} Current position data + */ + save({ name, ...extra }) { + if (typeof name !== "string") { + throw new TypeError(`Position - save error: 'name' is not a string.`); + } + const data = this.#position.get(extra); + this.#dataSaved.set(name, data); + return data; + } + /** + * Directly sets a position state. + * + * @param {object} opts - Options. + * + * @param {string} opts.name - name to index this saved data. + * + * @param {...*} [opts.data] - TJSPosition data to set. + */ + set({ name, ...data }) { + if (typeof name !== "string") { + throw new TypeError(`Position - set error: 'name' is not a string.`); + } + this.#dataSaved.set(name, data); + } +} +class StyleCache { + constructor() { + this.el = void 0; + this.computed = void 0; + this.marginLeft = void 0; + this.marginTop = void 0; + this.maxHeight = void 0; + this.maxWidth = void 0; + this.minHeight = void 0; + this.minWidth = void 0; + this.hasWillChange = false; + this.resizeObserved = { + contentHeight: void 0, + contentWidth: void 0, + offsetHeight: void 0, + offsetWidth: void 0 + }; + const storeResizeObserved = writable(this.resizeObserved); + this.stores = { + element: writable(this.el), + resizeContentHeight: propertyStore(storeResizeObserved, "contentHeight"), + resizeContentWidth: propertyStore(storeResizeObserved, "contentWidth"), + resizeObserved: storeResizeObserved, + resizeOffsetHeight: propertyStore(storeResizeObserved, "offsetHeight"), + resizeOffsetWidth: propertyStore(storeResizeObserved, "offsetWidth") + }; + } + /** + * Returns the cached offsetHeight from any attached `resizeObserver` action otherwise gets the offsetHeight from + * the element directly. The more optimized path is using `resizeObserver` as getting it from the element + * directly is more expensive and alters the execution order of an animation frame. + * + * @returns {number} The element offsetHeight. + */ + get offsetHeight() { + if (this.el instanceof HTMLElement) { + return this.resizeObserved.offsetHeight !== void 0 ? this.resizeObserved.offsetHeight : this.el.offsetHeight; + } + throw new Error(`StyleCache - get offsetHeight error: no element assigned.`); + } + /** + * Returns the cached offsetWidth from any attached `resizeObserver` action otherwise gets the offsetWidth from + * the element directly. The more optimized path is using `resizeObserver` as getting it from the element + * directly is more expensive and alters the execution order of an animation frame. + * + * @returns {number} The element offsetHeight. + */ + get offsetWidth() { + if (this.el instanceof HTMLElement) { + return this.resizeObserved.offsetWidth !== void 0 ? this.resizeObserved.offsetWidth : this.el.offsetWidth; + } + throw new Error(`StyleCache - get offsetWidth error: no element assigned.`); + } + /** + * @param {HTMLElement} el - + * + * @returns {boolean} Does element match cached element. + */ + hasData(el) { + return this.el === el; + } + /** + * Resets the style cache. + */ + reset() { + if (this.el instanceof HTMLElement && this.el.isConnected && !this.hasWillChange) { + this.el.style.willChange = null; + } + this.el = void 0; + this.computed = void 0; + this.marginLeft = void 0; + this.marginTop = void 0; + this.maxHeight = void 0; + this.maxWidth = void 0; + this.minHeight = void 0; + this.minWidth = void 0; + this.hasWillChange = false; + this.resizeObserved.contentHeight = void 0; + this.resizeObserved.contentWidth = void 0; + this.resizeObserved.offsetHeight = void 0; + this.resizeObserved.offsetWidth = void 0; + this.stores.element.set(void 0); + } + /** + * Updates the style cache with new data from the given element. + * + * @param {HTMLElement} el - An HTML element. + */ + update(el) { + this.el = el; + this.computed = globalThis.getComputedStyle(el); + this.marginLeft = StyleParse.pixels(el.style.marginLeft) ?? StyleParse.pixels(this.computed.marginLeft); + this.marginTop = StyleParse.pixels(el.style.marginTop) ?? StyleParse.pixels(this.computed.marginTop); + this.maxHeight = StyleParse.pixels(el.style.maxHeight) ?? StyleParse.pixels(this.computed.maxHeight); + this.maxWidth = StyleParse.pixels(el.style.maxWidth) ?? StyleParse.pixels(this.computed.maxWidth); + this.minHeight = StyleParse.pixels(el.style.minHeight) ?? StyleParse.pixels(this.computed.minHeight); + this.minWidth = StyleParse.pixels(el.style.minWidth) ?? StyleParse.pixels(this.computed.minWidth); + const willChange = el.style.willChange !== "" ? el.style.willChange : this.computed.willChange; + this.hasWillChange = willChange !== "" && willChange !== "auto"; + this.stores.element.set(el); + } +} +class TJSTransformData { + constructor() { + Object.seal(this); + } + /** + * Stores the calculated bounding rectangle. + * + * @type {DOMRect} + */ + #boundingRect = new DOMRect(); + /** + * Stores the individual transformed corner points of the window in screen space clockwise from: + * top left -> top right -> bottom right -> bottom left. + * + * @type {import('#runtime/math/gl-matrix').Vec3[]} + */ + #corners = [Vec3.create(), Vec3.create(), Vec3.create(), Vec3.create()]; + /** + * Stores the current gl-matrix Mat4 data. + * + * @type {import('#runtime/math/gl-matrix').Mat4} + */ + #mat4 = Mat4.create(); + /** + * Stores the pre & post origin translations to apply to matrix transforms. + * + * @type {import('#runtime/math/gl-matrix').Mat4[]} + */ + #originTranslations = [Mat4.create(), Mat4.create()]; + /** + * @returns {DOMRect} The bounding rectangle. + */ + get boundingRect() { + return this.#boundingRect; + } + /** + * @returns {import('#runtime/math/gl-matrix').Vec3[]} The transformed corner points as Vec3 in screen space. + */ + get corners() { + return this.#corners; + } + /** + * @returns {string} Returns the CSS style string for the transform matrix. + */ + get css() { + return `matrix3d(${this.mat4.join(",")})`; + } + /** + * @returns {import('#runtime/math/gl-matrix').Mat4} The transform matrix. + */ + get mat4() { + return this.#mat4; + } + /** + * @returns {import('#runtime/math/gl-matrix').Mat4[]} The pre / post translation matrices for origin translation. + */ + get originTranslations() { + return this.#originTranslations; + } +} +const s_SCALE_VECTOR = [1, 1, 1]; +const s_TRANSLATE_VECTOR = [0, 0, 0]; +const s_MAT4_RESULT = Mat4.create(); +const s_MAT4_TEMP = Mat4.create(); +const s_VEC3_TEMP = Vec3.create(); +class TJSTransforms { + /** + * Stores the transform keys in the order added. + * + * @type {string[]} + */ + #orderList = []; + constructor() { + this._data = {}; + } + /** + * @returns {boolean} Whether there are active transforms in local data. + */ + get isActive() { + return this.#orderList.length > 0; + } + /** + * @returns {number|undefined} Any local rotateX data. + */ + get rotateX() { + return this._data.rotateX; + } + /** + * @returns {number|undefined} Any local rotateY data. + */ + get rotateY() { + return this._data.rotateY; + } + /** + * @returns {number|undefined} Any local rotateZ data. + */ + get rotateZ() { + return this._data.rotateZ; + } + /** + * @returns {number|undefined} Any local rotateZ scale. + */ + get scale() { + return this._data.scale; + } + /** + * @returns {number|undefined} Any local translateZ data. + */ + get translateX() { + return this._data.translateX; + } + /** + * @returns {number|undefined} Any local translateZ data. + */ + get translateY() { + return this._data.translateY; + } + /** + * @returns {number|undefined} Any local translateZ data. + */ + get translateZ() { + return this._data.translateZ; + } + /** + * Sets the local rotateX data if the value is a finite number otherwise removes the local data. + * + * @param {number|null|undefined} value - A value to set. + */ + set rotateX(value) { + if (Number.isFinite(value)) { + if (this._data.rotateX === void 0) { + this.#orderList.push("rotateX"); + } + this._data.rotateX = value; + } else { + if (this._data.rotateX !== void 0) { + const index = this.#orderList.findIndex((entry) => entry === "rotateX"); + if (index >= 0) { + this.#orderList.splice(index, 1); + } + } + delete this._data.rotateX; + } + } + /** + * Sets the local rotateY data if the value is a finite number otherwise removes the local data. + * + * @param {number|null|undefined} value - A value to set. + */ + set rotateY(value) { + if (Number.isFinite(value)) { + if (this._data.rotateY === void 0) { + this.#orderList.push("rotateY"); + } + this._data.rotateY = value; + } else { + if (this._data.rotateY !== void 0) { + const index = this.#orderList.findIndex((entry) => entry === "rotateY"); + if (index >= 0) { + this.#orderList.splice(index, 1); + } + } + delete this._data.rotateY; + } + } + /** + * Sets the local rotateZ data if the value is a finite number otherwise removes the local data. + * + * @param {number|null|undefined} value - A value to set. + */ + set rotateZ(value) { + if (Number.isFinite(value)) { + if (this._data.rotateZ === void 0) { + this.#orderList.push("rotateZ"); + } + this._data.rotateZ = value; + } else { + if (this._data.rotateZ !== void 0) { + const index = this.#orderList.findIndex((entry) => entry === "rotateZ"); + if (index >= 0) { + this.#orderList.splice(index, 1); + } + } + delete this._data.rotateZ; + } + } + /** + * Sets the local scale data if the value is a finite number otherwise removes the local data. + * + * @param {number|null|undefined} value - A value to set. + */ + set scale(value) { + if (Number.isFinite(value)) { + if (this._data.scale === void 0) { + this.#orderList.push("scale"); + } + this._data.scale = value; + } else { + if (this._data.scale !== void 0) { + const index = this.#orderList.findIndex((entry) => entry === "scale"); + if (index >= 0) { + this.#orderList.splice(index, 1); + } + } + delete this._data.scale; + } + } + /** + * Sets the local translateX data if the value is a finite number otherwise removes the local data. + * + * @param {number|null|undefined} value - A value to set. + */ + set translateX(value) { + if (Number.isFinite(value)) { + if (this._data.translateX === void 0) { + this.#orderList.push("translateX"); + } + this._data.translateX = value; + } else { + if (this._data.translateX !== void 0) { + const index = this.#orderList.findIndex((entry) => entry === "translateX"); + if (index >= 0) { + this.#orderList.splice(index, 1); + } + } + delete this._data.translateX; + } + } + /** + * Sets the local translateY data if the value is a finite number otherwise removes the local data. + * + * @param {number|null|undefined} value - A value to set. + */ + set translateY(value) { + if (Number.isFinite(value)) { + if (this._data.translateY === void 0) { + this.#orderList.push("translateY"); + } + this._data.translateY = value; + } else { + if (this._data.translateY !== void 0) { + const index = this.#orderList.findIndex((entry) => entry === "translateY"); + if (index >= 0) { + this.#orderList.splice(index, 1); + } + } + delete this._data.translateY; + } + } + /** + * Sets the local translateZ data if the value is a finite number otherwise removes the local data. + * + * @param {number|null|undefined} value - A value to set. + */ + set translateZ(value) { + if (Number.isFinite(value)) { + if (this._data.translateZ === void 0) { + this.#orderList.push("translateZ"); + } + this._data.translateZ = value; + } else { + if (this._data.translateZ !== void 0) { + const index = this.#orderList.findIndex((entry) => entry === "translateZ"); + if (index >= 0) { + this.#orderList.splice(index, 1); + } + } + delete this._data.translateZ; + } + } + /** + * Returns the matrix3d CSS transform for the given position / transform data. + * + * @param {object} [data] - Optional position data otherwise use local stored transform data. + * + * @returns {string} The CSS matrix3d string. + */ + getCSS(data = this._data) { + return `matrix3d(${this.getMat4(data, s_MAT4_RESULT).join(",")})`; + } + /** + * Returns the matrix3d CSS transform for the given position / transform data. + * + * @param {object} [data] - Optional position data otherwise use local stored transform data. + * + * @returns {string} The CSS matrix3d string. + */ + getCSSOrtho(data = this._data) { + return `matrix3d(${this.getMat4Ortho(data, s_MAT4_RESULT).join(",")})`; + } + /** + * Collects all data including a bounding rect, transform matrix, and points array of the given + * {@link TJSPositionData} instance with the applied local transform data. + * + * @param {import('../').TJSPositionData} position - The position data to process. + * + * @param {TJSTransformData} [output] - Optional TJSTransformData output instance. + * + * @param {object} [validationData] - Optional validation data for adjustment parameters. + * + * @returns {TJSTransformData} The output TJSTransformData instance. + */ + getData(position, output = new TJSTransformData(), validationData = {}) { + const valWidth = validationData.width ?? 0; + const valHeight = validationData.height ?? 0; + const valOffsetTop = validationData.offsetTop ?? validationData.marginTop ?? 0; + const valOffsetLeft = validationData.offsetLeft ?? validationData.offsetLeft ?? 0; + position.top += valOffsetTop; + position.left += valOffsetLeft; + const width = Number.isFinite(position.width) ? position.width : valWidth; + const height = Number.isFinite(position.height) ? position.height : valHeight; + const rect = output.corners; + if (this.hasTransform(position)) { + rect[0][0] = rect[0][1] = rect[0][2] = 0; + rect[1][0] = width; + rect[1][1] = rect[1][2] = 0; + rect[2][0] = width; + rect[2][1] = height; + rect[2][2] = 0; + rect[3][0] = 0; + rect[3][1] = height; + rect[3][2] = 0; + const matrix = this.getMat4(position, output.mat4); + const translate = s_GET_ORIGIN_TRANSLATION(position.transformOrigin, width, height, output.originTranslations); + if (transformOriginDefault === position.transformOrigin) { + Vec3.transformMat4(rect[0], rect[0], matrix); + Vec3.transformMat4(rect[1], rect[1], matrix); + Vec3.transformMat4(rect[2], rect[2], matrix); + Vec3.transformMat4(rect[3], rect[3], matrix); + } else { + Vec3.transformMat4(rect[0], rect[0], translate[0]); + Vec3.transformMat4(rect[0], rect[0], matrix); + Vec3.transformMat4(rect[0], rect[0], translate[1]); + Vec3.transformMat4(rect[1], rect[1], translate[0]); + Vec3.transformMat4(rect[1], rect[1], matrix); + Vec3.transformMat4(rect[1], rect[1], translate[1]); + Vec3.transformMat4(rect[2], rect[2], translate[0]); + Vec3.transformMat4(rect[2], rect[2], matrix); + Vec3.transformMat4(rect[2], rect[2], translate[1]); + Vec3.transformMat4(rect[3], rect[3], translate[0]); + Vec3.transformMat4(rect[3], rect[3], matrix); + Vec3.transformMat4(rect[3], rect[3], translate[1]); + } + rect[0][0] = position.left + rect[0][0]; + rect[0][1] = position.top + rect[0][1]; + rect[1][0] = position.left + rect[1][0]; + rect[1][1] = position.top + rect[1][1]; + rect[2][0] = position.left + rect[2][0]; + rect[2][1] = position.top + rect[2][1]; + rect[3][0] = position.left + rect[3][0]; + rect[3][1] = position.top + rect[3][1]; + } else { + rect[0][0] = position.left; + rect[0][1] = position.top; + rect[1][0] = position.left + width; + rect[1][1] = position.top; + rect[2][0] = position.left + width; + rect[2][1] = position.top + height; + rect[3][0] = position.left; + rect[3][1] = position.top + height; + Mat4.identity(output.mat4); + } + let maxX = Number.MIN_SAFE_INTEGER; + let maxY = Number.MIN_SAFE_INTEGER; + let minX = Number.MAX_SAFE_INTEGER; + let minY = Number.MAX_SAFE_INTEGER; + for (let cntr = 4; --cntr >= 0; ) { + if (rect[cntr][0] > maxX) { + maxX = rect[cntr][0]; + } + if (rect[cntr][0] < minX) { + minX = rect[cntr][0]; + } + if (rect[cntr][1] > maxY) { + maxY = rect[cntr][1]; + } + if (rect[cntr][1] < minY) { + minY = rect[cntr][1]; + } + } + const boundingRect = output.boundingRect; + boundingRect.x = minX; + boundingRect.y = minY; + boundingRect.width = maxX - minX; + boundingRect.height = maxY - minY; + position.top -= valOffsetTop; + position.left -= valOffsetLeft; + return output; + } + /** + * Creates a transform matrix based on local data applied in order it was added. + * + * If no data object is provided then the source is the local transform data. If another data object is supplied + * then the stored local transform order is applied then all remaining transform keys are applied. This allows the + * construction of a transform matrix in advance of setting local data and is useful in collision detection. + * + * @param {object} [data] - TJSPositionData instance or local transform data. + * + * @param {import('#runtime/math/gl-matrix').Mat4} [output] - The output mat4 instance. + * + * @returns {import('#runtime/math/gl-matrix').Mat4} Transform matrix. + */ + getMat4(data = this._data, output = Mat4.create()) { + const matrix = Mat4.identity(output); + let seenKeys = 0; + const orderList = this.#orderList; + for (let cntr = 0; cntr < orderList.length; cntr++) { + const key = orderList[cntr]; + switch (key) { + case "rotateX": + seenKeys |= transformKeysBitwise.rotateX; + Mat4.multiply(matrix, matrix, Mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + case "rotateY": + seenKeys |= transformKeysBitwise.rotateY; + Mat4.multiply(matrix, matrix, Mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + case "rotateZ": + seenKeys |= transformKeysBitwise.rotateZ; + Mat4.multiply(matrix, matrix, Mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + case "scale": + seenKeys |= transformKeysBitwise.scale; + s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data[key]; + Mat4.multiply(matrix, matrix, Mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR)); + break; + case "translateX": + seenKeys |= transformKeysBitwise.translateX; + s_TRANSLATE_VECTOR[0] = data.translateX; + s_TRANSLATE_VECTOR[1] = 0; + s_TRANSLATE_VECTOR[2] = 0; + Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR)); + break; + case "translateY": + seenKeys |= transformKeysBitwise.translateY; + s_TRANSLATE_VECTOR[0] = 0; + s_TRANSLATE_VECTOR[1] = data.translateY; + s_TRANSLATE_VECTOR[2] = 0; + Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR)); + break; + case "translateZ": + seenKeys |= transformKeysBitwise.translateZ; + s_TRANSLATE_VECTOR[0] = 0; + s_TRANSLATE_VECTOR[1] = 0; + s_TRANSLATE_VECTOR[2] = data.translateZ; + Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR)); + break; + } + } + if (data !== this._data) { + for (let cntr = 0; cntr < transformKeys.length; cntr++) { + const key = transformKeys[cntr]; + if (data[key] === null || (seenKeys & transformKeysBitwise[key]) > 0) { + continue; + } + switch (key) { + case "rotateX": + Mat4.multiply(matrix, matrix, Mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + case "rotateY": + Mat4.multiply(matrix, matrix, Mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + case "rotateZ": + Mat4.multiply(matrix, matrix, Mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + case "scale": + s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data[key]; + Mat4.multiply(matrix, matrix, Mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR)); + break; + case "translateX": + s_TRANSLATE_VECTOR[0] = data[key]; + s_TRANSLATE_VECTOR[1] = 0; + s_TRANSLATE_VECTOR[2] = 0; + Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR)); + break; + case "translateY": + s_TRANSLATE_VECTOR[0] = 0; + s_TRANSLATE_VECTOR[1] = data[key]; + s_TRANSLATE_VECTOR[2] = 0; + Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR)); + break; + case "translateZ": + s_TRANSLATE_VECTOR[0] = 0; + s_TRANSLATE_VECTOR[1] = 0; + s_TRANSLATE_VECTOR[2] = data[key]; + Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR)); + break; + } + } + } + return matrix; + } + /** + * Provides an orthographic enhancement to convert left / top positional data to a translate operation. + * + * This transform matrix takes into account that the remaining operations are , but adds any left / top attributes from passed in data to + * translate X / Y. + * + * If no data object is provided then the source is the local transform data. If another data object is supplied + * then the stored local transform order is applied then all remaining transform keys are applied. This allows the + * construction of a transform matrix in advance of setting local data and is useful in collision detection. + * + * @param {object} [data] - TJSPositionData instance or local transform data. + * + * @param {import('#runtime/math/gl-matrix').Mat4} [output] - The output mat4 instance. + * + * @returns {import('#runtime/math/gl-matrix').Mat4} Transform matrix. + */ + getMat4Ortho(data = this._data, output = Mat4.create()) { + const matrix = Mat4.identity(output); + s_TRANSLATE_VECTOR[0] = (data.left ?? 0) + (data.translateX ?? 0); + s_TRANSLATE_VECTOR[1] = (data.top ?? 0) + (data.translateY ?? 0); + s_TRANSLATE_VECTOR[2] = data.translateZ ?? 0; + Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR)); + if (data.scale !== null) { + s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data.scale; + Mat4.multiply(matrix, matrix, Mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR)); + } + if (data.rotateX === null && data.rotateY === null && data.rotateZ === null) { + return matrix; + } + let seenKeys = 0; + const orderList = this.#orderList; + for (let cntr = 0; cntr < orderList.length; cntr++) { + const key = orderList[cntr]; + switch (key) { + case "rotateX": + seenKeys |= transformKeysBitwise.rotateX; + Mat4.multiply(matrix, matrix, Mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + case "rotateY": + seenKeys |= transformKeysBitwise.rotateY; + Mat4.multiply(matrix, matrix, Mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + case "rotateZ": + seenKeys |= transformKeysBitwise.rotateZ; + Mat4.multiply(matrix, matrix, Mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + } + } + if (data !== this._data) { + for (let cntr = 0; cntr < transformKeys.length; cntr++) { + const key = transformKeys[cntr]; + if (data[key] === null || (seenKeys & transformKeysBitwise[key]) > 0) { + continue; + } + switch (key) { + case "rotateX": + Mat4.multiply(matrix, matrix, Mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + case "rotateY": + Mat4.multiply(matrix, matrix, Mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + case "rotateZ": + Mat4.multiply(matrix, matrix, Mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key]))); + break; + } + } + } + return matrix; + } + /** + * Tests an object if it contains transform keys and the values are finite numbers. + * + * @param {object} data - An object to test for transform data. + * + * @returns {boolean} Whether the given TJSPositionData has transforms. + */ + hasTransform(data) { + for (const key of transformKeys) { + if (Number.isFinite(data[key])) { + return true; + } + } + return false; + } + /** + * Resets internal data from the given object containing valid transform keys. + * + * @param {object} data - An object with transform data. + */ + reset(data) { + for (const key in data) { + if (transformKeys.includes(key)) { + if (Number.isFinite(data[key])) { + this._data[key] = data[key]; + } else { + const index = this.#orderList.findIndex((entry) => entry === key); + if (index >= 0) { + this.#orderList.splice(index, 1); + } + delete this._data[key]; + } + } + } + } +} +function s_GET_ORIGIN_TRANSLATION(transformOrigin, width, height, output) { + const vector = s_VEC3_TEMP; + switch (transformOrigin) { + case "top left": + vector[0] = vector[1] = 0; + Mat4.fromTranslation(output[0], vector); + Mat4.fromTranslation(output[1], vector); + break; + case "top center": + vector[0] = -width * 0.5; + vector[1] = 0; + Mat4.fromTranslation(output[0], vector); + vector[0] = width * 0.5; + Mat4.fromTranslation(output[1], vector); + break; + case "top right": + vector[0] = -width; + vector[1] = 0; + Mat4.fromTranslation(output[0], vector); + vector[0] = width; + Mat4.fromTranslation(output[1], vector); + break; + case "center left": + vector[0] = 0; + vector[1] = -height * 0.5; + Mat4.fromTranslation(output[0], vector); + vector[1] = height * 0.5; + Mat4.fromTranslation(output[1], vector); + break; + case null: + case "center": + vector[0] = -width * 0.5; + vector[1] = -height * 0.5; + Mat4.fromTranslation(output[0], vector); + vector[0] = width * 0.5; + vector[1] = height * 0.5; + Mat4.fromTranslation(output[1], vector); + break; + case "center right": + vector[0] = -width; + vector[1] = -height * 0.5; + Mat4.fromTranslation(output[0], vector); + vector[0] = width; + vector[1] = height * 0.5; + Mat4.fromTranslation(output[1], vector); + break; + case "bottom left": + vector[0] = 0; + vector[1] = -height; + Mat4.fromTranslation(output[0], vector); + vector[1] = height; + Mat4.fromTranslation(output[1], vector); + break; + case "bottom center": + vector[0] = -width * 0.5; + vector[1] = -height; + Mat4.fromTranslation(output[0], vector); + vector[0] = width * 0.5; + vector[1] = height; + Mat4.fromTranslation(output[1], vector); + break; + case "bottom right": + vector[0] = -width; + vector[1] = -height; + Mat4.fromTranslation(output[0], vector); + vector[0] = width; + vector[1] = height; + Mat4.fromTranslation(output[1], vector); + break; + default: + Mat4.identity(output[0]); + Mat4.identity(output[1]); + break; + } + return output; +} +class AdapterValidators { + /** @type {boolean} */ + #enabled = true; + /** + * @type {import('../').ValidatorData[]} + */ + #validatorData; + #mapUnsubscribe = /* @__PURE__ */ new Map(); + /** + * @returns {[AdapterValidators, import('../').ValidatorData[]]} Returns this and internal storage for validator + * adapter. + */ + constructor() { + this.#validatorData = []; + Object.seal(this); + return [this, this.#validatorData]; + } + /** + * @returns {boolean} Returns the enabled state.s + */ + get enabled() { + return this.#enabled; + } + /** + * @returns {number} Returns the length of the validators array. + */ + get length() { + return this.#validatorData.length; + } + /** + * @param {boolean} enabled - Sets enabled state. + */ + set enabled(enabled) { + if (typeof enabled !== "boolean") { + throw new TypeError(`'enabled' is not a boolean.`); + } + this.#enabled = enabled; + } + /** + * Provides an iterator for validators. + * + * @yields {import('../').ValidatorData} + */ + *[Symbol.iterator]() { + if (this.#validatorData.length === 0) { + return; + } + for (const entry of this.#validatorData) { + yield { ...entry }; + } + } + /** + * @param {...(import('../').ValidatorFn | import('../').ValidatorData)} validators - + */ + add(...validators) { + for (const validator of validators) { + const validatorType = typeof validator; + if (validatorType !== "function" && validatorType !== "object" || validator === null) { + throw new TypeError(`AdapterValidator error: 'validator' is not a function or object.`); + } + let data = void 0; + let subscribeFn = void 0; + switch (validatorType) { + case "function": + data = { + id: void 0, + validator, + weight: 1 + }; + subscribeFn = validator.subscribe; + break; + case "object": + if (typeof validator.validator !== "function") { + throw new TypeError(`AdapterValidator error: 'validator' attribute is not a function.`); + } + if (validator.weight !== void 0 && typeof validator.weight !== "number" || (validator.weight < 0 || validator.weight > 1)) { + throw new TypeError( + `AdapterValidator error: 'weight' attribute is not a number between '0 - 1' inclusive.` + ); + } + data = { + id: validator.id !== void 0 ? validator.id : void 0, + validator: validator.validator.bind(validator), + weight: validator.weight || 1, + instance: validator + }; + subscribeFn = validator.validator.subscribe ?? validator.subscribe; + break; + } + const index = this.#validatorData.findIndex((value) => { + return data.weight < value.weight; + }); + if (index >= 0) { + this.#validatorData.splice(index, 0, data); + } else { + this.#validatorData.push(data); + } + if (typeof subscribeFn === "function") { + const unsubscribe = subscribeFn(); + if (typeof unsubscribe !== "function") { + throw new TypeError( + "AdapterValidator error: Filter has subscribe function, but no unsubscribe function is returned." + ); + } + if (this.#mapUnsubscribe.has(data.validator)) { + throw new Error( + "AdapterValidator error: Filter added already has an unsubscribe function registered." + ); + } + this.#mapUnsubscribe.set(data.validator, unsubscribe); + } + } + } + clear() { + this.#validatorData.length = 0; + for (const unsubscribe of this.#mapUnsubscribe.values()) { + unsubscribe(); + } + this.#mapUnsubscribe.clear(); + } + /** + * @param {...(import('../').ValidatorFn | import('../').ValidatorData)} validators - + */ + remove(...validators) { + const length = this.#validatorData.length; + if (length === 0) { + return; + } + for (const data of validators) { + const actualValidator = typeof data === "function" ? data : isObject(data) ? data.validator : void 0; + if (!actualValidator) { + continue; + } + for (let cntr = this.#validatorData.length; --cntr >= 0; ) { + if (this.#validatorData[cntr].validator === actualValidator) { + this.#validatorData.splice(cntr, 1); + let unsubscribe = void 0; + if (typeof (unsubscribe = this.#mapUnsubscribe.get(actualValidator)) === "function") { + unsubscribe(); + this.#mapUnsubscribe.delete(actualValidator); + } + } + } + } + } + /** + * Remove validators by the provided callback. The callback takes 3 parameters: `id`, `validator`, and `weight`. + * Any truthy value returned will remove that validator. + * + * @param {function(*, import('../').ValidatorFn, number): boolean} callback - Callback function to evaluate each + * validator entry. + */ + removeBy(callback) { + const length = this.#validatorData.length; + if (length === 0) { + return; + } + if (typeof callback !== "function") { + throw new TypeError(`AdapterValidator error: 'callback' is not a function.`); + } + this.#validatorData = this.#validatorData.filter((data) => { + const remove = callback.call(callback, { ...data }); + if (remove) { + let unsubscribe; + if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.validator)) === "function") { + unsubscribe(); + this.#mapUnsubscribe.delete(data.validator); + } + } + return !remove; + }); + } + removeById(...ids) { + const length = this.#validatorData.length; + if (length === 0) { + return; + } + this.#validatorData = this.#validatorData.filter((data) => { + let remove = false; + for (const id2 of ids) { + remove |= data.id === id2; + } + if (remove) { + let unsubscribe; + if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.validator)) === "function") { + unsubscribe(); + this.#mapUnsubscribe.delete(data.validator); + } + } + return !remove; + }); + } +} +class BasicBounds { + /** + * When true constrains the min / max width or height to element. + * + * @type {boolean} + */ + #constrain; + /** + * @type {HTMLElement} + */ + #element; + /** + * When true the validator is active. + * + * @type {boolean} + */ + #enabled; + /** + * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not + * performance oriented. If manually set this height is used instead of `offsetHeight`. + * + * @type {number} + */ + #height; + /** + * Set from an optional value in the constructor to lock accessors preventing modification. + */ + #lock; + /** + * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not + * performance oriented. If manually set this width is used instead of `offsetWidth`. + * + * @type {number} + */ + #width; + constructor({ constrain = true, element: element2, enabled = true, lock = false, width, height } = {}) { + this.element = element2; + this.constrain = constrain; + this.enabled = enabled; + this.width = width; + this.height = height; + this.#lock = typeof lock === "boolean" ? lock : false; + } + get constrain() { + return this.#constrain; + } + get element() { + return this.#element; + } + get enabled() { + return this.#enabled; + } + get height() { + return this.#height; + } + get width() { + return this.#width; + } + set constrain(constrain) { + if (this.#lock) { + return; + } + if (typeof constrain !== "boolean") { + throw new TypeError(`'constrain' is not a boolean.`); + } + this.#constrain = constrain; + } + set element(element2) { + if (this.#lock) { + return; + } + if (element2 === void 0 || element2 === null || element2 instanceof HTMLElement) { + this.#element = element2; + } else { + throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`); + } + } + set enabled(enabled) { + if (this.#lock) { + return; + } + if (typeof enabled !== "boolean") { + throw new TypeError(`'enabled' is not a boolean.`); + } + this.#enabled = enabled; + } + set height(height) { + if (this.#lock) { + return; + } + if (height === void 0 || Number.isFinite(height)) { + this.#height = height; + } else { + throw new TypeError(`'height' is not a finite number or undefined.`); + } + } + set width(width) { + if (this.#lock) { + return; + } + if (width === void 0 || Number.isFinite(width)) { + this.#width = width; + } else { + throw new TypeError(`'width' is not a finite number or undefined.`); + } + } + setDimension(width, height) { + if (this.#lock) { + return; + } + if (width === void 0 || Number.isFinite(width)) { + this.#width = width; + } else { + throw new TypeError(`'width' is not a finite number or undefined.`); + } + if (height === void 0 || Number.isFinite(height)) { + this.#height = height; + } else { + throw new TypeError(`'height' is not a finite number or undefined.`); + } + } + /** + * Provides a validator that respects transforms in positional data constraining the position to within the target + * elements bounds. + * + * @param {import('../').ValidationData} valData - The associated validation data for position updates. + * + * @returns {import('../').TJSPositionData} Potentially adjusted position data. + */ + validator(valData) { + if (!this.#enabled) { + return valData.position; + } + const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth; + const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight; + if (typeof valData.position.width === "number") { + const maxW = valData.maxWidth ?? (this.#constrain ? boundsWidth : Number.MAX_SAFE_INTEGER); + valData.position.width = valData.width = clamp(valData.position.width, valData.minWidth, maxW); + if (valData.width + valData.position.left + valData.marginLeft > boundsWidth) { + valData.position.left = boundsWidth - valData.width - valData.marginLeft; + } + } + if (typeof valData.position.height === "number") { + const maxH = valData.maxHeight ?? (this.#constrain ? boundsHeight : Number.MAX_SAFE_INTEGER); + valData.position.height = valData.height = clamp(valData.position.height, valData.minHeight, maxH); + if (valData.height + valData.position.top + valData.marginTop > boundsHeight) { + valData.position.top = boundsHeight - valData.height - valData.marginTop; + } + } + const maxL = Math.max(boundsWidth - valData.width - valData.marginLeft, 0); + valData.position.left = Math.round(clamp(valData.position.left, 0, maxL)); + const maxT = Math.max(boundsHeight - valData.height - valData.marginTop, 0); + valData.position.top = Math.round(clamp(valData.position.top, 0, maxT)); + return valData.position; + } +} +const s_TRANSFORM_DATA = new TJSTransformData(); +class TransformBounds { + /** + * When true constrains the min / max width or height to element. + * + * @type {boolean} + */ + #constrain; + /** + * @type {HTMLElement} + */ + #element; + /** + * When true the validator is active. + * + * @type {boolean} + */ + #enabled; + /** + * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not + * performance oriented. If manually set this height is used instead of `offsetHeight`. + * + * @type {number} + */ + #height; + /** + * Set from an optional value in the constructor to lock accessors preventing modification. + */ + #lock; + /** + * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not + * performance oriented. If manually set this width is used instead of `offsetWidth`. + * + * @type {number} + */ + #width; + constructor({ constrain = true, element: element2, enabled = true, lock = false, width, height } = {}) { + this.element = element2; + this.constrain = constrain; + this.enabled = enabled; + this.width = width; + this.height = height; + this.#lock = typeof lock === "boolean" ? lock : false; + } + get constrain() { + return this.#constrain; + } + get element() { + return this.#element; + } + get enabled() { + return this.#enabled; + } + get height() { + return this.#height; + } + get width() { + return this.#width; + } + set constrain(constrain) { + if (this.#lock) { + return; + } + if (typeof constrain !== "boolean") { + throw new TypeError(`'constrain' is not a boolean.`); + } + this.#constrain = constrain; + } + set element(element2) { + if (this.#lock) { + return; + } + if (element2 === void 0 || element2 === null || element2 instanceof HTMLElement) { + this.#element = element2; + } else { + throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`); + } + } + set enabled(enabled) { + if (this.#lock) { + return; + } + if (typeof enabled !== "boolean") { + throw new TypeError(`'enabled' is not a boolean.`); + } + this.#enabled = enabled; + } + set height(height) { + if (this.#lock) { + return; + } + if (height === void 0 || Number.isFinite(height)) { + this.#height = height; + } else { + throw new TypeError(`'height' is not a finite number or undefined.`); + } + } + set width(width) { + if (this.#lock) { + return; + } + if (width === void 0 || Number.isFinite(width)) { + this.#width = width; + } else { + throw new TypeError(`'width' is not a finite number or undefined.`); + } + } + setDimension(width, height) { + if (this.#lock) { + return; + } + if (width === void 0 || Number.isFinite(width)) { + this.#width = width; + } else { + throw new TypeError(`'width' is not a finite number or undefined.`); + } + if (height === void 0 || Number.isFinite(height)) { + this.#height = height; + } else { + throw new TypeError(`'height' is not a finite number or undefined.`); + } + } + /** + * Provides a validator that respects transforms in positional data constraining the position to within the target + * elements bounds. + * + * @param {import('../').ValidationData} valData - The associated validation data for position updates. + * + * @returns {import('../').TJSPositionData} Potentially adjusted position data. + */ + validator(valData) { + if (!this.#enabled) { + return valData.position; + } + const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth; + const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight; + if (typeof valData.position.width === "number") { + const maxW = valData.maxWidth ?? (this.#constrain ? boundsWidth : Number.MAX_SAFE_INTEGER); + valData.position.width = clamp(valData.width, valData.minWidth, maxW); + } + if (typeof valData.position.height === "number") { + const maxH = valData.maxHeight ?? (this.#constrain ? boundsHeight : Number.MAX_SAFE_INTEGER); + valData.position.height = clamp(valData.height, valData.minHeight, maxH); + } + const data = valData.transforms.getData(valData.position, s_TRANSFORM_DATA, valData); + const initialX = data.boundingRect.x; + const initialY = data.boundingRect.y; + if (data.boundingRect.bottom + valData.marginTop > boundsHeight) { + data.boundingRect.y += boundsHeight - data.boundingRect.bottom - valData.marginTop; + } + if (data.boundingRect.right + valData.marginLeft > boundsWidth) { + data.boundingRect.x += boundsWidth - data.boundingRect.right - valData.marginLeft; + } + if (data.boundingRect.top - valData.marginTop < 0) { + data.boundingRect.y += Math.abs(data.boundingRect.top - valData.marginTop); + } + if (data.boundingRect.left - valData.marginLeft < 0) { + data.boundingRect.x += Math.abs(data.boundingRect.left - valData.marginLeft); + } + valData.position.left -= initialX - data.boundingRect.x; + valData.position.top -= initialY - data.boundingRect.y; + return valData.position; + } +} +class UpdateElementData { + constructor() { + this.data = void 0; + this.dataSubscribers = new TJSPositionData(); + this.dimensionData = { width: 0, height: 0 }; + this.changeSet = void 0; + this.options = void 0; + this.queued = false; + this.styleCache = void 0; + this.transforms = void 0; + this.transformData = new TJSTransformData(); + this.subscriptions = void 0; + this.storeDimension = writable(this.dimensionData); + this.storeTransform = writable(this.transformData, () => { + this.options.transformSubscribed = true; + return () => this.options.transformSubscribed = false; + }); + this.queued = false; + Object.seal(this.dimensionData); + } +} +class UpdateElementManager { + static list = []; + static listCntr = 0; + static updatePromise; + static get promise() { + return this.updatePromise; + } + /** + * Potentially adds the given element and internal updateData instance to the list. + * + * @param {HTMLElement} el - An HTMLElement instance. + * + * @param {import('./UpdateElementData').UpdateElementData} updateData - An UpdateElementData instance. + * + * @returns {Promise} The unified next frame update promise. Returns `currentTime`. + */ + static add(el, updateData) { + if (this.listCntr < this.list.length) { + const entry = this.list[this.listCntr]; + entry[0] = el; + entry[1] = updateData; + } else { + this.list.push([el, updateData]); + } + this.listCntr++; + updateData.queued = true; + if (!this.updatePromise) { + this.updatePromise = this.wait(); + } + return this.updatePromise; + } + /** + * Await on `nextAnimationFrame` and iterate over list map invoking callback functions. + * + * @returns {Promise} The next frame Promise / currentTime from nextAnimationFrame. + */ + static async wait() { + const currentTime = await nextAnimationFrame(); + this.updatePromise = void 0; + for (let cntr = this.listCntr; --cntr >= 0; ) { + const entry = this.list[cntr]; + const el = entry[0]; + const updateData = entry[1]; + entry[0] = void 0; + entry[1] = void 0; + updateData.queued = false; + if (!el.isConnected) { + continue; + } + if (updateData.options.ortho) { + s_UPDATE_ELEMENT_ORTHO(el, updateData); + } else { + s_UPDATE_ELEMENT(el, updateData); + } + if (updateData.options.calculateTransform || updateData.options.transformSubscribed) { + s_UPDATE_TRANSFORM(el, updateData); + } + this.updateSubscribers(updateData); + } + this.listCntr = 0; + return currentTime; + } + /** + * Potentially immediately updates the given element. + * + * @param {HTMLElement} el - An HTMLElement instance. + * + * @param {import('./UpdateElementData').UpdateElementData} updateData - An UpdateElementData instance. + */ + static immediate(el, updateData) { + if (!el.isConnected) { + return; + } + if (updateData.options.ortho) { + s_UPDATE_ELEMENT_ORTHO(el, updateData); + } else { + s_UPDATE_ELEMENT(el, updateData); + } + if (updateData.options.calculateTransform || updateData.options.transformSubscribed) { + s_UPDATE_TRANSFORM(el, updateData); + } + this.updateSubscribers(updateData); + } + /** + * @param {import('./UpdateElementData').UpdateElementData} updateData - Data change set. + */ + static updateSubscribers(updateData) { + const data = updateData.data; + const changeSet = updateData.changeSet; + if (!changeSet.hasChange()) { + return; + } + const output = updateData.dataSubscribers.copy(data); + const subscriptions = updateData.subscriptions; + if (subscriptions.length > 0) { + for (let cntr = 0; cntr < subscriptions.length; cntr++) { + subscriptions[cntr](output); + } + } + if (changeSet.width || changeSet.height) { + updateData.dimensionData.width = data.width; + updateData.dimensionData.height = data.height; + updateData.storeDimension.set(updateData.dimensionData); + } + changeSet.set(false); + } +} +function s_UPDATE_ELEMENT(el, updateData) { + const changeSet = updateData.changeSet; + const data = updateData.data; + if (changeSet.left) { + el.style.left = `${data.left}px`; + } + if (changeSet.top) { + el.style.top = `${data.top}px`; + } + if (changeSet.zIndex) { + el.style.zIndex = typeof data.zIndex === "number" ? `${data.zIndex}` : null; + } + if (changeSet.width) { + el.style.width = typeof data.width === "number" ? `${data.width}px` : data.width; + } + if (changeSet.height) { + el.style.height = typeof data.height === "number" ? `${data.height}px` : data.height; + } + if (changeSet.transformOrigin) { + el.style.transformOrigin = data.transformOrigin; + } + if (changeSet.transform) { + el.style.transform = updateData.transforms.isActive ? updateData.transforms.getCSS() : null; + } +} +function s_UPDATE_ELEMENT_ORTHO(el, updateData) { + const changeSet = updateData.changeSet; + const data = updateData.data; + if (changeSet.zIndex) { + el.style.zIndex = typeof data.zIndex === "number" ? `${data.zIndex}` : null; + } + if (changeSet.width) { + el.style.width = typeof data.width === "number" ? `${data.width}px` : data.width; + } + if (changeSet.height) { + el.style.height = typeof data.height === "number" ? `${data.height}px` : data.height; + } + if (changeSet.transformOrigin) { + el.style.transformOrigin = data.transformOrigin; + } + if (changeSet.left || changeSet.top || changeSet.transform) { + el.style.transform = updateData.transforms.getCSSOrtho(data); + } +} +function s_UPDATE_TRANSFORM(el, updateData) { + s_VALIDATION_DATA$1.height = updateData.data.height !== "auto" ? updateData.data.height : updateData.styleCache.offsetHeight; + s_VALIDATION_DATA$1.width = updateData.data.width !== "auto" ? updateData.data.width : updateData.styleCache.offsetWidth; + s_VALIDATION_DATA$1.marginLeft = updateData.styleCache.marginLeft; + s_VALIDATION_DATA$1.marginTop = updateData.styleCache.marginTop; + updateData.transforms.getData(updateData.data, updateData.transformData, s_VALIDATION_DATA$1); + updateData.storeTransform.set(updateData.transformData); +} +const s_VALIDATION_DATA$1 = { + height: void 0, + width: void 0, + marginLeft: void 0, + marginTop: void 0 +}; +class TJSPosition { + /** + * @type {{browserCentered: Centered, Centered: Centered}} + */ + static #positionInitial = { + browserCentered: new Centered({ lock: true }), + Centered + }; + /** + * @type {{TransformBounds: TransformBounds, BasicBounds: BasicBounds, basicWindow: BasicBounds, transformWindow: TransformBounds}} + */ + static #positionValidators = { + basicWindow: new BasicBounds({ lock: true }), + BasicBounds, + transformWindow: new TransformBounds({ lock: true }), + TransformBounds + }; + /** + * @type {TJSPositionData} + */ + #data = new TJSPositionData(); + /** + * Provides the animation API. + * + * @type {AnimationAPI} + */ + #animate = new AnimationAPI(this, this.#data); + /** + * Provides a way to turn on / off the position handling. + * + * @type {boolean} + */ + #enabled = true; + /** + * Stores ongoing options that are set in the constructor or by transform store subscription. + * + * @type {import('./').TJSPositionOptions} + */ + #options = { + calculateTransform: false, + initialHelper: void 0, + ortho: true, + transformSubscribed: false + }; + /** + * The associated parent for positional data tracking. Used in validators. + * + * @type {import('./').TJSPositionParent} + */ + #parent; + /** + * Stores the style attributes that changed on update. + * + * @type {PositionChangeSet} + */ + #positionChangeSet = new PositionChangeSet(); + /** + * @type {import('./').TJSPositionStores} + */ + #stores; + /** + * Stores an instance of the computer styles for the target element. + * + * @type {StyleCache} + */ + #styleCache; + /** + * Stores the subscribers. + * + * @type {import('svelte/store').Subscriber[]} + */ + #subscriptions = []; + /** + * @type {TJSTransforms} + */ + #transforms = new TJSTransforms(); + /** + * @type {UpdateElementData} + */ + #updateElementData; + /** + * Stores the UpdateElementManager wait promise. + * + * @type {Promise} + */ + #updateElementPromise; + /** + * @type {AdapterValidators} + */ + #validators; + /** + * @type {import('./').ValidatorData[]} + */ + #validatorData; + /** + * @type {PositionStateAPI} + */ + #state = new PositionStateAPI(this, this.#data, this.#transforms); + /** + * @returns {AnimationGroupAPI} Public Animation API. + */ + static get Animate() { + return AnimationGroupAPI; + } + /** + * @returns {{browserCentered: Centered, Centered: Centered}} TJSPosition initial API. + */ + static get Initial() { + return this.#positionInitial; + } + /** + * Returns TJSTransformData class / constructor. + * + * @returns {TJSTransformData} TJSTransformData class / constructor. + */ + static get TransformData() { + return TJSTransformData; + } + /** + * Returns default validators. + * + * Note: `basicWindow` and `BasicBounds` will eventually be removed. + * + * @returns {{TransformBounds: TransformBounds, BasicBounds: BasicBounds, basicWindow: BasicBounds, transformWindow: TransformBounds}} + * Available validators. + */ + static get Validators() { + return this.#positionValidators; + } + /** + * Returns a duplicate of a given position instance copying any options and validators. + * + * // TODO: Consider more safety over options processing. + * + * @param {TJSPosition} position - A position instance. + * + * @param {import('./').TJSPositionOptions} options - TJSPosition options. + * + * @returns {TJSPosition} A duplicate position instance. + */ + static duplicate(position, options) { + if (!(position instanceof TJSPosition)) { + throw new TypeError(`'position' is not an instance of Position.`); + } + const newPosition = new TJSPosition(options); + newPosition.#options = Object.assign({}, position.#options, options); + newPosition.#validators.add(...position.#validators); + newPosition.set(position.#data); + return newPosition; + } + /** + * @param {import('./').TJSPositionParent | import('./').TJSPositionOptionsAll} [parent] - A + * potential parent element or object w/ `elementTarget` getter. May also be the TJSPositionOptions object + * w/ 1 argument. + * + * @param {import('./').TJSPositionOptionsAll} [options] - Default values. + */ + constructor(parent, options) { + if (isPlainObject(parent)) { + options = parent; + } else { + this.#parent = parent; + } + const data = this.#data; + const transforms = this.#transforms; + this.#styleCache = new StyleCache(); + const updateData = new UpdateElementData(); + updateData.changeSet = this.#positionChangeSet; + updateData.data = this.#data; + updateData.options = this.#options; + updateData.styleCache = this.#styleCache; + updateData.subscriptions = this.#subscriptions; + updateData.transforms = this.#transforms; + this.#updateElementData = updateData; + if (isObject(options)) { + if (typeof options.calculateTransform === "boolean") { + this.#options.calculateTransform = options.calculateTransform; + } + if (typeof options.ortho === "boolean") { + this.#options.ortho = options.ortho; + } + if (Number.isFinite(options.height) || options.height === "auto" || options.height === "inherit" || options.height === null) { + data.height = updateData.dimensionData.height = typeof options.height === "number" ? Math.round(options.height) : options.height; + } + if (Number.isFinite(options.left) || options.left === null) { + data.left = typeof options.left === "number" ? Math.round(options.left) : options.left; + } + if (Number.isFinite(options.maxHeight) || options.maxHeight === null) { + data.maxHeight = typeof options.maxHeight === "number" ? Math.round(options.maxHeight) : options.maxHeight; + } + if (Number.isFinite(options.maxWidth) || options.maxWidth === null) { + data.maxWidth = typeof options.maxWidth === "number" ? Math.round(options.maxWidth) : options.maxWidth; + } + if (Number.isFinite(options.minHeight) || options.minHeight === null) { + data.minHeight = typeof options.minHeight === "number" ? Math.round(options.minHeight) : options.minHeight; + } + if (Number.isFinite(options.minWidth) || options.minWidth === null) { + data.minWidth = typeof options.minWidth === "number" ? Math.round(options.minWidth) : options.minWidth; + } + if (Number.isFinite(options.rotateX) || options.rotateX === null) { + transforms.rotateX = data.rotateX = options.rotateX; + } + if (Number.isFinite(options.rotateY) || options.rotateY === null) { + transforms.rotateY = data.rotateY = options.rotateY; + } + if (Number.isFinite(options.rotateZ) || options.rotateZ === null) { + transforms.rotateZ = data.rotateZ = options.rotateZ; + } + if (Number.isFinite(options.scale) || options.scale === null) { + transforms.scale = data.scale = options.scale; + } + if (Number.isFinite(options.top) || options.top === null) { + data.top = typeof options.top === "number" ? Math.round(options.top) : options.top; + } + if (typeof options.transformOrigin === "string" || options.transformOrigin === null) { + data.transformOrigin = transformOrigins.includes(options.transformOrigin) ? options.transformOrigin : null; + } + if (Number.isFinite(options.translateX) || options.translateX === null) { + transforms.translateX = data.translateX = options.translateX; + } + if (Number.isFinite(options.translateY) || options.translateY === null) { + transforms.translateY = data.translateY = options.translateY; + } + if (Number.isFinite(options.translateZ) || options.translateZ === null) { + transforms.translateZ = data.translateZ = options.translateZ; + } + if (Number.isFinite(options.width) || options.width === "auto" || options.width === "inherit" || options.width === null) { + data.width = updateData.dimensionData.width = typeof options.width === "number" ? Math.round(options.width) : options.width; + } + if (Number.isFinite(options.zIndex) || options.zIndex === null) { + data.zIndex = typeof options.zIndex === "number" ? Math.round(options.zIndex) : options.zIndex; + } + } + this.#stores = { + // The main properties for manipulating TJSPosition. + height: propertyStore(this, "height"), + left: propertyStore(this, "left"), + rotateX: propertyStore(this, "rotateX"), + rotateY: propertyStore(this, "rotateY"), + rotateZ: propertyStore(this, "rotateZ"), + scale: propertyStore(this, "scale"), + top: propertyStore(this, "top"), + transformOrigin: propertyStore(this, "transformOrigin"), + translateX: propertyStore(this, "translateX"), + translateY: propertyStore(this, "translateY"), + translateZ: propertyStore(this, "translateZ"), + width: propertyStore(this, "width"), + zIndex: propertyStore(this, "zIndex"), + // Stores that control validation when width / height is not `auto`. + maxHeight: propertyStore(this, "maxHeight"), + maxWidth: propertyStore(this, "maxWidth"), + minHeight: propertyStore(this, "minHeight"), + minWidth: propertyStore(this, "minWidth"), + // Readable stores based on updates or from resize observer changes. + dimension: { subscribe: updateData.storeDimension.subscribe }, + element: { subscribe: this.#styleCache.stores.element.subscribe }, + resizeContentHeight: { subscribe: this.#styleCache.stores.resizeContentHeight.subscribe }, + resizeContentWidth: { subscribe: this.#styleCache.stores.resizeContentWidth.subscribe }, + resizeOffsetHeight: { subscribe: this.#styleCache.stores.resizeOffsetHeight.subscribe }, + resizeOffsetWidth: { subscribe: this.#styleCache.stores.resizeOffsetWidth.subscribe }, + transform: { subscribe: updateData.storeTransform.subscribe }, + // Protected store that should only be set by resizeObserver action. + resizeObserved: this.#styleCache.stores.resizeObserved + }; + subscribeIgnoreFirst(this.#stores.resizeObserved, (resizeData) => { + const parent2 = this.#parent; + const el = parent2 instanceof HTMLElement ? parent2 : parent2?.elementTarget; + if (el instanceof HTMLElement && Number.isFinite(resizeData?.offsetWidth) && Number.isFinite(resizeData?.offsetHeight)) { + this.set(data); + } + }); + this.#stores.transformOrigin.values = transformOrigins; + [this.#validators, this.#validatorData] = new AdapterValidators(); + if (options?.initial || options?.positionInitial) { + const initialHelper = options.initial ?? options.positionInitial; + if (typeof initialHelper?.getLeft !== "function" || typeof initialHelper?.getTop !== "function") { + throw new Error( + `'options.initial' position helper does not contain 'getLeft' and / or 'getTop' functions.` + ); + } + this.#options.initialHelper = options.initial; + } + if (options?.validator) { + if (isIterable(options?.validator)) { + this.validators.add(...options.validator); + } else { + this.validators.add(options.validator); + } + } + } + /** + * Returns the animation API. + * + * @returns {AnimationAPI} Animation API. + */ + get animate() { + return this.#animate; + } + /** + * Returns the dimension data for the readable store. + * + * @returns {{width: number | 'auto', height: number | 'auto'}} Dimension data. + */ + get dimension() { + return this.#updateElementData.dimensionData; + } + /** + * Returns the enabled state. + * + * @returns {boolean} Enabled state. + */ + get enabled() { + return this.#enabled; + } + /** + * Returns the current HTMLElement being positioned. + * + * @returns {HTMLElement|undefined} Current HTMLElement being positioned. + */ + get element() { + return this.#styleCache.el; + } + /** + * Returns a promise that is resolved on the next element update with the time of the update. + * + * @returns {Promise} Promise resolved on element update. + */ + get elementUpdated() { + return this.#updateElementPromise; + } + /** + * Returns the associated {@link TJSPositionParent} instance. + * + * @returns {import('./').TJSPositionParent} The TJSPositionParent instance. + */ + get parent() { + return this.#parent; + } + /** + * Returns the state API. + * + * @returns {import('./PositionStateAPI').PositionStateAPI} TJSPosition state API. + */ + get state() { + return this.#state; + } + /** + * Returns the derived writable stores for individual data variables. + * + * @returns {import('./').TJSPositionStores} Derived / writable stores. + */ + get stores() { + return this.#stores; + } + /** + * Returns the transform data for the readable store. + * + * @returns {TJSTransformData} Transform Data. + */ + get transform() { + return this.#updateElementData.transformData; + } + /** + * Returns the validators. + * + * @returns {AdapterValidators} validators. + */ + get validators() { + return this.#validators; + } + /** + * Sets the enabled state. + * + * @param {boolean} enabled - New enabled state. + */ + set enabled(enabled) { + if (typeof enabled !== "boolean") { + throw new TypeError(`'enabled' is not a boolean.`); + } + this.#enabled = enabled; + } + /** + * Sets the associated {@link TJSPositionParent} instance. Resets the style cache and default data. + * + * @param {import('./').TJSPositionParent} parent - A TJSPositionParent instance. + */ + set parent(parent) { + if (parent !== void 0 && !(parent instanceof HTMLElement) && !isObject(parent)) { + throw new TypeError(`'parent' is not an HTMLElement, object, or undefined.`); + } + this.#parent = parent; + this.#state.remove({ name: "#defaultData" }); + this.#styleCache.reset(); + if (parent) { + this.set(this.#data); + } + } + // Data accessors ---------------------------------------------------------------------------------------------------- + /** + * @returns {number|'auto'|'inherit'|null} height + */ + get height() { + return this.#data.height; + } + /** + * @returns {number|null} left + */ + get left() { + return this.#data.left; + } + /** + * @returns {number|null} maxHeight + */ + get maxHeight() { + return this.#data.maxHeight; + } + /** + * @returns {number|null} maxWidth + */ + get maxWidth() { + return this.#data.maxWidth; + } + /** + * @returns {number|null} minHeight + */ + get minHeight() { + return this.#data.minHeight; + } + /** + * @returns {number|null} minWidth + */ + get minWidth() { + return this.#data.minWidth; + } + /** + * @returns {number|null} rotateX + */ + get rotateX() { + return this.#data.rotateX; + } + /** + * @returns {number|null} rotateY + */ + get rotateY() { + return this.#data.rotateY; + } + /** + * @returns {number|null} rotateZ + */ + get rotateZ() { + return this.#data.rotateZ; + } + /** + * @returns {number|null} alias for rotateZ + */ + get rotation() { + return this.#data.rotateZ; + } + /** + * @returns {number|null} scale + */ + get scale() { + return this.#data.scale; + } + /** + * @returns {number|null} top + */ + get top() { + return this.#data.top; + } + /** + * @returns {import('./').TJSTransformOrigin} transformOrigin + */ + get transformOrigin() { + return this.#data.transformOrigin; + } + /** + * @returns {number|null} translateX + */ + get translateX() { + return this.#data.translateX; + } + /** + * @returns {number|null} translateY + */ + get translateY() { + return this.#data.translateY; + } + /** + * @returns {number|null} translateZ + */ + get translateZ() { + return this.#data.translateZ; + } + /** + * @returns {number|'auto'|'inherit'|null} width + */ + get width() { + return this.#data.width; + } + /** + * @returns {number|null} z-index + */ + get zIndex() { + return this.#data.zIndex; + } + /** + * @param {number|string|null} height - + */ + set height(height) { + this.#stores.height.set(height); + } + /** + * @param {number|string|null} left - + */ + set left(left) { + this.#stores.left.set(left); + } + /** + * @param {number|string|null} maxHeight - + */ + set maxHeight(maxHeight) { + this.#stores.maxHeight.set(maxHeight); + } + /** + * @param {number|string|null} maxWidth - + */ + set maxWidth(maxWidth) { + this.#stores.maxWidth.set(maxWidth); + } + /** + * @param {number|string|null} minHeight - + */ + set minHeight(minHeight) { + this.#stores.minHeight.set(minHeight); + } + /** + * @param {number|string|null} minWidth - + */ + set minWidth(minWidth) { + this.#stores.minWidth.set(minWidth); + } + /** + * @param {number|string|null} rotateX - + */ + set rotateX(rotateX) { + this.#stores.rotateX.set(rotateX); + } + /** + * @param {number|string|null} rotateY - + */ + set rotateY(rotateY) { + this.#stores.rotateY.set(rotateY); + } + /** + * @param {number|string|null} rotateZ - + */ + set rotateZ(rotateZ) { + this.#stores.rotateZ.set(rotateZ); + } + /** + * @param {number|string|null} rotateZ - alias for rotateZ + */ + set rotation(rotateZ) { + this.#stores.rotateZ.set(rotateZ); + } + /** + * @param {number|string|null} scale - + */ + set scale(scale) { + this.#stores.scale.set(scale); + } + /** + * @param {number|string|null} top - + */ + set top(top) { + this.#stores.top.set(top); + } + /** + * @param {import('./').TJSTransformOrigin} transformOrigin - + */ + set transformOrigin(transformOrigin) { + if (transformOrigins.includes(transformOrigin)) { + this.#stores.transformOrigin.set(transformOrigin); + } + } + /** + * @param {number|string|null} translateX - + */ + set translateX(translateX) { + this.#stores.translateX.set(translateX); + } + /** + * @param {number|string|null} translateY - + */ + set translateY(translateY) { + this.#stores.translateY.set(translateY); + } + /** + * @param {number|string|null} translateZ - + */ + set translateZ(translateZ) { + this.#stores.translateZ.set(translateZ); + } + /** + * @param {number|string|null} width - + */ + set width(width) { + this.#stores.width.set(width); + } + /** + * @param {number|string|null} zIndex - + */ + set zIndex(zIndex) { + this.#stores.zIndex.set(zIndex); + } + /** + * Assigns current position to object passed into method. + * + * @param {object|TJSPositionData} [position] - Target to assign current position data. + * + * @param {import('./').TJSPositionGetOptions} [options] - Defines options for specific keys and substituting null + * for numeric default values. + * + * @returns {TJSPositionData} Passed in object with current position data. + */ + get(position = {}, options) { + const keys = options?.keys; + const excludeKeys = options?.exclude; + const numeric = options?.numeric ?? false; + if (isIterable(keys)) { + if (numeric) { + for (const key of keys) { + position[key] = this[key] ?? numericDefaults[key]; + } + } else { + for (const key of keys) { + position[key] = this[key]; + } + } + if (isIterable(excludeKeys)) { + for (const key of excludeKeys) { + delete position[key]; + } + } + return position; + } else { + const data = Object.assign(position, this.#data); + if (isIterable(excludeKeys)) { + for (const key of excludeKeys) { + delete data[key]; + } + } + if (numeric) { + setNumericDefaults(data); + } + return data; + } + } + /** + * @returns {TJSPositionData} Current position data. + */ + toJSON() { + return Object.assign({}, this.#data); + } + /** + * All calculation and updates of position are implemented in {@link TJSPosition}. This allows position to be fully + * reactive and in control of updating inline styles for the application. + * + * Note: the logic for updating position is improved and changes a few aspects from the default + * {@link globalThis.Application.setPosition}. The gate on `popOut` is removed, so to ensure no positional + * application occurs popOut applications can set `this.options.positionable` to false ensuring no positional inline + * styles are applied. + * + * The initial set call on an application with a target element will always set width / height as this is + * necessary for correct calculations. + * + * When a target element is present updated styles are applied after validation. To modify the behavior of set + * implement one or more validator functions and add them from the application via + * `this.position.validators.add()`. + * + * Updates to any target element are decoupled from the underlying TJSPosition data. This method returns this instance + * that you can then await on the target element inline style update by using {@link TJSPosition.elementUpdated}. + * + * @param {import('./').TJSPositionDataExtended} [position] - TJSPosition data to set. + * + * @returns {TJSPosition} This TJSPosition instance. + */ + set(position = {}) { + if (!isObject(position)) { + throw new TypeError(`Position - set error: 'position' is not an object.`); + } + const parent = this.#parent; + if (!this.#enabled) { + return this; + } + if (parent !== void 0 && typeof parent?.options?.positionable === "boolean" && !parent?.options?.positionable) { + return this; + } + const immediateElementUpdate = position.immediateElementUpdate === true; + const data = this.#data; + const transforms = this.#transforms; + const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget; + const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0; + const changeSet = this.#positionChangeSet; + const styleCache = this.#styleCache; + if (el) { + if (!styleCache.hasData(el)) { + styleCache.update(el); + if (!styleCache.hasWillChange) + ; + changeSet.set(true); + this.#updateElementData.queued = false; + } + convertRelative(position, this); + position = this.#updatePosition(position, parent, el, styleCache); + if (position === null) { + return this; + } + } + if (Number.isFinite(position.left)) { + position.left = Math.round(position.left); + if (data.left !== position.left) { + data.left = position.left; + changeSet.left = true; + } + } + if (Number.isFinite(position.top)) { + position.top = Math.round(position.top); + if (data.top !== position.top) { + data.top = position.top; + changeSet.top = true; + } + } + if (Number.isFinite(position.maxHeight) || position.maxHeight === null) { + position.maxHeight = typeof position.maxHeight === "number" ? Math.round(position.maxHeight) : null; + if (data.maxHeight !== position.maxHeight) { + data.maxHeight = position.maxHeight; + changeSet.maxHeight = true; + } + } + if (Number.isFinite(position.maxWidth) || position.maxWidth === null) { + position.maxWidth = typeof position.maxWidth === "number" ? Math.round(position.maxWidth) : null; + if (data.maxWidth !== position.maxWidth) { + data.maxWidth = position.maxWidth; + changeSet.maxWidth = true; + } + } + if (Number.isFinite(position.minHeight) || position.minHeight === null) { + position.minHeight = typeof position.minHeight === "number" ? Math.round(position.minHeight) : null; + if (data.minHeight !== position.minHeight) { + data.minHeight = position.minHeight; + changeSet.minHeight = true; + } + } + if (Number.isFinite(position.minWidth) || position.minWidth === null) { + position.minWidth = typeof position.minWidth === "number" ? Math.round(position.minWidth) : null; + if (data.minWidth !== position.minWidth) { + data.minWidth = position.minWidth; + changeSet.minWidth = true; + } + } + if (Number.isFinite(position.rotateX) || position.rotateX === null) { + if (data.rotateX !== position.rotateX) { + data.rotateX = transforms.rotateX = position.rotateX; + changeSet.transform = true; + } + } + if (Number.isFinite(position.rotateY) || position.rotateY === null) { + if (data.rotateY !== position.rotateY) { + data.rotateY = transforms.rotateY = position.rotateY; + changeSet.transform = true; + } + } + if (Number.isFinite(position.rotateZ) || position.rotateZ === null) { + if (data.rotateZ !== position.rotateZ) { + data.rotateZ = transforms.rotateZ = position.rotateZ; + changeSet.transform = true; + } + } + if (Number.isFinite(position.scale) || position.scale === null) { + position.scale = typeof position.scale === "number" ? Math.max(0, Math.min(position.scale, 1e3)) : null; + if (data.scale !== position.scale) { + data.scale = transforms.scale = position.scale; + changeSet.transform = true; + } + } + if (typeof position.transformOrigin === "string" && transformOrigins.includes( + position.transformOrigin + ) || position.transformOrigin === null) { + if (data.transformOrigin !== position.transformOrigin) { + data.transformOrigin = position.transformOrigin; + changeSet.transformOrigin = true; + } + } + if (Number.isFinite(position.translateX) || position.translateX === null) { + if (data.translateX !== position.translateX) { + data.translateX = transforms.translateX = position.translateX; + changeSet.transform = true; + } + } + if (Number.isFinite(position.translateY) || position.translateY === null) { + if (data.translateY !== position.translateY) { + data.translateY = transforms.translateY = position.translateY; + changeSet.transform = true; + } + } + if (Number.isFinite(position.translateZ) || position.translateZ === null) { + if (data.translateZ !== position.translateZ) { + data.translateZ = transforms.translateZ = position.translateZ; + changeSet.transform = true; + } + } + if (Number.isFinite(position.zIndex)) { + position.zIndex = Math.round(position.zIndex); + if (data.zIndex !== position.zIndex) { + data.zIndex = position.zIndex; + changeSet.zIndex = true; + } + } + if (Number.isFinite(position.width) || position.width === "auto" || position.width === "inherit" || position.width === null) { + position.width = typeof position.width === "number" ? Math.round(position.width) : position.width; + if (data.width !== position.width) { + data.width = position.width; + changeSet.width = true; + } + } + if (Number.isFinite(position.height) || position.height === "auto" || position.height === "inherit" || position.height === null) { + position.height = typeof position.height === "number" ? Math.round(position.height) : position.height; + if (data.height !== position.height) { + data.height = position.height; + changeSet.height = true; + } + } + if (el) { + const defaultData = this.#state.getDefault(); + if (!isObject(defaultData)) { + this.#state.save({ name: "#defaultData", ...Object.assign({}, data) }); + } + if (immediateElementUpdate) { + UpdateElementManager.immediate(el, this.#updateElementData); + this.#updateElementPromise = Promise.resolve(performance.now()); + } else if (!this.#updateElementData.queued) { + this.#updateElementPromise = UpdateElementManager.add(el, this.#updateElementData); + } + } else { + UpdateElementManager.updateSubscribers(this.#updateElementData); + } + return this; + } + /** + * @param {import('svelte/store').Subscriber} handler - Callback function that is invoked on + * update / changes. Receives a copy of the TJSPositionData. + * + * @returns {import('svelte/store').Unsubscriber} Unsubscribe function. + */ + subscribe(handler) { + this.#subscriptions.push(handler); + handler(Object.assign({}, this.#data)); + return () => { + const index = this.#subscriptions.findIndex((sub) => sub === handler); + if (index >= 0) { + this.#subscriptions.splice(index, 1); + } + }; + } + /** + * @param {import('./').TJSPositionDataExtended} opts - + * + * @param {number|null} opts.left - + * + * @param {number|null} opts.top - + * + * @param {number|null} opts.maxHeight - + * + * @param {number|null} opts.maxWidth - + * + * @param {number|null} opts.minHeight - + * + * @param {number|null} opts.minWidth - + * + * @param {number|'auto'|null} opts.width - + * + * @param {number|'auto'|null} opts.height - + * + * @param {number|null} opts.rotateX - + * + * @param {number|null} opts.rotateY - + * + * @param {number|null} opts.rotateZ - + * + * @param {number|null} opts.scale - + * + * @param {string} opts.transformOrigin - + * + * @param {number|null} opts.translateX - + * + * @param {number|null} opts.translateY - + * + * @param {number|null} opts.translateZ - + * + * @param {number|null} opts.zIndex - + * + * @param {number|null} opts.rotation - alias for rotateZ + * + * @param {*} opts.rest - + * + * @param {object} parent - + * + * @param {HTMLElement} el - + * + * @param {StyleCache} styleCache - + * + * @returns {null|TJSPositionData} Updated position data or null if validation fails. + */ + #updatePosition({ + // Directly supported parameters + left, + top, + maxWidth, + maxHeight, + minWidth, + minHeight, + width, + height, + rotateX, + rotateY, + rotateZ, + scale, + transformOrigin, + translateX, + translateY, + translateZ, + zIndex, + // Aliased parameters + rotation, + ...rest + } = {}, parent, el, styleCache) { + let currentPosition = s_DATA_UPDATE.copy(this.#data); + if (el.style.width === "" || width !== void 0) { + if (width === "auto" || currentPosition.width === "auto" && width !== null) { + currentPosition.width = "auto"; + width = styleCache.offsetWidth; + } else if (width === "inherit" || currentPosition.width === "inherit" && width !== null) { + currentPosition.width = "inherit"; + width = styleCache.offsetWidth; + } else { + const newWidth = Number.isFinite(width) ? width : currentPosition.width; + currentPosition.width = width = Number.isFinite(newWidth) ? Math.round(newWidth) : styleCache.offsetWidth; + } + } else { + width = Number.isFinite(currentPosition.width) ? currentPosition.width : styleCache.offsetWidth; + } + if (el.style.height === "" || height !== void 0) { + if (height === "auto" || currentPosition.height === "auto" && height !== null) { + currentPosition.height = "auto"; + height = styleCache.offsetHeight; + } else if (height === "inherit" || currentPosition.height === "inherit" && height !== null) { + currentPosition.height = "inherit"; + height = styleCache.offsetHeight; + } else { + const newHeight = Number.isFinite(height) ? height : currentPosition.height; + currentPosition.height = height = Number.isFinite(newHeight) ? Math.round(newHeight) : styleCache.offsetHeight; + } + } else { + height = Number.isFinite(currentPosition.height) ? currentPosition.height : styleCache.offsetHeight; + } + if (Number.isFinite(left)) { + currentPosition.left = left; + } else if (!Number.isFinite(currentPosition.left)) { + currentPosition.left = typeof this.#options.initialHelper?.getLeft === "function" ? this.#options.initialHelper.getLeft(width) : 0; + } + if (Number.isFinite(top)) { + currentPosition.top = top; + } else if (!Number.isFinite(currentPosition.top)) { + currentPosition.top = typeof this.#options.initialHelper?.getTop === "function" ? this.#options.initialHelper.getTop(height) : 0; + } + if (Number.isFinite(maxHeight) || maxHeight === null) { + currentPosition.maxHeight = Number.isFinite(maxHeight) ? Math.round(maxHeight) : null; + } + if (Number.isFinite(maxWidth) || maxWidth === null) { + currentPosition.maxWidth = Number.isFinite(maxWidth) ? Math.round(maxWidth) : null; + } + if (Number.isFinite(minHeight) || minHeight === null) { + currentPosition.minHeight = Number.isFinite(minHeight) ? Math.round(minHeight) : null; + } + if (Number.isFinite(minWidth) || minWidth === null) { + currentPosition.minWidth = Number.isFinite(minWidth) ? Math.round(minWidth) : null; + } + if (Number.isFinite(rotateX) || rotateX === null) { + currentPosition.rotateX = rotateX; + } + if (Number.isFinite(rotateY) || rotateY === null) { + currentPosition.rotateY = rotateY; + } + if (rotateZ !== currentPosition.rotateZ && (Number.isFinite(rotateZ) || rotateZ === null)) { + currentPosition.rotateZ = rotateZ; + } else if (rotation !== currentPosition.rotateZ && (Number.isFinite(rotation) || rotation === null)) { + currentPosition.rotateZ = rotation; + } + if (Number.isFinite(translateX) || translateX === null) { + currentPosition.translateX = translateX; + } + if (Number.isFinite(translateY) || translateY === null) { + currentPosition.translateY = translateY; + } + if (Number.isFinite(translateZ) || translateZ === null) { + currentPosition.translateZ = translateZ; + } + if (Number.isFinite(scale) || scale === null) { + currentPosition.scale = typeof scale === "number" ? Math.max(0, Math.min(scale, 1e3)) : null; + } + if (typeof transformOrigin === "string" || transformOrigin === null) { + currentPosition.transformOrigin = transformOrigins.includes(transformOrigin) ? transformOrigin : null; + } + if (Number.isFinite(zIndex) || zIndex === null) { + currentPosition.zIndex = typeof zIndex === "number" ? Math.round(zIndex) : zIndex; + } + const validatorData = this.#validatorData; + if (this.#validators.enabled && validatorData.length) { + s_VALIDATION_DATA.parent = parent; + s_VALIDATION_DATA.el = el; + s_VALIDATION_DATA.computed = styleCache.computed; + s_VALIDATION_DATA.transforms = this.#transforms; + s_VALIDATION_DATA.height = height; + s_VALIDATION_DATA.width = width; + s_VALIDATION_DATA.marginLeft = styleCache.marginLeft; + s_VALIDATION_DATA.marginTop = styleCache.marginTop; + s_VALIDATION_DATA.maxHeight = styleCache.maxHeight ?? currentPosition.maxHeight; + s_VALIDATION_DATA.maxWidth = styleCache.maxWidth ?? currentPosition.maxWidth; + const isMinimized = parent?.reactive?.minimized ?? false; + s_VALIDATION_DATA.minHeight = isMinimized ? currentPosition.minHeight ?? 0 : styleCache.minHeight || (currentPosition.minHeight ?? 0); + s_VALIDATION_DATA.minWidth = isMinimized ? currentPosition.minWidth ?? 0 : styleCache.minWidth || (currentPosition.minWidth ?? 0); + for (let cntr = 0; cntr < validatorData.length; cntr++) { + s_VALIDATION_DATA.position = currentPosition; + s_VALIDATION_DATA.rest = rest; + currentPosition = validatorData[cntr].validator(s_VALIDATION_DATA); + if (currentPosition === null) { + return null; + } + } + } + return currentPosition; + } +} +const s_DATA_UPDATE = new TJSPositionData(); +const s_VALIDATION_DATA = { + position: void 0, + parent: void 0, + el: void 0, + computed: void 0, + transforms: void 0, + height: void 0, + width: void 0, + marginLeft: void 0, + marginTop: void 0, + maxHeight: void 0, + maxWidth: void 0, + minHeight: void 0, + minWidth: void 0, + rest: void 0 +}; +Object.seal(s_VALIDATION_DATA); +function draggable(node, { + position, + active: active2 = true, + button = 0, + storeDragging = void 0, + ease = false, + easeOptions = { duration: 0.1, ease: cubicOut }, + hasTargetClassList, + ignoreTargetClassList +}) { + if (hasTargetClassList !== void 0 && !isIterable(hasTargetClassList)) { + throw new TypeError(`'hasTargetClassList' is not iterable.`); + } + if (ignoreTargetClassList !== void 0 && !isIterable(ignoreTargetClassList)) { + throw new TypeError(`'ignoreTargetClassList' is not iterable.`); + } + const positionData = { left: 0, top: 0 }; + let initialPosition = null; + let initialDragPoint = {}; + let dragging = false; + let quickTo = position.animate.quickTo(["top", "left"], easeOptions); + const handlers = { + dragDown: ["pointerdown", onDragPointerDown, false], + dragMove: ["pointermove", onDragPointerChange, false], + dragUp: ["pointerup", onDragPointerUp, false] + }; + function activateListeners() { + node.addEventListener(...handlers.dragDown); + node.classList.add("draggable"); + } + function removeListeners() { + if (typeof storeDragging?.set === "function") { + storeDragging.set(false); + } + node.removeEventListener(...handlers.dragDown); + node.removeEventListener(...handlers.dragMove); + node.removeEventListener(...handlers.dragUp); + node.classList.remove("draggable"); + } + if (active2) { + activateListeners(); + } + function onDragPointerDown(event) { + if (event.button !== button || !event.isPrimary) { + return; + } + if (!position.enabled) { + return; + } + if (ignoreTargetClassList !== void 0 && event.target instanceof HTMLElement) { + for (const targetClass of ignoreTargetClassList) { + if (event.target.classList.contains(targetClass)) { + return; + } + } + } + if (hasTargetClassList !== void 0 && event.target instanceof HTMLElement) { + let foundTarget = false; + for (const targetClass of hasTargetClassList) { + if (event.target.classList.contains(targetClass)) { + foundTarget = true; + break; + } + } + if (!foundTarget) { + return; + } + } + event.preventDefault(); + dragging = false; + initialPosition = position.get(); + initialDragPoint = { x: event.clientX, y: event.clientY }; + node.addEventListener(...handlers.dragMove); + node.addEventListener(...handlers.dragUp); + node.setPointerCapture(event.pointerId); + } + function onDragPointerChange(event) { + if ((event.buttons & 1) === 0) { + onDragPointerUp(event); + return; + } + if (event.button !== -1 || !event.isPrimary) { + return; + } + event.preventDefault(); + if (!dragging && typeof storeDragging?.set === "function") { + dragging = true; + storeDragging.set(true); + } + const newLeft = initialPosition.left + (event.clientX - initialDragPoint.x); + const newTop = initialPosition.top + (event.clientY - initialDragPoint.y); + if (ease) { + quickTo(newTop, newLeft); + } else { + positionData.left = newLeft; + positionData.top = newTop; + position.set(positionData); + } + } + function onDragPointerUp(event) { + event.preventDefault(); + dragging = false; + if (typeof storeDragging?.set === "function") { + storeDragging.set(false); + } + node.removeEventListener(...handlers.dragMove); + node.removeEventListener(...handlers.dragUp); + } + return { + // The default of active being true won't automatically add listeners twice. + update: (options) => { + if (typeof options.active === "boolean") { + active2 = options.active; + if (active2) { + activateListeners(); + } else { + removeListeners(); + } + } + if (typeof options.button === "number") { + button = options.button; + } + if (options.position !== void 0 && options.position !== position) { + position = options.position; + quickTo = position.animate.quickTo(["top", "left"], easeOptions); + } + if (typeof options.ease === "boolean") { + ease = options.ease; + } + if (isObject(options.easeOptions)) { + easeOptions = options.easeOptions; + quickTo.options(easeOptions); + } + if (options.hasTargetClassList !== void 0) { + if (!isIterable(options.hasTargetClassList)) { + throw new TypeError(`'hasTargetClassList' is not iterable.`); + } else { + hasTargetClassList = options.hasTargetClassList; + } + } + if (options.ignoreTargetClassList !== void 0) { + if (!isIterable(options.ignoreTargetClassList)) { + throw new TypeError(`'ignoreTargetClassList' is not iterable.`); + } else { + ignoreTargetClassList = options.ignoreTargetClassList; + } + } + }, + destroy: () => removeListeners() + }; +} +class DraggableOptions { + #ease = false; + /** + * @type {{ duration: number, ease: (t: number) => number | string }} + */ + #easeOptions = { duration: 0.1, ease: cubicOut }; + /** + * Stores the subscribers. + * + * @type {import('svelte/store').Subscriber[]} + */ + #subscriptions = []; + /** + * + * @param {object} [opts] - Optional parameters. + * + * @param {boolean} [opts.ease] - + * + * @param {object} [opts.easeOptions] - + */ + constructor({ ease, easeOptions } = {}) { + Object.defineProperty(this, "ease", { + get: () => { + return this.#ease; + }, + set: (newEase) => { + if (typeof newEase !== "boolean") { + throw new TypeError(`'ease' is not a boolean.`); + } + this.#ease = newEase; + this.#updateSubscribers(); + }, + enumerable: true + }); + Object.defineProperty(this, "easeOptions", { + get: () => { + return this.#easeOptions; + }, + set: (newEaseOptions) => { + if (!isObject(newEaseOptions)) { + throw new TypeError(`'easeOptions' is not an object.`); + } + if (newEaseOptions.duration !== void 0) { + if (!Number.isFinite(newEaseOptions.duration)) { + throw new TypeError(`'easeOptions.duration' is not a finite number.`); + } + if (newEaseOptions.duration < 0) { + throw new Error(`'easeOptions.duration' is less than 0.`); + } + this.#easeOptions.duration = newEaseOptions.duration; + } + if (newEaseOptions.ease !== void 0) { + if (typeof newEaseOptions.ease !== "function" && typeof newEaseOptions.ease !== "string") { + throw new TypeError(`'easeOptions.ease' is not a function or string.`); + } + this.#easeOptions.ease = newEaseOptions.ease; + } + this.#updateSubscribers(); + }, + enumerable: true + }); + if (ease !== void 0) { + this.ease = ease; + } + if (easeOptions !== void 0) { + this.easeOptions = easeOptions; + } + } + /** + * @returns {number} Get ease duration + */ + get easeDuration() { + return this.#easeOptions.duration; + } + /** + * @returns {string|Function} Get easing function value. + */ + get easeValue() { + return this.#easeOptions.ease; + } + /** + * @param {number} duration - Set ease duration. + */ + set easeDuration(duration) { + if (!Number.isFinite(duration)) { + throw new TypeError(`'duration' is not a finite number.`); + } + if (duration < 0) { + throw new Error(`'duration' is less than 0.`); + } + this.#easeOptions.duration = duration; + this.#updateSubscribers(); + } + /** + * @param {string|Function} value - Get easing function value. + */ + set easeValue(value) { + if (typeof value !== "function" && typeof value !== "string") { + throw new TypeError(`'value' is not a function or string.`); + } + this.#easeOptions.ease = value; + this.#updateSubscribers(); + } + /** + * Resets all options data to default values. + */ + reset() { + this.#ease = false; + this.#easeOptions = { duration: 0.1, ease: cubicOut }; + this.#updateSubscribers(); + } + /** + * Resets easing options to default values. + */ + resetEase() { + this.#easeOptions = { duration: 0.1, ease: cubicOut }; + this.#updateSubscribers(); + } + /** + * + * @param {import('svelte/store').Subscriber} handler - Callback function that is invoked on + * update / changes. Receives the DraggableOptions object / instance. + * + * @returns {import('svelte/store').Unsubscriber} Unsubscribe function. + */ + subscribe(handler) { + this.#subscriptions.push(handler); + handler(this); + return () => { + const index = this.#subscriptions.findIndex((sub) => sub === handler); + if (index >= 0) { + this.#subscriptions.splice(index, 1); + } + }; + } + #updateSubscribers() { + const subscriptions = this.#subscriptions; + if (subscriptions.length > 0) { + for (let cntr = 0; cntr < subscriptions.length; cntr++) { + subscriptions[cntr](this); + } + } + } +} +draggable.options = (options) => new DraggableOptions(options); +function create_if_block$a(ctx) { + let span; + let t; + return { + c() { + span = element("span"); + t = text( + /*label*/ + ctx[3] + ); + attr(span, "class", "svelte-gas-166l8wd"); + toggle_class( + span, + "has-icon", + /*icon*/ + ctx[4] !== void 0 + ); + }, + m(target, anchor) { + insert(target, span, anchor); + append(span, t); + }, + p(ctx2, dirty) { + if (dirty & /*label*/ + 8) set_data( + t, + /*label*/ + ctx2[3] + ); + if (dirty & /*icon*/ + 16) { + toggle_class( + span, + "has-icon", + /*icon*/ + ctx2[4] !== void 0 + ); + } + }, + d(detaching) { + if (detaching) { + detach(span); + } + } + }; +} +function create_fragment$l(ctx) { + let a; + let html_tag; + let html_anchor; + let a_class_value; + let applyStyles_action; + let mounted; + let dispose; + let if_block = ( + /*label*/ + ctx[3] && create_if_block$a(ctx) + ); + return { + c() { + a = element("a"); + html_tag = new HtmlTag(false); + html_anchor = empty(); + if (if_block) if_block.c(); + html_tag.a = html_anchor; + attr(a, "class", a_class_value = "header-button " + /*button*/ + ctx[0].class + " svelte-gas-166l8wd"); + attr( + a, + "aria-label", + /*label*/ + ctx[3] + ); + attr(a, "tabindex", "0"); + attr(a, "role", "button"); + toggle_class( + a, + "keep-minimized", + /*keepMinimized*/ + ctx[2] + ); + }, + m(target, anchor) { + insert(target, a, anchor); + html_tag.m( + /*icon*/ + ctx[4], + a + ); + append(a, html_anchor); + if (if_block) if_block.m(a, null); + if (!mounted) { + dispose = [ + listen(a, "click", stop_propagation(prevent_default( + /*onClick*/ + ctx[5] + ))), + listen(a, "contextmenu", stop_propagation(prevent_default( + /*onContextMenu*/ + ctx[6] + ))), + listen( + a, + "keydown", + /*onKeydown*/ + ctx[7] + ), + listen( + a, + "keyup", + /*onKeyup*/ + ctx[8] + ), + action_destroyer(applyStyles_action = applyStyles.call( + null, + a, + /*styles*/ + ctx[1] + )) + ]; + mounted = true; + } + }, + p(ctx2, [dirty]) { + if (dirty & /*icon*/ + 16) html_tag.p( + /*icon*/ + ctx2[4] + ); + if ( + /*label*/ + ctx2[3] + ) { + if (if_block) { + if_block.p(ctx2, dirty); + } else { + if_block = create_if_block$a(ctx2); + if_block.c(); + if_block.m(a, null); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + if (dirty & /*button*/ + 1 && a_class_value !== (a_class_value = "header-button " + /*button*/ + ctx2[0].class + " svelte-gas-166l8wd")) { + attr(a, "class", a_class_value); + } + if (dirty & /*label*/ + 8) { + attr( + a, + "aria-label", + /*label*/ + ctx2[3] + ); + } + if (applyStyles_action && is_function(applyStyles_action.update) && dirty & /*styles*/ + 2) applyStyles_action.update.call( + null, + /*styles*/ + ctx2[1] + ); + if (dirty & /*button, keepMinimized*/ + 5) { + toggle_class( + a, + "keep-minimized", + /*keepMinimized*/ + ctx2[2] + ); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(a); + } + if (if_block) if_block.d(); + mounted = false; + run_all(dispose); + } + }; +} +const s_REGEX_HTML$1 = /^\s*<.*>$/; +function instance$l($$self, $$props, $$invalidate) { + let title2; + let icon; + let label; + let keepMinimized; + let keyCode; + let styles2; + let { button = void 0 } = $$props; + function onClick(event) { + const invoke = button?.onPress ?? button?.onclick; + if (typeof invoke === "function") { + invoke.call(button, event); + $$invalidate(0, button); + } + } + function onContextMenu(event) { + const invoke = button?.onContextMenu; + if (typeof invoke === "function") { + invoke.call(button, event); + $$invalidate(0, button); + } + } + function onKeydown(event) { + if (event.code === keyCode) { + event.preventDefault(); + event.stopPropagation(); + } + } + function onKeyup(event) { + if (event.code === keyCode) { + const invoke = button.onPress ?? button.onclick; + if (typeof invoke === "function") { + invoke.call(button, event); + $$invalidate(0, button); + } + event.preventDefault(); + event.stopPropagation(); + } + } + $$self.$$set = ($$props2) => { + if ("button" in $$props2) $$invalidate(0, button = $$props2.button); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*button*/ + 1) { + $$invalidate(9, title2 = isObject(button) && typeof button.title === "string" ? localize(button.title) : ""); + } + if ($$self.$$.dirty & /*button, title*/ + 513) { + $$invalidate(4, icon = isObject(button) && typeof button.icon !== "string" ? void 0 : s_REGEX_HTML$1.test(button.icon) ? button.icon : ``); + } + if ($$self.$$.dirty & /*button*/ + 1) { + $$invalidate(3, label = isObject(button) && typeof button.label === "string" ? localize(button.label) : void 0); + } + if ($$self.$$.dirty & /*button*/ + 1) { + $$invalidate(2, keepMinimized = isObject(button) && typeof button.keepMinimized === "boolean" ? button.keepMinimized : false); + } + if ($$self.$$.dirty & /*button*/ + 1) { + keyCode = isObject(button) && typeof button.keyCode === "string" ? button.keyCode : "Enter"; + } + if ($$self.$$.dirty & /*button*/ + 1) { + $$invalidate(1, styles2 = isObject(button) && isObject(button.styles) ? button.styles : void 0); + } + }; + return [ + button, + styles2, + keepMinimized, + label, + icon, + onClick, + onContextMenu, + onKeydown, + onKeyup, + title2 + ]; +} +class TJSHeaderButton extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$l, create_fragment$l, safe_not_equal, { button: 0 }); + } + get button() { + return this.$$.ctx[0]; + } + set button(button) { + this.$$set({ button }); + flush(); + } +} +function get_each_context$4(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[31] = list[i]; + return child_ctx; +} +function get_each_context_1$2(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[31] = list[i]; + return child_ctx; +} +function create_if_block$9(ctx) { + let img; + let img_src_value; + return { + c() { + img = element("img"); + attr(img, "class", "tjs-app-icon keep-minimized svelte-gas-1wviwl9"); + if (!src_url_equal(img.src, img_src_value = /*$storeHeaderIcon*/ + ctx[6])) attr(img, "src", img_src_value); + attr(img, "alt", "icon"); + }, + m(target, anchor) { + insert(target, img, anchor); + }, + p(ctx2, dirty) { + if (dirty[0] & /*$storeHeaderIcon*/ + 64 && !src_url_equal(img.src, img_src_value = /*$storeHeaderIcon*/ + ctx2[6])) { + attr(img, "src", img_src_value); + } + }, + d(detaching) { + if (detaching) { + detach(img); + } + } + }; +} +function create_each_block_1$2(ctx) { + let switch_instance; + let switch_instance_anchor; + let current; + const switch_instance_spread_levels = [ + /*button*/ + ctx[31].props + ]; + var switch_value = ( + /*button*/ + ctx[31].class + ); + function switch_props(ctx2, dirty) { + let switch_instance_props = {}; + for (let i = 0; i < switch_instance_spread_levels.length; i += 1) { + switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); + } + if (dirty !== void 0 && dirty[0] & /*buttonsLeft*/ + 2) { + switch_instance_props = assign(switch_instance_props, get_spread_update(switch_instance_spread_levels, [get_spread_object( + /*button*/ + ctx2[31].props + )])); + } + return { props: switch_instance_props }; + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); + } + return { + c() { + if (switch_instance) create_component(switch_instance.$$.fragment); + switch_instance_anchor = empty(); + }, + m(target, anchor) { + if (switch_instance) mount_component(switch_instance, target, anchor); + insert(target, switch_instance_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if (dirty[0] & /*buttonsLeft*/ + 2 && switch_value !== (switch_value = /*button*/ + ctx2[31].class)) { + if (switch_instance) { + group_outros(); + const old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, () => { + destroy_component(old_component, 1); + }); + check_outros(); + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx2, dirty)); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); + } else { + switch_instance = null; + } + } else if (switch_value) { + const switch_instance_changes = dirty[0] & /*buttonsLeft*/ + 2 ? get_spread_update(switch_instance_spread_levels, [get_spread_object( + /*button*/ + ctx2[31].props + )]) : {}; + switch_instance.$set(switch_instance_changes); + } + }, + i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(switch_instance_anchor); + } + if (switch_instance) destroy_component(switch_instance, detaching); + } + }; +} +function create_each_block$4(ctx) { + let switch_instance; + let switch_instance_anchor; + let current; + const switch_instance_spread_levels = [ + /*button*/ + ctx[31].props + ]; + var switch_value = ( + /*button*/ + ctx[31].class + ); + function switch_props(ctx2, dirty) { + let switch_instance_props = {}; + for (let i = 0; i < switch_instance_spread_levels.length; i += 1) { + switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); + } + if (dirty !== void 0 && dirty[0] & /*buttonsRight*/ + 4) { + switch_instance_props = assign(switch_instance_props, get_spread_update(switch_instance_spread_levels, [get_spread_object( + /*button*/ + ctx2[31].props + )])); + } + return { props: switch_instance_props }; + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); + } + return { + c() { + if (switch_instance) create_component(switch_instance.$$.fragment); + switch_instance_anchor = empty(); + }, + m(target, anchor) { + if (switch_instance) mount_component(switch_instance, target, anchor); + insert(target, switch_instance_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if (dirty[0] & /*buttonsRight*/ + 4 && switch_value !== (switch_value = /*button*/ + ctx2[31].class)) { + if (switch_instance) { + group_outros(); + const old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, () => { + destroy_component(old_component, 1); + }); + check_outros(); + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx2, dirty)); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); + } else { + switch_instance = null; + } + } else if (switch_value) { + const switch_instance_changes = dirty[0] & /*buttonsRight*/ + 4 ? get_spread_update(switch_instance_spread_levels, [get_spread_object( + /*button*/ + ctx2[31].props + )]) : {}; + switch_instance.$set(switch_instance_changes); + } + }, + i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(switch_instance_anchor); + } + if (switch_instance) destroy_component(switch_instance, detaching); + } + }; +} +function create_key_block(ctx) { + let header; + let t0; + let h4; + let t1_value = localize( + /*$storeTitle*/ + ctx[7] + ) + ""; + let t1; + let t2; + let t3; + let span; + let t4; + let draggable_action; + let minimizable_action; + let current; + let mounted; + let dispose; + let if_block = typeof /*$storeHeaderIcon*/ + ctx[6] === "string" && create_if_block$9(ctx); + let each_value_1 = ensure_array_like( + /*buttonsLeft*/ + ctx[1] + ); + let each_blocks_1 = []; + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks_1[i] = create_each_block_1$2(get_each_context_1$2(ctx, each_value_1, i)); + } + const out = (i) => transition_out(each_blocks_1[i], 1, 1, () => { + each_blocks_1[i] = null; + }); + let each_value = ensure_array_like( + /*buttonsRight*/ + ctx[2] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block$4(get_each_context$4(ctx, each_value, i)); + } + const out_1 = (i) => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + return { + c() { + header = element("header"); + if (if_block) if_block.c(); + t0 = space(); + h4 = element("h4"); + t1 = text(t1_value); + t2 = space(); + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].c(); + } + t3 = space(); + span = element("span"); + t4 = space(); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(h4, "class", "window-title svelte-gas-1wviwl9"); + set_style( + h4, + "display", + /*displayHeaderTitle*/ + ctx[4] + ); + attr(span, "class", "tjs-window-header-spacer keep-minimized svelte-gas-1wviwl9"); + attr(header, "class", "window-header flexrow svelte-gas-1wviwl9"); + }, + m(target, anchor) { + insert(target, header, anchor); + if (if_block) if_block.m(header, null); + append(header, t0); + append(header, h4); + append(h4, t1); + append(header, t2); + for (let i = 0; i < each_blocks_1.length; i += 1) { + if (each_blocks_1[i]) { + each_blocks_1[i].m(header, null); + } + } + append(header, t3); + append(header, span); + append(header, t4); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(header, null); + } + } + current = true; + if (!mounted) { + dispose = [ + action_destroyer(draggable_action = /*draggable*/ + ctx[0].call( + null, + header, + /*dragOptions*/ + ctx[3] + )), + action_destroyer(minimizable_action = /*minimizable*/ + ctx[18].call( + null, + header, + /*$storeMinimizable*/ + ctx[5] + )), + listen( + header, + "pointerdown", + /*onPointerdown*/ + ctx[19] + ) + ]; + mounted = true; + } + }, + p(ctx2, dirty) { + if (typeof /*$storeHeaderIcon*/ + ctx2[6] === "string") { + if (if_block) { + if_block.p(ctx2, dirty); + } else { + if_block = create_if_block$9(ctx2); + if_block.c(); + if_block.m(header, t0); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + if ((!current || dirty[0] & /*$storeTitle*/ + 128) && t1_value !== (t1_value = localize( + /*$storeTitle*/ + ctx2[7] + ) + "")) set_data(t1, t1_value); + if (dirty[0] & /*displayHeaderTitle*/ + 16) { + set_style( + h4, + "display", + /*displayHeaderTitle*/ + ctx2[4] + ); + } + if (dirty[0] & /*buttonsLeft*/ + 2) { + each_value_1 = ensure_array_like( + /*buttonsLeft*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1$2(ctx2, each_value_1, i); + if (each_blocks_1[i]) { + each_blocks_1[i].p(child_ctx, dirty); + transition_in(each_blocks_1[i], 1); + } else { + each_blocks_1[i] = create_each_block_1$2(child_ctx); + each_blocks_1[i].c(); + transition_in(each_blocks_1[i], 1); + each_blocks_1[i].m(header, t3); + } + } + group_outros(); + for (i = each_value_1.length; i < each_blocks_1.length; i += 1) { + out(i); + } + check_outros(); + } + if (dirty[0] & /*buttonsRight*/ + 4) { + each_value = ensure_array_like( + /*buttonsRight*/ + ctx2[2] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context$4(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block$4(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(header, null); + } + } + group_outros(); + for (i = each_value.length; i < each_blocks.length; i += 1) { + out_1(i); + } + check_outros(); + } + if (draggable_action && is_function(draggable_action.update) && dirty[0] & /*dragOptions*/ + 8) draggable_action.update.call( + null, + /*dragOptions*/ + ctx2[3] + ); + if (minimizable_action && is_function(minimizable_action.update) && dirty[0] & /*$storeMinimizable*/ + 32) minimizable_action.update.call( + null, + /*$storeMinimizable*/ + ctx2[5] + ); + }, + i(local) { + if (current) return; + for (let i = 0; i < each_value_1.length; i += 1) { + transition_in(each_blocks_1[i]); + } + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + current = true; + }, + o(local) { + each_blocks_1 = each_blocks_1.filter(Boolean); + for (let i = 0; i < each_blocks_1.length; i += 1) { + transition_out(each_blocks_1[i]); + } + each_blocks = each_blocks.filter(Boolean); + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + current = false; + }, + d(detaching) { + if (detaching) { + detach(header); + } + if (if_block) if_block.d(); + destroy_each(each_blocks_1, detaching); + destroy_each(each_blocks, detaching); + mounted = false; + run_all(dispose); + } + }; +} +function create_fragment$k(ctx) { + let previous_key = ( + /*draggable*/ + ctx[0] + ); + let key_block_anchor; + let current; + let key_block = create_key_block(ctx); + return { + c() { + key_block.c(); + key_block_anchor = empty(); + }, + m(target, anchor) { + key_block.m(target, anchor); + insert(target, key_block_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if (dirty[0] & /*draggable*/ + 1 && safe_not_equal(previous_key, previous_key = /*draggable*/ + ctx2[0])) { + group_outros(); + transition_out(key_block, 1, 1, noop); + check_outros(); + key_block = create_key_block(ctx2); + key_block.c(); + transition_in(key_block, 1); + key_block.m(key_block_anchor.parentNode, key_block_anchor); + } else { + key_block.p(ctx2, dirty); + } + }, + i(local) { + if (current) return; + transition_in(key_block); + current = true; + }, + o(local) { + transition_out(key_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(key_block_anchor); + } + key_block.d(detaching); + } + }; +} +function instance$k($$self, $$props, $$invalidate) { + let $focusKeep; + let $focusAuto; + let $elementRoot; + let $storeHeaderButtons; + let $storeMinimized; + let $storeHeaderNoTitleMinimized; + let $storeDraggable; + let $storeMinimizable; + let $storeHeaderIcon; + let $storeTitle; + let { draggable: draggable$1 = void 0 } = $$props; + let { draggableOptions = void 0 } = $$props; + const { application } = getContext("#external"); + const { focusAuto, focusKeep } = application.reactive.storeAppOptions; + component_subscribe($$self, focusAuto, (value) => $$invalidate(26, $focusAuto = value)); + component_subscribe($$self, focusKeep, (value) => $$invalidate(25, $focusKeep = value)); + const { elementRoot } = getContext("#internal").stores; + component_subscribe($$self, elementRoot, (value) => $$invalidate(27, $elementRoot = value)); + const storeTitle = application.reactive.storeAppOptions.title; + component_subscribe($$self, storeTitle, (value) => $$invalidate(7, $storeTitle = value)); + const storeDraggable = application.reactive.storeAppOptions.draggable; + component_subscribe($$self, storeDraggable, (value) => $$invalidate(24, $storeDraggable = value)); + const storeDragging = application.reactive.storeUIState.dragging; + const storeHeaderButtons = application.reactive.storeUIState.headerButtons; + component_subscribe($$self, storeHeaderButtons, (value) => $$invalidate(21, $storeHeaderButtons = value)); + const storeHeaderIcon = application.reactive.storeAppOptions.headerIcon; + component_subscribe($$self, storeHeaderIcon, (value) => $$invalidate(6, $storeHeaderIcon = value)); + const storeHeaderNoTitleMinimized = application.reactive.storeAppOptions.headerNoTitleMinimized; + component_subscribe($$self, storeHeaderNoTitleMinimized, (value) => $$invalidate(23, $storeHeaderNoTitleMinimized = value)); + const storeMinimizable = application.reactive.storeAppOptions.minimizable; + component_subscribe($$self, storeMinimizable, (value) => $$invalidate(5, $storeMinimizable = value)); + const storeMinimized = application.reactive.storeUIState.minimized; + component_subscribe($$self, storeMinimized, (value) => $$invalidate(22, $storeMinimized = value)); + const s_DRAG_TARGET_CLASSLIST = Object.freeze(["tjs-app-icon", "tjs-window-header-spacer", "window-header", "window-title"]); + let dragOptions; + let displayHeaderTitle; + let buttonsLeft; + let buttonsRight; + function minimizable(node, booleanStore) { + const callback = (event) => { + if (event.target.classList.contains("window-title") || event.target.classList.contains("window-header") || event.target.classList.contains("keep-minimized")) { + application._onToggleMinimize(event); + } + }; + function activateListeners() { + node.addEventListener("dblclick", callback); + } + function removeListeners() { + node.removeEventListener("dblclick", callback); + } + if (booleanStore) { + activateListeners(); + } + return { + update: (booleanStore2) => { + if (booleanStore2) { + activateListeners(); + } else { + removeListeners(); + } + }, + destroy: () => removeListeners() + }; + } + function onPointerdown(event) { + const rootEl = $elementRoot; + if ($focusAuto && rootEl instanceof HTMLElement && rootEl?.isConnected) { + if ($focusKeep) { + const focusOutside = document.activeElement instanceof HTMLElement && !rootEl.contains(document.activeElement); + if (focusOutside) { + rootEl.focus(); + } else { + event.preventDefault(); + } + } else { + rootEl.focus(); + } + } + } + $$self.$$set = ($$props2) => { + if ("draggable" in $$props2) $$invalidate(0, draggable$1 = $$props2.draggable); + if ("draggableOptions" in $$props2) $$invalidate(20, draggableOptions = $$props2.draggableOptions); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty[0] & /*draggable*/ + 1) { + $$invalidate(0, draggable$1 = typeof draggable$1 === "function" ? draggable$1 : draggable); + } + if ($$self.$$.dirty[0] & /*draggableOptions, $storeDraggable*/ + 17825792) { + $$invalidate(3, dragOptions = Object.assign( + {}, + { + ease: true, + easeOptions: { duration: 0.06, ease: cubicOut } + }, + isObject(draggableOptions) ? draggableOptions : {}, + { + position: application.position, + active: $storeDraggable, + storeDragging, + hasTargetClassList: s_DRAG_TARGET_CLASSLIST + } + )); + } + if ($$self.$$.dirty[0] & /*$storeHeaderNoTitleMinimized, $storeMinimized*/ + 12582912) { + $$invalidate(4, displayHeaderTitle = $storeHeaderNoTitleMinimized && $storeMinimized ? "none" : null); + } + if ($$self.$$.dirty[0] & /*$storeHeaderButtons, buttonsLeft, buttonsRight*/ + 2097158) { + { + $$invalidate(1, buttonsLeft = []); + $$invalidate(2, buttonsRight = []); + for (const button of $storeHeaderButtons) { + const buttonsList = typeof button?.alignLeft === "boolean" && button?.alignLeft ? buttonsLeft : buttonsRight; + buttonsList.push(isSvelteComponent(button) ? { class: button, props: {} } : { + class: TJSHeaderButton, + props: { button } + }); + } + } + } + }; + return [ + draggable$1, + buttonsLeft, + buttonsRight, + dragOptions, + displayHeaderTitle, + $storeMinimizable, + $storeHeaderIcon, + $storeTitle, + focusAuto, + focusKeep, + elementRoot, + storeTitle, + storeDraggable, + storeHeaderButtons, + storeHeaderIcon, + storeHeaderNoTitleMinimized, + storeMinimizable, + storeMinimized, + minimizable, + onPointerdown, + draggableOptions, + $storeHeaderButtons, + $storeMinimized, + $storeHeaderNoTitleMinimized, + $storeDraggable + ]; +} +class TJSApplicationHeader extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$k, create_fragment$k, safe_not_equal, { draggable: 0, draggableOptions: 20 }, null, [-1, -1]); + } +} +function create_fragment$j(ctx) { + let div; + let mounted; + let dispose; + return { + c() { + div = element("div"); + attr(div, "class", "tjs-focus-wrap svelte-gas-kjcljd"); + attr(div, "tabindex", "0"); + }, + m(target, anchor) { + insert(target, div, anchor); + ctx[4](div); + if (!mounted) { + dispose = listen( + div, + "focus", + /*onFocus*/ + ctx[1] + ); + mounted = true; + } + }, + p: noop, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div); + } + ctx[4](null); + mounted = false; + dispose(); + } + }; +} +function instance$j($$self, $$props, $$invalidate) { + let { elementRoot = void 0 } = $$props; + let { enabled = true } = $$props; + let ignoreElements, wrapEl; + function onFocus() { + if (!enabled) { + return; + } + if (elementRoot instanceof HTMLElement) { + const firstFocusEl = A11yHelper.getFirstFocusableElement(elementRoot, ignoreElements); + if (firstFocusEl instanceof HTMLElement && firstFocusEl !== wrapEl) { + firstFocusEl.focus(); + } else { + elementRoot.focus(); + } + } + } + function div_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + wrapEl = $$value; + $$invalidate(0, wrapEl); + }); + } + $$self.$$set = ($$props2) => { + if ("elementRoot" in $$props2) $$invalidate(2, elementRoot = $$props2.elementRoot); + if ("enabled" in $$props2) $$invalidate(3, enabled = $$props2.enabled); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*wrapEl*/ + 1) { + if (wrapEl) { + ignoreElements = /* @__PURE__ */ new Set([wrapEl]); + } + } + }; + return [wrapEl, onFocus, elementRoot, enabled, div_binding]; +} +class TJSFocusWrap extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$j, create_fragment$j, safe_not_equal, { elementRoot: 2, enabled: 3 }); + } +} +function create_fragment$i(ctx) { + let div; + let resizable_action; + let mounted; + let dispose; + return { + c() { + div = element("div"); + div.innerHTML = ``; + attr(div, "class", "window-resizable-handle svelte-gas-14lnpz8"); + }, + m(target, anchor) { + insert(target, div, anchor); + ctx[10](div); + if (!mounted) { + dispose = action_destroyer(resizable_action = /*resizable*/ + ctx[6].call(null, div, { + active: ( + /*$storeResizable*/ + ctx[1] + ), + storeResizing: ( + /*storeResizing*/ + ctx[5] + ) + })); + mounted = true; + } + }, + p(ctx2, [dirty]) { + if (resizable_action && is_function(resizable_action.update) && dirty & /*$storeResizable*/ + 2) resizable_action.update.call(null, { + active: ( + /*$storeResizable*/ + ctx2[1] + ), + storeResizing: ( + /*storeResizing*/ + ctx2[5] + ) + }); + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div); + } + ctx[10](null); + mounted = false; + dispose(); + } + }; +} +function instance$i($$self, $$props, $$invalidate) { + let $storeElementRoot; + let $storeMinimized; + let $storeResizable; + let { isResizable = false } = $$props; + const application = getContext("#external").application; + const storeElementRoot = getContext("#internal").stores.elementRoot; + component_subscribe($$self, storeElementRoot, (value) => $$invalidate(8, $storeElementRoot = value)); + const storeResizable = application.reactive.storeAppOptions.resizable; + component_subscribe($$self, storeResizable, (value) => $$invalidate(1, $storeResizable = value)); + const storeMinimized = application.reactive.storeUIState.minimized; + component_subscribe($$self, storeMinimized, (value) => $$invalidate(9, $storeMinimized = value)); + const storeResizing = application.reactive.storeUIState.resizing; + let elementResize; + function resizable(node, { active: active2 = true, storeResizing: storeResizing2 = void 0 } = {}) { + let position = null; + let initialPosition = {}; + let resizing = false; + const handlers = { + resizeDown: ["pointerdown", (e) => onResizePointerDown(e), false], + resizeMove: ["pointermove", (e) => onResizePointerMove(e), false], + resizeUp: ["pointerup", (e) => onResizePointerUp(e), false] + }; + function activateListeners() { + node.addEventListener(...handlers.resizeDown); + $$invalidate(7, isResizable = true); + node.style.display = "block"; + } + function removeListeners() { + if (typeof storeResizing2?.set === "function") { + storeResizing2.set(false); + } + node.removeEventListener(...handlers.resizeDown); + node.removeEventListener(...handlers.resizeMove); + node.removeEventListener(...handlers.resizeUp); + node.style.display = "none"; + $$invalidate(7, isResizable = false); + } + if (active2) { + activateListeners(); + } else { + node.style.display = "none"; + } + function onResizePointerDown(event) { + event.preventDefault(); + resizing = false; + position = application.position.get(); + if (position.height === "auto") { + position.height = $storeElementRoot.clientHeight; + } + if (position.width === "auto") { + position.width = $storeElementRoot.clientWidth; + } + initialPosition = { x: event.clientX, y: event.clientY }; + node.addEventListener(...handlers.resizeMove); + node.addEventListener(...handlers.resizeUp); + node.setPointerCapture(event.pointerId); + } + function onResizePointerMove(event) { + event.preventDefault(); + if (!resizing && typeof storeResizing2?.set === "function") { + resizing = true; + storeResizing2.set(true); + } + application.position.set({ + width: position.width + (event.clientX - initialPosition.x), + height: position.height + (event.clientY - initialPosition.y) + }); + } + function onResizePointerUp(event) { + resizing = false; + if (typeof storeResizing2?.set === "function") { + storeResizing2.set(false); + } + event.preventDefault(); + node.removeEventListener(...handlers.resizeMove); + node.removeEventListener(...handlers.resizeUp); + application?._onResize?.(event); + } + return { + update: ({ active: active3 }) => { + if (active3) { + activateListeners(); + } else { + removeListeners(); + } + }, + destroy: () => removeListeners() + }; + } + function div_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + elementResize = $$value; + $$invalidate(0, elementResize), $$invalidate(7, isResizable), $$invalidate(9, $storeMinimized), $$invalidate(8, $storeElementRoot); + }); + } + $$self.$$set = ($$props2) => { + if ("isResizable" in $$props2) $$invalidate(7, isResizable = $$props2.isResizable); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*elementResize, isResizable, $storeMinimized, $storeElementRoot*/ + 897) { + if (elementResize) { + $$invalidate(0, elementResize.style.display = isResizable && !$storeMinimized ? "block" : "none", elementResize); + const elementRoot = $storeElementRoot; + if (elementRoot) { + elementRoot.classList[isResizable ? "add" : "remove"]("resizable"); + } + } + } + }; + return [ + elementResize, + $storeResizable, + storeElementRoot, + storeResizable, + storeMinimized, + storeResizing, + resizable, + isResizable, + $storeElementRoot, + $storeMinimized, + div_binding + ]; +} +class ResizableHandle extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$i, create_fragment$i, safe_not_equal, { isResizable: 7 }); + } +} +function create_else_block$5(ctx) { + let div; + let tjsapplicationheader; + let t0; + let section; + let applyStyles_action; + let t1; + let resizablehandle; + let t2; + let tjsfocuswrap; + let div_id_value; + let div_class_value; + let div_data_appid_value; + let applyStyles_action_1; + let current; + let mounted; + let dispose; + tjsapplicationheader = new TJSApplicationHeader({ + props: { + draggable: ( + /*draggable*/ + ctx[6] + ), + draggableOptions: ( + /*draggableOptions*/ + ctx[7] + ) + } + }); + const default_slot_template = ( + /*#slots*/ + ctx[36].default + ); + const default_slot = create_slot( + default_slot_template, + ctx, + /*$$scope*/ + ctx[35], + null + ); + resizablehandle = new ResizableHandle({}); + tjsfocuswrap = new TJSFocusWrap({ + props: { + elementRoot: ( + /*elementRoot*/ + ctx[1] + ), + enabled: ( + /*focusWrapEnabled*/ + ctx[11] + ) + } + }); + return { + c() { + div = element("div"); + create_component(tjsapplicationheader.$$.fragment); + t0 = space(); + section = element("section"); + if (default_slot) default_slot.c(); + t1 = space(); + create_component(resizablehandle.$$.fragment); + t2 = space(); + create_component(tjsfocuswrap.$$.fragment); + attr(section, "class", "window-content svelte-gas-oz81f7"); + attr(section, "tabindex", "-1"); + attr(div, "id", div_id_value = /*application*/ + ctx[10].id); + attr(div, "class", div_class_value = "app window-app " + /*application*/ + ctx[10].options.classes.join(" ") + " svelte-gas-oz81f7"); + attr(div, "data-appid", div_data_appid_value = /*application*/ + ctx[10].appId); + attr(div, "role", "application"); + attr(div, "tabindex", "-1"); + }, + m(target, anchor) { + insert(target, div, anchor); + mount_component(tjsapplicationheader, div, null); + append(div, t0); + append(div, section); + if (default_slot) { + default_slot.m(section, null); + } + ctx[39](section); + append(div, t1); + mount_component(resizablehandle, div, null); + append(div, t2); + mount_component(tjsfocuswrap, div, null); + ctx[40](div); + current = true; + if (!mounted) { + dispose = [ + listen( + section, + "pointerdown", + /*onPointerdownContent*/ + ctx[21] + ), + action_destroyer(applyStyles_action = applyStyles.call( + null, + section, + /*stylesContent*/ + ctx[9] + )), + action_destroyer( + /*contentResizeObserver*/ + ctx[13].call( + null, + section, + /*resizeObservedContent*/ + ctx[22] + ) + ), + listen(div, "close:popup", stop_propagation(prevent_default( + /*onClosePopup*/ + ctx[18] + ))), + listen( + div, + "keydown", + /*onKeydown*/ + ctx[19], + true + ), + listen( + div, + "pointerdown", + /*onPointerdownApp*/ + ctx[20] + ), + action_destroyer(applyStyles_action_1 = applyStyles.call( + null, + div, + /*stylesApp*/ + ctx[8] + )), + action_destroyer( + /*appResizeObserver*/ + ctx[12].call( + null, + div, + /*resizeObservedApp*/ + ctx[23] + ) + ) + ]; + mounted = true; + } + }, + p(ctx2, dirty) { + const tjsapplicationheader_changes = {}; + if (dirty[0] & /*draggable*/ + 64) tjsapplicationheader_changes.draggable = /*draggable*/ + ctx2[6]; + if (dirty[0] & /*draggableOptions*/ + 128) tjsapplicationheader_changes.draggableOptions = /*draggableOptions*/ + ctx2[7]; + tjsapplicationheader.$set(tjsapplicationheader_changes); + if (default_slot) { + if (default_slot.p && (!current || dirty[1] & /*$$scope*/ + 16)) { + update_slot_base( + default_slot, + default_slot_template, + ctx2, + /*$$scope*/ + ctx2[35], + !current ? get_all_dirty_from_scope( + /*$$scope*/ + ctx2[35] + ) : get_slot_changes( + default_slot_template, + /*$$scope*/ + ctx2[35], + dirty, + null + ), + null + ); + } + } + if (applyStyles_action && is_function(applyStyles_action.update) && dirty[0] & /*stylesContent*/ + 512) applyStyles_action.update.call( + null, + /*stylesContent*/ + ctx2[9] + ); + const tjsfocuswrap_changes = {}; + if (dirty[0] & /*elementRoot*/ + 2) tjsfocuswrap_changes.elementRoot = /*elementRoot*/ + ctx2[1]; + if (dirty[0] & /*focusWrapEnabled*/ + 2048) tjsfocuswrap_changes.enabled = /*focusWrapEnabled*/ + ctx2[11]; + tjsfocuswrap.$set(tjsfocuswrap_changes); + if (!current || dirty[0] & /*application*/ + 1024 && div_id_value !== (div_id_value = /*application*/ + ctx2[10].id)) { + attr(div, "id", div_id_value); + } + if (!current || dirty[0] & /*application*/ + 1024 && div_class_value !== (div_class_value = "app window-app " + /*application*/ + ctx2[10].options.classes.join(" ") + " svelte-gas-oz81f7")) { + attr(div, "class", div_class_value); + } + if (!current || dirty[0] & /*application*/ + 1024 && div_data_appid_value !== (div_data_appid_value = /*application*/ + ctx2[10].appId)) { + attr(div, "data-appid", div_data_appid_value); + } + if (applyStyles_action_1 && is_function(applyStyles_action_1.update) && dirty[0] & /*stylesApp*/ + 256) applyStyles_action_1.update.call( + null, + /*stylesApp*/ + ctx2[8] + ); + }, + i(local) { + if (current) return; + transition_in(tjsapplicationheader.$$.fragment, local); + transition_in(default_slot, local); + transition_in(resizablehandle.$$.fragment, local); + transition_in(tjsfocuswrap.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(tjsapplicationheader.$$.fragment, local); + transition_out(default_slot, local); + transition_out(resizablehandle.$$.fragment, local); + transition_out(tjsfocuswrap.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_component(tjsapplicationheader); + if (default_slot) default_slot.d(detaching); + ctx[39](null); + destroy_component(resizablehandle); + destroy_component(tjsfocuswrap); + ctx[40](null); + mounted = false; + run_all(dispose); + } + }; +} +function create_if_block$8(ctx) { + let div; + let tjsapplicationheader; + let t0; + let section; + let applyStyles_action; + let t1; + let resizablehandle; + let t2; + let tjsfocuswrap; + let div_id_value; + let div_class_value; + let div_data_appid_value; + let applyStyles_action_1; + let div_intro; + let div_outro; + let current; + let mounted; + let dispose; + tjsapplicationheader = new TJSApplicationHeader({ + props: { + draggable: ( + /*draggable*/ + ctx[6] + ), + draggableOptions: ( + /*draggableOptions*/ + ctx[7] + ) + } + }); + const default_slot_template = ( + /*#slots*/ + ctx[36].default + ); + const default_slot = create_slot( + default_slot_template, + ctx, + /*$$scope*/ + ctx[35], + null + ); + resizablehandle = new ResizableHandle({}); + tjsfocuswrap = new TJSFocusWrap({ + props: { elementRoot: ( + /*elementRoot*/ + ctx[1] + ) } + }); + return { + c() { + div = element("div"); + create_component(tjsapplicationheader.$$.fragment); + t0 = space(); + section = element("section"); + if (default_slot) default_slot.c(); + t1 = space(); + create_component(resizablehandle.$$.fragment); + t2 = space(); + create_component(tjsfocuswrap.$$.fragment); + attr(section, "class", "window-content svelte-gas-oz81f7"); + attr(section, "tabindex", "-1"); + attr(div, "id", div_id_value = /*application*/ + ctx[10].id); + attr(div, "class", div_class_value = "app window-app " + /*application*/ + ctx[10].options.classes.join(" ") + " svelte-gas-oz81f7"); + attr(div, "data-appid", div_data_appid_value = /*application*/ + ctx[10].appId); + attr(div, "role", "application"); + attr(div, "tabindex", "-1"); + }, + m(target, anchor) { + insert(target, div, anchor); + mount_component(tjsapplicationheader, div, null); + append(div, t0); + append(div, section); + if (default_slot) { + default_slot.m(section, null); + } + ctx[37](section); + append(div, t1); + mount_component(resizablehandle, div, null); + append(div, t2); + mount_component(tjsfocuswrap, div, null); + ctx[38](div); + current = true; + if (!mounted) { + dispose = [ + listen( + section, + "pointerdown", + /*onPointerdownContent*/ + ctx[21] + ), + action_destroyer(applyStyles_action = applyStyles.call( + null, + section, + /*stylesContent*/ + ctx[9] + )), + action_destroyer( + /*contentResizeObserver*/ + ctx[13].call( + null, + section, + /*resizeObservedContent*/ + ctx[22] + ) + ), + listen(div, "close:popup", stop_propagation(prevent_default( + /*onClosePopup*/ + ctx[18] + ))), + listen( + div, + "keydown", + /*onKeydown*/ + ctx[19], + true + ), + listen( + div, + "pointerdown", + /*onPointerdownApp*/ + ctx[20] + ), + action_destroyer(applyStyles_action_1 = applyStyles.call( + null, + div, + /*stylesApp*/ + ctx[8] + )), + action_destroyer( + /*appResizeObserver*/ + ctx[12].call( + null, + div, + /*resizeObservedApp*/ + ctx[23] + ) + ) + ]; + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + const tjsapplicationheader_changes = {}; + if (dirty[0] & /*draggable*/ + 64) tjsapplicationheader_changes.draggable = /*draggable*/ + ctx[6]; + if (dirty[0] & /*draggableOptions*/ + 128) tjsapplicationheader_changes.draggableOptions = /*draggableOptions*/ + ctx[7]; + tjsapplicationheader.$set(tjsapplicationheader_changes); + if (default_slot) { + if (default_slot.p && (!current || dirty[1] & /*$$scope*/ + 16)) { + update_slot_base( + default_slot, + default_slot_template, + ctx, + /*$$scope*/ + ctx[35], + !current ? get_all_dirty_from_scope( + /*$$scope*/ + ctx[35] + ) : get_slot_changes( + default_slot_template, + /*$$scope*/ + ctx[35], + dirty, + null + ), + null + ); + } + } + if (applyStyles_action && is_function(applyStyles_action.update) && dirty[0] & /*stylesContent*/ + 512) applyStyles_action.update.call( + null, + /*stylesContent*/ + ctx[9] + ); + const tjsfocuswrap_changes = {}; + if (dirty[0] & /*elementRoot*/ + 2) tjsfocuswrap_changes.elementRoot = /*elementRoot*/ + ctx[1]; + tjsfocuswrap.$set(tjsfocuswrap_changes); + if (!current || dirty[0] & /*application*/ + 1024 && div_id_value !== (div_id_value = /*application*/ + ctx[10].id)) { + attr(div, "id", div_id_value); + } + if (!current || dirty[0] & /*application*/ + 1024 && div_class_value !== (div_class_value = "app window-app " + /*application*/ + ctx[10].options.classes.join(" ") + " svelte-gas-oz81f7")) { + attr(div, "class", div_class_value); + } + if (!current || dirty[0] & /*application*/ + 1024 && div_data_appid_value !== (div_data_appid_value = /*application*/ + ctx[10].appId)) { + attr(div, "data-appid", div_data_appid_value); + } + if (applyStyles_action_1 && is_function(applyStyles_action_1.update) && dirty[0] & /*stylesApp*/ + 256) applyStyles_action_1.update.call( + null, + /*stylesApp*/ + ctx[8] + ); + }, + i(local) { + if (current) return; + transition_in(tjsapplicationheader.$$.fragment, local); + transition_in(default_slot, local); + transition_in(resizablehandle.$$.fragment, local); + transition_in(tjsfocuswrap.$$.fragment, local); + add_render_callback(() => { + if (!current) return; + if (div_outro) div_outro.end(1); + div_intro = create_in_transition( + div, + /*inTransition*/ + ctx[2], + /*inTransitionOptions*/ + ctx[4] + ); + div_intro.start(); + }); + current = true; + }, + o(local) { + transition_out(tjsapplicationheader.$$.fragment, local); + transition_out(default_slot, local); + transition_out(resizablehandle.$$.fragment, local); + transition_out(tjsfocuswrap.$$.fragment, local); + if (div_intro) div_intro.invalidate(); + div_outro = create_out_transition( + div, + /*outTransition*/ + ctx[3], + /*outTransitionOptions*/ + ctx[5] + ); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_component(tjsapplicationheader); + if (default_slot) default_slot.d(detaching); + ctx[37](null); + destroy_component(resizablehandle); + destroy_component(tjsfocuswrap); + ctx[38](null); + if (detaching && div_outro) div_outro.end(); + mounted = false; + run_all(dispose); + } + }; +} +function create_fragment$h(ctx) { + let current_block_type_index; + let if_block; + let if_block_anchor; + let current; + const if_block_creators = [create_if_block$8, create_else_block$5]; + const if_blocks = []; + function select_block_type(ctx2, dirty) { + if ( + /*inTransition*/ + ctx2[2] !== TJSDefaultTransition.default || /*outTransition*/ + ctx2[3] !== TJSDefaultTransition.default + ) return 0; + return 1; + } + current_block_type_index = select_block_type(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + return { + c() { + if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if_blocks[current_block_type_index].m(target, anchor); + insert(target, if_block_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx2); + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } else { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + if_block = if_blocks[current_block_type_index]; + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block.c(); + } else { + if_block.p(ctx2, dirty); + } + transition_in(if_block, 1); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if_blocks[current_block_type_index].d(detaching); + } + }; +} +function instance$h($$self, $$props, $$invalidate) { + let $focusKeep; + let $focusAuto; + let $minimized; + let $focusTrap; + let { $$slots: slots = {}, $$scope } = $$props; + let { elementContent = void 0 } = $$props; + let { elementRoot = void 0 } = $$props; + let { draggable: draggable2 = void 0 } = $$props; + let { draggableOptions = void 0 } = $$props; + let { stylesApp = void 0 } = $$props; + let { stylesContent = void 0 } = $$props; + let { appOffsetHeight = false } = $$props; + let { appOffsetWidth = false } = $$props; + const appResizeObserver = !!appOffsetHeight || !!appOffsetWidth ? resizeObserver : () => null; + let { contentOffsetHeight = false } = $$props; + let { contentOffsetWidth = false } = $$props; + const contentResizeObserver = !!contentOffsetHeight || !!contentOffsetWidth ? resizeObserver : () => null; + const internal = new AppShellContextInternal(); + const s_IGNORE_CLASSES = { ignoreClasses: ["tjs-focus-wrap"] }; + setContext("#internal", internal); + const { application } = getContext("#external"); + const { focusAuto, focusKeep, focusTrap } = application.reactive.storeAppOptions; + component_subscribe($$self, focusAuto, (value) => $$invalidate(32, $focusAuto = value)); + component_subscribe($$self, focusKeep, (value) => $$invalidate(41, $focusKeep = value)); + component_subscribe($$self, focusTrap, (value) => $$invalidate(34, $focusTrap = value)); + const { minimized } = application.reactive.storeUIState; + component_subscribe($$self, minimized, (value) => $$invalidate(33, $minimized = value)); + let focusWrapEnabled; + let { transition = TJSDefaultTransition.default } = $$props; + let { inTransition = TJSDefaultTransition.default } = $$props; + let { outTransition = TJSDefaultTransition.default } = $$props; + let { transitionOptions = void 0 } = $$props; + let { inTransitionOptions = TJSDefaultTransition.options } = $$props; + let { outTransitionOptions = TJSDefaultTransition.options } = $$props; + let oldTransition = TJSDefaultTransition.default; + let oldTransitionOptions = void 0; + onMount(() => elementRoot.focus()); + function onClosePopup(event) { + if (!$focusAuto) { + return; + } + const targetEl = event?.detail?.target; + if (!(targetEl instanceof HTMLElement)) { + return; + } + if (A11yHelper.isFocusable(targetEl)) { + return; + } + const elementRootContains = elementRoot.contains(targetEl); + if (targetEl === elementRoot) { + elementRoot.focus(); + } else if (targetEl === elementContent) { + elementContent.focus(); + } else if (elementRootContains) { + if (elementContent.contains(targetEl)) { + elementContent.focus(); + } else { + elementRoot.focus(); + } + } + } + function onKeydown(event) { + if ((event.target === elementRoot || event.target === elementContent) && KeyboardManager && KeyboardManager?._getMatchingActions?.(KeyboardManager?.getKeyboardEventContext?.(event))?.length) { + event.target?.blur(); + return; + } + if (focusWrapEnabled && event.shiftKey && event.code === "Tab") { + const allFocusable = A11yHelper.getFocusableElements(elementRoot, s_IGNORE_CLASSES); + const firstFocusEl = allFocusable.length > 0 ? allFocusable[0] : void 0; + const lastFocusEl = allFocusable.length > 0 ? allFocusable[allFocusable.length - 1] : void 0; + if (elementRoot === document.activeElement || firstFocusEl === document.activeElement) { + if (lastFocusEl instanceof HTMLElement && firstFocusEl !== lastFocusEl) { + lastFocusEl.focus(); + } + event.preventDefault(); + event.stopPropagation(); + } + } + if (typeof application?.options?.popOut === "boolean" && application.options.popOut && application !== globalThis.ui?.activeWindow) { + application.bringToTop.call(application); + } + } + function onPointerdownApp() { + if (typeof application?.options?.popOut === "boolean" && application.options.popOut && application !== globalThis.ui?.activeWindow) { + application.bringToTop.call(application); + } + } + function onPointerdownContent(event) { + const focusable = A11yHelper.isFocusable(event.target); + if (!focusable && $focusAuto) { + if ($focusKeep) { + const focusOutside = document.activeElement instanceof HTMLElement && !elementRoot.contains(document.activeElement); + if (focusOutside) { + elementContent.focus(); + } else { + event.preventDefault(); + } + } else { + elementContent.focus(); + } + } + } + function resizeObservedContent(offsetWidth, offsetHeight) { + $$invalidate(27, contentOffsetWidth = offsetWidth); + $$invalidate(26, contentOffsetHeight = offsetHeight); + } + function resizeObservedApp(offsetWidth, offsetHeight, contentWidth, contentHeight) { + application.position.stores.resizeObserved.update((object) => { + object.contentWidth = contentWidth; + object.contentHeight = contentHeight; + object.offsetWidth = offsetWidth; + object.offsetHeight = offsetHeight; + return object; + }); + $$invalidate(24, appOffsetHeight = offsetHeight); + $$invalidate(25, appOffsetWidth = offsetWidth); + } + function section_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + elementContent = $$value; + $$invalidate(0, elementContent); + }); + } + function div_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + elementRoot = $$value; + $$invalidate(1, elementRoot); + }); + } + function section_binding_1($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + elementContent = $$value; + $$invalidate(0, elementContent); + }); + } + function div_binding_1($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + elementRoot = $$value; + $$invalidate(1, elementRoot); + }); + } + $$self.$$set = ($$props2) => { + if ("elementContent" in $$props2) $$invalidate(0, elementContent = $$props2.elementContent); + if ("elementRoot" in $$props2) $$invalidate(1, elementRoot = $$props2.elementRoot); + if ("draggable" in $$props2) $$invalidate(6, draggable2 = $$props2.draggable); + if ("draggableOptions" in $$props2) $$invalidate(7, draggableOptions = $$props2.draggableOptions); + if ("stylesApp" in $$props2) $$invalidate(8, stylesApp = $$props2.stylesApp); + if ("stylesContent" in $$props2) $$invalidate(9, stylesContent = $$props2.stylesContent); + if ("appOffsetHeight" in $$props2) $$invalidate(24, appOffsetHeight = $$props2.appOffsetHeight); + if ("appOffsetWidth" in $$props2) $$invalidate(25, appOffsetWidth = $$props2.appOffsetWidth); + if ("contentOffsetHeight" in $$props2) $$invalidate(26, contentOffsetHeight = $$props2.contentOffsetHeight); + if ("contentOffsetWidth" in $$props2) $$invalidate(27, contentOffsetWidth = $$props2.contentOffsetWidth); + if ("transition" in $$props2) $$invalidate(28, transition = $$props2.transition); + if ("inTransition" in $$props2) $$invalidate(2, inTransition = $$props2.inTransition); + if ("outTransition" in $$props2) $$invalidate(3, outTransition = $$props2.outTransition); + if ("transitionOptions" in $$props2) $$invalidate(29, transitionOptions = $$props2.transitionOptions); + if ("inTransitionOptions" in $$props2) $$invalidate(4, inTransitionOptions = $$props2.inTransitionOptions); + if ("outTransitionOptions" in $$props2) $$invalidate(5, outTransitionOptions = $$props2.outTransitionOptions); + if ("$$scope" in $$props2) $$invalidate(35, $$scope = $$props2.$$scope); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty[0] & /*elementContent*/ + 1) { + if (elementContent !== void 0 && elementContent !== null) { + getContext("#internal").stores.elementContent.set(elementContent); + } + } + if ($$self.$$.dirty[0] & /*elementRoot*/ + 2) { + if (elementRoot !== void 0 && elementRoot !== null) { + getContext("#internal").stores.elementRoot.set(elementRoot); + } + } + if ($$self.$$.dirty[1] & /*$focusAuto, $focusTrap, $minimized*/ + 14) { + $$invalidate(11, focusWrapEnabled = $focusAuto && $focusTrap && !$minimized); + } + if ($$self.$$.dirty[0] & /*oldTransition, transition*/ + 1342177280) { + if (oldTransition !== transition) { + const newTransition = typeof transition === "function" ? transition : TJSDefaultTransition.default; + $$invalidate(2, inTransition = newTransition); + $$invalidate(3, outTransition = newTransition); + $$invalidate(30, oldTransition = newTransition); + } + } + if ($$self.$$.dirty[0] & /*transitionOptions*/ + 536870912 | $$self.$$.dirty[1] & /*oldTransitionOptions*/ + 1) { + if (oldTransitionOptions !== transitionOptions) { + const newOptions = transitionOptions !== TJSDefaultTransition.options && isObject(transitionOptions) ? transitionOptions : TJSDefaultTransition.options; + $$invalidate(4, inTransitionOptions = newOptions); + $$invalidate(5, outTransitionOptions = newOptions); + $$invalidate(31, oldTransitionOptions = newOptions); + } + } + if ($$self.$$.dirty[0] & /*inTransition*/ + 4) { + if (typeof inTransition !== "function") { + $$invalidate(2, inTransition = TJSDefaultTransition.default); + } + } + if ($$self.$$.dirty[0] & /*outTransition, application*/ + 1032) { + { + if (typeof outTransition !== "function") { + $$invalidate(3, outTransition = TJSDefaultTransition.default); + } + const defaultCloseAnimation = application?.options?.defaultCloseAnimation; + if (typeof defaultCloseAnimation === "boolean" && defaultCloseAnimation && outTransition !== TJSDefaultTransition.default) { + $$invalidate(10, application.options.defaultCloseAnimation = false, application); + } + } + } + if ($$self.$$.dirty[0] & /*inTransitionOptions*/ + 16) { + if (!isObject(inTransitionOptions)) { + $$invalidate(4, inTransitionOptions = TJSDefaultTransition.options); + } + } + if ($$self.$$.dirty[0] & /*outTransitionOptions*/ + 32) { + if (!isObject(outTransitionOptions)) { + $$invalidate(5, outTransitionOptions = TJSDefaultTransition.options); + } + } + }; + return [ + elementContent, + elementRoot, + inTransition, + outTransition, + inTransitionOptions, + outTransitionOptions, + draggable2, + draggableOptions, + stylesApp, + stylesContent, + application, + focusWrapEnabled, + appResizeObserver, + contentResizeObserver, + focusAuto, + focusKeep, + focusTrap, + minimized, + onClosePopup, + onKeydown, + onPointerdownApp, + onPointerdownContent, + resizeObservedContent, + resizeObservedApp, + appOffsetHeight, + appOffsetWidth, + contentOffsetHeight, + contentOffsetWidth, + transition, + transitionOptions, + oldTransition, + oldTransitionOptions, + $focusAuto, + $minimized, + $focusTrap, + $$scope, + slots, + section_binding, + div_binding, + section_binding_1, + div_binding_1 + ]; +} +class ApplicationShell extends SvelteComponent { + constructor(options) { + super(); + init( + this, + options, + instance$h, + create_fragment$h, + safe_not_equal, + { + elementContent: 0, + elementRoot: 1, + draggable: 6, + draggableOptions: 7, + stylesApp: 8, + stylesContent: 9, + appOffsetHeight: 24, + appOffsetWidth: 25, + contentOffsetHeight: 26, + contentOffsetWidth: 27, + transition: 28, + inTransition: 2, + outTransition: 3, + transitionOptions: 29, + inTransitionOptions: 4, + outTransitionOptions: 5 + }, + null, + [-1, -1] + ); + } + get elementContent() { + return this.$$.ctx[0]; + } + set elementContent(elementContent) { + this.$$set({ elementContent }); + flush(); + } + get elementRoot() { + return this.$$.ctx[1]; + } + set elementRoot(elementRoot) { + this.$$set({ elementRoot }); + flush(); + } + get draggable() { + return this.$$.ctx[6]; + } + set draggable(draggable2) { + this.$$set({ draggable: draggable2 }); + flush(); + } + get draggableOptions() { + return this.$$.ctx[7]; + } + set draggableOptions(draggableOptions) { + this.$$set({ draggableOptions }); + flush(); + } + get stylesApp() { + return this.$$.ctx[8]; + } + set stylesApp(stylesApp) { + this.$$set({ stylesApp }); + flush(); + } + get stylesContent() { + return this.$$.ctx[9]; + } + set stylesContent(stylesContent) { + this.$$set({ stylesContent }); + flush(); + } + get appOffsetHeight() { + return this.$$.ctx[24]; + } + set appOffsetHeight(appOffsetHeight) { + this.$$set({ appOffsetHeight }); + flush(); + } + get appOffsetWidth() { + return this.$$.ctx[25]; + } + set appOffsetWidth(appOffsetWidth) { + this.$$set({ appOffsetWidth }); + flush(); + } + get contentOffsetHeight() { + return this.$$.ctx[26]; + } + set contentOffsetHeight(contentOffsetHeight) { + this.$$set({ contentOffsetHeight }); + flush(); + } + get contentOffsetWidth() { + return this.$$.ctx[27]; + } + set contentOffsetWidth(contentOffsetWidth) { + this.$$set({ contentOffsetWidth }); + flush(); + } + get transition() { + return this.$$.ctx[28]; + } + set transition(transition) { + this.$$set({ transition }); + flush(); + } + get inTransition() { + return this.$$.ctx[2]; + } + set inTransition(inTransition) { + this.$$set({ inTransition }); + flush(); + } + get outTransition() { + return this.$$.ctx[3]; + } + set outTransition(outTransition) { + this.$$set({ outTransition }); + flush(); + } + get transitionOptions() { + return this.$$.ctx[29]; + } + set transitionOptions(transitionOptions) { + this.$$set({ transitionOptions }); + flush(); + } + get inTransitionOptions() { + return this.$$.ctx[4]; + } + set inTransitionOptions(inTransitionOptions) { + this.$$set({ inTransitionOptions }); + flush(); + } + get outTransitionOptions() { + return this.$$.ctx[5]; + } + set outTransitionOptions(outTransitionOptions) { + this.$$set({ outTransitionOptions }); + flush(); + } +} +function create_else_block$4(ctx) { + let div; + let tjsapplicationheader; + let t0; + let section; + let applyStyles_action; + let t1; + let resizablehandle; + let t2; + let tjsfocuswrap; + let div_id_value; + let div_class_value; + let div_data_appid_value; + let applyStyles_action_1; + let current; + let mounted; + let dispose; + tjsapplicationheader = new TJSApplicationHeader({ + props: { + draggable: ( + /*draggable*/ + ctx[6] + ), + draggableOptions: ( + /*draggableOptions*/ + ctx[7] + ) + } + }); + const default_slot_template = ( + /*#slots*/ + ctx[36].default + ); + const default_slot = create_slot( + default_slot_template, + ctx, + /*$$scope*/ + ctx[35], + null + ); + resizablehandle = new ResizableHandle({}); + tjsfocuswrap = new TJSFocusWrap({ + props: { + elementRoot: ( + /*elementRoot*/ + ctx[1] + ), + enabled: ( + /*focusWrapEnabled*/ + ctx[11] + ) + } + }); + return { + c() { + div = element("div"); + create_component(tjsapplicationheader.$$.fragment); + t0 = space(); + section = element("section"); + if (default_slot) default_slot.c(); + t1 = space(); + create_component(resizablehandle.$$.fragment); + t2 = space(); + create_component(tjsfocuswrap.$$.fragment); + attr(section, "class", "window-content svelte-gas-18tboxn"); + attr(section, "tabindex", "-1"); + attr(div, "id", div_id_value = /*application*/ + ctx[10].id); + attr(div, "class", div_class_value = "tjs-app tjs-window-app " + /*application*/ + ctx[10].options.classes.join(" ") + " svelte-gas-18tboxn"); + attr(div, "data-appid", div_data_appid_value = /*application*/ + ctx[10].appId); + attr(div, "role", "application"); + attr(div, "tabindex", "-1"); + }, + m(target, anchor) { + insert(target, div, anchor); + mount_component(tjsapplicationheader, div, null); + append(div, t0); + append(div, section); + if (default_slot) { + default_slot.m(section, null); + } + ctx[39](section); + append(div, t1); + mount_component(resizablehandle, div, null); + append(div, t2); + mount_component(tjsfocuswrap, div, null); + ctx[40](div); + current = true; + if (!mounted) { + dispose = [ + listen( + section, + "pointerdown", + /*onPointerdownContent*/ + ctx[21] + ), + action_destroyer(applyStyles_action = applyStyles.call( + null, + section, + /*stylesContent*/ + ctx[9] + )), + action_destroyer( + /*contentResizeObserver*/ + ctx[13].call( + null, + section, + /*resizeObservedContent*/ + ctx[22] + ) + ), + listen(div, "close:popup", stop_propagation(prevent_default( + /*onClosePopup*/ + ctx[18] + ))), + listen( + div, + "keydown", + /*onKeydown*/ + ctx[19], + true + ), + listen( + div, + "pointerdown", + /*onPointerdownApp*/ + ctx[20] + ), + action_destroyer(applyStyles_action_1 = applyStyles.call( + null, + div, + /*stylesApp*/ + ctx[8] + )), + action_destroyer( + /*appResizeObserver*/ + ctx[12].call( + null, + div, + /*resizeObservedApp*/ + ctx[23] + ) + ) + ]; + mounted = true; + } + }, + p(ctx2, dirty) { + const tjsapplicationheader_changes = {}; + if (dirty[0] & /*draggable*/ + 64) tjsapplicationheader_changes.draggable = /*draggable*/ + ctx2[6]; + if (dirty[0] & /*draggableOptions*/ + 128) tjsapplicationheader_changes.draggableOptions = /*draggableOptions*/ + ctx2[7]; + tjsapplicationheader.$set(tjsapplicationheader_changes); + if (default_slot) { + if (default_slot.p && (!current || dirty[1] & /*$$scope*/ + 16)) { + update_slot_base( + default_slot, + default_slot_template, + ctx2, + /*$$scope*/ + ctx2[35], + !current ? get_all_dirty_from_scope( + /*$$scope*/ + ctx2[35] + ) : get_slot_changes( + default_slot_template, + /*$$scope*/ + ctx2[35], + dirty, + null + ), + null + ); + } + } + if (applyStyles_action && is_function(applyStyles_action.update) && dirty[0] & /*stylesContent*/ + 512) applyStyles_action.update.call( + null, + /*stylesContent*/ + ctx2[9] + ); + const tjsfocuswrap_changes = {}; + if (dirty[0] & /*elementRoot*/ + 2) tjsfocuswrap_changes.elementRoot = /*elementRoot*/ + ctx2[1]; + if (dirty[0] & /*focusWrapEnabled*/ + 2048) tjsfocuswrap_changes.enabled = /*focusWrapEnabled*/ + ctx2[11]; + tjsfocuswrap.$set(tjsfocuswrap_changes); + if (!current || dirty[0] & /*application*/ + 1024 && div_id_value !== (div_id_value = /*application*/ + ctx2[10].id)) { + attr(div, "id", div_id_value); + } + if (!current || dirty[0] & /*application*/ + 1024 && div_class_value !== (div_class_value = "tjs-app tjs-window-app " + /*application*/ + ctx2[10].options.classes.join(" ") + " svelte-gas-18tboxn")) { + attr(div, "class", div_class_value); + } + if (!current || dirty[0] & /*application*/ + 1024 && div_data_appid_value !== (div_data_appid_value = /*application*/ + ctx2[10].appId)) { + attr(div, "data-appid", div_data_appid_value); + } + if (applyStyles_action_1 && is_function(applyStyles_action_1.update) && dirty[0] & /*stylesApp*/ + 256) applyStyles_action_1.update.call( + null, + /*stylesApp*/ + ctx2[8] + ); + }, + i(local) { + if (current) return; + transition_in(tjsapplicationheader.$$.fragment, local); + transition_in(default_slot, local); + transition_in(resizablehandle.$$.fragment, local); + transition_in(tjsfocuswrap.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(tjsapplicationheader.$$.fragment, local); + transition_out(default_slot, local); + transition_out(resizablehandle.$$.fragment, local); + transition_out(tjsfocuswrap.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_component(tjsapplicationheader); + if (default_slot) default_slot.d(detaching); + ctx[39](null); + destroy_component(resizablehandle); + destroy_component(tjsfocuswrap); + ctx[40](null); + mounted = false; + run_all(dispose); + } + }; +} +function create_if_block$7(ctx) { + let div; + let tjsapplicationheader; + let t0; + let section; + let applyStyles_action; + let t1; + let resizablehandle; + let t2; + let tjsfocuswrap; + let div_id_value; + let div_class_value; + let div_data_appid_value; + let applyStyles_action_1; + let div_intro; + let div_outro; + let current; + let mounted; + let dispose; + tjsapplicationheader = new TJSApplicationHeader({ + props: { + draggable: ( + /*draggable*/ + ctx[6] + ), + draggableOptions: ( + /*draggableOptions*/ + ctx[7] + ) + } + }); + const default_slot_template = ( + /*#slots*/ + ctx[36].default + ); + const default_slot = create_slot( + default_slot_template, + ctx, + /*$$scope*/ + ctx[35], + null + ); + resizablehandle = new ResizableHandle({}); + tjsfocuswrap = new TJSFocusWrap({ + props: { elementRoot: ( + /*elementRoot*/ + ctx[1] + ) } + }); + return { + c() { + div = element("div"); + create_component(tjsapplicationheader.$$.fragment); + t0 = space(); + section = element("section"); + if (default_slot) default_slot.c(); + t1 = space(); + create_component(resizablehandle.$$.fragment); + t2 = space(); + create_component(tjsfocuswrap.$$.fragment); + attr(section, "class", "window-content svelte-gas-18tboxn"); + attr(section, "tabindex", "-1"); + attr(div, "id", div_id_value = /*application*/ + ctx[10].id); + attr(div, "class", div_class_value = "tjs-app tjs-window-app " + /*application*/ + ctx[10].options.classes.join(" ") + " svelte-gas-18tboxn"); + attr(div, "data-appid", div_data_appid_value = /*application*/ + ctx[10].appId); + attr(div, "role", "application"); + attr(div, "tabindex", "-1"); + }, + m(target, anchor) { + insert(target, div, anchor); + mount_component(tjsapplicationheader, div, null); + append(div, t0); + append(div, section); + if (default_slot) { + default_slot.m(section, null); + } + ctx[37](section); + append(div, t1); + mount_component(resizablehandle, div, null); + append(div, t2); + mount_component(tjsfocuswrap, div, null); + ctx[38](div); + current = true; + if (!mounted) { + dispose = [ + listen( + section, + "pointerdown", + /*onPointerdownContent*/ + ctx[21] + ), + action_destroyer(applyStyles_action = applyStyles.call( + null, + section, + /*stylesContent*/ + ctx[9] + )), + action_destroyer( + /*contentResizeObserver*/ + ctx[13].call( + null, + section, + /*resizeObservedContent*/ + ctx[22] + ) + ), + listen(div, "close:popup", stop_propagation(prevent_default( + /*onClosePopup*/ + ctx[18] + ))), + listen( + div, + "keydown", + /*onKeydown*/ + ctx[19], + true + ), + listen( + div, + "pointerdown", + /*onPointerdownApp*/ + ctx[20] + ), + action_destroyer(applyStyles_action_1 = applyStyles.call( + null, + div, + /*stylesApp*/ + ctx[8] + )), + action_destroyer( + /*appResizeObserver*/ + ctx[12].call( + null, + div, + /*resizeObservedApp*/ + ctx[23] + ) + ) + ]; + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + const tjsapplicationheader_changes = {}; + if (dirty[0] & /*draggable*/ + 64) tjsapplicationheader_changes.draggable = /*draggable*/ + ctx[6]; + if (dirty[0] & /*draggableOptions*/ + 128) tjsapplicationheader_changes.draggableOptions = /*draggableOptions*/ + ctx[7]; + tjsapplicationheader.$set(tjsapplicationheader_changes); + if (default_slot) { + if (default_slot.p && (!current || dirty[1] & /*$$scope*/ + 16)) { + update_slot_base( + default_slot, + default_slot_template, + ctx, + /*$$scope*/ + ctx[35], + !current ? get_all_dirty_from_scope( + /*$$scope*/ + ctx[35] + ) : get_slot_changes( + default_slot_template, + /*$$scope*/ + ctx[35], + dirty, + null + ), + null + ); + } + } + if (applyStyles_action && is_function(applyStyles_action.update) && dirty[0] & /*stylesContent*/ + 512) applyStyles_action.update.call( + null, + /*stylesContent*/ + ctx[9] + ); + const tjsfocuswrap_changes = {}; + if (dirty[0] & /*elementRoot*/ + 2) tjsfocuswrap_changes.elementRoot = /*elementRoot*/ + ctx[1]; + tjsfocuswrap.$set(tjsfocuswrap_changes); + if (!current || dirty[0] & /*application*/ + 1024 && div_id_value !== (div_id_value = /*application*/ + ctx[10].id)) { + attr(div, "id", div_id_value); + } + if (!current || dirty[0] & /*application*/ + 1024 && div_class_value !== (div_class_value = "tjs-app tjs-window-app " + /*application*/ + ctx[10].options.classes.join(" ") + " svelte-gas-18tboxn")) { + attr(div, "class", div_class_value); + } + if (!current || dirty[0] & /*application*/ + 1024 && div_data_appid_value !== (div_data_appid_value = /*application*/ + ctx[10].appId)) { + attr(div, "data-appid", div_data_appid_value); + } + if (applyStyles_action_1 && is_function(applyStyles_action_1.update) && dirty[0] & /*stylesApp*/ + 256) applyStyles_action_1.update.call( + null, + /*stylesApp*/ + ctx[8] + ); + }, + i(local) { + if (current) return; + transition_in(tjsapplicationheader.$$.fragment, local); + transition_in(default_slot, local); + transition_in(resizablehandle.$$.fragment, local); + transition_in(tjsfocuswrap.$$.fragment, local); + add_render_callback(() => { + if (!current) return; + if (div_outro) div_outro.end(1); + div_intro = create_in_transition( + div, + /*inTransition*/ + ctx[2], + /*inTransitionOptions*/ + ctx[4] + ); + div_intro.start(); + }); + current = true; + }, + o(local) { + transition_out(tjsapplicationheader.$$.fragment, local); + transition_out(default_slot, local); + transition_out(resizablehandle.$$.fragment, local); + transition_out(tjsfocuswrap.$$.fragment, local); + if (div_intro) div_intro.invalidate(); + div_outro = create_out_transition( + div, + /*outTransition*/ + ctx[3], + /*outTransitionOptions*/ + ctx[5] + ); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_component(tjsapplicationheader); + if (default_slot) default_slot.d(detaching); + ctx[37](null); + destroy_component(resizablehandle); + destroy_component(tjsfocuswrap); + ctx[38](null); + if (detaching && div_outro) div_outro.end(); + mounted = false; + run_all(dispose); + } + }; +} +function create_fragment$g(ctx) { + let current_block_type_index; + let if_block; + let if_block_anchor; + let current; + const if_block_creators = [create_if_block$7, create_else_block$4]; + const if_blocks = []; + function select_block_type(ctx2, dirty) { + if ( + /*inTransition*/ + ctx2[2] !== TJSDefaultTransition.default || /*outTransition*/ + ctx2[3] !== TJSDefaultTransition.default + ) return 0; + return 1; + } + current_block_type_index = select_block_type(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + return { + c() { + if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if_blocks[current_block_type_index].m(target, anchor); + insert(target, if_block_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx2); + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } else { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + if_block = if_blocks[current_block_type_index]; + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block.c(); + } else { + if_block.p(ctx2, dirty); + } + transition_in(if_block, 1); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if_blocks[current_block_type_index].d(detaching); + } + }; +} +function instance$g($$self, $$props, $$invalidate) { + let $focusKeep; + let $focusAuto; + let $minimized; + let $focusTrap; + let { $$slots: slots = {}, $$scope } = $$props; + let { elementContent = void 0 } = $$props; + let { elementRoot = void 0 } = $$props; + let { draggable: draggable2 = void 0 } = $$props; + let { draggableOptions = void 0 } = $$props; + let { stylesApp = void 0 } = $$props; + let { stylesContent = void 0 } = $$props; + let { appOffsetHeight = false } = $$props; + let { appOffsetWidth = false } = $$props; + const appResizeObserver = !!appOffsetHeight || !!appOffsetWidth ? resizeObserver : () => null; + let { contentOffsetHeight = false } = $$props; + let { contentOffsetWidth = false } = $$props; + const contentResizeObserver = !!contentOffsetHeight || !!contentOffsetWidth ? resizeObserver : () => null; + const internal = new AppShellContextInternal(); + const s_IGNORE_CLASSES = { ignoreClasses: ["tjs-focus-wrap"] }; + setContext("#internal", internal); + const { application } = getContext("#external"); + const { focusAuto, focusKeep, focusTrap } = application.reactive.storeAppOptions; + component_subscribe($$self, focusAuto, (value) => $$invalidate(32, $focusAuto = value)); + component_subscribe($$self, focusKeep, (value) => $$invalidate(41, $focusKeep = value)); + component_subscribe($$self, focusTrap, (value) => $$invalidate(34, $focusTrap = value)); + const { minimized } = application.reactive.storeUIState; + component_subscribe($$self, minimized, (value) => $$invalidate(33, $minimized = value)); + let focusWrapEnabled; + let { transition = TJSDefaultTransition.default } = $$props; + let { inTransition = TJSDefaultTransition.default } = $$props; + let { outTransition = TJSDefaultTransition.default } = $$props; + let { transitionOptions = void 0 } = $$props; + let { inTransitionOptions = TJSDefaultTransition.options } = $$props; + let { outTransitionOptions = TJSDefaultTransition.options } = $$props; + let oldTransition = TJSDefaultTransition.default; + let oldTransitionOptions = void 0; + onMount(() => { + if ($focusAuto) { + elementRoot.focus(); + } + }); + function onClosePopup(event) { + if (!$focusAuto) { + return; + } + const targetEl = event?.detail?.target; + if (!(targetEl instanceof HTMLElement)) { + return; + } + if (A11yHelper.isFocusable(targetEl)) { + return; + } + const elementRootContains = elementRoot.contains(targetEl); + if (targetEl === elementRoot) { + elementRoot.focus(); + } else if (targetEl === elementContent) { + elementContent.focus(); + } else if (elementRootContains) { + if (elementContent.contains(targetEl)) { + elementContent.focus(); + } else { + elementRoot.focus(); + } + } + } + function onKeydown(event) { + if ((event.target === elementRoot || event.target === elementContent) && KeyboardManager && KeyboardManager?._getMatchingActions?.(KeyboardManager?.getKeyboardEventContext?.(event))?.length) { + event.target?.blur(); + return; + } + if (focusWrapEnabled && event.shiftKey && event.code === "Tab") { + const allFocusable = A11yHelper.getFocusableElements(elementRoot, s_IGNORE_CLASSES); + const firstFocusEl = allFocusable.length > 0 ? allFocusable[0] : void 0; + const lastFocusEl = allFocusable.length > 0 ? allFocusable[allFocusable.length - 1] : void 0; + if (elementRoot === document.activeElement || firstFocusEl === document.activeElement) { + if (lastFocusEl instanceof HTMLElement && firstFocusEl !== lastFocusEl) { + lastFocusEl.focus(); + } + event.preventDefault(); + event.stopPropagation(); + } + } + if (typeof application?.options?.popOut === "boolean" && application.options.popOut && application !== globalThis.ui?.activeWindow) { + application.bringToTop.call(application); + } + } + function onPointerdownApp() { + if (typeof application?.options?.popOut === "boolean" && application.options.popOut && application !== globalThis.ui?.activeWindow) { + application.bringToTop.call(application); + } + } + function onPointerdownContent(event) { + const focusable = A11yHelper.isFocusable(event.target); + if (!focusable && $focusAuto) { + if ($focusKeep) { + const focusOutside = document.activeElement instanceof HTMLElement && !elementRoot.contains(document.activeElement); + if (focusOutside) { + elementContent.focus(); + } else { + event.preventDefault(); + } + } else { + elementContent.focus(); + } + } + } + function resizeObservedContent(offsetWidth, offsetHeight) { + $$invalidate(27, contentOffsetWidth = offsetWidth); + $$invalidate(26, contentOffsetHeight = offsetHeight); + } + function resizeObservedApp(offsetWidth, offsetHeight, contentWidth, contentHeight) { + application.position.stores.resizeObserved.update((object) => { + object.contentWidth = contentWidth; + object.contentHeight = contentHeight; + object.offsetWidth = offsetWidth; + object.offsetHeight = offsetHeight; + return object; + }); + $$invalidate(24, appOffsetHeight = offsetHeight); + $$invalidate(25, appOffsetWidth = offsetWidth); + } + function section_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + elementContent = $$value; + $$invalidate(0, elementContent); + }); + } + function div_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + elementRoot = $$value; + $$invalidate(1, elementRoot); + }); + } + function section_binding_1($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + elementContent = $$value; + $$invalidate(0, elementContent); + }); + } + function div_binding_1($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + elementRoot = $$value; + $$invalidate(1, elementRoot); + }); + } + $$self.$$set = ($$props2) => { + if ("elementContent" in $$props2) $$invalidate(0, elementContent = $$props2.elementContent); + if ("elementRoot" in $$props2) $$invalidate(1, elementRoot = $$props2.elementRoot); + if ("draggable" in $$props2) $$invalidate(6, draggable2 = $$props2.draggable); + if ("draggableOptions" in $$props2) $$invalidate(7, draggableOptions = $$props2.draggableOptions); + if ("stylesApp" in $$props2) $$invalidate(8, stylesApp = $$props2.stylesApp); + if ("stylesContent" in $$props2) $$invalidate(9, stylesContent = $$props2.stylesContent); + if ("appOffsetHeight" in $$props2) $$invalidate(24, appOffsetHeight = $$props2.appOffsetHeight); + if ("appOffsetWidth" in $$props2) $$invalidate(25, appOffsetWidth = $$props2.appOffsetWidth); + if ("contentOffsetHeight" in $$props2) $$invalidate(26, contentOffsetHeight = $$props2.contentOffsetHeight); + if ("contentOffsetWidth" in $$props2) $$invalidate(27, contentOffsetWidth = $$props2.contentOffsetWidth); + if ("transition" in $$props2) $$invalidate(28, transition = $$props2.transition); + if ("inTransition" in $$props2) $$invalidate(2, inTransition = $$props2.inTransition); + if ("outTransition" in $$props2) $$invalidate(3, outTransition = $$props2.outTransition); + if ("transitionOptions" in $$props2) $$invalidate(29, transitionOptions = $$props2.transitionOptions); + if ("inTransitionOptions" in $$props2) $$invalidate(4, inTransitionOptions = $$props2.inTransitionOptions); + if ("outTransitionOptions" in $$props2) $$invalidate(5, outTransitionOptions = $$props2.outTransitionOptions); + if ("$$scope" in $$props2) $$invalidate(35, $$scope = $$props2.$$scope); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty[0] & /*elementContent*/ + 1) { + if (elementContent !== void 0 && elementContent !== null) { + getContext("#internal").stores.elementContent.set(elementContent); + } + } + if ($$self.$$.dirty[0] & /*elementRoot*/ + 2) { + if (elementRoot !== void 0 && elementRoot !== null) { + getContext("#internal").stores.elementRoot.set(elementRoot); + } + } + if ($$self.$$.dirty[1] & /*$focusAuto, $focusTrap, $minimized*/ + 14) { + $$invalidate(11, focusWrapEnabled = $focusAuto && $focusTrap && !$minimized); + } + if ($$self.$$.dirty[0] & /*oldTransition, transition*/ + 1342177280) { + if (oldTransition !== transition) { + const newTransition = typeof transition === "function" ? transition : TJSDefaultTransition.default; + $$invalidate(2, inTransition = newTransition); + $$invalidate(3, outTransition = newTransition); + $$invalidate(30, oldTransition = newTransition); + } + } + if ($$self.$$.dirty[0] & /*transitionOptions*/ + 536870912 | $$self.$$.dirty[1] & /*oldTransitionOptions*/ + 1) { + if (oldTransitionOptions !== transitionOptions) { + const newOptions = transitionOptions !== TJSDefaultTransition.options && isObject(transitionOptions) ? transitionOptions : TJSDefaultTransition.options; + $$invalidate(4, inTransitionOptions = newOptions); + $$invalidate(5, outTransitionOptions = newOptions); + $$invalidate(31, oldTransitionOptions = newOptions); + } + } + if ($$self.$$.dirty[0] & /*inTransition*/ + 4) { + if (typeof inTransition !== "function") { + $$invalidate(2, inTransition = TJSDefaultTransition.default); + } + } + if ($$self.$$.dirty[0] & /*outTransition, application*/ + 1032) { + { + if (typeof outTransition !== "function") { + $$invalidate(3, outTransition = TJSDefaultTransition.default); + } + const defaultCloseAnimation = application?.options?.defaultCloseAnimation; + if (typeof defaultCloseAnimation === "boolean" && defaultCloseAnimation && outTransition !== TJSDefaultTransition.default) { + $$invalidate(10, application.options.defaultCloseAnimation = false, application); + } + } + } + if ($$self.$$.dirty[0] & /*inTransitionOptions*/ + 16) { + if (!isObject(inTransitionOptions)) { + $$invalidate(4, inTransitionOptions = TJSDefaultTransition.options); + } + } + if ($$self.$$.dirty[0] & /*outTransitionOptions*/ + 32) { + if (!isObject(outTransitionOptions)) { + $$invalidate(5, outTransitionOptions = TJSDefaultTransition.options); + } + } + }; + return [ + elementContent, + elementRoot, + inTransition, + outTransition, + inTransitionOptions, + outTransitionOptions, + draggable2, + draggableOptions, + stylesApp, + stylesContent, + application, + focusWrapEnabled, + appResizeObserver, + contentResizeObserver, + focusAuto, + focusKeep, + focusTrap, + minimized, + onClosePopup, + onKeydown, + onPointerdownApp, + onPointerdownContent, + resizeObservedContent, + resizeObservedApp, + appOffsetHeight, + appOffsetWidth, + contentOffsetHeight, + contentOffsetWidth, + transition, + transitionOptions, + oldTransition, + oldTransitionOptions, + $focusAuto, + $minimized, + $focusTrap, + $$scope, + slots, + section_binding, + div_binding, + section_binding_1, + div_binding_1 + ]; +} +class TJSApplicationShell extends SvelteComponent { + constructor(options) { + super(); + init( + this, + options, + instance$g, + create_fragment$g, + safe_not_equal, + { + elementContent: 0, + elementRoot: 1, + draggable: 6, + draggableOptions: 7, + stylesApp: 8, + stylesContent: 9, + appOffsetHeight: 24, + appOffsetWidth: 25, + contentOffsetHeight: 26, + contentOffsetWidth: 27, + transition: 28, + inTransition: 2, + outTransition: 3, + transitionOptions: 29, + inTransitionOptions: 4, + outTransitionOptions: 5 + }, + null, + [-1, -1] + ); + } + get elementContent() { + return this.$$.ctx[0]; + } + set elementContent(elementContent) { + this.$$set({ elementContent }); + flush(); + } + get elementRoot() { + return this.$$.ctx[1]; + } + set elementRoot(elementRoot) { + this.$$set({ elementRoot }); + flush(); + } + get draggable() { + return this.$$.ctx[6]; + } + set draggable(draggable2) { + this.$$set({ draggable: draggable2 }); + flush(); + } + get draggableOptions() { + return this.$$.ctx[7]; + } + set draggableOptions(draggableOptions) { + this.$$set({ draggableOptions }); + flush(); + } + get stylesApp() { + return this.$$.ctx[8]; + } + set stylesApp(stylesApp) { + this.$$set({ stylesApp }); + flush(); + } + get stylesContent() { + return this.$$.ctx[9]; + } + set stylesContent(stylesContent) { + this.$$set({ stylesContent }); + flush(); + } + get appOffsetHeight() { + return this.$$.ctx[24]; + } + set appOffsetHeight(appOffsetHeight) { + this.$$set({ appOffsetHeight }); + flush(); + } + get appOffsetWidth() { + return this.$$.ctx[25]; + } + set appOffsetWidth(appOffsetWidth) { + this.$$set({ appOffsetWidth }); + flush(); + } + get contentOffsetHeight() { + return this.$$.ctx[26]; + } + set contentOffsetHeight(contentOffsetHeight) { + this.$$set({ contentOffsetHeight }); + flush(); + } + get contentOffsetWidth() { + return this.$$.ctx[27]; + } + set contentOffsetWidth(contentOffsetWidth) { + this.$$set({ contentOffsetWidth }); + flush(); + } + get transition() { + return this.$$.ctx[28]; + } + set transition(transition) { + this.$$set({ transition }); + flush(); + } + get inTransition() { + return this.$$.ctx[2]; + } + set inTransition(inTransition) { + this.$$set({ inTransition }); + flush(); + } + get outTransition() { + return this.$$.ctx[3]; + } + set outTransition(outTransition) { + this.$$set({ outTransition }); + flush(); + } + get transitionOptions() { + return this.$$.ctx[29]; + } + set transitionOptions(transitionOptions) { + this.$$set({ transitionOptions }); + flush(); + } + get inTransitionOptions() { + return this.$$.ctx[4]; + } + set inTransitionOptions(inTransitionOptions) { + this.$$set({ inTransitionOptions }); + flush(); + } + get outTransitionOptions() { + return this.$$.ctx[5]; + } + set outTransitionOptions(outTransitionOptions) { + this.$$set({ outTransitionOptions }); + flush(); + } +} +function get_each_context$3(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[26] = list[i]; + return child_ctx; +} +function create_if_block_3$3(ctx) { + let switch_instance; + let switch_instance_anchor; + let current; + const switch_instance_spread_levels = [ + /*dialogProps*/ + ctx[7] + ]; + var switch_value = ( + /*dialogClass*/ + ctx[6] + ); + function switch_props(ctx2, dirty) { + let switch_instance_props = {}; + for (let i = 0; i < switch_instance_spread_levels.length; i += 1) { + switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); + } + if (dirty !== void 0 && dirty & /*dialogProps*/ + 128) { + switch_instance_props = assign(switch_instance_props, get_spread_update(switch_instance_spread_levels, [get_spread_object( + /*dialogProps*/ + ctx2[7] + )])); + } + return { props: switch_instance_props }; + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); + ctx[16](switch_instance); + } + return { + c() { + if (switch_instance) create_component(switch_instance.$$.fragment); + switch_instance_anchor = empty(); + }, + m(target, anchor) { + if (switch_instance) mount_component(switch_instance, target, anchor); + insert(target, switch_instance_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if (dirty & /*dialogClass*/ + 64 && switch_value !== (switch_value = /*dialogClass*/ + ctx2[6])) { + if (switch_instance) { + group_outros(); + const old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, () => { + destroy_component(old_component, 1); + }); + check_outros(); + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx2, dirty)); + ctx2[16](switch_instance); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); + } else { + switch_instance = null; + } + } else if (switch_value) { + const switch_instance_changes = dirty & /*dialogProps*/ + 128 ? get_spread_update(switch_instance_spread_levels, [get_spread_object( + /*dialogProps*/ + ctx2[7] + )]) : {}; + switch_instance.$set(switch_instance_changes); + } + }, + i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(switch_instance_anchor); + } + ctx[16](null); + if (switch_instance) destroy_component(switch_instance, detaching); + } + }; +} +function create_if_block_2$4(ctx) { + let html_tag; + let html_anchor; + return { + c() { + html_tag = new HtmlTag(false); + html_anchor = empty(); + html_tag.a = html_anchor; + }, + m(target, anchor) { + html_tag.m( + /*content*/ + ctx[3], + target, + anchor + ); + insert(target, html_anchor, anchor); + }, + p(ctx2, dirty) { + if (dirty & /*content*/ + 8) html_tag.p( + /*content*/ + ctx2[3] + ); + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(html_anchor); + html_tag.d(); + } + } + }; +} +function create_if_block$6(ctx) { + let div; + let each_blocks = []; + let each_1_lookup = /* @__PURE__ */ new Map(); + let each_value = ensure_array_like( + /*buttons*/ + ctx[1] + ); + const get_key = (ctx2) => ( + /*button*/ + ctx2[26].id + ); + for (let i = 0; i < each_value.length; i += 1) { + let child_ctx = get_each_context$3(ctx, each_value, i); + let key = get_key(child_ctx); + each_1_lookup.set(key, each_blocks[i] = create_each_block$3(key, child_ctx)); + } + return { + c() { + div = element("div"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(div, "class", "dialog-buttons tjs-dialog-buttons svelte-gas-1ez4adq"); + }, + m(target, anchor) { + insert(target, div, anchor); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div, null); + } + } + ctx[20](div); + }, + p(ctx2, dirty) { + if (dirty & /*buttons, onClick, currentButtonId*/ + 530) { + each_value = ensure_array_like( + /*buttons*/ + ctx2[1] + ); + each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, div, destroy_block, create_each_block$3, null, get_each_context$3); + } + }, + d(detaching) { + if (detaching) { + detach(div); + } + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].d(); + } + ctx[20](null); + } + }; +} +function create_if_block_1$4(ctx) { + let html_tag; + let raw_value = ( + /*button*/ + ctx[26].icon + "" + ); + let html_anchor; + return { + c() { + html_tag = new HtmlTag(false); + html_anchor = empty(); + html_tag.a = html_anchor; + }, + m(target, anchor) { + html_tag.m(raw_value, target, anchor); + insert(target, html_anchor, anchor); + }, + p(ctx2, dirty) { + if (dirty & /*buttons*/ + 2 && raw_value !== (raw_value = /*button*/ + ctx2[26].icon + "")) html_tag.p(raw_value); + }, + d(detaching) { + if (detaching) { + detach(html_anchor); + html_tag.d(); + } + } + }; +} +function create_each_block$3(key_1, ctx) { + let button_1; + let span; + let t0_value = ( + /*button*/ + ctx[26].label + "" + ); + let t0; + let span_title_value; + let t1; + let button_1_class_value; + let button_1_disabled_value; + let applyStyles_action; + let mounted; + let dispose; + let if_block = ( + /*button*/ + ctx[26].icon && create_if_block_1$4(ctx) + ); + function click_handler() { + return ( + /*click_handler*/ + ctx[18]( + /*button*/ + ctx[26] + ) + ); + } + function focus_handler() { + return ( + /*focus_handler*/ + ctx[19]( + /*button*/ + ctx[26] + ) + ); + } + return { + key: key_1, + first: null, + c() { + button_1 = element("button"); + span = element("span"); + if (if_block) if_block.c(); + t0 = text(t0_value); + t1 = space(); + attr(span, "title", span_title_value = /*button*/ + ctx[26].title); + attr(button_1, "class", button_1_class_value = "dialog-button tjs-dialog-button " + /*button*/ + ctx[26].id + " svelte-gas-1ez4adq"); + button_1.disabled = button_1_disabled_value = /*button*/ + ctx[26].disabled; + this.first = button_1; + }, + m(target, anchor) { + insert(target, button_1, anchor); + append(button_1, span); + if (if_block) if_block.m(span, null); + append(span, t0); + append(button_1, t1); + if (!mounted) { + dispose = [ + listen(button_1, "click", stop_propagation(prevent_default(click_handler))), + listen(button_1, "focus", focus_handler), + action_destroyer(applyStyles_action = applyStyles.call( + null, + button_1, + /*button*/ + ctx[26].styles + )) + ]; + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if ( + /*button*/ + ctx[26].icon + ) { + if (if_block) { + if_block.p(ctx, dirty); + } else { + if_block = create_if_block_1$4(ctx); + if_block.c(); + if_block.m(span, t0); + } + } else if (if_block) { + if_block.d(1); + if_block = null; + } + if (dirty & /*buttons*/ + 2 && t0_value !== (t0_value = /*button*/ + ctx[26].label + "")) set_data(t0, t0_value); + if (dirty & /*buttons*/ + 2 && span_title_value !== (span_title_value = /*button*/ + ctx[26].title)) { + attr(span, "title", span_title_value); + } + if (dirty & /*buttons*/ + 2 && button_1_class_value !== (button_1_class_value = "dialog-button tjs-dialog-button " + /*button*/ + ctx[26].id + " svelte-gas-1ez4adq")) { + attr(button_1, "class", button_1_class_value); + } + if (dirty & /*buttons*/ + 2 && button_1_disabled_value !== (button_1_disabled_value = /*button*/ + ctx[26].disabled)) { + button_1.disabled = button_1_disabled_value; + } + if (applyStyles_action && is_function(applyStyles_action.update) && dirty & /*buttons*/ + 2) applyStyles_action.update.call( + null, + /*button*/ + ctx[26].styles + ); + }, + d(detaching) { + if (detaching) { + detach(button_1); + } + if (if_block) if_block.d(); + mounted = false; + run_all(dispose); + } + }; +} +function create_fragment$f(ctx) { + let main; + let div; + let current_block_type_index; + let if_block0; + let t; + let current; + const if_block_creators = [create_if_block_2$4, create_if_block_3$3]; + const if_blocks = []; + function select_block_type(ctx2, dirty) { + if (typeof /*content*/ + ctx2[3] === "string") return 0; + if ( + /*dialogClass*/ + ctx2[6] + ) return 1; + return -1; + } + if (~(current_block_type_index = select_block_type(ctx))) { + if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + } + let if_block1 = ( + /*buttons*/ + ctx[1].length && create_if_block$6(ctx) + ); + return { + c() { + main = element("main"); + div = element("div"); + if (if_block0) if_block0.c(); + t = space(); + if (if_block1) if_block1.c(); + attr(div, "class", "dialog-content"); + }, + m(target, anchor) { + insert(target, main, anchor); + append(main, div); + if (~current_block_type_index) { + if_blocks[current_block_type_index].m(div, null); + } + ctx[17](div); + append(main, t); + if (if_block1) if_block1.m(main, null); + current = true; + }, + p(ctx2, [dirty]) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx2); + if (current_block_type_index === previous_block_index) { + if (~current_block_type_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } + } else { + if (if_block0) { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + } + if (~current_block_type_index) { + if_block0 = if_blocks[current_block_type_index]; + if (!if_block0) { + if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block0.c(); + } else { + if_block0.p(ctx2, dirty); + } + transition_in(if_block0, 1); + if_block0.m(div, null); + } else { + if_block0 = null; + } + } + if ( + /*buttons*/ + ctx2[1].length + ) { + if (if_block1) { + if_block1.p(ctx2, dirty); + } else { + if_block1 = create_if_block$6(ctx2); + if_block1.c(); + if_block1.m(main, null); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + }, + i(local) { + if (current) return; + transition_in(if_block0); + current = true; + }, + o(local) { + transition_out(if_block0); + current = false; + }, + d(detaching) { + if (detaching) { + detach(main); + } + if (~current_block_type_index) { + if_blocks[current_block_type_index].d(); + } + ctx[17](null); + if (if_block1) if_block1.d(); + } + }; +} +const s_REGEX_HTML = /^\s*<.*>$/; +function instance$f($$self, $$props, $$invalidate) { + let autoClose; + let focusFirst; + let resolveId; + let $elementRoot; + let { data = void 0 } = $$props; + let { preventDefault: preventDefault2 = false } = $$props; + let { stopPropagation = false } = $$props; + let { dialogComponent = void 0 } = $$props; + let buttons; + let contentEl; + let buttonsEl; + let content = void 0; + let dialogClass; + let dialogProps = {}; + let { elementRoot } = getContext("#internal").stores; + component_subscribe($$self, elementRoot, (value) => $$invalidate(15, $elementRoot = value)); + let { application } = getContext("#external"); + let managedPromise = getContext("#managedPromise"); + let currentButtonId = data.default; + onDestroy(() => { + const rootEl = $elementRoot; + if (rootEl instanceof HTMLElement) { + rootEl.removeEventListener("keydown", onKeydown); + rootEl.removeEventListener("keyup", onKeyup); + } + }); + onMount(() => { + if (focusFirst) { + const focusEl = A11yHelper.getFirstFocusableElement(contentEl); + if (focusEl instanceof HTMLElement) { + setTimeout(() => focusEl.focus(), 0); + } + } + }); + function onClick(button) { + try { + let result = void 0; + const callback = button?.onPress; + switch (typeof callback) { + case "function": + result = callback(application); + break; + case "string": + if (dialogComponent !== void 0 && typeof dialogComponent[callback] === "function") { + result = dialogComponent[callback](application); + } else { + if (dialogComponent === void 0) { + console.warn(`[TRL] TJSDialog warning: 'onPress' defined as a string with no associated content Svelte component.`); + } else if (typeof dialogComponent?.[callback] !== "function") { + console.warn(`[TRL] TJSDialog warning: The content Svelte component does not contain an associated function '${callback}'. Did you remember to add '' and export the function?`); + } + } + break; + } + if (button.autoClose && autoClose) { + if (resolveId && result === void 0) { + result = button.id; + } + managedPromise.resolve(result); + } + } catch (err) { + const notifyError = typeof data.notifyError === "boolean" ? data.notifyError : true; + if (notifyError) { + globalThis.ui.notifications.error(err, { console: false }); + } + if (!managedPromise.reject(err)) { + throw err; + } + } finally { + if (button.autoClose && autoClose) { + application.close(); + } + } + } + function onKeydown(event) { + switch (event.code) { + case "ArrowLeft": + case "ArrowRight": + case "Enter": + event.stopPropagation(); + break; + case "Tab": + event.stopPropagation(); + setTimeout( + () => { + const activeElement = document.activeElement; + if (activeElement instanceof HTMLElement && buttonsEl instanceof HTMLElement && buttonsEl.contains(activeElement)) { + for (let cntr = 0; cntr < activeElement.classList.length; cntr++) { + const item = activeElement.classList.item(cntr); + if (item !== "dialog-button" && item !== "default" && typeof data.buttons[item] !== void 0) { + $$invalidate(4, currentButtonId = item); + break; + } + } + } + }, + 0 + ); + break; + default: + if (preventDefault2) { + event.preventDefault(); + } + if (stopPropagation) { + event.stopPropagation(); + } + break; + } + } + function onKeyup(event) { + switch (event.code) { + case "ArrowLeft": { + event.preventDefault(); + event.stopPropagation(); + const activeEl = document.activeElement; + if (buttonsEl instanceof HTMLElement) { + if (activeEl instanceof HTMLElement && buttonsEl.contains(activeEl)) { + const currentIndex = buttons.findIndex((button) => button.id === currentButtonId); + if (buttons.length && currentIndex > 0) { + $$invalidate(4, currentButtonId = buttons[currentIndex - 1].id); + } + } + const buttonEl = buttonsEl.querySelector(`.${currentButtonId}`); + if (buttonEl instanceof HTMLElement) { + buttonEl.focus(); + } + } + break; + } + case "ArrowRight": { + event.preventDefault(); + event.stopPropagation(); + const activeEl = document.activeElement; + if (buttonsEl instanceof HTMLElement) { + if (activeEl instanceof HTMLElement && (buttonsEl.contains(activeEl) || currentButtonId === void 0)) { + const currentIndex = buttons.findIndex((button) => button.id === currentButtonId); + if (buttons.length && currentIndex < buttons.length - 1) { + $$invalidate(4, currentButtonId = buttons[currentIndex + 1].id); + } + } + const buttonEl = buttonsEl.querySelector(`.${currentButtonId}`); + if (buttonEl instanceof HTMLElement) { + buttonEl.focus(); + } + } + break; + } + case "Enter": + event.preventDefault(); + event.stopPropagation(); + break; + default: + if (preventDefault2) { + event.preventDefault(); + } + if (stopPropagation) { + event.stopPropagation(); + } + break; + } + } + function switch_instance_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + dialogComponent = $$value; + $$invalidate(0, dialogComponent); + }); + } + function div_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + contentEl = $$value; + $$invalidate(5, contentEl); + }); + } + const click_handler = (button) => onClick(button); + const focus_handler = (button) => $$invalidate(4, currentButtonId = button.id); + function div_binding_1($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + buttonsEl = $$value; + $$invalidate(2, buttonsEl); + }); + } + $$self.$$set = ($$props2) => { + if ("data" in $$props2) $$invalidate(10, data = $$props2.data); + if ("preventDefault" in $$props2) $$invalidate(11, preventDefault2 = $$props2.preventDefault); + if ("stopPropagation" in $$props2) $$invalidate(12, stopPropagation = $$props2.stopPropagation); + if ("dialogComponent" in $$props2) $$invalidate(0, dialogComponent = $$props2.dialogComponent); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$elementRoot*/ + 32768) { + if ($elementRoot) { + const rootEl = $elementRoot; + if (rootEl instanceof HTMLElement) { + rootEl.addEventListener("keydown", onKeydown); + rootEl.addEventListener("keyup", onKeyup); + } + } + } + if ($$self.$$.dirty & /*data*/ + 1024) { + $$invalidate(13, autoClose = typeof data.autoClose === "boolean" ? data.autoClose : true); + } + if ($$self.$$.dirty & /*data*/ + 1024) { + $$invalidate(14, focusFirst = typeof data.focusFirst === "boolean" ? data.focusFirst : false); + } + if ($$self.$$.dirty & /*data*/ + 1024) { + { + $$invalidate(1, buttons = !isObject(data.buttons) ? [] : Object.keys(data.buttons).reduce( + (array, key) => { + const b = data.buttons[key]; + const icon = typeof b.icon !== "string" ? void 0 : s_REGEX_HTML.test(b.icon) ? b.icon : ``; + const autoClose2 = typeof b.autoClose === "boolean" ? b.autoClose : true; + const disabled = typeof b.disabled === "boolean" ? b.disabled : false; + const label = typeof b.label === "string" ? `${icon !== void 0 ? " " : ""}${localize(b.label)}` : ""; + const title2 = typeof b.title === "string" ? localize(b.title) : void 0; + const condition = typeof b.condition === "function" ? b.condition.call(b) : b.condition ?? true; + if (condition) { + array.push({ + ...b, + id: key, + autoClose: autoClose2, + icon, + label, + title: title2, + disabled + }); + } + return array; + }, + [] + )); + } + } + if ($$self.$$.dirty & /*buttons, currentButtonId*/ + 18) { + if (!buttons.find((button) => button.id === currentButtonId)) { + $$invalidate(4, currentButtonId = void 0); + } + } + if ($$self.$$.dirty & /*focusFirst, buttonsEl, currentButtonId*/ + 16404) { + if (!focusFirst && buttonsEl instanceof HTMLElement) { + const buttonEl = buttonsEl.querySelector(`.${currentButtonId}`); + if (buttonEl instanceof HTMLElement) { + buttonEl.focus(); + } + } + } + if ($$self.$$.dirty & /*data*/ + 1024) { + resolveId = typeof data.resolveId === "boolean" ? data.resolveId : false; + } + if ($$self.$$.dirty & /*content, data*/ + 1032) { + if (content !== data.content) { + $$invalidate( + 3, + content = data.content + ); + try { + if (isSvelteComponent(content)) { + $$invalidate(6, dialogClass = content); + $$invalidate(7, dialogProps = {}); + } else if (isObject(content)) { + const svelteConfig = parseTJSSvelteConfig(content, application); + $$invalidate(6, dialogClass = svelteConfig.class); + $$invalidate(7, dialogProps = svelteConfig.props ?? {}); + const children2 = svelteConfig?.context?.get("external")?.children; + if (Array.isArray(children2)) { + $$invalidate(7, dialogProps.children = children2, dialogProps); + } + } else { + $$invalidate(6, dialogClass = void 0); + $$invalidate(7, dialogProps = {}); + } + } catch (err) { + $$invalidate(6, dialogClass = void 0); + $$invalidate(7, dialogProps = {}); + $$invalidate(3, content = err.message); + console.error(err); + } + } + } + }; + return [ + dialogComponent, + buttons, + buttonsEl, + content, + currentButtonId, + contentEl, + dialogClass, + dialogProps, + elementRoot, + onClick, + data, + preventDefault2, + stopPropagation, + autoClose, + focusFirst, + $elementRoot, + switch_instance_binding, + div_binding, + click_handler, + focus_handler, + div_binding_1 + ]; +} +class DialogContent extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$f, create_fragment$f, safe_not_equal, { + data: 10, + preventDefault: 11, + stopPropagation: 12, + dialogComponent: 0 + }); + } +} +function create_else_block$3(ctx) { + let applicationshell; + let updating_elementRoot; + let updating_elementContent; + let current; + const applicationshell_spread_levels = [ + /*appProps*/ + ctx[6], + { appOffsetHeight: true } + ]; + function applicationshell_elementRoot_binding_1(value) { + ctx[15](value); + } + function applicationshell_elementContent_binding_1(value) { + ctx[16](value); + } + let applicationshell_props = { + $$slots: { default: [create_default_slot_2] }, + $$scope: { ctx } + }; + for (let i = 0; i < applicationshell_spread_levels.length; i += 1) { + applicationshell_props = assign(applicationshell_props, applicationshell_spread_levels[i]); + } + if ( + /*elementRoot*/ + ctx[0] !== void 0 + ) { + applicationshell_props.elementRoot = /*elementRoot*/ + ctx[0]; + } + if ( + /*elementContent*/ + ctx[1] !== void 0 + ) { + applicationshell_props.elementContent = /*elementContent*/ + ctx[1]; + } + applicationshell = new ApplicationShell({ props: applicationshell_props }); + binding_callbacks.push(() => bind(applicationshell, "elementRoot", applicationshell_elementRoot_binding_1)); + binding_callbacks.push(() => bind(applicationshell, "elementContent", applicationshell_elementContent_binding_1)); + return { + c() { + create_component(applicationshell.$$.fragment); + }, + m(target, anchor) { + mount_component(applicationshell, target, anchor); + current = true; + }, + p(ctx2, dirty) { + const applicationshell_changes = dirty & /*appProps*/ + 64 ? get_spread_update(applicationshell_spread_levels, [ + get_spread_object( + /*appProps*/ + ctx2[6] + ), + applicationshell_spread_levels[1] + ]) : {}; + if (dirty & /*$$scope, data, dialogComponent*/ + 4194316) { + applicationshell_changes.$$scope = { dirty, ctx: ctx2 }; + } + if (!updating_elementRoot && dirty & /*elementRoot*/ + 1) { + updating_elementRoot = true; + applicationshell_changes.elementRoot = /*elementRoot*/ + ctx2[0]; + add_flush_callback(() => updating_elementRoot = false); + } + if (!updating_elementContent && dirty & /*elementContent*/ + 2) { + updating_elementContent = true; + applicationshell_changes.elementContent = /*elementContent*/ + ctx2[1]; + add_flush_callback(() => updating_elementContent = false); + } + applicationshell.$set(applicationshell_changes); + }, + i(local) { + if (current) return; + transition_in(applicationshell.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(applicationshell.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(applicationshell, detaching); + } + }; +} +function create_if_block$5(ctx) { + let tjsglasspane; + let current; + const tjsglasspane_spread_levels = [ + { + id: `${/*application*/ + ctx[4].id}-glasspane` + }, + /*modalProps*/ + ctx[7], + { zIndex: ( + /*zIndex*/ + ctx[8] + ) } + ]; + let tjsglasspane_props = { + $$slots: { default: [create_default_slot$4] }, + $$scope: { ctx } + }; + for (let i = 0; i < tjsglasspane_spread_levels.length; i += 1) { + tjsglasspane_props = assign(tjsglasspane_props, tjsglasspane_spread_levels[i]); + } + tjsglasspane = new TJSGlassPane({ props: tjsglasspane_props }); + tjsglasspane.$on( + "close:glasspane", + /*close_glasspane_handler*/ + ctx[13] + ); + return { + c() { + create_component(tjsglasspane.$$.fragment); + }, + m(target, anchor) { + mount_component(tjsglasspane, target, anchor); + current = true; + }, + p(ctx2, dirty) { + const tjsglasspane_changes = dirty & /*application, modalProps, zIndex*/ + 400 ? get_spread_update(tjsglasspane_spread_levels, [ + dirty & /*application*/ + 16 && { + id: `${/*application*/ + ctx2[4].id}-glasspane` + }, + dirty & /*modalProps*/ + 128 && get_spread_object( + /*modalProps*/ + ctx2[7] + ), + dirty & /*zIndex*/ + 256 && { zIndex: ( + /*zIndex*/ + ctx2[8] + ) } + ]) : {}; + if (dirty & /*$$scope, appProps, elementRoot, elementContent, data, dialogComponent*/ + 4194383) { + tjsglasspane_changes.$$scope = { dirty, ctx: ctx2 }; + } + tjsglasspane.$set(tjsglasspane_changes); + }, + i(local) { + if (current) return; + transition_in(tjsglasspane.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(tjsglasspane.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(tjsglasspane, detaching); + } + }; +} +function create_default_slot_2(ctx) { + let dialogcontent; + let updating_dialogComponent; + let current; + function dialogcontent_dialogComponent_binding_1(value) { + ctx[14](value); + } + let dialogcontent_props = { data: ( + /*data*/ + ctx[3] + ) }; + if ( + /*dialogComponent*/ + ctx[2] !== void 0 + ) { + dialogcontent_props.dialogComponent = /*dialogComponent*/ + ctx[2]; + } + dialogcontent = new DialogContent({ props: dialogcontent_props }); + binding_callbacks.push(() => bind(dialogcontent, "dialogComponent", dialogcontent_dialogComponent_binding_1)); + return { + c() { + create_component(dialogcontent.$$.fragment); + }, + m(target, anchor) { + mount_component(dialogcontent, target, anchor); + current = true; + }, + p(ctx2, dirty) { + const dialogcontent_changes = {}; + if (dirty & /*data*/ + 8) dialogcontent_changes.data = /*data*/ + ctx2[3]; + if (!updating_dialogComponent && dirty & /*dialogComponent*/ + 4) { + updating_dialogComponent = true; + dialogcontent_changes.dialogComponent = /*dialogComponent*/ + ctx2[2]; + add_flush_callback(() => updating_dialogComponent = false); + } + dialogcontent.$set(dialogcontent_changes); + }, + i(local) { + if (current) return; + transition_in(dialogcontent.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(dialogcontent.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(dialogcontent, detaching); + } + }; +} +function create_default_slot_1$1(ctx) { + let dialogcontent; + let updating_dialogComponent; + let current; + function dialogcontent_dialogComponent_binding(value) { + ctx[10](value); + } + let dialogcontent_props = { + data: ( + /*data*/ + ctx[3] + ), + stopPropagation: true + }; + if ( + /*dialogComponent*/ + ctx[2] !== void 0 + ) { + dialogcontent_props.dialogComponent = /*dialogComponent*/ + ctx[2]; + } + dialogcontent = new DialogContent({ props: dialogcontent_props }); + binding_callbacks.push(() => bind(dialogcontent, "dialogComponent", dialogcontent_dialogComponent_binding)); + return { + c() { + create_component(dialogcontent.$$.fragment); + }, + m(target, anchor) { + mount_component(dialogcontent, target, anchor); + current = true; + }, + p(ctx2, dirty) { + const dialogcontent_changes = {}; + if (dirty & /*data*/ + 8) dialogcontent_changes.data = /*data*/ + ctx2[3]; + if (!updating_dialogComponent && dirty & /*dialogComponent*/ + 4) { + updating_dialogComponent = true; + dialogcontent_changes.dialogComponent = /*dialogComponent*/ + ctx2[2]; + add_flush_callback(() => updating_dialogComponent = false); + } + dialogcontent.$set(dialogcontent_changes); + }, + i(local) { + if (current) return; + transition_in(dialogcontent.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(dialogcontent.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(dialogcontent, detaching); + } + }; +} +function create_default_slot$4(ctx) { + let applicationshell; + let updating_elementRoot; + let updating_elementContent; + let current; + const applicationshell_spread_levels = [ + /*appProps*/ + ctx[6], + { appOffsetHeight: true } + ]; + function applicationshell_elementRoot_binding(value) { + ctx[11](value); + } + function applicationshell_elementContent_binding(value) { + ctx[12](value); + } + let applicationshell_props = { + $$slots: { default: [create_default_slot_1$1] }, + $$scope: { ctx } + }; + for (let i = 0; i < applicationshell_spread_levels.length; i += 1) { + applicationshell_props = assign(applicationshell_props, applicationshell_spread_levels[i]); + } + if ( + /*elementRoot*/ + ctx[0] !== void 0 + ) { + applicationshell_props.elementRoot = /*elementRoot*/ + ctx[0]; + } + if ( + /*elementContent*/ + ctx[1] !== void 0 + ) { + applicationshell_props.elementContent = /*elementContent*/ + ctx[1]; + } + applicationshell = new ApplicationShell({ props: applicationshell_props }); + binding_callbacks.push(() => bind(applicationshell, "elementRoot", applicationshell_elementRoot_binding)); + binding_callbacks.push(() => bind(applicationshell, "elementContent", applicationshell_elementContent_binding)); + return { + c() { + create_component(applicationshell.$$.fragment); + }, + m(target, anchor) { + mount_component(applicationshell, target, anchor); + current = true; + }, + p(ctx2, dirty) { + const applicationshell_changes = dirty & /*appProps*/ + 64 ? get_spread_update(applicationshell_spread_levels, [ + get_spread_object( + /*appProps*/ + ctx2[6] + ), + applicationshell_spread_levels[1] + ]) : {}; + if (dirty & /*$$scope, data, dialogComponent*/ + 4194316) { + applicationshell_changes.$$scope = { dirty, ctx: ctx2 }; + } + if (!updating_elementRoot && dirty & /*elementRoot*/ + 1) { + updating_elementRoot = true; + applicationshell_changes.elementRoot = /*elementRoot*/ + ctx2[0]; + add_flush_callback(() => updating_elementRoot = false); + } + if (!updating_elementContent && dirty & /*elementContent*/ + 2) { + updating_elementContent = true; + applicationshell_changes.elementContent = /*elementContent*/ + ctx2[1]; + add_flush_callback(() => updating_elementContent = false); + } + applicationshell.$set(applicationshell_changes); + }, + i(local) { + if (current) return; + transition_in(applicationshell.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(applicationshell.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(applicationshell, detaching); + } + }; +} +function create_fragment$e(ctx) { + let current_block_type_index; + let if_block; + let if_block_anchor; + let current; + const if_block_creators = [create_if_block$5, create_else_block$3]; + const if_blocks = []; + function select_block_type(ctx2, dirty) { + if ( + /*modal*/ + ctx2[5] + ) return 0; + return 1; + } + current_block_type_index = select_block_type(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + return { + c() { + if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if_blocks[current_block_type_index].m(target, anchor); + insert(target, if_block_anchor, anchor); + current = true; + }, + p(ctx2, [dirty]) { + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx2); + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } else { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + if_block = if_blocks[current_block_type_index]; + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block.c(); + } else { + if_block.p(ctx2, dirty); + } + transition_in(if_block, 1); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if_blocks[current_block_type_index].d(detaching); + } + }; +} +const s_MODAL_BACKGROUND = "#50505080"; +function instance$e($$self, $$props, $$invalidate) { + let { elementContent = void 0 } = $$props; + let { elementRoot = void 0 } = $$props; + let { data = {} } = $$props; + let { dialogComponent = void 0 } = $$props; + let { managedPromise = void 0 } = $$props; + const application = getContext("#external").application; + const dialogOptions = writable({}); + setContext("#managedPromise", managedPromise); + setContext("#dialogOptions", dialogOptions); + const s_MODAL_TRANSITION = fade; + const s_MODAL_TRANSITION_OPTIONS = { duration: 200 }; + let modal = void 0; + const appProps = { + // Stores any transition functions. + transition: void 0, + inTransition: void 0, + outTransition: void 0, + // Stores properties to set for options for any transitions. + transitionOptions: void 0, + inTransitionOptions: void 0, + outTransitionOptions: void 0, + // Stores any style overrides for application shell. + stylesApp: void 0, + stylesContent: void 0 + }; + const modalProps = { + // Background CSS style string. + background: void 0, + slotSeparate: void 0, + styles: void 0, + // Close modal on glasspane input. + closeOnInput: void 0, + // Stores any transition functions. + transition: void 0, + inTransition: void 0, + outTransition: void 0, + // Stores properties to set for options for any transitions. + transitionOptions: void 0, + inTransitionOptions: void 0, + outTransitionOptions: void 0 + }; + let zIndex = void 0; + if (modal === void 0) { + modal = typeof data?.modal === "boolean" ? data.modal : false; + } + if (modal) { + onDestroy(() => window.removeEventListener("keydown", onKeydownModal, { capture: true })); + onMount(() => window.addEventListener("keydown", onKeydownModal, { capture: true })); + } else { + onDestroy(() => document.removeEventListener("keydown", onKeydown)); + onMount(() => document.addEventListener("keydown", onKeydown)); + } + function onKeydown(event) { + if (event.code === "Escape") { + event.preventDefault(); + event.stopPropagation(); + application.close(); + } + } + function onKeydownModal(event) { + if (event.code === "Escape") { + event.preventDefault(); + event.stopImmediatePropagation(); + application.close(); + } + } + function dialogcontent_dialogComponent_binding(value) { + dialogComponent = value; + $$invalidate(2, dialogComponent); + } + function applicationshell_elementRoot_binding(value) { + elementRoot = value; + $$invalidate(0, elementRoot); + } + function applicationshell_elementContent_binding(value) { + elementContent = value; + $$invalidate(1, elementContent); + } + const close_glasspane_handler = () => application.close(); + function dialogcontent_dialogComponent_binding_1(value) { + dialogComponent = value; + $$invalidate(2, dialogComponent); + } + function applicationshell_elementRoot_binding_1(value) { + elementRoot = value; + $$invalidate(0, elementRoot); + } + function applicationshell_elementContent_binding_1(value) { + elementContent = value; + $$invalidate(1, elementContent); + } + $$self.$$set = ($$props2) => { + if ("elementContent" in $$props2) $$invalidate(1, elementContent = $$props2.elementContent); + if ("elementRoot" in $$props2) $$invalidate(0, elementRoot = $$props2.elementRoot); + if ("data" in $$props2) $$invalidate(3, data = $$props2.data); + if ("dialogComponent" in $$props2) $$invalidate(2, dialogComponent = $$props2.dialogComponent); + if ("managedPromise" in $$props2) $$invalidate(9, managedPromise = $$props2.managedPromise); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*elementRoot, modal*/ + 33) { + if (elementRoot instanceof HTMLElement) { + elementRoot.setAttribute("role", "dialog"); + if (modal) { + elementRoot.setAttribute("aria-modal", "true"); + } + } + } + if ($$self.$$.dirty & /*data, modal, zIndex, application*/ + 312) { + if (isObject(data)) { + dialogOptions.set(klona(data)); + const newZIndex = Number.isInteger(data.zIndex) || data.zIndex === null ? data.zIndex : modal ? Number.MAX_SAFE_INTEGER : Number.MAX_SAFE_INTEGER - 1; + if (zIndex !== newZIndex) { + $$invalidate(8, zIndex = newZIndex); + } + const newDraggable = typeof data.draggable === "boolean" ? data.draggable : void 0; + if (newDraggable !== void 0 && application.reactive.draggable !== newDraggable) { + $$invalidate(4, application.reactive.draggable = newDraggable, application); + } + const newFocusAuto = typeof data.focusAuto === "boolean" ? data.focusAuto : void 0; + if (newFocusAuto !== void 0 && application.reactive.focusAuto !== newFocusAuto) { + $$invalidate(4, application.reactive.focusAuto = newFocusAuto, application); + } + const newFocusKeep = typeof data.focusKeep === "boolean" ? data.focusKeep : void 0; + if (newFocusKeep !== void 0 && application.reactive.focusKeep !== newFocusKeep) { + $$invalidate(4, application.reactive.focusKeep = newFocusKeep, application); + } + const newFocusTrap = typeof data.focusTrap === "boolean" ? data.focusTrap : void 0; + if (newFocusTrap !== void 0 && application.reactive.focusTrap !== newFocusTrap) { + $$invalidate(4, application.reactive.focusTrap = newFocusTrap, application); + } + const newMinimizable = typeof data.minimizable === "boolean" ? data.minimizable : void 0; + if (newMinimizable !== void 0 && application.reactive.minimizable !== newMinimizable) { + $$invalidate(4, application.reactive.minimizable = newMinimizable, application); + } + const newResizable = typeof data.resizable === "boolean" ? data.resizable : void 0; + if (newResizable !== void 0 && application.reactive.resizable !== newResizable) { + $$invalidate(4, application.reactive.resizable = newResizable, application); + } + const newTitle = data.title ?? "Dialog"; + if (newTitle !== application?.options?.title) { + $$invalidate(4, application.reactive.title = newTitle, application); + } + if (application.position.zIndex !== zIndex) { + $$invalidate(4, application.position.zIndex = zIndex, application); + } + } + } + if ($$self.$$.dirty & /*data, appProps*/ + 72) { + if (isObject(data?.transition)) { + const d = data.transition; + if (d?.transition !== appProps.transition) { + $$invalidate(6, appProps.transition = d.transition, appProps); + } + if (d?.inTransition !== appProps.inTransition) { + $$invalidate(6, appProps.inTransition = d.inTransition, appProps); + } + if (d?.outTransition !== appProps.outTransition) { + $$invalidate(6, appProps.outTransition = d.outTransition, appProps); + } + if (d?.transitionOptions !== appProps.transitionOptions) { + $$invalidate(6, appProps.transitionOptions = d.transitionOptions, appProps); + } + if (d?.inTransitionOptions !== appProps.inTransitionOptions) { + $$invalidate(6, appProps.inTransitionOptions = d.inTransitionOptions, appProps); + } + if (d?.outTransitionOptions !== appProps.outTransitionOptions) { + $$invalidate(6, appProps.outTransitionOptions = d.outTransitionOptions, appProps); + } + } + } + if ($$self.$$.dirty & /*data, modalProps*/ + 136) { + { + const newModalBackground = typeof data?.modalOptions?.background === "string" ? data.modalOptions.background : s_MODAL_BACKGROUND; + if (newModalBackground !== modalProps.background) { + $$invalidate(7, modalProps.background = newModalBackground, modalProps); + } + } + } + if ($$self.$$.dirty & /*data, modalProps*/ + 136) { + { + const newModalSlotSeparate = typeof data?.modalOptions?.slotSeparate === "boolean" ? data.modalOptions.slotSeparate : void 0; + if (newModalSlotSeparate !== modalProps.slotSeparate) { + $$invalidate(7, modalProps.slotSeparate = newModalSlotSeparate, modalProps); + } + } + } + if ($$self.$$.dirty & /*data, modalProps*/ + 136) { + { + const newModalStyles = isObject(data?.modalOptions?.styles) ? data.modalOptions.styles : void 0; + if (newModalStyles !== modalProps.styles) { + $$invalidate(7, modalProps.styles = newModalStyles, modalProps); + } + } + } + if ($$self.$$.dirty & /*data, modalProps*/ + 136) { + { + const newModalCloseOnInput = typeof data?.modalOptions?.closeOnInput === "boolean" ? data.modalOptions.closeOnInput : void 0; + if (newModalCloseOnInput !== modalProps.closeOnInput) { + $$invalidate(7, modalProps.closeOnInput = newModalCloseOnInput, modalProps); + } + } + } + if ($$self.$$.dirty & /*data, modalProps*/ + 136) { + if (isObject(data?.modalOptions?.transition)) { + const d = data.modalOptions.transition; + if (d?.transition !== modalProps.transition) { + $$invalidate( + 7, + modalProps.transition = typeof d?.transition === "function" ? d.transition : s_MODAL_TRANSITION, + modalProps + ); + } + if (d?.inTransition !== modalProps.inTransition) { + $$invalidate(7, modalProps.inTransition = d.inTransition, modalProps); + } + if (d?.outTransition !== modalProps.outTransition) { + $$invalidate(7, modalProps.outTransition = d.outTransition, modalProps); + } + if (d?.transitionOptions !== modalProps.transitionOptions) { + $$invalidate( + 7, + modalProps.transitionOptions = isObject(d?.transitionOptions) ? d.transitionOptions : s_MODAL_TRANSITION_OPTIONS, + modalProps + ); + } + if (d?.inTransitionOptions !== modalProps.inTransitionOptions) { + $$invalidate(7, modalProps.inTransitionOptions = d.inTransitionOptions, modalProps); + } + if (d?.outTransitionOptions !== modalProps.outTransitionOptions) { + $$invalidate(7, modalProps.outTransitionOptions = d.outTransitionOptions, modalProps); + } + } else { + const newModalTransition = typeof data?.modalOptions?.transition?.transition === "function" ? data.modalOptions.transition.transition : s_MODAL_TRANSITION; + if (newModalTransition !== modalProps.transition) { + $$invalidate(7, modalProps.transition = newModalTransition, modalProps); + } + const newModalTransitionOptions = isObject(data?.modalOptions?.transitionOptions) ? data.modalOptions.transitionOptions : s_MODAL_TRANSITION_OPTIONS; + if (newModalTransitionOptions !== modalProps.transitionOptions) { + $$invalidate(7, modalProps.transitionOptions = newModalTransitionOptions, modalProps); + } + } + } + }; + return [ + elementRoot, + elementContent, + dialogComponent, + data, + application, + modal, + appProps, + modalProps, + zIndex, + managedPromise, + dialogcontent_dialogComponent_binding, + applicationshell_elementRoot_binding, + applicationshell_elementContent_binding, + close_glasspane_handler, + dialogcontent_dialogComponent_binding_1, + applicationshell_elementRoot_binding_1, + applicationshell_elementContent_binding_1 + ]; +} +class DialogShell extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$e, create_fragment$e, safe_not_equal, { + elementContent: 1, + elementRoot: 0, + data: 3, + dialogComponent: 2, + managedPromise: 9 + }); + } + get elementContent() { + return this.$$.ctx[1]; + } + set elementContent(elementContent) { + this.$$set({ elementContent }); + flush(); + } + get elementRoot() { + return this.$$.ctx[0]; + } + set elementRoot(elementRoot) { + this.$$set({ elementRoot }); + flush(); + } + get data() { + return this.$$.ctx[3]; + } + set data(data) { + this.$$set({ data }); + flush(); + } + get dialogComponent() { + return this.$$.ctx[2]; + } + set dialogComponent(dialogComponent) { + this.$$set({ dialogComponent }); + flush(); + } + get managedPromise() { + return this.$$.ctx[9]; + } + set managedPromise(managedPromise) { + this.$$set({ managedPromise }); + flush(); + } +} +cssVariables$1.setProperties({ + // Anchor text shadow / header buttons + "--tjs-default-text-shadow-focus-hover": "0 0 8px var(--color-shadow-primary)", + // TJSApplicationShell app background. + "--tjs-app-background": `url("${globalThis.foundry.utils.getRoute("/ui/denim075.png")}")` +}, false); +const MODULE_ID = "foundryvtt-actor-studio"; +const MODULE_CODE = "RTAS"; +const LOG_PREFIX = "ACTOR STUDIO |"; +const sessionConstants = { + appState: `${MODULE_ID}.settings.appState` +}; +const DEFAULT_SOURCES = { + races: [ + "dnd5e.races" + /* RACES */ + ], + racialFeatures: [ + "dnd5e.races" + /* RACE_FEATURES */ + ], + classes: [ + "dnd5e.classes" + /* CLASSES */ + ], + subclasses: [ + "dnd5e.subclasses" + /* SUBCLASSES */ + ], + backgrounds: [ + "dnd5e.backgrounds" + /* BACKGROUNDS */ + ], + spells: [ + "dnd5e.spells" + /* SPELLS */ + ], + feats: [], + items: [ + "dnd5e.items" + /* ITEMS */ + ] +}; +const POINT_BUY_COSTS = { + 8: 0, + 9: 1, + 10: 2, + 11: 3, + 12: 4, + 13: 5, + 14: 7, + 15: 9 +}; +const STANDARD_ARRAY = { + str: 15, + dex: 14, + con: 13, + int: 12, + wis: 10, + cha: 8 +}; +function create_default_slot$3(ctx) { + let main; + let img; + let img_src_value; + let p0; + let h10; + let p1; + let h11; + let p2; + let p3; + let p4; + let h12; + let p5; + let div2; + let div0; + let input; + let div1; + let span2; + let footer; + let mounted; + let dispose; + return { + c() { + main = element("main"); + img = element("img"); + p0 = element("p"); + p0.textContent = "Thank you for using Actor Studio!"; + h10 = element("h1"); + h10.textContent = "Introduction"; + p1 = element("p"); + p1.textContent = "Actor Studio is a tool to help you create and level-up your characters for Dungeons and Dragons 5e. It provides a guided workflow to help you create a character, and then guides you through the various advancements for your character."; + h11 = element("h1"); + h11.textContent = "Usage Instructions"; + p2 = element("p"); + p2.textContent = "To create your character, work your way through the tabs and select from the options available. You can always go back and change your choices. Use this as a way to preview what each choice does to your character."; + p3 = element("p"); + p3.textContent = 'Once you are happy with your character, click the "Create Character" button to create your character in Foundry VTT.'; + p4 = element("p"); + p4.textContent = "At this point the Actor will be created and then the Advancement workflows will begin, where you select the various advancements for each choice you've made for your character (e.g. languages, skills, etc.)."; + h12 = element("h1"); + h12.textContent = "Help"; + p5 = element("p"); + p5.innerHTML = `If you have any issues, please report them on the github page.`; + div2 = element("div"); + div0 = element("div"); + input = element("input"); + div1 = element("div"); + span2 = element("span"); + span2.textContent = `${localize("GAS.Setting.DontShowWelcome.Name")}`; + footer = element("footer"); + footer.innerHTML = `

Actor Studio is sponsored by

Round Table Games`; + if (!src_url_equal(img.src, img_src_value = "modules/foundryvtt-actor-studio/assets/actor-studio-blue.svg")) attr(img, "src", img_src_value); + attr(img, "alt", "Actor Studio"); + set_style(img, "height", "100%"); + set_style(img, "max-height", "50px"); + set_style(img, "border", "none"); + set_style(img, "width", "auto"); + attr(input, "type", "checkbox"); + attr(input, "label", localize("GAS.Setting.DontShowWelcome.Name")); + attr(div0, "class", "flex0"); + attr(div1, "class", "flex"); + attr(div2, "class", "flexrow inset justify-flexrow-vertical"); + attr(div2, "data-tooltip", localize("GAS.Setting.DontShowWelcome.Hint")); + attr(main, "class", "svelte-gas-1wkx21b"); + attr(footer, "class", "svelte-gas-1wkx21b"); + }, + m(target, anchor) { + insert(target, main, anchor); + append(main, img); + append(main, p0); + append(main, h10); + append(main, p1); + append(main, h11); + append(main, p2); + append(main, p3); + append(main, p4); + append(main, h12); + append(main, p5); + append(main, div2); + append(div2, div0); + append(div0, input); + input.checked = /*dontShowWelcome*/ + ctx[1]; + append(div2, div1); + append(div1, span2); + insert(target, footer, anchor); + if (!mounted) { + dispose = [ + listen( + input, + "change", + /*handleChange*/ + ctx[2] + ), + listen( + input, + "change", + /*input_change_handler*/ + ctx[5] + ) + ]; + mounted = true; + } + }, + p(ctx2, dirty) { + if (dirty & /*dontShowWelcome*/ + 2) { + input.checked = /*dontShowWelcome*/ + ctx2[1]; + } + }, + d(detaching) { + if (detaching) { + detach(main); + detach(footer); + } + mounted = false; + run_all(dispose); + } + }; +} +function create_fragment$d(ctx) { + let applicationshell; + let updating_elementRoot; + let current; + function applicationshell_elementRoot_binding(value) { + ctx[6](value); + } + let applicationshell_props = { + $$slots: { default: [create_default_slot$3] }, + $$scope: { ctx } + }; + if ( + /*elementRoot*/ + ctx[0] !== void 0 + ) { + applicationshell_props.elementRoot = /*elementRoot*/ + ctx[0]; + } + applicationshell = new ApplicationShell({ props: applicationshell_props }); + binding_callbacks.push(() => bind(applicationshell, "elementRoot", applicationshell_elementRoot_binding)); + return { + c() { + create_component(applicationshell.$$.fragment); + }, + m(target, anchor) { + mount_component(applicationshell, target, anchor); + current = true; + }, + p(ctx2, [dirty]) { + const applicationshell_changes = {}; + if (dirty & /*$$scope, dontShowWelcome*/ + 258) { + applicationshell_changes.$$scope = { dirty, ctx: ctx2 }; + } + if (!updating_elementRoot && dirty & /*elementRoot*/ + 1) { + updating_elementRoot = true; + applicationshell_changes.elementRoot = /*elementRoot*/ + ctx2[0]; + add_flush_callback(() => updating_elementRoot = false); + } + applicationshell.$set(applicationshell_changes); + }, + i(local) { + if (current) return; + transition_in(applicationshell.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(applicationshell.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(applicationshell, detaching); + } + }; +} +function instance$d($$self, $$props, $$invalidate) { + let dontShowWelcome2; + let { elementRoot = void 0 } = $$props; + let { version: version2 = void 0 } = $$props; + const application = getContext("#external").application; + const handleChange = (event) => { + game.settings.set(MODULE_ID, "dontShowWelcome", event.target.checked); + }; + let draggable2 = application.reactive.draggable; + draggable2 = true; + onMount(async () => { + }); + function input_change_handler() { + dontShowWelcome2 = this.checked; + $$invalidate(1, dontShowWelcome2); + } + function applicationshell_elementRoot_binding(value) { + elementRoot = value; + $$invalidate(0, elementRoot); + } + $$self.$$set = ($$props2) => { + if ("elementRoot" in $$props2) $$invalidate(0, elementRoot = $$props2.elementRoot); + if ("version" in $$props2) $$invalidate(3, version2 = $$props2.version); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*draggable*/ + 16) { + application.reactive.draggable = draggable2; + } + }; + $$invalidate(1, dontShowWelcome2 = game.settings.get(MODULE_ID, "dontShowWelcome")); + return [ + elementRoot, + dontShowWelcome2, + handleChange, + version2, + draggable2, + input_change_handler, + applicationshell_elementRoot_binding + ]; +} +class WelcomeAppShell extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$d, create_fragment$d, safe_not_equal, { elementRoot: 0, version: 3 }); + } + get elementRoot() { + return this.$$.ctx[0]; + } + set elementRoot(elementRoot) { + this.$$set({ elementRoot }); + flush(); + } + get version() { + return this.$$.ctx[3]; + } + set version(version2) { + this.$$set({ version: version2 }); + flush(); + } +} +class ApplicationState { + /** @type {T} */ + #application; + /** @type {Map} */ + #dataSaved = /* @__PURE__ */ new Map(); + /** + * @param {T} application - The application. + */ + constructor(application) { + this.#application = application; + Object.seal(this); + } + /** + * Returns current application state along with any extra data passed into method. + * + * @param {object} [extra] - Extra data to add to application state. + * + * @returns {ApplicationStateData} Passed in object with current application state. + */ + get(extra = {}) { + return Object.assign(extra, { + position: this.#application?.position?.get(), + beforeMinimized: this.#application?.position?.state.get({ name: "#beforeMinimized" }), + options: Object.assign({}, this.#application?.options), + ui: { minimized: this.#application?.reactive?.minimized } + }); + } + /** + * Returns any stored save state by name. + * + * @param {object} options - Options. + * + * @param {string} options.name - Saved data set name. + * + * @returns {ApplicationStateData} The saved data set. + */ + getSave({ name }) { + if (typeof name !== "string") { + throw new TypeError(`ApplicationState - getSave error: 'name' is not a string.`); + } + return this.#dataSaved.get(name); + } + /** + * Removes and returns any application state by name. + * + * @param {object} options - Options. + * + * @param {string} options.name - Name to remove and retrieve. + * + * @returns {ApplicationStateData} Saved application data. + */ + remove({ name }) { + if (typeof name !== "string") { + throw new TypeError(`ApplicationState - remove: 'name' is not a string.`); + } + const data = this.#dataSaved.get(name); + this.#dataSaved.delete(name); + return data; + } + /** + * Restores a saved application state returning the data. Several optional parameters are available + * to control whether the restore action occurs silently (no store / inline styles updates), animates + * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to} allows + * specification of the duration, easing, and interpolate functions along with configuring a Promise to be + * returned if awaiting the end of the animation. + * + * @param {object} params - Parameters + * + * @param {string} params.name - Saved data set name. + * + * @param {boolean} [params.remove=false] - Remove data set. + * + * @param {boolean} [params.async=false] - If animating return a Promise that resolves with any saved data. + * + * @param {boolean} [params.animateTo=false] - Animate to restore data. + * + * @param {number} [params.duration=0.1] - Duration in seconds. + * + * @param {Function} [params.ease=linear] - Easing function. + * + * @param {Function} [params.interpolate=lerp] - Interpolation function. + * + * @returns {ApplicationStateData|Promise} Saved application data. + */ + restore({ + name, + remove = false, + async = false, + animateTo = false, + duration = 0.1, + ease = identity, + interpolate = lerp + }) { + if (typeof name !== "string") { + throw new TypeError(`ApplicationState - restore error: 'name' is not a string.`); + } + const dataSaved = this.#dataSaved.get(name); + if (dataSaved) { + if (remove) { + this.#dataSaved.delete(name); + } + if (async) { + return this.set(dataSaved, { async, animateTo, duration, ease, interpolate }).then(() => dataSaved); + } else { + this.set(dataSaved, { async, animateTo, duration, ease, interpolate }); + } + } + return dataSaved; + } + /** + * Saves current application state with the opportunity to add extra data to the saved state. + * + * @param {object} options - Options. + * + * @param {string} options.name - name to index this saved data. + * + * @param {...*} [options.extra] - Extra data to add to saved data. + * + * @returns {ApplicationStateData} Current application data + */ + save({ name, ...extra }) { + if (typeof name !== "string") { + throw new TypeError(`ApplicationState - save error: 'name' is not a string.`); + } + const data = this.get(extra); + this.#dataSaved.set(name, data); + return data; + } + /** + * Restores a saved application state returning the data. Several optional parameters are available + * to control whether the restore action occurs silently (no store / inline styles updates), animates + * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to} allows + * specification of the duration, easing, and interpolate functions along with configuring a Promise to be + * returned if awaiting the end of the animation. + * + * Note: If serializing application state any minimized apps will use the before minimized state on initial render + * of the app as it is currently not possible to render apps with Foundry VTT core API in the minimized state. + * + * TODO: THIS METHOD NEEDS TO BE REFACTORED WHEN TRL IS MADE INTO A STANDALONE FRAMEWORK. + * + * @param {ApplicationStateData} data - Saved data set name. + * + * @param {object} [opts] - Optional parameters + * + * @param {boolean} [opts.async=false] - If animating return a Promise that resolves with any saved data. + * + * @param {boolean} [opts.animateTo=false] - Animate to restore data. + * + * @param {number} [opts.duration=0.1] - Duration in seconds. + * + * @param {Function} [opts.ease=linear] - Easing function. + * + * @param {Function} [opts.interpolate=lerp] - Interpolation function. + * + * @returns {T | Promise} When synchronous the application or Promise when animating resolving with application. + */ + set(data, { async = false, animateTo = false, duration = 0.1, ease = identity, interpolate = lerp } = {}) { + if (!isObject(data)) { + throw new TypeError(`ApplicationState - restore error: 'data' is not an object.`); + } + const application = this.#application; + if (!isObject(data?.position)) { + console.warn(`ApplicationState.set warning: 'data.position' is not an object.`); + return application; + } + const rendered = application.rendered; + if (animateTo && !rendered) { + console.warn(`ApplicationState.set warning: Application is not rendered and 'animateTo' is true.`); + return application; + } + if (animateTo) { + if (data.position.transformOrigin !== application.position.transformOrigin) { + application.position.transformOrigin = data.position.transformOrigin; + } + if (isObject(data?.ui)) { + const minimized = typeof data.ui?.minimized === "boolean" ? data.ui.minimized : false; + if (application?.reactive?.minimized && !minimized) { + application.maximize({ animate: false, duration: 0 }); + } + } + const promise2 = application.position.animate.to( + data.position, + { duration, ease, interpolate } + ).finished.then((cancelled) => { + if (cancelled) { + return application; + } + if (isObject(data?.options)) { + application?.reactive.mergeOptions(data.options); + } + if (isObject(data?.ui)) { + const minimized = typeof data.ui?.minimized === "boolean" ? data.ui.minimized : false; + if (!application?.reactive?.minimized && minimized) { + application.minimize({ animate: false, duration: 0 }); + } + } + if (isObject(data?.beforeMinimized)) { + application.position.state.set({ name: "#beforeMinimized", ...data.beforeMinimized }); + } + return application; + }); + if (async) { + return promise2; + } + } else { + if (rendered) { + if (isObject(data?.options)) { + application?.reactive.mergeOptions(data.options); + } + if (isObject(data?.ui)) { + const minimized = typeof data.ui?.minimized === "boolean" ? data.ui.minimized : false; + if (application?.reactive?.minimized && !minimized) { + application.maximize({ animate: false, duration: 0 }); + } else if (!application?.reactive?.minimized && minimized) { + application.minimize({ animate: false, duration }); + } + } + if (isObject(data?.beforeMinimized)) { + application.position.state.set({ name: "#beforeMinimized", ...data.beforeMinimized }); + } + application.position.set(data.position); + } else { + let positionData = data.position; + if (isObject(data.beforeMinimized)) { + positionData = data.beforeMinimized; + positionData.left = data.position.left; + positionData.top = data.position.top; + } + application.position.set(positionData); + } + } + return application; + } +} +class GetSvelteData { + /** @type {import('./types').MountedAppShell[] | null[]} */ + #applicationShellHolder; + /** @type {import('./types').SvelteData[]} */ + #svelteData; + /** + * Keep a direct reference to the SvelteData array in an associated {@link SvelteApplication}. + * + * @param {import('./types').MountedAppShell[] | null[]} applicationShellHolder - A reference to the + * MountedAppShell array. + * + * @param {import('./types').SvelteData[]} svelteData - A reference to the SvelteData array of mounted components. + */ + constructor(applicationShellHolder, svelteData) { + this.#applicationShellHolder = applicationShellHolder; + this.#svelteData = svelteData; + } + /** + * Returns any mounted {@link MountedAppShell}. + * + * @returns {import('./types').MountedAppShell | null} Any mounted application shell. + */ + get applicationShell() { + return this.#applicationShellHolder[0]; + } + /** + * Returns the indexed Svelte component. + * + * @param {number} index - + * + * @returns {object} The loaded Svelte component. + */ + component(index) { + const data = this.#svelteData[index]; + return data?.component ?? void 0; + } + /** + * Returns the Svelte component entries iterator. + * + * @returns {IterableIterator<[number, import('svelte').SvelteComponent]>} Svelte component entries iterator. + * @yields + */ + *componentEntries() { + for (let cntr = 0; cntr < this.#svelteData.length; cntr++) { + yield [cntr, this.#svelteData[cntr].component]; + } + } + /** + * Returns the Svelte component values iterator. + * + * @returns {IterableIterator} Svelte component values iterator. + * @yields + */ + *componentValues() { + for (let cntr = 0; cntr < this.#svelteData.length; cntr++) { + yield this.#svelteData[cntr].component; + } + } + /** + * Returns the indexed SvelteData entry. + * + * @param {number} index - The index of SvelteData instance to retrieve. + * + * @returns {import('./types').SvelteData} The loaded Svelte config + component. + */ + data(index) { + return this.#svelteData[index]; + } + /** + * Returns the {@link SvelteData} instance for a given component. + * + * @param {import('svelte').SvelteComponent} component - Svelte component. + * + * @returns {import('./types').SvelteData} - The loaded Svelte config + component. + */ + dataByComponent(component) { + for (const data of this.#svelteData) { + if (data.component === component) { + return data; + } + } + return void 0; + } + /** + * Returns the SvelteData entries iterator. + * + * @returns {IterableIterator<[number, import('./types').SvelteData]>} SvelteData entries iterator. + */ + dataEntries() { + return this.#svelteData.entries(); + } + /** + * Returns the SvelteData values iterator. + * + * @returns {IterableIterator} SvelteData values iterator. + */ + dataValues() { + return this.#svelteData.values(); + } + /** + * Returns the length of the mounted Svelte component list. + * + * @returns {number} Length of mounted Svelte component list. + */ + get length() { + return this.#svelteData.length; + } +} +function storeGenerator({ storage, serialize = JSON.stringify, deserialize = JSON.parse }) { + function isSimpleDeriver(deriver) { + return deriver.length < 2; + } + function storageReadable(key, value, start) { + return { + subscribe: storageWritable(key, value, start).subscribe + }; + } + function storageWritable(key, value, start) { + function wrap_start(ogSet) { + return start(function wrap_set(new_value) { + if (storage) { + storage.setItem(key, serialize(new_value)); + } + return ogSet(new_value); + }, function wrap_update(fn) { + set2(fn(get_store_value(ogStore))); + }); + } + if (storage) { + const storageValue = storage.getItem(key); + try { + if (storageValue) { + value = deserialize(storageValue); + } + } catch (err) { + } + storage.setItem(key, serialize(value)); + } + const ogStore = writable(value, start ? wrap_start : void 0); + function set2(new_value) { + if (storage) { + storage.setItem(key, serialize(new_value)); + } + ogStore.set(new_value); + } + function update2(fn) { + set2(fn(get_store_value(ogStore))); + } + function subscribe2(run2, invalidate) { + return ogStore.subscribe(run2, invalidate); + } + return { set: set2, update: update2, subscribe: subscribe2 }; + } + function storageDerived(key, stores, fn, initial_value) { + const single = !Array.isArray(stores); + const stores_array = single ? [stores] : stores; + if (storage && storage.getItem(key)) { + try { + initial_value = deserialize(storage.getItem(key)); + } catch (err) { + } + } + return storageReadable(key, initial_value, (set2, update2) => { + let inited = false; + const values = []; + let pending = 0; + let cleanup; + const sync = () => { + if (pending) { + return; + } + cleanup?.(); + const input = single ? values[0] : values; + if (isSimpleDeriver(fn)) { + set2(fn(input)); + } else { + const result = fn(input, set2, update2); + if (typeof result === "function") { + cleanup = result; + } + } + }; + const unsubscribers = stores_array.map((store, i) => store.subscribe((value) => { + values[i] = value; + pending &= ~(1 << i); + if (inited) { + sync(); + } + }, () => { + pending |= 1 << i; + })); + inited = true; + sync(); + return function stop() { + unsubscribers.forEach((unsubscriber) => unsubscriber()); + cleanup?.(); + }; + }); + } + return { + readable: storageReadable, + writable: storageWritable, + derived: storageDerived, + storage, + serialize, + deserialize + }; +} +const sessionStores = storeGenerator({ storage: globalThis?.sessionStorage }); +class TJSWebStorage { + /** @type {import('./').StorageStores} */ + #storageStores; + /** + * @type {(Map any, + * serialize?: (value: any, ...rest: any[]) => string + * }>)} + */ + #stores = /* @__PURE__ */ new Map(); + /** + * @param {import('./').StorageStores} storageStores - Provides a complete set of + * storage API store helper functions and the associated storage API instance and serializations strategy. + */ + constructor(storageStores) { + this.#storageStores = storageStores; + } + /** + * @param {string} key - Storage key. + * + * @returns {(value: string, ...rest: any[]) => any} Deserialize function. + */ + #getDeserialize(key) { + return this.#stores.get(key)?.deserialize ?? this.#storageStores.deserialize; + } + /** + * @param {string} key - Storage key. + * + * @returns {(value: any, ...rest: any[]) => string} Serialize function. + */ + #getSerialize(key) { + return this.#stores.get(key)?.serialize ?? this.#storageStores.serialize; + } + /** + * Creates a new store for the given key. + * + * @template T + * + * @param {string} key - Key to lookup in stores map. + * + * @param {T} [defaultValue] - A default value to set for the store. + * + * @param {import('./').StorageStores} [storageStores] - Additional store creation options. + * + * @returns {import('svelte/store').Writable} The new store. + */ + #createStore(key, defaultValue = void 0, storageStores) { + try { + const value = this.#storageStores.storage.getItem(key); + if (value !== null) { + const deserialize = storageStores?.deserialize ?? this.#storageStores.deserialize; + defaultValue = deserialize(value); + } + } catch (err) { + } + const writable2 = storageStores?.writable ?? this.#storageStores.writable; + return writable2(key, defaultValue); + } + /** + * Gets a store from the `stores` Map or creates a new store for the key and a given default value. + * + * @template T + * + * @param {string} key - Key to lookup in stores map. + * + * @param {T} [defaultValue] - A default value to set for the store. + * + * @param {import('./').StorageStores} [storageStores] - Additional store creation options. + * + * @returns {import('svelte/store').Writable} The store for the given key. + */ + #getStore(key, defaultValue = void 0, storageStores) { + const storeEntry = this.#stores.get(key); + if (storeEntry) { + return storeEntry.store; + } + const store = this.#createStore(key, defaultValue, storageStores); + this.#stores.set(key, { + store, + deserialize: storageStores?.deserialize, + serialize: storageStores?.serialize + }); + return store; + } + /** + * Get value from the storage API. + * + * @param {string} key - Key to lookup in storage API. + * + * @param {*} [defaultValue] - A default value to return if key not present in session storage. + * + * @returns {*} Value from session storage or if not defined any default value provided. + */ + getItem(key, defaultValue) { + let value = defaultValue; + const storageValue = this.#storageStores.storage.getItem(key); + if (storageValue !== null) { + try { + value = this.#getDeserialize(key)(storageValue); + } catch (err) { + value = defaultValue; + } + } else if (defaultValue !== void 0) { + try { + const newValue = this.#getSerialize(key)(defaultValue); + this.#storageStores.storage.setItem(key, newValue); + } catch (err) { + } + } + return value; + } + /** + * Returns the backing Svelte store for the given key; potentially sets a default value if the key + * is not already set. + * + * @template T + * + * @param {string} key - Key to lookup in storage API. + * + * @param {T} [defaultValue] - A default value to return if key not present in session storage. + * + * @param {import('./').StorageStores} [storageStores] - Additional store creation options. + * + * @returns {import('svelte/store').Writable} The Svelte store for this key. + */ + getStore(key, defaultValue, storageStores) { + return this.#getStore(key, defaultValue, storageStores); + } + /** + * Sets the value for the given key in storage API. + * + * @param {string} key - Key to lookup in storage API. + * + * @param {*} value - A value to set for this key. + */ + setItem(key, value) { + const store = this.#getStore(key); + store.set(value); + } + /** + * Convenience method to swap a boolean value stored in storage API. + * + * @param {string} key - Key to lookup in storage API. + * + * @param {boolean} [defaultValue] - A default value to return if key not present in session storage. + * + * @returns {boolean} The boolean swap for the given key. + */ + swapItemBoolean(key, defaultValue) { + const store = this.#getStore(key, defaultValue); + let currentValue = false; + try { + currentValue = !!this.#getDeserialize(key)(this.#storageStores.storage.getItem(key)); + } catch (err) { + } + const newValue = typeof currentValue === "boolean" ? !currentValue : false; + store.set(newValue); + return newValue; + } +} +class TJSSessionStorage extends TJSWebStorage { + constructor() { + super(sessionStores); + } +} +class SvelteReactive { + /** + * @type {import('../SvelteApplication').SvelteApplication} + */ + #application; + /** + * @type {boolean} + */ + #initialized = false; + /** @type {import('@typhonjs-fvtt/runtime/svelte/store/web-storage').TJSWebStorage} */ + #sessionStorage; + /** + * The Application option store which is injected into mounted Svelte component context under the `external` key. + * + * @type {import('./types').StoreAppOptions} + */ + #storeAppOptions; + /** + * Stores the update function for `#storeAppOptions`. + * + * @type {(this: void, updater: import('svelte/store').Updater) => void} + */ + #storeAppOptionsUpdate; + /** + * Stores the UI state data to make it accessible via getters. + * + * @type {object} + */ + #dataUIState; + /** + * The UI option store which is injected into mounted Svelte component context under the `external` key. + * + * @type {import('./types').StoreUIOptions} + */ + #storeUIState; + /** + * Stores the update function for `#storeUIState`. + * + * @type {(this: void, updater: import('svelte/store').Updater) => void} + */ + #storeUIStateUpdate; + /** + * Stores the unsubscribe functions from local store subscriptions. + * + * @type {import('svelte/store').Unsubscriber[]} + */ + #storeUnsubscribe = []; + /** + * @param {import('../SvelteApplication').SvelteApplication} application - The host Foundry application. + */ + constructor(application) { + this.#application = application; + const optionsSessionStorage = application?.options?.sessionStorage; + if (optionsSessionStorage !== void 0 && !(optionsSessionStorage instanceof TJSWebStorage)) { + throw new TypeError(`'options.sessionStorage' is not an instance of TJSWebStorage.`); + } + this.#sessionStorage = optionsSessionStorage !== void 0 ? optionsSessionStorage : new TJSSessionStorage(); + } + /** + * Initializes reactive support. Package private for internal use. + * + * @returns {SvelteReactiveStores | undefined} Internal methods to interact with Svelte stores. + * @package + * @internal + */ + initialize() { + if (this.#initialized) { + return; + } + this.#initialized = true; + this.#storesInitialize(); + return { + appOptionsUpdate: this.#storeAppOptionsUpdate, + uiStateUpdate: this.#storeUIStateUpdate, + subscribe: this.#storesSubscribe.bind(this), + unsubscribe: this.#storesUnsubscribe.bind(this) + }; + } + // Store getters ----------------------------------------------------------------------------------------------------- + /** + * @returns {import('@typhonjs-fvtt/runtime/svelte/store/web-storage').TJSWebStorage} Returns TJSWebStorage (session) instance. + */ + get sessionStorage() { + return this.#sessionStorage; + } + /** + * Returns the store for app options. + * + * @returns {import('./types').StoreAppOptions} App options store. + */ + get storeAppOptions() { + return this.#storeAppOptions; + } + /** + * Returns the store for UI options. + * + * @returns {import('./types').StoreUIOptions} UI options store. + */ + get storeUIState() { + return this.#storeUIState; + } + // Only reactive getters --------------------------------------------------------------------------------------------- + /** + * Returns the current dragging UI state. + * + * @returns {boolean} Dragging UI state. + */ + get dragging() { + return this.#dataUIState.dragging; + } + /** + * Returns the current minimized UI state. + * + * @returns {boolean} Minimized UI state. + */ + get minimized() { + return this.#dataUIState.minimized; + } + /** + * Returns the current resizing UI state. + * + * @returns {boolean} Resizing UI state. + */ + get resizing() { + return this.#dataUIState.resizing; + } + // Reactive getter / setters ----------------------------------------------------------------------------------------- + /** + * Returns the draggable app option. + * + * @returns {boolean} Draggable app option. + */ + get draggable() { + return this.#application?.options?.draggable; + } + /** + * Returns the focusAuto app option. + * + * @returns {boolean} When true auto-management of app focus is enabled. + */ + get focusAuto() { + return this.#application?.options?.focusAuto; + } + /** + * Returns the focusKeep app option. + * + * @returns {boolean} When `focusAuto` and `focusKeep` is true; keeps internal focus. + */ + get focusKeep() { + return this.#application?.options?.focusKeep; + } + /** + * Returns the focusTrap app option. + * + * @returns {boolean} When true focus trapping / wrapping is enabled keeping focus inside app. + */ + get focusTrap() { + return this.#application?.options?.focusTrap; + } + /** + * Returns the headerButtonNoClose app option. + * + * @returns {boolean} Remove the close the button in header app option. + */ + get headerButtonNoClose() { + return this.#application?.options?.headerButtonNoClose; + } + /** + * Returns the headerButtonNoLabel app option. + * + * @returns {boolean} Remove the labels from buttons in header app option. + */ + get headerButtonNoLabel() { + return this.#application?.options?.headerButtonNoLabel; + } + /** + * Returns the headerIcon app option. + * + * @returns {string|void} URL for header app icon. + */ + get headerIcon() { + return this.#application?.options?.headerIcon; + } + /** + * Returns the headerNoTitleMinimized app option. + * + * @returns {boolean} When true removes the header title when minimized. + */ + get headerNoTitleMinimized() { + return this.#application?.options?.headerNoTitleMinimized; + } + /** + * Returns the minimizable app option. + * + * @returns {boolean} Minimizable app option. + */ + get minimizable() { + return this.#application?.options?.minimizable; + } + /** + * Returns the Foundry popOut state; {@link Application.popOut} + * + * @returns {boolean} Positionable app option. + */ + get popOut() { + return this.#application.popOut; + } + /** + * Returns the positionable app option; {@link SvelteApplicationOptions.positionable} + * + * @returns {boolean} Positionable app option. + */ + get positionable() { + return this.#application?.options?.positionable; + } + /** + * Returns the resizable option. + * + * @returns {boolean} Resizable app option. + */ + get resizable() { + return this.#application?.options?.resizable; + } + /** + * Returns the title accessor from the parent Application class; {@link Application.title} + * TODO: Application v2; note that super.title localizes `this.options.title`; IMHO it shouldn't. + * + * @returns {string} Title. + */ + get title() { + return this.#application.title; + } + /** + * Sets `this.options.draggable` which is reactive for application shells. + * + * @param {boolean} draggable - Sets the draggable option. + */ + set draggable(draggable2) { + if (typeof draggable2 === "boolean") { + this.setOptions("draggable", draggable2); + } + } + /** + * Sets `this.options.focusAuto` which is reactive for application shells. + * + * @param {boolean} focusAuto - Sets the focusAuto option. + */ + set focusAuto(focusAuto) { + if (typeof focusAuto === "boolean") { + this.setOptions("focusAuto", focusAuto); + } + } + /** + * Sets `this.options.focusKeep` which is reactive for application shells. + * + * @param {boolean} focusKeep - Sets the focusKeep option. + */ + set focusKeep(focusKeep) { + if (typeof focusKeep === "boolean") { + this.setOptions("focusKeep", focusKeep); + } + } + /** + * Sets `this.options.focusTrap` which is reactive for application shells. + * + * @param {boolean} focusTrap - Sets the focusTrap option. + */ + set focusTrap(focusTrap) { + if (typeof focusTrap === "boolean") { + this.setOptions("focusTrap", focusTrap); + } + } + /** + * Sets `this.options.headerButtonNoClose` which is reactive for application shells. + * + * @param {boolean} headerButtonNoClose - Sets the headerButtonNoClose option. + */ + set headerButtonNoClose(headerButtonNoClose) { + if (typeof headerButtonNoClose === "boolean") { + this.setOptions("headerButtonNoClose", headerButtonNoClose); + } + } + /** + * Sets `this.options.headerButtonNoLabel` which is reactive for application shells. + * + * @param {boolean} headerButtonNoLabel - Sets the headerButtonNoLabel option. + */ + set headerButtonNoLabel(headerButtonNoLabel) { + if (typeof headerButtonNoLabel === "boolean") { + this.setOptions("headerButtonNoLabel", headerButtonNoLabel); + } + } + /** + * Sets `this.options.headerIcon` which is reactive for application shells. + * + * @param {string | undefined} headerIcon - Sets the headerButtonNoLabel option. + */ + set headerIcon(headerIcon) { + if (headerIcon === void 0 || typeof headerIcon === "string") { + this.setOptions("headerIcon", headerIcon); + } + } + /** + * Sets `this.options.headerNoTitleMinimized` which is reactive for application shells. + * + * @param {boolean} headerNoTitleMinimized - Sets the headerNoTitleMinimized option. + */ + set headerNoTitleMinimized(headerNoTitleMinimized) { + if (typeof headerNoTitleMinimized === "boolean") { + this.setOptions("headerNoTitleMinimized", headerNoTitleMinimized); + } + } + /** + * Sets `this.options.minimizable` which is reactive for application shells that are also pop out. + * + * @param {boolean} minimizable - Sets the minimizable option. + */ + set minimizable(minimizable) { + if (typeof minimizable === "boolean") { + this.setOptions("minimizable", minimizable); + } + } + /** + * Sets `this.options.popOut` which is reactive for application shells. This will add / remove this application + * from `ui.windows`. + * + * @param {boolean} popOut - Sets the popOut option. + */ + set popOut(popOut) { + if (typeof popOut === "boolean") { + this.setOptions("popOut", popOut); + } + } + /** + * Sets `this.options.positionable` enabling / disabling {@link SvelteApplication.position}. + * + * @param {boolean} positionable - Sets the positionable option. + */ + set positionable(positionable) { + if (typeof positionable === "boolean") { + this.setOptions("positionable", positionable); + } + } + /** + * Sets `this.options.resizable` which is reactive for application shells. + * + * @param {boolean} resizable - Sets the resizable option. + */ + set resizable(resizable) { + if (typeof resizable === "boolean") { + this.setOptions("resizable", resizable); + } + } + /** + * Sets `this.options.title` which is reactive for application shells. + * + * Note: Will set empty string if title is undefined or null. + * + * @param {string | undefined | null} title - Application title; will be localized, so a translation key is fine. + */ + set title(title2) { + if (typeof title2 === "string") { + this.setOptions("title", title2); + } else if (title2 === void 0 || title2 === null) { + this.setOptions("title", ""); + } + } + // Reactive Options API ------------------------------------------------------------------------------------------- + /** + * Provides a way to safely get this applications options given an accessor string which describes the + * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries + * to walk. + * + * // TODO DOCUMENT the accessor in more detail. + * + * @param {string} accessor - The path / key to set. You can set multiple levels. + * + * @param {*} [defaultValue] - A default value returned if the accessor is not found. + * + * @returns {*} Value at the accessor. + */ + getOptions(accessor, defaultValue) { + return safeAccess(this.#application.options, accessor, defaultValue); + } + /** + * Provides a way to merge `options` into this applications options and update the appOptions store. + * + * @param {object} options - The options object to merge with `this.options`. + */ + mergeOptions(options) { + this.#storeAppOptionsUpdate((instanceOptions) => deepMerge(instanceOptions, options)); + } + /** + * Provides a way to safely set this applications options given an accessor string which describes the + * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries + * to walk. + * + * Additionally if an application shell Svelte component is mounted and exports the `appOptions` property then + * the application options is set to `appOptions` potentially updating the application shell / Svelte component. + * + * // TODO DOCUMENT the accessor in more detail. + * + * @param {string} accessor - The path / key to set. You can set multiple levels. + * + * @param {any} value - Value to set. + */ + setOptions(accessor, value) { + const success = safeSet(this.#application.options, accessor, value); + if (success) { + this.#storeAppOptionsUpdate(() => this.#application.options); + } + } + /** + * Initializes the Svelte stores and derived stores for the application options and UI state. + * + * While writable stores are created the update method is stored in private variables locally and derived Readable + * stores are provided for essential options which are commonly used. + * + * These stores are injected into all Svelte components mounted under the `external` context: `storeAppOptions` and + * `storeUIState`. + */ + #storesInitialize() { + const writableAppOptions = writable(this.#application.options); + this.#storeAppOptionsUpdate = writableAppOptions.update; + const storeAppOptions = { + subscribe: writableAppOptions.subscribe, + draggable: propertyStore(writableAppOptions, "draggable"), + focusAuto: propertyStore(writableAppOptions, "focusAuto"), + focusKeep: propertyStore(writableAppOptions, "focusKeep"), + focusTrap: propertyStore(writableAppOptions, "focusTrap"), + headerButtonNoClose: propertyStore(writableAppOptions, "headerButtonNoClose"), + headerButtonNoLabel: propertyStore(writableAppOptions, "headerButtonNoLabel"), + headerIcon: propertyStore(writableAppOptions, "headerIcon"), + headerNoTitleMinimized: propertyStore(writableAppOptions, "headerNoTitleMinimized"), + minimizable: propertyStore(writableAppOptions, "minimizable"), + popOut: propertyStore(writableAppOptions, "popOut"), + positionable: propertyStore(writableAppOptions, "positionable"), + resizable: propertyStore(writableAppOptions, "resizable"), + title: propertyStore(writableAppOptions, "title") + }; + Object.freeze(storeAppOptions); + this.#storeAppOptions = storeAppOptions; + this.#dataUIState = { + dragging: false, + headerButtons: [], + minimized: this.#application._minimized, + resizing: false + }; + const writableUIOptions = writable(this.#dataUIState); + this.#storeUIStateUpdate = writableUIOptions.update; + const storeUIState = { + subscribe: writableUIOptions.subscribe, + dragging: propertyStore(writableUIOptions, "dragging"), + headerButtons: derived(writableUIOptions, ($options, set2) => set2($options.headerButtons)), + minimized: derived(writableUIOptions, ($options, set2) => set2($options.minimized)), + resizing: propertyStore(writableUIOptions, "resizing") + }; + Object.freeze(storeUIState); + this.#storeUIState = storeUIState; + } + /** + * Registers local store subscriptions for app options. `popOut` controls registering this app with `ui.windows`. + * + * @see SvelteApplication._injectHTML + */ + #storesSubscribe() { + this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.headerButtonNoClose, (value) => { + this.updateHeaderButtons({ headerButtonNoClose: value }); + })); + this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.headerButtonNoLabel, (value) => { + this.updateHeaderButtons({ headerButtonNoLabel: value }); + })); + this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.popOut, (value) => { + if (value && this.#application.rendered) { + globalThis.ui.windows[this.#application.appId] = this.#application; + } else { + delete globalThis.ui.windows[this.#application.appId]; + } + })); + } + /** + * Unsubscribes from any locally monitored stores. + * + * @see SvelteApplication.close + */ + #storesUnsubscribe() { + this.#storeUnsubscribe.forEach((unsubscribe) => unsubscribe()); + this.#storeUnsubscribe = []; + } + /** + * Updates the UI Options store with the current header buttons. You may dynamically add / remove header buttons + * if using an application shell Svelte component. In either overriding `_getHeaderButtons` or responding to the + * Hooks fired return a new button array and the uiOptions store is updated and the application shell will render + * the new buttons. + * + * Optionally you can set in the SvelteApplication app options {@link SvelteApplicationOptions.headerButtonNoClose} + * to remove the close button and {@link SvelteApplicationOptions.headerButtonNoLabel} to true and labels will be + * removed from the header buttons. + * + * @param {object} [opts] - Optional parameters (for internal use) + * + * @param {boolean} [opts.headerButtonNoClose] - The value for `headerButtonNoClose`. + * + * @param {boolean} [opts.headerButtonNoLabel] - The value for `headerButtonNoLabel`. + */ + updateHeaderButtons({ + headerButtonNoClose = this.#application.options.headerButtonNoClose, + headerButtonNoLabel = this.#application.options.headerButtonNoLabel + } = {}) { + let buttons = this.#application._getHeaderButtons(); + if (typeof headerButtonNoClose === "boolean" && headerButtonNoClose) { + buttons = buttons.filter((button) => button.class !== "close"); + } + if (typeof headerButtonNoLabel === "boolean" && headerButtonNoLabel) { + for (const button of buttons) { + button.label = void 0; + } + } + this.#storeUIStateUpdate((options) => { + options.headerButtons = buttons; + return options; + }); + } +} +const applicationShellContract = ["elementRoot"]; +Object.freeze(applicationShellContract); +function isApplicationShell(component) { + if (component === null || component === void 0) { + return false; + } + let compHasContract = true; + let protoHasContract = true; + for (const accessor of applicationShellContract) { + const descriptor = Object.getOwnPropertyDescriptor(component, accessor); + if (descriptor === void 0 || descriptor.get === void 0 || descriptor.set === void 0) { + compHasContract = false; + } + } + const prototype = Object.getPrototypeOf(component); + for (const accessor of applicationShellContract) { + const descriptor = Object.getOwnPropertyDescriptor(prototype, accessor); + if (descriptor === void 0 || descriptor.get === void 0 || descriptor.set === void 0) { + protoHasContract = false; + } + } + return compHasContract || protoHasContract; +} +function loadSvelteConfig({ app, template, config, elementRootUpdate } = {}) { + const svelteOptions = isObject(config.options) ? config.options : {}; + let target; + if (config.target instanceof HTMLElement) { + target = config.target; + } else if (template instanceof HTMLElement && typeof config.target === "string") { + target = template.querySelector(config.target); + } else { + target = document.createDocumentFragment(); + } + if (target === void 0) { + console.log( + `%c[TRL] loadSvelteConfig error - could not find target selector, '${config.target}', for config: +`, + "background: rgb(57,34,34)", + config + ); + throw new Error(); + } + const NewSvelteComponent = config.class; + const svelteConfig = parseTJSSvelteConfig({ ...config, target }, app); + const externalContext = svelteConfig.context.get("#external"); + externalContext.application = app; + externalContext.elementRootUpdate = elementRootUpdate; + externalContext.sessionStorage = app.reactive.sessionStorage; + let eventbus; + if (isObject(app._eventbus) && typeof app._eventbus.createProxy === "function") { + eventbus = app._eventbus.createProxy(); + externalContext.eventbus = eventbus; + } + Object.seal(externalContext); + svelteConfig.context.set("external", new Proxy({}, { + get(targetUnused, prop) { + console.warn(`[TRL] Deprecation warning: Please change getContext('external') to getContext('#external').`); + return externalContext[prop]; + } + })); + const component = new NewSvelteComponent(svelteConfig); + svelteConfig.eventbus = eventbus; + let element2; + if (isApplicationShell(component)) { + element2 = component.elementRoot; + } + if (target instanceof DocumentFragment && target.firstElementChild) { + if (element2 === void 0) { + element2 = target.firstElementChild; + } + template.append(target); + } else if (config.target instanceof HTMLElement && element2 === void 0) { + if (config.target instanceof HTMLElement && typeof svelteOptions.selectorElement !== "string") { + console.log( + `%c[TRL] loadSvelteConfig error - HTMLElement target with no 'selectorElement' defined. + +Note: If configuring an application shell and directly targeting a HTMLElement did you bind an'elementRoot' and include ''? + +Offending config: +`, + "background: rgb(57,34,34)", + config + ); + throw new Error(); + } + element2 = target.querySelector(svelteOptions.selectorElement); + if (element2 === null || element2 === void 0) { + console.log( + `%c[TRL] loadSvelteConfig error - HTMLElement target with 'selectorElement', '${svelteOptions.selectorElement}', not found for config: +`, + "background: rgb(57,34,34)", + config + ); + throw new Error(); + } + } + const injectHTML = !(config.target instanceof HTMLElement); + return { config: svelteConfig, component, element: element2, injectHTML }; +} +class TJSAppIndex { + /** + * Stores all visible / rendered apps. + * + * @type {Map} + */ + static #visibleApps = /* @__PURE__ */ new Map(); + /** + * Adds a SvelteApplication to all visible apps tracked. + * + * @param {import('@typhonjs-fvtt/runtime/svelte/application').SvelteApplication} app - A SvelteApplication + * + * @package + */ + static add(app) { + this.#visibleApps.set(app.id, app); + } + /** + * Removes a SvelteApplication from all visible apps tracked. + * + * @param {import('@typhonjs-fvtt/runtime/svelte/application').SvelteApplication} app - A SvelteApplication + * + * @package + */ + static delete(app) { + this.#visibleApps.delete(app.id); + } + /** + * Gets a particular app by ID. + * + * @param {string} key - App ID. + * + * @returns {import('@typhonjs-fvtt/runtime/svelte/application').SvelteApplication} Associated app. + */ + static get(key) { + return this.#visibleApps.get(key); + } + /** + * Returns whether an associated app by ID is being tracked. + * + * @param {string} key - App ID. + * + * @returns {boolean} The given App ID is visible. + */ + static has(key) { + return this.#visibleApps.has(key); + } + /** + * @returns {IterableIterator} All visible app IDs. + */ + static keys() { + return this.#visibleApps.keys(); + } + /** + * @returns {IterableIterator} All visible apps. + */ + static values() { + return this.#visibleApps.values(); + } +} +class SvelteApplication extends Application { + /** + * Stores the first mounted component which follows the application shell contract. + * + * @type {import('./internal/state-svelte/types').MountedAppShell[]|null[]} Application shell. + */ + #applicationShellHolder = [null]; + /** + * Stores and manages application state for saving / restoring / serializing. + * + * @type {ApplicationState} + */ + #applicationState; + /** + * Stores the target element which may not necessarily be the main element. + * + * @type {HTMLElement} + */ + #elementTarget = null; + /** + * Stores the content element which is set for application shells. + * + * @type {HTMLElement} + */ + #elementContent = null; + /** + * Stores initial z-index from `_renderOuter` to set to target element / Svelte component. + * + * @type {number} + */ + #initialZIndex = 95; + /** + * Stores on mount state which is checked in _render to trigger onSvelteMount callback. + * + * @type {boolean} + */ + #onMount = false; + /** + * The position store. + * + * @type {TJSPosition} + */ + #position; + /** + * Contains the Svelte stores and reactive accessors. + * + * @type {SvelteReactive} + */ + #reactive; + /** + * Stores SvelteData entries with instantiated Svelte components. + * + * @type {import('./internal/state-svelte/types').SvelteData[]} + */ + #svelteData = []; + /** + * Provides a helper class that combines multiple methods for interacting with the mounted components tracked in + * #svelteData. + * + * @type {GetSvelteData} + */ + #getSvelteData = new GetSvelteData(this.#applicationShellHolder, this.#svelteData); + /** + * Contains methods to interact with the Svelte stores. + * + * @type {import('./internal/state-reactive/SvelteReactive').SvelteReactiveStores} + */ + #stores; + /** + * @param {import('@typhonjs-fvtt/runtime/svelte/application').SvelteApplicationOptions} options - The options for the application. + * + * @inheritDoc + */ + constructor(options = {}) { + super(options); + this.#applicationState = new ApplicationState(this); + this.#position = new TJSPosition(this, { + ...this.position, + ...this.options, + initial: this.options.positionInitial, + ortho: this.options.positionOrtho, + validator: this.options.positionValidator + }); + delete this.position; + Object.defineProperty(this, "position", { + get: () => this.#position, + set: (position) => { + if (isObject(position)) { + this.#position.set(position); + } + } + }); + this.#reactive = new SvelteReactive(this); + this.#stores = this.#reactive.initialize(); + } + /** + * Specifies the default options that SvelteApplication supports. + * + * @returns {import('@typhonjs-fvtt/runtime/svelte/application').SvelteApplicationOptions} options - Application options. + * @see https://foundryvtt.com/api/interfaces/client.ApplicationOptions.html + * + * @internal + */ + static get defaultOptions() { + return deepMerge(super.defaultOptions, { + defaultCloseAnimation: true, + // If false the default slide close animation is not run. + draggable: true, + // If true then application shells are draggable. + focusAuto: true, + // When true auto-management of app focus is enabled. + focusKeep: false, + // When `focusAuto` and `focusKeep` is true; keeps internal focus. + focusSource: void 0, + // Stores any A11yFocusSource data that is applied when app is closed. + focusTrap: true, + // When true focus trapping / wrapping is enabled keeping focus inside app. + headerButtonNoClose: false, + // If true then the close header button is removed. + headerButtonNoLabel: false, + // If true then header button labels are removed for application shells. + headerIcon: void 0, + // Sets a header icon given an image URL. + headerNoTitleMinimized: false, + // If true then header title is hidden when application is minimized. + minHeight: MIN_WINDOW_HEIGHT, + // Assigned to position. Number specifying minimum window height. + minWidth: MIN_WINDOW_WIDTH, + // Assigned to position. Number specifying minimum window width. + positionable: true, + // If false then `position.set` does not take effect. + positionInitial: TJSPosition.Initial.browserCentered, + // A helper for initial position placement. + positionOrtho: true, + // When true TJSPosition is optimized for orthographic use. + positionValidator: TJSPosition.Validators.transformWindow, + // A function providing the default validator. + sessionStorage: void 0, + // An instance of TJSWebStorage (session) to share across SvelteApplications. + svelte: void 0, + // A Svelte configuration object. + transformOrigin: "top left" + // By default, 'top / left' respects rotation when minimizing. + }); + } + /** + * Returns the content element if an application shell is mounted. + * + * @returns {HTMLElement} Content element. + */ + get elementContent() { + return this.#elementContent; + } + /** + * Returns the target element or main element if no target defined. + * + * @returns {HTMLElement} Target element. + */ + get elementTarget() { + return this.#elementTarget; + } + /** + * Returns the reactive accessors & Svelte stores for SvelteApplication. + * + * @returns {import('./internal/state-reactive/types').SvelteReactive} The reactive accessors & Svelte stores. + */ + get reactive() { + return this.#reactive; + } + /** + * Returns the application state manager. + * + * @returns {import('./internal/state-app/types').ApplicationState} The application state manager. + */ + get state() { + return this.#applicationState; + } + /** + * Returns the Svelte helper class w/ various methods to access mounted Svelte components. + * + * @returns {import('./internal/state-svelte/types').GetSvelteData} GetSvelteData + */ + get svelte() { + return this.#getSvelteData; + } + /** + * In this case of when a template is defined in app options `html` references the inner HTML / template. However, + * to activate classic v1 tabs for a Svelte component the element target is passed as an array simulating JQuery as + * the element is retrieved immediately and the core listeners use standard DOM queries. + * + * @protected + * @ignore + * @internal + */ + _activateCoreListeners(html) { + super._activateCoreListeners(typeof this.options.template === "string" ? html : [this.popOut ? this.#elementTarget?.firstChild : this.#elementTarget]); + } + /** + * Provide an override to set this application as the active window regardless of z-index. Changes behaviour from + * Foundry core. This is important / used for instance in dialog key handling for left / right button selection. + * + * @param {object} [opts] - Optional parameters. + * + * @param {boolean} [opts.force=false] - Force bring to top; will increment z-index by popOut order. + * + * @ignore + * @internal + */ + bringToTop({ force = false } = {}) { + if (force || this.popOut) { + super.bringToTop(); + } + if (document.activeElement !== document.body && !this.elementTarget.contains(document.activeElement)) { + if (document.activeElement instanceof HTMLElement) { + document.activeElement.blur(); + } + document.body.focus(); + } + globalThis.ui.activeWindow = this; + } + /** + * Note: This method is fully overridden and duplicated as Svelte components need to be destroyed manually and the + * best visual result is to destroy them after the default slide up animation occurs, but before the element + * is removed from the DOM. + * + * If you destroy the Svelte components before the slide up animation the Svelte elements are removed immediately + * from the DOM. The purpose of overriding ensures the slide up animation is always completed before + * the Svelte components are destroyed and then the element is removed from the DOM. + * + * Close the application and un-register references to it within UI mappings. + * This function returns a Promise which resolves once the window closing animation concludes + * + * @param {object} [options] - Optional parameters. + * + * @param {boolean} [options.force] - Force close regardless of render state. + * + * @returns {Promise} A Promise which resolves once the application is closed. + * + * @ignore + * @internal + */ + async close(options = {}) { + const states = Application.RENDER_STATES; + if (!options.force && ![states.RENDERED, states.ERROR].includes(this._state)) { + return; + } + this.#stores.unsubscribe(); + this._state = states.CLOSING; + const el = this.#elementTarget; + if (!el) { + return this._state = states.CLOSED; + } + const content = el.querySelector(".window-content"); + if (content) { + content.style.overflow = "hidden"; + for (let cntr = content.children.length; --cntr >= 0; ) { + content.children[cntr].style.overflow = "hidden"; + } + } + for (const cls of this.constructor._getInheritanceChain()) { + Hooks.call(`close${cls.name}`, this, $(el)); + } + const animate = typeof this.options.defaultCloseAnimation === "boolean" ? this.options.defaultCloseAnimation : true; + if (animate) { + el.style.minHeight = "0"; + const { paddingBottom, paddingTop } = globalThis.getComputedStyle(el); + await el.animate([ + { maxHeight: `${el.clientHeight}px`, paddingTop, paddingBottom }, + { maxHeight: 0, paddingTop: 0, paddingBottom: 0 } + ], { duration: 250, easing: "ease-in", fill: "forwards" }).finished; + } + const svelteDestroyPromises = []; + for (const entry of this.#svelteData) { + svelteDestroyPromises.push(outroAndDestroy(entry.component)); + const eventbus = entry.config.eventbus; + if (isObject(eventbus) && typeof eventbus.off === "function") { + eventbus.off(); + entry.config.eventbus = void 0; + } + } + await Promise.all(svelteDestroyPromises); + TJSAppIndex.delete(this); + this.#svelteData.length = 0; + el.remove(); + this.position.state.restore({ + name: "#beforeMinimized", + properties: ["width", "height"], + silent: true, + remove: true + }); + this.#applicationShellHolder[0] = null; + this._element = null; + this.#elementContent = null; + this.#elementTarget = null; + delete globalThis.ui.windows[this.appId]; + this._minimized = false; + this._scrollPositions = null; + this._state = states.CLOSED; + this.#onMount = false; + this.#stores.uiStateUpdate((storeOptions) => deepMerge(storeOptions, { minimized: this._minimized })); + A11yHelper.applyFocusSource(this.options.focusSource); + delete this.options.focusSource; + } + /** + * Inject the Svelte components defined in `this.options.svelte`. The Svelte component can attach to the existing + * pop-out of Application or provide no template and render into a document fragment which is then attached to the + * DOM. + * + * @protected + * @ignore + * @internal + */ + _injectHTML(html) { + if (this.popOut && html.length === 0 && isIterable(this.options.svelte)) { + throw new Error( + "SvelteApplication - _injectHTML - A popout app with no template can only support one Svelte component." + ); + } + this.reactive.updateHeaderButtons(); + const elementRootUpdate = () => { + let cntr = 0; + return (elementRoot) => { + if (elementRoot !== null && elementRoot !== void 0 && cntr++ > 0) { + this.#updateApplicationShell(); + return true; + } + return false; + }; + }; + if (isIterable(this.options.svelte)) { + for (const svelteConfig of this.options.svelte) { + const svelteData = loadSvelteConfig({ + app: this, + template: html[0], + config: svelteConfig, + elementRootUpdate + }); + if (isApplicationShell(svelteData.component)) { + if (this.svelte.applicationShell !== null) { + throw new Error( + `SvelteApplication - _injectHTML - An application shell is already mounted; offending config: + ${JSON.stringify(svelteConfig)}` + ); + } + this.#applicationShellHolder[0] = svelteData.component; + if (isHMRProxy(svelteData.component) && Array.isArray(svelteData.component?.$$?.on_hmr)) { + svelteData.component.$$.on_hmr.push(() => () => this.#updateApplicationShell()); + } + } + this.#svelteData.push(svelteData); + } + } else if (isObject(this.options.svelte)) { + const svelteData = loadSvelteConfig({ + app: this, + template: html[0], + config: this.options.svelte, + elementRootUpdate + }); + if (isApplicationShell(svelteData.component)) { + if (this.svelte.applicationShell !== null) { + throw new Error( + `SvelteApplication - _injectHTML - An application shell is already mounted; offending config: + ${JSON.stringify(this.options.svelte)}` + ); + } + this.#applicationShellHolder[0] = svelteData.component; + if (isHMRProxy(svelteData.component) && Array.isArray(svelteData.component?.$$?.on_hmr)) { + svelteData.component.$$.on_hmr.push(() => () => this.#updateApplicationShell()); + } + } + this.#svelteData.push(svelteData); + } + const isDocumentFragment = html.length && html[0] instanceof DocumentFragment; + let injectHTML = true; + for (const svelteData of this.#svelteData) { + if (!svelteData.injectHTML) { + injectHTML = false; + break; + } + } + if (injectHTML) { + super._injectHTML(html); + } + if (this.svelte.applicationShell !== null) { + this._element = $(this.svelte.applicationShell.elementRoot); + this.#elementContent = hasGetter(this.svelte.applicationShell, "elementContent") ? this.svelte.applicationShell.elementContent : null; + this.#elementTarget = hasGetter(this.svelte.applicationShell, "elementTarget") ? this.svelte.applicationShell.elementTarget : null; + } else if (isDocumentFragment) { + for (const svelteData of this.#svelteData) { + if (svelteData.element instanceof HTMLElement) { + this._element = $(svelteData.element); + break; + } + } + } + if (this.#elementTarget === null) { + this.#elementTarget = typeof this.options.selectorTarget === "string" ? this._element[0].querySelector(this.options.selectorTarget) : this._element[0]; + } + if (this.#elementTarget === null || this.#elementTarget === void 0) { + throw new Error(`SvelteApplication - _injectHTML: Target element '${this.options.selectorTarget}' not found.`); + } + if (typeof this.options.positionable === "boolean" && this.options.positionable) { + this.#elementTarget.style.zIndex = typeof this.options.zIndex === "number" ? this.options.zIndex : this.#initialZIndex ?? 95; + } + this.#stores.subscribe(); + } + /** + * Provides a mechanism to update the UI options store for maximized. + * + * Note: the sanity check is duplicated from {@link Application.maximize} the store is updated _before_ + * performing the rest of animations. This allows application shells to remove / show any resize handlers + * correctly. Extra constraint data is stored in a saved position state in {@link SvelteApplication.minimize} + * to animate the content area. + * + * @param {object} [opts] - Optional parameters. + * + * @param {boolean} [opts.animate=true] - When true perform default maximizing animation. + * + * @param {number} [opts.duration=0.1] - Controls content area animation duration in seconds. + */ + async maximize({ animate = true, duration = 0.1 } = {}) { + if (!this.popOut || [false, null].includes(this._minimized)) { + return; + } + this._minimized = null; + const durationMS = duration * 1e3; + const element2 = this.elementTarget; + const header = element2.querySelector(".window-header"); + const content = element2.querySelector(".window-content"); + const positionBefore = this.position.state.get({ name: "#beforeMinimized" }); + if (animate) { + await this.position.state.restore({ + name: "#beforeMinimized", + async: true, + animateTo: true, + properties: ["width"], + duration: 0.1 + }); + } + element2.classList.remove("minimized"); + for (let cntr = header.children.length; --cntr >= 0; ) { + header.children[cntr].style.display = null; + } + content.style.display = null; + let constraints; + if (animate) { + ({ constraints } = this.position.state.restore({ + name: "#beforeMinimized", + animateTo: true, + properties: ["height"], + remove: true, + duration + })); + } else { + ({ constraints } = this.position.state.remove({ name: "#beforeMinimized" })); + } + await content.animate([ + { maxHeight: 0, paddingTop: 0, paddingBottom: 0, offset: 0 }, + { ...constraints, offset: 1 }, + { maxHeight: "100%", offset: 1 } + ], { duration: durationMS, fill: "forwards" }).finished; + this.position.set({ + minHeight: positionBefore.minHeight ?? this.options?.minHeight ?? MIN_WINDOW_HEIGHT, + minWidth: positionBefore.minWidth ?? this.options?.minWidth ?? MIN_WINDOW_WIDTH + }); + element2.style.minWidth = null; + element2.style.minHeight = null; + this._minimized = false; + setTimeout(() => { + content.style.overflow = null; + for (let cntr = content.children.length; --cntr >= 0; ) { + content.children[cntr].style.overflow = null; + } + }, 50); + this.#stores.uiStateUpdate((options) => deepMerge(options, { minimized: false })); + } + /** + * Provides a mechanism to update the UI options store for minimized. + * + * Note: the sanity check is duplicated from {@link Application.minimize} the store is updated _before_ + * performing the rest of animations. This allows application shells to remove / show any resize handlers + * correctly. Extra constraint data is stored in a saved position state in {@link SvelteApplication.minimize} + * to animate the content area. + * + * @param {object} [opts] - Optional parameters + * + * @param {boolean} [opts.animate=true] - When true perform default minimizing animation. + * + * @param {number} [opts.duration=0.1] - Controls content area animation duration in seconds. + */ + async minimize({ animate = true, duration = 0.1 } = {}) { + if (!this.rendered || !this.popOut || [true, null].includes(this._minimized)) { + return; + } + this.#stores.uiStateUpdate((options) => deepMerge(options, { minimized: true })); + this._minimized = null; + const durationMS = duration * 1e3; + const element2 = this.elementTarget; + const header = element2.querySelector(".window-header"); + const content = element2.querySelector(".window-content"); + const beforeMinWidth = this.position.minWidth; + const beforeMinHeight = this.position.minHeight; + this.position.set({ minWidth: 100, minHeight: 30 }); + element2.style.minWidth = "100px"; + element2.style.minHeight = "30px"; + if (content) { + content.style.overflow = "hidden"; + for (let cntr = content.children.length; --cntr >= 0; ) { + content.children[cntr].style.overflow = "hidden"; + } + } + const { paddingBottom, paddingTop } = globalThis.getComputedStyle(content); + const constraints = { + maxHeight: `${content.clientHeight}px`, + paddingTop, + paddingBottom + }; + if (animate) { + const animation = content.animate([ + constraints, + { maxHeight: 0, paddingTop: 0, paddingBottom: 0 } + ], { duration: durationMS, fill: "forwards" }); + animation.finished.then(() => content.style.display = "none"); + } else { + setTimeout(() => content.style.display = "none", durationMS); + } + const saved = this.position.state.save({ name: "#beforeMinimized", constraints }); + saved.minWidth = beforeMinWidth; + saved.minHeight = beforeMinHeight; + const headerOffsetHeight = header.offsetHeight; + this.position.minHeight = headerOffsetHeight; + if (animate) { + await this.position.animate.to({ height: headerOffsetHeight }, { duration }).finished; + } + for (let cntr = header.children.length; --cntr >= 0; ) { + const className = header.children[cntr].className; + if (className.includes("window-title") || className.includes("close")) { + continue; + } + if (className.includes("keep-minimized")) { + header.children[cntr].style.display = "block"; + continue; + } + header.children[cntr].style.display = "none"; + } + if (animate) { + await this.position.animate.to({ width: MIN_WINDOW_WIDTH }, { duration: 0.1 }).finished; + } + element2.classList.add("minimized"); + this._minimized = true; + } + /** + * Provides a callback after all Svelte components are initialized. + * + * @param {import('./internal/state-svelte/types').MountedAppShell} [mountedAppShell] - The mounted app shell + * elements. + */ + onSvelteMount(mountedAppShell) { + } + // eslint-disable-line no-unused-vars + /** + * Provides a callback after the main application shell is remounted. This may occur during HMR / hot module + * replacement or directly invoked from the `elementRootUpdate` callback passed to the application shell component + * context. + * + * @param {import('./internal/state-svelte/types').MountedAppShell} [mountedAppShell] - The mounted app shell + * elements. + */ + onSvelteRemount(mountedAppShell) { + } + // eslint-disable-line no-unused-vars + /** + * Override replacing HTML as Svelte components control the rendering process. Only potentially change the outer + * application frame / title for pop-out applications. + * + * @protected + * @ignore + * @internal + */ + _replaceHTML(element2, html) { + if (!element2.length) { + return; + } + this.reactive.updateHeaderButtons(); + } + /** + * Provides an override verifying that a new Application being rendered for the first time doesn't have a + * corresponding DOM element already loaded. This is a check that only occurs when `this._state` is + * `Application.RENDER_STATES.NONE`. It is useful in particular when SvelteApplication has a static ID + * explicitly set in `this.options.id` and long intro / outro transitions are assigned. If a new application + * sharing this static ID attempts to open / render for the first time while an existing DOM element sharing + * this static ID exists then the initial render is cancelled below rather than crashing later in the render + * cycle {@link TJSPosition.set}. + * + * @protected + * @ignore + * @internal + */ + async _render(force = false, options = {}) { + if (isObject(options?.focusSource)) { + this.options.focusSource = options.focusSource; + } + if (this._state === Application.RENDER_STATES.NONE && document.querySelector(`#${this.id}`) instanceof HTMLElement) { + console.warn(`SvelteApplication - _render: A DOM element already exists for CSS ID '${this.id}'. Cancelling initial render for new application with appId '${this.appId}'.`); + return; + } + await super._render(force, options); + if ([Application.RENDER_STATES.CLOSING, Application.RENDER_STATES.RENDERING].includes(this._state)) { + return; + } + if (!force && this._state <= Application.RENDER_STATES.NONE) { + return; + } + if (!this._minimized) { + this.#position.set(options); + } + if (!this.#onMount) { + TJSAppIndex.add(this); + this.onSvelteMount({ element: this._element[0], elementContent: this.#elementContent, elementTarget: this.#elementTarget }); + this.#onMount = true; + } + } + /** + * Render the inner application content. Only render a template if one is defined otherwise provide an empty + * JQuery element per the core Foundry API. + * + * @protected + * @ignore + * @internal + */ + async _renderInner(data) { + const html = typeof this.template === "string" ? await renderTemplate(this.template, data) : document.createDocumentFragment(); + return $(html); + } + /** + * Stores the initial z-index set in `_renderOuter` which is used in `_injectHTML` to set the target element + * z-index after the Svelte component is mounted. + * + * @protected + * @ignore + * @internal + */ + async _renderOuter() { + const html = await super._renderOuter(); + this.#initialZIndex = html[0].style.zIndex; + return html; + } + /** + * All calculation and updates of position are implemented in {@link TJSPosition.set}. This allows position to be fully + * reactive and in control of updating inline styles for the application. + * + * This method remains for backward compatibility with Foundry. If you have a custom override quite likely you need + * to update to using the {@link TJSPosition.validators} functionality. + * + * @param {import('@typhonjs-fvtt/runtime/svelte/store/position').TJSPositionDataExtended} [position] - TJSPosition data. + * + * @returns {TJSPosition} The updated position object for the application containing the new values. + * @ignore + */ + setPosition(position) { + return this.position.set(position); + } + /** + * This method is invoked by the `elementRootUpdate` callback that is added to the external context passed to + * Svelte components. When invoked it updates the local element roots tracked by SvelteApplication. + * + * This method may also be invoked by HMR / hot module replacement via `svelte-hmr`. + */ + #updateApplicationShell() { + const applicationShell = this.svelte.applicationShell; + if (applicationShell !== null) { + this._element = $(applicationShell.elementRoot); + this.#elementContent = hasGetter(applicationShell, "elementContent") ? applicationShell.elementContent : null; + this.#elementTarget = hasGetter(applicationShell, "elementTarget") ? applicationShell.elementTarget : null; + if (this.#elementTarget === null) { + this.#elementTarget = typeof this.options.selectorTarget === "string" ? this._element[0].querySelector(this.options.selectorTarget) : this._element[0]; + } + if (typeof this.options.positionable === "boolean" && this.options.positionable) { + this.#elementTarget.style.zIndex = typeof this.options.zIndex === "number" ? this.options.zIndex : this.#initialZIndex ?? 95; + super.bringToTop(); + this.position.set(this.position.get()); + } + super._activateCoreListeners([this.popOut ? this.#elementTarget?.firstChild : this.#elementTarget]); + this.onSvelteRemount({ element: this._element[0], elementContent: this.#elementContent, elementTarget: this.#elementTarget }); + } + } +} +class ManagedPromise { + /** @type {boolean} */ + static #logging = false; + /** @type {{ isProcessing?: boolean, promise?: Promise, reject: Function, resolve: Function }} */ + #current; + /** + * @returns {boolean} Whether global logging is enabled. + */ + static get logging() { + return this.#logging; + } + /** + * @returns {boolean} Whether there is an active managed Promise. + */ + get isActive() { + return this.#current !== void 0; + } + /** + * @returns {boolean} Whether there is an active managed Promise and resolution is currently being processed. + */ + get isProcessing() { + return this.#current !== void 0 ? this.#current.isProcessing : false; + } + /** + * Sets global logging enabled state. + * + * @param {boolean} logging - New logging enabled state. + */ + static set logging(logging) { + if (typeof logging !== "boolean") { + throw new TypeError(`[TRL] ManagedPromise.logging error: 'logging' is not a boolean.`); + } + this.#logging = logging; + } + // ---------------------------------------------------------------------------------------------------------------- + /** + * Resolves any current Promise with undefined and creates a new current Promise. + * + * @template T + * + * @param {object} opts - Options. + * + * @param {boolean} [opts.reuse=false] - When true if there is an existing live Promise it is returned immediately. + * + * @returns {Promise} The new current managed Promise. + */ + create({ reuse = false } = {}) { + if (typeof reuse !== "boolean") { + throw new TypeError(`[TRL] ManagedPromise.create error: 'reuse' is not a boolean.`); + } + if (reuse && this.#current !== void 0 && this.#current.promise instanceof Promise) { + if (ManagedPromise.#logging) { + console.warn(`[TRL] ManagedPromise.create info: Reusing / returning existing managed Promise.`); + } + return this.#current.promise; + } + if (this.#current !== void 0) { + if (ManagedPromise.#logging) { + console.warn( + `[TRL] ManagedPromise.create info: Creating a new Promise and resolving existing immediately.` + ); + } + this.#current.resolve(void 0); + this.#current = void 0; + } + const promise2 = new Promise((resolve, reject) => { + this.#current = { + isProcessing: false, + reject, + resolve + }; + }); + this.#current.promise = promise2; + return promise2; + } + /** + * Gets the current Promise if any. + * + * @returns {Promise} Current Promise. + */ + get() { + return this.#current ? this.#current.promise : void 0; + } + /** + * Rejects the current Promise if applicable. + * + * @param {*} [result] - Result to reject. + * + * @returns {boolean} Was the promise rejected. + */ + reject(result = void 0) { + if (this.#current !== void 0 && this.#current.isProcessing) { + if (ManagedPromise.#logging) { + console.warn(`[TRL] ManagedPromise.reject info: Currently processing promise.`); + } + return true; + } + if (this.#current !== void 0) { + this.#current.isProcessing = true; + if (result instanceof Promise) { + result.then((value) => { + this.#current.reject(value); + this.#current = void 0; + }).catch((err) => { + this.#current.reject(err); + this.#current = void 0; + }); + } else { + this.#current.reject(result); + this.#current = void 0; + } + return true; + } else { + if (ManagedPromise.#logging) { + console.warn(`[TRL] ManagedPromise.reject warning: No current managed Promise to reject.`); + } + return false; + } + } + /** + * Resolves the current Promise if applicable. + * + * @param {*} [result] - Result to resolve. + * + * @returns {boolean} Was the promise resolved. + */ + resolve(result = void 0) { + if (this.#current !== void 0 && this.#current.isProcessing) { + if (ManagedPromise.#logging) { + console.warn(`[TRL] ManagedPromise.resolve info: Currently processing promise.`); + } + return true; + } + if (this.#current !== void 0) { + if (result instanceof Promise) { + this.#current.isProcessing = true; + result.then((value) => { + this.#current.resolve(value); + this.#current = void 0; + }).catch((err) => { + this.#current.reject(err); + this.#current = void 0; + }); + } else { + this.#current.resolve(result); + this.#current = void 0; + } + return true; + } else { + if (ManagedPromise.#logging) { + console.warn(`[TRL] ManagedPromise.resolve warning: No current managed Promise to resolve.`); + } + return false; + } + } +} +class TJSDialogData { + /** + * @type {import('../../index.js').SvelteApplication} + */ + #application; + /** + * Stores the dialog options data. + * + * @type {import('./types').TJSDialogOptions} + */ + #internal = {}; + /** + * @param {import('../../index.js').SvelteApplication} application - The host Foundry application. + */ + constructor(application) { + this.#application = application; + } + /** + * @returns {Record} The dialog button configuration. + */ + get buttons() { + return this.#internal.buttons; + } + /** + * Set the dialog button configuration. + * + * @param {string} buttons - New dialog button configuration. + */ + set buttons(buttons) { + this.#internal.buttons = buttons; + this.#updateComponent(); + } + /** + * @returns {import('@typhonjs-fvtt/runtime/svelte/util').TJSSvelteConfig | string} The Svelte configuration object or HTML string + * content. + */ + get content() { + return this.#internal.content; + } + /** + * Set the Svelte configuration object or HTML string content. + * + * @param {import('@typhonjs-fvtt/runtime/svelte/util').TJSSvelteConfig | string} content - New Svelte configuration object or + * HTML string content. + */ + set content(content) { + this.#internal.content = content; + this.#updateComponent(); + } + /** + * @returns {string} The default button ID to focus initially. + */ + get default() { + return this.#internal.default; + } + /** + * Set the default button ID to focus initially. + * + * @param {string} newDefault - New default button ID to focus initially. + */ + set default(newDefault) { + this.#internal.default = newDefault; + this.#updateComponent(); + } + /** + * @returns {boolean} The dialog draggable state; draggable when true. + */ + get draggable() { + return this.#internal.draggable; + } + /** + * Set the dialog state; draggable when true. + * + * @param {boolean} draggable - New dialog draggable state; draggable when true. + */ + set draggable(draggable2) { + this.#internal.draggable = draggable2; + this.#updateComponent(); + } + /** + * @returns {boolean} When true auto-management of app focus is enabled. + */ + get focusAuto() { + return this.#internal.focusAuto; + } + /** + * Set the dialog auto-management of app focus. + * + * @param {boolean} focusAuto - New dialog auto-management of app focus. + */ + set focusAuto(focusAuto) { + this.#internal.focusAuto = focusAuto; + this.#updateComponent(); + } + /** + * @returns {boolean} When true the first focusable element that isn't a button is focused. + */ + get focusFirst() { + return this.#internal.focusFirst; + } + /** + * Set the dialog first focusable element state. + * + * @param {boolean} focusFirst - New dialog first focusable element state. + */ + set focusFirst(focusFirst) { + this.#internal.focusFirst = focusFirst; + this.#updateComponent(); + } + /** + * @returns {boolean} When `focusAuto` and `focusKeep` is true; keeps internal focus. + */ + get focusKeep() { + return this.#internal.focusKeep; + } + /** + * Set the dialog `focusKeep` state. When `focusAuto` and `focusKeep` is true; keeps internal focus. + * + * @param {boolean} focusKeep - New dialog `focusKeep` state. + */ + set focusKeep(focusKeep) { + this.#internal.focusKeep = focusKeep; + this.#updateComponent(); + } + /** + * @returns {boolean} When true the dialog is minimizable. + */ + get minimizable() { + return this.#internal.minimizable; + } + /** + * Set the dialog `minimizable` state. When true the dialog is minimizable. + * + * @param {boolean} minimizable - New dialog `minimizable` state. + */ + set minimizable(minimizable) { + this.#internal.minimizable = minimizable; + this.#updateComponent(); + } + /** + * @returns {boolean} When true a modal dialog is displayed. + */ + get modal() { + return this.#internal.modal; + } + /** + * Set the dialog `modal` state. When true a modal dialog is displayed. + * + * @param {boolean} modal - New dialog `modal` state. + */ + set modal(modal) { + this.#internal.modal = modal; + this.#updateComponent(); + } + /** + * @returns {import('./types').TJSDialogModalOptions} Additional options for modal dialog display. + */ + get modalOptions() { + return this.#internal.modalOptions; + } + /** + * Set additional options for modal dialog display. + * + * @param {import('./types').TJSDialogModalOptions} modalOptions - New additional options for modal dialog display. + */ + set modalOptions(modalOptions) { + this.#internal.modalOptions = modalOptions; + this.#updateComponent(); + } + /** + * @returns {boolean} When true and an error is raised in dialog callback functions post a UI error notification. + */ + get notifyError() { + return this.#internal.notifyError; + } + /** + * Set the dialog `notifyError` state. When true and an error is raised in dialog callback functions post a UI error + * notification. + * + * @param {boolean} notifyError - New dialog `notifyError` state. + */ + set notifyError(notifyError) { + this.#internal.notifyError = notifyError; + this.#updateComponent(); + } + /** + * @returns {string | ((application: import('../../index.js').TJSDialog) => any)} Callback invoked when dialog is + * closed; no button option selected. When defined as a string any matching function by name exported from + * content Svelte component is invoked. + */ + get onClose() { + return this.#internal.onClose; + } + /** + * Set callback invoked when dialog is closed; no button option selected. When defined as a string any matching + * function by name exported from content Svelte component is invoked.. + * + * @param {string | ((application: import('../../index.js').TJSDialog) => any)} onClose - New dialog `onClose` state. + */ + set onClose(onClose) { + this.#internal.onClose = onClose; + this.#updateComponent(); + } + /** + * @returns {boolean} Dialog `rejectClose` state. When true and a Promise has been created by {@link TJSDialog.wait} + * and the Promise is not in the process of being resolved or rejected on close of the dialog any `onClose` + * function is invoked and any result that is undefined will cause the Promise to then be rejected.. + */ + get rejectClose() { + return this.#internal.rejectClose; + } + /** + * Set the dialog `rejectClose` state. + * + * @param {boolean} rejectClose - New dialog `rejectClose` state. + */ + set rejectClose(rejectClose) { + this.#internal.rejectClose = rejectClose; + this.#updateComponent(); + } + /** + * @returns {boolean} When true the dialog is resizable. + */ + get resizable() { + return this.#internal.resizable; + } + /** + * Set the dialog `resizable` state. When true the dialog is resizable. + * + * @param {boolean} resizable - New dialog `resizable` state. + */ + set resizable(resizable) { + this.#internal.resizable = resizable; + this.#updateComponent(); + } + /** + * @returns {boolean} When true and resolving any Promises and there are undefined results from any button callbacks + * the button ID is resolved. + */ + get resolveId() { + return this.#internal.resolveId; + } + /** + * Set the dialog `resolveId` state. When true and resolving any Promises and there are undefined results from any + * button callbacks the button ID is resolved. + * + * @param {boolean} resolveId - New dialog `resolveId` state. + */ + set resolveId(resolveId) { + this.#internal.resolveId = resolveId; + this.#updateComponent(); + } + /** + * @returns {string} The dialog window title. + */ + get title() { + return this.#internal.title; + } + /** + * Set the dialog window title. + * + * @param {string} title - New dialog window title. + */ + set title(title2) { + this.#internal.title = title2; + this.#updateComponent(); + } + /** + * @returns {import('./types').TJSDialogTransitionOptions} Transition options for the dialog. + */ + get transition() { + return this.#internal.transition; + } + /** + * Set transition options for the dialog. + * + * @param {import('./types').TJSDialogTransitionOptions} transition - New transition options for the dialog. + */ + set transition(transition) { + this.#internal.transition = transition; + this.#updateComponent(); + } + /** + * @returns {number | null} A specific z-index for the dialog. Pass null for the dialog to act like other + * applications in regard bringing to top when activated. + */ + get zIndex() { + return this.#internal.zIndex; + } + /** + * Set specific z-index for the dialog. + * + * @param {number | null} zIndex - New z-index for the dialog. + */ + set zIndex(zIndex) { + this.#internal.zIndex = zIndex; + this.#updateComponent(); + } + /** + * Provides a way to safely get this dialogs data given an accessor string which describes the + * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries + * to walk. + * + * @param {string} accessor - The path / key to set. You can set multiple levels. + * + * @param {any} [defaultValue] - A default value returned if the accessor is not found. + * + * @returns {any} Value at the accessor. + */ + get(accessor, defaultValue) { + return safeAccess(this.#internal, accessor, defaultValue); + } + /** + * @param {import('./types').TJSDialogOptions} data - Merge provided data object into Dialog data. + */ + merge(data) { + deepMerge(this.#internal, data); + this.#updateComponent(); + } + /** + * Sets the dialog data; this is reactive. + * + * @param {import('./types').TJSDialogOptions} data - Dialog data. + */ + replace(data) { + if (!isObject(data)) { + throw new TypeError(`TJSDialogData replace error: 'data' is not an object'.`); + } + this.#internal = {}; + this.merge(data); + } + /** + * Provides a way to safely set this dialogs data given an accessor string which describes the + * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries + * to walk. + * + * Automatically the dialog data will be updated in the associated DialogShell Svelte component. + * + * @param {string} accessor - The path / key to set. You can set multiple levels. + * + * @param {any} value - Value to set. + * + * @returns {boolean} True if successful. + */ + set(accessor, value) { + const success = safeSet(this.#internal, accessor, value); + if (success) { + this.#updateComponent(); + } + return success; + } + /** + * Updates the data in the Svelte dialog component. + */ + #updateComponent() { + const component = this.#application.svelte.component(0); + if (component?.data) { + component.data = this.#internal; + } + } +} +class TJSDialog extends SvelteApplication { + /** @type {TJSDialogData} */ + #data; + /** @type {ManagedPromise} */ + #managedPromise; + /** + * @param {import('./internal/state-dialog/types').TJSDialogOptions} data - Dialog options. + * + * @param {import('./').SvelteApplicationOptions} [options] - SvelteApplication options. + */ + constructor(data, options = {}) { + super(options); + this.#managedPromise = new ManagedPromise(); + this.#data = new TJSDialogData(this); + this.#data.replace(data); + Object.defineProperty(this.svelte, "dialogComponent", { + get: () => this.svelte?.applicationShell?.dialogComponent + }); + } + /** + * Default options for TJSDialog. Provides a default width and setting `height` to `auto` to always display dialog + * content even if it changes. The default `DialogShell` / `svelte` options should not be changed and instead mount + * the dialog content component by supplying a Svelte configuration object to dialog data `content` field. + * + * @returns {import('./').SvelteApplicationOptions} Default options + */ + static get defaultOptions() { + return deepMerge(super.defaultOptions, { + classes: ["dialog", "tjs-dialog"], + width: 400, + height: "auto", + svelte: { + class: DialogShell, + intro: true, + target: document.body, + props: function() { + return { + data: this.#data, + managedPromise: this.#managedPromise + }; + } + } + }); + } + /** + * Returns the dialog data. + * + * @returns {import('./internal/state-dialog/types').TJSDialogData} Dialog data. + */ + get data() { + return this.#data; + } + /** + * @returns {import('@typhonjs-fvtt/runtime/util/async').ManagedPromise} Returns the managed promise. + */ + get managedPromise() { + return this.#managedPromise; + } + /** + * Close the dialog and un-register references to it within UI mappings. + * This function returns a Promise which resolves once the window closing animation concludes. + * + * @param {object} [options] - Optional parameters. + * + * @param {boolean} [options.force] - Force close regardless of render state. + * + * @returns {Promise} A Promise which resolves once the application is closed with the callback value or + * `true`. + */ + async close(options) { + try { + if (this.#managedPromise.isActive && !this.#managedPromise.isProcessing) { + const result = TJSDialog.#invokeFn(this.#data.onClose, this, null); + const rejectClose = typeof this.#data.rejectClose === "boolean" ? this.#data.rejectClose : false; + if (rejectClose && result === null) { + this.#managedPromise.reject(new Error("TJSDialog was closed without a choice being made.")); + } else { + this.#managedPromise.resolve(result); + } + } + } catch (err) { + const notifyError = typeof this.#data.notifyError === "boolean" ? this.#data.notifyError : true; + if (notifyError) { + globalThis.ui.notifications.error(err, { console: false }); + } + if (!this.#managedPromise.reject(err)) { + throw err; + } + } finally { + await super.close(options); + } + } + /** + * Brings to top or renders this dialog returning a Promise that is resolved any button pressed or when the dialog + * is closed. + * + * Creates an anonymous data defined TJSDialog returning a Promise that can be awaited upon for the user to make a + * choice. + * + * Note: `null` is returned if the dialog is closed without a user making a choice. + * + * @template T + * + * @param {object} [options] - Options. + * + * @param {boolean} [options.reuse=false] - When true if there is an existing managed Promise this allows multiple + * sources to await on the same result. + * + * @returns {Promise} A promise for dialog resolution. + */ + async wait(options) { + if (this.rendered) { + this.bringToTop(); + } else { + this.render(true, { focus: true }); + } + return this.#managedPromise.create(options); + } + // --------------------------------------------------------------------------------------------------------------- + /** + * A helper factory method to create simple confirmation dialog windows which consist of simple yes / no prompts. + * If you require more flexibility, a custom TJSDialog instance is preferred. The default focused button is 'yes'. + * You can change the default focused button by setting `default` to `yes` or `no`. + * + * @template T + * + * @param {import('./internal/state-dialog/types').TJSDialogOptions & { + * onYes?: string|((application: TJSDialog) => any), + * onNo?: string|((application: TJSDialog) => any) + * }} [data] - Confirm dialog options. + * + * @param {string|((application: TJSDialog) => any)} [data.onYes] - Callback function upon `yes`; may be an async + * function. When defined as a string any matching function by name exported from content Svelte component is + * invoked. + * + * @param {string|((application: TJSDialog) => any)} [data.onNo] - Callback function upon `no`; may be an async + * function. When defined as a string any matching function by name exported from content Svelte component is + * invoked. + * + * @param {import('./').SvelteApplicationOptions} [options] SvelteApplication options passed to the TJSDialog + * constructor. + * + * @returns {Promise} A promise which resolves with result of yes / no callbacks or true / false. + * + * @example + * const result = await TJSDialog.confirm({ + * title: 'A Yes or No Question', + * content: '

Choose wisely.

', + * onYes: () => 'YES Result' + * onNo: () => 'NO Result' + * }); + * + * // Logs 'YES result', 'NO Result', or null if the user closed the dialog without making a selection. + * console.log(result); + */ + static async confirm({ onYes, onNo, ...data } = {}, options = {}) { + const mergedButtons = deepMerge({ + yes: { + icon: "fas fa-check", + label: "Yes" + }, + no: { + icon: "fas fa-times", + label: "No" + } + }, data.buttons ?? {}); + return this.wait({ + ...data, + buttons: deepMerge(mergedButtons, { + yes: { + onPress: (application) => this.#invokeFn(onYes, application, true) + }, + no: { + onPress: (application) => this.#invokeFn(onNo, application, false) + } + }), + default: data.default ?? "yes" + }, options); + } + /** + * A helper method to invoke a callback function directly or lookup an exported function with the same name from any + * content Svelte component to invoke. This is used internally to apply default values for `confirm` and `prompt`. + * + * @param {string|((application: TJSDialog) => any)} callback - Callback function to invoke; may be an async + * function. When defined as a string any matching function by name exported from content Svelte component is + * invoked. + * + * @param {TJSDialog} application - TJSDialog instance passed to callback. + * + * @param {*} [defaultResult] - An optional default result to return; undefined if not specified. + * + * @returns {*} Result. + * + * @internal + */ + static #invokeFn(callback, application, defaultResult = void 0) { + let result = defaultResult; + switch (typeof callback) { + case "function": + result = callback(application); + break; + case "string": { + const dialogComponent = application?.svelte?.dialogComponent; + if (dialogComponent !== void 0 && typeof dialogComponent?.[callback] === "function") { + result = dialogComponent?.[callback](application); + } else { + if (dialogComponent === void 0) { + console.warn(`[TRL] TJSDialog warning: 'onPress' defined as a string with no associated content Svelte component.`); + } else if (typeof dialogComponent?.[callback] !== "function") { + console.warn(`[TRL] TJSDialog warning: The content Svelte component does not contain an associated function '${callback}'. Did you remember to add '' and export the function?`); + } + } + break; + } + } + return result; + } + /** + * A helper factory method to display a basic "prompt" style TJSDialog with a single button. + * + * @template T + * + * @param {import('./internal/state-dialog/types').TJSDialogOptions & { + * onOk?: string|((application: TJSDialog) => any), + * label?: string, + * icon?: string + * }} [data] - Prompt dialog options that includes any TJSDialog options along with the following optional fields: + * + * @param {string|((application: TJSDialog) => any)} [data.onOk] - Callback function upon `ok`; may be an async + * function. When defined as a string any matching function by name exported from content Svelte component is + * invoked. + * + * @param {string} [data.label] - The OK prompt button text. + * + * @param {string} [data.icon="fas fa-check"] - Set another icon besides `fas fa-check` for button. + * + * @param {import('./').SvelteApplicationOptions} [options] SvelteApplication options passed to the TJSDialog + * constructor. + * + * @returns {Promise} The returned value from the provided callback function or `true` if the button + * is pressed. + * + * @example + * const result = await TJSDialog.prompt({ + * title: 'Are you OK?', + * content: '

Are you OK?.

', + * label: 'Feeling Fine!' + * onOk: () => 'OK' + * }); + * + * // Logs 'OK' or null if the user closed the dialog without making a selection. + * console.log(result); + */ + static async prompt({ onOk, label, icon = "fas fa-check", ...data } = {}, options = {}) { + return this.wait({ + ...data, + buttons: { + ok: { + icon, + label, + onPress: (application) => this.#invokeFn(onOk, application, true) + } + }, + default: "ok" + }, options); + } + /** + * Creates an anonymous data defined TJSDialog returning a Promise that can be awaited upon for the user to make a + * choice. + * + * Note: By default `null` is returned if the dialog is closed without a user making a choice. + * + * @template T + * + * @param {import('./internal/state-dialog/types').TJSDialogOptions} data - Dialog data passed to the TJSDialog constructor. + * + * @param {import('./').SvelteApplicationOptions} [options] SvelteApplication options passed to the TJSDialog + * constructor. + * + * @returns {Promise} A Promise that resolves to the chosen result. + */ + static async wait(data, options = {}) { + if (!isObject(data)) { + throw new TypeError(`TJSDialog.wait error: 'data' is not an object'.`); + } + return new this({ ...data }, options).wait(); + } +} +Hooks.on("PopOut:loading", (app) => { + if (app instanceof SvelteApplication) { + app.position.enabled = false; + } +}); +Hooks.on("PopOut:popin", (app) => { + if (app instanceof SvelteApplication) { + app.position.enabled = true; + } +}); +Hooks.on("PopOut:close", (app) => { + if (app instanceof SvelteApplication) { + app.position.enabled = true; + } +}); +class DynReducerUtils { + /** + * Checks for array equality between two arrays of numbers. + * + * @param a - Array A + * + * @param b - Array B + * + * @returns Arrays are equal. + */ + static arrayEquals(a, b) { + if (a === b) { + return true; + } + if (a === null || b === null) { + return false; + } + if (a.length !== b.length) { + return false; + } + for (let cntr = a.length; --cntr >= 0; ) { + if (a[cntr] !== b[cntr]) { + return false; + } + } + return true; + } + /** + * Provides a solid string hashing algorithm. + * + * Sourced from: https://stackoverflow.com/a/52171480 + * + * @param str - String to hash. + * + * @param seed - A seed value altering the hash. + * + * @returns Hash code. + */ + static hashString(str, seed = 0) { + let h1 = 3735928559 ^ seed, h2 = 1103547991 ^ seed; + for (let ch, i = 0; i < str.length; i++) { + ch = str.charCodeAt(i); + h1 = Math.imul(h1 ^ ch, 2654435761); + h2 = Math.imul(h2 ^ ch, 1597334677); + } + h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909); + h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909); + return 4294967296 * (2097151 & h2) + (h1 >>> 0); + } + /** + * Converts an unknown value for hashing purposes in {@link AdapterIndexer.calcHashUpdate}. + * + * Currently objects / Map w/ object keys is not supported. Potentially can include `object-hash` to handle this + * case, but it is not common to use objects as keys in Maps. + * + * @param value - An unknown value to convert to a number. + */ + static hashUnknown(value) { + if (value === null || value === void 0) { + return 0; + } + let result = 0; + switch (typeof value) { + case "boolean": + result = value ? 1 : 0; + break; + case "bigint": + result = Number(BigInt.asIntN(64, value)); + break; + case "function": + result = this.hashString(value.name); + break; + case "number": + result = Number.isFinite(value) ? value : 0; + break; + case "object": + break; + case "string": + result = this.hashString(value); + break; + case "symbol": + result = this.hashString(Symbol.keyFor(value)); + break; + } + return result; + } + /** + * @param target - + * + * @param Prototype - + * + * @returns target constructor function has Prototype. + */ + static hasPrototype(target, Prototype) { + if (typeof target !== "function") { + return false; + } + if (target === Prototype) { + return true; + } + for (let proto = Object.getPrototypeOf(target); proto; proto = Object.getPrototypeOf(proto)) { + if (proto === Prototype) { + return true; + } + } + return false; + } + /** + * Provides a utility method to determine if the given data is iterable / implements iterator protocol. + * + * @param data - Data to verify as iterable. + * + * @returns Is data iterable. + */ + static isIterable(data) { + return data !== null && data !== void 0 && typeof data === "object" && typeof data[Symbol.iterator] === "function"; + } +} +class AdapterDerived { + #hostData; + #DerivedReducerCtor; + #parentIndex; + #derived = /* @__PURE__ */ new Map(); + #destroyed = false; + /** + * @param hostData - Hosted data structure. + * + * @param parentIndex - Any associated parent index API. + * + * @param DerivedReducerCtor - The default derived reducer constructor function. + */ + constructor(hostData, parentIndex, DerivedReducerCtor) { + this.#hostData = hostData; + this.#parentIndex = parentIndex; + this.#DerivedReducerCtor = DerivedReducerCtor; + Object.freeze(this); + } + /** + * Creates a new derived reducer. + * + * @param options - Options defining the new derived reducer. + * + * @returns Newly created derived reducer. + */ + create(options) { + if (this.#destroyed) { + throw Error(`AdapterDerived.create error: this instance has been destroyed.`); + } + let name; + let rest = {}; + let ctor; + const DerivedReducerCtor = this.#DerivedReducerCtor; + if (typeof options === "string") { + name = options; + ctor = DerivedReducerCtor; + } else if (typeof options === "function" && DynReducerUtils.hasPrototype(options, DerivedReducerCtor)) { + ctor = options; + } else if (typeof options === "object" && options !== null) { + ({ name, ctor = DerivedReducerCtor, ...rest } = options); + } else { + throw new TypeError(`AdapterDerived.create error: 'options' does not conform to allowed parameters.`); + } + if (!DynReducerUtils.hasPrototype(ctor, DerivedReducerCtor)) { + throw new TypeError(`AdapterDerived.create error: 'ctor' is not a '${DerivedReducerCtor?.name}'.`); + } + name = name ?? ctor?.name; + if (typeof name !== "string") { + throw new TypeError(`AdapterDerived.create error: 'name' is not a string.`); + } + const derivedReducer = new ctor(this.#hostData, this.#parentIndex, rest); + this.#derived.set(name, derivedReducer); + return derivedReducer; + } + /** + * Removes all derived reducers and associated subscriptions. + */ + clear() { + if (this.#destroyed) { + return; + } + for (const reducer of this.#derived.values()) { + reducer.destroy(); + } + this.#derived.clear(); + } + /** + * Deletes and destroys a derived reducer by name. + * + * @param name - Name of the derived reducer. + */ + delete(name) { + if (this.#destroyed) { + throw Error(`AdapterDerived.delete error: this instance has been destroyed.`); + } + const reducer = this.#derived.get(name); + if (reducer) { + reducer.destroy(); + } + return this.#derived.delete(name); + } + /** + * Removes all derived reducers, subscriptions, and cleans up all resources. + */ + destroy() { + if (this.#destroyed) { + return; + } + this.clear(); + this.#hostData = [null]; + this.#parentIndex = null; + this.#destroyed = true; + } + /** + * Returns an existing derived reducer. + * + * @param name - Name of derived reducer. + */ + get(name) { + if (this.#destroyed) { + throw Error(`AdapterDerived.get error: this instance has been destroyed.`); + } + return this.#derived.get(name); + } + /** + * Updates all managed derived reducer indexes. + * + * @param [force] - Force an update to subscribers. + */ + update(force = false) { + if (this.#destroyed) { + return; + } + for (const reducer of this.#derived.values()) { + reducer.index.update(force); + } + } +} +class AdapterFilters { + #filtersData; + #indexUpdate; + #mapUnsubscribe = /* @__PURE__ */ new Map(); + /** + * @param indexUpdate - update function for the indexer. + * + * @param filtersAdapter - Stores the filter function data. + */ + constructor(indexUpdate, filtersAdapter) { + this.#indexUpdate = indexUpdate; + this.#filtersData = filtersAdapter; + Object.freeze(this); + } + /** + * @returns Returns the length of the filter data. + */ + get length() { + return this.#filtersData.filters.length; + } + /** + * Provides an iterator for filters. + * + * @yields {DataFilter} + */ + *[Symbol.iterator]() { + if (this.#filtersData.filters.length === 0) { + return; + } + for (const entry of this.#filtersData.filters) { + yield { ...entry }; + } + } + /** + * @param filters - + */ + add(...filters) { + let subscribeCount = 0; + for (const filter of filters) { + const filterType = typeof filter; + if (filterType !== "function" && (filterType !== "object" || filter === null)) { + throw new TypeError(`AdapterFilters error: 'filter' is not a function or object.`); + } + let data = void 0; + let subscribeFn = void 0; + if (filterType === "function") { + data = { + id: void 0, + filter, + weight: 1 + }; + subscribeFn = filter.subscribe; + } else if (filterType === "object") { + if ("filter" in filter) { + if (typeof filter.filter !== "function") { + throw new TypeError(`AdapterFilters error: 'filter' attribute is not a function.`); + } + if (filter.weight !== void 0 && typeof filter.weight !== "number" || (filter.weight < 0 || filter.weight > 1)) { + throw new TypeError(`AdapterFilters error: 'weight' attribute is not a number between '0 - 1' inclusive.`); + } + data = { + id: filter.id !== void 0 ? filter.id : void 0, + filter: filter.filter, + weight: filter.weight || 1 + }; + subscribeFn = filter.filter.subscribe ?? filter.subscribe; + } else { + throw new TypeError(`AdapterFilters error: 'filter' attribute is not a function.`); + } + } + const index = this.#filtersData.filters.findIndex((value) => { + return data.weight < value.weight; + }); + if (index >= 0) { + this.#filtersData.filters.splice(index, 0, data); + } else { + this.#filtersData.filters.push(data); + } + if (typeof subscribeFn === "function") { + const unsubscribe = subscribeFn(this.#indexUpdate); + if (typeof unsubscribe !== "function") { + throw new TypeError("AdapterFilters error: Filter has subscribe function, but no unsubscribe function is returned."); + } + if (this.#mapUnsubscribe.has(data.filter)) { + throw new Error("AdapterFilters error: Filter added already has an unsubscribe function registered."); + } + this.#mapUnsubscribe.set(data.filter, unsubscribe); + subscribeCount++; + } + } + if (subscribeCount < filters.length) { + this.#indexUpdate(); + } + } + /** + * Clears and removes all filters. + */ + clear() { + this.#filtersData.filters.length = 0; + for (const unsubscribe of this.#mapUnsubscribe.values()) { + unsubscribe(); + } + this.#mapUnsubscribe.clear(); + this.#indexUpdate(); + } + /** + * @param filters - + */ + remove(...filters) { + const length = this.#filtersData.filters.length; + if (length === 0) { + return; + } + for (const data of filters) { + const actualFilter = typeof data === "function" ? data : data !== null && typeof data === "object" ? data.filter : void 0; + if (!actualFilter) { + continue; + } + for (let cntr = this.#filtersData.filters.length; --cntr >= 0; ) { + if (this.#filtersData.filters[cntr].filter === actualFilter) { + this.#filtersData.filters.splice(cntr, 1); + let unsubscribe = void 0; + if (typeof (unsubscribe = this.#mapUnsubscribe.get(actualFilter)) === "function") { + unsubscribe(); + this.#mapUnsubscribe.delete(actualFilter); + } + } + } + } + if (length !== this.#filtersData.filters.length) { + this.#indexUpdate(); + } + } + /** + * Remove filters by the provided callback. The callback takes 3 parameters: `id`, `filter`, and `weight`. + * Any truthy value returned will remove that filter. + * + * @param callback - Callback function to evaluate each filter entry. + */ + removeBy(callback) { + const length = this.#filtersData.filters.length; + if (length === 0) { + return; + } + if (typeof callback !== "function") { + throw new TypeError(`AdapterFilters error: 'callback' is not a function.`); + } + this.#filtersData.filters = this.#filtersData.filters.filter((data) => { + const remove = callback.call(callback, { ...data }); + if (remove) { + let unsubscribe; + if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.filter)) === "function") { + unsubscribe(); + this.#mapUnsubscribe.delete(data.filter); + } + } + return !remove; + }); + if (length !== this.#filtersData.filters.length) { + this.#indexUpdate(); + } + } + /** + * @param ids - Removes filters by ID. + */ + removeById(...ids) { + const length = this.#filtersData.filters.length; + if (length === 0) { + return; + } + this.#filtersData.filters = this.#filtersData.filters.filter((data) => { + let remove = 0; + for (const id2 of ids) { + remove |= data.id === id2 ? 1 : 0; + } + if (!!remove) { + let unsubscribe; + if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.filter)) === "function") { + unsubscribe(); + this.#mapUnsubscribe.delete(data.filter); + } + } + return !remove; + }); + if (length !== this.#filtersData.filters.length) { + this.#indexUpdate(); + } + } +} +class AdapterIndexer { + derivedAdapter; + filtersData; + hostData; + hostUpdate; + indexData; + sortData; + sortFn; + destroyed = false; + /** + * @param hostData - Hosted data structure. + * + * @param hostUpdate - Host update function invoked on index updates. + * + * @param [parentIndexer] - Any associated parent index API. + * + * @returns Indexer adapter instance. + */ + constructor(hostData, hostUpdate, parentIndexer) { + this.hostData = hostData; + this.hostUpdate = hostUpdate; + this.indexData = { index: null, hash: null, reversed: false, parent: parentIndexer }; + } + /** + * @returns Returns whether the index is active. + */ + get active() { + return this.filtersData.filters.length > 0 || this.sortData.compareFn !== null || this.indexData.parent?.active === true; + } + /** + * @returns Returns length of reduced index. + */ + get length() { + return this.indexData.index ? this.indexData.index.length : 0; + } + /* c8 ignore start */ + /** + * @returns Returns reversed state. + */ + get reversed() { + return this.indexData.reversed; + } + /* c8 ignore end */ + /** + * @param reversed - New reversed state. + */ + set reversed(reversed) { + this.indexData.reversed = reversed; + } + // ------------------------------------------------------------------------------------------------------------------- + /** + * Calculates a new hash value for the new index array if any. If the new index array is null then the hash value + * is set to null. Set calculated new hash value to the index adapter hash value. + * + * After hash generation compare old and new hash values and perform an update if they are different. If they are + * equal check for array equality between the old and new index array and perform an update if they are not equal. + * + * @param oldIndex - Old index array. + * + * @param oldHash - Old index hash value. + * + * @param [force=false] - When true forces an update to subscribers. + */ + calcHashUpdate(oldIndex, oldHash, force = false) { + const actualForce = typeof force === "boolean" ? force : ( + /* c8 ignore next */ + false + ); + let newHash = null; + const newIndex = this.indexData.index; + if (newIndex) { + for (let cntr = newIndex.length; --cntr >= 0; ) { + newHash ^= DynReducerUtils.hashUnknown(newIndex[cntr]) + 2654435769 + (newHash << 6) + (newHash >> 2); + } + } + this.indexData.hash = newHash; + if (actualForce || (oldHash === newHash ? !DynReducerUtils.arrayEquals(oldIndex, newIndex) : true)) { + this.hostUpdate(); + } + } + /** + * Destroys all resources. + */ + destroy() { + if (this.destroyed) { + return; + } + this.indexData.index = null; + this.indexData.hash = null; + this.indexData.reversed = null; + this.indexData.parent = null; + this.destroyed = true; + } + /** + * Store associated filter and sort data that are constructed after the indexer. + * + * @param filtersData - Associated AdapterFilters instance. + * + * @param sortData - Associated AdapterSort instance. + * + * @param derivedAdapter - Associated AdapterDerived instance. + */ + initAdapters(filtersData, sortData, derivedAdapter) { + this.filtersData = filtersData; + this.sortData = sortData; + this.derivedAdapter = derivedAdapter; + this.sortFn = this.createSortFn(); + } +} +class AdapterSort { + #sortData; + #indexUpdate; + #unsubscribe; + /** + * @param indexUpdate - Function to update indexer. + * + * @param sortData - Storage for compare function. + */ + constructor(indexUpdate, sortData) { + this.#indexUpdate = indexUpdate; + this.#sortData = sortData; + Object.freeze(this); + } + /** + * Clears & removes any assigned sort function and triggers an index update. + */ + clear() { + const oldCompareFn = this.#sortData.compareFn; + this.#sortData.compareFn = null; + if (typeof this.#unsubscribe === "function") { + this.#unsubscribe(); + this.#unsubscribe = void 0; + } + if (typeof oldCompareFn === "function") { + this.#indexUpdate(); + } + } + /** + * @param data - A callback function that compares two values. Return > 0 to sort b before a; + * < 0 to sort a before b; or 0 to keep original order of a & b. + * + * Note: You can set a compare function that also has a subscribe function attached as the `subscribe` attribute. + * + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#parameters + */ + set(data) { + if (typeof this.#unsubscribe === "function") { + this.#unsubscribe(); + this.#unsubscribe = void 0; + } + let compareFn = void 0; + let subscribeFn = void 0; + switch (typeof data) { + case "function": + compareFn = data; + subscribeFn = data.subscribe; + break; + case "object": + if (data === null) { + break; + } + if (typeof data.compare !== "function") { + throw new TypeError(`AdapterSort error: 'compare' attribute is not a function.`); + } + compareFn = data.compare; + subscribeFn = data.compare.subscribe ?? data.subscribe; + break; + } + if (typeof compareFn === "function") { + this.#sortData.compareFn = compareFn; + } else { + const oldCompareFn = this.#sortData.compareFn; + this.#sortData.compareFn = null; + if (typeof oldCompareFn === "function") { + this.#indexUpdate(); + } + return; + } + if (typeof subscribeFn === "function") { + this.#unsubscribe = subscribeFn(this.#indexUpdate); + if (typeof this.#unsubscribe !== "function") { + throw new Error(`AdapterSort error: sort has 'subscribe' function, but no 'unsubscribe' function is returned.`); + } + } else { + this.#indexUpdate(); + } + } +} +class IndexerAPI { + #indexData; + /** + * Provides a getter to determine if the index is active. + */ + active; + /** + * Provides length of reduced / indexed elements. + */ + length; + /** + * Manually invoke an update of the index. + * + * @param force - Force update to any subscribers. + */ + update; + constructor(adapterIndexer) { + this.#indexData = adapterIndexer.indexData; + this.update = adapterIndexer.update.bind(adapterIndexer); + Object.defineProperties(this, { + active: { get: () => adapterIndexer.active }, + length: { get: () => adapterIndexer.length } + }); + Object.freeze(this); + } + /** + * - Current hash value of the index. + */ + get hash() { + return this.#indexData.hash; + } + /** + * Provides an iterator over the index array. + * + * @yields {K} + */ + *[Symbol.iterator]() { + const indexData = this.#indexData; + if (!indexData.index) { + return; + } + const reversed = indexData.reversed; + const length = indexData.index.length; + if (reversed) { + for (let cntr = length; --cntr >= 0; ) { + yield indexData.index[cntr]; + } + } else { + for (let cntr = 0; cntr < length; cntr++) { + yield indexData.index[cntr]; + } + } + } +} +class DerivedAPI { + /** + * Removes all derived reducers and associated subscriptions. + */ + clear; + /** + * @param options - Options for creating a reducer. + * + * @returns Newly created derived reducer. + */ + create; + /** + * Deletes and destroys a derived reducer. + * + * @param name - Name of the derived reducer + */ + delete; + /** + * Removes all derived reducers, associated subscriptions, and cleans up all resources. + */ + destroy; + /** + * Returns an existing derived reducer. + * + * @param name - Name of derived reducer. + */ + get; + constructor(adapterDerived) { + this.clear = adapterDerived.clear.bind(adapterDerived); + this.create = adapterDerived.create.bind(adapterDerived); + this.delete = adapterDerived.delete.bind(adapterDerived); + this.destroy = adapterDerived.destroy.bind(adapterDerived); + this.get = adapterDerived.get.bind(adapterDerived); + Object.freeze(this); + } +} +class Indexer extends AdapterIndexer { + /** + * @inheritDoc + */ + createSortFn() { + return (a, b) => this.sortData.compareFn(this.hostData[0].get(a), this.hostData[0].get(b)); + } + /** + * Provides the custom filter / reduce step that is ~25-40% faster than implementing with `Array.reduce`. + * + * Note: Other loop unrolling techniques like Duff's Device gave a slight faster lower bound on large data sets, + * but the maintenance factor is not worth the extra complication. + * + * @returns New filtered index array. + */ + reduceImpl() { + const data = []; + const map = this.hostData[0]; + if (!map) { + return data; + } + const filters = this.filtersData.filters; + let include = true; + const parentIndex = this.indexData.parent; + if (DynReducerUtils.isIterable(parentIndex) && parentIndex.active) { + for (const key of parentIndex) { + const value = map.get(key); + include = true; + for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) { + if (!filters[filCntr].filter(value)) { + include = false; + break; + } + } + if (include) { + data.push(key); + } + } + } else { + for (const key of map.keys()) { + include = true; + const value = map.get(key); + for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) { + if (!filters[filCntr].filter(value)) { + include = false; + break; + } + } + if (include) { + data.push(key); + } + } + } + return data; + } + /** + * Update the reducer indexes. If there are changes subscribers are notified. If data order is changed externally + * pass in true to force an update to subscribers. + * + * @param [force=false] - When true forces an update to subscribers. + */ + update(force = false) { + if (this.destroyed) { + return; + } + const oldIndex = this.indexData.index; + const oldHash = this.indexData.hash; + const map = this.hostData[0]; + const parentIndex = this.indexData.parent; + if (this.filtersData.filters.length === 0 && !this.sortData.compareFn || this.indexData.index && map?.size !== this.indexData.index.length) { + this.indexData.index = null; + } + if (this.filtersData.filters.length > 0) { + this.indexData.index = this.reduceImpl(); + } + if (!this.indexData.index && parentIndex?.active) { + this.indexData.index = [...parentIndex]; + } + if (this.sortData.compareFn && map instanceof Map) { + if (!this.indexData.index) { + this.indexData.index = this.indexData.index = [...map.keys()]; + } + this.indexData.index.sort(this.sortFn); + } + this.calcHashUpdate(oldIndex, oldHash, force); + this.derivedAdapter?.update(force); + } +} +class DynMapReducerDerived { + #map; + #derived; + #derivedPublicAPI; + #filters; + #filtersData = { filters: [] }; + #index; + #indexPublicAPI; + #reversed = false; + #sort; + #sortData = { compareFn: null }; + #subscriptions = []; + #destroyed = false; + /** + * @param map - Data host Map. + * + * @param parentIndex - Parent indexer. + * + * @param options - Any filters and sort functions to apply. + */ + constructor(map, parentIndex, options) { + this.#map = map; + this.#index = new Indexer(this.#map, this.#updateSubscribers.bind(this), parentIndex); + this.#indexPublicAPI = new IndexerAPI(this.#index); + this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData); + this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData); + this.#derived = new AdapterDerived(this.#map, this.#indexPublicAPI, DynMapReducerDerived); + this.#derivedPublicAPI = new DerivedAPI(this.#derived); + this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived); + let filters = void 0; + let sort = void 0; + if (options !== void 0 && ("filters" in options || "sort" in options)) { + if (options.filters !== void 0) { + if (DynReducerUtils.isIterable(options.filters)) { + filters = options.filters; + } else { + throw new TypeError(`DerivedMapReducer error (DataDerivedOptions): 'filters' attribute is not iterable.`); + } + } + if (options.sort !== void 0) { + if (typeof options.sort === "function") { + sort = options.sort; + } else if (typeof options.sort === "object" && options.sort !== null) { + sort = options.sort; + } else { + throw new TypeError(`DerivedMapReducer error (DataDerivedOptions): 'sort' attribute is not a function or object.`); + } + } + } + if (filters) { + this.filters.add(...filters); + } + if (sort) { + this.sort.set(sort); + } + this.initialize(); + } + /** + * Returns the internal data of this instance. Be careful! + * + * Note: The returned map is the same map set by the main reducer. If any changes are performed to the data + * externally do invoke {@link IndexerAPI.update} with `true` to recalculate the index and notify all subscribers. + * + * @returns The internal data. + */ + get data() { + return this.#map[0]; + } + /** + * @returns Derived public API. + */ + get derived() { + return this.#derivedPublicAPI; + } + /** + * @returns The filters adapter. + */ + get filters() { + return this.#filters; + } + /** + * Returns the Indexer public API. + * + * @returns Indexer API - is also iterable. + */ + get index() { + return this.#indexPublicAPI; + } + /** + * Returns whether this derived reducer is destroyed. + */ + get destroyed() { + return this.#destroyed; + } + /** + * @returns Main data / items length or indexed length. + */ + get length() { + const map = this.#map[0]; + return this.#index.active ? this.index.length : map ? map.size : 0; + } + /** + * @returns Gets current reversed state. + */ + get reversed() { + return this.#reversed; + } + /** + * @returns The sort adapter. + */ + get sort() { + return this.#sort; + } + /** + * Sets reversed state and notifies subscribers. + * + * @param reversed - New reversed state. + */ + set reversed(reversed) { + if (typeof reversed !== "boolean") { + throw new TypeError(`DerivedMapReducer.reversed error: 'reversed' is not a boolean.`); + } + this.#reversed = reversed; + this.#index.reversed = reversed; + this.index.update(true); + } + /** + * Removes all derived reducers, subscriptions, and cleans up all resources. + */ + destroy() { + this.#destroyed = true; + this.#map = [null]; + this.#index.update(true); + this.#subscriptions.length = 0; + this.#derived.destroy(); + this.#index.destroy(); + this.#filters.clear(); + this.#sort.clear(); + } + /** + * Provides a callback for custom derived reducers to initialize any data / custom configuration. This allows + * child classes to avoid implementing the constructor. + * + * @protected + */ + initialize() { + } + /** + * Provides an iterator for data stored in DerivedMapReducer. + * + * @yields {T} + */ + *[Symbol.iterator]() { + const map = this.#map[0]; + if (this.#destroyed || map === null || map?.size === 0) { + return; + } + if (this.#index.active) { + for (const key of this.index) { + yield map.get(key); + } + } else { + if (this.reversed) { + const values = [...map.values()]; + for (let cntr = values.length; --cntr >= 0; ) { + yield values[cntr]; + } + } else { + for (const value of map.values()) { + yield value; + } + } + } + } + // ------------------------------------------------------------------------------------------------------------------- + /** + * Subscribe to this DerivedMapReducer. + * + * @param handler - Callback function that is invoked on update / changes. Receives `this` reference. + * + * @returns Unsubscribe function. + */ + subscribe(handler) { + this.#subscriptions.push(handler); + handler(this); + return () => { + const index = this.#subscriptions.findIndex((sub) => sub === handler); + if (index >= 0) { + this.#subscriptions.splice(index, 1); + } + }; + } + /** + * Updates subscribers on changes. + */ + #updateSubscribers() { + for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) { + this.#subscriptions[cntr](this); + } + } +} +class DynMapReducer { + #map = [null]; + #derived; + #derivedPublicAPI; + #filters; + #filtersData = { filters: [] }; + #index; + #indexPublicAPI; + #reversed = false; + #sort; + #sortData = { compareFn: null }; + #subscriptions = []; + #destroyed = false; + /** + * Initializes DynMapReducer. Any iterable is supported for initial data. Take note that if `data` is an array it + * will be used as the host array and not copied. All non-array iterables otherwise create a new array / copy. + * + * @param [data] - Data iterable to store if array or copy otherwise. + */ + constructor(data) { + let dataMap = void 0; + let filters = void 0; + let sort = void 0; + if (data === null) { + throw new TypeError(`DynMapReducer error: 'data' is not an object or Map.`); + } + if (data !== void 0 && typeof data !== "object" && !(data instanceof Map)) { + throw new TypeError(`DynMapReducer error: 'data' is not an object or Map.`); + } + if (data !== void 0 && data instanceof Map) { + dataMap = data; + } else if (data !== void 0 && ("data" in data || "filters" in data || "sort" in data)) { + if (data.data !== void 0 && !(data.data instanceof Map)) { + throw new TypeError(`DynMapReducer error (DataDynMap): 'data' attribute is not a Map.`); + } + dataMap = data.data; + if (data.filters !== void 0) { + if (DynReducerUtils.isIterable(data.filters)) { + filters = data.filters; + } else { + throw new TypeError(`DynMapReducer error (DataDynMap): 'filters' attribute is not iterable.`); + } + } + if (data.sort !== void 0) { + if (typeof data.sort === "function") { + sort = data.sort; + } else if (typeof data.sort === "object" && data.sort !== null) { + sort = data.sort; + } else { + throw new TypeError(`DynMapReducer error (DataDynMap): 'sort' attribute is not a function or object.`); + } + } + } + if (dataMap) { + this.#map[0] = dataMap; + } + this.#index = new Indexer(this.#map, this.#updateSubscribers.bind(this)); + this.#indexPublicAPI = new IndexerAPI(this.#index); + this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData); + this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData); + this.#derived = new AdapterDerived(this.#map, this.#indexPublicAPI, DynMapReducerDerived); + this.#derivedPublicAPI = new DerivedAPI(this.#derived); + this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived); + if (filters) { + this.filters.add(...filters); + } + if (sort) { + this.sort.set(sort); + } + this.initialize(); + } + /** + * Returns the internal data of this instance. Be careful! + * + * Note: When a map is set as data then that map is used as the internal data. If any changes are + * performed to the data externally do invoke {@link AdapterIndexer.index.update} with `true` to recalculate the + * index and notify all subscribers. + * + * @returns The internal data. + */ + get data() { + return this.#map[0]; + } + /** + * @returns Derived public API. + */ + get derived() { + return this.#derivedPublicAPI; + } + /** + * @returns The filters adapter. + */ + get filters() { + return this.#filters; + } + /** + * @returns Returns the Indexer public API. + */ + get index() { + return this.#indexPublicAPI; + } + /** + * Returns whether this instance is destroyed. + */ + get destroyed() { + return this.#destroyed; + } + /** + * Gets the main data / items length. + * + * @returns {number} Main data / items length. + */ + get length() { + const map = this.#map[0]; + return this.#index.active ? this.#indexPublicAPI.length : map ? map.size : 0; + } + /** + * Gets current reversed state. + * + * @returns {boolean} Reversed state. + */ + get reversed() { + return this.#reversed; + } + /** + * @returns The sort adapter. + */ + get sort() { + return this.#sort; + } + /** + * Sets reversed state and notifies subscribers. + * + * @param reversed - New reversed state. + */ + set reversed(reversed) { + if (typeof reversed !== "boolean") { + throw new TypeError(`DynMapReducer.reversed error: 'reversed' is not a boolean.`); + } + this.#reversed = reversed; + this.#index.reversed = reversed; + this.index.update(true); + } + /** + * Removes all derived reducers, subscriptions, and cleans up all resources. + */ + destroy() { + if (this.#destroyed) { + return; + } + this.#destroyed = true; + this.#derived.destroy(); + this.#map = [null]; + this.index.update(true); + this.#subscriptions.length = 0; + this.#index.destroy(); + this.#filters.clear(); + this.#sort.clear(); + } + /** + * Provides a callback for custom reducers to initialize any data / custom configuration. This allows + * child classes to avoid implementing the constructor. + * + * @protected + */ + initialize() { + } + /** + * Removes internal data and pushes new data. This does not destroy any initial array set to internal data unless + * `replace` is set to true. + * + * @param data - New data to set to internal data. + * + * @param replace=false - New data to set to internal data. + */ + setData(data, replace = false) { + if (data !== null && !(data instanceof Map)) { + throw new TypeError(`DynMapReducer.setData error: 'data' is not iterable.`); + } + if (typeof replace !== "boolean") { + throw new TypeError(`DynMapReducer.setData error: 'replace' is not a boolean.`); + } + const map = this.#map[0]; + if (!(map instanceof Map) || replace) { + this.#map[0] = data instanceof Map ? data : null; + } else if (data instanceof Map && map instanceof Map) { + const removeKeySet = new Set(map.keys()); + for (const key of data.keys()) { + map.set(key, data.get(key)); + if (removeKeySet.has(key)) { + removeKeySet.delete(key); + } + } + for (const key of removeKeySet) { + map.delete(key); + } + } else if (data === null) { + this.#map[0] = null; + } + this.index.update(true); + } + /** + * Add a subscriber to this DynMapReducer instance. + * + * @param handler - Callback function that is invoked on update / changes. Receives `this` reference. + * + * @returns Unsubscribe function. + */ + subscribe(handler) { + this.#subscriptions.push(handler); + handler(this); + return () => { + const index = this.#subscriptions.findIndex((sub) => sub === handler); + if (index >= 0) { + this.#subscriptions.splice(index, 1); + } + }; + } + /** + * Updates subscribers on changes. + */ + #updateSubscribers() { + for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) { + this.#subscriptions[cntr](this); + } + } + /** + * Provides an iterator for data stored in DynMapReducer. + * + * @yields {T} + */ + *[Symbol.iterator]() { + const map = this.#map[0]; + if (this.#destroyed || map === null || map?.size === 0) { + return; + } + if (this.#index.active) { + for (const key of this.index) { + yield map.get(key); + } + } else { + if (this.reversed) { + const values = [...map.values()]; + for (let cntr = values.length; --cntr >= 0; ) { + yield values[cntr]; + } + } else { + for (const value of map.values()) { + yield value; + } + } + } + } +} +class EmbeddedStoreManager { + /** + * RegExp for detecting CRUD updates for renderContext. + * + * @type {RegExp} + */ + static #renderContextRegex = /(?create|delete|update)(?\.?)(?\w+)/; + /** + * @type {Map>} + */ + #name = /* @__PURE__ */ new Map(); + /** + * @type {foundry.abstract.Document[]} + */ + #document; + /** + * @type {Map} + */ + #collectionToDocName = /* @__PURE__ */ new Map(); + /** + * @type {Set} + */ + #embeddedNames = /* @__PURE__ */ new Set(); + /** + * @param {foundry.abstract.Document[]} document - The associated document holder. + */ + constructor(document2) { + this.#document = document2; + this.handleDocChange(); + Object.seal(this); + } + /** + * @template [T=import('./types').NamedDocumentConstructor] + * + * @param {T} FoundryDoc - A Foundry document class / constructor. + * + * @param {import('#runtime/svelte/store/reducer').DynOptionsMapCreate} options - DynMapReducer + * creation options. + * + * @returns {import('#runtime/svelte/store/reducer').DynMapReducer} DynMapReducer instance. + */ + create(FoundryDoc, options) { + const docName = FoundryDoc?.documentName; + if (typeof docName !== "string") { + throw new TypeError( + `EmbeddedStoreManager.create error: 'FoundryDoc' does not have a valid 'documentName' property.` + ); + } + const doc = this.#document[0]; + let collection = null; + if (doc) { + try { + collection = doc.getEmbeddedCollection(docName); + } catch (err) { + console.warn(`EmbeddedStoreManager.create error: No valid embedded collection for: ${docName}`); + } + } + let embeddedData; + if (!this.#name.has(docName)) { + embeddedData = { + collection, + stores: /* @__PURE__ */ new Map() + }; + this.#name.set(docName, embeddedData); + } else { + embeddedData = this.#name.get(docName); + } + let name; + let rest = {}; + let ctor; + if (typeof options === "string") { + name = options; + ctor = DynMapReducer; + } else if (typeof options === "function" && hasPrototype(options, DynMapReducer)) { + ctor = options; + } else if (isObject(options)) { + ({ name, ctor = DynMapReducer, ...rest } = options); + } else { + throw new TypeError(`EmbeddedStoreManager.create error: 'options' does not conform to allowed parameters.`); + } + if (!hasPrototype(ctor, DynMapReducer)) { + throw new TypeError(`EmbeddedStoreManager.create error: 'ctor' is not a 'DynMapReducer'.`); + } + name = name ?? ctor?.name; + if (typeof name !== "string") { + throw new TypeError(`EmbeddedStoreManager.create error: 'name' is not a string.`); + } + if (embeddedData.stores.has(name)) { + return embeddedData.stores.get(name); + } else { + const storeOptions = collection ? { data: collection, ...rest } : { ...rest }; + const store = new ctor(storeOptions); + embeddedData.stores.set(name, store); + return store; + } + } + /** + * @template [T=import('./types').NamedDocumentConstructor] + * + * Destroys and removes embedded collection stores. Invoking this method with no parameters destroys all stores. + * Invoking with an embedded name destroys all stores for that particular collection. If you provide an embedded and + * store name just that particular store is destroyed and removed. + * + * @param {T} [FoundryDoc] - A Foundry document class / constructor. + * + * @param {string} [storeName] - Specific store name. + * + * @returns {boolean} One or more stores destroyed? + */ + destroy(FoundryDoc, storeName) { + let count = 0; + if (FoundryDoc === void 0) { + for (const embeddedData of this.#name.values()) { + embeddedData.collection = null; + for (const store of embeddedData.stores.values()) { + store.destroy(); + count++; + } + } + this.#name.clear(); + } else { + const docName = FoundryDoc?.documentName; + if (typeof docName !== "string") { + throw new TypeError( + `EmbeddedStoreManager.delete error: 'FoundryDoc' does not have a valid 'documentName' property.` + ); + } + if (storeName === void 0) { + const embeddedData = this.#name.get(docName); + if (embeddedData) { + embeddedData.collection = null; + for (const store of embeddedData.stores.values()) { + store.destroy(); + count++; + } + } + this.#name.delete(docName); + } else if (storeName === "string") { + const embeddedData = this.#name.get(docName); + if (embeddedData) { + const store = embeddedData.stores.get(storeName); + if (store) { + store.destroy(); + count++; + } + } + } + } + return count > 0; + } + /** + * @template [T=import('./types').NamedDocumentConstructor] + * + * @param {T} FoundryDoc - A Foundry document class / constructor. + * + * @param {string} storeName - Name of the embedded collection to retrieve. + * + * @returns {import('#runtime/svelte/store/reducer').DynMapReducer>} DynMapReducer + * instance. + */ + get(FoundryDoc, storeName) { + const docName = FoundryDoc?.documentName; + if (typeof docName !== "string") { + throw new TypeError( + `EmbeddedStoreManager.get error: 'FoundryDoc' does not have a valid 'documentName' property.` + ); + } + if (!this.#name.has(docName)) { + return void 0; + } + return this.#name.get(docName).stores.get(storeName); + } + /** + * Updates all existing embedded collection stores with the associated embedded collection + */ + handleDocChange() { + const doc = this.#document[0]; + if (doc instanceof globalThis.foundry.abstract.Document) { + const existingEmbeddedNames = new Set(this.#name.keys()); + const embeddedNames = Object.entries(doc.constructor?.metadata?.embedded ?? []); + this.#collectionToDocName.clear(); + this.#embeddedNames.clear(); + for (const [docName, collectionName] of embeddedNames) { + existingEmbeddedNames.delete(docName); + this.#embeddedNames.add(`create${docName}`); + this.#embeddedNames.add(`delete${docName}`); + this.#embeddedNames.add(`update${docName}`); + this.#embeddedNames.add(`create.${collectionName}`); + this.#embeddedNames.add(`delete.${collectionName}`); + this.#embeddedNames.add(`update.${collectionName}`); + this.#embeddedNames.add(`create${collectionName}`); + this.#embeddedNames.add(`delete${collectionName}`); + this.#embeddedNames.add(`update${collectionName}`); + this.#collectionToDocName.set(docName, docName); + this.#collectionToDocName.set(collectionName, docName); + let collection = null; + try { + collection = doc.getEmbeddedCollection(docName); + } catch (err) { + console.warn(`EmbeddedStoreManager.handleDocUpdate error: No valid embedded collection for: ${docName}`); + } + const embeddedData = this.#name.get(docName); + if (embeddedData) { + embeddedData.collection = collection; + for (const store of embeddedData.stores.values()) { + store.setData(collection, true); + } + } + } + for (const embeddedName of existingEmbeddedNames) { + const embeddedData = this.#name.get(embeddedName); + if (embeddedData) { + embeddedData.collection = null; + for (const store of embeddedData.stores.values()) { + store.setData(null, true); + } + } + } + } else { + this.#collectionToDocName.clear(); + this.#embeddedNames.clear(); + for (const embeddedData of this.#name.values()) { + embeddedData.collection = null; + for (const store of embeddedData.stores.values()) { + store.setData(null, true); + } + } + } + } + /** + * Handles updates to embedded stores parsing the render context for valid embedded store types. + * + * On create, delete, update parse the type being modified then force index updates for the embedded type. + * + * @param {string} renderContext - render context update from document. + */ + handleUpdate(renderContext) { + if (!this.#embeddedNames.has(renderContext)) { + return; + } + const match = EmbeddedStoreManager.#renderContextRegex.exec(renderContext); + if (match) { + const docOrCollectionName = match.groups.name; + const embeddedName = this.#collectionToDocName.get(docOrCollectionName); + if (!this.#name.has(embeddedName)) { + return; + } + for (const store of this.#name.get(embeddedName).stores.values()) { + store.index.update(true); + } + } + } +} +class TJSDocument { + /** + * @type {T[]} + */ + #document = [void 0]; + /** + * @type {EmbeddedStoreManager} + */ + #embeddedStoreManager; + /** + * @type {import('./types').EmbeddedAPI} + */ + #embeddedAPI; + /** + * @type {string} + */ + #uuidv4; + /** + * @type {TJSDocumentOptions} + */ + #options = { delete: void 0, preDelete: void 0 }; + /** + * @type {((value: T, updateOptions?: TJSDocumentUpdateOptions) => void)[]} + */ + #subscriptions = []; + /** + * @type {TJSDocumentUpdateOptions} + */ + #updateOptions; + /** + * @param {T | TJSDocumentOptions} [document] - Document to wrap or TJSDocumentOptions. + * + * @param {TJSDocumentOptions} [options] - TJSDocument options. + */ + constructor(document2, options = {}) { + this.#uuidv4 = `tjs-document-${Hashing.uuidv4()}`; + if (isPlainObject(document2)) { + this.setOptions(document2); + } else { + this.setOptions(options); + this.set(document2); + } + } + /** + * @returns {import('./types').EmbeddedAPI} Embedded store manager. + */ + get embedded() { + if (!this.#embeddedAPI) { + this.#embeddedStoreManager = new EmbeddedStoreManager(this.#document); + this.#embeddedAPI = { + create: (doc, options) => this.#embeddedStoreManager.create(doc, options), + destroy: (doc, storeName) => this.#embeddedStoreManager.destroy(doc, storeName), + get: (doc, storeName) => this.#embeddedStoreManager.get(doc, storeName) + }; + } + return this.#embeddedAPI; + } + /** + * Returns the options passed on last update. + * + * @returns {TJSDocumentUpdateOptions} Last update options. + */ + get updateOptions() { + return this.#updateOptions ?? {}; + } + /** + * Returns the UUID assigned to this store. + * + * @returns {string} UUID + */ + get uuidv4() { + return this.#uuidv4; + } + /** + * Handles cleanup when the document is deleted. Invoking any optional delete function set in the constructor. + * + * @returns {Promise} + */ + async #deleted() { + const doc = this.#document[0]; + if (doc instanceof globalThis.foundry.abstract.Document && !doc?.collection?.has(doc.id)) { + delete doc?.apps[this.#uuidv4]; + this.#setDocument(void 0); + if (typeof this.#options.preDelete === "function") { + await this.#options.preDelete(doc); + } + this.#updateSubscribers(false, { action: "delete", data: void 0 }); + if (typeof this.#options.delete === "function") { + await this.#options.delete(doc); + } + this.#updateOptions = void 0; + } + } + /** + * Completely removes all internal subscribers, any optional delete callback, and unregisters from the + * ClientDocumentMixin `apps` tracking object. + */ + destroy() { + const doc = this.#document[0]; + if (this.#embeddedStoreManager) { + this.#embeddedStoreManager.destroy(); + this.#embeddedStoreManager = void 0; + this.#embeddedAPI = void 0; + } + if (doc instanceof globalThis.foundry.abstract.Document) { + delete doc?.apps[this.#uuidv4]; + this.#setDocument(void 0); + } + this.#options.delete = void 0; + this.#subscriptions.length = 0; + } + /** + * @param {boolean} [force] - unused - signature from Foundry render function. + * + * @param {object} [options] - Options from render call; will have document update context. + */ + #updateSubscribers(force = false, options = {}) { + this.#updateOptions = options; + const doc = this.#document[0]; + for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) { + this.#subscriptions[cntr](doc, options); + } + if (this.#embeddedStoreManager) { + this.#embeddedStoreManager.handleUpdate(options.renderContext); + } + } + /** + * @returns {T} Current document + */ + get() { + return this.#document[0]; + } + /** + * Attempts to create a Foundry UUID from standard drop data. This may not work for all systems. + * + * @param {object} data - Drop transfer data. + * + * @param {object} [opts] - Optional parameters. + * + * @param {boolean} [opts.actor=true] - Accept actor owned documents. + * + * @param {boolean} [opts.compendium=true] - Accept compendium documents. + * + * @param {boolean} [opts.world=true] - Accept world documents. + * + * @param {string[]|undefined} [opts.types] - Require the `data.type` to match entry in `types`. + * + * @returns {string|undefined} Foundry UUID for drop data. + */ + static getUUIDFromDataTransfer(data, { actor = true, compendium = true, world = true, types = void 0 } = {}) { + if (!isObject(data)) { + return void 0; + } + if (Array.isArray(types) && !types.includes(data.type)) { + return void 0; + } + let uuid = void 0; + if (typeof data.uuid === "string") { + const isCompendium = data.uuid.startsWith("Compendium"); + if (isCompendium && compendium) { + uuid = data.uuid; + } else if (world) { + uuid = data.uuid; + } + } else { + if (actor && world && data.actorId && data.type) { + uuid = `Actor.${data.actorId}.${data.type}.${data.data._id}`; + } else if (typeof data.id === "string") { + if (compendium && typeof data.pack === "string") { + uuid = `Compendium.${data.pack}.${data.id}`; + } else if (world) { + uuid = `${data.type}.${data.id}`; + } + } + } + return uuid; + } + /** + * @param {T | undefined} document - New document to set. + * + * @param {TJSDocumentUpdateOptions} [options] - New document update options to set. + */ + set(document2, options = {}) { + if (this.#document[0]) { + delete this.#document[0].apps[this.#uuidv4]; + } + if (document2 !== void 0 && !(document2 instanceof globalThis.foundry.abstract.Document)) { + throw new TypeError(`TJSDocument set error: 'document' is not a valid Document or undefined.`); + } + if (!isObject(options)) { + throw new TypeError(`TJSDocument set error: 'options' is not an object.`); + } + if (document2 instanceof globalThis.foundry.abstract.Document) { + document2.apps[this.#uuidv4] = { + close: this.#deleted.bind(this), + render: this.#updateSubscribers.bind(this) + }; + } + this.#setDocument(document2); + this.#updateOptions = options; + this.#updateSubscribers(); + } + /** + * + * @param {T | undefined} doc - + */ + #setDocument(doc) { + this.#document[0] = doc; + if (this.#embeddedStoreManager) { + this.#embeddedStoreManager.handleDocChange(); + } + } + /** + * Potentially sets new document from data transfer object. + * + * @param {object} data - Document transfer data. + * + * @param {{ actor?: boolean, compendium?: boolean, world?: boolean, types?: string[] } & TJSDocumentOptions} [options] - Optional + * parameters. + * + * @returns {Promise} Returns true if new document set from data transfer blob. + */ + async setFromDataTransfer(data, options) { + return this.setFromUUID(TJSDocument.getUUIDFromDataTransfer(data, options), options); + } + /** + * Sets the document by Foundry UUID performing a lookup and setting the document if found. + * + * @param {string} uuid - A Foundry UUID to lookup. + * + * @param {TJSDocumentOptions} [options] - New document update options to set. + * + * @returns {Promise} True if successfully set document from UUID. + */ + async setFromUUID(uuid, options = {}) { + if (typeof uuid !== "string" || uuid.length === 0) { + return false; + } + try { + const doc = await globalThis.fromUuid(uuid); + if (doc) { + this.set(doc, options); + return true; + } + } catch (err) { + } + return false; + } + /** + * Sets options for this document wrapper / store. + * + * @param {TJSDocumentOptions} options - Options for TJSDocument. + */ + setOptions(options) { + if (!isObject(options)) { + throw new TypeError(`TJSDocument error: 'options' is not a plain object.`); + } + if (options.delete !== void 0 && typeof options.delete !== "function") { + throw new TypeError(`TJSDocument error: 'delete' attribute in options is not a function.`); + } + if (options.preDelete !== void 0 && typeof options.preDelete !== "function") { + throw new TypeError(`TJSDocument error: 'preDelete' attribute in options is not a function.`); + } + if (options.delete === void 0 || typeof options.delete === "function") { + this.#options.delete = options.delete; + } + if (options.preDelete === void 0 || typeof options.preDelete === "function") { + this.#options.preDelete = options.preDelete; + } + } + /** + * @param {(value: T, updateOptions?: TJSDocumentUpdateOptions) => void} handler - Callback function that is + * invoked on update / changes. + * + * @returns {import('svelte/store').Unsubscriber} Unsubscribe function. + */ + subscribe(handler) { + this.#subscriptions.push(handler); + const updateOptions = { action: "subscribe", data: void 0 }; + handler(this.#document[0], updateOptions); + return () => { + const index = this.#subscriptions.findIndex((sub) => sub === handler); + if (index >= 0) { + this.#subscriptions.splice(index, 1); + } + }; + } +} +const title = "Actor Studio"; +const description$1 = "Easily create Heroes, Villains and everything in between."; +const version$1 = "1.5.7"; +const styles = [ + "dist/style.css" +]; +const esmodules = [ + "index.js" +]; +const languages = [ + { + lang: "en", + name: "English", + path: "lang/en.json", + flags: {} + }, + { + lang: "zh-tw", + name: "正體中文", + path: "lang/zh-tw.json", + flags: {} + } +]; +const url = "https://github.com/geoidesic/foundryvtt-actor-studio"; +const manifest = "https://github.com/geoidesic/foundryvtt-actor-studio/releases/download/1.5.7/module.json"; +const download = "https://github.com/geoidesic/foundryvtt-actor-studio/releases/download/1.5.7/module.zip"; +const authors$1 = [ + { + name: "Noel da Costa", + url: "https://www.arc2.co.uk", + discord: "geoidesic", + flags: {} + } +]; +const compatibility = { + minimum: "11", + verified: "12", + maximum: "12" +}; +const flags = { + hotReload: { + extensions: [ + "json" + ], + paths: [ + "lang" + ] + } +}; +const relationships = { + systems: [ + { + id: "dnd5e", + type: "system", + compatibility: { + minimum: "3.0.0", + verified: "4", + maximum: "5" + } + } + ] +}; +const id = "foundryvtt-actor-studio"; +const manifestJson = { + title, + description: description$1, + version: version$1, + styles, + esmodules, + languages, + url, + manifest, + download, + authors: authors$1, + compatibility, + flags, + relationships, + id +}; +class WelcomeApplication extends SvelteApplication { + /** + * Default Application options + * + * @returns {object} options - Application options. + * @see https://foundryvtt.com/api/interfaces/client.ApplicationOptions.html + */ + static get defaultOptions() { + return foundry.utils.mergeObject(super.defaultOptions, { + id: "foundryvtt-actor-studio-welcome", + classes: [MODULE_CODE], + resizable: true, + minimizable: true, + width: 220, + height: 400, + headerIcon: "modules/foundryvtt-actor-studio/assets/actor-studio-logo-dragon-white.svg", + title: game.i18n.localize("GAS.ActorStudio") + " v" + version$1, + svelte: { + class: WelcomeAppShell, + target: document.body, + intro: true, + props: { + version: version$1 + // A prop passed to HelloFoundryAppShell for the initial message displayed. + } + } + }); + } +} +class plugin { + enabled; + constructor() { + this.enabled = false; + } + /** + * Initializes the plugin by checking if Donation Tracker is enabled in settings. + * Sets up a hook to notify when the GAS Plugin is loaded. + */ + init() { + this.enabled = game.settings.get(MODULE_ID, "enable-donation-tracker"); + Hooks.on("gas-plugin", () => { + alert("GAS Plugin Loaded"); + }); + } + /** + * Retrieves the settings for each donation tracker rank, including the folder name and permission. + * + * @returns {Array} - An array of objects containing permission, rank, and folderName. + */ + getDTSettings() { + const membershipRanks = game.membership.RANKS; + const membershipFolderArray = Object.entries(membershipRanks).filter(([_, value]) => value !== -1); + const settings = membershipFolderArray.map(([key, rank]) => { + return { permission: key, rank, folderName: game.settings.get(MODULE_ID, `donation-tracker-rank-${key}`) }; + }); + return settings; + } + /** + * Checks if the current pack has DT folders or not. + * Ignored rank access permissions. + * @param {object} pack + * @returns boolean + */ + packHasDTFolders(pack) { + const membershipRanks = game.membership.RANKS; + const membershipFolderArray = Object.entries(membershipRanks).filter(([_, value]) => value !== -1); + const DTfolders = membershipFolderArray.map(([key, _]) => game.settings.get(MODULE_ID, `donation-tracker-rank-${key}`)); + return DTfolders.length > 0; + } + /** + * Retrieves all folder names associated with donation tracker ranks. + * @returns {Array} - An array of folder names tied to donation tracker ranks. + */ + getAllowedDTFolderNames() { + const membershipRanks = game.membership.RANKS; + const membershipFolderArray = Object.entries(membershipRanks).filter(([_, value]) => value !== -1); + const allowedMembershipFolderNames = membershipFolderArray.filter( + ([key, _]) => { + return game.membership.hasPermission(key) || game.membership.membershipLevel == -1 && key == "member"; + } + ).map(([key, _]) => game.settings.get(MODULE_ID, `donation-tracker-rank-${key}`)); + return allowedMembershipFolderNames; + } + /** + * Retrieves the root-level and subfolder DT folder IDs from a compendium pack that are allowed for the current user. + * + * @param {Object} pack - The compendium pack to search. + * @returns {Array} - An array of allowed folder IDs including subfolders. + */ + getDTFolderIdsFromPack(pack, filterByPermissions = true) { + let allowedFolderIds = []; + const getFolderAndSubfolderIds = (folders) => { + for (let i = 0; i < folders.length; i++) { + const folder = folders[i]; + allowedFolderIds.push(folder.id); + if (folder.children && folder.children.length > 0) { + getFolderAndSubfolderIds(folder.children.map((f) => f.folder)); + } + } + }; + const validRootFolderNames = this.getAllowedDTFolderNames(); + if (filterByPermissions) { + getFolderAndSubfolderIds(pack.folders.filter((f) => validRootFolderNames.includes(f.name))); + } else { + getFolderAndSubfolderIds(Array.from(pack.folders)); + } + return allowedFolderIds; + } +} +const DTPlugin = new plugin(); +const log$1 = { + ASSERT: 1, + ERROR: 2, + WARN: 3, + INFO: 4, + DEBUG: 5, + VERBOSE: 6, + set level(level2) { + this.a = level2 >= this.ASSERT ? console.assert.bind(window.console, LOG_PREFIX) : () => { + }; + this.e = level2 >= this.ERROR ? console.error.bind(window.console, LOG_PREFIX) : () => { + }; + this.w = level2 >= this.WARN ? console.warn.bind(window.console, LOG_PREFIX) : () => { + }; + this.i = level2 >= this.INFO ? console.info.bind(window.console, LOG_PREFIX) : () => { + }; + this.d = level2 >= this.DEBUG ? console.debug.bind(window.console, LOG_PREFIX) : () => { + }; + this.v = level2 >= this.VERBOSE ? console.log.bind(window.console, LOG_PREFIX) : () => { + }; + this.loggingLevel = level2; + }, + get level() { + return this.loggingLevel; + } +}; +async function getRules(rule) { + const { journalId, pageId } = rule; + const rules = await game.packs.get("dnd5e.rules"); + const journal = await rules?.getDocument(journalId); + const text2 = journal?.pages?.get(pageId).text; + if (!text2) { + console.error(`Unable to find rule journal on compendium ${DEFAULT_PACKS.RULES}`); + } + return text2; +} +function filterPackForDTPackItems(pack, entries) { + if (game.modules.get("donation-tracker")?.active && game.settings.get(MODULE_ID, "enable-donation-tracker")) { + if (!DTPlugin.packHasDTFolders(pack)) { + return true; + } + const allowedDTFolderIds = DTPlugin.getDTFolderIdsFromPack(pack); + const allDTFolderIds = DTPlugin.getDTFolderIdsFromPack(pack, false); + const unregisteredAccess = game.settings.get(MODULE_ID, "enable-donation-tracker-unregistered-access"); + if (game.user.isGM && game.membership.DEVELOPER_IS_ADMIN) return entries; + entries = entries.filter(([key, value]) => { + if (!value.folder) { + return unregisteredAccess; + } + if (!pack.folders.get(value.folder)) return false; + if (allowedDTFolderIds.includes(value.folder)) return true; + if (!allDTFolderIds.includes(value.folder)) { + return unregisteredAccess; + } + return false; + }); + } + return entries; +} +function extractItemsFromPacksSync(packs, keys) { + const items = []; + for (const pack of packs) { + game.system.log.d("pack.metadata.name", pack.metadata.name); + if (!pack.index) { + ui.notifications.error(game.i18n.localize("GAS.Error.PackIndexNotFound")); + } + let entries = pack.index.entries(); + entries = filterPackForDTPackItems(pack, entries); + const packItems = extractMapIteratorObjectProperties(entries, keys); + items.push(...packItems); + } + return items; +} +async function extractItemsFromPacksAsync(packs, keys, nonIndexKeys = false) { + const items = []; + for (const pack of packs) { + let index = await pack.getIndex({ + fields: nonIndexKeys + }); + if (!pack) continue; + if (!index) { + ui.notifications.error(game.i18n.localize("GAS.Error.PackIndexNotFound")); + } + let entries = index.entries(); + entries = filterPackForDTPackItems(pack, entries); + const packItems = extractMapIteratorObjectProperties(entries, [...keys, ...nonIndexKeys]); + items.push(...packItems); + } + game.system.log.d("items", items); + return items; +} +function extractMapIteratorObjectProperties(mapIterator, keys) { + const newArray = []; + for (const [key, data] of mapIterator) { + const newObj = {}; + keys.forEach((k) => { + if (k.includes("->")) { + const split = k.split("->"); + newObj[split[1]] = data[split[0]]; + } else if (k.includes(".")) { + setNestedProperty(newObj, k, getNestedProperty(data, k)); + } else { + newObj[k] = data[k]; + } + }); + newObj.key = key; + newArray.push(newObj); + } + return newArray; +} +function getNestedProperty(obj, path) { + return path.split(".").reduce((acc, key) => acc && acc[key], obj); +} +function setNestedProperty(obj, path, value) { + const keys = path.split("."); + const lastKey = keys.pop(); + const lastObj = keys.reduce((acc, key) => acc[key] = acc[key] || {}, obj); + lastObj[lastKey] = value; +} +const getPacksFromSettings = (type2) => { + const settings = game.settings.get(MODULE_ID, "compendiumSources"); + let filteredPackNames = settings[type2]; + const packs = []; + filteredPackNames = filteredPackNames.filter((packName) => { + const pack = game.packs.get(packName); + if (pack) { + packs.push(pack); + return true; + } + return false; + }); + if (filteredPackNames.length !== settings[type2].length) { + settings[type2] = filteredPackNames; + game.settings.set(MODULE_ID, "compendiumSources", settings); + } + return packs; +}; +const getAllPacksFromAllSettings = () => { + const settings = game.settings.get(MODULE_ID, "compendiumSources"); + const types = Object.keys(settings); + const packs = []; + for (const type2 of types) { + const filteredPackNames = settings[type2]; + for (const packName of filteredPackNames) { + packs.push(game.packs.get(packName)); + } + } + return packs; +}; +const getAllPackIdsFromAllSettings = () => { + const packs = getAllPacksFromAllSettings(); + return packs.map((p) => { + return p.collection; + }); +}; +function getAdvancementValue(advancement, key) { + if (game.version > 12) { + return advancement[key] || null; + } else { + return advancement.configuration?.[key] || null; + } +} +function ucfirst(str) { + if (!str) return str; + return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); +} +function camelCaseToTitleCase(camelCaseStr) { + const words = camelCaseStr.replace(/([A-Z])/g, " $1").trim(); + const titleCaseStr = words.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" "); + return titleCaseStr; +} +const getCompendiumSource = (item) => { + let sourceId; + if (game.version < 12) { + sourceId = item.flags.core.sourceId; + } else { + sourceId = item._stats.compendiumSource; + } + return sourceId; +}; +const prepareItemForDrop = async ({ itemData, isLevelUp: isLevelUp2, isMultiClass: isMultiClass2 }) => { + game.system.log.d("prepareItemForDrop"); + game.system.log.d("isLevelUp? ", isLevelUp2); + game.system.log.d("isMultiClass? ", isMultiClass2); + game.system.log.d("itemData", itemData); + let item; + if (isLevelUp2) { + if (isMultiClass2) { + item = await Item.implementation.fromDropData({ type: "Item", uuid: itemData.uuid }); + } else { + item = await Item.implementation.fromDropData({ type: "Item", uuid: getCompendiumSource(itemData) }); + } + if (!item) { + log$1.e("Item not found in compendium", itemData._stats.compendiumSource); + ui.notifications.error(game.i18n.localize("GAS.Error.ItemNotFoundInCompendium")); + return; + } + } else { + const dropData = { + type: "Item", + uuid: itemData.uuid + }; + game.system.log.d("dropData", dropData); + item = await Item.implementation.fromDropData(dropData); + game.system.log.d("item", item); + } + return item; +}; +const dropItemOnCharacter = async (actor, item) => { + game.system.log.d("dropItemOnCharacter"); + game.system.log.d("dropItemOnCharacter item", item); + game.system.log.d("actor.sheet._onDropItemCreate fn", actor.sheet._onDropItemCreate); + return await actor.sheet._onDropItemCreate(item); +}; +const itemHasAdvancementChoices = (item) => { + let hasAdvancementChoices = false; + if (!item?.system?.advancement.length) return false; + for (const adv of item.system.advancement) { + if (adv.configuration.choices) { + hasAdvancementChoices = true; + break; + } + } + return hasAdvancementChoices; +}; +function truncate(str, n) { + return str.length > n ? str.substr(0, n - 1) + "..." : str; +} +function userHasRightPermissions() { + const userRole = game.user.role; + if (!game.permissions.ACTOR_CREATE.includes(userRole)) { + ui.notifications?.error(game.i18n.localize("GAS.Permissions.NeedCreateActorError")); + return false; + } + return true; +} +const initialTabs = [ + { label: "Abilities", id: "abilities", component: "Abilities" }, + { label: "Race", id: "race", component: "Race" }, + { label: "Background", id: "background", component: "Background" }, + { label: "Class", id: "class", component: "Class" } +]; +const upTabs = [ + { label: "Level Up", id: "level-up", component: "LevelUp" } +]; +const arrayOfObjectsStore = () => { + const store = writable([]); + const inProcess = writable(false); + const { subscribe: subscribe2, set: set2, update: update2 } = store; + const remove = (id2) => update2((apps) => apps.filter((app) => app.id !== id2)); + return { + subscribe: subscribe2, + add: (app) => { + update2((apps) => { + const filteredApps = apps.filter((existingApp) => existingApp.id !== app.id); + return [...filteredApps, app]; + }); + game.system.log.d("currentStore.length", get_store_value(store).length); + }, + remove, + removeAll: () => set2([]), + advanceQueue: async (initial) => { + const currentStore = get_store_value(store); + const next = currentStore[0] || false; + if (!next) { + inProcess.set(false); + game.system.log.d("end of queue"); + return false; + } + inProcess.set(next); + remove(next.id); + const item = await prepareItemForDrop(next); + try { + const result = await dropItemOnCharacter(next.actor, item); + } catch (error) { + } + if (currentStore.length == 1) { + if (!itemHasAdvancementChoices(next.itemData)) { + return false; + } + } + if (currentStore.length == 0) return false; + return true; + }, + currentProcess: derived(inProcess, ($inProcess) => $inProcess), + updateCurrentProcess: (obj) => inProcess.update((p) => ({ ...p, ...obj })) + }; +}; +const race = writable(false); +const subRace = writable(false); +const characterClass = writable(false); +const characterSubClass = writable(false); +const background = writable(false); +const abilities = writable(false); +const spells = writable(false); +const isLevelUp = writable(false); +const pointBuy = writable(false); +const abilityRolls = writable(false); +const isStandardArrayValues = writable(false); +const newClassLevel = writable(false); +const level = writable(1); +const activeTab = writable(""); +const activeClass = writable(false); +const isActorCreated = writable(false); +const dropItemRegistry = arrayOfObjectsStore(); +const tabs$1 = writable(initialTabs); +const levelUpTabs = writable(upTabs); +const actorInGame = writable(false); +const abilityGenerationMethod = writable(null); +const subClassesForClass = writable([]); +const isMultiClass = derived([characterClass, activeClass, newClassLevel], ([$characterClass, $characterSubClass, $newClassLevel]) => { + if ($newClassLevel) return false; + if ($characterClass && !$newClassLevel) return true; +}); +function resetStores() { + race.set(false); + subRace.set(false); + characterClass.set(false); + characterSubClass.set(false); + background.set(false); + abilities.set(false); + isLevelUp.set(false); + pointBuy.set(false); + isStandardArrayValues.set(false); + abilityRolls.set({}); + newClassLevel.set(false); + spells.set(false); + level.set(1); + activeTab.set(""); + activeClass.set(false); + tabs$1.set(initialTabs); + levelUpTabs.set(upTabs); + dropItemRegistry.removeAll(); + isActorCreated.set(false); + actorInGame.set(false); + abilityGenerationMethod.set(null); + subClassesForClass.set([]); +} +const __variableDynamicImportRuntimeHelper = (glob, path, segs) => { + const v = glob[path]; + if (v) { + return typeof v === "function" ? v() : Promise.resolve(v); + } + return new Promise((_, reject) => { + (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)( + reject.bind( + null, + new Error( + "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "") + ) + ) + ); + }); +}; +function preventDefault(event) { + event.preventDefault(); + return; +} +function ripple({ + duration = 600, + background: background2 = "rgba(255, 255, 255, 0.7)", + events = ["click", "keyup"], + keyCode = "Enter", + debounce +} = {}) { + return (element2) => { + function createRipple(e) { + const elementRect = element2.getBoundingClientRect(); + const diameter = Math.max(elementRect.width, elementRect.height); + const radius = diameter / 2; + const left = e.clientX ? `${e.clientX - (elementRect.left + radius)}px` : "0"; + const top = e.clientY ? `${e.clientY - (elementRect.top + radius)}px` : "0"; + const span = document.createElement("span"); + span.style.position = "absolute"; + span.style.width = `${diameter}px`; + span.style.height = `${diameter}px`; + span.style.left = left; + span.style.top = top; + span.style.background = `var(--tjs-action-ripple-background, ${background2})`; + span.style.borderRadius = "50%"; + span.style.pointerEvents = "none"; + span.style.transform = "translateZ(-1px)"; + element2.prepend(span); + const animation = span.animate( + [ + { + // from + transform: "scale(.7)", + opacity: 0.5, + filter: "blur(2px)" + }, + { + // to + transform: "scale(4)", + opacity: 0, + filter: "blur(5px)" + } + ], + duration + ); + animation.onfinish = () => { + if (span && span.isConnected) { + span.remove(); + } + }; + } + function keyHandler(event) { + if (event?.code === keyCode) { + createRipple(event); + } + } + const eventFn = Number.isInteger(debounce) && debounce > 0 ? Timing.debounce(createRipple, debounce) : createRipple; + const keyEventFn = Number.isInteger(debounce) && debounce > 0 ? Timing.debounce(keyHandler, debounce) : keyHandler; + for (const event of events) { + if (["keydown", "keyup"].includes(event)) { + element2.addEventListener(event, keyEventFn); + } else { + element2.addEventListener(event, eventFn); + } + } + return { + destroy: () => { + for (const event of events) { + if (["keydown", "keyup"].includes(event)) { + element2.removeEventListener(event, keyEventFn); + } else { + element2.removeEventListener(event, eventFn); + } + } + } + }; + }; +} +function rippleFocus({ duration = 300, background: background2 = "rgba(255, 255, 255, 0.7)", selectors } = {}) { + return (element2) => { + const targetEl = typeof selectors === "string" ? element2.querySelector(selectors) : element2.firstChild instanceof HTMLElement ? element2.firstChild : element2; + let span = void 0; + let clientX = -1; + let clientY = -1; + function blurRipple() { + if (!(span instanceof HTMLElement) || document.activeElement === targetEl) { + return; + } + const animation = span.animate( + [ + { + // from + transform: "scale(3)", + opacity: 0.3 + }, + { + // to + transform: "scale(.7)", + opacity: 0 + } + ], + { + duration, + fill: "forwards" + } + ); + animation.onfinish = () => { + clientX = clientY = -1; + if (span && span.isConnected) { + span.remove(); + } + span = void 0; + }; + } + function focusRipple() { + if (span instanceof HTMLElement) { + return; + } + const elementRect = element2.getBoundingClientRect(); + const actualX = clientX >= 0 ? clientX : elementRect.left + elementRect.width / 2; + const actualY = clientX >= 0 ? clientY : elementRect.top + elementRect.height / 2; + const diameter = Math.max(elementRect.width, elementRect.height); + const radius = diameter / 2; + const left = `${actualX - (elementRect.left + radius)}px`; + const top = `${actualY - (elementRect.top + radius)}px`; + span = document.createElement("span"); + span.style.position = "absolute"; + span.style.width = `${diameter}px`; + span.style.height = `${diameter}px`; + span.style.left = left; + span.style.top = top; + span.style.background = `var(--tjs-action-ripple-background-focus, var(--tjs-action-ripple-background, ${background2}))`; + span.style.borderRadius = "50%"; + span.style.pointerEvents = "none"; + span.style.transform = "translateZ(-1px)"; + element2.prepend(span); + span.animate( + [ + { + // from + transform: "scale(.7)", + opacity: 0.5 + }, + { + // to + transform: "scale(3)", + opacity: 0.3 + } + ], + { + duration, + fill: "forwards" + } + ); + } + function onPointerDown(e) { + clientX = e.clientX; + clientY = e.clientY; + } + targetEl.addEventListener("pointerdown", onPointerDown); + targetEl.addEventListener("blur", blurRipple); + targetEl.addEventListener("focus", focusRipple); + return { + destroy: () => { + targetEl.removeEventListener("pointerdown", onPointerDown); + targetEl.removeEventListener("blur", blurRipple); + targetEl.removeEventListener("focus", focusRipple); + } + }; + }; +} +function toggleDetails(details, { store, clickActive = true } = {}) { + const summary = details.querySelector("summary"); + let animation; + let open = details.open; + const unsubscribe = subscribeFirstRest(store, (value) => { + open = value; + details.open = open; + }, async (value) => { + open = value; + await tick(); + handleAnimation(); + }); + function animate(a, b, value) { + details.style.overflow = "hidden"; + const duration = Math.max(0, 30 * Math.log(Math.abs(b - a) + Number.EPSILON)); + animation = details.animate( + { + height: [`${a}px`, `${b}px`] + }, + { + duration, + easing: "ease-out" + } + ); + animation.onfinish = () => { + details.open = value; + details.dataset.closing = "false"; + details.style.overflow = ""; + }; + } + function handleAnimation() { + if (open) { + const a = details.offsetHeight; + if (animation) { + animation.cancel(); + } + details.open = true; + const b = details.offsetHeight; + animate(a, b, true); + } else { + const a = details.offsetHeight; + const b = summary.offsetHeight; + details.dataset.closing = "true"; + animate(a, b, false); + } + } + function handleClick(e) { + if (clickActive) { + e.preventDefault(); + store.set(!open); + } + } + summary.addEventListener("click", handleClick); + return { + destroy() { + unsubscribe(); + summary.removeEventListener("click", handleClick); + } + }; +} +function get_each_context$2(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[8] = list[i]; + return child_ctx; +} +function get_each_context_1$1(ctx, list, i) { + const child_ctx = ctx.slice(); + child_ctx[8] = list[i]; + child_ctx[12] = i; + return child_ctx; +} +function create_each_block_1$1(ctx) { + let button; + let t0_value = ( + /*tab*/ + ctx[8].label + "" + ); + let t0; + let t1; + let button_class_value; + let mounted; + let dispose; + function click_handler() { + return ( + /*click_handler*/ + ctx[7]( + /*tab*/ + ctx[8] + ) + ); + } + return { + c() { + button = element("button"); + t0 = text(t0_value); + t1 = space(); + attr(button, "class", button_class_value = null_to_empty( + /*activeTab*/ + ctx[0] === /*tab*/ + ctx[8].id ? "active " : "" + ) + " svelte-gas-iws9o4"); + }, + m(target, anchor) { + insert(target, button, anchor); + append(button, t0); + append(button, t1); + if (!mounted) { + dispose = [ + listen(button, "click", click_handler), + listen(button, "mousedown", preventDefault), + action_destroyer( + /*efx*/ + ctx[3].call(null, button) + ) + ]; + mounted = true; + } + }, + p(new_ctx, dirty) { + ctx = new_ctx; + if (dirty & /*tabs*/ + 2 && t0_value !== (t0_value = /*tab*/ + ctx[8].label + "")) set_data(t0, t0_value); + if (dirty & /*activeTab, tabs*/ + 3 && button_class_value !== (button_class_value = null_to_empty( + /*activeTab*/ + ctx[0] === /*tab*/ + ctx[8].id ? "active " : "" + ) + " svelte-gas-iws9o4")) { + attr(button, "class", button_class_value); + } + }, + d(detaching) { + if (detaching) { + detach(button); + } + mounted = false; + run_all(dispose); + } + }; +} +function create_if_block$4(ctx) { + let switch_instance; + let switch_instance_anchor; + let current; + var switch_value = ( + /*tabComponents*/ + ctx[4][ + /*tab*/ + ctx[8].component + ] + ); + function switch_props(ctx2, dirty) { + return { props: { sheet: ( + /*sheet*/ + ctx2[2] + ) } }; + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); + } + return { + c() { + if (switch_instance) create_component(switch_instance.$$.fragment); + switch_instance_anchor = empty(); + }, + m(target, anchor) { + if (switch_instance) mount_component(switch_instance, target, anchor); + insert(target, switch_instance_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if (dirty & /*tabComponents, tabs*/ + 18 && switch_value !== (switch_value = /*tabComponents*/ + ctx2[4][ + /*tab*/ + ctx2[8].component + ])) { + if (switch_instance) { + group_outros(); + const old_component = switch_instance; + transition_out(old_component.$$.fragment, 1, 0, () => { + destroy_component(old_component, 1); + }); + check_outros(); + } + if (switch_value) { + switch_instance = construct_svelte_component(switch_value, switch_props(ctx2)); + create_component(switch_instance.$$.fragment); + transition_in(switch_instance.$$.fragment, 1); + mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); + } else { + switch_instance = null; + } + } else if (switch_value) { + const switch_instance_changes = {}; + if (dirty & /*sheet*/ + 4) switch_instance_changes.sheet = /*sheet*/ + ctx2[2]; + switch_instance.$set(switch_instance_changes); + } + }, + i(local) { + if (current) return; + if (switch_instance) transition_in(switch_instance.$$.fragment, local); + current = true; + }, + o(local) { + if (switch_instance) transition_out(switch_instance.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(switch_instance_anchor); + } + if (switch_instance) destroy_component(switch_instance, detaching); + } + }; +} +function create_each_block$2(ctx) { + let if_block_anchor; + let current; + let if_block = ( + /*tab*/ + ctx[8].id === /*activeTab*/ + ctx[0] && /*tabComponents*/ + ctx[4][ + /*tab*/ + ctx[8].component + ] && create_if_block$4(ctx) + ); + return { + c() { + if (if_block) if_block.c(); + if_block_anchor = empty(); + }, + m(target, anchor) { + if (if_block) if_block.m(target, anchor); + insert(target, if_block_anchor, anchor); + current = true; + }, + p(ctx2, dirty) { + if ( + /*tab*/ + ctx2[8].id === /*activeTab*/ + ctx2[0] && /*tabComponents*/ + ctx2[4][ + /*tab*/ + ctx2[8].component + ] + ) { + if (if_block) { + if_block.p(ctx2, dirty); + if (dirty & /*tabs, activeTab, tabComponents*/ + 19) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block$4(ctx2); + if_block.c(); + transition_in(if_block, 1); + if_block.m(if_block_anchor.parentNode, if_block_anchor); + } + } else if (if_block) { + group_outros(); + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + check_outros(); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(if_block_anchor); + } + if (if_block) if_block.d(detaching); + } + }; +} +function create_fragment$c(ctx) { + let div2; + let div0; + let t; + let div1; + let div2_class_value; + let current; + let each_value_1 = ensure_array_like( + /*tabs*/ + ctx[1] + ); + let each_blocks_1 = []; + for (let i = 0; i < each_value_1.length; i += 1) { + each_blocks_1[i] = create_each_block_1$1(get_each_context_1$1(ctx, each_value_1, i)); + } + let each_value = ensure_array_like( + /*tabs*/ + ctx[1] + ); + let each_blocks = []; + for (let i = 0; i < each_value.length; i += 1) { + each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i)); + } + const out = (i) => transition_out(each_blocks[i], 1, 1, () => { + each_blocks[i] = null; + }); + return { + c() { + div2 = element("div"); + div0 = element("div"); + for (let i = 0; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].c(); + } + t = space(); + div1 = element("div"); + for (let i = 0; i < each_blocks.length; i += 1) { + each_blocks[i].c(); + } + attr(div0, "class", "tabs-list svelte-gas-iws9o4"); + attr(div1, "class", "tab-content svelte-gas-iws9o4"); + attr(div2, "class", div2_class_value = "tabs " + /*$$restProps*/ + ctx[5].class + " svelte-gas-iws9o4"); + }, + m(target, anchor) { + insert(target, div2, anchor); + append(div2, div0); + for (let i = 0; i < each_blocks_1.length; i += 1) { + if (each_blocks_1[i]) { + each_blocks_1[i].m(div0, null); + } + } + append(div2, t); + append(div2, div1); + for (let i = 0; i < each_blocks.length; i += 1) { + if (each_blocks[i]) { + each_blocks[i].m(div1, null); + } + } + current = true; + }, + p(ctx2, [dirty]) { + if (dirty & /*activeTab, tabs*/ + 3) { + each_value_1 = ensure_array_like( + /*tabs*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value_1.length; i += 1) { + const child_ctx = get_each_context_1$1(ctx2, each_value_1, i); + if (each_blocks_1[i]) { + each_blocks_1[i].p(child_ctx, dirty); + } else { + each_blocks_1[i] = create_each_block_1$1(child_ctx); + each_blocks_1[i].c(); + each_blocks_1[i].m(div0, null); + } + } + for (; i < each_blocks_1.length; i += 1) { + each_blocks_1[i].d(1); + } + each_blocks_1.length = each_value_1.length; + } + if (dirty & /*tabComponents, tabs, sheet, activeTab*/ + 23) { + each_value = ensure_array_like( + /*tabs*/ + ctx2[1] + ); + let i; + for (i = 0; i < each_value.length; i += 1) { + const child_ctx = get_each_context$2(ctx2, each_value, i); + if (each_blocks[i]) { + each_blocks[i].p(child_ctx, dirty); + transition_in(each_blocks[i], 1); + } else { + each_blocks[i] = create_each_block$2(child_ctx); + each_blocks[i].c(); + transition_in(each_blocks[i], 1); + each_blocks[i].m(div1, null); + } + } + group_outros(); + for (i = each_value.length; i < each_blocks.length; i += 1) { + out(i); + } + check_outros(); + } + if (!current || dirty & /*$$restProps*/ + 32 && div2_class_value !== (div2_class_value = "tabs " + /*$$restProps*/ + ctx2[5].class + " svelte-gas-iws9o4")) { + attr(div2, "class", div2_class_value); + } + }, + i(local) { + if (current) return; + for (let i = 0; i < each_value.length; i += 1) { + transition_in(each_blocks[i]); + } + current = true; + }, + o(local) { + each_blocks = each_blocks.filter(Boolean); + for (let i = 0; i < each_blocks.length; i += 1) { + transition_out(each_blocks[i]); + } + current = false; + }, + d(detaching) { + if (detaching) { + detach(div2); + } + destroy_each(each_blocks_1, detaching); + destroy_each(each_blocks, detaching); + } + }; +} +function instance$c($$self, $$props, $$invalidate) { + let tabComponents; + const omit_props_names = ["tabs", "sheet", "activeTab", "efx"]; + let $$restProps = compute_rest_props($$props, omit_props_names); + let { tabs: tabs2 = [] } = $$props; + let { sheet } = $$props; + let { activeTab: activeTab2 = void 0 } = $$props; + let { efx = ripple() } = $$props; + let initialTabs2 = []; + onMount(async () => { + $$invalidate(6, initialTabs2 = tabs2); + for (const tab of tabs2) { + const module = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../organisms/dnd5e/Tabs/Abilities.svelte": () => import("./Abilities-Cws_x1it.js"), "../organisms/dnd5e/Tabs/Advancements.svelte": () => import("./Advancements-NN8C0jBF.js"), "../organisms/dnd5e/Tabs/Background.svelte": () => import("./Background-CdPSlNd0.js"), "../organisms/dnd5e/Tabs/Class.svelte": () => import("./Class-fcAq_lx5.js"), "../organisms/dnd5e/Tabs/ExistingAbilities.svelte": () => import("./ExistingAbilities-CSTjZ0sf.js"), "../organisms/dnd5e/Tabs/LevelUp.svelte": () => import("./LevelUp-CEmyazSj.js"), "../organisms/dnd5e/Tabs/LevelUpExistingClassLeftCol.svelte": () => import("./LevelUpExistingClassLeftCol-Dij9sL0P.js"), "../organisms/dnd5e/Tabs/Race.svelte": () => import("./Race-CfTxV0Jo.js"), "../organisms/dnd5e/Tabs/Spells.svelte": () => import("./Spells-r1-NCKP_.js") }), `../organisms/dnd5e/Tabs/${tab.component}.svelte`, 5); + $$invalidate(4, tabComponents[tab.component] = module.default, tabComponents); + } + }); + const click_handler = (tab) => { + $$invalidate(0, activeTab2 = tab.id); + }; + $$self.$$set = ($$new_props) => { + $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)); + $$invalidate(5, $$restProps = compute_rest_props($$props, omit_props_names)); + if ("tabs" in $$new_props) $$invalidate(1, tabs2 = $$new_props.tabs); + if ("sheet" in $$new_props) $$invalidate(2, sheet = $$new_props.sheet); + if ("activeTab" in $$new_props) $$invalidate(0, activeTab2 = $$new_props.activeTab); + if ("efx" in $$new_props) $$invalidate(3, efx = $$new_props.efx); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*initialTabs, tabs*/ + 66) { + if (initialTabs2 !== tabs2) { + $$invalidate(6, initialTabs2 = tabs2); + for (const tab of tabs2) { + __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../organisms/dnd5e/Tabs/Abilities.svelte": () => import("./Abilities-Cws_x1it.js"), "../organisms/dnd5e/Tabs/Advancements.svelte": () => import("./Advancements-NN8C0jBF.js"), "../organisms/dnd5e/Tabs/Background.svelte": () => import("./Background-CdPSlNd0.js"), "../organisms/dnd5e/Tabs/Class.svelte": () => import("./Class-fcAq_lx5.js"), "../organisms/dnd5e/Tabs/ExistingAbilities.svelte": () => import("./ExistingAbilities-CSTjZ0sf.js"), "../organisms/dnd5e/Tabs/LevelUp.svelte": () => import("./LevelUp-CEmyazSj.js"), "../organisms/dnd5e/Tabs/LevelUpExistingClassLeftCol.svelte": () => import("./LevelUpExistingClassLeftCol-Dij9sL0P.js"), "../organisms/dnd5e/Tabs/Race.svelte": () => import("./Race-CfTxV0Jo.js"), "../organisms/dnd5e/Tabs/Spells.svelte": () => import("./Spells-r1-NCKP_.js") }), `../organisms/dnd5e/Tabs/${tab.component}.svelte`, 5).then((module) => { + $$invalidate(4, tabComponents[tab.component] = module.default, tabComponents); + }); + } + } + } + }; + $$invalidate(4, tabComponents = {}); + return [ + activeTab2, + tabs2, + sheet, + efx, + tabComponents, + $$restProps, + initialTabs2, + click_handler + ]; +} +class Tabs extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$c, create_fragment$c, safe_not_equal, { tabs: 1, sheet: 2, activeTab: 0, efx: 3 }); + } +} +function create_fragment$b(ctx) { + let div2; + let div0; + let t0; + let t1; + let t2; + let div1; + let t3; + let t4; + return { + c() { + div2 = element("div"); + div0 = element("div"); + t0 = text( + /*$progress*/ + ctx[1] + ); + t1 = text("% Complete"); + t2 = space(); + div1 = element("div"); + t3 = text( + /*$progress*/ + ctx[1] + ); + t4 = text("% Complete"); + attr(div0, "class", "back svelte-gas-1n7c6br"); + attr(div1, "class", "front svelte-gas-1n7c6br"); + set_style(div1, "clip-path", "inset(0 0 0 " + /*$progress*/ + ctx[1] + "%)"); + set_style(div1, "-webkit-clip-path", "inset(0 0 0 " + /*$progress*/ + ctx[1] + "%)"); + attr(div2, "class", "progress svelte-gas-1n7c6br"); + }, + m(target, anchor) { + insert(target, div2, anchor); + append(div2, div0); + append(div0, t0); + append(div0, t1); + append(div2, t2); + append(div2, div1); + append(div1, t3); + append(div1, t4); + }, + p(ctx2, [dirty]) { + if (dirty & /*$progress*/ + 2) set_data( + t0, + /*$progress*/ + ctx2[1] + ); + if (dirty & /*$progress*/ + 2) set_data( + t3, + /*$progress*/ + ctx2[1] + ); + if (dirty & /*$progress*/ + 2) { + set_style(div1, "clip-path", "inset(0 0 0 " + /*$progress*/ + ctx2[1] + "%)"); + } + if (dirty & /*$progress*/ + 2) { + set_style(div1, "-webkit-clip-path", "inset(0 0 0 " + /*$progress*/ + ctx2[1] + "%)"); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(div2); + } + } + }; +} +function instance$b($$self, $$props, $$invalidate) { + let $progress, $$unsubscribe_progress = noop, $$subscribe_progress = () => ($$unsubscribe_progress(), $$unsubscribe_progress = subscribe(progress, ($$value) => $$invalidate(1, $progress = $$value)), progress); + $$self.$$.on_destroy.push(() => $$unsubscribe_progress()); + let { progress } = $$props; + $$subscribe_progress(); + $$self.$$set = ($$props2) => { + if ("progress" in $$props2) $$subscribe_progress($$invalidate(0, progress = $$props2.progress)); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$progress*/ + 2) ; + }; + return [progress, $progress]; +} +class ProgressBar extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$b, create_fragment$b, safe_not_equal, { progress: 0 }); + } +} +function create_if_block$3(ctx) { + let div5; + let div4; + let div3; + let div2; + let div0; + let div1; + let input; + let current_block_type_index; + let if_block; + let current; + let mounted; + let dispose; + const if_block_creators = [create_if_block_1$3, create_else_block_1]; + const if_blocks = []; + function select_block_type(ctx2, dirty) { + if (!/*$isLevelUp*/ + ctx2[1]) return 0; + return 1; + } + current_block_type_index = select_block_type(ctx); + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); + return { + c() { + div5 = element("div"); + div4 = element("div"); + div3 = element("div"); + div2 = element("div"); + div0 = element("div"); + div0.innerHTML = ``; + div1 = element("div"); + input = element("input"); + if_block.c(); + attr(div0, "class", "flex0 right mt-xs no-wrap ml-md"); + attr(input, "class", "left"); + attr(input, "type", "text"); + input.value = /*value*/ + ctx[0]; + attr(div1, "class", "flex2"); + attr(div2, "class", "flexrow gap-10 svelte-gas-y7u2kp"); + attr(div3, "class", "flexcol"); + attr(div4, "class", "flex2"); + attr(div5, "class", "flexrow gap-10 pr-md mt-sm svelte-gas-y7u2kp"); + }, + m(target, anchor) { + insert(target, div5, anchor); + append(div5, div4); + append(div4, div3); + append(div3, div2); + append(div2, div0); + append(div2, div1); + append(div1, input); + if_blocks[current_block_type_index].m(div5, null); + current = true; + if (!mounted) { + dispose = listen( + input, + "input", + /*handleNameInput*/ + ctx[8] + ); + mounted = true; + } + }, + p(ctx2, dirty) { + if (!current || dirty & /*value*/ + 1 && input.value !== /*value*/ + ctx2[0]) { + input.value = /*value*/ + ctx2[0]; + } + let previous_block_index = current_block_type_index; + current_block_type_index = select_block_type(ctx2); + if (current_block_type_index === previous_block_index) { + if_blocks[current_block_type_index].p(ctx2, dirty); + } else { + group_outros(); + transition_out(if_blocks[previous_block_index], 1, 1, () => { + if_blocks[previous_block_index] = null; + }); + check_outros(); + if_block = if_blocks[current_block_type_index]; + if (!if_block) { + if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2); + if_block.c(); + } else { + if_block.p(ctx2, dirty); + } + transition_in(if_block, 1); + if_block.m(div5, null); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div5); + } + if_blocks[current_block_type_index].d(); + mounted = false; + dispose(); + } + }; +} +function create_else_block_1(ctx) { + let button; + let t; + let button_disabled_value; + let button_data_tooltip_value; + let mounted; + let dispose; + return { + c() { + button = element("button"); + t = text("Update"); + button.disabled = button_disabled_value = !/*$characterClass*/ + ctx[2]; + attr(button, "type", "button"); + attr(button, "role", "button"); + attr(button, "data-tooltip", button_data_tooltip_value = /*$characterClass*/ + ctx[2] ? "" : "First select a class to level up, or a multi-class to add"); + attr(button, "class", "svelte-gas-y7u2kp"); + }, + m(target, anchor) { + insert(target, button, anchor); + append(button, t); + if (!mounted) { + dispose = listen( + button, + "mousedown", + /*clickUpdateHandler*/ + ctx[10] + ); + mounted = true; + } + }, + p(ctx2, dirty) { + if (dirty & /*$characterClass*/ + 4 && button_disabled_value !== (button_disabled_value = !/*$characterClass*/ + ctx2[2])) { + button.disabled = button_disabled_value; + } + if (dirty & /*$characterClass*/ + 4 && button_data_tooltip_value !== (button_data_tooltip_value = /*$characterClass*/ + ctx2[2] ? "" : "First select a class to level up, or a multi-class to add")) { + attr(button, "data-tooltip", button_data_tooltip_value); + } + }, + i: noop, + o: noop, + d(detaching) { + if (detaching) { + detach(button); + } + mounted = false; + dispose(); + } + }; +} +function create_if_block_1$3(ctx) { + let div; + let progressbar; + let current; + progressbar = new ProgressBar({ props: { progress: ( + /*progress*/ + ctx[6] + ) } }); + function select_block_type_1(ctx2, dirty) { + if ( + /*$progress*/ + ctx2[5] != "100" + ) return create_if_block_2$3; + return create_else_block$2; + } + let current_block_type = select_block_type_1(ctx); + let if_block = current_block_type(ctx); + return { + c() { + div = element("div"); + create_component(progressbar.$$.fragment); + if_block.c(); + attr(div, "class", "flex1"); + }, + m(target, anchor) { + insert(target, div, anchor); + mount_component(progressbar, div, null); + if_block.m(div, null); + current = true; + }, + p(ctx2, dirty) { + if (current_block_type === (current_block_type = select_block_type_1(ctx2)) && if_block) { + if_block.p(ctx2, dirty); + } else { + if_block.d(1); + if_block = current_block_type(ctx2); + if (if_block) { + if_block.c(); + if_block.m(div, null); + } + } + }, + i(local) { + if (current) return; + transition_in(progressbar.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(progressbar.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + destroy_component(progressbar); + if_block.d(); + } + }; +} +function create_else_block$2(ctx) { + let if_block0_anchor; + let if_block1_anchor; + let if_block0 = !/*$isActorCreated*/ + ctx[3] && create_if_block_4$2(ctx); + let if_block1 = ( + /*$isActorCreated*/ + ctx[3] && create_if_block_3$2(ctx) + ); + return { + c() { + if (if_block0) if_block0.c(); + if_block0_anchor = empty(); + if (if_block1) if_block1.c(); + if_block1_anchor = empty(); + }, + m(target, anchor) { + if (if_block0) if_block0.m(target, anchor); + insert(target, if_block0_anchor, anchor); + if (if_block1) if_block1.m(target, anchor); + insert(target, if_block1_anchor, anchor); + }, + p(ctx2, dirty) { + if (!/*$isActorCreated*/ + ctx2[3]) { + if (if_block0) { + if_block0.p(ctx2, dirty); + } else { + if_block0 = create_if_block_4$2(ctx2); + if_block0.c(); + if_block0.m(if_block0_anchor.parentNode, if_block0_anchor); + } + } else if (if_block0) { + if_block0.d(1); + if_block0 = null; + } + if ( + /*$isActorCreated*/ + ctx2[3] + ) { + if (if_block1) { + if_block1.p(ctx2, dirty); + } else { + if_block1 = create_if_block_3$2(ctx2); + if_block1.c(); + if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); + } + } else if (if_block1) { + if_block1.d(1); + if_block1 = null; + } + }, + d(detaching) { + if (detaching) { + detach(if_block0_anchor); + detach(if_block1_anchor); + } + if (if_block0) if_block0.d(detaching); + if (if_block1) if_block1.d(detaching); + } + }; +} +function create_if_block_2$3(ctx) { + return { c: noop, m: noop, p: noop, d: noop }; +} +function create_if_block_4$2(ctx) { + let button; + let mounted; + let dispose; + return { + c() { + button = element("button"); + button.textContent = "Create Character"; + attr(button, "class", "mt-xs"); + attr(button, "type", "button"); + attr(button, "role", "button"); + }, + m(target, anchor) { + insert(target, button, anchor); + if (!mounted) { + dispose = listen( + button, + "mousedown", + /*clickCreateHandler*/ + ctx[9] + ); + mounted = true; + } + }, + p: noop, + d(detaching) { + if (detaching) { + detach(button); + } + mounted = false; + dispose(); + } + }; +} +function create_if_block_3$2(ctx) { + let button; + let mounted; + let dispose; + return { + c() { + button = element("button"); + button.textContent = "Update"; + attr(button, "type", "button"); + attr(button, "role", "button"); + }, + m(target, anchor) { + insert(target, button, anchor); + if (!mounted) { + dispose = listen( + button, + "mousedown", + /*clickUpdateHandler*/ + ctx[10] + ); + mounted = true; + } + }, + p: noop, + d(detaching) { + if (detaching) { + detach(button); + } + mounted = false; + dispose(); + } + }; +} +function create_fragment$a(ctx) { + let div; + let current; + let if_block = ( + /*$activeTab*/ + ctx[4] !== "advancements" && create_if_block$3(ctx) + ); + return { + c() { + div = element("div"); + if (if_block) if_block.c(); + }, + m(target, anchor) { + insert(target, div, anchor); + if (if_block) if_block.m(div, null); + current = true; + }, + p(ctx2, [dirty]) { + if ( + /*$activeTab*/ + ctx2[4] !== "advancements" + ) { + if (if_block) { + if_block.p(ctx2, dirty); + if (dirty & /*$activeTab*/ + 16) { + transition_in(if_block, 1); + } + } else { + if_block = create_if_block$3(ctx2); + if_block.c(); + transition_in(if_block, 1); + if_block.m(div, null); + } + } else if (if_block) { + group_outros(); + transition_out(if_block, 1, 1, () => { + if_block = null; + }); + check_outros(); + } + }, + i(local) { + if (current) return; + transition_in(if_block); + current = true; + }, + o(local) { + transition_out(if_block); + current = false; + }, + d(detaching) { + if (detaching) { + detach(div); + } + if (if_block) if_block.d(); + } + }; +} +function instance$a($$self, $$props, $$invalidate) { + let $actor; + let $isLevelUp; + let $actorInGame; + let $spells; + let $characterSubClass; + let $characterClass; + let $subRace; + let $race; + let $background; + let $isMultiClass; + let $isActorCreated; + let $subClassesForClass; + let $isStandardArrayValues; + let $abilityRolls; + let $pointBuy; + let $activeTab; + let $progress; + component_subscribe($$self, isLevelUp, ($$value) => $$invalidate(1, $isLevelUp = $$value)); + component_subscribe($$self, actorInGame, ($$value) => $$invalidate(14, $actorInGame = $$value)); + component_subscribe($$self, spells, ($$value) => $$invalidate(15, $spells = $$value)); + component_subscribe($$self, characterSubClass, ($$value) => $$invalidate(16, $characterSubClass = $$value)); + component_subscribe($$self, characterClass, ($$value) => $$invalidate(2, $characterClass = $$value)); + component_subscribe($$self, subRace, ($$value) => $$invalidate(17, $subRace = $$value)); + component_subscribe($$self, race, ($$value) => $$invalidate(18, $race = $$value)); + component_subscribe($$self, background, ($$value) => $$invalidate(19, $background = $$value)); + component_subscribe($$self, isMultiClass, ($$value) => $$invalidate(20, $isMultiClass = $$value)); + component_subscribe($$self, isActorCreated, ($$value) => $$invalidate(3, $isActorCreated = $$value)); + component_subscribe($$self, subClassesForClass, ($$value) => $$invalidate(21, $subClassesForClass = $$value)); + component_subscribe($$self, isStandardArrayValues, ($$value) => $$invalidate(22, $isStandardArrayValues = $$value)); + component_subscribe($$self, abilityRolls, ($$value) => $$invalidate(23, $abilityRolls = $$value)); + component_subscribe($$self, pointBuy, ($$value) => $$invalidate(24, $pointBuy = $$value)); + component_subscribe($$self, activeTab, ($$value) => $$invalidate(4, $activeTab = $$value)); + const stores = [ + race, + characterClass, + characterSubClass, + background, + abilityGenerationMethod, + pointBuy, + abilityRolls, + isStandardArrayValues + ]; + function isAbilityGenerationMethodReady(method) { + if (!method) { + return false; + } + switch (method) { + case 2: + game.system.log.d("pointBuy", $pointBuy); + return $pointBuy.scoreTotal === $pointBuy.pointBuyLimit; + case 3: + game.system.log.d("abilityRolls", $abilityRolls); + return Object.keys($abilityRolls).length === 6; + case 4: + return $isStandardArrayValues; + default: + return true; + } + } + const progress = derived(stores, ($stores) => { + const [ + race2, + characterClass2, + characterSubClass2, + background2, + abilityGenerationMethod2, + pointBuy2, + abilityRolls2, + isStandardArrayValues2 + ] = $stores; + $subClassesForClass.length > 0 ? 5 : 4; + const total = $stores.slice(0, 5).length; + const completed = $stores.slice(0, 5).filter((value2, index) => { + if (index === 4) { + return isAbilityGenerationMethodReady(abilityGenerationMethod2); + } + return !!value2; + }).length; + return completed / total * 100; + }); + component_subscribe($$self, progress, (value2) => $$invalidate(5, $progress = value2)); + let { value = null } = $$props; + const actor = getContext("#doc"); + component_subscribe($$self, actor, (value2) => $$invalidate(11, $actor = value2)); + getContext("#external").application; + let actorName = $actor?.name || ""; + const handleNameInput = (e) => { + if ($isLevelUp) { + actorName = e.target.value; + } else { + $actor.updateSource({ name: e.target.value }); + } + }; + const clickCreateHandler = async () => { + await createActorInGameAndEmbedItems(); + set_store_value(isActorCreated, $isActorCreated = true, $isActorCreated); + }; + const clickUpdateHandler = async () => { + await updateActorAndEmbedItems(); + }; + const updateActorAndEmbedItems = async () => { + await $actor.update({ name: actorName }); + set_store_value(actorInGame, $actorInGame = $actor, $actorInGame); + const data = { + actor: $actorInGame, + id: "characterClass", + itemData: $characterClass, + isLevelUp: $isLevelUp, + isMultiClass: $isMultiClass + }; + if ($characterClass) { + dropItemRegistry.add(data); + } + dropItemRegistry.advanceQueue(true); + }; + const createActorInGameAndEmbedItems = async () => { + const test = $actor.toObject(); + test.name = $actor.name; + set_store_value(actorInGame, $actorInGame = await Actor.create($actor.toObject()), $actorInGame); + if ($background) { + game.system.log.i("Adding background to character"); + const backgroundData = $background; + dropItemRegistry.add({ + actor: $actorInGame, + id: "background", + itemData: backgroundData, + isLevelUp: $isLevelUp + }); + } + if ($race) { + game.system.log.i("Adding race to character"); + const raceData = $race; + dropItemRegistry.add({ + actor: $actorInGame, + id: "race", + itemData: raceData, + isLevelUp: $isLevelUp + }); + } + if ($subRace) { + game.system.log.i("Adding subrace to character"); + const subRaceData = $subRace; + dropItemRegistry.add({ + actor: $actorInGame, + id: "subRace", + itemData: subRaceData, + isLevelUp: $isLevelUp + }); + } + if ($characterClass) { + game.system.log.i("Adding class to character", $characterClass); + const characterClassData = $characterClass; + dropItemRegistry.add({ + actor: $actorInGame, + id: "characterClass", + itemData: characterClassData, + isLevelUp: $isLevelUp + }); + } + if ($characterSubClass) { + game.system.log.i("Adding subclass to character"); + const characterSubClassData = $characterSubClass; + dropItemRegistry.add({ + actor: $actorInGame, + id: "characterSubClass", + itemData: characterSubClassData, + isLevelUp: $isLevelUp + }); + } + if ($spells) { + game.system.log.i("Adding spells to character"); + const spellsData = $spells; + dropItemRegistry.add({ + actor: $actorInGame, + id: "spells", + itemData: spellsData, + isLevelUp: $isLevelUp + }); + } + dropItemRegistry.advanceQueue(true); + }; + $$self.$$set = ($$props2) => { + if ("value" in $$props2) $$invalidate(0, value = $$props2.value); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*$actor*/ + 2048) { + $$invalidate(0, value = $actor?.name || ""); + } + if ($$self.$$.dirty & /*$actor, value*/ + 2049) { + $actor?.flags?.[MODULE_ID]?.tokenName || value; + } + }; + return [ + value, + $isLevelUp, + $characterClass, + $isActorCreated, + $activeTab, + $progress, + progress, + actor, + handleNameInput, + clickCreateHandler, + clickUpdateHandler, + $actor + ]; +} +class Footer extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$a, create_fragment$a, safe_not_equal, { value: 0 }); + } +} +const tabs = [ + { + label: "Abilities", + id: "abilities" + }, + { + label: "Race", + id: "race" + }, + { + label: "Background", + id: "background" + }, + { + label: "Class", + id: "class" + } +]; +const actorTypes = { + character: true, + npc: false, + group: false, + vehicle: false +}; +const multiclassing = { + Artificer: { + type: "any", + abilities: [ + { + abilityAbbreviation: "int", + value: 13 + } + ] + }, + Barbarian: { + type: "any", + abilities: [ + { + abilityAbbreviation: "str", + value: 13 + } + ] + }, + Bard: { + type: "any", + abilities: [ + { + abilityAbbreviation: "cha", + value: 13 + } + ] + }, + Cleric: { + type: "any", + abilities: [ + { + abilityAbbreviation: "wis", + value: 13 + } + ] + }, + Druid: { + type: "any", + abilities: [ + { + abilityAbbreviation: "wis", + value: 13 + } + ] + }, + Fighter: { + type: "any", + abilities: [ + { + abilityAbbreviation: "str", + value: 13 + }, + { + abilityAbbreviation: "dex", + value: 13 + } + ] + }, + Monk: { + type: "all", + abilities: [ + { + abilityAbbreviation: "dex", + value: 13 + }, + { + abilityAbbreviation: "wis", + value: 13 + } + ] + }, + Paladin: { + type: "all", + abilities: [ + { + abilityAbbreviation: "str", + value: 13 + }, + { + abilityAbbreviation: "cha", + value: 13 + } + ] + }, + Ranger: { + type: "all", + abilities: [ + { + abilityAbbreviation: "dex", + value: 13 + }, + { + abilityAbbreviation: "wis", + value: 13 + } + ] + }, + Rogue: { + type: "any", + abilities: [ + { + abilityAbbreviation: "dex", + value: 13 + } + ] + }, + Sorcerer: { + type: "any", + abilities: [ + { + abilityAbbreviation: "cha", + value: 13 + } + ] + }, + Warlock: { + type: "any", + abilities: [ + { + abilityAbbreviation: "cha", + value: 13 + } + ] + }, + Wizard: { + type: "any", + abilities: [ + { + abilityAbbreviation: "int", + value: 13 + } + ] + } +}; +const dnd5e = { + tabs, + actorTypes, + multiclassing +}; +function create_default_slot$2(ctx) { + let main; + let section0; + let tabs_1; + let updating_activeTab; + let section1; + let footer; + let current; + function tabs_1_activeTab_binding(value) { + ctx[8](value); + } + let tabs_1_props = { + class: "gas-tabs", + tabs: ( + /*filteredTabs*/ + ctx[2] + ), + sheet: "PC" + }; + if ( + /*$activeTab*/ + ctx[3] !== void 0 + ) { + tabs_1_props.activeTab = /*$activeTab*/ + ctx[3]; + } + tabs_1 = new Tabs({ props: tabs_1_props }); + binding_callbacks.push(() => bind(tabs_1, "activeTab", tabs_1_activeTab_binding)); + footer = new Footer({}); + return { + c() { + main = element("main"); + section0 = element("section"); + create_component(tabs_1.$$.fragment); + section1 = element("section"); + create_component(footer.$$.fragment); + attr(section0, "class", "a svelte-gas-1ii4ih"); + attr(section1, "class", "b svelte-gas-1ii4ih"); + attr(main, "class", "svelte-gas-1ii4ih"); + }, + m(target, anchor) { + insert(target, main, anchor); + append(main, section0); + mount_component(tabs_1, section0, null); + append(main, section1); + mount_component(footer, section1, null); + current = true; + }, + p(ctx2, dirty) { + const tabs_1_changes = {}; + if (dirty & /*filteredTabs*/ + 4) tabs_1_changes.tabs = /*filteredTabs*/ + ctx2[2]; + if (!updating_activeTab && dirty & /*$activeTab*/ + 8) { + updating_activeTab = true; + tabs_1_changes.activeTab = /*$activeTab*/ + ctx2[3]; + add_flush_callback(() => updating_activeTab = false); + } + tabs_1.$set(tabs_1_changes); + }, + i(local) { + if (current) return; + transition_in(tabs_1.$$.fragment, local); + transition_in(footer.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(tabs_1.$$.fragment, local); + transition_out(footer.$$.fragment, local); + current = false; + }, + d(detaching) { + if (detaching) { + detach(main); + } + destroy_component(tabs_1); + destroy_component(footer); + } + }; +} +function create_fragment$9(ctx) { + let applicationshell; + let updating_elementRoot; + let current; + function applicationshell_elementRoot_binding(value) { + ctx[9](value); + } + let applicationshell_props = { + stylesApp: true, + $$slots: { default: [create_default_slot$2] }, + $$scope: { ctx } + }; + if ( + /*elementRoot*/ + ctx[0] !== void 0 + ) { + applicationshell_props.elementRoot = /*elementRoot*/ + ctx[0]; + } + applicationshell = new ApplicationShell({ props: applicationshell_props }); + binding_callbacks.push(() => bind(applicationshell, "elementRoot", applicationshell_elementRoot_binding)); + return { + c() { + create_component(applicationshell.$$.fragment); + }, + m(target, anchor) { + mount_component(applicationshell, target, anchor); + current = true; + }, + p(ctx2, [dirty]) { + const applicationshell_changes = {}; + if (dirty & /*$$scope, filteredTabs, $activeTab*/ + 65548) { + applicationshell_changes.$$scope = { dirty, ctx: ctx2 }; + } + if (!updating_elementRoot && dirty & /*elementRoot*/ + 1) { + updating_elementRoot = true; + applicationshell_changes.elementRoot = /*elementRoot*/ + ctx2[0]; + add_flush_callback(() => updating_elementRoot = false); + } + applicationshell.$set(applicationshell_changes); + }, + i(local) { + if (current) return; + transition_in(applicationshell.$$.fragment, local); + current = true; + }, + o(local) { + transition_out(applicationshell.$$.fragment, local); + current = false; + }, + d(detaching) { + destroy_component(applicationshell, detaching); + } + }; +} +function instance$9($$self, $$props, $$invalidate) { + let filteredTabs; + let $actorInGame; + let $isLevelUp; + let $documentStore, $$unsubscribe_documentStore = noop, $$subscribe_documentStore = () => ($$unsubscribe_documentStore(), $$unsubscribe_documentStore = subscribe(documentStore, ($$value) => $$invalidate(12, $documentStore = $$value)), documentStore); + let $tabs; + let $levelUpTabs; + let $activeTab; + component_subscribe($$self, actorInGame, ($$value) => $$invalidate(10, $actorInGame = $$value)); + component_subscribe($$self, isLevelUp, ($$value) => $$invalidate(11, $isLevelUp = $$value)); + component_subscribe($$self, tabs$1, ($$value) => $$invalidate(6, $tabs = $$value)); + component_subscribe($$self, levelUpTabs, ($$value) => $$invalidate(7, $levelUpTabs = $$value)); + component_subscribe($$self, activeTab, ($$value) => $$invalidate(3, $activeTab = $$value)); + $$self.$$.on_destroy.push(() => $$unsubscribe_documentStore()); + let { elementRoot } = $$props; + let { documentStore } = $$props; + $$subscribe_documentStore(); + let { document: document2 } = $$props; + let { levelUp = false } = $$props; + setContext("#doc", documentStore); + const application = getContext("#external").application; + set_store_value(activeTab, $activeTab = levelUp ? $levelUpTabs[0].id : $tabs[0].id, $activeTab); + onMount(async () => { + if (levelUp) { + set_store_value(actorInGame, $actorInGame = $documentStore, $actorInGame); + } + isLevelUp.set(levelUp); + }); + onDestroy(() => { + resetStores(); + Hooks.off("gas.close", gasClose); + }); + function gasClose() { + if (!$isLevelUp) { + $actorInGame.sheet.render(true); + } + resetStores(); + application.close(); + } + Hooks.once("gas.close", gasClose); + function tabs_1_activeTab_binding(value) { + $activeTab = value; + activeTab.set($activeTab); + } + function applicationshell_elementRoot_binding(value) { + elementRoot = value; + $$invalidate(0, elementRoot); + } + $$self.$$set = ($$props2) => { + if ("elementRoot" in $$props2) $$invalidate(0, elementRoot = $$props2.elementRoot); + if ("documentStore" in $$props2) $$subscribe_documentStore($$invalidate(1, documentStore = $$props2.documentStore)); + if ("document" in $$props2) $$invalidate(4, document2 = $$props2.document); + if ("levelUp" in $$props2) $$invalidate(5, levelUp = $$props2.levelUp); + }; + $$self.$$.update = () => { + if ($$self.$$.dirty & /*levelUp, $levelUpTabs, $tabs*/ + 224) { + $$invalidate(2, filteredTabs = levelUp ? $levelUpTabs : $tabs); + } + }; + return [ + elementRoot, + documentStore, + filteredTabs, + $activeTab, + document2, + levelUp, + $tabs, + $levelUpTabs, + tabs_1_activeTab_binding, + applicationshell_elementRoot_binding + ]; +} +class PCAppShell extends SvelteComponent { + constructor(options) { + super(); + init(this, options, instance$9, create_fragment$9, safe_not_equal, { + elementRoot: 0, + documentStore: 1, + document: 4, + levelUp: 5 + }); + } + get elementRoot() { + return this.$$.ctx[0]; + } + set elementRoot(elementRoot) { + this.$$set({ elementRoot }); + flush(); + } + get documentStore() { + return this.$$.ctx[1]; + } + set documentStore(documentStore) { + this.$$set({ documentStore }); + flush(); + } + get document() { + return this.$$.ctx[4]; + } + set document(document2) { + this.$$set({ document: document2 }); + flush(); + } + get levelUp() { + return this.$$.ctx[5]; + } + set levelUp(levelUp) { + this.$$set({ levelUp }); + flush(); + } +} +class PCApplication extends SvelteApplication { + /** + * Document store that monitors updates to any assigned document. + * + * @type {TJSDocument} + */ + #documentStore = new TJSDocument(void 0, { delete: this.close.bind(this) }); + /** + * Holds the document unsubscription function. + * + * @type {Function} + */ + #storeUnsubscribe; + constructor(object, levelUp = false) { + super(object); + Object.defineProperty(this.reactive, "document", { + get: () => this.#documentStore.get(), + set: (document2) => { + this.#documentStore.set(document2); + } + }); + this.reactive.document = object; + this.levelUp = levelUp; + } + /** + * Default Application options + * + * @returns {object} options - Application options. + * @see https://foundryvtt.com/api/Application.html#options + */ + static get defaultOptions() { + this.title; + return foundry.utils.mergeObject(super.defaultOptions, { + id: "foundryvtt-actor-studio-pc-sheet", + title: game.i18n.localize("GAS.ActorStudio") + " - " + game.i18n.localize("GAS.PCTitle"), + classes: [MODULE_CODE], + width: game.settings.get(MODULE_ID, "windowX") || 700, + height: game.settings.get(MODULE_ID, "windowX") || 800, + headerIcon: "modules/foundryvtt-actor-studio/assets/actor-studio-logo-dragon-white.svg", + minWidth: 500, + padding: 0, + resizable: true, + focusAuto: false, + minimizable: true, + svelte: { + class: PCAppShell, + target: document.body, + props: function() { + return { documentStore: this.#documentStore, document: this.reactive.document, levelUp: this.levelUp }; + } + } + }); + } + /** + * Drag&Drop handling + */ + _canDragStart(selector) { + return true; + } + _canDragDrop(selector) { + return this.reactive.document.isOwner || game.user.isGM; + } + _onDragOver(event) { + } + _onDragStart(event) { + } + async _onDrop(event) { + } + async close(options = {}) { + await super.close(options); + if (this.#storeUnsubscribe) { + this.#storeUnsubscribe(); + this.#storeUnsubscribe = void 0; + } + } + /** + * Handles any changes to document. + * + * @param {foundry.abstract.Document} doc - + * + * @param {object} options - + */ + async #handleDocUpdate(doc, options) { + const { action, data, documentType } = options; + if ((action === void 0 || action === "update" || action === "subscribe") && doc) { + const tokenText = doc.flags?.[MODULE_ID]?.tokenName ? ` (${doc.flags[MODULE_ID].tokenName})` : ""; + this.reactive.title = `${game.i18n.localize("GAS.ActorStudio") + " - " + game.i18n.localize("GAS.PCTitle")} - ${doc.name} ${tokenText}`; + } + } + render(force = false, options = {}) { + if (!this.#storeUnsubscribe) { + this.#storeUnsubscribe = this.#documentStore.subscribe(this.#handleDocUpdate.bind(this)); + } + super.render(force, options); + return this; + } +} +const description = "Easily create Heroes, Villains and everything in between."; +const license = "MIT"; +const version = "1.5.7"; +const type = "module"; +const authors = [ + { + name: "Noel da Costa", + discord: "@geoidesic" + } +]; +const imports = { + "#runtime/*": "@typhonjs-fvtt/runtime/*", + "#standard/*": "@typhonjs-fvtt/svelte-standard/*" +}; +const dependencies = { + "@floating-ui/core": "^1.6.1", + "@typhonjs-fvtt/runtime": "^0.1.3", + "@typhonjs-fvtt/svelte-standard": "^0.1.0", + svelte: "^4.2.16", + "svelte-floating-ui": "^1.5.8", + "svelte-select": "^5.8.3" +}; +const devDependencies = { + "@league-of-foundry-developers/foundry-vtt-types": "^9.280.0", + "@typescript-eslint/eslint-plugin": "^7.8.0", + "@typescript-eslint/parser": "^7.8.0", + eslint: "^9.2.0", + html2pug: "^4.0.0", + prettier: "^3.2.5", + pug: "^3.0.2", + "pug-cli": "^1.0.0-alpha6", + "svelte-preprocess": "^5.1.4", + typescript: "^5.4.5", + vite: "^5.2.11" +}; +const browserslist = [ + ">5%", + "not IE 11" +]; +const scripts = { + dev: " > dist/style.css; /* blank the style.css to enable HMR for css in dev */; vite;", + build: "vite build", + eslint: "eslint .", + release: "node release.js" +}; +const packageJson = { + description, + license, + "private": false, + version, + type, + authors, + imports, + dependencies, + devDependencies, + browserslist, + scripts +}; +const pulseKeyframes = ` +@keyframes pulse { + 0%, 100% { + opacity: 1; + } + 50% { + opacity: 0.5; + } +} +`; +function registerSettings$1() { + game.settings.register(MODULE_ID, "enableLevelUp", { + name: game.i18n.localize("GAS.Setting.EnableLevelUp.Name"), + hint: game.i18n.localize("GAS.Setting.EnableLevelUp.Hint"), + scope: "world", + config: true, + default: true, + type: Boolean + }); +} +function dnd5eSheet2UI(app, html, data) { + const actor = data.actor; + const sheetheader = html.find(".sheet-header"); + const buttons = sheetheader.find(".sheet-header-buttons"); + if (!game.settings.get(MODULE_ID, "milestoneLeveling") && actor.system.details.xp.max - actor.system.details.xp.value > 0) return; + buttons.css("gap", "0.35rem"); + const levelUpButton = $(` + + `); + levelUpButton.on("click", async (event) => { + new PCApplication(app.actor, true).render(true, { focus: true }); + }); + $("\n","import {\n\trun_all,\n\tsubscribe,\n\tnoop,\n\tsafe_not_equal,\n\tis_function,\n\tget_store_value\n} from '../internal/index.js';\n\nconst subscriber_queue = [];\n\n/**\n * Creates a `Readable` store that allows reading by subscription.\n *\n * https://svelte.dev/docs/svelte-store#readable\n * @template T\n * @param {T} [value] initial value\n * @param {import('./public.js').StartStopNotifier} [start]\n * @returns {import('./public.js').Readable}\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 * https://svelte.dev/docs/svelte-store#writable\n * @template T\n * @param {T} [value] initial value\n * @param {import('./public.js').StartStopNotifier} [start]\n * @returns {import('./public.js').Writable}\n */\nexport function writable(value, start = noop) {\n\t/** @type {import('./public.js').Unsubscriber} */\n\tlet stop;\n\t/** @type {Set>} */\n\tconst subscribers = new Set();\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 {import('./public.js').Updater} fn\n\t * @returns {void}\n\t */\n\tfunction update(fn) {\n\t\tset(fn(value));\n\t}\n\n\t/**\n\t * @param {import('./public.js').Subscriber} run\n\t * @param {import('./private.js').Invalidator} [invalidate]\n\t * @returns {import('./public.js').Unsubscriber}\n\t */\n\tfunction subscribe(run, invalidate = noop) {\n\t\t/** @type {import('./private.js').SubscribeInvalidateTuple} */\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(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 * https://svelte.dev/docs/svelte-store#derived\n * @template {import('./private.js').Stores} S\n * @template T\n * @overload\n * @param {S} stores - input stores\n * @param {(values: import('./private.js').StoresValues, set: (value: T) => void, update: (fn: import('./public.js').Updater) => void) => import('./public.js').Unsubscriber | void} fn - function callback that aggregates the values\n * @param {T} [initial_value] - initial value\n * @returns {import('./public.js').Readable}\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 * https://svelte.dev/docs/svelte-store#derived\n * @template {import('./private.js').Stores} S\n * @template T\n * @overload\n * @param {S} stores - input stores\n * @param {(values: import('./private.js').StoresValues) => T} fn - function callback that aggregates the values\n * @param {T} [initial_value] - initial value\n * @returns {import('./public.js').Readable}\n */\n\n/**\n * @template {import('./private.js').Stores} S\n * @template T\n * @param {S} stores\n * @param {Function} fn\n * @param {T} [initial_value]\n * @returns {import('./public.js').Readable}\n */\nexport function derived(stores, fn, initial_value) {\n\tconst single = !Array.isArray(stores);\n\t/** @type {Array>} */\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\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 = is_function(result) ? result : noop;\n\t\t\t}\n\t\t};\n\t\tconst unsubscribers = stores_array.map((store, i) =>\n\t\t\tsubscribe(\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 * https://svelte.dev/docs/svelte-store#readonly\n * @template T\n * @param {import('./public.js').Readable} store - store to make readonly\n * @returns {import('./public.js').Readable}\n */\nexport function readonly(store) {\n\treturn {\n\t\tsubscribe: store.subscribe.bind(store)\n\t};\n}\n\nexport { get_store_value as get };\n","import { writable } from 'svelte/store';\n\n/**\n * Provides the internal context to all application shells.\n */\nexport class AppShellContextInternal\n{\n /** @type {InternalAppStores} */\n #stores;\n\n constructor()\n {\n this.#stores = {\n elementContent: writable(void 0),\n elementRoot: writable(void 0)\n };\n\n Object.freeze(this.#stores);\n Object.seal(this);\n }\n\n /**\n * @returns {InternalAppStores} The internal context stores for elementContent / elementRoot\n */\n get stores()\n {\n return this.#stores;\n }\n}\n\n/**\n * @typedef {object} InternalAppStores\n *\n * @property {import('svelte/store').Writable} elementContent The window content element.\n *\n * @property {import('svelte/store').Writable} elementRoot The window root element.\n */\n","import { isObject } from '@typhonjs-fvtt/runtime/util/object';\nimport { group_outros, transition_out, check_outros } from 'svelte/internal';\n\n/**\n * Provides basic duck typing to determine if the provided object is a HMR ProxyComponent instance or class.\n *\n * @param {*} comp - Data to check as a HMR proxy component.\n *\n * @returns {boolean} Whether basic duck typing succeeds.\n */\nfunction isHMRProxy(comp)\n{\n const instanceName = comp?.constructor?.name;\n if (typeof instanceName === 'string' && (instanceName.startsWith('Proxy<') || instanceName === 'ProxyComponent'))\n {\n return true;\n }\n\n const prototypeName = comp?.prototype?.constructor?.name;\n return typeof prototypeName === 'string' && (prototypeName.startsWith('Proxy<') ||\n prototypeName === 'ProxyComponent');\n}\n\n/**\n * Provides basic duck typing to determine if the provided function is a constructor function for a Svelte component.\n *\n * @param {*} comp - Data to check as a Svelte component.\n *\n * @returns {boolean} Whether basic duck typing succeeds.\n */\nfunction isSvelteComponent(comp)\n{\n if (comp === null || comp === void 0 || typeof comp !== 'function') { return false; }\n\n // When using Vite in a developer build the SvelteComponent is wrapped in a ProxyComponent class.\n // This class doesn't define methods on the prototype, so we must check if the constructor name\n // starts with `Proxy<` as it provides the wrapped component as `Proxy<_wrapped component name_>`.\n const prototypeName = comp?.prototype?.constructor?.name;\n if (typeof prototypeName === 'string' && (prototypeName.startsWith('Proxy<') || prototypeName === 'ProxyComponent'))\n {\n return true;\n }\n\n return typeof window !== 'undefined' ?\n typeof comp.prototype.$destroy === 'function' && typeof comp.prototype.$on === 'function' : // client-side\n typeof comp.render === 'function'; // server-side\n}\n\n/**\n * Validates `config` argument whether it is a valid {@link TJSSvelteConfig}.\n *\n * @param {*} config - The potential config object to validate.\n *\n * @param {boolean} [raiseException=false] - If validation fails raise an exception.\n *\n * @returns {boolean} Is the config a valid TJSSvelteConfig.\n *\n * @throws {TypeError} Any validation error when `raiseException` is enabled.\n */\nfunction isTJSSvelteConfig(config, raiseException = false)\n{\n if (!isObject(config))\n {\n if (raiseException) { throw new TypeError(`isTJSSvelteConfig error: 'config' is not an object.`); }\n return false;\n }\n\n if (!isSvelteComponent(config.class))\n {\n if (raiseException)\n {\n throw new TypeError(`isTJSSvelteConfig error: 'config.class' is not a Svelte component constructor.`);\n }\n return false;\n }\n\n return true;\n}\n\n/* eslint-disable */ // jsdoc/valid-types doesn't like the Google closure constructor function. TODO: verify in future eslint-plugin-jsdoc version\n/**\n * @typedef {object} TJSSvelteConfig Defines the TRL / client side configuration object to load a Svelte component.\n *\n * @property {({\n * new(options: import('svelte').ComponentConstructorOptions):\n * import('svelte').SvelteComponent | import('svelte').SvelteComponentTyped\n * })} class The Svelte component class / constructor function.\n *\n * @property {HTMLElement | ShadowRoot} [target=document.body] A {@link HTMLElement} or {@link ShadowRoot} to\n * render to. By default, `document.body` is used as the target if not otherwise defined.\n *\n * @property {HTMLElement} [anchor] A child of `target` to render the component immediately before.\n *\n * @property {() => Record | Record} [props] Props to pass to the component.\n *\n * @property {() => (Record | Map) | Map | Record} [context] The root-level\n * context to pass to the component.\n *\n * @property {boolean} [hydrate] See description in main Svelte docs\n * {@link https://svelte.dev/docs/client-side-component-api#creating-a-component | Creating a component.}\n *\n * @property {boolean} [intro] If true, will play transitions on initial render, rather than waiting for subsequent\n * state changes.\n*/\n/* eslint-enable */\n\n/**\n * Runs outro transition then destroys Svelte component.\n *\n * Workaround for https://github.com/sveltejs/svelte/issues/4056\n *\n * @param {*} instance - A Svelte component.\n */\nasync function outroAndDestroy(instance)\n{\n return new Promise((resolve) =>\n {\n if (instance.$$.fragment && instance.$$.fragment.o)\n {\n group_outros();\n transition_out(instance.$$.fragment, 0, 0, () =>\n {\n instance.$destroy();\n resolve();\n });\n check_outros();\n }\n else\n {\n instance.$destroy();\n resolve();\n }\n });\n}\n\n/**\n * Parses a TyphonJS Svelte config object ensuring that classes specified are Svelte components and props are set\n * correctly.\n *\n * @param {object} config - Svelte config object.\n *\n * @param {*} [thisArg] - `This` reference to set for invoking any props function.\n *\n * @returns {object} The processed Svelte config object.\n */\nfunction parseTJSSvelteConfig(config, thisArg = void 0)\n{\n if (!isObject(config))\n {\n throw new TypeError(`parseSvelteConfig - 'config' is not an object:\\n${JSON.stringify(config)}.`);\n }\n\n if (!isSvelteComponent(config.class))\n {\n throw new TypeError(\n `parseSvelteConfig - 'class' is not a Svelte component constructor for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.hydrate !== void 0 && typeof config.hydrate !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'hydrate' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.intro !== void 0 && typeof config.intro !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'intro' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.target !== void 0 && typeof config.target !== 'string' && !(config.target instanceof HTMLElement) &&\n !(config.target instanceof ShadowRoot) && !(config.target instanceof DocumentFragment))\n {\n throw new TypeError(\n `parseSvelteConfig - 'target' is not a string, HTMLElement, ShadowRoot, or DocumentFragment for config:\\n${\n JSON.stringify(config)}.`);\n }\n\n if (config.anchor !== void 0 && typeof config.anchor !== 'string' && !(config.anchor instanceof HTMLElement) &&\n !(config.anchor instanceof ShadowRoot) && !(config.anchor instanceof DocumentFragment))\n {\n throw new TypeError(\n `parseSvelteConfig - 'anchor' is not a string, HTMLElement, ShadowRoot, or DocumentFragment for config:\\n${\n JSON.stringify(config)}.`);\n }\n\n if (config.context !== void 0 && typeof config.context !== 'function' && !(config.context instanceof Map) &&\n !isObject(config.context))\n {\n throw new TypeError(\n `parseSvelteConfig - 'context' is not a Map, function or object for config:\\n${JSON.stringify(config)}.`);\n }\n\n // Validate extra TyphonJS options --------------------------------------------------------------------------------\n\n // `selectorTarget` optionally stores a target element found in main element.\n if (config.selectorTarget !== void 0 && typeof config.selectorTarget !== 'string')\n {\n throw new TypeError(\n `parseSvelteConfig - 'selectorTarget' is not a string for config:\\n${JSON.stringify(config)}.`);\n }\n\n // `options` stores `injectApp`, `injectEventbus`, and `selectorElement`.\n if (config.options !== void 0 && !isObject(config.options))\n {\n throw new TypeError(\n `parseSvelteConfig - 'options' is not an object for config:\\n${JSON.stringify(config)}.`);\n }\n\n // Validate TyphonJS standard options.\n if (config.options !== void 0)\n {\n if (config.options.injectApp !== void 0 && typeof config.options.injectApp !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'options.injectApp' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n if (config.options.injectEventbus !== void 0 && typeof config.options.injectEventbus !== 'boolean')\n {\n throw new TypeError(\n `parseSvelteConfig - 'options.injectEventbus' is not a boolean for config:\\n${JSON.stringify(config)}.`);\n }\n\n // `selectorElement` optionally stores a main element selector to be found in a HTMLElement target.\n if (config.options.selectorElement !== void 0 && typeof config.options.selectorElement !== 'string')\n {\n throw new TypeError(\n `parseSvelteConfig - 'selectorElement' is not a string for config:\\n${JSON.stringify(config)}.`);\n }\n }\n\n const svelteConfig = { ...config };\n\n // Delete extra Svelte options.\n delete svelteConfig.options;\n\n let externalContext = {};\n\n // If a context callback function is provided then invoke it with `this` being the Foundry app.\n // If an object is returned it adds the entries to external context.\n if (typeof svelteConfig.context === 'function')\n {\n const contextFunc = svelteConfig.context;\n delete svelteConfig.context;\n\n const result = contextFunc.call(thisArg);\n if (isObject(result))\n {\n externalContext = { ...result };\n }\n else\n {\n throw new Error(`parseSvelteConfig - 'context' is a function that did not return an object for config:\\n${\n JSON.stringify(config)}`);\n }\n }\n else if (svelteConfig.context instanceof Map)\n {\n externalContext = Object.fromEntries(svelteConfig.context);\n delete svelteConfig.context;\n }\n else if (isObject(svelteConfig.context))\n {\n externalContext = svelteConfig.context;\n delete svelteConfig.context;\n }\n\n // If a props is a function then invoke it with `this` being the Foundry app.\n // If an object is returned set it as the props.\n svelteConfig.props = s_PROCESS_PROPS(svelteConfig.props, thisArg, config);\n\n // Process children components attaching to external context.\n if (Array.isArray(svelteConfig.children))\n {\n const children = [];\n\n for (let cntr = 0; cntr < svelteConfig.children.length; cntr++)\n {\n const child = svelteConfig.children[cntr];\n\n if (!isSvelteComponent(child.class))\n {\n throw new Error(`parseSvelteConfig - 'class' is not a Svelte component for child[${cntr}] for config:\\n${\n JSON.stringify(config)}`);\n }\n\n child.props = s_PROCESS_PROPS(child.props, thisArg, config);\n\n children.push(child);\n }\n\n if (children.length > 0)\n {\n externalContext.children = children;\n }\n\n delete svelteConfig.children;\n }\n else if (isObject(svelteConfig.children))\n {\n if (!isSvelteComponent(svelteConfig.children.class))\n {\n throw new Error(`parseSvelteConfig - 'class' is not a Svelte component for children object for config:\\n${\n JSON.stringify(config)}`);\n }\n\n svelteConfig.children.props = s_PROCESS_PROPS(svelteConfig.children.props, thisArg, config);\n\n externalContext.children = [svelteConfig.children];\n delete svelteConfig.children;\n }\n\n if (!(svelteConfig.context instanceof Map))\n {\n svelteConfig.context = new Map();\n }\n\n svelteConfig.context.set('#external', externalContext);\n\n return svelteConfig;\n}\n\n/**\n * Processes Svelte props. Potentially props can be a function to invoke with `thisArg`.\n *\n * @param {object|Function} props - Svelte props.\n *\n * @param {*} thisArg - `This` reference to set for invoking any props function.\n *\n * @param {object} config - Svelte config\n *\n * @returns {object|void} Svelte props.\n */\nfunction s_PROCESS_PROPS(props, thisArg, config)\n{\n // If a props is a function then invoke it with `this` being the Foundry app.\n // If an object is returned set it as the props.\n if (typeof props === 'function')\n {\n const result = props.call(thisArg);\n if (isObject(result))\n {\n return result;\n }\n else\n {\n throw new Error(`parseSvelteConfig - 'props' is a function that did not return an object for config:\\n${\n JSON.stringify(config)}`);\n }\n }\n else if (isObject(props))\n {\n return props;\n }\n else if (props !== void 0)\n {\n throw new Error(\n `parseSvelteConfig - 'props' is not a function or an object for config:\\n${JSON.stringify(config)}`);\n }\n\n return {};\n}\n\nexport { isHMRProxy, isSvelteComponent, isTJSSvelteConfig, outroAndDestroy, parseTJSSvelteConfig };\n//# sourceMappingURL=index.js.map\n","import { isObject } from '@typhonjs-fvtt/runtime/util/object';\n\n/**\n * A helper to create a set of radio checkbox input elements in a named set.\n * The provided keys are the possible radio values while the provided values are human readable labels.\n *\n * @param {string} name The radio checkbox field name\n *\n * @param {object} choices A mapping of radio checkbox values to human readable labels\n *\n * @param {object} options Options which customize the radio boxes creation\n *\n * @param {string} options.checked Which key is currently checked?\n *\n * @param {boolean} options.localize Pass each label through string localization?\n *\n * @returns {string} HTML for radio boxes.\n *\n * @example The provided input data\n * let groupName = \"importantChoice\";\n * let choices = {a: \"Choice A\", b: \"Choice B\"};\n * let chosen = \"a\";\n *\n * @example The template HTML structure\n *
\n * \n *
\n * {@html radioBoxes(groupName, choices, { checked: chosen, localize: true})}\n *
\n *
\n */\nfunction radioBoxes(name, choices, options)\n{\n const checked = options['checked'] || null;\n\n const localize = options['localize'] || false;\n\n let html = '';\n\n for (let [key, label] of Object.entries(choices)) // eslint-disable-line prefer-const\n {\n if (localize) { label = globalThis.game.i18n.localize(label); }\n const isChecked = checked === key;\n html += ``;\n }\n\n return new globalThis.Handlebars.SafeString(html);\n}\n\n/**\n * Converts the `selectOptions` Handlebars helper to be Svelte compatible. This is useful when initially converting\n * over an app to Svelte and for essential usage to several dialogs that mirror the core Foundry experience. For\n * an example of usage see {@link TJSDocumentOwnership}.\n *\n * A helper to create a set of `;\n }\n\n return new globalThis.Handlebars.SafeString(html);\n}\n\n/**\n * Localize a string including variable formatting for input arguments. Provide a string ID which defines the localized\n * template. Variables can be included in the template enclosed in braces and will be substituted using those named\n * keys.\n *\n * @param {string} stringId - The string ID to translate.\n *\n * @param {object} [data] - Provided input data.\n *\n * @returns {string} The translated and formatted string\n */\nfunction localize(stringId, data)\n{\n const result = !isObject(data) ? globalThis.game.i18n.localize(stringId) :\n globalThis.game.i18n.format(stringId, data);\n\n return result !== void 0 ? result : '';\n}\n\nexport { localize, radioBoxes, selectOptions };\n//# sourceMappingURL=index.js.map\n","import { derived, get } from 'svelte/store';\n\n/**\n * @external Store\n * @see [Svelte stores](https://svelte.dev/docs#component-format-script-4-prefix-stores-with-$-to-access-their-values-store-contract)\n */\n\n/**\n * Create a store similar to [Svelte's `derived`](https://svelte.dev/docs#run-time-svelte-store-writable),\n * but which has its own `set` and `update` methods and can send values back to the origin stores.\n * [Read more...](https://github.com/PixievoltNo1/svelte-writable-derived#default-export-writablederived)\n * \n * @param {Store|Store[]} origins One or more stores to derive from. Same as\n * [`derived`](https://svelte.dev/docs#run-time-svelte-store-writable)'s 1st parameter.\n * @param {!Function} derive The callback to determine the derived value. Same as\n * [`derived`](https://svelte.dev/docs#run-time-svelte-store-writable)'s 2nd parameter.\n * @param {!Function} reflect Called when the derived store gets a new value via its `set` or\n * `update` methods, and determines new values for the origin stores.\n * [Read more...](https://github.com/PixievoltNo1/svelte-writable-derived#new-parameter-reflect)\n * @param [initial] The new store's initial value. Same as\n * [`derived`](https://svelte.dev/docs#run-time-svelte-store-writable)'s 3rd parameter.\n * \n * @returns {Store} A writable store.\n */\nfunction writableDerived(origins, derive, reflect, initial) {\n\tvar childDerivedSetter, originValues, blockNextDerive = false;\n\tvar reflectOldValues = reflect.length >= 2;\n\tvar wrappedDerive = (got, set, update) => {\n\t\tchildDerivedSetter = set;\n\t\tif (reflectOldValues) {\n\t\t\toriginValues = got;\n\t\t}\n\t\tif (!blockNextDerive) {\n\t\t\tlet returned = derive(got, set, update);\n\t\t\tif (derive.length < 2) {\n\t\t\t\tset(returned);\n\t\t\t} else {\n\t\t\t\treturn returned;\n\t\t\t}\n\t\t}\n\t\tblockNextDerive = false;\n\t};\n\tvar childDerived = derived(origins, wrappedDerive, initial);\n\t\n\tvar singleOrigin = !Array.isArray(origins);\n\tfunction doReflect(reflecting) {\n\t\tvar setWith = reflect(reflecting, originValues);\n\t\tif (singleOrigin) {\n\t\t\tblockNextDerive = true;\n\t\t\torigins.set(setWith);\n\t\t} else {\n\t\t\tsetWith.forEach( (value, i) => {\n\t\t\t\tblockNextDerive = true;\n\t\t\t\torigins[i].set(value);\n\t\t\t} );\n\t\t}\n\t\tblockNextDerive = false;\n\t}\n\t\n\tvar tryingSet = false;\n\tfunction update(fn) {\n\t\tvar isUpdated, mutatedBySubscriptions, oldValue, newValue;\n\t\tif (tryingSet) {\n\t\t\tnewValue = fn( get(childDerived) );\n\t\t\tchildDerivedSetter(newValue);\n\t\t\treturn;\n\t\t}\n\t\tvar unsubscribe = childDerived.subscribe( (value) => {\n\t\t\tif (!tryingSet) {\n\t\t\t\toldValue = value;\n\t\t\t} else if (!isUpdated) {\n\t\t\t\tisUpdated = true;\n\t\t\t} else {\n\t\t\t\tmutatedBySubscriptions = true;\n\t\t\t}\n\t\t} );\n\t\tnewValue = fn(oldValue);\n\t\ttryingSet = true;\n\t\tchildDerivedSetter(newValue);\n\t\tunsubscribe();\n\t\ttryingSet = false;\n\t\tif (mutatedBySubscriptions) {\n\t\t\tnewValue = get(childDerived);\n\t\t}\n\t\tif (isUpdated) {\n\t\t\tdoReflect(newValue);\n\t\t}\n\t}\n\treturn {\n\t\tsubscribe: childDerived.subscribe,\n\t\tset(value) { update( () => value ); },\n\t\tupdate,\n\t};\n}\n\n/**\n * Create a store for a property value in an object contained in another store.\n * [Read more...](https://github.com/PixievoltNo1/svelte-writable-derived#named-export-propertystore)\n * \n * @param {Store} origin The store containing the object to get/set from.\n * @param {string|number|symbol|Array} propName The property to get/set, or a path of\n * properties in nested objects.\n *\n * @returns {Store} A writable store.\n */\nfunction propertyStore(origin, propName) {\n\tif (!Array.isArray(propName)) {\n\t\treturn writableDerived(\n\t\t\torigin,\n\t\t\t(object) => object[propName],\n\t\t\t(reflecting, object) => {\n\t\t\t\tobject[propName] = reflecting;\n\t\t\t\treturn object;\n\t\t\t},\n\t\t);\n\t} else {\n\t\tlet props = propName.concat();\n\t\treturn writableDerived(\n\t\t\torigin,\n\t\t\t(value) => {\n\t\t\t\tfor (let i = 0; i < props.length; ++i) {\n\t\t\t\t\tvalue = value[ props[i] ];\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\t(reflecting, object) => {\n\t\t\t\tlet target = object;\n\t\t\t\tfor (let i = 0; i < props.length - 1; ++i) {\n\t\t\t\t\ttarget = target[ props[i] ];\n\t\t\t\t}\n\t\t\t\ttarget[ props[props.length - 1] ] = reflecting;\n\t\t\t\treturn object;\n\t\t\t},\n\t\t);\n\t}\n}\n\nexport { propertyStore, writableDerived };\n//# sourceMappingURL=index.js.map\n","const EPSILON = 0.000001;\n\nconst IDENTITY_2X2 = new Float32Array([\n 1, 0,\n 0, 1\n]);\n/**\n * A 2x2 Matrix\n */\nclass Mat2 extends Float32Array {\n /**\n * The number of bytes in a {@link Mat2}.\n */\n static BYTE_LENGTH = 4 * Float32Array.BYTES_PER_ELEMENT;\n /**\n * Create a {@link Mat2}.\n */\n constructor(...values) {\n switch (values.length) {\n case 4:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 4);\n break;\n case 1:\n const v = values[0];\n if (typeof v === 'number') {\n super([\n v, v,\n v, v\n ]);\n }\n else {\n super(v, 0, 4);\n }\n break;\n default:\n super(IDENTITY_2X2);\n break;\n }\n }\n //============\n // Attributes\n //============\n /**\n * A string representation of `this`\n * Equivalent to `Mat2.str(this);`\n */\n get str() {\n return Mat2.str(this);\n }\n //===================\n // Instance methods\n //===================\n /**\n * Copy the values from another {@link Mat2} into `this`.\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat2.identity(this)\n *\n * @returns `this`\n */\n identity() {\n this.set(IDENTITY_2X2);\n return this;\n }\n /**\n * Multiplies this {@link Mat2} against another one\n * Equivalent to `Mat2.multiply(this, this, b);`\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `this`\n */\n multiply(b) {\n return Mat2.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat2.multiply}\n */\n mul(b) { return this; }\n /**\n * Transpose this {@link Mat2}\n * Equivalent to `Mat2.transpose(this, this);`\n *\n * @returns `this`\n */\n transpose() {\n return Mat2.transpose(this, this);\n }\n /**\n * Inverts this {@link Mat2}\n * Equivalent to `Mat4.invert(this, this);`\n *\n * @returns `this`\n */\n invert() {\n return Mat2.invert(this, this);\n }\n /**\n * Scales this {@link Mat2} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat2.scale(this, this, v);`\n *\n * @param v - The {@link Vec2} to scale the matrix by\n * @returns `this`\n */\n scale(v) {\n return Mat2.scale(this, this, v);\n }\n /**\n * Rotates this {@link Mat2} by the given angle around the given axis\n * Equivalent to `Mat2.rotate(this, this, rad);`\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n rotate(rad) {\n return Mat2.rotate(this, this, rad);\n }\n //================\n // Static methods\n //================\n /**\n * Creates a new, identity {@link Mat2}\n * @category Static\n *\n * @returns A new {@link Mat2}\n */\n static create() {\n return new Mat2();\n }\n /**\n * Creates a new {@link Mat2} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat2}\n */\n static clone(a) {\n return new Mat2(a);\n }\n /**\n * Copy the values from one {@link Mat2} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Create a new {@link Mat2} with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat2}\n */\n static fromValues(...values) {\n return new Mat2(...values);\n }\n /**\n * Set the components of a {@link Mat2} to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n return out;\n }\n /**\n * Set a {@link Mat2} to the identity matrix\n * @category Static\n *\n * @param out - The receiving matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n }\n /**\n * Transpose the values of a {@link Mat2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache\n // some values\n if (out === a) {\n let a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n }\n else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n return out;\n }\n /**\n * Inverts a {@link Mat2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static invert(out, a) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n // Calculate the determinant\n let det = a0 * a3 - a2 * a1;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n return out;\n }\n /**\n * Calculates the adjugate of a {@link Mat2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static adjoint(out, a) {\n // Caching this value is necessary if out == a\n const a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat2}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n return a[0] * a[3] - a[2] * a[1];\n }\n /**\n * Adds two {@link Mat2}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n }\n /**\n * Alias for {@link Mat2.subtract}\n * @category Static\n */\n static sub(out, a, b) { return out; }\n /**\n * Multiplies two {@link Mat2}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n }\n /**\n * Alias for {@link Mat2.multiply}\n * @category Static\n */\n static mul(out, a, b) { return out; }\n /**\n * Rotates a {@link Mat2} by the given angle\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotate(out, a, rad) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n }\n /**\n * Scales the {@link Mat2} by the dimensions in the given {@link Vec2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec2} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const v0 = v[0];\n const v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n }\n /**\n * Creates a {@link Mat2} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.rotate(dest, dest, rad);\n * @category Static\n *\n * @param out - {@link Mat2} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n return out;\n }\n /**\n * Creates a {@link Mat2} from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.scale(dest, dest, vec);\n * @category Static\n *\n * @param out - {@link Mat2} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat2}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\n }\n /**\n * Multiply each element of a {@link Mat2} by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n }\n /**\n * Adds two {@link Mat2}'s after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n }\n /**\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\n * @category Static\n *\n * @param L - the lower triangular matrix\n * @param D - the diagonal matrix\n * @param U - the upper triangular matrix\n * @param a - the input matrix to factorize\n */\n static LDU(L, D, U, a) {\n L[2] = a[2] / a[0];\n U[0] = a[0];\n U[1] = a[1];\n U[3] = a[3] - L[2] * U[1];\n return [L, D, U];\n }\n /**\n * Returns whether or not two {@link Mat2}s have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return (a[0] === b[0] &&\n a[1] === b[1] &&\n a[2] === b[2] &&\n a[3] === b[3]);\n }\n /**\n * Returns whether or not two {@link Mat2}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n return (Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)));\n }\n /**\n * Returns a string representation of a {@link Mat2}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat2(${a.join(', ')})`;\n }\n}\n// Instance method alias assignments\nMat2.prototype.mul = Mat2.prototype.multiply;\n// Static method alias assignments\nMat2.mul = Mat2.multiply;\nMat2.sub = Mat2.subtract;\n\nconst IDENTITY_2X3 = new Float32Array([\n 1, 0,\n 0, 1,\n 0, 0,\n]);\n/**\n * A 2x3 Matrix\n */\nclass Mat2d extends Float32Array {\n /**\n * The number of bytes in a {@link Mat2d}.\n */\n static BYTE_LENGTH = 6 * Float32Array.BYTES_PER_ELEMENT;\n /**\n * Create a {@link Mat2}.\n */\n constructor(...values) {\n switch (values.length) {\n case 6:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 6);\n break;\n case 1:\n const v = values[0];\n if (typeof v === 'number') {\n super([\n v, v,\n v, v,\n v, v\n ]);\n }\n else {\n super(v, 0, 6);\n }\n break;\n default:\n super(IDENTITY_2X3);\n break;\n }\n }\n //============\n // Attributes\n //============\n /**\n * A string representation of `this`\n * Equivalent to `Mat2d.str(this);`\n */\n get str() {\n return Mat2d.str(this);\n }\n //===================\n // Instances methods\n //===================\n /**\n * Copy the values from another {@link Mat2d} into `this`.\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat2d.identity(this)\n *\n * @returns `this`\n */\n identity() {\n this.set(IDENTITY_2X3);\n return this;\n }\n /**\n * Multiplies this {@link Mat2d} against another one\n * Equivalent to `Mat2d.multiply(this, this, b);`\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `this`\n */\n multiply(b) {\n return Mat2d.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat2d.multiply}\n */\n mul(b) { return this; }\n /**\n * Translate this {@link Mat2d} by the given vector\n * Equivalent to `Mat2d.translate(this, this, v);`\n *\n * @param v - The {@link Vec2} to translate by\n * @returns `this`\n */\n translate(v) {\n return Mat2d.translate(this, this, v);\n }\n /**\n * Rotates this {@link Mat2d} by the given angle around the given axis\n * Equivalent to `Mat2d.rotate(this, this, rad);`\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n rotate(rad) {\n return Mat2d.rotate(this, this, rad);\n }\n /**\n * Scales this {@link Mat2d} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat2d.scale(this, this, v);`\n *\n * @param v - The {@link Vec2} to scale the matrix by\n * @returns `this`\n */\n scale(v) {\n return Mat2d.scale(this, this, v);\n }\n //================\n // Static methods\n //================\n /**\n * Creates a new, identity {@link Mat2d}\n * @category Static\n *\n * @returns A new {@link Mat2d}\n */\n static create() {\n return new Mat2d();\n }\n /**\n * Creates a new {@link Mat2d} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat2d}\n */\n static clone(a) {\n return new Mat2d(a);\n }\n /**\n * Copy the values from one {@link Mat2d} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n }\n /**\n * Create a new {@link Mat2d} with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat2d}\n */\n static fromValues(...values) {\n return new Mat2d(...values);\n }\n /**\n * Set the components of a {@link Mat2d} to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n out[4] = values[4];\n out[5] = values[5];\n return out;\n }\n /**\n * Set a {@link Mat2d} to the identity matrix\n * @category Static\n *\n * @param out - The receiving matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n }\n /**\n * Inverts a {@link Mat2d}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static invert(out, a) {\n const aa = a[0];\n const ab = a[1];\n const ac = a[2];\n const ad = a[3];\n const atx = a[4];\n const aty = a[5];\n let det = aa * ad - ab * ac;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat2d}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n return a[0] * a[3] - a[1] * a[2];\n }\n /**\n * Adds two {@link Mat2d}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n return out;\n }\n /**\n * Alias for {@link Mat2d.subtract}\n * @category Static\n */\n static sub(out, a, b) { return out; }\n /**\n * Multiplies two {@link Mat2d}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n out[4] = a0 * b4 + a2 * b5 + a4;\n out[5] = a1 * b4 + a3 * b5 + a5;\n return out;\n }\n /**\n * Alias for {@link Mat2d.multiply}\n * @category Static\n */\n static mul(out, a, b) { return out; }\n /**\n * Translate a {@link Mat2d} by the given vector\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const v0 = v[0];\n const v1 = v[1];\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = a0 * v0 + a2 * v1 + a4;\n out[5] = a1 * v0 + a3 * v1 + a5;\n return out;\n }\n /**\n * Rotates a {@link Mat2d} by the given angle\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotate(out, a, rad) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n out[4] = a4;\n out[5] = a5;\n return out;\n }\n /**\n * Scales the {@link Mat2d} by the dimensions in the given {@link Vec2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec2} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const v0 = v[0];\n const v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n out[4] = a4;\n out[5] = a5;\n return out;\n }\n // TODO: Got to fromRotation\n /**\n * Creates a {@link Mat2d} from a vector translation\n * This is equivalent to (but much faster than):\n *\n * Mat2d.identity(dest);\n * Mat2d.translate(dest, dest, vec);\n * @category Static\n *\n * @param out - {@link Mat2d} receiving operation result\n * @param v - Translation vector\n * @returns `out`\n */\n static fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = v[0];\n out[5] = v[1];\n return out;\n }\n /**\n * Creates a {@link Mat2d} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * Mat2d.identity(dest);\n * Mat2d.rotate(dest, dest, rad);\n * @category Static\n *\n * @param out - {@link Mat2d} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n out[4] = 0;\n out[5] = 0;\n return out;\n }\n /**\n * Creates a {@link Mat2d} from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * Mat2d.identity(dest);\n * Mat2d.scale(dest, dest, vec);\n * @category Static\n *\n * @param out - {@link Mat2d} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n out[4] = 0;\n out[5] = 0;\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat2d}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\n }\n /**\n * Multiply each element of a {@link Mat2d} by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n return out;\n }\n /**\n * Adds two {@link Mat2d}'s after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n return out;\n }\n /**\n * Returns whether or not two {@link Mat2d}s have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return (a[0] === b[0] &&\n a[1] === b[1] &&\n a[2] === b[2] &&\n a[3] === b[3] &&\n a[4] === b[4] &&\n a[5] === b[5]);\n }\n /**\n * Returns whether or not two {@link Mat2d}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n return (Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\n Math.abs(a4 - b4) <= EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\n Math.abs(a5 - b5) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)));\n }\n /**\n * Returns a string representation of a {@link Mat2d}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat2d(${a.join(', ')})`;\n }\n}\n// Static method alias assignments\nMat2d.mul = Mat2d.multiply;\nMat2d.sub = Mat2d.subtract;\n\nconst IDENTITY_3X3 = new Float32Array([\n 1, 0, 0,\n 0, 1, 0,\n 0, 0, 1,\n]);\n/**\n * A 3x3 Matrix\n */\nclass Mat3 extends Float32Array {\n /**\n * The number of bytes in a {@link Mat3}.\n */\n static BYTE_LENGTH = 9 * Float32Array.BYTES_PER_ELEMENT;\n /**\n * Create a {@link Mat3}.\n */\n constructor(...values) {\n switch (values.length) {\n case 9:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 9);\n break;\n case 1:\n const v = values[0];\n if (typeof v === 'number') {\n super([\n v, v, v,\n v, v, v,\n v, v, v\n ]);\n }\n else {\n super(v, 0, 9);\n }\n break;\n default:\n super(IDENTITY_3X3);\n break;\n }\n }\n //============\n // Attributes\n //============\n /**\n * A string representation of `this`\n * Equivalent to `Mat3.str(this);`\n */\n get str() {\n return Mat3.str(this);\n }\n //===================\n // Instance methods\n //===================\n /**\n * Copy the values from another {@link Mat3} into `this`.\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat3.identity(this)\n *\n * @returns `this`\n */\n identity() {\n this.set(IDENTITY_3X3);\n return this;\n }\n /**\n * Multiplies this {@link Mat3} against another one\n * Equivalent to `Mat3.multiply(this, this, b);`\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `this`\n */\n multiply(b) {\n return Mat3.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat3.multiply}\n */\n mul(b) { return this; }\n /**\n * Transpose this {@link Mat3}\n * Equivalent to `Mat3.transpose(this, this);`\n *\n * @returns `this`\n */\n transpose() {\n return Mat3.transpose(this, this);\n }\n /**\n * Inverts this {@link Mat3}\n * Equivalent to `Mat4.invert(this, this);`\n *\n * @returns `this`\n */\n invert() {\n return Mat3.invert(this, this);\n }\n /**\n * Translate this {@link Mat3} by the given vector\n * Equivalent to `Mat3.translate(this, this, v);`\n *\n * @param v - The {@link Vec2} to translate by\n * @returns `this`\n */\n translate(v) {\n return Mat3.translate(this, this, v);\n }\n /**\n * Rotates this {@link Mat3} by the given angle around the given axis\n * Equivalent to `Mat3.rotate(this, this, rad);`\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n rotate(rad) {\n return Mat3.rotate(this, this, rad);\n }\n /**\n * Scales this {@link Mat3} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat3.scale(this, this, v);`\n *\n * @param v - The {@link Vec2} to scale the matrix by\n * @returns `this`\n */\n scale(v) {\n return Mat3.scale(this, this, v);\n }\n //================\n // Static methods\n //================\n /**\n * Creates a new, identity {@link Mat3}\n * @category Static\n *\n * @returns A new {@link Mat3}\n */\n static create() {\n return new Mat3();\n }\n /**\n * Creates a new {@link Mat3} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat3}\n */\n static clone(a) {\n return new Mat3(a);\n }\n /**\n * Copy the values from one {@link Mat3} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n }\n /**\n * Create a new {@link Mat3} with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat3}\n */\n static fromValues(...values) {\n return new Mat3(...values);\n }\n /**\n * Set the components of a {@link Mat3} to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n out[4] = values[4];\n out[5] = values[5];\n out[6] = values[6];\n out[7] = values[7];\n out[8] = values[8];\n return out;\n }\n /**\n * Set a {@link Mat3} to the identity matrix\n * @category Static\n *\n * @param out - The receiving matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n }\n /**\n * Transpose the values of a {@link Mat3}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n const a01 = a[1], a02 = a[2], a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n }\n else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n return out;\n }\n /**\n * Inverts a {@link Mat3}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static invert(out, a) {\n const a00 = a[0], a01 = a[1], a02 = a[2];\n const a10 = a[3], a11 = a[4], a12 = a[5];\n const a20 = a[6], a21 = a[7], a22 = a[8];\n const b01 = a22 * a11 - a12 * a21;\n const b11 = -a22 * a10 + a12 * a20;\n const b21 = a21 * a10 - a11 * a20;\n // Calculate the determinant\n let det = a00 * b01 + a01 * b11 + a02 * b21;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n }\n /**\n * Calculates the adjugate of a {@link Mat3}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static adjoint(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat3}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n return (a00 * (a22 * a11 - a12 * a21) +\n a01 * (-a22 * a10 + a12 * a20) +\n a02 * (a21 * a10 - a11 * a20));\n }\n /**\n * Adds two {@link Mat3}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n }\n /**\n * Alias for {@link Mat3.subtract}\n * @category Static\n */\n static sub(out, a, b) { return out; }\n /**\n * Multiplies two {@link Mat3}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n let b0 = b[0];\n let b1 = b[1];\n let b2 = b[2];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22;\n b0 = b[3];\n b1 = b[4];\n b2 = b[5];\n out[3] = b0 * a00 + b1 * a10 + b2 * a20;\n out[4] = b0 * a01 + b1 * a11 + b2 * a21;\n out[5] = b0 * a02 + b1 * a12 + b2 * a22;\n b0 = b[6];\n b1 = b[7];\n b2 = b[8];\n out[6] = b0 * a00 + b1 * a10 + b2 * a20;\n out[7] = b0 * a01 + b1 * a11 + b2 * a21;\n out[8] = b0 * a02 + b1 * a12 + b2 * a22;\n return out;\n }\n /**\n * Alias for {@link Mat3.multiply}\n * @category Static\n */\n static mul(out, a, b) { return out; }\n /**\n * Translate a {@link Mat3} by the given vector\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const x = v[0];\n const y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n }\n /**\n * Rotates a {@link Mat3} by the given angle\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotate(out, a, rad) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n }\n /**\n * Scales the {@link Mat3} by the dimensions in the given {@link Vec2}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec2} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const x = v[0];\n const y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n }\n /**\n * Creates a {@link Mat3} from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.translate(dest, dest, vec);\n * @category Static\n *\n * @param out - {@link Mat3} receiving operation result\n * @param v - Translation vector\n * @returns `out`\n */\n static fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat3} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.rotate(dest, dest, rad);\n * @category Static\n *\n * @param out - {@link Mat3} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat3} from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.scale(dest, dest, vec);\n * @category Static\n *\n * @param out - {@link Mat3} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n }\n /**\n * Copies the upper-left 3x3 values of a {@link Mat2d} into the given\n * {@link Mat3}.\n * @category Static\n *\n * @param out - the receiving 3x3 matrix\n * @param a - the source 2x3 matrix\n * @returns `out`\n */\n static fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n }\n /**\n * Calculates a {@link Mat3} from the given quaternion\n *\n * @param out - {@link Mat3} receiving operation result\n * @param q - {@link Quat} to create matrix from\n * @returns `out`\n */\n static fromQuat(out, q) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n }\n /**\n * Copies the upper-left 3x3 values of a {@link Mat4} into the given\n * {@link Mat3}.\n * @category Static\n *\n * @param out - the receiving 3x3 matrix\n * @param a - the source 4x4 matrix\n * @returns `out`\n */\n static fromMat4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n }\n /**\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n * @category Static\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\n * @returns `out`\n */\n static normalFromMat4(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n // Calculate the determinant\n let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n }\n /**\n * Generates a 2D projection matrix with the given bounds\n * @category Static\n *\n * @param out mat3 frustum matrix will be written into\n * @param width Width of your gl context\n * @param height Height of gl context\n * @returns `out`\n */\n static projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat3}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(a[0] * a[0] +\n a[1] * a[1] +\n a[2] * a[2] +\n a[3] * a[3] +\n a[4] * a[4] +\n a[5] * a[5] +\n a[6] * a[6] +\n a[7] * a[7] +\n a[8] * a[8]);\n }\n /**\n * Multiply each element of a {@link Mat3} by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n }\n /**\n * Adds two {@link Mat3}'s after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n }\n /**\n * Returns whether or not two {@link Mat3}s have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return (a[0] === b[0] &&\n a[1] === b[1] &&\n a[2] === b[2] &&\n a[3] === b[3] &&\n a[4] === b[4] &&\n a[5] === b[5] &&\n a[6] === b[6] &&\n a[7] === b[7] &&\n a[8] === b[8]);\n }\n /**\n * Returns whether or not two {@link Mat3}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const a8 = a[8];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n const b8 = b[8];\n return (Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\n Math.abs(a4 - b4) <= EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\n Math.abs(a5 - b5) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\n Math.abs(a6 - b6) <= EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\n Math.abs(a7 - b7) <= EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\n Math.abs(a8 - b8) <= EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)));\n }\n /**\n * Returns a string representation of a {@link Mat3}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat3(${a.join(', ')})`;\n }\n}\n// Instance method alias assignments\nMat3.prototype.mul = Mat3.prototype.multiply;\n// Static method alias assignments\nMat3.mul = Mat3.multiply;\nMat3.sub = Mat3.subtract;\n\nconst IDENTITY_4X4 = new Float32Array([\n 1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1,\n]);\n/**\n * A 4x4 Matrix\n */\nclass Mat4 extends Float32Array {\n /**\n * The number of bytes in a {@link Mat4}.\n */\n static BYTE_LENGTH = 16 * Float32Array.BYTES_PER_ELEMENT;\n /**\n * Create a {@link Mat4}.\n */\n constructor(...values) {\n switch (values.length) {\n case 16:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 16);\n break;\n case 1:\n const v = values[0];\n if (typeof v === 'number') {\n super([\n v, v, v, v,\n v, v, v, v,\n v, v, v, v,\n v, v, v, v\n ]);\n }\n else {\n super(v, 0, 16);\n }\n break;\n default:\n super(IDENTITY_4X4);\n break;\n }\n }\n //============\n // Attributes\n //============\n /**\n * A string representation of `this`\n * Equivalent to `Mat4.str(this);`\n */\n get str() {\n return Mat4.str(this);\n }\n //===================\n // Instance methods\n //===================\n /**\n * Copy the values from another {@link Mat4} into `this`.\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Set `this` to the identity matrix\n * Equivalent to Mat4.identity(this)\n *\n * @returns `this`\n */\n identity() {\n this.set(IDENTITY_4X4);\n return this;\n }\n /**\n * Multiplies this {@link Mat4} against another one\n * Equivalent to `Mat4.multiply(this, this, b);`\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `this`\n */\n multiply(b) {\n return Mat4.multiply(this, this, b);\n }\n /**\n * Alias for {@link Mat4.multiply}\n */\n mul(b) { return this; }\n /**\n * Transpose this {@link Mat4}\n * Equivalent to `Mat4.transpose(this, this);`\n *\n * @returns `this`\n */\n transpose() {\n return Mat4.transpose(this, this);\n }\n /**\n * Inverts this {@link Mat4}\n * Equivalent to `Mat4.invert(this, this);`\n *\n * @returns `this`\n */\n invert() {\n return Mat4.invert(this, this);\n }\n /**\n * Translate this {@link Mat4} by the given vector\n * Equivalent to `Mat4.translate(this, this, v);`\n *\n * @param v - The {@link Vec3} to translate by\n * @returns `this`\n */\n translate(v) {\n return Mat4.translate(this, this, v);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the given axis\n * Equivalent to `Mat4.rotate(this, this, rad, axis);`\n *\n * @param rad - the angle to rotate the matrix by\n * @param axis - the axis to rotate around\n * @returns `out`\n */\n rotate(rad, axis) {\n return Mat4.rotate(this, this, rad, axis);\n }\n /**\n * Scales this {@link Mat4} by the dimensions in the given vec3 not using vectorization\n * Equivalent to `Mat4.scale(this, this, v);`\n *\n * @param v - The {@link Vec3} to scale the matrix by\n * @returns `this`\n */\n scale(v) {\n return Mat4.scale(this, this, v);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the X axis\n * Equivalent to `Mat4.rotateX(this, this, rad);`\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotateX(rad) {\n return Mat4.rotateX(this, this, rad);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the Y axis\n * Equivalent to `Mat4.rotateY(this, this, rad);`\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotateY(rad) {\n return Mat4.rotateY(this, this, rad);\n }\n /**\n * Rotates this {@link Mat4} by the given angle around the Z axis\n * Equivalent to `Mat4.rotateZ(this, this, rad);`\n *\n * @param rad - the angle to rotate the matrix by\n * @returns `this`\n */\n rotateZ(rad) {\n return Mat4.rotateZ(this, this, rad);\n }\n /**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * Equivalent to `Mat4.perspectiveNO(this, fovy, aspect, near, far);`\n *\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `this`\n */\n perspectiveNO(fovy, aspect, near, far) {\n return Mat4.perspectiveNO(this, fovy, aspect, near, far);\n }\n /**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * Equivalent to `Mat4.perspectiveZO(this, fovy, aspect, near, far);`\n *\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `this`\n */\n perspectiveZO(fovy, aspect, near, far) {\n return Mat4.perspectiveZO(this, fovy, aspect, near, far);\n }\n /**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Equivalent to `Mat4.orthoNO(this, left, right, bottom, top, near, far);`\n *\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `this`\n */\n orthoNO(left, right, bottom, top, near, far) {\n return Mat4.orthoNO(this, left, right, bottom, top, near, far);\n }\n /**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Equivalent to `Mat4.orthoZO(this, left, right, bottom, top, near, far);`\n *\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `this`\n */\n orthoZO(left, right, bottom, top, near, far) {\n return Mat4.orthoZO(this, left, right, bottom, top, near, far);\n }\n //================\n // Static methods\n //================\n /**\n * Creates a new, identity {@link Mat4}\n * @category Static\n *\n * @returns A new {@link Mat4}\n */\n static create() {\n return new Mat4();\n }\n /**\n * Creates a new {@link Mat4} initialized with values from an existing matrix\n * @category Static\n *\n * @param a - Matrix to clone\n * @returns A new {@link Mat4}\n */\n static clone(a) {\n return new Mat4(a);\n }\n /**\n * Copy the values from one {@link Mat4} to another\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - Matrix to copy\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n /**\n * Create a new mat4 with the given values\n * @category Static\n *\n * @param values - Matrix components\n * @returns A new {@link Mat4}\n */\n static fromValues(...values) {\n return new Mat4(...values);\n }\n /**\n * Set the components of a mat4 to the given values\n * @category Static\n *\n * @param out - The receiving matrix\n * @param values - Matrix components\n * @returns `out`\n */\n static set(out, ...values) {\n out[0] = values[0];\n out[1] = values[1];\n out[2] = values[2];\n out[3] = values[3];\n out[4] = values[4];\n out[5] = values[5];\n out[6] = values[6];\n out[7] = values[7];\n out[8] = values[8];\n out[9] = values[9];\n out[10] = values[10];\n out[11] = values[11];\n out[12] = values[12];\n out[13] = values[13];\n out[14] = values[14];\n out[15] = values[15];\n return out;\n }\n /**\n * Set a {@link Mat4} to the identity matrix\n * @category Static\n *\n * @param out - The receiving Matrix\n * @returns `out`\n */\n static identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Transpose the values of a {@link Mat4}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n const a01 = a[1], a02 = a[2], a03 = a[3];\n const a12 = a[6], a13 = a[7];\n const a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n }\n else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n return out;\n }\n /**\n * Inverts a {@link Mat4}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static invert(out, a) {\n const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];\n const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n // Calculate the determinant\n let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n }\n /**\n * Calculates the adjugate of a {@link Mat4}\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the source matrix\n * @returns `out`\n */\n static adjoint(out, a) {\n const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];\n const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\n return out;\n }\n /**\n * Calculates the determinant of a {@link Mat4}\n * @category Static\n *\n * @param a - the source matrix\n * @returns determinant of a\n */\n static determinant(a) {\n const a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3];\n const a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7];\n const a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11];\n const a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n const b0 = a00 * a11 - a01 * a10;\n const b1 = a00 * a12 - a02 * a10;\n const b2 = a01 * a12 - a02 * a11;\n const b3 = a20 * a31 - a21 * a30;\n const b4 = a20 * a32 - a22 * a30;\n const b5 = a21 * a32 - a22 * a31;\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\n // Calculate the determinant\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\n }\n /**\n * Multiplies two {@link Mat4}s\n * @category Static\n *\n * @param out - The receiving Matrix\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n // Cache only the current line of the second matrix\n let b0 = b[0];\n let b1 = b[1];\n let b2 = b[2];\n let b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n }\n /**\n * Alias for {@link Mat4.multiply}\n * @category Static\n */\n static mul(out, a, b) { return out; }\n /**\n * Translate a {@link Mat4} by the given vector\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const x = v[0];\n const y = v[1];\n const z = v[2];\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n }\n else {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n return out;\n }\n /**\n * Scales the {@link Mat4} by the dimensions in the given {@link Vec3} not using vectorization\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param v - the {@link Vec3} to scale the matrix by\n * @returns `out`\n **/\n static scale(out, a, v) {\n const x = v[0];\n const y = v[1];\n const z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n }\n /**\n * Rotates a {@link Mat4} by the given angle around the given axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @param axis - the axis to rotate around\n * @returns `out`\n */\n static rotate(out, a, rad, axis) {\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n let len = Math.sqrt(x * x + y * y + z * z);\n if (len < EPSILON) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const t = 1 - c;\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n // Construct the elements of the rotation matrix\n const b00 = x * x * t + c;\n const b01 = y * x * t + z * s;\n const b02 = z * x * t - y * s;\n const b10 = x * y * t - z * s;\n const b11 = y * y * t + c;\n const b12 = z * y * t + x * s;\n const b20 = x * z * t + y * s;\n const b21 = y * z * t - x * s;\n const b22 = z * z * t + c;\n // Perform rotation-specific matrix multiplication\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n }\n /**\n * Rotates a matrix by the given angle around the X axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotateX(out, a, rad) {\n let s = Math.sin(rad);\n let c = Math.cos(rad);\n let a10 = a[4];\n let a11 = a[5];\n let a12 = a[6];\n let a13 = a[7];\n let a20 = a[8];\n let a21 = a[9];\n let a22 = a[10];\n let a23 = a[11];\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n // Perform axis-specific matrix multiplication\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n }\n /**\n * Rotates a matrix by the given angle around the Y axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotateY(out, a, rad) {\n let s = Math.sin(rad);\n let c = Math.cos(rad);\n let a00 = a[0];\n let a01 = a[1];\n let a02 = a[2];\n let a03 = a[3];\n let a20 = a[8];\n let a21 = a[9];\n let a22 = a[10];\n let a23 = a[11];\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n }\n /**\n * Rotates a matrix by the given angle around the Z axis\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to rotate\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static rotateZ(out, a, rad) {\n let s = Math.sin(rad);\n let c = Math.cos(rad);\n let a00 = a[0];\n let a01 = a[1];\n let a02 = a[2];\n let a03 = a[3];\n let a10 = a[4];\n let a11 = a[5];\n let a12 = a[6];\n let a13 = a[7];\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n }\n /**\n * Creates a {@link Mat4} from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n * @category Static\n *\n * @param out - {@link Mat4} receiving operation result\n * @param v - Translation vector\n * @returns `out`\n */\n static fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat4} from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n * @category Static\n *\n * @param out - {@link Mat4} receiving operation result\n * @param v - Scaling vector\n * @returns `out`\n */\n static fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a {@link Mat4} from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n * @category Static\n *\n * @param out - {@link Mat4} receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @param axis - the axis to rotate around\n * @returns `out`\n */\n static fromRotation(out, rad, axis) {\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n let len = Math.sqrt(x * x + y * y + z * z);\n if (len < EPSILON) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const t = 1 - c;\n // Perform rotation-specific matrix multiplication\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromXRotation(out, rad) {\n let s = Math.sin(rad);\n let c = Math.cos(rad);\n // Perform axis-specific matrix multiplication\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromYRotation(out, rad) {\n let s = Math.sin(rad);\n let c = Math.cos(rad);\n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param rad - the angle to rotate the matrix by\n * @returns `out`\n */\n static fromZRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Rotation quaternion\n * @param v - Translation vector\n * @returns `out`\n */\n static fromRotationTranslation(out, q, v) {\n // Quaternion math\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n /**\n * Sets a {@link Mat4} from a {@link Quat2}.\n * @category Static\n *\n * @param out - Matrix\n * @param a - Dual Quaternion\n * @returns `out`\n */\n static fromQuat2(out, a) {\n let translation = [0, 0, 0];\n const bx = -a[0];\n const by = -a[1];\n const bz = -a[2];\n const bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n let magnitude = bx * bx + by * by + bz * bz + bw * bw;\n //Only scale if it makes sense\n if (magnitude > 0) {\n translation[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\n translation[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\n translation[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\n }\n else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n Mat4.fromRotationTranslation(out, a, translation);\n return out;\n }\n /**\n * Returns the translation vector component of a transformation\n * matrix. If a matrix is built with fromRotationTranslation,\n * the returned vector will be the same as the translation vector\n * originally supplied.\n * @category Static\n *\n * @param {vec3} out Vector to receive translation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n static getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n }\n /**\n * Returns the scaling factor component of a transformation\n * matrix. If a matrix is built with fromRotationTranslationScale\n * with a normalized Quaternion paramter, the returned vector will be\n * the same as the scaling vector\n * originally supplied.\n * @category Static\n *\n * @param {vec3} out Vector to receive scaling factor component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n static getScaling(out, mat) {\n const m11 = mat[0];\n const m12 = mat[1];\n const m13 = mat[2];\n const m21 = mat[4];\n const m22 = mat[5];\n const m23 = mat[6];\n const m31 = mat[8];\n const m32 = mat[9];\n const m33 = mat[10];\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\n return out;\n }\n /**\n * Returns a quaternion representing the rotational component\n * of a transformation matrix. If a matrix is built with\n * fromRotationTranslation, the returned quaternion will be the\n * same as the quaternion originally supplied.\n * @category Static\n *\n * @param out - Quaternion to receive the rotation component\n * @param mat - Matrix to be decomposed (input)\n * @return `out`\n */\n static getRotation(out, mat) {\n Mat4.getScaling(tmpVec3$1, mat);\n const is1 = 1 / tmpVec3$1[0];\n const is2 = 1 / tmpVec3$1[1];\n const is3 = 1 / tmpVec3$1[2];\n const sm11 = mat[0] * is1;\n const sm12 = mat[1] * is2;\n const sm13 = mat[2] * is3;\n const sm21 = mat[4] * is1;\n const sm22 = mat[5] * is2;\n const sm23 = mat[6] * is3;\n const sm31 = mat[8] * is1;\n const sm32 = mat[9] * is2;\n const sm33 = mat[10] * is3;\n const trace = sm11 + sm22 + sm33;\n let S = 0;\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n }\n else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n }\n else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n }\n else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n return out;\n }\n /**\n * Decomposes a transformation matrix into its rotation, translation\n * and scale components. Returns only the rotation component\n * @category Static\n *\n * @param out_r - Quaternion to receive the rotation component\n * @param out_t - Vector to receive the translation vector\n * @param out_s - Vector to receive the scaling factor\n * @param mat - Matrix to be decomposed (input)\n * @returns `out_r`\n */\n static decompose(out_r, out_t, out_s, mat) {\n out_t[0] = mat[12];\n out_t[1] = mat[13];\n out_t[2] = mat[14];\n const m11 = mat[0];\n const m12 = mat[1];\n const m13 = mat[2];\n const m21 = mat[4];\n const m22 = mat[5];\n const m23 = mat[6];\n const m31 = mat[8];\n const m32 = mat[9];\n const m33 = mat[10];\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\n const is1 = 1 / out_s[0];\n const is2 = 1 / out_s[1];\n const is3 = 1 / out_s[2];\n const sm11 = m11 * is1;\n const sm12 = m12 * is2;\n const sm13 = m13 * is3;\n const sm21 = m21 * is1;\n const sm22 = m22 * is2;\n const sm23 = m23 * is3;\n const sm31 = m31 * is1;\n const sm32 = m32 * is2;\n const sm33 = m33 * is3;\n const trace = sm11 + sm22 + sm33;\n let S = 0;\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out_r[3] = 0.25 * S;\n out_r[0] = (sm23 - sm32) / S;\n out_r[1] = (sm31 - sm13) / S;\n out_r[2] = (sm12 - sm21) / S;\n }\n else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out_r[3] = (sm23 - sm32) / S;\n out_r[0] = 0.25 * S;\n out_r[1] = (sm12 + sm21) / S;\n out_r[2] = (sm31 + sm13) / S;\n }\n else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out_r[3] = (sm31 - sm13) / S;\n out_r[0] = (sm12 + sm21) / S;\n out_r[1] = 0.25 * S;\n out_r[2] = (sm23 + sm32) / S;\n }\n else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out_r[3] = (sm12 - sm21) / S;\n out_r[0] = (sm31 + sm13) / S;\n out_r[1] = (sm23 + sm32) / S;\n out_r[2] = 0.25 * S;\n }\n return out_r;\n }\n /**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale);\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Rotation quaternion\n * @param v - Translation vector\n * @param s - Scaling vector\n * @returns `out`\n */\n static fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n const sx = s[0];\n const sy = s[1];\n const sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n }\n /**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * mat4.translate(dest, origin);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n * mat4.translate(dest, negativeOrigin);\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Rotation quaternion\n * @param v - Translation vector\n * @param s - Scaling vector\n * @param o - The origin vector around which to scale and rotate\n * @returns `out`\n */\n static fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n const sx = s[0];\n const sy = s[1];\n const sz = s[2];\n const ox = o[0];\n const oy = o[1];\n const oz = o[2];\n const out0 = (1 - (yy + zz)) * sx;\n const out1 = (xy + wz) * sx;\n const out2 = (xz - wy) * sx;\n const out4 = (xy - wz) * sy;\n const out5 = (1 - (xx + zz)) * sy;\n const out6 = (yz + wx) * sy;\n const out8 = (xz + wy) * sz;\n const out9 = (yz - wx) * sz;\n const out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n }\n /**\n * Calculates a 4x4 matrix from the given quaternion\n * @category Static\n *\n * @param out - mat4 receiving operation result\n * @param q - Quaternion to create matrix from\n * @returns `out`\n */\n static fromQuat(out, q) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n }\n /**\n * Generates a frustum matrix with the given bounds\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `out`\n */\n static frustum(out, left, right, bottom, top, near, far) {\n const rl = 1 / (right - left);\n const tb = 1 / (top - bottom);\n const nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n }\n /**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `out`\n */\n static perspectiveNO(out, fovy, aspect, near, far) {\n const f = 1.0 / Math.tan(fovy / 2);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n }\n else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n return out;\n }\n /**\n * Alias for {@link Mat4.perspectiveNO}\n * @category Static\n * @deprecated Use {@link Mat4.perspectiveNO} or {@link Mat4.perspectiveZO} explicitly\n */\n static perspective(out, fovy, aspect, near, far) { return out; }\n /**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param fovy - Vertical field of view in radians\n * @param aspect - Aspect ratio. typically viewport width/height\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum, can be null or Infinity\n * @returns `out`\n */\n static perspectiveZO(out, fovy, aspect, near, far) {\n const f = 1.0 / Math.tan(fovy / 2);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = far * nf;\n out[14] = far * near * nf;\n }\n else {\n out[10] = -1;\n out[14] = -near;\n }\n return out;\n }\n /**\n * Generates a perspective projection matrix with the given field of view.\n * This is primarily useful for generating projection matrices to be used\n * with the still experiemental WebVR API.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param fov - Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `out`\n * @deprecated\n */\n static perspectiveFromFieldOfView(out, fov, near, far) {\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\n const xScale = 2.0 / (leftTan + rightTan);\n const yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n }\n /**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `out`\n */\n static orthoNO(out, left, right, bottom, top, near, far) {\n const lr = 1 / (left - right);\n const bt = 1 / (bottom - top);\n const nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n }\n /**\n * Alias for {@link Mat4.orthoNO}\n * @category Static\n * @deprecated Use {@link Mat4.orthoNO} or {@link Mat4.orthoZO} explicitly\n */\n static ortho(out, left, right, bottom, top, near, far) { return out; }\n /**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param left - Left bound of the frustum\n * @param right - Right bound of the frustum\n * @param bottom - Bottom bound of the frustum\n * @param top - Top bound of the frustum\n * @param near - Near bound of the frustum\n * @param far - Far bound of the frustum\n * @returns `out`\n */\n static orthoZO(out, left, right, bottom, top, near, far) {\n const lr = 1 / (left - right);\n const bt = 1 / (bottom - top);\n const nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = near * nf;\n out[15] = 1;\n return out;\n }\n /**\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param eye - Position of the viewer\n * @param center - Point the viewer is looking at\n * @param up - vec3 pointing up\n * @returns `out`\n */\n static lookAt(out, eye, center, up) {\n const eyex = eye[0];\n const eyey = eye[1];\n const eyez = eye[2];\n const upx = up[0];\n const upy = up[1];\n const upz = up[2];\n const centerx = center[0];\n const centery = center[1];\n const centerz = center[2];\n if (Math.abs(eyex - centerx) < EPSILON &&\n Math.abs(eyey - centery) < EPSILON &&\n Math.abs(eyez - centerz) < EPSILON) {\n return Mat4.identity(out);\n }\n let z0 = eyex - centerx;\n let z1 = eyey - centery;\n let z2 = eyez - centerz;\n let len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n let x0 = upy * z2 - upz * z1;\n let x1 = upz * z0 - upx * z2;\n let x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n }\n else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n let y0 = z1 * x2 - z2 * x1;\n let y1 = z2 * x0 - z0 * x2;\n let y2 = z0 * x1 - z1 * x0;\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n }\n else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n }\n /**\n * Generates a matrix that makes something look at something else.\n * @category Static\n *\n * @param out - mat4 frustum matrix will be written into\n * @param eye - Position of the viewer\n * @param target - Point the viewer is looking at\n * @param up - vec3 pointing up\n * @returns `out`\n */\n static targetTo(out, eye, target, up) {\n const eyex = eye[0];\n const eyey = eye[1];\n const eyez = eye[2];\n const upx = up[0];\n const upy = up[1];\n const upz = up[2];\n let z0 = eyex - target[0];\n let z1 = eyey - target[1];\n let z2 = eyez - target[2];\n let len = z0 * z0 + z1 * z1 + z2 * z2;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n let x0 = upy * z2 - upz * z1;\n let x1 = upz * z0 - upx * z2;\n let x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n }\n /**\n * Returns Frobenius norm of a {@link Mat4}\n * @category Static\n *\n * @param a - the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\n static frob(a) {\n return Math.sqrt(a[0] * a[0] +\n a[1] * a[1] +\n a[2] * a[2] +\n a[3] * a[3] +\n a[4] * a[4] +\n a[5] * a[5] +\n a[6] * a[6] +\n a[7] * a[7] +\n a[8] * a[8] +\n a[9] * a[9] +\n a[10] * a[10] +\n a[11] * a[11] +\n a[12] * a[12] +\n a[13] * a[13] +\n a[14] * a[14] +\n a[15] * a[15]);\n }\n /**\n * Adds two {@link Mat4}'s\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n }\n /**\n * Subtracts matrix b from matrix a\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n }\n /**\n * Alias for {@link Mat4.subtract}\n * @category Static\n */\n static sub(out, a, b) { return out; }\n /**\n * Multiply each element of the matrix by a scalar.\n * @category Static\n *\n * @param out - the receiving matrix\n * @param a - the matrix to scale\n * @param b - amount to scale the matrix's elements by\n * @returns `out`\n */\n static multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n }\n /**\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b's elements by before adding\n * @returns `out`\n */\n static multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n }\n /**\n * Returns whether or not two {@link Mat4}s have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return (a[0] === b[0] &&\n a[1] === b[1] &&\n a[2] === b[2] &&\n a[3] === b[3] &&\n a[4] === b[4] &&\n a[5] === b[5] &&\n a[6] === b[6] &&\n a[7] === b[7] &&\n a[8] === b[8] &&\n a[9] === b[9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15]);\n }\n /**\n * Returns whether or not two {@link Mat4}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const a8 = a[8];\n const a9 = a[9];\n const a10 = a[10];\n const a11 = a[11];\n const a12 = a[12];\n const a13 = a[13];\n const a14 = a[14];\n const a15 = a[15];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n const b8 = b[8];\n const b9 = b[9];\n const b10 = b[10];\n const b11 = b[11];\n const b12 = b[12];\n const b13 = b[13];\n const b14 = b[14];\n const b15 = b[15];\n return (Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= EPSILON * Math.max(1, Math.abs(a3), Math.abs(b3)) &&\n Math.abs(a4 - b4) <= EPSILON * Math.max(1, Math.abs(a4), Math.abs(b4)) &&\n Math.abs(a5 - b5) <= EPSILON * Math.max(1, Math.abs(a5), Math.abs(b5)) &&\n Math.abs(a6 - b6) <= EPSILON * Math.max(1, Math.abs(a6), Math.abs(b6)) &&\n Math.abs(a7 - b7) <= EPSILON * Math.max(1, Math.abs(a7), Math.abs(b7)) &&\n Math.abs(a8 - b8) <= EPSILON * Math.max(1, Math.abs(a8), Math.abs(b8)) &&\n Math.abs(a9 - b9) <= EPSILON * Math.max(1, Math.abs(a9), Math.abs(b9)) &&\n Math.abs(a10 - b10) <= EPSILON * Math.max(1, Math.abs(a10), Math.abs(b10)) &&\n Math.abs(a11 - b11) <= EPSILON * Math.max(1, Math.abs(a11), Math.abs(b11)) &&\n Math.abs(a12 - b12) <= EPSILON * Math.max(1, Math.abs(a12), Math.abs(b12)) &&\n Math.abs(a13 - b13) <= EPSILON * Math.max(1, Math.abs(a13), Math.abs(b13)) &&\n Math.abs(a14 - b14) <= EPSILON * Math.max(1, Math.abs(a14), Math.abs(b14)) &&\n Math.abs(a15 - b15) <= EPSILON * Math.max(1, Math.abs(a15), Math.abs(b15)));\n }\n /**\n * Returns a string representation of a {@link Mat4}\n * @category Static\n *\n * @param a - matrix to represent as a string\n * @returns string representation of the matrix\n */\n static str(a) {\n return `Mat4(${a.join(', ')})`;\n }\n}\n// Temporary variables to prevent repeated allocations in the algorithms above.\nconst tmpVec3$1 = [0, 0, 0];\n// Instance method alias assignments\nMat4.prototype.mul = Mat4.prototype.multiply;\n// Static method alias assignments\nMat4.sub = Mat4.subtract;\nMat4.mul = Mat4.multiply;\nMat4.perspective = Mat4.perspectiveNO;\nMat4.ortho = Mat4.orthoNO;\n\n/**\n * 3 Dimensional Vector\n */\nclass Vec3 extends Float32Array {\n /**\n * The number of bytes in a {@link Vec3}.\n */\n static BYTE_LENGTH = 3 * Float32Array.BYTES_PER_ELEMENT;\n /**\n * Create a {@link Vec3}.\n */\n constructor(...values) {\n switch (values.length) {\n case 3:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 3);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === 'number') {\n super([v, v, v]);\n }\n else {\n super(v, 0, 3);\n }\n break;\n }\n default:\n super(3);\n break;\n }\n }\n //============\n // Attributes\n //============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the vector. Equivalent to `this[0];`\n * @category Vector components\n */\n get x() { return this[0]; }\n set x(value) { this[0] = value; }\n /**\n * The y component of the vector. Equivalent to `this[1];`\n * @category Vector components\n */\n get y() { return this[1]; }\n set y(value) { this[1] = value; }\n /**\n * The z component of the vector. Equivalent to `this[2];`\n * @category Vector components\n */\n get z() { return this[2]; }\n set z(value) { this[2] = value; }\n // Alternate set of getters and setters in case this is being used to define\n // a color.\n /**\n * The r component of the vector. Equivalent to `this[0];`\n * @category Color components\n */\n get r() { return this[0]; }\n set r(value) { this[0] = value; }\n /**\n * The g component of the vector. Equivalent to `this[1];`\n * @category Color components\n */\n get g() { return this[1]; }\n set g(value) { this[1] = value; }\n /**\n * The b component of the vector. Equivalent to `this[2];`\n * @category Color components\n */\n get b() { return this[2]; }\n set b(value) { this[2] = value; }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Vec3.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * `Float32Array` to mean the number of elements in the array.\n */\n get magnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Alias for {@link Vec3.magnitude}\n */\n get mag() { return this.magnitude; }\n /**\n * The squared magnitude (length) of `this`.\n * Equivalent to `Vec3.squaredMagnitude(this);`\n */\n get squaredMagnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n return x * x + y * y + z * z;\n }\n /**\n * Alias for {@link Vec3.squaredMagnitude}\n */\n get sqrMag() { return this.squaredMagnitude; }\n /**\n * A string representation of `this`\n * Equivalent to `Vec3.str(this);`\n */\n get str() {\n return Vec3.str(this);\n }\n //===================\n // Instances methods\n //===================\n /**\n * Copy the values from another {@link Vec3} into `this`.\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n /**\n * Adds a {@link Vec3} to `this`.\n * Equivalent to `Vec3.add(this, this, b);`\n *\n * @param b - The vector to add to `this`\n * @returns `this`\n */\n add(b) {\n this[0] += b[0];\n this[1] += b[1];\n this[2] += b[2];\n return this;\n }\n /**\n * Subtracts a {@link Vec3} from `this`.\n * Equivalent to `Vec3.subtract(this, this, b);`\n *\n * @param b - The vector to subtract from `this`\n * @returns `this`\n */\n subtract(b) {\n this[0] -= b[0];\n this[1] -= b[1];\n this[2] -= b[2];\n return this;\n }\n /**\n * Alias for {@link Vec3.subtract}\n */\n sub(b) { return this; }\n /**\n * Multiplies `this` by a {@link Vec3}.\n * Equivalent to `Vec3.multiply(this, this, b);`\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n this[0] *= b[0];\n this[1] *= b[1];\n this[2] *= b[2];\n return this;\n }\n /**\n * Alias for {@link Vec3.multiply}\n */\n mul(b) { return this; }\n /**\n * Divides `this` by a {@link Vec3}.\n * Equivalent to `Vec3.divide(this, this, b);`\n *\n * @param b - The vector to divide `this` by\n * @returns `this`\n */\n divide(b) {\n this[0] /= b[0];\n this[1] /= b[1];\n this[2] /= b[2];\n return this;\n }\n /**\n * Alias for {@link Vec3.divide}\n */\n div(b) { return this; }\n /**\n * Scales `this` by a scalar number.\n * Equivalent to `Vec3.scale(this, this, b);`\n *\n * @param b - Amount to scale `this` by\n * @returns `this`\n */\n scale(b) {\n this[0] *= b;\n this[1] *= b;\n this[2] *= b;\n return this;\n }\n /**\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\n * Equivalent to `Vec3.scaleAndAdd(this, this, b, scale);`\n *\n * @param b - The vector to add to `this`\n * @param scale - The amount to scale `b` by before adding\n * @returns `this`\n */\n scaleAndAdd(b, scale) {\n this[0] += b[0] * scale;\n this[1] += b[1] * scale;\n this[2] += b[2] * scale;\n return this;\n }\n /**\n * Calculates the euclidian distance between another {@link Vec3} and `this`.\n * Equivalent to `Vec3.distance(this, b);`\n *\n * @param b - The vector to calculate the distance to\n * @returns Distance between `this` and `b`\n */\n distance(b) {\n return Vec3.distance(this, b);\n }\n /**\n * Alias for {@link Vec3.distance}\n */\n dist(b) { return 0; }\n /**\n * Calculates the squared euclidian distance between another {@link Vec3} and `this`.\n * Equivalent to `Vec3.squaredDistance(this, b);`\n *\n * @param b The vector to calculate the squared distance to\n * @returns Squared distance between `this` and `b`\n */\n squaredDistance(b) {\n return Vec3.squaredDistance(this, b);\n }\n /**\n * Alias for {@link Vec3.squaredDistance}\n */\n sqrDist(b) { return 0; }\n /**\n * Negates the components of `this`.\n * Equivalent to `Vec3.negate(this, this);`\n *\n * @returns `this`\n */\n negate() {\n this[0] *= -1;\n this[1] *= -1;\n this[2] *= -1;\n return this;\n }\n /**\n * Inverts the components of `this`.\n * Equivalent to `Vec3.inverse(this, this);`\n *\n * @returns `this`\n */\n invert() {\n this[0] = 1.0 / this[0];\n this[1] = 1.0 / this[1];\n this[2] = 1.0 / this[2];\n return this;\n }\n /**\n * Calculates the dot product of this and another {@link Vec3}.\n * Equivalent to `Vec3.dot(this, b);`\n *\n * @param b - The second operand\n * @returns Dot product of `this` and `b`\n */\n dot(b) {\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2];\n }\n /**\n * Normalize `this`.\n * Equivalent to `Vec3.normalize(this, this);`\n *\n * @returns `this`\n */\n normalize() {\n return Vec3.normalize(this, this);\n }\n //================\n // Static methods\n //================\n /**\n * Creates a new, empty vec3\n * @category Static\n *\n * @returns a new 3D vector\n */\n static create() {\n return new Vec3();\n }\n /**\n * Creates a new vec3 initialized with values from an existing vector\n * @category Static\n *\n * @param a - vector to clone\n * @returns a new 3D vector\n */\n static clone(a) {\n return new Vec3(a);\n }\n /**\n * Calculates the magnitude (length) of a {@link Vec3}\n * @category Static\n *\n * @param a - Vector to calculate magnitude of\n * @returns Magnitude of a\n */\n static magnitude(a) {\n let x = a[0];\n let y = a[1];\n let z = a[2];\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Alias for {@link Vec3.magnitude}\n * @category Static\n */\n static mag(a) { return 0; }\n /**\n * Alias for {@link Vec3.magnitude}\n * @category Static\n * @deprecated Use {@link Vec3.magnitude} to avoid conflicts with builtin `length` methods/attribs\n *\n * @param a - vector to calculate length of\n * @returns length of a\n */\n // @ts-ignore: Length conflicts with Function.length\n static length(a) { return 0; }\n /**\n * Alias for {@link Vec3.magnitude}\n * @category Static\n * @deprecated Use {@link Vec3.mag}\n */\n static len(a) { return 0; }\n /**\n * Creates a new vec3 initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @returns a new 3D vector\n */\n static fromValues(x, y, z) {\n return new Vec3(x, y, z);\n }\n /**\n * Copy the values from one vec3 to another\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the source vector\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n }\n /**\n * Set the components of a vec3 to the given values\n * @category Static\n *\n * @param out - the receiving vector\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @returns `out`\n */\n static set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n }\n /**\n * Adds two {@link Vec3}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n }\n /**\n * Subtracts vector b from vector a\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n }\n /**\n * Alias for {@link Vec3.subtract}\n * @category Static\n */\n static sub(out, a, b) { return [0, 0, 0]; }\n ;\n /**\n * Multiplies two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n }\n /**\n * Alias for {@link Vec3.multiply}\n * @category Static\n */\n static mul(out, a, b) { return [0, 0, 0]; }\n /**\n * Divides two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n }\n /**\n * Alias for {@link Vec3.divide}\n * @category Static\n */\n static div(out, a, b) { return [0, 0, 0]; }\n ;\n /**\n * Math.ceil the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to ceil\n * @returns `out`\n */\n static ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n }\n /**\n * Math.floor the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to floor\n * @returns `out`\n */\n static floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n }\n /**\n * Returns the minimum of two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n }\n /**\n * Returns the maximum of two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n }\n /**\n * symmetric round the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to round\n * @returns `out`\n */\n /*static round(out: Vec3Like, a: Readonly): Vec3Like {\n out[0] = glMatrix.round(a[0]);\n out[1] = glMatrix.round(a[1]);\n out[2] = glMatrix.round(a[2]);\n return out;\n }*/\n /**\n * Scales a vec3 by a scalar number\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to scale\n * @param scale - amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, scale) {\n out[0] = a[0] * scale;\n out[1] = a[1] * scale;\n out[2] = a[2] * scale;\n return out;\n }\n /**\n * Adds two vec3's after scaling the second operand by a scalar value\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b by before adding\n * @returns `out`\n */\n static scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n }\n /**\n * Calculates the euclidian distance between two vec3's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns distance between a and b\n */\n static distance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n return Math.sqrt(x * x + y * y + z * z);\n }\n /**\n * Alias for {@link Vec3.distance}\n */\n static dist(a, b) { return 0; }\n /**\n * Calculates the squared euclidian distance between two vec3's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns squared distance between a and b\n */\n static squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n return x * x + y * y + z * z;\n }\n /**\n * Alias for {@link Vec3.squaredDistance}\n */\n static sqrDist(a, b) { return 0; }\n /**\n * Calculates the squared length of a vec3\n * @category Static\n *\n * @param a - vector to calculate squared length of\n * @returns squared length of a\n */\n static squaredLength(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n return x * x + y * y + z * z;\n }\n /**\n * Alias for {@link Vec3.squaredLength}\n */\n static sqrLen(a, b) { return 0; }\n /**\n * Negates the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to negate\n * @returns `out`\n */\n static negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n }\n /**\n * Returns the inverse of the components of a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to invert\n * @returns `out`\n */\n static inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n }\n /**\n * Normalize a vec3\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n let len = x * x + y * y + z * z;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n }\n /**\n * Calculates the dot product of two vec3's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n }\n /**\n * Computes the cross product of two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static cross(out, a, b) {\n const ax = a[0], ay = a[1], az = a[2];\n const bx = b[0], by = b[1], bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n }\n /**\n * Performs a linear interpolation between two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n }\n /**\n * Performs a spherical linear interpolation between two vec3's\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static slerp(out, a, b, t) {\n const angle = Math.acos(Math.min(Math.max(Vec3.dot(a, b), -1), 1));\n const sinTotal = Math.sin(angle);\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\n const ratioB = Math.sin(t * angle) / sinTotal;\n out[0] = ratioA * a[0] + ratioB * b[0];\n out[1] = ratioA * a[1] + ratioB * b[1];\n out[2] = ratioA * a[2] + ratioB * b[2];\n return out;\n }\n /**\n * Performs a hermite interpolation with two control points\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param c - the third operand\n * @param d - the fourth operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static hermite(out, a, b, c, d, t) {\n const factorTimes2 = t * t;\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\n const factor2 = factorTimes2 * (t - 2) + t;\n const factor3 = factorTimes2 * (t - 1);\n const factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n }\n /**\n * Performs a bezier interpolation with two control points\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param c - the third operand\n * @param d - the fourth operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static bezier(out, a, b, c, d, t) {\n const inverseFactor = 1 - t;\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\n const factorTimes2 = t * t;\n const factor1 = inverseFactorTimesTwo * inverseFactor;\n const factor2 = 3 * t * inverseFactorTimesTwo;\n const factor3 = 3 * factorTimes2 * inverseFactor;\n const factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n }\n /**\n * Generates a random vector with the given scale\n * @category Static\n *\n * @param out - the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\n * @returns `out`\n */\n /*static random(out: Vec3Like, scale) {\n scale = scale === undefined ? 1.0 : scale;\n \n let r = glMatrix.RANDOM() * 2.0 * Math.PI;\n let z = glMatrix.RANDOM() * 2.0 - 1.0;\n let zScale = Math.sqrt(1.0 - z * z) * scale;\n \n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n }*/\n /**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param m - matrix to transform with\n * @returns `out`\n */\n static transformMat4(out, a, m) {\n const x = a[0], y = a[1], z = a[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n }\n /**\n * Transforms the vec3 with a mat3.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param m - the 3x3 matrix to transform with\n * @returns `out`\n */\n static transformMat3(out, a, m) {\n let x = a[0], y = a[1], z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n }\n /**\n * Transforms the vec3 with a quat\n * Can also be used for dual quaternions. (Multiply it with the real part)\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param q - quaternion to transform with\n * @returns `out`\n */\n static transformQuat(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n const x = a[0];\n const y = a[1];\n const z = a[2];\n // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n const uvx = (qy * z - qz * y);\n const uvy = (qz * x - qx * z);\n const uvz = (qx * y - qy * x);\n // var uuv = vec3.cross([], qvec, uv);\n // vec3.scale(uuv, uuv, 2);\n const uuvx = (qy * uvz - qz * uvy) * 2;\n const uuvy = (qz * uvx - qx * uvz) * 2;\n const uuvz = (qx * uvy - qy * uvx) * 2;\n // vec3.scale(uv, uv, 2 * w);\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\n out[0] = x + (uvx * w2) + uuvx;\n out[1] = y + (uvy * w2) + uuvy;\n out[2] = z + (uvz * w2) + uuvz;\n return out;\n }\n /**\n * Rotate a 3D vector around the x-axis\n * @param out - The receiving vec3\n * @param a - The vec3 point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotateX(out, a, b, rad) {\n const by = b[1];\n const bz = b[2];\n //Translate point to the origin\n const py = a[1] - by;\n const pz = a[2] - bz;\n //perform rotation\n //translate to correct position\n out[0] = a[0];\n out[1] = (py * Math.cos(rad) - pz * Math.sin(rad)) + by;\n out[2] = (py * Math.sin(rad) + pz * Math.cos(rad)) + bz;\n return out;\n }\n /**\n * Rotate a 3D vector around the y-axis\n * @param out - The receiving vec3\n * @param a - The vec3 point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotateY(out, a, b, rad) {\n const bx = b[0];\n const bz = b[2];\n //Translate point to the origin\n const px = a[0] - bx;\n const pz = a[2] - bz;\n //perform rotation\n //translate to correct position\n out[0] = (pz * Math.sin(rad) + px * Math.cos(rad)) + bx;\n out[1] = a[1];\n out[2] = (pz * Math.cos(rad) - px * Math.sin(rad)) + bz;\n return out;\n }\n /**\n * Rotate a 3D vector around the z-axis\n * @param out - The receiving vec3\n * @param a - The vec3 point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotateZ(out, a, b, rad) {\n const bx = b[0];\n const by = b[1];\n //Translate point to the origin\n const px = a[0] - bx;\n const py = a[1] - by;\n //perform rotation\n //translate to correct position\n out[0] = (px * Math.cos(rad) - py * Math.sin(rad)) + bx;\n out[1] = (px * Math.sin(rad) + py * Math.cos(rad)) + by;\n out[2] = b[2];\n return out;\n }\n /**\n * Get the angle between two 3D vectors\n * @param a - The first operand\n * @param b - The second operand\n * @returns The angle in radians\n */\n static angle(a, b) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\n const cosine = mag && Vec3.dot(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n }\n /**\n * Set the components of a vec3 to zero\n * @category Static\n *\n * @param out - the receiving vector\n * @returns `out`\n */\n static zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n }\n /**\n * Returns a string representation of a vector\n * @category Static\n *\n * @param a - vector to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Vec3(${a.join(', ')})`;\n }\n /**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n }\n /**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)));\n }\n}\n// Instance method alias assignments\nVec3.prototype.sub = Vec3.prototype.subtract;\nVec3.prototype.mul = Vec3.prototype.multiply;\nVec3.prototype.div = Vec3.prototype.divide;\nVec3.prototype.dist = Vec3.prototype.distance;\nVec3.prototype.sqrDist = Vec3.prototype.squaredDistance;\n// Static method alias assignments\nVec3.sub = Vec3.subtract;\nVec3.mul = Vec3.multiply;\nVec3.div = Vec3.divide;\nVec3.dist = Vec3.distance;\nVec3.sqrDist = Vec3.squaredDistance;\nVec3.sqrLen = Vec3.squaredLength;\nVec3.mag = Vec3.magnitude;\nVec3.length = Vec3.magnitude;\nVec3.len = Vec3.magnitude;\n\n/**\n * 4 Dimensional Vector\n */\nclass Vec4 extends Float32Array {\n /**\n * The number of bytes in a {@link Vec4}.\n */\n static BYTE_LENGTH = 4 * Float32Array.BYTES_PER_ELEMENT;\n /**\n * Create a {@link Vec4}.\n */\n constructor(...values) {\n switch (values.length) {\n case 4:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 4);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === 'number') {\n super([v, v, v, v]);\n }\n else {\n super(v, 0, 4);\n }\n break;\n }\n default:\n super(4);\n break;\n }\n }\n //============\n // Attributes\n //============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the vector. Equivalent to `this[0];`\n * @category Vector components\n */\n get x() { return this[0]; }\n set x(value) { this[0] = value; }\n /**\n * The y component of the vector. Equivalent to `this[1];`\n * @category Vector components\n */\n get y() { return this[1]; }\n set y(value) { this[1] = value; }\n /**\n * The z component of the vector. Equivalent to `this[2];`\n * @category Vector components\n */\n get z() { return this[2]; }\n set z(value) { this[2] = value; }\n /**\n * The w component of the vector. Equivalent to `this[3];`\n * @category Vector components\n */\n get w() { return this[3]; }\n set w(value) { this[3] = value; }\n // Alternate set of getters and setters in case this is being used to define\n // a color.\n /**\n * The r component of the vector. Equivalent to `this[0];`\n * @category Color components\n */\n get r() { return this[0]; }\n set r(value) { this[0] = value; }\n /**\n * The g component of the vector. Equivalent to `this[1];`\n * @category Color components\n */\n get g() { return this[1]; }\n set g(value) { this[1] = value; }\n /**\n * The b component of the vector. Equivalent to `this[2];`\n * @category Color components\n */\n get b() { return this[2]; }\n set b(value) { this[2] = value; }\n /**\n * The a component of the vector. Equivalent to `this[3];`\n * @category Color components\n */\n get a() { return this[3]; }\n set a(value) { this[3] = value; }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Vec4.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * `Float32Array` to mean the number of elements in the array.\n */\n get magnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n const w = this[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n }\n /**\n * Alias for {@link Vec4.magnitude}\n */\n get mag() { return this.magnitude; }\n /**\n * A string representation of `this`\n * Equivalent to `Vec4.str(this);`\n */\n get str() {\n return Vec4.str(this);\n }\n //===================\n // Instances methods\n //===================\n /**\n * Copy the values from another {@link Vec4} into `this`.\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n super.set(a);\n return this;\n }\n /**\n * Adds a {@link Vec4} to `this`.\n * Equivalent to `Vec4.add(this, this, b);`\n *\n * @param b - The vector to add to `this`\n * @returns `this`\n */\n add(b) {\n this[0] += b[0];\n this[1] += b[1];\n this[2] += b[2];\n this[3] += b[3];\n return this;\n }\n /**\n * Subtracts a {@link Vec4} from `this`.\n * Equivalent to `Vec4.subtract(this, this, b);`\n *\n * @param b - The vector to subtract from `this`\n * @returns `this`\n */\n subtract(b) {\n this[0] -= b[0];\n this[1] -= b[1];\n this[2] -= b[2];\n this[3] -= b[3];\n return this;\n }\n /**\n * Alias for {@link Vec4.subtract}\n */\n sub(b) { return this; }\n /**\n * Multiplies `this` by a {@link Vec4}.\n * Equivalent to `Vec4.multiply(this, this, b);`\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n this[0] *= b[0];\n this[1] *= b[1];\n this[2] *= b[2];\n this[3] *= b[3];\n return this;\n }\n /**\n * Alias for {@link Vec4.multiply}\n */\n mul(b) { return this; }\n /**\n * Divides `this` by a {@link Vec4}.\n * Equivalent to `Vec4.divide(this, this, b);`\n *\n * @param b - The vector to divide `this` by\n * @returns `this`\n */\n divide(b) {\n this[0] /= b[0];\n this[1] /= b[1];\n this[2] /= b[2];\n this[3] /= b[3];\n return this;\n }\n /**\n * Alias for {@link Vec4.divide}\n */\n div(b) { return this; }\n /**\n * Scales `this` by a scalar number.\n * Equivalent to `Vec4.scale(this, this, b);`\n *\n * @param b - Amount to scale `this` by\n * @returns `this`\n */\n scale(b) {\n this[0] *= b;\n this[1] *= b;\n this[2] *= b;\n this[3] *= b;\n return this;\n }\n /**\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\n * Equivalent to `Vec4.scaleAndAdd(this, this, b, scale);`\n *\n * @param b - The vector to add to `this`\n * @param scale - The amount to scale `b` by before adding\n * @returns `this`\n */\n scaleAndAdd(b, scale) {\n this[0] += b[0] * scale;\n this[1] += b[1] * scale;\n this[2] += b[2] * scale;\n this[3] += b[3] * scale;\n return this;\n }\n /**\n * Calculates the euclidian distance between another {@link Vec4} and `this`.\n * Equivalent to `Vec4.distance(this, b);`\n *\n * @param b - The vector to calculate the distance to\n * @returns Distance between `this` and `b`\n */\n distance(b) {\n return Vec4.distance(this, b);\n }\n /**\n * Alias for {@link Vec4.distance}\n */\n dist(b) { return 0; }\n /**\n * Calculates the squared euclidian distance between another {@link Vec4} and `this`.\n * Equivalent to `Vec4.squaredDistance(this, b);`\n *\n * @param b The vector to calculate the squared distance to\n * @returns Squared distance between `this` and `b`\n */\n squaredDistance(b) {\n return Vec4.squaredDistance(this, b);\n }\n /**\n * Alias for {@link Vec4.squaredDistance}\n */\n sqrDist(b) { return 0; }\n /**\n * Negates the components of `this`.\n * Equivalent to `Vec4.negate(this, this);`\n *\n * @returns `this`\n */\n negate() {\n this[0] *= -1;\n this[1] *= -1;\n this[2] *= -1;\n this[3] *= -1;\n return this;\n }\n /**\n * Inverts the components of `this`.\n * Equivalent to `Vec4.inverse(this, this);`\n *\n * @returns `this`\n */\n invert() {\n this[0] = 1.0 / this[0];\n this[1] = 1.0 / this[1];\n this[2] = 1.0 / this[2];\n this[3] = 1.0 / this[3];\n return this;\n }\n /**\n * Calculates the dot product of this and another {@link Vec4}.\n * Equivalent to `Vec4.dot(this, b);`\n *\n * @param b - The second operand\n * @returns Dot product of `this` and `b`\n */\n dot(b) {\n return this[0] * b[0] + this[1] * b[1] + this[2] * b[2] + this[3] * b[3];\n }\n /**\n * Normalize `this`.\n * Equivalent to `Vec4.normalize(this, this);`\n *\n * @returns `this`\n */\n normalize() {\n return Vec4.normalize(this, this);\n }\n //===================\n // Static methods\n //===================\n /**\n * Creates a new, empty {@link Vec4}\n * @category Static\n *\n * @returns a new 4D vector\n */\n static create() {\n return new Vec4();\n }\n /**\n * Creates a new {@link Vec4} initialized with values from an existing vector\n * @category Static\n *\n * @param a - vector to clone\n * @returns a new 4D vector\n */\n static clone(a) {\n return new Vec4(a);\n }\n /**\n * Creates a new {@link Vec4} initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns a new 4D vector\n */\n static fromValues(x, y, z, w) {\n return new Vec4(x, y, z, w);\n }\n /**\n * Copy the values from one {@link Vec4} to another\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the source vector\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Set the components of a {@link Vec4} to the given values\n * @category Static\n *\n * @param out - the receiving vector\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns `out`\n */\n static set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n }\n /**\n * Adds two {@link Vec4}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n }\n /**\n * Subtracts vector b from vector a\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n }\n /**\n * Alias for {@link Vec4.subtract}\n * @category Static\n */\n static sub(out, a, b) { return out; }\n /**\n * Multiplies two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n }\n /**\n * Alias for {@link Vec4.multiply}\n * @category Static\n */\n static mul(out, a, b) { return out; }\n /**\n * Divides two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n }\n /**\n * Alias for {@link Vec4.divide}\n * @category Static\n */\n static div(out, a, b) { return out; }\n /**\n * Math.ceil the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to ceil\n * @returns `out`\n */\n static ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n }\n /**\n * Math.floor the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to floor\n * @returns `out`\n */\n static floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n }\n /**\n * Returns the minimum of two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n }\n /**\n * Returns the maximum of two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n }\n /**\n * Math.round the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to round\n * @returns `out`\n */\n static round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n }\n /**\n * Scales a {@link Vec4} by a scalar number\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to scale\n * @param scale - amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, scale) {\n out[0] = a[0] * scale;\n out[1] = a[1] * scale;\n out[2] = a[2] * scale;\n out[3] = a[3] * scale;\n return out;\n }\n /**\n * Adds two {@link Vec4}'s after scaling the second operand by a scalar value\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param scale - the amount to scale b by before adding\n * @returns `out`\n */\n static scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n }\n /**\n * Calculates the euclidian distance between two {@link Vec4}'s\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns distance between a and b\n */\n static distance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n const w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n }\n /**\n * Alias for {@link Vec4.distance}\n * @category Static\n */\n static dist(a, b) { return 0; }\n /**\n * Calculates the squared euclidian distance between two {@link Vec4}'s\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns squared distance between a and b\n */\n static squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n const w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n }\n /**\n * Alias for {@link Vec4.squaredDistance}\n * @category Static\n */\n static sqrDist(a, b) { return 0; }\n /**\n * Calculates the magnitude (length) of a {@link Vec4}\n * @category Static\n *\n * @param a - vector to calculate length of\n * @returns length of `a`\n */\n static magnitude(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n }\n /**\n * Alias for {@link Vec4.magnitude}\n * @category Static\n */\n static mag(a) { return 0; }\n /**\n * Alias for {@link Vec4.magnitude}\n * @category Static\n * @deprecated Use {@link Vec4.magnitude} to avoid conflicts with builtin `length` methods/attribs\n */\n // @ts-ignore: Length conflicts with Function.length\n static length(a) { return 0; }\n /**\n * Alias for {@link Vec4.magnitude}\n * @category Static\n * @deprecated Use {@link Vec4.mag}\n */\n static len(a) { return 0; }\n /**\n * Calculates the squared length of a {@link Vec4}\n * @category Static\n *\n * @param a - vector to calculate squared length of\n * @returns squared length of a\n */\n static squaredLength(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n return x * x + y * y + z * z + w * w;\n }\n /**\n * Alias for {@link Vec4.squaredLength}\n * @category Static\n */\n static sqrLen(a) { return 0; }\n /**\n * Negates the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to negate\n * @returns `out`\n */\n static negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n }\n /**\n * Returns the inverse of the components of a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to invert\n * @returns `out`\n */\n static inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n }\n /**\n * Normalize a {@link Vec4}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - vector to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n let len = x * x + y * y + z * z + w * w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n }\n /**\n * Calculates the dot product of two {@link Vec4}'s\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n }\n /**\n * Returns the cross-product of three vectors in a 4-dimensional space\n * @category Static\n *\n * @param out the receiving vector\n * @param u - the first vector\n * @param v - the second vector\n * @param w - the third vector\n * @returns result\n */\n static cross(out, u, v, w) {\n const a = v[0] * w[1] - v[1] * w[0];\n const b = v[0] * w[2] - v[2] * w[0];\n const c = v[0] * w[3] - v[3] * w[0];\n const d = v[1] * w[2] - v[2] * w[1];\n const e = v[1] * w[3] - v[3] * w[1];\n const f = v[2] * w[3] - v[3] * w[2];\n const g = u[0];\n const h = u[1];\n const i = u[2];\n const j = u[3];\n out[0] = h * f - i * e + j * d;\n out[1] = -(g * f) + i * c - j * b;\n out[2] = g * e - h * c + j * a;\n out[3] = -(g * d) + h * b - i * a;\n return out;\n }\n /**\n * Performs a linear interpolation between two {@link Vec4}'s\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n }\n /**\n * Generates a random vector with the given scale\n * @category Static\n *\n * @param out - the receiving vector\n * @param [scale] - Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns `out`\n */\n /*static random(out: Vec4Like, scale): Vec4Like {\n scale = scale || 1.0;\n \n // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n var v1, v2, v3, v4;\n var s1, s2;\n do {\n v1 = glMatrix.RANDOM() * 2 - 1;\n v2 = glMatrix.RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n do {\n v3 = glMatrix.RANDOM() * 2 - 1;\n v4 = glMatrix.RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n \n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n }*/\n /**\n * Transforms the {@link Vec4} with a {@link Mat4}.\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param m - matrix to transform with\n * @returns `out`\n */\n static transformMat4(out, a, m) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n }\n /**\n * Transforms the {@link Vec4} with a {@link Quat}\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to transform\n * @param q - quaternion to transform with\n * @returns `out`\n */\n static transformQuat(out, a, q) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n // calculate quat * vec\n const ix = qw * x + qy * z - qz * y;\n const iy = qw * y + qz * x - qx * z;\n const iz = qw * z + qx * y - qy * x;\n const iw = -qx * x - qy * y - qz * z;\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n }\n /**\n * Set the components of a {@link Vec4} to zero\n * @category Static\n *\n * @param out - the receiving vector\n * @returns `out`\n */\n static zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n }\n /**\n * Returns a string representation of a {@link Vec4}\n * @category Static\n *\n * @param a - vector to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Vec4(${a.join(', ')})`;\n }\n /**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n }\n /**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)));\n }\n}\n// Instance method alias assignments\nVec4.prototype.sub = Vec4.prototype.subtract;\nVec4.prototype.mul = Vec4.prototype.multiply;\nVec4.prototype.div = Vec4.prototype.divide;\nVec4.prototype.dist = Vec4.prototype.distance;\nVec4.prototype.sqrDist = Vec4.prototype.squaredDistance;\n// Static method alias assignments\nVec4.sub = Vec4.subtract;\nVec4.mul = Vec4.multiply;\nVec4.div = Vec4.divide;\nVec4.dist = Vec4.distance;\nVec4.sqrDist = Vec4.squaredDistance;\nVec4.sqrLen = Vec4.squaredLength;\nVec4.mag = Vec4.magnitude;\nVec4.length = Vec4.magnitude;\nVec4.len = Vec4.magnitude;\n\n/**\n * Quaternion\n */\nclass Quat extends Float32Array {\n /**\n * The number of bytes in a {@link Quat}.\n */\n static BYTE_LENGTH = 4 * Float32Array.BYTES_PER_ELEMENT;\n /**\n * Create a {@link Quat}.\n */\n constructor(...values) {\n switch (values.length) {\n case 4:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 4);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === 'number') {\n super([v, v, v, v]);\n }\n else {\n super(v, 0, 4);\n }\n break;\n }\n default:\n super(4);\n this[3] = 1;\n break;\n }\n }\n //============\n // Attributes\n //============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the quaternion. Equivalent to `this[0];`\n * @category Quaternion components\n */\n get x() { return this[0]; }\n set x(value) { this[0] = value; }\n /**\n * The y component of the quaternion. Equivalent to `this[1];`\n * @category Quaternion components\n */\n get y() { return this[1]; }\n set y(value) { this[1] = value; }\n /**\n * The z component of the quaternion. Equivalent to `this[2];`\n * @category Quaternion components\n */\n get z() { return this[2]; }\n set z(value) { this[2] = value; }\n /**\n * The w component of the quaternion. Equivalent to `this[3];`\n * @category Quaternion components\n */\n get w() { return this[3]; }\n set w(value) { this[3] = value; }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Quat.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * `Float32Array` to mean the number of elements in the array.\n */\n get magnitude() {\n const x = this[0];\n const y = this[1];\n const z = this[2];\n const w = this[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n }\n /**\n * Alias for {@link Quat.magnitude}\n */\n get mag() { return this.magnitude; }\n /**\n * A string representation of `this`\n * Equivalent to `Quat.str(this);`\n */\n get str() {\n return Quat.str(this);\n }\n //===================\n // Instances methods\n //===================\n /**\n * Copy the values from another {@link Quat} into `this`.\n *\n * @param a the source quaternion\n * @returns `this`\n */\n copy(a) {\n super.set(a);\n return this;\n }\n /**\n * Set `this` to the identity quaternion\n * Equivalent to Quat.identity(this)\n *\n * @returns `this`\n */\n identity() {\n this[0] = 0;\n this[1] = 0;\n this[2] = 0;\n this[3] = 1;\n return this;\n }\n /**\n * Multiplies `this` by a {@link Quat}.\n * Equivalent to `Quat.multiply(this, this, b);`\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n return Quat.multiply(this, this, b);\n }\n /**\n * Alias for {@link Quat.multiply}\n */\n mul(b) { return this; }\n /**\n * Rotates `this` by the given angle about the X axis\n * Equivalent to `Quat.rotateX(this, this, rad);`\n *\n * @param rad - angle (in radians) to rotate\n * @returns `this`\n */\n rotateX(rad) {\n return Quat.rotateX(this, this, rad);\n }\n /**\n * Rotates `this` by the given angle about the Y axis\n * Equivalent to `Quat.rotateY(this, this, rad);`\n *\n * @param rad - angle (in radians) to rotate\n * @returns `this`\n */\n rotateY(rad) {\n return Quat.rotateY(this, this, rad);\n }\n /**\n * Rotates `this` by the given angle about the Z axis\n * Equivalent to `Quat.rotateZ(this, this, rad);`\n *\n * @param rad - angle (in radians) to rotate\n * @returns `this`\n */\n rotateZ(rad) {\n return Quat.rotateZ(this, this, rad);\n }\n /**\n * Inverts `this`\n * Equivalent to `Quat.invert(this, this);`\n *\n * @returns `this`\n */\n invert() {\n return Quat.invert(this, this);\n }\n /**\n * Scales `this` by a scalar number\n * Equivalent to `Quat.scale(this, this, scale);`\n *\n * @param out - the receiving vector\n * @param a - the vector to scale\n * @param scale - amount to scale the vector by\n * @returns `this`\n */\n scale(scale) {\n this[0] *= scale;\n this[1] *= scale;\n this[2] *= scale;\n this[3] *= scale;\n return this;\n }\n /**\n * Calculates the dot product of `this` and another {@link Quat}\n * Equivalent to `Quat.dot(this, b);`\n *\n * @param b - the second operand\n * @returns dot product of `this` and b\n */\n dot(b) {\n return Quat.dot(this, b);\n }\n //===================\n // Static methods\n //===================\n /**\n * Creates a new identity quat\n * @category Static\n *\n * @returns a new quaternion\n */\n static create() {\n return new Quat();\n }\n /**\n * Set a quat to the identity quaternion\n * @category Static\n *\n * @param out - the receiving quaternion\n * @returns `out`\n */\n static identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n }\n /**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param axis - the axis around which to rotate\n * @param rad - the angle in radians\n * @returns `out`\n **/\n static setAxisAngle(out, axis, rad) {\n rad = rad * 0.5;\n const s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n }\n /**\n * Gets the rotation axis and angle for a given\n * quaternion. If a quaternion is created with\n * setAxisAngle, this method will return the same\n * values as providied in the original parameter list\n * OR functionally equivalent values.\n * Example: The quaternion formed by axis [0, 0, 1] and\n * angle -90 is the same as the quaternion formed by\n * [0, 0, 1] and 270. This method favors the latter.\n * @category Static\n *\n * @param out_axis - Vector receiving the axis of rotation\n * @param q - Quaternion to be decomposed\n * @return Angle, in radians, of the rotation\n */\n static getAxisAngle(out_axis, q) {\n const rad = Math.acos(q[3]) * 2.0;\n const s = Math.sin(rad / 2.0);\n if (s > EPSILON) {\n out_axis[0] = q[0] / s;\n out_axis[1] = q[1] / s;\n out_axis[2] = q[2] / s;\n }\n else {\n // If s is zero, return any axis (no rotation - axis does not matter)\n out_axis[0] = 1;\n out_axis[1] = 0;\n out_axis[2] = 0;\n }\n return rad;\n }\n /**\n * Gets the angular distance between two unit quaternions\n * @category Static\n *\n * @param {ReadonlyQuat} a Origin unit quaternion\n * @param {ReadonlyQuat} b Destination unit quaternion\n * @return {Number} Angle, in radians, between the two quaternions\n */\n static getAngle(a, b) {\n const dotproduct = Quat.dot(a, b);\n return Math.acos(2 * dotproduct * dotproduct - 1);\n }\n /**\n * Multiplies two quat's\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n }\n /**\n * Rotates a quaternion by the given angle about the X axis\n * @category Static\n *\n * @param out - quat receiving operation result\n * @param a - quat to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateX(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bx = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n }\n /**\n * Rotates a quaternion by the given angle about the Y axis\n * @category Static\n *\n * @param out - quat receiving operation result\n * @param a - quat to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateY(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const by = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n }\n /**\n * Rotates a quaternion by the given angle about the Z axis\n * @category Static\n *\n * @param out - quat receiving operation result\n * @param a - quat to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateZ(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bz = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n }\n /**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate W component of\n * @returns `out`\n */\n static calculateW(out, a) {\n const x = a[0], y = a[1], z = a[2];\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n }\n /**\n * Calculate the exponential of a unit quaternion.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate the exponential of\n * @returns `out`\n */\n static exp(out, a) {\n const x = a[0], y = a[1], z = a[2], w = a[3];\n const r = Math.sqrt(x * x + y * y + z * z);\n const et = Math.exp(w);\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\n out[0] = x * s;\n out[1] = y * s;\n out[2] = z * s;\n out[3] = et * Math.cos(r);\n return out;\n }\n /**\n * Calculate the natural logarithm of a unit quaternion.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate the exponential of\n * @returns `out`\n */\n static ln(out, a) {\n const x = a[0], y = a[1], z = a[2], w = a[3];\n const r = Math.sqrt(x * x + y * y + z * z);\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\n out[0] = x * t;\n out[1] = y * t;\n out[2] = z * t;\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\n return out;\n }\n /**\n * Calculate the scalar power of a unit quaternion.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate the exponential of\n * @param b - amount to scale the quaternion by\n * @returns `out`\n */\n static pow(out, a, b) {\n Quat.ln(out, a);\n Quat.scale(out, out, b);\n Quat.exp(out, out);\n return out;\n }\n /**\n * Performs a spherical linear interpolation between two quat\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static slerp(out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n const ax = a[0], ay = a[1], az = a[2], aw = a[3];\n let bx = b[0], by = b[1], bz = b[2], bw = b[3];\n let scale0;\n let scale1;\n // calc cosine\n let cosom = ax * bx + ay * by + az * bz + aw * bw;\n // adjust signs (if necessary)\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n // calculate coefficients\n if (1.0 - cosom > EPSILON) {\n // standard case (slerp)\n const omega = Math.acos(cosom);\n const sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n }\n else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n }\n // calculate final values\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n }\n /**\n * Generates a random unit quaternion\n * @category Static\n *\n * @param out - the receiving quaternion\n * @returns `out`\n */\n /*static random(out: QuatLike): QuatLike {\n // Implementation of http://planning.cs.uiuc.edu/node198.html\n // TODO: Calling random 3 times is probably not the fastest solution\n let u1 = glMatrix.RANDOM();\n let u2 = glMatrix.RANDOM();\n let u3 = glMatrix.RANDOM();\n \n let sqrt1MinusU1 = Math.sqrt(1 - u1);\n let sqrtU1 = Math.sqrt(u1);\n \n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\n return out;\n }*/\n /**\n * Calculates the inverse of a quat\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate inverse of\n * @returns `out`\n */\n static invert(out, a) {\n const a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1.0 / dot : 0;\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n out[0] = -a0 * invDot;\n out[1] = -a1 * invDot;\n out[2] = -a2 * invDot;\n out[3] = a3 * invDot;\n return out;\n }\n /**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quat to calculate conjugate of\n * @returns `out`\n */\n static conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to renormalize the quaternion yourself where necessary.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param m - rotation matrix\n * @returns `out`\n */\n static fromMat3(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const fTrace = m[0] + m[4] + m[8];\n let fRoot;\n if (fTrace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n out[3] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot; // 1/(4w)\n out[0] = (m[5] - m[7]) * fRoot;\n out[1] = (m[6] - m[2]) * fRoot;\n out[2] = (m[1] - m[3]) * fRoot;\n }\n else {\n // |w| <= 1/2\n let i = 0;\n if (m[4] > m[0])\n i = 1;\n if (m[8] > m[i * 3 + i])\n i = 2;\n let j = (i + 1) % 3;\n let k = (i + 2) % 3;\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\n }\n return out;\n }\n /**\n * Creates a quaternion from the given euler angle x, y, z.\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param x - Angle to rotate around X axis in degrees.\n * @param y - Angle to rotate around Y axis in degrees.\n * @param z - Angle to rotate around Z axis in degrees.\n * @returns `out`\n */\n static fromEuler(out, x, y, z) {\n let halfToRad = (0.5 * Math.PI) / 180.0;\n x *= halfToRad;\n y *= halfToRad;\n z *= halfToRad;\n let sx = Math.sin(x);\n let cx = Math.cos(x);\n let sy = Math.sin(y);\n let cy = Math.cos(y);\n let sz = Math.sin(z);\n let cz = Math.cos(z);\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n return out;\n }\n /**\n * Returns a string representation of a quatenion\n * @category Static\n *\n * @param a - vector to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Quat(${a.join(', ')})`;\n }\n /**\n * Creates a new quat initialized with values from an existing quaternion\n * @category Static\n *\n * @param a - quaternion to clone\n * @returns a new quaternion\n */\n static clone(a) {\n return new Quat(a);\n }\n /**\n * Creates a new quat initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns a new quaternion\n */\n static fromValues(x, y, z, w) {\n return new Quat(x, y, z, w);\n }\n /**\n * Copy the values from one quat to another\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the source quaternion\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n /**\n * Set the components of a {@link Quat} to the given values\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param x - X component\n * @param y - Y component\n * @param z - Z component\n * @param w - W component\n * @returns `out`\n */\n static set(out, x, y, z, w) { return out; }\n /**\n * Adds two {@link Quat}'s\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) { return out; }\n /**\n * Alias for {@link Quat.multiply}\n * @category Static\n */\n static mul(out, a, b) { return out; }\n /**\n * Scales a quat by a scalar number\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - the vector to scale\n * @param b - amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, scale) {\n out[0] = a[0] * scale;\n out[1] = a[1] * scale;\n out[2] = a[2] * scale;\n out[3] = a[3] * scale;\n return out;\n }\n /**\n * Calculates the dot product of two quat's\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n }\n /**\n * Performs a linear interpolation between two quat's\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) { return out; }\n /**\n * Calculates the magnitude (length) of a {@link Quat}\n * @category Static\n *\n * @param a - quaternion to calculate length of\n * @returns length of `a`\n */\n static magnitude(a) { return 0; }\n /**\n * Alias for {@link Quat.magnitude}\n * @category Static\n */\n static mag(a) { return 0; }\n /**\n * Alias for {@link Quat.magnitude}\n * @category Static\n * @deprecated Use {@link Quat.magnitude} to avoid conflicts with builtin `length` methods/attribs\n */\n // @ts-ignore: Length conflicts with Function.length\n static length(a) { return 0; }\n /**\n * Alias for {@link Quat.magnitude}\n * @category Static\n * @deprecated Use {@link Quat.mag}\n */\n static len(a) { return 0; }\n /**\n * Calculates the squared length of a {@link Quat}\n * @category Static\n *\n * @param a - quaternion to calculate squared length of\n * @returns squared length of a\n */\n static squaredLength(a) { return 0; }\n /**\n * Alias for {@link Quat.squaredLength}\n * @category Static\n */\n static sqrLen(a) { return 0; }\n /**\n * Normalize a {@link Quat}\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - quaternion to normalize\n * @returns `out`\n */\n static normalize(out, a) { return out; }\n /**\n * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first quaternion.\n * @param b - The second quaternion.\n * @returns True if the vectors are equal, false otherwise.\n */\n static exactEquals(a, b) { return false; }\n /**\n * Returns whether or not the quaternions have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\n static equals(a, b) { return false; }\n /**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n * @category Static\n *\n * @param out - the receiving quaternion.\n * @param a - the initial vector\n * @param b - the destination vector\n * @returns `out`\n */\n static rotationTo(out, a, b) {\n let dot = Vec3.dot(a, b);\n if (dot < -0.999999) {\n Vec3.cross(tmpVec3, xUnitVec3, a);\n if (Vec3.len(tmpVec3) < 0.000001)\n Vec3.cross(tmpVec3, yUnitVec3, a);\n Vec3.normalize(tmpVec3, tmpVec3);\n Quat.setAxisAngle(out, tmpVec3, Math.PI);\n return out;\n }\n else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n }\n else {\n Vec3.cross(tmpVec3, a, b);\n out[0] = tmpVec3[0];\n out[1] = tmpVec3[1];\n out[2] = tmpVec3[2];\n out[3] = 1 + dot;\n return Quat.normalize(out, out);\n }\n }\n /**\n * Performs a spherical linear interpolation with two control points\n * @category Static\n *\n * @param out - the receiving quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @param c - the third operand\n * @param d - the fourth operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static sqlerp(out, a, b, c, d, t) {\n Quat.slerp(temp1, a, d, t);\n Quat.slerp(temp2, b, c, t);\n Quat.slerp(out, temp1, temp2, 2 * t * (1 - t));\n return out;\n }\n /**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n * @category Static\n *\n * @param out - The receiving quaternion\n * @param view - the vector representing the viewing direction\n * @param right - the vector representing the local \"right\" direction\n * @param up - the vector representing the local \"up\" direction\n * @returns `out`\n */\n static setAxes(out, view, right, up) {\n tempMat3[0] = right[0];\n tempMat3[3] = right[1];\n tempMat3[6] = right[2];\n tempMat3[1] = up[0];\n tempMat3[4] = up[1];\n tempMat3[7] = up[2];\n tempMat3[2] = -view[0];\n tempMat3[5] = -view[1];\n tempMat3[8] = -view[2];\n return Quat.normalize(out, Quat.fromMat3(out, tempMat3));\n }\n}\n// Temporary variables to prevent repeated allocations in the algorithms above.\nconst temp1 = [0, 0, 0, 0];\nconst temp2 = [0, 0, 0, 0];\nconst tempMat3 = [0, 0, 0, 0, 0, 0, 0, 0, 0];\nconst tmpVec3 = [0, 0, 0];\nconst xUnitVec3 = [1, 0, 0];\nconst yUnitVec3 = [0, 1, 0];\n// Methods which re-use the Vec4 implementation\nQuat.set = Vec4.set;\nQuat.add = Vec4.add;\nQuat.lerp = Vec4.lerp;\nQuat.normalize = Vec4.normalize;\nQuat.squaredLength = Vec4.squaredLength;\nQuat.sqrLen = Vec4.squaredLength;\nQuat.exactEquals = Vec4.exactEquals;\nQuat.equals = Vec4.equals;\nQuat.magnitude = Vec4.magnitude;\n// Instance method alias assignments\nQuat.prototype.mul = Quat.prototype.multiply;\n// Static method alias assignments\nQuat.mul = Quat.multiply;\nQuat.mag = Quat.magnitude;\nQuat.length = Quat.magnitude;\nQuat.len = Quat.magnitude;\n\n/**\n * Dual Quaternion\n */\nclass Quat2 extends Float32Array {\n /**\n * The number of bytes in a {@link Quat}.\n */\n static BYTE_LENGTH = 8 * Float32Array.BYTES_PER_ELEMENT;\n /**\n * Create a {@link Quat2}.\n */\n constructor(...values) {\n switch (values.length) {\n case 8:\n super(values);\n break;\n case 2:\n super(values[0], values[1], 8);\n break;\n case 1: {\n const v = values[0];\n if (typeof v === 'number') {\n super([v, v, v, v, v, v, v, v]);\n }\n else {\n super(v, 0, 8);\n }\n break;\n }\n default:\n super(8);\n this[3] = 1;\n break;\n }\n }\n //============\n // Attributes\n //============\n /**\n * A string representation of `this`\n * Equivalent to `Quat2.str(this);`\n */\n get str() {\n return Quat2.str(this);\n }\n //===================\n // Instances methods\n //===================\n /**\n * Copy the values from another {@link Quat2} into `this`.\n *\n * @param a the source dual quaternion\n * @returns `this`\n */\n copy(a) {\n super.set(a);\n return this;\n }\n //===================\n // Static methods\n //===================\n /**\n * Creates a new identity {@link Quat2}\n * @category Static\n *\n * @returns a new dual quaternion [real -> rotation, dual -> translation]\n */\n static create() {\n return new Quat2();\n }\n /**\n * Creates a {@link Quat2} quat initialized with values from an existing quaternion\n * @category Static\n *\n * @param a - dual quaternion to clone\n * @returns a new dual quaternion\n */\n static clone(a) {\n return new Quat2(a);\n }\n /**\n * Creates a new {@link Quat2} initialized with the given values\n * @category Static\n *\n * @param x1 - 1st X component\n * @param y1 - 1st Y component\n * @param z1 - 1st Z component\n * @param w1 - 1st W component\n * @param x2 - 2nd X component\n * @param y2 - 2nd Y component\n * @param z2 - 2nd Z component\n * @param w2 - 2nd W component\n * @returns a new dual quaternion\n */\n static fromValues(x1, y1, z1, w1, x2, y2, z2, w2) {\n return new Quat2(x1, y1, z1, w1, x2, y2, z2, w2);\n }\n /**\n * Creates a new {@link Quat2} from the given values (quat and translation)\n * @category Static\n *\n * @param x1 - X component (rotation)\n * @param y1 - Y component (rotation)\n * @param z1 - Z component (rotation)\n * @param w1 - W component (rotation)\n * @param x2 - X component (translation)\n * @param y2 - Y component (translation)\n * @param z2 - Z component (translation)\n * @returns a new dual quaternion\n */\n static fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) {\n const ax = x2 * 0.5;\n const ay = y2 * 0.5;\n const az = z2 * 0.5;\n return new Quat2(x1, y1, z1, w1, ax * w1 + ay * z1 - az * y1, ay * w1 + az * x1 - ax * z1, az * w1 + ax * y1 - ay * x1, -ax * x1 - ay * y1 - az * z1);\n }\n /**\n * Sets a {@link Quat2} from a quaternion and a translation\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param q - a normalized quaternion\n * @param t - translation vector\n * @returns `out`\n */\n static fromRotationTranslation(out, q, t) {\n const ax = t[0] * 0.5;\n const ay = t[1] * 0.5;\n const az = t[2] * 0.5;\n const bx = q[0];\n const by = q[1];\n const bz = q[2];\n const bw = q[3];\n out[0] = bx;\n out[1] = by;\n out[2] = bz;\n out[3] = bw;\n out[4] = ax * bw + ay * bz - az * by;\n out[5] = ay * bw + az * bx - ax * bz;\n out[6] = az * bw + ax * by - ay * bx;\n out[7] = -ax * bx - ay * by - az * bz;\n return out;\n }\n /**\n * Sets a {@link Quat2} from a translation\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param t - translation vector\n * @returns `out`\n */\n static fromTranslation(out, t) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = t[0] * 0.5;\n out[5] = t[1] * 0.5;\n out[6] = t[2] * 0.5;\n out[7] = 0;\n return out;\n }\n /**\n * Sets a {@link Quat2} from a quaternion\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param q - a normalized quaternion\n * @returns `out`\n */\n static fromRotation(out, q) {\n out[0] = q[0];\n out[1] = q[1];\n out[2] = q[2];\n out[3] = q[3];\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n }\n /**\n * Sets a {@link Quat2} from a quaternion\n * @category Static\n *\n * @param out - dual quaternion receiving operation result\n * @param a - the matrix\n * @returns `out`\n */\n static fromMat4(out, a) {\n Mat4.getRotation(tempQuat, a);\n Mat4.getTranslation(tempVec3, a);\n return Quat2.fromRotationTranslation(out, tempQuat, tempVec3);\n }\n /**\n * Copy the values from one {@link Quat2} to another\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the source dual quaternion\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n return out;\n }\n /**\n * Set a {@link Quat2} to the identity dual quaternion\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @returns `out`\n */\n static identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n return out;\n }\n /**\n * Set the components of a {@link Quat2} to the given values\n * @category Static\n *\n * @param out - the receiving vector\n * @param x1 - 1st X component\n * @param y1 - 1st Y component\n * @param z1 - 1st Z component\n * @param w1 - 1st W component\n * @param x2 - 2nd X component\n * @param y2 - 2nd Y component\n * @param z2 - 2nd Z component\n * @param w2 - 2nd W component\n * @returns `out`\n */\n static set(out, x1, y1, z1, w1, x2, y2, z2, w2) {\n out[0] = x1;\n out[1] = y1;\n out[2] = z1;\n out[3] = w1;\n out[4] = x2;\n out[5] = y2;\n out[6] = z2;\n out[7] = w2;\n return out;\n }\n /**\n * Gets the real part of a dual quat\n * @category Static\n *\n * @param out - real part\n * @param a - Dual Quaternion\n * @return `out`\n */\n static getReal(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n ;\n /**\n * Gets the dual part of a dual quat\n * @category Static\n *\n * @param out - dual part\n * @param a - Dual Quaternion\n * @return `out`\n */\n static getDual(out, a) {\n out[0] = a[4];\n out[1] = a[5];\n out[2] = a[6];\n out[3] = a[7];\n return out;\n }\n /**\n * Set the real component of a {@link Quat2} to the given quaternion\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - a quaternion representing the real part\n * @return `out`\n */\n static setReal(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n }\n ;\n /**\n * Set the dual component of a {@link Quat2} to the given quaternion\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - a quaternion representing the dual part\n * @return `out`\n */\n static setDual(out, a) {\n out[4] = a[0];\n out[5] = a[1];\n out[6] = a[2];\n out[7] = a[3];\n return out;\n }\n /**\n * Gets the translation of a normalized {@link Quat2}\n * @category Static\n *\n * @param out - the receiving translation vector\n * @param a - Dual Quaternion to be decomposed\n * @return `out`\n */\n static getTranslation(out, a) {\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const bx = -a[0];\n const by = -a[1];\n const bz = -a[2];\n const bw = a[3];\n out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n return out;\n }\n /**\n * Translates a {@link Quat2} by the given vector\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to translate\n * @param v - vector to translate by\n * @returns `out`\n */\n static translate(out, a, v) {\n const ax1 = a[0];\n const ay1 = a[1];\n const az1 = a[2];\n const aw1 = a[3];\n const bx1 = v[0] * 0.5;\n const by1 = v[1] * 0.5;\n const bz1 = v[2] * 0.5;\n const ax2 = a[4];\n const ay2 = a[5];\n const az2 = a[6];\n const aw2 = a[7];\n out[0] = ax1;\n out[1] = ay1;\n out[2] = az1;\n out[3] = aw1;\n out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;\n out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;\n out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;\n out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around the X axis\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateX(out, a, rad) {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n Quat.rotateX(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around the Y axis\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateY(out, a, rad) {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n Quat.rotateY(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around the Z axis\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param rad - angle (in radians) to rotate\n * @returns `out`\n */\n static rotateZ(out, a, rad) {\n let bx = -a[0];\n let by = -a[1];\n let bz = -a[2];\n let bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const ax1 = ax * bw + aw * bx + ay * bz - az * by;\n const ay1 = ay * bw + aw * by + az * bx - ax * bz;\n const az1 = az * bw + aw * bz + ax * by - ay * bx;\n const aw1 = aw * bw - ax * bx - ay * by - az * bz;\n Quat.rotateZ(out, a, rad);\n bx = out[0];\n by = out[1];\n bz = out[2];\n bw = out[3];\n out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} by a given quaternion (a * q)\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param q - quaternion to rotate by\n * @returns `out`\n */\n static rotateByQuatAppend(out, a, q) {\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n let ax = a[0];\n let ay = a[1];\n let az = a[2];\n let aw = a[3];\n out[0] = ax * qw + aw * qx + ay * qz - az * qy;\n out[1] = ay * qw + aw * qy + az * qx - ax * qz;\n out[2] = az * qw + aw * qz + ax * qy - ay * qx;\n out[3] = aw * qw - ax * qx - ay * qy - az * qz;\n ax = a[4];\n ay = a[5];\n az = a[6];\n aw = a[7];\n out[4] = ax * qw + aw * qx + ay * qz - az * qy;\n out[5] = ay * qw + aw * qy + az * qx - ax * qz;\n out[6] = az * qw + aw * qz + ax * qy - ay * qx;\n out[7] = aw * qw - ax * qx - ay * qy - az * qz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} by a given quaternion (q * a)\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param q - quaternion to rotate by\n * @param a - the dual quaternion to rotate\n * @returns `out`\n */\n static rotateByQuatPrepend(out, q, a) {\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n let bx = a[0];\n let by = a[1];\n let bz = a[2];\n let bw = a[3];\n out[0] = qx * bw + qw * bx + qy * bz - qz * by;\n out[1] = qy * bw + qw * by + qz * bx - qx * bz;\n out[2] = qz * bw + qw * bz + qx * by - qy * bx;\n out[3] = qw * bw - qx * bx - qy * by - qz * bz;\n bx = a[4];\n by = a[5];\n bz = a[6];\n bw = a[7];\n out[4] = qx * bw + qw * bx + qy * bz - qz * by;\n out[5] = qy * bw + qw * by + qz * bx - qx * bz;\n out[6] = qz * bw + qw * bz + qx * by - qy * bx;\n out[7] = qw * bw - qx * bx - qy * by - qz * bz;\n return out;\n }\n /**\n * Rotates a {@link Quat2} around a given axis. Does the normalization automatically\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the dual quaternion to rotate\n * @param axis - the axis to rotate around\n * @param rad - how far the rotation should be\n * @returns `out`\n */\n static rotateAroundAxis(out, a, axis, rad) {\n //Special case for rad = 0\n if (Math.abs(rad) < EPSILON) {\n return Quat2.copy(out, a);\n }\n const axisLength = Math.sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);\n rad = rad * 0.5;\n const s = Math.sin(rad);\n const bx = (s * axis[0]) / axisLength;\n const by = (s * axis[1]) / axisLength;\n const bz = (s * axis[2]) / axisLength;\n const bw = Math.cos(rad);\n const ax1 = a[0];\n const ay1 = a[1];\n const az1 = a[2];\n const aw1 = a[3];\n out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;\n out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;\n out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;\n out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n out[4] = ax * bw + aw * bx + ay * bz - az * by;\n out[5] = ay * bw + aw * by + az * bx - ax * bz;\n out[6] = az * bw + aw * bz + ax * by - ay * bx;\n out[7] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n }\n /**\n * Adds two {@link Quat2}s\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n return out;\n }\n /**\n * Multiplies two {@link Quat2}s\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - the first operand\n * @param b - the second operand\n * @returns {quat2} out\n */\n static multiply(out, a, b) {\n const ax0 = a[0];\n const ay0 = a[1];\n const az0 = a[2];\n const aw0 = a[3];\n const bx1 = b[4];\n const by1 = b[5];\n const bz1 = b[6];\n const bw1 = b[7];\n const ax1 = a[4];\n const ay1 = a[5];\n const az1 = a[6];\n const aw1 = a[7];\n const bx0 = b[0];\n const by0 = b[1];\n const bz0 = b[2];\n const bw0 = b[3];\n out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;\n out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;\n out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;\n out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;\n out[4] =\n ax0 * bw1 +\n aw0 * bx1 +\n ay0 * bz1 -\n az0 * by1 +\n ax1 * bw0 +\n aw1 * bx0 +\n ay1 * bz0 -\n az1 * by0;\n out[5] =\n ay0 * bw1 +\n aw0 * by1 +\n az0 * bx1 -\n ax0 * bz1 +\n ay1 * bw0 +\n aw1 * by0 +\n az1 * bx0 -\n ax1 * bz0;\n out[6] =\n az0 * bw1 +\n aw0 * bz1 +\n ax0 * by1 -\n ay0 * bx1 +\n az1 * bw0 +\n aw1 * bz0 +\n ax1 * by0 -\n ay1 * bx0;\n out[7] =\n aw0 * bw1 -\n ax0 * bx1 -\n ay0 * by1 -\n az0 * bz1 +\n aw1 * bw0 -\n ax1 * bx0 -\n ay1 * by0 -\n az1 * bz0;\n return out;\n }\n /**\n * Alias for {@link Quat2.multiply}\n * @category Static\n */\n static mul(out, a, b) { return out; }\n /**\n * Scales a {@link Quat2} by a scalar value\n * @category Static\n *\n * @param out - the receiving dual quaterion\n * @param a - the dual quaternion to scale\n * @param b - scalar value to scale the dual quaterion by\n * @returns `out`\n */\n static scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n return out;\n }\n /**\n * Calculates the dot product of two {@link Quat2}s (The dot product of the real parts)\n * @category Static\n *\n * @param a - the first operand\n * @param b - the second operand\n * @returns dot product of a and b\n */\n static dot(a, b) { return 0; }\n /**\n * Performs a linear interpolation between two {@link Quat2}s\n * NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when `t = 0.5`)\n * @category Static\n *\n * @param out - the receiving dual quat\n * @param a - the first operand\n * @param b - the second operand\n * @param t - interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const mt = 1 - t;\n if (Quat2.dot(a, b) < 0)\n t = -t;\n out[0] = a[0] * mt + b[0] * t;\n out[1] = a[1] * mt + b[1] * t;\n out[2] = a[2] * mt + b[2] * t;\n out[3] = a[3] * mt + b[3] * t;\n out[4] = a[4] * mt + b[4] * t;\n out[5] = a[5] * mt + b[5] * t;\n out[6] = a[6] * mt + b[6] * t;\n out[7] = a[7] * mt + b[7] * t;\n return out;\n }\n /**\n * Calculates the inverse of a {@link Quat2}. If they are normalized, conjugate is cheaper\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - dual quat to calculate inverse of\n * @returns `out`\n */\n static invert(out, a) {\n const sqlen = Quat2.squaredLength(a);\n out[0] = -a[0] / sqlen;\n out[1] = -a[1] / sqlen;\n out[2] = -a[2] / sqlen;\n out[3] = a[3] / sqlen;\n out[4] = -a[4] / sqlen;\n out[5] = -a[5] / sqlen;\n out[6] = -a[6] / sqlen;\n out[7] = a[7] / sqlen;\n return out;\n }\n /**\n * Calculates the conjugate of a {@link Quat2}\n * If the dual quaternion is normalized, this function is faster than {@link Quat2.invert} and produces the same result.\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - dual quaternion to calculate conjugate of\n * @returns `out`\n */\n static conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n out[4] = -a[4];\n out[5] = -a[5];\n out[6] = -a[6];\n out[7] = a[7];\n return out;\n }\n /**\n * Calculates the magnitude (length) of a {@link Quat2}\n * @category Static\n *\n * @param a - dual quaternion to calculate length of\n * @returns length of `a`\n */\n static magnitude(a) { return 0; }\n /**\n * Alias for {@link Quat2.magnitude}\n * @category Static\n */\n static mag(a) { return 0; }\n /**\n * Alias for {@link Quat2.magnitude}\n * @category Static\n * @deprecated Use {@link Quat2.magnitude} to avoid conflicts with builtin `length` methods/attribs\n */\n // @ts-ignore: Length conflicts with Function.length\n static length(a) { return 0; }\n /**\n * Alias for {@link Quat2.magnitude}\n * @category Static\n * @deprecated Use {@link Quat2.mag}\n */\n static len(a) { return 0; }\n /**\n * Calculates the squared length of a {@link Quat2}\n * @category Static\n *\n * @param a - dual quaternion to calculate squared length of\n * @returns squared length of a\n */\n static squaredLength(a) { return 0; }\n /**\n * Alias for {@link Quat2.squaredLength}\n * @category Static\n */\n static sqrLen(a) { return 0; }\n /**\n * Normalize a {@link Quat2}\n * @category Static\n *\n * @param out - the receiving dual quaternion\n * @param a - dual quaternion to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n let magnitude = Quat2.squaredLength(a);\n if (magnitude > 0) {\n magnitude = Math.sqrt(magnitude);\n const a0 = a[0] / magnitude;\n const a1 = a[1] / magnitude;\n const a2 = a[2] / magnitude;\n const a3 = a[3] / magnitude;\n const b0 = a[4];\n const b1 = a[5];\n const b2 = a[6];\n const b3 = a[7];\n const a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = (b0 - a0 * a_dot_b) / magnitude;\n out[5] = (b1 - a1 * a_dot_b) / magnitude;\n out[6] = (b2 - a2 * a_dot_b) / magnitude;\n out[7] = (b3 - a3 * a_dot_b) / magnitude;\n }\n return out;\n }\n /**\n * Returns a string representation of a {@link Quat2}\n * @category Static\n *\n * @param a - dual quaternion to represent as a string\n * @returns string representation of the vector\n */\n static str(a) {\n return `Quat2(${a.join(', ')})`;\n }\n /**\n * Returns whether or not the {@link Quat2}s have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first dual quaternion.\n * @param b - The second dual quaternion.\n * @returns True if the dual quaternions are equal, false otherwise.\n */\n static exactEquals(a, b) {\n return (a[0] === b[0] &&\n a[1] === b[1] &&\n a[2] === b[2] &&\n a[3] === b[3] &&\n a[4] === b[4] &&\n a[5] === b[5] &&\n a[6] === b[6] &&\n a[7] === b[7]);\n }\n /**\n * Returns whether or not the {@link Quat2}s have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first dual quaternion.\n * @param b - The second dual quaternion.\n * @returns True if the dual quaternions are equal, false otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\n Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\n Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\n Math.abs(a6 - b6) <= EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\n Math.abs(a7 - b7) <= EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)));\n }\n}\n// Temporary variables to prevent repeated allocations in the algorithms above.\nconst tempQuat = [0, 0, 0, 0];\nconst tempVec3 = [0, 0, 0];\n// Methods which re-use the Quat implementation\n// @ts-ignore\nQuat2.dot = Quat.dot;\n// @ts-ignore\nQuat2.squaredLength = Quat.squaredLength;\n// @ts-ignore\nQuat2.sqrLen = Quat.squaredLength;\n// @ts-ignore\nQuat2.mag = Quat.magnitude;\n// @ts-ignore\nQuat2.length = Quat.magnitude;\n// @ts-ignore\nQuat2.len = Quat.magnitude;\n// Static method alias assignments\nQuat2.mul = Quat2.multiply;\n\n/**\n * 2 Dimensional Vector\n */\nclass Vec2 extends Float32Array {\n /**\n * The number of bytes in a {@link Vec2}.\n */\n static BYTE_LENGTH = 2 * Float32Array.BYTES_PER_ELEMENT;\n /**\n * Create a {@link Vec2}.\n */\n constructor(...values) {\n switch (values.length) {\n case 2: {\n const v = values[0];\n if (typeof v === 'number') {\n super([v, values[1]]);\n }\n else {\n super(v, values[1], 2);\n }\n break;\n }\n case 1: {\n const v = values[0];\n if (typeof v === 'number') {\n super([v, v]);\n }\n else {\n super(v, 0, 2);\n }\n break;\n }\n default:\n super(2);\n break;\n }\n }\n //============\n // Attributes\n //============\n // Getters and setters to make component access read better.\n // These are likely to be a little bit slower than direct array access.\n /**\n * The x component of the vector. Equivalent to `this[0];`\n * @category Vector components\n */\n get x() { return this[0]; }\n set x(value) { this[0] = value; }\n /**\n * The y component of the vector. Equivalent to `this[1];`\n * @category Vector components\n */\n get y() { return this[1]; }\n set y(value) { this[1] = value; }\n // Alternate set of getters and setters in case this is being used to define\n // a color.\n /**\n * The r component of the vector. Equivalent to `this[0];`\n * @category Color components\n */\n get r() { return this[0]; }\n set r(value) { this[0] = value; }\n /**\n * The g component of the vector. Equivalent to `this[1];`\n * @category Color components\n */\n get g() { return this[1]; }\n set g(value) { this[1] = value; }\n /**\n * The magnitude (length) of this.\n * Equivalent to `Vec2.magnitude(this);`\n *\n * Magnitude is used because the `length` attribute is already defined by\n * `Float32Array` to mean the number of elements in the array.\n */\n get magnitude() {\n return Math.hypot(this[0], this[1]);\n }\n /**\n * Alias for {@link Vec2.magnitude}\n */\n get mag() { return this.magnitude; }\n /**\n * The squared magnitude (length) of `this`.\n * Equivalent to `Vec2.squaredMagnitude(this);`\n */\n get squaredMagnitude() {\n const x = this[0];\n const y = this[1];\n return x * x + y * y;\n }\n /**\n * Alias for {@link Vec2.squaredMagnitude}\n */\n get sqrMag() { return this.squaredMagnitude; }\n /**\n * A string representation of `this`\n * Equivalent to `Vec2.str(this);`\n */\n get str() {\n return Vec2.str(this);\n }\n //===================\n // Instances methods\n //===================\n /**\n * Copy the values from another {@link Vec2} into `this`.\n *\n * @param a the source vector\n * @returns `this`\n */\n copy(a) {\n this.set(a);\n return this;\n }\n // Instead of zero(), use a.fill(0) for instances;\n /**\n * Adds a {@link Vec2} to `this`.\n * Equivalent to `Vec2.add(this, this, b);`\n *\n * @param b - The vector to add to `this`\n * @returns `this`\n */\n add(b) {\n this[0] += b[0];\n this[1] += b[1];\n return this;\n }\n /**\n * Subtracts a {@link Vec2} from `this`.\n * Equivalent to `Vec2.subtract(this, this, b);`\n *\n * @param b - The vector to subtract from `this`\n * @returns `this`\n */\n subtract(b) {\n this[0] -= b[0];\n this[1] -= b[1];\n return this;\n }\n /**\n * Alias for {@link Vec2.subtract}\n */\n sub(b) { return this; }\n /**\n * Multiplies `this` by a {@link Vec2}.\n * Equivalent to `Vec2.multiply(this, this, b);`\n *\n * @param b - The vector to multiply `this` by\n * @returns `this`\n */\n multiply(b) {\n this[0] *= b[0];\n this[1] *= b[1];\n return this;\n }\n /**\n * Alias for {@link Vec2.multiply}\n */\n mul(b) { return this; }\n /**\n * Divides `this` by a {@link Vec2}.\n * Equivalent to `Vec2.divide(this, this, b);`\n *\n * @param b - The vector to divide `this` by\n * @returns {Vec2} `this`\n */\n divide(b) {\n this[0] /= b[0];\n this[1] /= b[1];\n return this;\n }\n /**\n * Alias for {@link Vec2.divide}\n */\n div(b) { return this; }\n /**\n * Scales `this` by a scalar number.\n * Equivalent to `Vec2.scale(this, this, b);`\n *\n * @param b - Amount to scale `this` by\n * @returns `this`\n */\n scale(b) {\n this[0] *= b;\n this[1] *= b;\n return this;\n }\n /**\n * Calculates `this` scaled by a scalar value then adds the result to `this`.\n * Equivalent to `Vec2.scaleAndAdd(this, this, b, scale);`\n *\n * @param b - The vector to add to `this`\n * @param scale - The amount to scale `b` by before adding\n * @returns `this`\n */\n scaleAndAdd(b, scale) {\n this[0] += b[0] * scale;\n this[1] += b[1] * scale;\n return this;\n }\n /**\n * Calculates the euclidian distance between another {@link Vec2} and `this`.\n * Equivalent to `Vec2.distance(this, b);`\n *\n * @param b - The vector to calculate the distance to\n * @returns Distance between `this` and `b`\n */\n distance(b) {\n return Vec2.distance(this, b);\n }\n /**\n * Alias for {@link Vec2.distance}\n */\n dist(b) { return 0; }\n /**\n * Calculates the squared euclidian distance between another {@link Vec2} and `this`.\n * Equivalent to `Vec2.squaredDistance(this, b);`\n *\n * @param b The vector to calculate the squared distance to\n * @returns Squared distance between `this` and `b`\n */\n squaredDistance(b) {\n return Vec2.squaredDistance(this, b);\n }\n /**\n * Alias for {@link Vec2.squaredDistance}\n */\n sqrDist(b) { return 0; }\n /**\n * Negates the components of `this`.\n * Equivalent to `Vec2.negate(this, this);`\n *\n * @returns `this`\n */\n negate() {\n this[0] *= -1;\n this[1] *= -1;\n return this;\n }\n /**\n * Inverts the components of `this`.\n * Equivalent to `Vec2.inverse(this, this);`\n *\n * @returns `this`\n */\n invert() {\n this[0] = 1.0 / this[0];\n this[1] = 1.0 / this[1];\n return this;\n }\n /**\n * Calculates the dot product of this and another {@link Vec2}.\n * Equivalent to `Vec2.dot(this, b);`\n *\n * @param b - The second operand\n * @returns Dot product of `this` and `b`\n */\n dot(b) {\n return this[0] * b[0] + this[1] * b[1];\n }\n /**\n * Normalize `this`.\n * Equivalent to `Vec2.normalize(this, this);`\n *\n * @returns `this`\n */\n normalize() {\n return Vec2.normalize(this, this);\n }\n //================\n // Static methods\n //================\n /**\n * Creates a new, empty {@link Vec2}\n * @category Static\n *\n * @returns A new 2D vector\n */\n static create() {\n return new Vec2();\n }\n /**\n * Creates a new {@link Vec2} initialized with values from an existing vector\n * @category Static\n *\n * @param a - Vector to clone\n * @returns A new 2D vector\n */\n static clone(a) {\n return new Vec2(a);\n }\n /**\n * Creates a new {@link Vec2} initialized with the given values\n * @category Static\n *\n * @param x - X component\n * @param y - Y component\n * @returns A new 2D vector\n */\n static fromValues(x, y) {\n return new Vec2(x, y);\n }\n /**\n * Copy the values from one {@link Vec2} to another\n * @category Static\n *\n * @param out - the receiving vector\n * @param a - The source vector\n * @returns `out`\n */\n static copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n }\n /**\n * Set the components of a {@link Vec2} to the given values\n * @category Static\n *\n * @param out - The receiving vector\n * @param x - X component\n * @param y - Y component\n * @returns `out`\n */\n static set(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n }\n /**\n * Adds two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n }\n /**\n * Subtracts vector b from vector a\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n }\n /**\n * Alias for {@link Vec2.subtract}\n * @category Static\n */\n static sub(out, a, b) { return [0, 0]; }\n /**\n * Multiplies two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n }\n /**\n * Alias for {@link Vec2.multiply}\n * @category Static\n */\n static mul(out, a, b) { return [0, 0]; }\n /**\n * Divides two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n }\n /**\n * Alias for {@link Vec2.divide}\n * @category Static\n */\n static div(out, a, b) { return [0, 0]; }\n /**\n * Math.ceil the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to ceil\n * @returns `out`\n */\n static ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n }\n /**\n * Math.floor the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to floor\n * @returns `out`\n */\n static floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n }\n /**\n * Returns the minimum of two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n }\n /**\n * Returns the maximum of two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n }\n /**\n * Math.round the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to round\n * @returns `out`\n */\n static round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n return out;\n }\n /**\n * Scales a {@link Vec2} by a scalar number\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The vector to scale\n * @param b - Amount to scale the vector by\n * @returns `out`\n */\n static scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n }\n /**\n * Adds two Vec2's after scaling the second operand by a scalar value\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @param scale - The amount to scale b by before adding\n * @returns `out`\n */\n static scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n }\n /**\n * Calculates the euclidian distance between two {@link Vec2}s\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns distance between `a` and `b`\n */\n static distance(a, b) {\n return Math.hypot(b[0] - a[0], b[1] - a[1]);\n }\n /**\n * Alias for {@link Vec2.distance}\n * @category Static\n */\n static dist(a, b) { return 0; }\n /**\n * Calculates the squared euclidian distance between two {@link Vec2}s\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns Squared distance between `a` and `b`\n */\n static squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n return x * x + y * y;\n }\n /**\n * Alias for {@link Vec2.distance}\n * @category Static\n */\n static sqrDist(a, b) { return 0; }\n /**\n * Calculates the magnitude (length) of a {@link Vec2}\n * @category Static\n *\n * @param a - Vector to calculate magnitude of\n * @returns Magnitude of a\n */\n static magnitude(a) {\n let x = a[0];\n let y = a[1];\n return Math.sqrt(x * x + y * y);\n }\n /**\n * Alias for {@link Vec2.magnitude}\n * @category Static\n */\n static mag(a) { return 0; }\n /**\n * Alias for {@link Vec2.magnitude}\n * @category Static\n * @deprecated Use {@link Vec2.magnitude} to avoid conflicts with builtin `length` methods/attribs\n *\n * @param a - vector to calculate length of\n * @returns length of a\n */\n // @ts-ignore: Length conflicts with Function.length\n static length(a) { return 0; }\n /**\n * Alias for {@link Vec2.magnitude}\n * @category Static\n * @deprecated Use {@link Vec2.mag}\n */\n static len(a) { return 0; }\n /**\n * Calculates the squared length of a {@link Vec2}\n * @category Static\n *\n * @param a - Vector to calculate squared length of\n * @returns Squared length of a\n */\n static squaredLength(a) {\n const x = a[0];\n const y = a[1];\n return x * x + y * y;\n }\n /**\n * Alias for {@link Vec2.squaredLength}\n */\n static sqrLen(a, b) { return 0; }\n /**\n * Negates the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to negate\n * @returns `out`\n */\n static negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n }\n /**\n * Returns the inverse of the components of a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to invert\n * @returns `out`\n */\n static inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n }\n /**\n * Normalize a {@link Vec2}\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - Vector to normalize\n * @returns `out`\n */\n static normalize(out, a) {\n const x = a[0];\n const y = a[1];\n let len = x * x + y * y;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n }\n /**\n * Calculates the dot product of two {@link Vec2}s\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns Dot product of `a` and `b`\n */\n static dot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n }\n /**\n * Computes the cross product of two {@link Vec2}s\n * Note that the cross product must by definition produce a 3D vector.\n * For this reason there is also not instance equivalent for this function.\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @returns `out`\n */\n static cross(out, a, b) {\n const z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n }\n /**\n * Performs a linear interpolation between two {@link Vec2}s\n * @category Static\n *\n * @param out - The receiving vector\n * @param a - The first operand\n * @param b - The second operand\n * @param t - Interpolation amount, in the range [0-1], between the two inputs\n * @returns `out`\n */\n static lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat2}\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n */\n static transformMat2(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat2d}\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n */\n static transformMat2d(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat3}\n * 3rd vector component is implicitly '1'\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n */\n static transformMat3(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n }\n /**\n * Transforms the {@link Vec2} with a {@link Mat4}\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param out - The receiving vector\n * @param a - The vector to transform\n * @param m - Matrix to transform with\n * @returns `out`\n */\n static transformMat4(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n }\n /**\n * Rotate a 2D vector\n * @category Static\n *\n * @param out - The receiving {@link Vec2}\n * @param a - The {@link Vec2} point to rotate\n * @param b - The origin of the rotation\n * @param rad - The angle of rotation in radians\n * @returns `out`\n */\n static rotate(out, a, b, rad) {\n //Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n //perform rotation and translate to correct position\n out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n return out;\n }\n /**\n * Get the angle between two 2D vectors\n * @category Static\n *\n * @param a - The first operand\n * @param b - The second operand\n * @returns The angle in radians\n */\n static angle(a, b) {\n const x1 = a[0];\n const y1 = a[1];\n const x2 = b[0];\n const y2 = b[1];\n // mag is the product of the magnitudes of a and b\n const mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2);\n // mag &&.. short circuits if mag == 0\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n }\n /**\n * Set the components of a {@link Vec2} to zero\n * @category Static\n *\n * @param out - The receiving vector\n * @returns `out`\n */\n static zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n return out;\n }\n /**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns `true` if the vectors components are ===, `false` otherwise.\n */\n static exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1];\n }\n /**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n * @category Static\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns `true` if the vectors are approximately equal, `false` otherwise.\n */\n static equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const b0 = b[0];\n const b1 = b[1];\n return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)));\n }\n /**\n * Returns a string representation of a vector\n * @category Static\n *\n * @param a - Vector to represent as a string\n * @returns String representation of the vector\n */\n static str(a) {\n return `Vec2(${a.join(', ')})`;\n }\n}\n// Instance method alias assignments\nVec2.prototype.sub = Vec2.prototype.subtract;\nVec2.prototype.mul = Vec2.prototype.multiply;\nVec2.prototype.div = Vec2.prototype.divide;\nVec2.prototype.dist = Vec2.prototype.distance;\nVec2.prototype.sqrDist = Vec2.prototype.squaredDistance;\n// Static method alias assignments\nVec2.sub = Vec2.subtract;\nVec2.mul = Vec2.multiply;\nVec2.div = Vec2.divide;\nVec2.dist = Vec2.distance;\nVec2.sqrDist = Vec2.squaredDistance;\nVec2.sqrLen = Vec2.squaredLength;\nVec2.mag = Vec2.magnitude;\nVec2.length = Vec2.magnitude;\nVec2.len = Vec2.magnitude;\n\n// The contents of the following section are autogenerated by scripts/gen-swizzle.js and should\n// not be modified by hand.\n// [Swizzle Autogen]\nconst VEC2_SWIZZLES = ['xx', 'xy', 'yx', 'yy', 'xxx', 'xxy', 'xyx', 'xyy', 'yxx', 'yxy', 'yyx', 'yyy', 'xxxx', 'xxxy', 'xxyx', 'xxyy', 'xyxx', 'xyxy', 'xyyx', 'xyyy', 'yxxx', 'yxxy', 'yxyx', 'yxyy', 'yyxx', 'yyxy', 'yyyx', 'yyyy', 'rr', 'rg', 'gr', 'gg', 'rrr', 'rrg', 'rgr', 'rgg', 'grr', 'grg', 'ggr', 'ggg', 'rrrr', 'rrrg', 'rrgr', 'rrgg', 'rgrr', 'rgrg', 'rggr', 'rggg', 'grrr', 'grrg', 'grgr', 'grgg', 'ggrr', 'ggrg', 'gggr', 'gggg'];\nconst VEC3_SWIZZLES = ['xz', 'yz', 'zx', 'zy', 'zz', 'xxz', 'xyz', 'xzx', 'xzy', 'xzz', 'yxz', 'yyz', 'yzx', 'yzy', 'yzz', 'zxx', 'zxy', 'zxz', 'zyx', 'zyy', 'zyz', 'zzx', 'zzy', 'zzz', 'xxxz', 'xxyz', 'xxzx', 'xxzy', 'xxzz', 'xyxz', 'xyyz', 'xyzx', 'xyzy', 'xyzz', 'xzxx', 'xzxy', 'xzxz', 'xzyx', 'xzyy', 'xzyz', 'xzzx', 'xzzy', 'xzzz', 'yxxz', 'yxyz', 'yxzx', 'yxzy', 'yxzz', 'yyxz', 'yyyz', 'yyzx', 'yyzy', 'yyzz', 'yzxx', 'yzxy', 'yzxz', 'yzyx', 'yzyy', 'yzyz', 'yzzx', 'yzzy', 'yzzz', 'zxxx', 'zxxy', 'zxxz', 'zxyx', 'zxyy', 'zxyz', 'zxzx', 'zxzy', 'zxzz', 'zyxx', 'zyxy', 'zyxz', 'zyyx', 'zyyy', 'zyyz', 'zyzx', 'zyzy', 'zyzz', 'zzxx', 'zzxy', 'zzxz', 'zzyx', 'zzyy', 'zzyz', 'zzzx', 'zzzy', 'zzzz', 'rb', 'gb', 'br', 'bg', 'bb', 'rrb', 'rgb', 'rbr', 'rbg', 'rbb', 'grb', 'ggb', 'gbr', 'gbg', 'gbb', 'brr', 'brg', 'brb', 'bgr', 'bgg', 'bgb', 'bbr', 'bbg', 'bbb', 'rrrb', 'rrgb', 'rrbr', 'rrbg', 'rrbb', 'rgrb', 'rggb', 'rgbr', 'rgbg', 'rgbb', 'rbrr', 'rbrg', 'rbrb', 'rbgr', 'rbgg', 'rbgb', 'rbbr', 'rbbg', 'rbbb', 'grrb', 'grgb', 'grbr', 'grbg', 'grbb', 'ggrb', 'gggb', 'ggbr', 'ggbg', 'ggbb', 'gbrr', 'gbrg', 'gbrb', 'gbgr', 'gbgg', 'gbgb', 'gbbr', 'gbbg', 'gbbb', 'brrr', 'brrg', 'brrb', 'brgr', 'brgg', 'brgb', 'brbr', 'brbg', 'brbb', 'bgrr', 'bgrg', 'bgrb', 'bggr', 'bggg', 'bggb', 'bgbr', 'bgbg', 'bgbb', 'bbrr', 'bbrg', 'bbrb', 'bbgr', 'bbgg', 'bbgb', 'bbbr', 'bbbg', 'bbbb'];\nconst VEC4_SWIZZLES = ['xw', 'yw', 'zw', 'wx', 'wy', 'wz', 'ww', 'xxw', 'xyw', 'xzw', 'xwx', 'xwy', 'xwz', 'xww', 'yxw', 'yyw', 'yzw', 'ywx', 'ywy', 'ywz', 'yww', 'zxw', 'zyw', 'zzw', 'zwx', 'zwy', 'zwz', 'zww', 'wxx', 'wxy', 'wxz', 'wxw', 'wyx', 'wyy', 'wyz', 'wyw', 'wzx', 'wzy', 'wzz', 'wzw', 'wwx', 'wwy', 'wwz', 'www', 'xxxw', 'xxyw', 'xxzw', 'xxwx', 'xxwy', 'xxwz', 'xxww', 'xyxw', 'xyyw', 'xyzw', 'xywx', 'xywy', 'xywz', 'xyww', 'xzxw', 'xzyw', 'xzzw', 'xzwx', 'xzwy', 'xzwz', 'xzww', 'xwxx', 'xwxy', 'xwxz', 'xwxw', 'xwyx', 'xwyy', 'xwyz', 'xwyw', 'xwzx', 'xwzy', 'xwzz', 'xwzw', 'xwwx', 'xwwy', 'xwwz', 'xwww', 'yxxw', 'yxyw', 'yxzw', 'yxwx', 'yxwy', 'yxwz', 'yxww', 'yyxw', 'yyyw', 'yyzw', 'yywx', 'yywy', 'yywz', 'yyww', 'yzxw', 'yzyw', 'yzzw', 'yzwx', 'yzwy', 'yzwz', 'yzww', 'ywxx', 'ywxy', 'ywxz', 'ywxw', 'ywyx', 'ywyy', 'ywyz', 'ywyw', 'ywzx', 'ywzy', 'ywzz', 'ywzw', 'ywwx', 'ywwy', 'ywwz', 'ywww', 'zxxw', 'zxyw', 'zxzw', 'zxwx', 'zxwy', 'zxwz', 'zxww', 'zyxw', 'zyyw', 'zyzw', 'zywx', 'zywy', 'zywz', 'zyww', 'zzxw', 'zzyw', 'zzzw', 'zzwx', 'zzwy', 'zzwz', 'zzww', 'zwxx', 'zwxy', 'zwxz', 'zwxw', 'zwyx', 'zwyy', 'zwyz', 'zwyw', 'zwzx', 'zwzy', 'zwzz', 'zwzw', 'zwwx', 'zwwy', 'zwwz', 'zwww', 'wxxx', 'wxxy', 'wxxz', 'wxxw', 'wxyx', 'wxyy', 'wxyz', 'wxyw', 'wxzx', 'wxzy', 'wxzz', 'wxzw', 'wxwx', 'wxwy', 'wxwz', 'wxww', 'wyxx', 'wyxy', 'wyxz', 'wyxw', 'wyyx', 'wyyy', 'wyyz', 'wyyw', 'wyzx', 'wyzy', 'wyzz', 'wyzw', 'wywx', 'wywy', 'wywz', 'wyww', 'wzxx', 'wzxy', 'wzxz', 'wzxw', 'wzyx', 'wzyy', 'wzyz', 'wzyw', 'wzzx', 'wzzy', 'wzzz', 'wzzw', 'wzwx', 'wzwy', 'wzwz', 'wzww', 'wwxx', 'wwxy', 'wwxz', 'wwxw', 'wwyx', 'wwyy', 'wwyz', 'wwyw', 'wwzx', 'wwzy', 'wwzz', 'wwzw', 'wwwx', 'wwwy', 'wwwz', 'wwww', 'ra', 'ga', 'ba', 'ar', 'ag', 'ab', 'aa', 'rra', 'rga', 'rba', 'rar', 'rag', 'rab', 'raa', 'gra', 'gga', 'gba', 'gar', 'gag', 'gab', 'gaa', 'bra', 'bga', 'bba', 'bar', 'bag', 'bab', 'baa', 'arr', 'arg', 'arb', 'ara', 'agr', 'agg', 'agb', 'aga', 'abr', 'abg', 'abb', 'aba', 'aar', 'aag', 'aab', 'aaa', 'rrra', 'rrga', 'rrba', 'rrar', 'rrag', 'rrab', 'rraa', 'rgra', 'rgga', 'rgba', 'rgar', 'rgag', 'rgab', 'rgaa', 'rbra', 'rbga', 'rbba', 'rbar', 'rbag', 'rbab', 'rbaa', 'rarr', 'rarg', 'rarb', 'rara', 'ragr', 'ragg', 'ragb', 'raga', 'rabr', 'rabg', 'rabb', 'raba', 'raar', 'raag', 'raab', 'raaa', 'grra', 'grga', 'grba', 'grar', 'grag', 'grab', 'graa', 'ggra', 'ggga', 'ggba', 'ggar', 'ggag', 'ggab', 'ggaa', 'gbra', 'gbga', 'gbba', 'gbar', 'gbag', 'gbab', 'gbaa', 'garr', 'garg', 'garb', 'gara', 'gagr', 'gagg', 'gagb', 'gaga', 'gabr', 'gabg', 'gabb', 'gaba', 'gaar', 'gaag', 'gaab', 'gaaa', 'brra', 'brga', 'brba', 'brar', 'brag', 'brab', 'braa', 'bgra', 'bgga', 'bgba', 'bgar', 'bgag', 'bgab', 'bgaa', 'bbra', 'bbga', 'bbba', 'bbar', 'bbag', 'bbab', 'bbaa', 'barr', 'barg', 'barb', 'bara', 'bagr', 'bagg', 'bagb', 'baga', 'babr', 'babg', 'babb', 'baba', 'baar', 'baag', 'baab', 'baaa', 'arrr', 'arrg', 'arrb', 'arra', 'argr', 'argg', 'argb', 'arga', 'arbr', 'arbg', 'arbb', 'arba', 'arar', 'arag', 'arab', 'araa', 'agrr', 'agrg', 'agrb', 'agra', 'aggr', 'aggg', 'aggb', 'agga', 'agbr', 'agbg', 'agbb', 'agba', 'agar', 'agag', 'agab', 'agaa', 'abrr', 'abrg', 'abrb', 'abra', 'abgr', 'abgg', 'abgb', 'abga', 'abbr', 'abbg', 'abbb', 'abba', 'abar', 'abag', 'abab', 'abaa', 'aarr', 'aarg', 'aarb', 'aara', 'aagr', 'aagg', 'aagb', 'aaga', 'aabr', 'aabg', 'aabb', 'aaba', 'aaar', 'aaag', 'aaab', 'aaaa'];\n// [/Swizzle Autogen]\nconst SWIZZLE_INDEX = {\n x: 0, r: 0,\n y: 1, g: 1,\n z: 2, b: 2,\n w: 3, a: 3,\n};\nfunction getSwizzleImpl(swizzle) {\n switch (swizzle.length) {\n case 2:\n return function () { return new Vec2(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]]); };\n case 3:\n return function () { return new Vec3(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], this[SWIZZLE_INDEX[swizzle[2]]]); };\n case 4:\n return function () { return new Vec4(this[SWIZZLE_INDEX[swizzle[0]]], this[SWIZZLE_INDEX[swizzle[1]]], this[SWIZZLE_INDEX[swizzle[2]]], this[SWIZZLE_INDEX[swizzle[3]]]); };\n }\n}\nlet swizzlesEnabled = false;\n/**\n * Enables Swizzle operations on {@link Vec2}, {@link Vec3}, and {@link Vec4} types.\n *\n * Swizzle operations are performed by using the `.` operator in conjunction with any combination\n * of between two to four component names, either from the set `xyzw` or `rgbw` (though not intermixed).\n * They return a new vector with the same number of components as specified in the swizzle attribute.\n *\n * @example\n * ```js\n * import { Vec3, EnableSwizzles } from 'gl-matrix';\n *\n * EnableSwizzles();\n *\n * let v = new Vec3(0, 1, 2);\n *\n * v.yx // returns new Vec2(1, 0);\n * v.xzy // returns new Vec3(0, 2, 1);\n * v.zyxz // returns new Vec4(2, 1, 0, 2);\n *\n * v.rgb // returns new Vec3(0, 1, 2);\n * v.rbg // returns new Vec3(0, 2, 1);\n * v.gg // returns new Vec2(1, 1);\n * ```\n */\nfunction EnableSwizzles() {\n if (swizzlesEnabled) {\n return;\n }\n for (const swizzle of VEC2_SWIZZLES) {\n const impl = getSwizzleImpl(swizzle);\n Object.defineProperty(Vec2.prototype, swizzle, {\n get: impl\n });\n Object.defineProperty(Vec3.prototype, swizzle, {\n get: impl\n });\n Object.defineProperty(Vec4.prototype, swizzle, {\n get: impl\n });\n }\n for (const swizzle of VEC3_SWIZZLES) {\n const impl = getSwizzleImpl(swizzle);\n Object.defineProperty(Vec3.prototype, swizzle, {\n get: impl\n });\n Object.defineProperty(Vec4.prototype, swizzle, {\n get: impl\n });\n }\n for (const swizzle of VEC4_SWIZZLES) {\n const impl = getSwizzleImpl(swizzle);\n Object.defineProperty(Vec4.prototype, swizzle, {\n get: impl\n });\n }\n swizzlesEnabled = true;\n}\n\nexport { EnableSwizzles, Mat2, Mat2d, Mat3, Mat4, Quat, Quat2, Vec2, Vec3, Vec4 };\n//# sourceMappingURL=index.js.map\n","/**\n * Awaits `requestAnimationFrame` calls by the counter specified. This allows asynchronous applications for direct /\n * inline style modification amongst other direct animation techniques.\n *\n * @param {number} [cntr=1] - A positive integer greater than 0 for amount of requestAnimationFrames to wait.\n *\n * @returns {Promise} Returns current time equivalent to `performance.now()`.\n */\nasync function nextAnimationFrame(cntr = 1)\n{\n if (!Number.isInteger(cntr) || cntr < 1)\n {\n throw new TypeError(`nextAnimationFrame error: 'cntr' must be a positive integer greater than 0.`);\n }\n\n let currentTime = performance.now();\n for (;--cntr >= 0;)\n {\n currentTime = await new Promise((resolve) => requestAnimationFrame(resolve));\n }\n\n return currentTime;\n}\n\nexport { nextAnimationFrame };\n//# sourceMappingURL=index.js.map\n","/**\n * Clamps a value between min / max values.\n *\n * @param {number} value - Value to clamp.\n *\n * @param {number} min - Minimum value.\n *\n * @param {number} max - Maximum value.\n *\n * @returns {number} Clamped value.\n */\nfunction clamp(value = 0, min = 0, max = 0)\n{\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Converts the given number from degrees to radians.\n *\n * @param {number} deg - Degree number to convert\n *\n * @returns {number} Degree as radians.\n */\nfunction degToRad(deg)\n{\n return deg * (Math.PI / 180.0);\n}\n\n/**\n * Converts the given number from radians to degrees.\n *\n * @param {number} rad - Radian number to convert.\n *\n * @returns {number} Degree as radians.\n */\nfunction radToDeg(rad)\n{\n return rad * (180.0 / Math.PI);\n}\n\nexport { clamp, degToRad, radToDeg };\n//# sourceMappingURL=index.js.map\n","import { propertyStore } from '@typhonjs-fvtt/runtime/svelte/store/writable-derived';\nimport { isObject, isPlainObject, isIterable, hasSetter } from '@typhonjs-fvtt/runtime/util/object';\nimport { subscribeIgnoreFirst } from '@typhonjs-fvtt/runtime/util/store';\nimport { cubicOut, linear } from 'svelte/easing';\nimport { lerp } from '@typhonjs-fvtt/runtime/math/interpolate';\nimport { writable } from 'svelte/store';\nimport { StyleParse } from '@typhonjs-fvtt/runtime/util/browser';\nimport { Mat4, Vec3 } from '@typhonjs-fvtt/runtime/math/gl-matrix';\nimport { nextAnimationFrame } from '@typhonjs-fvtt/runtime/util/animate';\nimport { degToRad, clamp } from '@typhonjs-fvtt/runtime/math/util';\n\n/**\n * Provides a TJSBasicAnimation implementation for TJSPosition animation.\n */\nclass AnimationControl\n{\n /** @type {object} */\n #animationData;\n\n /** @type {Promise} */\n #finishedPromise;\n\n #willFinish;\n\n /**\n * Defines a static empty / void animation control.\n *\n * @type {AnimationControl}\n */\n static #voidControl = new AnimationControl(null);\n\n /**\n * Provides a static void / undefined AnimationControl that is automatically resolved.\n *\n * @returns {AnimationControl} Void AnimationControl\n */\n static get voidControl() { return this.#voidControl; }\n\n /**\n * @param {object|null} [animationData] - Animation data from {@link AnimationAPI}.\n *\n * @param {boolean} [willFinish] - Promise that tracks animation finished state.\n */\n constructor(animationData, willFinish = false)\n {\n this.#animationData = animationData;\n this.#willFinish = willFinish;\n\n // Set this control to animation data.\n if (isObject(animationData)) { animationData.control = this; }\n }\n\n /**\n * Get a promise that resolves when animation is finished.\n *\n * @returns {Promise}\n */\n get finished()\n {\n if (!(this.#finishedPromise instanceof Promise))\n {\n this.#finishedPromise = this.#willFinish ? new Promise((resolve) => this.#animationData.resolve = resolve) :\n Promise.resolve();\n }\n\n return this.#finishedPromise;\n }\n\n /**\n * Returns whether this animation is currently active / animating.\n *\n * Note: a delayed animation may not be started / active yet. Use {@link AnimationControl.isFinished} to determine\n * if an animation is actually finished.\n *\n * @returns {boolean} Animation active state.\n */\n get isActive() { return this.#animationData.active; }\n\n /**\n * Returns whether this animation is completely finished.\n *\n * @returns {boolean} Animation finished state.\n */\n get isFinished() { return this.#animationData.finished; }\n\n /**\n * Cancels the animation.\n */\n cancel()\n {\n const animationData = this.#animationData;\n\n if (animationData === null || animationData === void 0) { return; }\n\n // Set cancelled state to true and this animation data instance will be removed from AnimationManager on next\n // update.\n animationData.cancelled = true;\n }\n}\n\n/**\n * Provides animation management and scheduling allowing all TJSPosition instances to utilize one micro-task.\n */\nclass AnimationManager\n{\n /**\n * @type {object[]}\n */\n static activeList = [];\n\n /**\n * @type {object[]}\n */\n static newList = [];\n\n /**\n * @type {number}\n */\n static current;\n\n /**\n * Add animation data.\n *\n * @param {object} data -\n */\n static add(data)\n {\n const now = performance.now();\n\n // Offset start time by delta between last rAF time. This allows continuous tween cycles to appear naturally as\n // starting from the instant they are added to the AnimationManager. This is what makes `draggable` smooth when\n // easing is enabled.\n data.start = now + (AnimationManager.current - now);\n\n AnimationManager.newList.push(data);\n }\n\n /**\n * Manage all animation\n */\n static animate()\n {\n const current = AnimationManager.current = performance.now();\n\n // Early out of the rAF callback when there are no current animations.\n if (AnimationManager.activeList.length === 0 && AnimationManager.newList.length === 0)\n {\n globalThis.requestAnimationFrame(AnimationManager.animate);\n return;\n }\n\n if (AnimationManager.newList.length)\n {\n // Process new data\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n\n // If animation instance has been cancelled before start then remove it from new list and cleanup.\n if (data.cancelled)\n {\n AnimationManager.newList.splice(cntr, 1);\n data.cleanup(data);\n }\n\n // If data is active then process it now. Delayed animations start with `active` false.\n if (data.active)\n {\n // Remove from new list and add to active list.\n AnimationManager.newList.splice(cntr, 1);\n AnimationManager.activeList.push(data);\n }\n }\n }\n\n // Process active animations.\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n\n // Remove any animations that have been canceled.\n // Ensure that the element is still connected otherwise remove it from active list and continue.\n if (data.cancelled || (data.el !== void 0 && !data.el.isConnected))\n {\n AnimationManager.activeList.splice(cntr, 1);\n data.cleanup(data);\n continue;\n }\n\n data.current = current - data.start;\n\n // Remove this animation instance if current animating time exceeds duration.\n if (data.current >= data.duration)\n {\n // Prepare final update with end position data.\n for (let dataCntr = data.keys.length; --dataCntr >= 0;)\n {\n const key = data.keys[dataCntr];\n data.newData[key] = data.destination[key];\n }\n\n data.position.set(data.newData);\n\n AnimationManager.activeList.splice(cntr, 1);\n data.cleanup(data);\n\n continue;\n }\n\n // Apply easing to create an eased time.\n const easedTime = data.ease(data.current / data.duration);\n\n for (let dataCntr = data.keys.length; --dataCntr >= 0;)\n {\n const key = data.keys[dataCntr];\n data.newData[key] = data.interpolate(data.initial[key], data.destination[key], easedTime);\n }\n\n data.position.set(data.newData);\n }\n\n globalThis.requestAnimationFrame(AnimationManager.animate);\n }\n\n /**\n * Cancels all animations for given TJSPosition instance.\n *\n * @param {import('../').TJSPosition} position - TJSPosition instance.\n */\n static cancel(position)\n {\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n if (data.position === position)\n {\n AnimationManager.activeList.splice(cntr, 1);\n data.cancelled = true;\n data.cleanup(data);\n }\n }\n\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n if (data.position === position)\n {\n AnimationManager.newList.splice(cntr, 1);\n data.cancelled = true;\n data.cleanup(data);\n }\n }\n }\n\n /**\n * Cancels all active and delayed animations.\n */\n static cancelAll()\n {\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n data.cancelled = true;\n data.cleanup(data);\n }\n\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n data.cancelled = true;\n data.cleanup(data);\n }\n\n AnimationManager.activeList.length = 0;\n AnimationManager.newList.length = 0;\n }\n\n /**\n * Gets all {@link AnimationControl} instances for a given TJSPosition instance.\n *\n * @param {import('../index.js').TJSPosition} position - TJSPosition instance.\n *\n * @returns {import('#runtime/util/animate').TJSBasicAnimation[]} All scheduled AnimationControl instances for the\n * given TJSPosition instance.\n */\n static getScheduled(position)\n {\n const results = [];\n\n for (let cntr = AnimationManager.activeList.length; --cntr >= 0;)\n {\n const data = AnimationManager.activeList[cntr];\n if (data.position === position)\n {\n results.push(data.control);\n }\n }\n\n for (let cntr = AnimationManager.newList.length; --cntr >= 0;)\n {\n const data = AnimationManager.newList[cntr];\n if (data.position === position)\n {\n results.push(data.control);\n }\n }\n\n return results;\n }\n}\n\n// Start animation manager immediately. It constantly is running in background.\nAnimationManager.animate();\n\n/**\n * Stores the TJSPositionData properties that can be animated.\n *\n * @type {Set}\n */\nconst animateKeys = new Set([\n // Main keys\n 'left', 'top', 'maxWidth', 'maxHeight', 'minWidth', 'minHeight', 'width', 'height',\n 'rotateX', 'rotateY', 'rotateZ', 'scale', 'translateX', 'translateY', 'translateZ', 'zIndex',\n\n // Aliases\n 'rotation'\n]);\n\n/**\n * Defines the keys of TJSPositionData that are transform keys.\n *\n * @type {string[]}\n */\nconst transformKeys = ['rotateX', 'rotateY', 'rotateZ', 'scale', 'translateX', 'translateY', 'translateZ'];\n\nObject.freeze(transformKeys);\n\n/**\n * Parses a relative value string in the form of '+=', '-=', or '*=' and float / numeric value. IE '+=0.2'.\n *\n * @type {RegExp}\n */\nconst relativeRegex = /^([-+*])=(-?[\\d]*\\.?[\\d]+)$/;\n\n/**\n * Provides numeric defaults for all parameters. This is used by {@link TJSPosition.get} to optionally\n * provide numeric defaults.\n *\n * @type {{rotation: number, scale: number, minWidth: null, minHeight: null, translateZ: number, top: number, left: number, maxHeight: null, translateY: number, translateX: number, width: number, transformOrigin: null, rotateX: number, rotateY: number, height: number, maxWidth: null, zIndex: null, rotateZ: number}}\n */\nconst numericDefaults = {\n // Other keys\n height: 0,\n left: 0,\n maxHeight: null,\n maxWidth: null,\n minHeight: null,\n minWidth: null,\n top: 0,\n transformOrigin: null,\n width: 0,\n zIndex: null,\n\n rotateX: 0,\n rotateY: 0,\n rotateZ: 0,\n scale: 1,\n translateX: 0,\n translateY: 0,\n translateZ: 0,\n\n rotation: 0\n};\n\nObject.freeze(numericDefaults);\n\n/**\n * Sets numeric defaults for a {@link TJSPositionData} like object.\n *\n * @param {object} data - A TJSPositionData like object.\n */\nfunction setNumericDefaults(data)\n{\n // Transform keys\n if (data.rotateX === null) { data.rotateX = 0; }\n if (data.rotateY === null) { data.rotateY = 0; }\n if (data.rotateZ === null) { data.rotateZ = 0; }\n if (data.translateX === null) { data.translateX = 0; }\n if (data.translateY === null) { data.translateY = 0; }\n if (data.translateZ === null) { data.translateZ = 0; }\n if (data.scale === null) { data.scale = 1; }\n\n // Aliases\n if (data.rotation === null) { data.rotation = 0; }\n}\n\n/**\n * Defines bitwise keys for transforms used in {@link TJSTransforms.getMat4}.\n *\n * @type {object}\n */\nconst transformKeysBitwise = {\n rotateX: 1,\n rotateY: 2,\n rotateZ: 4,\n scale: 8,\n translateX: 16,\n translateY: 32,\n translateZ: 64\n};\n\nObject.freeze(transformKeysBitwise);\n\n/**\n * Defines the default transform origin.\n *\n * @type {string}\n */\nconst transformOriginDefault = 'top left';\n\n/**\n * Defines the valid transform origins.\n *\n * @type {string[]}\n */\nconst transformOrigins = ['top left', 'top center', 'top right', 'center left', 'center', 'center right', 'bottom left',\n 'bottom center', 'bottom right'];\n\nObject.freeze(transformOrigins);\n\n/**\n * Converts any relative string values for animatable keys to actual updates performed against current data.\n *\n * @param {import('./').TJSPositionDataExtended} positionData - position data.\n *\n * @param {import('./').TJSPosition | import('./').TJSPositionData} position - The source position instance.\n */\nfunction convertRelative(positionData, position)\n{\n for (const key in positionData)\n {\n // Key is animatable / numeric.\n if (animateKeys.has(key))\n {\n const value = positionData[key];\n\n if (typeof value !== 'string') { continue; }\n\n // Ignore 'auto' and 'inherit' string values.\n if (value === 'auto' || value === 'inherit') { continue; }\n\n const regexResults = relativeRegex.exec(value);\n\n if (!regexResults)\n {\n throw new Error(\n `convertRelative error: malformed relative key (${key}) with value (${value})`);\n }\n\n const current = position[key];\n\n switch (regexResults[1])\n {\n case '-':\n positionData[key] = current - parseFloat(regexResults[2]);\n break;\n\n case '+':\n positionData[key] = current + parseFloat(regexResults[2]);\n break;\n\n case '*':\n positionData[key] = current * parseFloat(regexResults[2]);\n break;\n }\n }\n }\n}\n\nclass AnimationAPI\n{\n /** @type {import('../').TJSPositionData} */\n #data;\n\n /** @type {import('../').TJSPosition} */\n #position;\n\n /**\n * Tracks the number of animation control instances that are active.\n *\n * @type {number}\n */\n #instanceCount = 0;\n\n /**\n * Provides a bound function to pass as data to AnimationManager to invoke `AnimationAPI.#cleanupInstance`.\n *\n * @type {Function}\n */\n #cleanup;\n\n /**\n * @param {import('../index.js').TJSPosition} position -\n *\n * @param {import('../index.js').TJSPositionData} data -\n */\n constructor(position, data)\n {\n this.#position = position;\n this.#data = data;\n\n this.#cleanup = this.#cleanupInstance.bind(this);\n }\n\n /**\n * Returns whether there are scheduled animations whether active or delayed for this TJSPosition.\n *\n * @returns {boolean} Are there active animation instances.\n */\n get isScheduled()\n {\n return this.#instanceCount > 0;\n }\n\n /**\n * Adds / schedules an animation w/ the AnimationManager. This contains the final steps common to all tweens.\n *\n * @param {object} initial -\n *\n * @param {object} destination -\n *\n * @param {number} duration -\n *\n * @param {HTMLElement} el -\n *\n * @param {number} delay -\n *\n * @param {Function} ease -\n *\n * @param {Function} interpolate -\n *\n * @returns {import('#runtime/util/animate').TJSBasicAnimation} The associated animation control.\n */\n #addAnimation(initial, destination, duration, el, delay, ease, interpolate)\n {\n // Set initial data for transform values that are often null by default.\n setNumericDefaults(initial);\n setNumericDefaults(destination);\n\n // Reject all initial data that is not a number.\n for (const key in initial)\n {\n if (!Number.isFinite(initial[key])) { delete initial[key]; }\n }\n\n const keys = Object.keys(initial);\n const newData = Object.assign({ immediateElementUpdate: true }, initial);\n\n // Nothing to animate, so return now.\n if (keys.length === 0) { return AnimationControl.voidControl; }\n\n const animationData = {\n active: true,\n cleanup: this.#cleanup,\n cancelled: false,\n control: void 0,\n current: 0,\n destination,\n duration: duration * 1000, // Internally the AnimationManager works in ms.\n ease,\n el,\n finished: false,\n initial,\n interpolate,\n keys,\n newData,\n position: this.#position,\n resolve: void 0,\n start: void 0\n };\n\n if (delay > 0)\n {\n animationData.active = false;\n\n // Delay w/ setTimeout and schedule w/ AnimationManager if not already canceled\n setTimeout(() =>\n {\n if (!animationData.cancelled)\n {\n animationData.active = true;\n\n const now = performance.now();\n\n // Offset start time by delta between last rAF time. This allows a delayed tween to start from the\n // precise delayed time.\n animationData.start = now + (AnimationManager.current - now);\n }\n }, delay * 1000);\n }\n\n // Schedule immediately w/ AnimationManager\n this.#instanceCount++;\n AnimationManager.add(animationData);\n\n // Create animation control\n return new AnimationControl(animationData, true);\n }\n\n /**\n * Cancels all animation instances for this TJSPosition instance.\n */\n cancel()\n {\n AnimationManager.cancel(this.#position);\n }\n\n /**\n * Cleans up an animation instance.\n *\n * @param {object} data - Animation data for an animation instance.\n */\n #cleanupInstance(data)\n {\n this.#instanceCount--;\n\n data.active = false;\n data.finished = true;\n\n if (typeof data.resolve === 'function') { data.resolve(data.cancelled); }\n }\n\n /**\n * Returns all currently scheduled AnimationControl instances for this TJSPosition instance.\n *\n * @returns {import('#runtime/util/animate').TJSBasicAnimation[]} All currently scheduled animation controls for\n * this TJSPosition instance.\n */\n getScheduled()\n {\n return AnimationManager.getScheduled(this.#position);\n }\n\n /**\n * Provides a tween from given position data to the current position.\n *\n * @param {import('../index.js').TJSPositionDataExtended} fromData - The starting position.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.delay=0] - Delay in seconds before animation starts.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {import('#runtime/util/animate').TJSBasicAnimation} A control object that can cancel animation and\n * provides a `finished` Promise.\n */\n from(fromData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isObject(fromData))\n {\n throw new TypeError(`AnimationAPI.from error: 'fromData' is not an object.`);\n }\n\n const position = this.#position;\n const parent = position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return AnimationControl.voidControl;\n }\n\n // Cache any target element allowing AnimationManager to stop animation if it becomes disconnected from DOM.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n if (!Number.isFinite(delay) || delay < 0)\n {\n throw new TypeError(`AnimationAPI.from error: 'delay' is not a positive number.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.from error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.from error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.from error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key in fromData)\n {\n if (data[key] !== void 0 && fromData[key] !== data[key])\n {\n initial[key] = fromData[key];\n destination[key] = data[key];\n }\n }\n\n convertRelative(initial, data);\n\n return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate);\n }\n\n /**\n * Provides a tween from given position data to the current position.\n *\n * @param {import('../index.js').TJSPositionDataExtended} fromData - The starting position.\n *\n * @param {import('../index.js').TJSPositionDataExtended} toData - The ending position.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.delay=0] - Delay in seconds before animation starts.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {import('#runtime/util/animate').TJSBasicAnimation} A control object that can cancel animation and\n * provides a `finished` Promise.\n */\n fromTo(fromData, toData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isObject(fromData))\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'fromData' is not an object.`);\n }\n\n if (!isObject(toData))\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'toData' is not an object.`);\n }\n\n const parent = this.#position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return AnimationControl.voidControl;\n }\n\n // Cache any target element allowing AnimationManager to stop animation if it becomes disconnected from DOM.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n if (!Number.isFinite(delay) || delay < 0)\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'delay' is not a positive number.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.fromTo error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key in fromData)\n {\n if (toData[key] === void 0)\n {\n console.warn(\n `AnimationAPI.fromTo warning: key ('${key}') from 'fromData' missing in 'toData'; skipping this key.`);\n continue;\n }\n\n if (data[key] !== void 0)\n {\n initial[key] = fromData[key];\n destination[key] = toData[key];\n }\n }\n\n convertRelative(initial, data);\n convertRelative(destination, data);\n\n return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate);\n }\n\n /**\n * Provides a tween to given position data from the current position.\n *\n * @param {import('../index.js').TJSPositionDataExtended} toData - The destination position.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.delay=0] - Delay in seconds before animation starts.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {import('#runtime/util/animate').TJSBasicAnimation} A control object that can cancel animation and\n * provides a `finished` Promise.\n */\n to(toData, { delay = 0, duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isObject(toData))\n {\n throw new TypeError(`AnimationAPI.to error: 'toData' is not an object.`);\n }\n\n const parent = this.#position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return AnimationControl.voidControl;\n }\n\n // Cache any target element allowing AnimationManager to stop animation if it becomes disconnected from DOM.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n if (!Number.isFinite(delay) || delay < 0)\n {\n throw new TypeError(`AnimationAPI.to error: 'delay' is not a positive number.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.to error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.to error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.to error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key in toData)\n {\n if (data[key] !== void 0 && toData[key] !== data[key])\n {\n destination[key] = toData[key];\n initial[key] = data[key];\n }\n }\n\n convertRelative(destination, data);\n\n return this.#addAnimation(initial, destination, duration, el, delay, ease, interpolate);\n }\n\n /**\n * Returns a function that provides an optimized way to constantly update a to-tween.\n *\n * @param {Iterable} keys - The keys for quickTo.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.duration=1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=cubicOut] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {import('../index.js').quickToCallback} quick-to tween function.\n */\n quickTo(keys, { duration = 1, ease = cubicOut, interpolate = lerp } = {})\n {\n if (!isIterable(keys))\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'keys' is not an iterable list.`);\n }\n\n const parent = this.#position.parent;\n\n // Early out if the application is not positionable.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n throw new Error(`AnimationAPI.quickTo error: 'parent' is not positionable.`);\n }\n\n if (!Number.isFinite(duration) || duration < 0)\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'duration' is not a positive number.`);\n }\n\n if (typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'ease' is not a function.`);\n }\n\n if (typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo error: 'interpolate' is not a function.`);\n }\n\n const initial = {};\n const destination = {};\n\n const data = this.#data;\n\n // Set initial data if the key / data is defined and the end position is not equal to current data.\n for (const key of keys)\n {\n if (typeof key !== 'string')\n {\n throw new TypeError(`AnimationAPI.quickTo error: key is not a string.`);\n }\n\n if (!animateKeys.has(key))\n {\n throw new Error(`AnimationAPI.quickTo error: key ('${key}') is not animatable.`);\n }\n\n if (data[key] !== void 0)\n {\n destination[key] = data[key];\n initial[key] = data[key];\n }\n }\n\n const keysArray = [...keys];\n\n Object.freeze(keysArray);\n\n const newData = Object.assign({ immediateElementUpdate: true }, initial);\n\n const animationData = {\n active: true,\n cleanup: this.#cleanup,\n cancelled: false,\n control: void 0,\n current: 0,\n destination,\n duration: duration * 1000, // Internally the AnimationManager works in ms.\n ease,\n el: void 0,\n finished: true, // Note: start in finished state to add to AnimationManager on first callback.\n initial,\n interpolate,\n keys,\n newData,\n position: this.#position,\n resolve: void 0,\n start: void 0\n };\n\n const quickToCB = (...args) =>\n {\n const argsLength = args.length;\n\n if (argsLength === 0) { return; }\n\n for (let cntr = keysArray.length; --cntr >= 0;)\n {\n const key = keysArray[cntr];\n if (data[key] !== void 0) { initial[key] = data[key]; }\n }\n\n // Handle case where the first arg is an object. Update all quickTo keys from data contained in the object.\n if (isObject(args[0]))\n {\n const objData = args[0];\n\n for (const key in objData)\n {\n if (destination[key] !== void 0) { destination[key] = objData[key]; }\n }\n }\n else // Assign each variable argument to the key specified in the initial `keys` array above.\n {\n for (let cntr = 0; cntr < argsLength && cntr < keysArray.length; cntr++)\n {\n const key = keysArray[cntr];\n if (destination[key] !== void 0) { destination[key] = args[cntr]; }\n }\n }\n\n convertRelative(destination, data);\n\n // Set initial data for transform values that are often null by default.\n setNumericDefaults(initial);\n setNumericDefaults(destination);\n\n // Set target element to animation data to track if it is removed from the DOM hence ending the animation.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n animationData.el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n // Reschedule the quickTo animation with AnimationManager as it is finished.\n if (animationData.finished)\n {\n animationData.finished = false;\n animationData.active = true;\n animationData.current = 0;\n\n this.#instanceCount++;\n AnimationManager.add(animationData);\n }\n else // QuickTo animation is currently scheduled w/ AnimationManager so reset start and current time.\n {\n const now = performance.now();\n\n // Offset start time by delta between last rAF time. This allows a delayed tween to start from the\n // precise delayed time.\n animationData.start = now + (AnimationManager.current - now);\n animationData.current = 0;\n }\n };\n\n quickToCB.keys = keysArray;\n\n /**\n * Sets options of quickTo tween.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.duration] - Duration in seconds.\n *\n * @param {Function} [opts.ease] - Easing function.\n *\n * @param {Function} [opts.interpolate] - Interpolation function.\n *\n * @returns {import('../').quickToCallback} The quickTo callback.\n */\n quickToCB.options = ({ duration, ease, interpolate } = {}) => // eslint-disable-line no-shadow\n {\n if (duration !== void 0 && (!Number.isFinite(duration) || duration < 0))\n {\n throw new TypeError(`AnimationAPI.quickTo.options error: 'duration' is not a positive number.`);\n }\n\n if (ease !== void 0 && typeof ease !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo.options error: 'ease' is not a function.`);\n }\n\n if (interpolate !== void 0 && typeof interpolate !== 'function')\n {\n throw new TypeError(`AnimationAPI.quickTo.options error: 'interpolate' is not a function.`);\n }\n\n if (duration >= 0) { animationData.duration = duration * 1000; }\n if (ease) { animationData.ease = ease; }\n if (interpolate) { animationData.interpolate = interpolate; }\n\n return quickToCB;\n };\n\n return quickToCB;\n }\n}\n\n/**\n * Provides a TJSBasicAnimation implementation for a TJSPosition animation for a group of TJSPosition instances.\n */\nclass AnimationGroupControl\n{\n /** @type {import('./AnimationControl').AnimationControl[]} */\n #animationControls;\n\n /** @type {Promise[]>} */\n #finishedPromise;\n\n /**\n * Defines a static empty / void animation control.\n *\n * @type {AnimationGroupControl}\n */\n static #voidControl = new AnimationGroupControl(null);\n\n /**\n * Provides a static void / undefined AnimationGroupControl that is automatically resolved.\n *\n * @returns {AnimationGroupControl} Void AnimationGroupControl\n */\n static get voidControl() { return this.#voidControl; }\n\n /**\n * @param {import('./AnimationControl').AnimationControl[]} animationControls - An array of AnimationControl\n * instances.\n */\n constructor(animationControls)\n {\n this.#animationControls = animationControls;\n }\n\n /**\n * Get a promise that resolves when all animations are finished.\n *\n * @returns {Promise[]>|Promise} Finished Promise for all animations.\n */\n get finished()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return Promise.resolve(); }\n\n if (!(this.#finishedPromise instanceof Promise))\n {\n const promises = [];\n for (let cntr = animationControls.length; --cntr >= 0;)\n {\n promises.push(animationControls[cntr].finished);\n }\n\n this.#finishedPromise = Promise.all(promises);\n }\n\n return this.#finishedPromise;\n }\n\n /**\n * Returns whether there are active animation instances for this group.\n *\n * Note: a delayed animation may not be started / active yet. Use {@link AnimationGroupControl.isFinished} to\n * determine if all animations in the group are finished.\n *\n * @returns {boolean} Are there active animation instances.\n */\n get isActive()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return false; }\n\n for (let cntr = animationControls.length; --cntr >= 0;)\n {\n if (animationControls[cntr].isActive) { return true; }\n }\n\n return false;\n }\n\n /**\n * Returns whether all animations in the group are finished.\n *\n * @returns {boolean} Are all animation instances finished.\n */\n get isFinished()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return true; }\n\n for (let cntr = animationControls.length; --cntr >= 0;)\n {\n if (!animationControls[cntr].isFinished) { return false; }\n }\n\n return false;\n }\n\n /**\n * Cancels the all animations.\n */\n cancel()\n {\n const animationControls = this.#animationControls;\n\n if (animationControls === null || animationControls === void 0) { return; }\n\n for (let cntr = this.#animationControls.length; --cntr >= 0;)\n {\n this.#animationControls[cntr].cancel();\n }\n }\n}\n\n/**\n * Provides a public API for grouping multiple {@link TJSPosition} animations together with the\n * AnimationManager.\n *\n * Note: To remove cyclic dependencies as this class provides the TJSPosition static / group Animation API `instanceof`\n * checks are not done against TJSPosition. Instead, a check for the animate property being an instanceof\n * {@link AnimationAPI} is performed in {@link AnimationGroupAPI.#isPosition}.\n *\n * @see AnimationAPI\n */\nclass AnimationGroupAPI\n{\n /**\n * Checks of the given object is a TJSPosition instance by checking for AnimationAPI.\n *\n * @param {*} object - Any data.\n *\n * @returns {boolean} Is TJSPosition.\n */\n static #isPosition(object)\n {\n return isObject(object) && object.animate instanceof AnimationAPI;\n }\n\n /**\n * Cancels any animation for given TJSPosition data.\n *\n * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position -\n */\n static cancel(position)\n {\n if (isIterable(position))\n {\n let index = -1;\n\n for (const entry of position)\n {\n index++;\n\n const actualPosition = this.#isPosition(entry) ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.cancel warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n AnimationManager.cancel(actualPosition);\n }\n }\n else\n {\n const actualPosition = this.#isPosition(position) ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.cancel warning: No Position instance found.`);\n return;\n }\n\n AnimationManager.cancel(actualPosition);\n }\n }\n\n /**\n * Cancels all TJSPosition animation.\n */\n static cancelAll() { AnimationManager.cancelAll(); }\n\n /**\n * Gets all animation controls for the given position data.\n *\n * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position -\n *\n * @returns {{ position: import('../').TJSPosition, data: object | void, controls: import('./AnimationControl').AnimationControl[]}[]} Results array.\n */\n static getScheduled(position)\n {\n const results = [];\n\n if (isIterable(position))\n {\n let index = -1;\n\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.getScheduled warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n const controls = AnimationManager.getScheduled(actualPosition);\n\n results.push({ position: actualPosition, data: isPosition ? void 0 : entry, controls });\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.getScheduled warning: No Position instance found.`);\n return results;\n }\n\n const controls = AnimationManager.getScheduled(actualPosition);\n\n results.push({ position: actualPosition, data: isPosition ? void 0 : position, controls });\n }\n\n return results;\n }\n\n /**\n * Provides the `from` animation tween for one or more TJSPosition instances as a group.\n *\n * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position -\n *\n * @param {object|Function} fromData -\n *\n * @param {object|Function} options -\n *\n * @returns {import('#runtime/util/animate').TJSBasicAnimation} Basic animation control.\n */\n static from(position, fromData, options)\n {\n if (!isObject(fromData) && typeof fromData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.from error: 'fromData' is not an object or function.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.from error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {import('./AnimationControl').AnimationControl[]}\n */\n const animationControls = [];\n\n let index = -1;\n let callbackOptions;\n\n const hasDataCallback = typeof fromData === 'function';\n const hasOptionCallback = typeof options === 'function';\n const hasCallback = hasDataCallback || hasOptionCallback;\n\n if (hasCallback) { callbackOptions = { index, position: void 0, data: void 0 }; }\n\n let actualFromData = fromData;\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.from warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n }\n\n if (hasDataCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualFromData === null || actualFromData === void 0) { continue; }\n\n if (!isObject(actualFromData))\n {\n throw new TypeError(`AnimationGroupAPI.from error: fromData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (!isObject(actualOptions))\n {\n throw new TypeError(`AnimationGroupAPI.from error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.from(actualFromData, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.from warning: No Position instance found.`);\n return AnimationGroupControl.voidControl;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n }\n\n if (hasDataCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n if (!isObject(actualFromData))\n {\n throw new TypeError(\n `AnimationGroupAPI.from error: fromData callback function failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (!isObject(actualOptions))\n {\n throw new TypeError(\n `AnimationGroupAPI.from error: options callback function failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.from(actualFromData, actualOptions));\n }\n\n return new AnimationGroupControl(animationControls);\n }\n\n /**\n * Provides the `fromTo` animation tween for one or more TJSPosition instances as a group.\n *\n * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position -\n *\n * @param {object|Function} fromData -\n *\n * @param {object|Function} toData -\n *\n * @param {object|Function} options -\n *\n * @returns {import('#runtime/util/animate').TJSBasicAnimation} Basic animation control.\n */\n static fromTo(position, fromData, toData, options)\n {\n if (!isObject(fromData) && typeof fromData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: 'fromData' is not an object or function.`);\n }\n\n if (!isObject(toData) && typeof toData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: 'toData' is not an object or function.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {import('./AnimationControl').AnimationControl[]}\n */\n const animationControls = [];\n\n let index = -1;\n let callbackOptions;\n\n const hasFromCallback = typeof fromData === 'function';\n const hasToCallback = typeof toData === 'function';\n const hasOptionCallback = typeof options === 'function';\n const hasCallback = hasFromCallback || hasToCallback || hasOptionCallback;\n\n if (hasCallback) { callbackOptions = { index, position: void 0, data: void 0 }; }\n\n let actualFromData = fromData;\n let actualToData = toData;\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.fromTo warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n }\n\n if (hasFromCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualFromData === null || actualFromData === void 0) { continue; }\n\n if (!isObject(actualFromData))\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: fromData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasToCallback)\n {\n actualToData = toData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualToData === null || actualToData === void 0) { continue; }\n\n if (!isObject(actualToData))\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: toData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (!isObject(actualOptions))\n {\n throw new TypeError(`AnimationGroupAPI.fromTo error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.fromTo(actualFromData, actualToData, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.fromTo warning: No Position instance found.`);\n return AnimationGroupControl.voidControl;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n }\n\n if (hasFromCallback)\n {\n actualFromData = fromData(callbackOptions);\n\n if (!isObject(actualFromData))\n {\n throw new TypeError(\n `AnimationGroupAPI.fromTo error: fromData callback function failed to return an object.`);\n }\n }\n\n if (hasToCallback)\n {\n actualToData = toData(callbackOptions);\n\n if (!isObject(actualToData))\n {\n throw new TypeError(\n `AnimationGroupAPI.fromTo error: toData callback function failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (!isObject(actualOptions))\n {\n throw new TypeError(\n `AnimationGroupAPI.fromTo error: options callback function failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.fromTo(actualFromData, actualToData, actualOptions));\n }\n\n return new AnimationGroupControl(animationControls);\n }\n\n /**\n * Provides the `to` animation tween for one or more TJSPosition instances as a group.\n *\n * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position -\n *\n * @param {object|Function} toData -\n *\n * @param {object|Function} options -\n *\n * @returns {import('#runtime/util/animate').TJSBasicAnimation} Basic animation control.\n */\n static to(position, toData, options)\n {\n if (!isObject(toData) && typeof toData !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.to error: 'toData' is not an object or function.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.to error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {import('./AnimationControl').AnimationControl[]}\n */\n const animationControls = [];\n\n let index = -1;\n let callbackOptions;\n\n const hasDataCallback = typeof toData === 'function';\n const hasOptionCallback = typeof options === 'function';\n const hasCallback = hasDataCallback || hasOptionCallback;\n\n if (hasCallback) { callbackOptions = { index, position: void 0, data: void 0 }; }\n\n let actualToData = toData;\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.to warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n }\n\n if (hasDataCallback)\n {\n actualToData = toData(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualToData === null || actualToData === void 0) { continue; }\n\n if (!isObject(actualToData))\n {\n throw new TypeError(`AnimationGroupAPI.to error: toData callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (!isObject(actualOptions))\n {\n throw new TypeError(`AnimationGroupAPI.to error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.to(actualToData, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.to warning: No Position instance found.`);\n return AnimationGroupControl.voidControl;\n }\n\n if (hasCallback)\n {\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n }\n\n if (hasDataCallback)\n {\n actualToData = toData(callbackOptions);\n\n if (!isObject(actualToData))\n {\n throw new TypeError(\n `AnimationGroupAPI.to error: toData callback function failed to return an object.`);\n }\n }\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (!isObject(actualOptions))\n {\n throw new TypeError(\n `AnimationGroupAPI.to error: options callback function failed to return an object.`);\n }\n }\n\n animationControls.push(actualPosition.animate.to(actualToData, actualOptions));\n }\n\n return new AnimationGroupControl(animationControls);\n }\n\n /**\n * Provides the `to` animation tween for one or more TJSPosition instances as a group.\n *\n * @param {import('../').TJSPosition | {position: import('../').TJSPosition} | Iterable | Iterable<{position: import('../').TJSPosition}>} position -\n *\n * @param {Iterable} keys -\n *\n * @param {object|Function} options -\n *\n * @returns {import('../').quickToCallback} Basic animation control.\n */\n static quickTo(position, keys, options)\n {\n if (!isIterable(keys))\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: 'keys' is not an iterable list.`);\n }\n\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: 'options' is not an object or function.`);\n }\n\n /**\n * @type {import('../').quickToCallback[]}\n */\n const quickToCallbacks = [];\n\n let index = -1;\n\n const hasOptionCallback = typeof options === 'function';\n\n const callbackOptions = { index, position: void 0, data: void 0 };\n\n let actualOptions = options;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.quickTo warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (!isObject(actualOptions))\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n }\n\n quickToCallbacks.push(actualPosition.animate.quickTo(keys, actualOptions));\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.quickTo warning: No Position instance found.`);\n return () => null;\n }\n\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n\n if (hasOptionCallback)\n {\n actualOptions = options(callbackOptions);\n\n if (!isObject(actualOptions))\n {\n throw new TypeError(\n `AnimationGroupAPI.quickTo error: options callback function failed to return an object.`);\n }\n }\n\n quickToCallbacks.push(actualPosition.animate.quickTo(keys, actualOptions));\n }\n\n const keysArray = [...keys];\n\n Object.freeze(keysArray);\n\n const quickToCB = (...args) =>\n {\n const argsLength = args.length;\n\n if (argsLength === 0) { return; }\n\n if (typeof args[0] === 'function')\n {\n const dataCallback = args[0];\n\n index = -1;\n let cntr = 0;\n\n if (isIterable(position))\n {\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition)) { continue; }\n\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n\n const toData = dataCallback(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (toData === null || toData === void 0) { continue; }\n\n /**\n * @type {boolean}\n */\n const toDataIterable = isIterable(toData);\n\n if (!Number.isFinite(toData) && !toDataIterable && !isObject(toData))\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: toData callback function iteration(${\n index}) failed to return a finite number, iterable list, or object.`);\n }\n\n if (toDataIterable)\n {\n quickToCallbacks[cntr++](...toData);\n }\n else\n {\n quickToCallbacks[cntr++](toData);\n }\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition)) { return; }\n\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n\n const toData = dataCallback(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (toData === null || toData === void 0) { return; }\n\n const toDataIterable = isIterable(toData);\n\n if (!Number.isFinite(toData) && !toDataIterable && !isObject(toData))\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: toData callback function iteration(${\n index}) failed to return a finite number, iterable list, or object.`);\n }\n\n if (toDataIterable)\n {\n quickToCallbacks[cntr++](...toData);\n }\n else\n {\n quickToCallbacks[cntr++](toData);\n }\n }\n }\n else\n {\n for (let cntr = quickToCallbacks.length; --cntr >= 0;)\n {\n quickToCallbacks[cntr](...args);\n }\n }\n };\n\n quickToCB.keys = keysArray;\n\n /**\n * Sets options of quickTo tween.\n *\n * @param {object|Function} [options] - Optional parameters.\n *\n * @param {number} [options.duration] - Duration in seconds.\n *\n * @param {Function} [options.ease] - Easing function.\n *\n * @param {Function} [options.interpolate] - Interpolation function.\n *\n * @returns {import('../').quickToCallback} The quickTo callback.\n */\n quickToCB.options = (options) => // eslint-disable-line no-shadow\n {\n if (options !== void 0 && !isObject(options) && typeof options !== 'function')\n {\n throw new TypeError(`AnimationGroupAPI.quickTo error: 'options' is not an object or function.`);\n }\n\n // Set options object for each quickTo callback.\n if (isObject(options))\n {\n for (let cntr = quickToCallbacks.length; --cntr >= 0;) { quickToCallbacks[cntr].options(options); }\n }\n else if (typeof options === 'function')\n {\n if (isIterable(position))\n {\n index = -1;\n let cntr = 0;\n\n for (const entry of position)\n {\n index++;\n\n const isPosition = this.#isPosition(entry);\n const actualPosition = isPosition ? entry : entry.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(\n `AnimationGroupAPI.quickTo.options warning: No Position instance found at index: ${index}.`);\n continue;\n }\n\n callbackOptions.index = index;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : entry;\n\n actualOptions = options(callbackOptions);\n\n // Returned data from callback is null / undefined, so skip this position instance.\n if (actualOptions === null || actualOptions === void 0) { continue; }\n\n if (!isObject(actualOptions))\n {\n throw new TypeError(\n `AnimationGroupAPI.quickTo.options error: options callback function iteration(${\n index}) failed to return an object.`);\n }\n\n quickToCallbacks[cntr++].options(actualOptions);\n }\n }\n else\n {\n const isPosition = this.#isPosition(position);\n const actualPosition = isPosition ? position : position.position;\n\n if (!this.#isPosition(actualPosition))\n {\n console.warn(`AnimationGroupAPI.quickTo.options warning: No Position instance found.`);\n return quickToCB;\n }\n\n callbackOptions.index = 0;\n callbackOptions.position = position;\n callbackOptions.data = isPosition ? void 0 : position;\n\n actualOptions = options(callbackOptions);\n\n if (!isObject(actualOptions))\n {\n throw new TypeError(\n `AnimationGroupAPI.quickTo error: options callback function failed to return an object.`);\n }\n\n quickToCallbacks[0].options(actualOptions);\n }\n }\n\n return quickToCB;\n };\n\n return quickToCB;\n }\n}\n\n/**\n * Provides a {@link TJSPositionInitialHelper} implementation to center to element being positioned.\n */\nclass Centered\n{\n /**\n * @type {HTMLElement}\n */\n #element;\n\n /**\n * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not\n * performance oriented. If manually set this height is used instead of `offsetHeight`.\n *\n * @type {number}\n */\n #height;\n\n /**\n * Set from an optional value in the constructor to lock accessors preventing modification.\n */\n #lock;\n\n /**\n * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not\n * performance oriented. If manually set this width is used instead of `offsetWidth`.\n *\n * @type {number}\n */\n #width;\n\n /**\n * @param {object} [options] - Initial options.\n *\n * @param {HTMLElement} [options.element] - Target element.\n *\n * @param {boolean} [options.lock=false] - Lock parameters from being set.\n *\n * @param {number} [options.width] - Manual width.\n *\n * @param {number} [options.height] - Manual height.\n */\n constructor({ element, lock = false, width, height } = {})\n {\n this.element = element;\n this.width = width;\n this.height = height;\n\n this.#lock = typeof lock === 'boolean' ? lock : false;\n }\n\n /**\n * @returns {HTMLElement|undefined|null} Target element.\n */\n get element() { return this.#element; }\n\n /**\n * @returns {number} Get manual height.\n */\n get height() { return this.#height; }\n\n /**\n * @returns {number} Get manual width.\n */\n get width() { return this.#width; }\n\n /**\n * @param {HTMLElement|undefined|null} element - Set target element.\n */\n set element(element)\n {\n if (this.#lock) { return; }\n\n if (element === void 0 || element === null || element instanceof HTMLElement)\n {\n this.#element = element;\n }\n else\n {\n throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`);\n }\n }\n\n /**\n * @param {number} height - Set manual height.\n */\n set height(height)\n {\n if (this.#lock) { return; }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n /**\n * @param {number} width - Set manual width.\n */\n set width(width)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n }\n\n /**\n * Set manual width & height.\n *\n * @param {number} width - New manual width.\n *\n * @param {number} height - New manual height.\n */\n setDimension(width, height)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n /**\n * Get the left constraint based on any manual target values or the browser inner width.\n *\n * @param {number} width - Target width.\n *\n * @returns {number} Calculated left constraint.\n */\n getLeft(width)\n {\n // Determine containing bounds from manual values; or any element; lastly the browser width / height.\n const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth;\n\n return (boundsWidth - width) / 2;\n }\n\n /**\n * Get the top constraint based on any manual target values or the browser inner height.\n *\n * @param {number} height - Target height.\n *\n * @returns {number} Calculated top constraint.\n */\n getTop(height)\n {\n const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight;\n\n return (boundsHeight - height) / 2;\n }\n}\n\nclass PositionChangeSet\n{\n constructor()\n {\n this.left = false;\n this.top = false;\n this.width = false;\n this.height = false;\n this.maxHeight = false;\n this.maxWidth = false;\n this.minHeight = false;\n this.minWidth = false;\n this.zIndex = false;\n this.transform = false;\n this.transformOrigin = false;\n }\n\n hasChange()\n {\n return this.left || this.top || this.width || this.height || this.maxHeight || this.maxWidth || this.minHeight ||\n this.minWidth || this.zIndex || this.transform || this.transformOrigin;\n }\n\n set(value)\n {\n this.left = value;\n this.top = value;\n this.width = value;\n this.height = value;\n this.maxHeight = value;\n this.maxWidth = value;\n this.minHeight = value;\n this.minWidth = value;\n this.zIndex = value;\n this.transform = value;\n this.transformOrigin = value;\n }\n}\n\n/**\n * Defines stored positional data.\n */\nclass TJSPositionData\n{\n constructor({ height = null, left = null, maxHeight = null, maxWidth = null, minHeight = null, minWidth = null,\n rotateX = null, rotateY = null, rotateZ = null, scale = null, translateX = null, translateY = null,\n translateZ = null, top = null, transformOrigin = null, width = null, zIndex = null } = {})\n {\n /**\n * @type {number|'auto'|'inherit'|null}\n */\n this.height = height;\n\n /**\n * @type {number|null}\n */\n this.left = left;\n\n /**\n * @type {number|null}\n */\n this.maxHeight = maxHeight;\n\n /**\n * @type {number|null}\n */\n this.maxWidth = maxWidth;\n\n /**\n * @type {number|null}\n */\n this.minHeight = minHeight;\n\n /**\n * @type {number|null}\n */\n this.minWidth = minWidth;\n\n /**\n * @type {number|null}\n */\n this.rotateX = rotateX;\n\n /**\n * @type {number|null}\n */\n this.rotateY = rotateY;\n\n /**\n * @type {number|null}\n */\n this.rotateZ = rotateZ;\n\n /**\n * @type {number|null}\n */\n this.scale = scale;\n\n /**\n * @type {number|null}\n */\n this.top = top;\n\n /**\n * @type {string|null}\n */\n this.transformOrigin = transformOrigin;\n\n /**\n * @type {number|null}\n */\n this.translateX = translateX;\n\n /**\n * @type {number|null}\n */\n this.translateY = translateY;\n\n /**\n * @type {number|null}\n */\n this.translateZ = translateZ;\n\n /**\n * @type {number|'auto'|'inherit'|null}\n */\n this.width = width;\n\n /**\n * @type {number|null}\n */\n this.zIndex = zIndex;\n\n Object.seal(this);\n }\n\n /**\n * Copies given data to this instance.\n *\n * @param {TJSPositionData} data - Copy from this instance.\n *\n * @returns {TJSPositionData} This instance.\n */\n copy(data)\n {\n this.height = data.height;\n this.left = data.left;\n this.maxHeight = data.maxHeight;\n this.maxWidth = data.maxWidth;\n this.minHeight = data.minHeight;\n this.minWidth = data.minWidth;\n this.rotateX = data.rotateX;\n this.rotateY = data.rotateY;\n this.rotateZ = data.rotateZ;\n this.scale = data.scale;\n this.top = data.top;\n this.transformOrigin = data.transformOrigin;\n this.translateX = data.translateX;\n this.translateY = data.translateY;\n this.translateZ = data.translateZ;\n this.width = data.width;\n this.zIndex = data.zIndex;\n\n return this;\n }\n}\n\nclass PositionStateAPI\n{\n /** @type {import('./TJSPositionData').TJSPositionData} */\n #data;\n\n /**\n * @type {Map}\n */\n #dataSaved = new Map();\n\n /** @type {import('./').TJSPosition} */\n #position;\n\n /** @type {import('./transform').TJSTransforms} */\n #transforms;\n\n constructor(position, data, transforms)\n {\n this.#position = position;\n this.#data = data;\n this.#transforms = transforms;\n }\n\n /**\n * Returns any stored save state by name.\n *\n * @param {object} options - Options\n *\n * @param {string} options.name - Saved data set name.\n *\n * @returns {import('./').TJSPositionDataExtended} The saved data set.\n */\n get({ name })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - getSave error: 'name' is not a string.`); }\n\n return this.#dataSaved.get(name);\n }\n\n /**\n * Returns any associated default data.\n *\n * @returns {import('./').TJSPositionDataExtended} Associated default data.\n */\n getDefault()\n {\n return this.#dataSaved.get('#defaultData');\n }\n\n /**\n * Removes and returns any position state by name.\n *\n * @param {object} options - Options.\n *\n * @param {string} options.name - Name to remove and retrieve.\n *\n * @returns {import('./').TJSPositionDataExtended} Saved position data.\n */\n remove({ name })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - remove: 'name' is not a string.`); }\n\n const data = this.#dataSaved.get(name);\n this.#dataSaved.delete(name);\n\n return data;\n }\n\n /**\n * Resets data to default values and invokes set.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.keepZIndex=false] - When true keeps current z-index.\n *\n * @param {boolean} [opts.invokeSet=true] - When true invokes set method.\n *\n * @returns {boolean} Operation successful.\n */\n reset({ keepZIndex = false, invokeSet = true } = {})\n {\n const defaultData = this.#dataSaved.get('#defaultData');\n\n // Quit early if there is no saved default data.\n if (!isObject(defaultData)) { return false; }\n\n // Cancel all animations for TJSPosition if there are currently any scheduled.\n if (this.#position.animate.isScheduled)\n {\n this.#position.animate.cancel();\n }\n\n const zIndex = this.#position.zIndex;\n\n const data = Object.assign({}, defaultData);\n\n if (keepZIndex) { data.zIndex = zIndex; }\n\n // Reset the transform data.\n this.#transforms.reset(data);\n\n // If current minimized invoke `maximize`.\n if (this.#position.parent?.reactive?.minimized)\n {\n this.#position.parent?.maximize?.({ animate: false, duration: 0 });\n }\n\n // Note next clock tick scheduling.\n if (invokeSet) { setTimeout(() => this.#position.set(data), 0); }\n\n return true;\n }\n\n /**\n * Restores a saved positional state returning the data. Several optional parameters are available\n * to control whether the restore action occurs silently (no store / inline styles updates), animates\n- * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to}\n * allows specification of the duration, easing, and interpolate functions along with configuring a Promise to be\n * returned if awaiting the end of the animation.\n *\n * @param {object} params - Parameters\n *\n * @param {string} params.name - Saved data set name.\n *\n * @param {boolean} [params.remove=false] - Remove data set.\n *\n * @param {Iterable} [params.properties] - Specific properties to set / animate.\n *\n * @param {boolean} [params.silent] - Set position data directly; no store or style updates.\n *\n * @param {boolean} [params.async=false] - If animating return a Promise that resolves with any saved data.\n *\n * @param {boolean} [params.animateTo=false] - Animate to restore data.\n *\n * @param {number} [params.duration=0.1] - Duration in seconds.\n *\n * @param {Function} [params.ease=linear] - Easing function.\n *\n * @param {Function} [params.interpolate=lerp] - Interpolation function.\n *\n * @returns {import('./').TJSPositionDataExtended | Promise} Saved position\n * data.\n */\n restore({ name, remove = false, properties, silent = false, async = false, animateTo = false, duration = 0.1,\n ease = linear, interpolate = lerp })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - restore error: 'name' is not a string.`); }\n\n const dataSaved = this.#dataSaved.get(name);\n\n if (dataSaved)\n {\n if (remove) { this.#dataSaved.delete(name); }\n\n let data = dataSaved;\n\n if (isIterable(properties))\n {\n data = {};\n for (const property of properties) { data[property] = dataSaved[property]; }\n }\n\n // Update data directly with no store or inline style updates.\n if (silent)\n {\n for (const property in data) { this.#data[property] = data[property]; }\n return dataSaved;\n }\n else if (animateTo) // Animate to saved data.\n {\n // Provide special handling to potentially change transform origin as this parameter is not animated.\n if (data.transformOrigin !== this.#position.transformOrigin)\n {\n this.#position.transformOrigin = data.transformOrigin;\n }\n\n // Return a Promise with saved data that resolves after animation ends.\n if (async)\n {\n return this.#position.animate.to(data, { duration, ease, interpolate }).finished.then(() => dataSaved);\n }\n else // Animate synchronously.\n {\n this.#position.animate.to(data, { duration, ease, interpolate });\n }\n }\n else\n {\n // Default options is to set data for an immediate update.\n this.#position.set(data);\n }\n }\n\n return dataSaved;\n }\n\n /**\n * Saves current position state with the opportunity to add extra data to the saved state.\n *\n * @param {object} opts - Options.\n *\n * @param {string} opts.name - name to index this saved data.\n *\n * @param {...*} [opts.extra] - Extra data to add to saved data.\n *\n * @returns {import('./').TJSPositionData} Current position data\n */\n save({ name, ...extra })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - save error: 'name' is not a string.`); }\n\n const data = this.#position.get(extra);\n\n this.#dataSaved.set(name, data);\n\n return data;\n }\n\n /**\n * Directly sets a position state.\n *\n * @param {object} opts - Options.\n *\n * @param {string} opts.name - name to index this saved data.\n *\n * @param {...*} [opts.data] - TJSPosition data to set.\n */\n set({ name, ...data })\n {\n if (typeof name !== 'string') { throw new TypeError(`Position - set error: 'name' is not a string.`); }\n\n this.#dataSaved.set(name, data);\n }\n}\n\nclass StyleCache\n{\n constructor()\n {\n /** @type {HTMLElement|undefined} */\n this.el = void 0;\n\n /** @type {CSSStyleDeclaration} */\n this.computed = void 0;\n\n /** @type {number|undefined} */\n this.marginLeft = void 0;\n\n /** @type {number|undefined} */\n this.marginTop = void 0;\n\n /** @type {number|undefined} */\n this.maxHeight = void 0;\n\n /** @type {number|undefined} */\n this.maxWidth = void 0;\n\n /** @type {number|undefined} */\n this.minHeight = void 0;\n\n /** @type {number|undefined} */\n this.minWidth = void 0;\n\n /** @type {boolean} */\n this.hasWillChange = false;\n\n /**\n * @type {import('./').ResizeObserverData}\n */\n this.resizeObserved = {\n contentHeight: void 0,\n contentWidth: void 0,\n offsetHeight: void 0,\n offsetWidth: void 0\n };\n\n /**\n * Provides a writable store to track offset & content width / height from an associated `resizeObserver` action.\n *\n * @type {import('svelte/store').Writable}\n */\n const storeResizeObserved = writable(this.resizeObserved);\n\n this.stores = {\n element: writable(this.el),\n resizeContentHeight: propertyStore(storeResizeObserved, 'contentHeight'),\n resizeContentWidth: propertyStore(storeResizeObserved, 'contentWidth'),\n resizeObserved: storeResizeObserved,\n resizeOffsetHeight: propertyStore(storeResizeObserved, 'offsetHeight'),\n resizeOffsetWidth: propertyStore(storeResizeObserved, 'offsetWidth')\n };\n }\n\n /**\n * Returns the cached offsetHeight from any attached `resizeObserver` action otherwise gets the offsetHeight from\n * the element directly. The more optimized path is using `resizeObserver` as getting it from the element\n * directly is more expensive and alters the execution order of an animation frame.\n *\n * @returns {number} The element offsetHeight.\n */\n get offsetHeight()\n {\n if (this.el instanceof HTMLElement)\n {\n return this.resizeObserved.offsetHeight !== void 0 ? this.resizeObserved.offsetHeight : this.el.offsetHeight;\n }\n\n throw new Error(`StyleCache - get offsetHeight error: no element assigned.`);\n }\n\n /**\n * Returns the cached offsetWidth from any attached `resizeObserver` action otherwise gets the offsetWidth from\n * the element directly. The more optimized path is using `resizeObserver` as getting it from the element\n * directly is more expensive and alters the execution order of an animation frame.\n *\n * @returns {number} The element offsetHeight.\n */\n get offsetWidth()\n {\n if (this.el instanceof HTMLElement)\n {\n return this.resizeObserved.offsetWidth !== void 0 ? this.resizeObserved.offsetWidth : this.el.offsetWidth;\n }\n\n throw new Error(`StyleCache - get offsetWidth error: no element assigned.`);\n }\n\n /**\n * @param {HTMLElement} el -\n *\n * @returns {boolean} Does element match cached element.\n */\n hasData(el) { return this.el === el; }\n\n /**\n * Resets the style cache.\n */\n reset()\n {\n // Remove will-change inline style from previous element if it is still connected.\n if (this.el instanceof HTMLElement && this.el.isConnected && !this.hasWillChange)\n {\n this.el.style.willChange = null;\n }\n\n this.el = void 0;\n this.computed = void 0;\n this.marginLeft = void 0;\n this.marginTop = void 0;\n this.maxHeight = void 0;\n this.maxWidth = void 0;\n this.minHeight = void 0;\n this.minWidth = void 0;\n\n this.hasWillChange = false;\n\n // Silently reset `resizedObserved`; With proper usage the `resizeObserver` action issues an update on removal.\n this.resizeObserved.contentHeight = void 0;\n this.resizeObserved.contentWidth = void 0;\n this.resizeObserved.offsetHeight = void 0;\n this.resizeObserved.offsetWidth = void 0;\n\n // Reset the tracked element this TJSPosition instance is modifying.\n this.stores.element.set(void 0);\n }\n\n /**\n * Updates the style cache with new data from the given element.\n *\n * @param {HTMLElement} el - An HTML element.\n */\n update(el)\n {\n this.el = el;\n\n this.computed = globalThis.getComputedStyle(el);\n\n this.marginLeft = StyleParse.pixels(el.style.marginLeft) ?? StyleParse.pixels(this.computed.marginLeft);\n this.marginTop = StyleParse.pixels(el.style.marginTop) ?? StyleParse.pixels(this.computed.marginTop);\n this.maxHeight = StyleParse.pixels(el.style.maxHeight) ?? StyleParse.pixels(this.computed.maxHeight);\n this.maxWidth = StyleParse.pixels(el.style.maxWidth) ?? StyleParse.pixels(this.computed.maxWidth);\n\n // Note that the computed styles for below will always be 0px / 0 when no style is active.\n this.minHeight = StyleParse.pixels(el.style.minHeight) ?? StyleParse.pixels(this.computed.minHeight);\n this.minWidth = StyleParse.pixels(el.style.minWidth) ?? StyleParse.pixels(this.computed.minWidth);\n\n // Tracks if there already is a will-change property on the inline or computed styles.\n const willChange = el.style.willChange !== '' ? el.style.willChange : this.computed.willChange;\n\n this.hasWillChange = willChange !== '' && willChange !== 'auto';\n\n // Update the tracked element this TJSPosition instance is modifying.\n this.stores.element.set(el);\n }\n}\n\n/**\n * Provides the output data for {@link TJSTransforms.getData}.\n */\nclass TJSTransformData\n{\n constructor()\n {\n Object.seal(this);\n }\n\n /**\n * Stores the calculated bounding rectangle.\n *\n * @type {DOMRect}\n */\n #boundingRect = new DOMRect();\n\n /**\n * Stores the individual transformed corner points of the window in screen space clockwise from:\n * top left -> top right -> bottom right -> bottom left.\n *\n * @type {import('#runtime/math/gl-matrix').Vec3[]}\n */\n #corners = [Vec3.create(), Vec3.create(), Vec3.create(), Vec3.create()];\n\n /**\n * Stores the current gl-matrix Mat4 data.\n *\n * @type {import('#runtime/math/gl-matrix').Mat4}\n */\n #mat4 = Mat4.create();\n\n /**\n * Stores the pre & post origin translations to apply to matrix transforms.\n *\n * @type {import('#runtime/math/gl-matrix').Mat4[]}\n */\n #originTranslations = [Mat4.create(), Mat4.create()];\n\n /**\n * @returns {DOMRect} The bounding rectangle.\n */\n get boundingRect() { return this.#boundingRect; }\n\n /**\n * @returns {import('#runtime/math/gl-matrix').Vec3[]} The transformed corner points as Vec3 in screen space.\n */\n get corners() { return this.#corners; }\n\n /**\n * @returns {string} Returns the CSS style string for the transform matrix.\n */\n get css() { return `matrix3d(${this.mat4.join(',')})`; }\n\n /**\n * @returns {import('#runtime/math/gl-matrix').Mat4} The transform matrix.\n */\n get mat4() { return this.#mat4; }\n\n /**\n * @returns {import('#runtime/math/gl-matrix').Mat4[]} The pre / post translation matrices for origin translation.\n */\n get originTranslations() { return this.#originTranslations; }\n}\n\n/** @type {number[]} */\nconst s_SCALE_VECTOR = [1, 1, 1];\n\n/** @type {number[]} */\nconst s_TRANSLATE_VECTOR = [0, 0, 0];\n\n/** @type {import('#runtime/math/gl-matrix').Mat4} */\nconst s_MAT4_RESULT = Mat4.create();\n\n/** @type {import('#runtime/math/gl-matrix').Mat4} */\nconst s_MAT4_TEMP = Mat4.create();\n\n/** @type {import('#runtime/math/gl-matrix').Vec3} */\nconst s_VEC3_TEMP = Vec3.create();\n\nclass TJSTransforms\n{\n /**\n * Stores the transform keys in the order added.\n *\n * @type {string[]}\n */\n #orderList = [];\n\n constructor()\n {\n this._data = {};\n }\n\n /**\n * @returns {boolean} Whether there are active transforms in local data.\n */\n get isActive() { return this.#orderList.length > 0; }\n\n /**\n * @returns {number|undefined} Any local rotateX data.\n */\n get rotateX() { return this._data.rotateX; }\n\n /**\n * @returns {number|undefined} Any local rotateY data.\n */\n get rotateY() { return this._data.rotateY; }\n\n /**\n * @returns {number|undefined} Any local rotateZ data.\n */\n get rotateZ() { return this._data.rotateZ; }\n\n /**\n * @returns {number|undefined} Any local rotateZ scale.\n */\n get scale() { return this._data.scale; }\n\n /**\n * @returns {number|undefined} Any local translateZ data.\n */\n get translateX() { return this._data.translateX; }\n\n /**\n * @returns {number|undefined} Any local translateZ data.\n */\n get translateY() { return this._data.translateY; }\n\n /**\n * @returns {number|undefined} Any local translateZ data.\n */\n get translateZ() { return this._data.translateZ; }\n\n /**\n * Sets the local rotateX data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set rotateX(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.rotateX === void 0) { this.#orderList.push('rotateX'); }\n\n this._data.rotateX = value;\n }\n else\n {\n if (this._data.rotateX !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'rotateX');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.rotateX;\n }\n }\n\n /**\n * Sets the local rotateY data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set rotateY(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.rotateY === void 0) { this.#orderList.push('rotateY'); }\n\n this._data.rotateY = value;\n }\n else\n {\n if (this._data.rotateY !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'rotateY');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.rotateY;\n }\n }\n\n /**\n * Sets the local rotateZ data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set rotateZ(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.rotateZ === void 0) { this.#orderList.push('rotateZ'); }\n\n this._data.rotateZ = value;\n }\n\n else\n {\n if (this._data.rotateZ !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'rotateZ');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.rotateZ;\n }\n }\n\n /**\n * Sets the local scale data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set scale(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.scale === void 0) { this.#orderList.push('scale'); }\n\n this._data.scale = value;\n }\n else\n {\n if (this._data.scale !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'scale');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.scale;\n }\n }\n\n /**\n * Sets the local translateX data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set translateX(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.translateX === void 0) { this.#orderList.push('translateX'); }\n\n this._data.translateX = value;\n }\n\n else\n {\n if (this._data.translateX !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'translateX');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.translateX;\n }\n }\n\n /**\n * Sets the local translateY data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set translateY(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.translateY === void 0) { this.#orderList.push('translateY'); }\n\n this._data.translateY = value;\n }\n\n else\n {\n if (this._data.translateY !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'translateY');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.translateY;\n }\n }\n\n /**\n * Sets the local translateZ data if the value is a finite number otherwise removes the local data.\n *\n * @param {number|null|undefined} value - A value to set.\n */\n set translateZ(value)\n {\n if (Number.isFinite(value))\n {\n if (this._data.translateZ === void 0) { this.#orderList.push('translateZ'); }\n\n this._data.translateZ = value;\n }\n\n else\n {\n if (this._data.translateZ !== void 0)\n {\n const index = this.#orderList.findIndex((entry) => entry === 'translateZ');\n if (index >= 0) { this.#orderList.splice(index, 1); }\n }\n\n delete this._data.translateZ;\n }\n }\n\n /**\n * Returns the matrix3d CSS transform for the given position / transform data.\n *\n * @param {object} [data] - Optional position data otherwise use local stored transform data.\n *\n * @returns {string} The CSS matrix3d string.\n */\n getCSS(data = this._data)\n {\n return `matrix3d(${this.getMat4(data, s_MAT4_RESULT).join(',')})`;\n }\n\n /**\n * Returns the matrix3d CSS transform for the given position / transform data.\n *\n * @param {object} [data] - Optional position data otherwise use local stored transform data.\n *\n * @returns {string} The CSS matrix3d string.\n */\n getCSSOrtho(data = this._data)\n {\n return `matrix3d(${this.getMat4Ortho(data, s_MAT4_RESULT).join(',')})`;\n }\n\n /**\n * Collects all data including a bounding rect, transform matrix, and points array of the given\n * {@link TJSPositionData} instance with the applied local transform data.\n *\n * @param {import('../').TJSPositionData} position - The position data to process.\n *\n * @param {TJSTransformData} [output] - Optional TJSTransformData output instance.\n *\n * @param {object} [validationData] - Optional validation data for adjustment parameters.\n *\n * @returns {TJSTransformData} The output TJSTransformData instance.\n */\n getData(position, output = new TJSTransformData(), validationData = {})\n {\n const valWidth = validationData.width ?? 0;\n const valHeight = validationData.height ?? 0;\n const valOffsetTop = validationData.offsetTop ?? validationData.marginTop ?? 0;\n const valOffsetLeft = validationData.offsetLeft ?? validationData.offsetLeft ?? 0;\n\n position.top += valOffsetTop;\n position.left += valOffsetLeft;\n\n const width = Number.isFinite(position.width) ? position.width : valWidth;\n const height = Number.isFinite(position.height) ? position.height : valHeight;\n\n const rect = output.corners;\n\n if (this.hasTransform(position))\n {\n rect[0][0] = rect[0][1] = rect[0][2] = 0;\n rect[1][0] = width;\n rect[1][1] = rect[1][2] = 0;\n rect[2][0] = width;\n rect[2][1] = height;\n rect[2][2] = 0;\n rect[3][0] = 0;\n rect[3][1] = height;\n rect[3][2] = 0;\n\n const matrix = this.getMat4(position, output.mat4);\n\n const translate = s_GET_ORIGIN_TRANSLATION(position.transformOrigin, width, height, output.originTranslations);\n\n if (transformOriginDefault === position.transformOrigin)\n {\n Vec3.transformMat4(rect[0], rect[0], matrix);\n Vec3.transformMat4(rect[1], rect[1], matrix);\n Vec3.transformMat4(rect[2], rect[2], matrix);\n Vec3.transformMat4(rect[3], rect[3], matrix);\n }\n else\n {\n Vec3.transformMat4(rect[0], rect[0], translate[0]);\n Vec3.transformMat4(rect[0], rect[0], matrix);\n Vec3.transformMat4(rect[0], rect[0], translate[1]);\n\n Vec3.transformMat4(rect[1], rect[1], translate[0]);\n Vec3.transformMat4(rect[1], rect[1], matrix);\n Vec3.transformMat4(rect[1], rect[1], translate[1]);\n\n Vec3.transformMat4(rect[2], rect[2], translate[0]);\n Vec3.transformMat4(rect[2], rect[2], matrix);\n Vec3.transformMat4(rect[2], rect[2], translate[1]);\n\n Vec3.transformMat4(rect[3], rect[3], translate[0]);\n Vec3.transformMat4(rect[3], rect[3], matrix);\n Vec3.transformMat4(rect[3], rect[3], translate[1]);\n }\n\n rect[0][0] = position.left + rect[0][0];\n rect[0][1] = position.top + rect[0][1];\n rect[1][0] = position.left + rect[1][0];\n rect[1][1] = position.top + rect[1][1];\n rect[2][0] = position.left + rect[2][0];\n rect[2][1] = position.top + rect[2][1];\n rect[3][0] = position.left + rect[3][0];\n rect[3][1] = position.top + rect[3][1];\n }\n else\n {\n rect[0][0] = position.left;\n rect[0][1] = position.top;\n rect[1][0] = position.left + width;\n rect[1][1] = position.top;\n rect[2][0] = position.left + width;\n rect[2][1] = position.top + height;\n rect[3][0] = position.left;\n rect[3][1] = position.top + height;\n\n Mat4.identity(output.mat4);\n }\n\n let maxX = Number.MIN_SAFE_INTEGER;\n let maxY = Number.MIN_SAFE_INTEGER;\n let minX = Number.MAX_SAFE_INTEGER;\n let minY = Number.MAX_SAFE_INTEGER;\n\n for (let cntr = 4; --cntr >= 0;)\n {\n if (rect[cntr][0] > maxX) { maxX = rect[cntr][0]; }\n if (rect[cntr][0] < minX) { minX = rect[cntr][0]; }\n if (rect[cntr][1] > maxY) { maxY = rect[cntr][1]; }\n if (rect[cntr][1] < minY) { minY = rect[cntr][1]; }\n }\n\n const boundingRect = output.boundingRect;\n boundingRect.x = minX;\n boundingRect.y = minY;\n boundingRect.width = maxX - minX;\n boundingRect.height = maxY - minY;\n\n position.top -= valOffsetTop;\n position.left -= valOffsetLeft;\n\n return output;\n }\n\n /**\n * Creates a transform matrix based on local data applied in order it was added.\n *\n * If no data object is provided then the source is the local transform data. If another data object is supplied\n * then the stored local transform order is applied then all remaining transform keys are applied. This allows the\n * construction of a transform matrix in advance of setting local data and is useful in collision detection.\n *\n * @param {object} [data] - TJSPositionData instance or local transform data.\n *\n * @param {import('#runtime/math/gl-matrix').Mat4} [output] - The output mat4 instance.\n *\n * @returns {import('#runtime/math/gl-matrix').Mat4} Transform matrix.\n */\n getMat4(data = this._data, output = Mat4.create())\n {\n const matrix = Mat4.identity(output);\n\n // Bitwise tracks applied transform keys from local transform data.\n let seenKeys = 0;\n\n const orderList = this.#orderList;\n\n // First apply ordered transforms from local transform data.\n for (let cntr = 0; cntr < orderList.length; cntr++)\n {\n const key = orderList[cntr];\n\n switch (key)\n {\n case 'rotateX':\n seenKeys |= transformKeysBitwise.rotateX;\n Mat4.multiply(matrix, matrix, Mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n seenKeys |= transformKeysBitwise.rotateY;\n Mat4.multiply(matrix, matrix, Mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n seenKeys |= transformKeysBitwise.rotateZ;\n Mat4.multiply(matrix, matrix, Mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'scale':\n seenKeys |= transformKeysBitwise.scale;\n s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data[key];\n Mat4.multiply(matrix, matrix, Mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR));\n break;\n\n case 'translateX':\n seenKeys |= transformKeysBitwise.translateX;\n s_TRANSLATE_VECTOR[0] = data.translateX;\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = 0;\n Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateY':\n seenKeys |= transformKeysBitwise.translateY;\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = data.translateY;\n s_TRANSLATE_VECTOR[2] = 0;\n Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateZ':\n seenKeys |= transformKeysBitwise.translateZ;\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = data.translateZ;\n Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n }\n }\n\n // Now apply any new keys not set in local transform data that have not been applied yet.\n if (data !== this._data)\n {\n for (let cntr = 0; cntr < transformKeys.length; cntr++)\n {\n const key = transformKeys[cntr];\n\n // Reject bad / no data or if the key has already been applied.\n if (data[key] === null || (seenKeys & transformKeysBitwise[key]) > 0) { continue; }\n\n switch (key)\n {\n case 'rotateX':\n Mat4.multiply(matrix, matrix, Mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n Mat4.multiply(matrix, matrix, Mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n Mat4.multiply(matrix, matrix, Mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'scale':\n s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data[key];\n Mat4.multiply(matrix, matrix, Mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR));\n break;\n\n case 'translateX':\n s_TRANSLATE_VECTOR[0] = data[key];\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = 0;\n Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateY':\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = data[key];\n s_TRANSLATE_VECTOR[2] = 0;\n Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n\n case 'translateZ':\n s_TRANSLATE_VECTOR[0] = 0;\n s_TRANSLATE_VECTOR[1] = 0;\n s_TRANSLATE_VECTOR[2] = data[key];\n Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n break;\n }\n }\n }\n\n return matrix;\n }\n\n /**\n * Provides an orthographic enhancement to convert left / top positional data to a translate operation.\n *\n * This transform matrix takes into account that the remaining operations are , but adds any left / top attributes from passed in data to\n * translate X / Y.\n *\n * If no data object is provided then the source is the local transform data. If another data object is supplied\n * then the stored local transform order is applied then all remaining transform keys are applied. This allows the\n * construction of a transform matrix in advance of setting local data and is useful in collision detection.\n *\n * @param {object} [data] - TJSPositionData instance or local transform data.\n *\n * @param {import('#runtime/math/gl-matrix').Mat4} [output] - The output mat4 instance.\n *\n * @returns {import('#runtime/math/gl-matrix').Mat4} Transform matrix.\n */\n getMat4Ortho(data = this._data, output = Mat4.create())\n {\n const matrix = Mat4.identity(output);\n\n // Attempt to retrieve values from passed in data otherwise default to 0.\n // Always perform the translation last regardless of order added to local transform data.\n // Add data.left to translateX and data.top to translateY.\n s_TRANSLATE_VECTOR[0] = (data.left ?? 0) + (data.translateX ?? 0);\n s_TRANSLATE_VECTOR[1] = (data.top ?? 0) + (data.translateY ?? 0);\n s_TRANSLATE_VECTOR[2] = data.translateZ ?? 0;\n Mat4.multiply(matrix, matrix, Mat4.fromTranslation(s_MAT4_TEMP, s_TRANSLATE_VECTOR));\n\n // Scale can also be applied out of order.\n if (data.scale !== null)\n {\n s_SCALE_VECTOR[0] = s_SCALE_VECTOR[1] = data.scale;\n Mat4.multiply(matrix, matrix, Mat4.fromScaling(s_MAT4_TEMP, s_SCALE_VECTOR));\n }\n\n // Early out if there is not rotation data.\n if (data.rotateX === null && data.rotateY === null && data.rotateZ === null) { return matrix; }\n\n // Rotation transforms must be applied in the order they are added.\n\n // Bitwise tracks applied transform keys from local transform data.\n let seenKeys = 0;\n\n const orderList = this.#orderList;\n\n // First apply ordered transforms from local transform data.\n for (let cntr = 0; cntr < orderList.length; cntr++)\n {\n const key = orderList[cntr];\n\n switch (key)\n {\n case 'rotateX':\n seenKeys |= transformKeysBitwise.rotateX;\n Mat4.multiply(matrix, matrix, Mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n seenKeys |= transformKeysBitwise.rotateY;\n Mat4.multiply(matrix, matrix, Mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n seenKeys |= transformKeysBitwise.rotateZ;\n Mat4.multiply(matrix, matrix, Mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n }\n }\n\n // Now apply any new keys not set in local transform data that have not been applied yet.\n if (data !== this._data)\n {\n for (let cntr = 0; cntr < transformKeys.length; cntr++)\n {\n const key = transformKeys[cntr];\n\n // Reject bad / no data or if the key has already been applied.\n if (data[key] === null || (seenKeys & transformKeysBitwise[key]) > 0) { continue; }\n\n switch (key)\n {\n case 'rotateX':\n Mat4.multiply(matrix, matrix, Mat4.fromXRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateY':\n Mat4.multiply(matrix, matrix, Mat4.fromYRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n\n case 'rotateZ':\n Mat4.multiply(matrix, matrix, Mat4.fromZRotation(s_MAT4_TEMP, degToRad(data[key])));\n break;\n }\n }\n }\n\n return matrix;\n }\n\n /**\n * Tests an object if it contains transform keys and the values are finite numbers.\n *\n * @param {object} data - An object to test for transform data.\n *\n * @returns {boolean} Whether the given TJSPositionData has transforms.\n */\n hasTransform(data)\n {\n for (const key of transformKeys)\n {\n if (Number.isFinite(data[key])) { return true; }\n }\n\n return false;\n }\n\n /**\n * Resets internal data from the given object containing valid transform keys.\n *\n * @param {object} data - An object with transform data.\n */\n reset(data)\n {\n for (const key in data)\n {\n if (transformKeys.includes(key))\n {\n if (Number.isFinite(data[key]))\n {\n this._data[key] = data[key];\n }\n else\n {\n const index = this.#orderList.findIndex((entry) => entry === key);\n if (index >= 0) { this.#orderList.splice(index, 1); }\n\n delete this._data[key];\n }\n }\n }\n }\n}\n\n/**\n * Returns the translations necessary to translate a matrix operation based on the `transformOrigin` parameter of the\n * given position instance. The first entry / index 0 is the pre-translation and last entry / index 1 is the post-\n * translation.\n *\n * This method is used internally, but may be useful if you need the origin translation matrices to transform\n * bespoke points based on any `transformOrigin` set in {@link TJSPositionData}.\n *\n * @param {string} transformOrigin - The transform origin attribute from TJSPositionData.\n *\n * @param {number} width - The TJSPositionData width or validation data width when 'auto'.\n *\n * @param {number} height - The TJSPositionData height or validation data height when 'auto'.\n *\n * @param {import('#runtime/math/gl-matrix').Mat4[]} output - Output Mat4 array.\n *\n * @returns {import('#runtime/math/gl-matrix').Mat4[]} Output Mat4 array.\n */\nfunction s_GET_ORIGIN_TRANSLATION(transformOrigin, width, height, output)\n{\n const vector = s_VEC3_TEMP;\n\n switch (transformOrigin)\n {\n case 'top left':\n vector[0] = vector[1] = 0;\n Mat4.fromTranslation(output[0], vector);\n Mat4.fromTranslation(output[1], vector);\n break;\n\n case 'top center':\n vector[0] = -width * 0.5;\n vector[1] = 0;\n Mat4.fromTranslation(output[0], vector);\n vector[0] = width * 0.5;\n Mat4.fromTranslation(output[1], vector);\n break;\n\n case 'top right':\n vector[0] = -width;\n vector[1] = 0;\n Mat4.fromTranslation(output[0], vector);\n vector[0] = width;\n Mat4.fromTranslation(output[1], vector);\n break;\n\n case 'center left':\n vector[0] = 0;\n vector[1] = -height * 0.5;\n Mat4.fromTranslation(output[0], vector);\n vector[1] = height * 0.5;\n Mat4.fromTranslation(output[1], vector);\n break;\n\n // By default, null / no transform is 'center'.\n case null:\n case 'center':\n vector[0] = -width * 0.5;\n vector[1] = -height * 0.5;\n Mat4.fromTranslation(output[0], vector);\n vector[0] = width * 0.5;\n vector[1] = height * 0.5;\n Mat4.fromTranslation(output[1], vector);\n break;\n\n case 'center right':\n vector[0] = -width;\n vector[1] = -height * 0.5;\n Mat4.fromTranslation(output[0], vector);\n vector[0] = width;\n vector[1] = height * 0.5;\n Mat4.fromTranslation(output[1], vector);\n break;\n\n case 'bottom left':\n vector[0] = 0;\n vector[1] = -height;\n Mat4.fromTranslation(output[0], vector);\n vector[1] = height;\n Mat4.fromTranslation(output[1], vector);\n break;\n\n case 'bottom center':\n vector[0] = -width * 0.5;\n vector[1] = -height;\n Mat4.fromTranslation(output[0], vector);\n vector[0] = width * 0.5;\n vector[1] = height;\n Mat4.fromTranslation(output[1], vector);\n break;\n\n case 'bottom right':\n vector[0] = -width;\n vector[1] = -height;\n Mat4.fromTranslation(output[0], vector);\n vector[0] = width;\n vector[1] = height;\n Mat4.fromTranslation(output[1], vector);\n break;\n\n // No valid transform origin parameter; set identity.\n default:\n Mat4.identity(output[0]);\n Mat4.identity(output[1]);\n break;\n }\n\n return output;\n}\n\n/**\n * Provides the storage and sequencing of managed position validators. Each validator added may be a bespoke function or\n * a {@link ValidatorData} object containing an `id`, `validator`, and `weight` attributes; `validator` is\n * the only required attribute.\n *\n * The `id` attribute can be anything that creates a unique ID for the validator; recommended strings or numbers. This\n * allows validators to be removed by ID easily.\n *\n * The `weight` attribute is a number between 0 and 1 inclusive that allows validators to be added in a\n * predictable order which is especially handy if they are manipulated at runtime. A lower weighted validator always\n * runs before a higher weighted validator. If no weight is specified the default of '1' is assigned and it is appended\n * to the end of the validators list.\n *\n * This class forms the public API which is accessible from the `.validators` getter in the main TJSPosition instance.\n * ```\n * const position = new TJSPosition();\n * position.validators.add(...);\n * position.validators.clear();\n * position.validators.length;\n * position.validators.remove(...);\n * position.validators.removeBy(...);\n * position.validators.removeById(...);\n * ```\n */\nclass AdapterValidators\n{\n /** @type {boolean} */\n #enabled = true;\n\n /**\n * @type {import('../').ValidatorData[]}\n */\n #validatorData;\n\n #mapUnsubscribe = new Map();\n\n /**\n * @returns {[AdapterValidators, import('../').ValidatorData[]]} Returns this and internal storage for validator\n * adapter.\n */\n constructor()\n {\n this.#validatorData = [];\n\n Object.seal(this);\n\n return [this, this.#validatorData];\n }\n\n /**\n * @returns {boolean} Returns the enabled state.s\n */\n get enabled() { return this.#enabled; }\n\n /**\n * @returns {number} Returns the length of the validators array.\n */\n get length() { return this.#validatorData.length; }\n\n /**\n * @param {boolean} enabled - Sets enabled state.\n */\n set enabled(enabled)\n {\n if (typeof enabled !== 'boolean') { throw new TypeError(`'enabled' is not a boolean.`); }\n\n this.#enabled = enabled;\n }\n\n /**\n * Provides an iterator for validators.\n *\n * @yields {import('../').ValidatorData}\n */\n *[Symbol.iterator]()\n {\n if (this.#validatorData.length === 0) { return; }\n\n for (const entry of this.#validatorData)\n {\n yield { ...entry };\n }\n }\n\n /**\n * @param {...(import('../').ValidatorFn | import('../').ValidatorData)} validators -\n */\n add(...validators)\n {\n /**\n * Tracks the number of validators added that have subscriber functionality.\n *\n * @type {number}\n */\n // let subscribeCount = 0; // TODO: Currently unused\n\n for (const validator of validators)\n {\n const validatorType = typeof validator;\n\n if ((validatorType !== 'function' && validatorType !== 'object') || validator === null)\n {\n throw new TypeError(`AdapterValidator error: 'validator' is not a function or object.`);\n }\n\n let data = void 0;\n let subscribeFn = void 0;\n\n switch (validatorType)\n {\n case 'function':\n data = {\n id: void 0,\n validator,\n weight: 1\n };\n\n subscribeFn = validator.subscribe;\n break;\n\n case 'object':\n if (typeof validator.validator !== 'function')\n {\n throw new TypeError(`AdapterValidator error: 'validator' attribute is not a function.`);\n }\n\n if (validator.weight !== void 0 && typeof validator.weight !== 'number' ||\n (validator.weight < 0 || validator.weight > 1))\n {\n throw new TypeError(\n `AdapterValidator error: 'weight' attribute is not a number between '0 - 1' inclusive.`);\n }\n\n data = {\n id: validator.id !== void 0 ? validator.id : void 0,\n validator: validator.validator.bind(validator),\n weight: validator.weight || 1,\n instance: validator\n };\n\n subscribeFn = validator.validator.subscribe ?? validator.subscribe;\n break;\n }\n\n // Find the index to insert where data.weight is less than existing values weight.\n const index = this.#validatorData.findIndex((value) =>\n {\n return data.weight < value.weight;\n });\n\n // If an index was found insert at that location.\n if (index >= 0)\n {\n this.#validatorData.splice(index, 0, data);\n }\n else // push to end of validators.\n {\n this.#validatorData.push(data);\n }\n\n if (typeof subscribeFn === 'function')\n {\n // TODO: consider how to handle validator updates.\n const unsubscribe = subscribeFn();\n\n // Ensure that unsubscribe is a function.\n if (typeof unsubscribe !== 'function')\n {\n throw new TypeError(\n 'AdapterValidator error: Filter has subscribe function, but no unsubscribe function is returned.');\n }\n\n // Ensure that the same validator is not subscribed to multiple times.\n if (this.#mapUnsubscribe.has(data.validator))\n {\n throw new Error(\n 'AdapterValidator error: Filter added already has an unsubscribe function registered.');\n }\n\n this.#mapUnsubscribe.set(data.validator, unsubscribe);\n // subscribeCount++; // TODO: Currently unused\n }\n }\n\n // Filters with subscriber functionality are assumed to immediately invoke the `subscribe` callback. If the\n // subscriber count is less than the amount of validators added then automatically trigger an index update\n // manually.\n // TODO: handle validator updates.\n // if (subscribeCount < validators.length) { this.#indexUpdate(); }\n }\n\n clear()\n {\n this.#validatorData.length = 0;\n\n // Unsubscribe from all validators with subscription support.\n for (const unsubscribe of this.#mapUnsubscribe.values())\n {\n unsubscribe();\n }\n\n this.#mapUnsubscribe.clear();\n\n // TODO: handle validator updates.\n // this.#indexUpdate();\n }\n\n /**\n * @param {...(import('../').ValidatorFn | import('../').ValidatorData)} validators -\n */\n remove(...validators)\n {\n const length = this.#validatorData.length;\n\n if (length === 0) { return; }\n\n for (const data of validators)\n {\n // Handle the case that the validator may either be a function or a validator entry / object.\n const actualValidator = typeof data === 'function' ? data : isObject(data) ? data.validator : void 0;\n\n if (!actualValidator) { continue; }\n\n for (let cntr = this.#validatorData.length; --cntr >= 0;)\n {\n if (this.#validatorData[cntr].validator === actualValidator)\n {\n this.#validatorData.splice(cntr, 1);\n\n // Invoke any unsubscribe function for given validator then remove from tracking.\n let unsubscribe = void 0;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(actualValidator)) === 'function')\n {\n unsubscribe();\n this.#mapUnsubscribe.delete(actualValidator);\n }\n }\n }\n }\n\n // Update the index a validator was removed.\n // TODO: handle validator updates.\n // if (length !== this.#validatorData.length) { this.#indexUpdate(); }\n }\n\n /**\n * Remove validators by the provided callback. The callback takes 3 parameters: `id`, `validator`, and `weight`.\n * Any truthy value returned will remove that validator.\n *\n * @param {function(*, import('../').ValidatorFn, number): boolean} callback - Callback function to evaluate each\n * validator entry.\n */\n removeBy(callback)\n {\n const length = this.#validatorData.length;\n\n if (length === 0) { return; }\n\n if (typeof callback !== 'function')\n {\n throw new TypeError(`AdapterValidator error: 'callback' is not a function.`);\n }\n\n this.#validatorData = this.#validatorData.filter((data) =>\n {\n const remove = callback.call(callback, { ...data });\n\n if (remove)\n {\n let unsubscribe;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.validator)) === 'function')\n {\n unsubscribe();\n this.#mapUnsubscribe.delete(data.validator);\n }\n }\n\n // Reverse remove boolean to properly validator / remove this validator.\n return !remove;\n });\n\n // TODO: handle validator updates.\n // if (length !== this.#validatorData.length) { this.#indexUpdate(); }\n }\n\n removeById(...ids)\n {\n const length = this.#validatorData.length;\n\n if (length === 0) { return; }\n\n this.#validatorData = this.#validatorData.filter((data) =>\n {\n let remove = false;\n\n for (const id of ids) { remove |= data.id === id; }\n\n // If not keeping invoke any unsubscribe function for given validator then remove from tracking.\n if (remove)\n {\n let unsubscribe;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.validator)) === 'function')\n {\n unsubscribe();\n this.#mapUnsubscribe.delete(data.validator);\n }\n }\n\n return !remove; // Swap here to actually remove the item via array validator method.\n });\n\n // TODO: handle validator updates.\n // if (length !== this.#validatorData.length) { this.#indexUpdate(); }\n }\n}\n\nclass BasicBounds\n{\n /**\n * When true constrains the min / max width or height to element.\n *\n * @type {boolean}\n */\n #constrain;\n\n /**\n * @type {HTMLElement}\n */\n #element;\n\n /**\n * When true the validator is active.\n *\n * @type {boolean}\n */\n #enabled;\n\n /**\n * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not\n * performance oriented. If manually set this height is used instead of `offsetHeight`.\n *\n * @type {number}\n */\n #height;\n\n /**\n * Set from an optional value in the constructor to lock accessors preventing modification.\n */\n #lock;\n\n /**\n * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not\n * performance oriented. If manually set this width is used instead of `offsetWidth`.\n *\n * @type {number}\n */\n #width;\n\n constructor({ constrain = true, element, enabled = true, lock = false, width, height } = {})\n {\n this.element = element;\n this.constrain = constrain;\n this.enabled = enabled;\n this.width = width;\n this.height = height;\n\n this.#lock = typeof lock === 'boolean' ? lock : false;\n }\n\n get constrain() { return this.#constrain; }\n\n get element() { return this.#element; }\n\n get enabled() { return this.#enabled; }\n\n get height() { return this.#height; }\n\n get width() { return this.#width; }\n\n set constrain(constrain)\n {\n if (this.#lock) { return; }\n\n if (typeof constrain !== 'boolean') { throw new TypeError(`'constrain' is not a boolean.`); }\n\n this.#constrain = constrain;\n }\n\n set element(element)\n {\n if (this.#lock) { return; }\n\n if (element === void 0 || element === null || element instanceof HTMLElement)\n {\n this.#element = element;\n }\n else\n {\n throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`);\n }\n }\n\n set enabled(enabled)\n {\n if (this.#lock) { return; }\n\n if (typeof enabled !== 'boolean') { throw new TypeError(`'enabled' is not a boolean.`); }\n\n this.#enabled = enabled;\n }\n\n set height(height)\n {\n if (this.#lock) { return; }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n set width(width)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n }\n\n setDimension(width, height)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n /**\n * Provides a validator that respects transforms in positional data constraining the position to within the target\n * elements bounds.\n *\n * @param {import('../').ValidationData} valData - The associated validation data for position updates.\n *\n * @returns {import('../').TJSPositionData} Potentially adjusted position data.\n */\n validator(valData)\n {\n // Early out if element is undefined or local enabled state is false.\n if (!this.#enabled) { return valData.position; }\n\n // Determine containing bounds from manual values; or any element; lastly the browser width / height.\n const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth;\n const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight;\n\n if (typeof valData.position.width === 'number')\n {\n const maxW = valData.maxWidth ?? (this.#constrain ? boundsWidth : Number.MAX_SAFE_INTEGER);\n valData.position.width = valData.width = clamp(valData.position.width, valData.minWidth, maxW);\n\n if ((valData.width + valData.position.left + valData.marginLeft) > boundsWidth)\n {\n valData.position.left = boundsWidth - valData.width - valData.marginLeft;\n }\n }\n\n if (typeof valData.position.height === 'number')\n {\n const maxH = valData.maxHeight ?? (this.#constrain ? boundsHeight : Number.MAX_SAFE_INTEGER);\n valData.position.height = valData.height = clamp(valData.position.height, valData.minHeight, maxH);\n\n if ((valData.height + valData.position.top + valData.marginTop) > boundsHeight)\n {\n valData.position.top = boundsHeight - valData.height - valData.marginTop;\n }\n }\n\n const maxL = Math.max(boundsWidth - valData.width - valData.marginLeft, 0);\n valData.position.left = Math.round(clamp(valData.position.left, 0, maxL));\n\n const maxT = Math.max(boundsHeight - valData.height - valData.marginTop, 0);\n valData.position.top = Math.round(clamp(valData.position.top, 0, maxT));\n\n return valData.position;\n }\n}\n\nconst s_TRANSFORM_DATA = new TJSTransformData();\n\nclass TransformBounds\n{\n /**\n * When true constrains the min / max width or height to element.\n *\n * @type {boolean}\n */\n #constrain;\n\n /**\n * @type {HTMLElement}\n */\n #element;\n\n /**\n * When true the validator is active.\n *\n * @type {boolean}\n */\n #enabled;\n\n /**\n * Provides a manual setting of the element height. As things go `offsetHeight` causes a browser layout and is not\n * performance oriented. If manually set this height is used instead of `offsetHeight`.\n *\n * @type {number}\n */\n #height;\n\n /**\n * Set from an optional value in the constructor to lock accessors preventing modification.\n */\n #lock;\n\n /**\n * Provides a manual setting of the element width. As things go `offsetWidth` causes a browser layout and is not\n * performance oriented. If manually set this width is used instead of `offsetWidth`.\n *\n * @type {number}\n */\n #width;\n\n constructor({ constrain = true, element, enabled = true, lock = false, width, height } = {})\n {\n this.element = element;\n this.constrain = constrain;\n this.enabled = enabled;\n this.width = width;\n this.height = height;\n\n this.#lock = typeof lock === 'boolean' ? lock : false;\n }\n\n get constrain() { return this.#constrain; }\n\n get element() { return this.#element; }\n\n get enabled() { return this.#enabled; }\n\n get height() { return this.#height; }\n\n get width() { return this.#width; }\n\n set constrain(constrain)\n {\n if (this.#lock) { return; }\n\n if (typeof constrain !== 'boolean') { throw new TypeError(`'constrain' is not a boolean.`); }\n\n this.#constrain = constrain;\n }\n\n set element(element)\n {\n if (this.#lock) { return; }\n\n if (element === void 0 || element === null || element instanceof HTMLElement)\n {\n this.#element = element;\n }\n else\n {\n throw new TypeError(`'element' is not a HTMLElement, undefined, or null.`);\n }\n }\n\n set enabled(enabled)\n {\n if (this.#lock) { return; }\n\n if (typeof enabled !== 'boolean') { throw new TypeError(`'enabled' is not a boolean.`); }\n\n this.#enabled = enabled;\n }\n\n set height(height)\n {\n if (this.#lock) { return; }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n set width(width)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n }\n\n setDimension(width, height)\n {\n if (this.#lock) { return; }\n\n if (width === void 0 || Number.isFinite(width))\n {\n this.#width = width;\n }\n else\n {\n throw new TypeError(`'width' is not a finite number or undefined.`);\n }\n\n if (height === void 0 || Number.isFinite(height))\n {\n this.#height = height;\n }\n else\n {\n throw new TypeError(`'height' is not a finite number or undefined.`);\n }\n }\n\n /**\n * Provides a validator that respects transforms in positional data constraining the position to within the target\n * elements bounds.\n *\n * @param {import('../').ValidationData} valData - The associated validation data for position updates.\n *\n * @returns {import('../').TJSPositionData} Potentially adjusted position data.\n */\n validator(valData)\n {\n // Early out if element is undefined or local enabled state is false.\n if (!this.#enabled) { return valData.position; }\n\n // Determine containing bounds from manual values; or any element; lastly the browser width / height.\n const boundsWidth = this.#width ?? this.#element?.offsetWidth ?? globalThis.innerWidth;\n const boundsHeight = this.#height ?? this.#element?.offsetHeight ?? globalThis.innerHeight;\n\n // Ensure min / max width constraints when position width is a number; not 'auto' or 'inherit'. If constrain is\n // true cap width bounds.\n if (typeof valData.position.width === 'number')\n {\n const maxW = valData.maxWidth ?? (this.#constrain ? boundsWidth : Number.MAX_SAFE_INTEGER);\n valData.position.width = clamp(valData.width, valData.minWidth, maxW);\n }\n\n // Ensure min / max height constraints when position height is a number; not 'auto' or 'inherit'. If constrain\n // is true cap height bounds.\n if (typeof valData.position.height === 'number')\n {\n const maxH = valData.maxHeight ?? (this.#constrain ? boundsHeight : Number.MAX_SAFE_INTEGER);\n valData.position.height = clamp(valData.height, valData.minHeight, maxH);\n }\n\n // Get transform data. First set constraints including any margin top / left as offsets and width / height. Used\n // when position width / height is 'auto'.\n const data = valData.transforms.getData(valData.position, s_TRANSFORM_DATA, valData);\n\n // Check the bounding rectangle against browser height / width. Adjust position based on how far the overlap of\n // the bounding rect is outside the bounds height / width. The order below matters as the constraints are top /\n // left oriented, so perform those checks last.\n\n const initialX = data.boundingRect.x;\n const initialY = data.boundingRect.y;\n\n if (data.boundingRect.bottom + valData.marginTop > boundsHeight)\n {\n data.boundingRect.y += boundsHeight - data.boundingRect.bottom - valData.marginTop;\n }\n\n if (data.boundingRect.right + valData.marginLeft > boundsWidth)\n {\n data.boundingRect.x += boundsWidth - data.boundingRect.right - valData.marginLeft;\n }\n\n if (data.boundingRect.top - valData.marginTop < 0)\n {\n data.boundingRect.y += Math.abs(data.boundingRect.top - valData.marginTop);\n }\n\n if (data.boundingRect.left - valData.marginLeft < 0)\n {\n data.boundingRect.x += Math.abs(data.boundingRect.left - valData.marginLeft);\n }\n\n valData.position.left -= initialX - data.boundingRect.x;\n valData.position.top -= initialY - data.boundingRect.y;\n\n return valData.position;\n }\n}\n\nclass UpdateElementData\n{\n constructor()\n {\n /**\n * Stores the private data from TJSPosition.\n *\n * @type {TJSPositionData}\n */\n this.data = void 0;\n\n /**\n * Provides a copy of local data sent to subscribers.\n *\n * @type {TJSPositionData}\n */\n this.dataSubscribers = new TJSPositionData();\n\n /**\n * Stores the current dimension data used for the readable `dimension` store.\n *\n * @type {{width: number | 'auto', height: number | 'auto'}}\n */\n this.dimensionData = { width: 0, height: 0 };\n\n /**\n * @type {import('../PositionChangeSet').PositionChangeSet}\n */\n this.changeSet = void 0;\n\n /**\n * @type {import('../').TJSPositionOptions}\n */\n this.options = void 0;\n\n /**\n * Stores if this TJSPosition / update data is queued for update.\n *\n * @type {boolean}\n */\n this.queued = false;\n\n /**\n * @type {import('../StyleCache').StyleCache}\n */\n this.styleCache = void 0;\n\n /**\n * @type {import('../transform').TJSTransforms}\n */\n this.transforms = void 0;\n\n /**\n * Stores the current transform data used for the readable `transform` store. It is only active when there are\n * subscribers to the store or calculateTransform options is true.\n *\n * @type {TJSTransformData}\n */\n this.transformData = new TJSTransformData();\n\n /**\n * @type {(function(TJSPositionData): void)[]}\n */\n this.subscriptions = void 0;\n\n /**\n * @type {import('svelte/store').Writable<{width: (number|\"auto\"), height: (number|\"auto\")}>}\n */\n this.storeDimension = writable(this.dimensionData);\n\n // When there are subscribers set option to calculate transform updates; set to false when no subscribers.\n\n /**\n * @type {import('svelte/store').Writable}\n */\n this.storeTransform = writable(this.transformData, () =>\n {\n this.options.transformSubscribed = true;\n return () => this.options.transformSubscribed = false;\n });\n\n /**\n * Stores the queued state for update element processing.\n *\n * @type {boolean}\n */\n this.queued = false;\n\n // Seal data backing readable stores.\n Object.seal(this.dimensionData);\n }\n}\n\n/**\n * Decouples updates to any parent target HTMLElement inline styles. Invoke\n * {@link TJSPosition.elementUpdated} to await on the returned promise that is resolved with the current\n * render time via `nextAnimationFrame` / `requestAnimationFrame`. This allows the underlying data model to be updated\n * immediately while updates to the element are in sync with the browser and potentially in the future be further\n * throttled.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n */\nclass UpdateElementManager\n{\n static list = [];\n static listCntr = 0;\n\n static updatePromise;\n\n static get promise() { return this.updatePromise; }\n\n /**\n * Potentially adds the given element and internal updateData instance to the list.\n *\n * @param {HTMLElement} el - An HTMLElement instance.\n *\n * @param {import('./UpdateElementData').UpdateElementData} updateData - An UpdateElementData instance.\n *\n * @returns {Promise} The unified next frame update promise. Returns `currentTime`.\n */\n static add(el, updateData)\n {\n if (this.listCntr < this.list.length)\n {\n const entry = this.list[this.listCntr];\n entry[0] = el;\n entry[1] = updateData;\n }\n else\n {\n this.list.push([el, updateData]);\n }\n\n this.listCntr++;\n updateData.queued = true;\n\n if (!this.updatePromise) { this.updatePromise = this.wait(); }\n\n return this.updatePromise;\n }\n\n /**\n * Await on `nextAnimationFrame` and iterate over list map invoking callback functions.\n *\n * @returns {Promise} The next frame Promise / currentTime from nextAnimationFrame.\n */\n static async wait()\n {\n // Await the next animation frame. In the future this can be extended to multiple frames to divide update rate.\n const currentTime = await nextAnimationFrame();\n\n this.updatePromise = void 0;\n\n for (let cntr = this.listCntr; --cntr >= 0;)\n {\n // Obtain data for entry.\n const entry = this.list[cntr];\n const el = entry[0];\n const updateData = entry[1];\n\n // Clear entry data.\n entry[0] = void 0;\n entry[1] = void 0;\n\n // Reset queued state.\n updateData.queued = false;\n\n // Early out if the element is no longer connected to the DOM / shadow root.\n // if (!el.isConnected || !updateData.changeSet.hasChange()) { continue; }\n if (!el.isConnected) { continue; }\n\n if (updateData.options.ortho)\n {\n s_UPDATE_ELEMENT_ORTHO(el, updateData);\n }\n else\n {\n s_UPDATE_ELEMENT(el, updateData);\n }\n\n // If calculate transform options is enabled then update the transform data and set the readable store.\n if (updateData.options.calculateTransform || updateData.options.transformSubscribed)\n {\n s_UPDATE_TRANSFORM(el, updateData);\n }\n\n // Update all subscribers with changed data.\n this.updateSubscribers(updateData);\n }\n\n this.listCntr = 0;\n\n return currentTime;\n }\n\n /**\n * Potentially immediately updates the given element.\n *\n * @param {HTMLElement} el - An HTMLElement instance.\n *\n * @param {import('./UpdateElementData').UpdateElementData} updateData - An UpdateElementData instance.\n */\n static immediate(el, updateData)\n {\n // Early out if the element is no longer connected to the DOM / shadow root.\n // if (!el.isConnected || !updateData.changeSet.hasChange()) { continue; }\n if (!el.isConnected) { return; }\n\n if (updateData.options.ortho)\n {\n s_UPDATE_ELEMENT_ORTHO(el, updateData);\n }\n else\n {\n s_UPDATE_ELEMENT(el, updateData);\n }\n\n // If calculate transform options is enabled then update the transform data and set the readable store.\n if (updateData.options.calculateTransform || updateData.options.transformSubscribed)\n {\n s_UPDATE_TRANSFORM(el, updateData);\n }\n\n // Update all subscribers with changed data.\n this.updateSubscribers(updateData);\n }\n\n /**\n * @param {import('./UpdateElementData').UpdateElementData} updateData - Data change set.\n */\n static updateSubscribers(updateData)\n {\n const data = updateData.data;\n const changeSet = updateData.changeSet;\n\n if (!changeSet.hasChange()) { return; }\n\n // Make a copy of the data.\n const output = updateData.dataSubscribers.copy(data);\n\n const subscriptions = updateData.subscriptions;\n\n // Early out if there are no subscribers.\n if (subscriptions.length > 0)\n {\n for (let cntr = 0; cntr < subscriptions.length; cntr++) { subscriptions[cntr](output); }\n }\n\n // Update dimension data if width / height has changed.\n if (changeSet.width || changeSet.height)\n {\n updateData.dimensionData.width = data.width;\n updateData.dimensionData.height = data.height;\n updateData.storeDimension.set(updateData.dimensionData);\n }\n\n changeSet.set(false);\n }\n}\n\n/**\n * Decouples updates to any parent target HTMLElement inline styles. Invoke\n * {@link TJSPosition.elementUpdated} to await on the returned promise that is resolved with the current\n * render time via `nextAnimationFrame` / `requestAnimationFrame`. This allows the underlying data model to be updated\n * immediately while updates to the element are in sync with the browser and potentially in the future be further\n * throttled.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n *\n * @param {import('./UpdateElementData').UpdateElementData} updateData - Update data.\n */\nfunction s_UPDATE_ELEMENT(el, updateData)\n{\n const changeSet = updateData.changeSet;\n const data = updateData.data;\n\n if (changeSet.left)\n {\n el.style.left = `${data.left}px`;\n }\n\n if (changeSet.top)\n {\n el.style.top = `${data.top}px`;\n }\n\n if (changeSet.zIndex)\n {\n el.style.zIndex = typeof data.zIndex === 'number' ? `${data.zIndex}` : null;\n }\n\n if (changeSet.width)\n {\n el.style.width = typeof data.width === 'number' ? `${data.width}px` : data.width;\n }\n\n if (changeSet.height)\n {\n el.style.height = typeof data.height === 'number' ? `${data.height}px` : data.height;\n }\n\n if (changeSet.transformOrigin)\n {\n el.style.transformOrigin = data.transformOrigin;\n }\n\n // Update all transforms in order added to transforms object.\n if (changeSet.transform)\n {\n el.style.transform = updateData.transforms.isActive ? updateData.transforms.getCSS() : null;\n }\n}\n\n/**\n * Decouples updates to any parent target HTMLElement inline styles. Invoke\n * {@link TJSPosition.elementUpdated} to await on the returned promise that is resolved with the current\n * render time via `nextAnimationFrame` / `requestAnimationFrame`. This allows the underlying data model to be updated\n * immediately while updates to the element are in sync with the browser and potentially in the future be further\n * throttled.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n *\n * @param {import('./UpdateElementData').UpdateElementData} updateData - Update data.\n */\nfunction s_UPDATE_ELEMENT_ORTHO(el, updateData)\n{\n const changeSet = updateData.changeSet;\n const data = updateData.data;\n\n if (changeSet.zIndex)\n {\n el.style.zIndex = typeof data.zIndex === 'number' ? `${data.zIndex}` : null;\n }\n\n if (changeSet.width)\n {\n el.style.width = typeof data.width === 'number' ? `${data.width}px` : data.width;\n }\n\n if (changeSet.height)\n {\n el.style.height = typeof data.height === 'number' ? `${data.height}px` : data.height;\n }\n\n if (changeSet.transformOrigin)\n {\n el.style.transformOrigin = data.transformOrigin;\n }\n\n // Update all transforms in order added to transforms object.\n if (changeSet.left || changeSet.top || changeSet.transform)\n {\n el.style.transform = updateData.transforms.getCSSOrtho(data);\n }\n}\n\n/**\n * Updates the applied transform data and sets the readble `transform` store.\n *\n * @param {HTMLElement} el - The target HTMLElement.\n *\n * @param {import('./UpdateElementData').UpdateElementData} updateData - Update element data.\n */\nfunction s_UPDATE_TRANSFORM(el, updateData)\n{\n s_VALIDATION_DATA$1.height = updateData.data.height !== 'auto' ? updateData.data.height :\n updateData.styleCache.offsetHeight;\n\n s_VALIDATION_DATA$1.width = updateData.data.width !== 'auto' ? updateData.data.width :\n updateData.styleCache.offsetWidth;\n\n s_VALIDATION_DATA$1.marginLeft = updateData.styleCache.marginLeft;\n\n s_VALIDATION_DATA$1.marginTop = updateData.styleCache.marginTop;\n\n // Get transform data. First set constraints including any margin top / left as offsets and width / height. Used\n // when position width / height is 'auto'.\n updateData.transforms.getData(updateData.data, updateData.transformData, s_VALIDATION_DATA$1);\n\n updateData.storeTransform.set(updateData.transformData);\n}\n\nconst s_VALIDATION_DATA$1 = {\n height: void 0,\n width: void 0,\n marginLeft: void 0,\n marginTop: void 0\n};\n\n/**\n * Provides a store for position following the subscriber protocol in addition to providing individual writable derived\n * stores for each independent variable.\n */\nclass TJSPosition\n{\n /**\n * @type {{browserCentered: Centered, Centered: Centered}}\n */\n static #positionInitial = {\n browserCentered: new Centered({ lock: true }),\n Centered\n };\n\n /**\n * @type {{TransformBounds: TransformBounds, BasicBounds: BasicBounds, basicWindow: BasicBounds, transformWindow: TransformBounds}}\n */\n static #positionValidators = {\n basicWindow: new BasicBounds({ lock: true }),\n BasicBounds,\n transformWindow: new TransformBounds({ lock: true }),\n TransformBounds\n };\n\n /**\n * @type {TJSPositionData}\n */\n #data = new TJSPositionData();\n\n /**\n * Provides the animation API.\n *\n * @type {AnimationAPI}\n */\n #animate = new AnimationAPI(this, this.#data);\n\n /**\n * Provides a way to turn on / off the position handling.\n *\n * @type {boolean}\n */\n #enabled = true;\n\n /**\n * Stores ongoing options that are set in the constructor or by transform store subscription.\n *\n * @type {import('./').TJSPositionOptions}\n */\n #options = {\n calculateTransform: false,\n initialHelper: void 0,\n ortho: true,\n transformSubscribed: false\n };\n\n /**\n * The associated parent for positional data tracking. Used in validators.\n *\n * @type {import('./').TJSPositionParent}\n */\n #parent;\n\n /**\n * Stores the style attributes that changed on update.\n *\n * @type {PositionChangeSet}\n */\n #positionChangeSet = new PositionChangeSet();\n\n /**\n * @type {import('./').TJSPositionStores}\n */\n #stores;\n\n /**\n * Stores an instance of the computer styles for the target element.\n *\n * @type {StyleCache}\n */\n #styleCache;\n\n /**\n * Stores the subscribers.\n *\n * @type {import('svelte/store').Subscriber[]}\n */\n #subscriptions = [];\n\n /**\n * @type {TJSTransforms}\n */\n #transforms = new TJSTransforms();\n\n /**\n * @type {UpdateElementData}\n */\n #updateElementData;\n\n /**\n * Stores the UpdateElementManager wait promise.\n *\n * @type {Promise}\n */\n #updateElementPromise;\n\n /**\n * @type {AdapterValidators}\n */\n #validators;\n\n /**\n * @type {import('./').ValidatorData[]}\n */\n #validatorData;\n\n /**\n * @type {PositionStateAPI}\n */\n #state = new PositionStateAPI(this, this.#data, this.#transforms);\n\n /**\n * @returns {AnimationGroupAPI} Public Animation API.\n */\n static get Animate() { return AnimationGroupAPI; }\n\n /**\n * @returns {{browserCentered: Centered, Centered: Centered}} TJSPosition initial API.\n */\n static get Initial() { return this.#positionInitial; }\n\n /**\n * Returns TJSTransformData class / constructor.\n *\n * @returns {TJSTransformData} TJSTransformData class / constructor.\n */\n static get TransformData() { return TJSTransformData; }\n\n /**\n * Returns default validators.\n *\n * Note: `basicWindow` and `BasicBounds` will eventually be removed.\n *\n * @returns {{TransformBounds: TransformBounds, BasicBounds: BasicBounds, basicWindow: BasicBounds, transformWindow: TransformBounds}}\n * Available validators.\n */\n static get Validators() { return this.#positionValidators; }\n\n /**\n * Returns a duplicate of a given position instance copying any options and validators.\n *\n * // TODO: Consider more safety over options processing.\n *\n * @param {TJSPosition} position - A position instance.\n *\n * @param {import('./').TJSPositionOptions} options - TJSPosition options.\n *\n * @returns {TJSPosition} A duplicate position instance.\n */\n static duplicate(position, options)\n {\n if (!(position instanceof TJSPosition)) { throw new TypeError(`'position' is not an instance of Position.`); }\n\n const newPosition = new TJSPosition(options);\n\n newPosition.#options = Object.assign({}, position.#options, options);\n newPosition.#validators.add(...position.#validators);\n\n newPosition.set(position.#data);\n\n return newPosition;\n }\n\n /**\n * @param {import('./').TJSPositionParent | import('./').TJSPositionOptionsAll} [parent] - A\n * potential parent element or object w/ `elementTarget` getter. May also be the TJSPositionOptions object\n * w/ 1 argument.\n *\n * @param {import('./').TJSPositionOptionsAll} [options] - Default values.\n */\n constructor(parent, options)\n {\n // Test if `parent` is a plain object; if so treat as options object.\n if (isPlainObject(parent))\n {\n options = parent;\n }\n else\n {\n this.#parent = parent;\n }\n\n const data = this.#data;\n const transforms = this.#transforms;\n\n this.#styleCache = new StyleCache();\n\n const updateData = new UpdateElementData();\n\n updateData.changeSet = this.#positionChangeSet;\n updateData.data = this.#data;\n updateData.options = this.#options;\n updateData.styleCache = this.#styleCache;\n updateData.subscriptions = this.#subscriptions;\n updateData.transforms = this.#transforms;\n\n this.#updateElementData = updateData;\n\n if (isObject(options))\n {\n // Set TJSPosition options\n if (typeof options.calculateTransform === 'boolean')\n {\n this.#options.calculateTransform = options.calculateTransform;\n }\n\n if (typeof options.ortho === 'boolean')\n {\n this.#options.ortho = options.ortho;\n }\n\n // Set default values from options.\n\n if (Number.isFinite(options.height) || options.height === 'auto' || options.height === 'inherit' ||\n options.height === null)\n {\n data.height = updateData.dimensionData.height = typeof options.height === 'number' ?\n Math.round(options.height) : options.height;\n }\n\n if (Number.isFinite(options.left) || options.left === null)\n {\n data.left = typeof options.left === 'number' ? Math.round(options.left) : options.left;\n }\n\n if (Number.isFinite(options.maxHeight) || options.maxHeight === null)\n {\n data.maxHeight = typeof options.maxHeight === 'number' ? Math.round(options.maxHeight) : options.maxHeight;\n }\n\n if (Number.isFinite(options.maxWidth) || options.maxWidth === null)\n {\n data.maxWidth = typeof options.maxWidth === 'number' ? Math.round(options.maxWidth) : options.maxWidth;\n }\n\n if (Number.isFinite(options.minHeight) || options.minHeight === null)\n {\n data.minHeight = typeof options.minHeight === 'number' ? Math.round(options.minHeight) : options.minHeight;\n }\n\n if (Number.isFinite(options.minWidth) || options.minWidth === null)\n {\n data.minWidth = typeof options.minWidth === 'number' ? Math.round(options.minWidth) : options.minWidth;\n }\n\n if (Number.isFinite(options.rotateX) || options.rotateX === null)\n {\n transforms.rotateX = data.rotateX = options.rotateX;\n }\n\n if (Number.isFinite(options.rotateY) || options.rotateY === null)\n {\n transforms.rotateY = data.rotateY = options.rotateY;\n }\n\n if (Number.isFinite(options.rotateZ) || options.rotateZ === null)\n {\n transforms.rotateZ = data.rotateZ = options.rotateZ;\n }\n\n if (Number.isFinite(options.scale) || options.scale === null)\n {\n transforms.scale = data.scale = options.scale;\n }\n\n if (Number.isFinite(options.top) || options.top === null)\n {\n data.top = typeof options.top === 'number' ? Math.round(options.top) : options.top;\n }\n\n if (typeof options.transformOrigin === 'string' || options.transformOrigin === null)\n {\n data.transformOrigin = transformOrigins.includes(options.transformOrigin) ?\n options.transformOrigin : null;\n }\n\n if (Number.isFinite(options.translateX) || options.translateX === null)\n {\n transforms.translateX = data.translateX = options.translateX;\n }\n\n if (Number.isFinite(options.translateY) || options.translateY === null)\n {\n transforms.translateY = data.translateY = options.translateY;\n }\n\n if (Number.isFinite(options.translateZ) || options.translateZ === null)\n {\n transforms.translateZ = data.translateZ = options.translateZ;\n }\n\n if (Number.isFinite(options.width) || options.width === 'auto' || options.width === 'inherit' ||\n options.width === null)\n {\n data.width = updateData.dimensionData.width = typeof options.width === 'number' ?\n Math.round(options.width) : options.width;\n }\n\n if (Number.isFinite(options.zIndex) || options.zIndex === null)\n {\n data.zIndex = typeof options.zIndex === 'number' ? Math.round(options.zIndex) : options.zIndex;\n }\n }\n\n this.#stores = {\n // The main properties for manipulating TJSPosition.\n height: propertyStore(this, 'height'),\n left: propertyStore(this, 'left'),\n rotateX: propertyStore(this, 'rotateX'),\n rotateY: propertyStore(this, 'rotateY'),\n rotateZ: propertyStore(this, 'rotateZ'),\n scale: propertyStore(this, 'scale'),\n top: propertyStore(this, 'top'),\n transformOrigin: propertyStore(this, 'transformOrigin'),\n translateX: propertyStore(this, 'translateX'),\n translateY: propertyStore(this, 'translateY'),\n translateZ: propertyStore(this, 'translateZ'),\n width: propertyStore(this, 'width'),\n zIndex: propertyStore(this, 'zIndex'),\n\n // Stores that control validation when width / height is not `auto`.\n maxHeight: propertyStore(this, 'maxHeight'),\n maxWidth: propertyStore(this, 'maxWidth'),\n minHeight: propertyStore(this, 'minHeight'),\n minWidth: propertyStore(this, 'minWidth'),\n\n // Readable stores based on updates or from resize observer changes.\n dimension: { subscribe: updateData.storeDimension.subscribe },\n element: { subscribe: this.#styleCache.stores.element.subscribe },\n resizeContentHeight: { subscribe: this.#styleCache.stores.resizeContentHeight.subscribe },\n resizeContentWidth: { subscribe: this.#styleCache.stores.resizeContentWidth.subscribe },\n resizeOffsetHeight: { subscribe: this.#styleCache.stores.resizeOffsetHeight.subscribe },\n resizeOffsetWidth: { subscribe: this.#styleCache.stores.resizeOffsetWidth.subscribe },\n transform: { subscribe: updateData.storeTransform.subscribe },\n\n // Protected store that should only be set by resizeObserver action.\n resizeObserved: this.#styleCache.stores.resizeObserved,\n };\n\n // When resize change from any applied resizeObserver action automatically set data for new validation run.\n // A resizeObserver prop should be set to true for ApplicationShell components or usage of resizeObserver action\n // to monitor for changes. This should only be used on elements that have 'auto' for width or height.\n subscribeIgnoreFirst(this.#stores.resizeObserved, (resizeData) =>\n {\n const parent = this.#parent;\n const el = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n\n // Only invoke set if there is a target element and the resize data has a valid offset width & height.\n if (el instanceof HTMLElement && Number.isFinite(resizeData?.offsetWidth) &&\n Number.isFinite(resizeData?.offsetHeight))\n {\n this.set(data);\n }\n });\n\n this.#stores.transformOrigin.values = transformOrigins;\n\n [this.#validators, this.#validatorData] = new AdapterValidators();\n\n if (options?.initial || options?.positionInitial)\n {\n const initialHelper = options.initial ?? options.positionInitial;\n\n if (typeof initialHelper?.getLeft !== 'function' || typeof initialHelper?.getTop !== 'function')\n {\n throw new Error(\n `'options.initial' position helper does not contain 'getLeft' and / or 'getTop' functions.`);\n }\n\n this.#options.initialHelper = options.initial;\n }\n\n if (options?.validator)\n {\n if (isIterable(options?.validator)) { this.validators.add(...options.validator); }\n else { this.validators.add(options.validator); }\n }\n }\n\n /**\n * Returns the animation API.\n *\n * @returns {AnimationAPI} Animation API.\n */\n get animate()\n {\n return this.#animate;\n }\n\n /**\n * Returns the dimension data for the readable store.\n *\n * @returns {{width: number | 'auto', height: number | 'auto'}} Dimension data.\n */\n get dimension()\n {\n return this.#updateElementData.dimensionData;\n }\n\n /**\n * Returns the enabled state.\n *\n * @returns {boolean} Enabled state.\n */\n get enabled()\n {\n return this.#enabled;\n }\n\n /**\n * Returns the current HTMLElement being positioned.\n *\n * @returns {HTMLElement|undefined} Current HTMLElement being positioned.\n */\n get element()\n {\n return this.#styleCache.el;\n }\n\n /**\n * Returns a promise that is resolved on the next element update with the time of the update.\n *\n * @returns {Promise} Promise resolved on element update.\n */\n get elementUpdated()\n {\n return this.#updateElementPromise;\n }\n\n /**\n * Returns the associated {@link TJSPositionParent} instance.\n *\n * @returns {import('./').TJSPositionParent} The TJSPositionParent instance.\n */\n get parent() { return this.#parent; }\n\n /**\n * Returns the state API.\n *\n * @returns {import('./PositionStateAPI').PositionStateAPI} TJSPosition state API.\n */\n get state() { return this.#state; }\n\n /**\n * Returns the derived writable stores for individual data variables.\n *\n * @returns {import('./').TJSPositionStores} Derived / writable stores.\n */\n get stores() { return this.#stores; }\n\n /**\n * Returns the transform data for the readable store.\n *\n * @returns {TJSTransformData} Transform Data.\n */\n get transform()\n {\n return this.#updateElementData.transformData;\n }\n\n /**\n * Returns the validators.\n *\n * @returns {AdapterValidators} validators.\n */\n get validators() { return this.#validators; }\n\n /**\n * Sets the enabled state.\n *\n * @param {boolean} enabled - New enabled state.\n */\n set enabled(enabled)\n {\n if (typeof enabled !== 'boolean')\n {\n throw new TypeError(`'enabled' is not a boolean.`);\n }\n\n this.#enabled = enabled;\n }\n\n /**\n * Sets the associated {@link TJSPositionParent} instance. Resets the style cache and default data.\n *\n * @param {import('./').TJSPositionParent} parent - A TJSPositionParent instance.\n */\n set parent(parent)\n {\n if (parent !== void 0 && !(parent instanceof HTMLElement) && !isObject(parent))\n {\n throw new TypeError(`'parent' is not an HTMLElement, object, or undefined.`);\n }\n\n this.#parent = parent;\n\n // Reset any stored default data & the style cache.\n this.#state.remove({ name: '#defaultData' });\n this.#styleCache.reset();\n\n // If a parent is defined then invoke set to update any parent element.\n if (parent) { this.set(this.#data); }\n }\n\n// Data accessors ----------------------------------------------------------------------------------------------------\n\n /**\n * @returns {number|'auto'|'inherit'|null} height\n */\n get height() { return this.#data.height; }\n\n /**\n * @returns {number|null} left\n */\n get left() { return this.#data.left; }\n\n /**\n * @returns {number|null} maxHeight\n */\n get maxHeight() { return this.#data.maxHeight; }\n\n /**\n * @returns {number|null} maxWidth\n */\n get maxWidth() { return this.#data.maxWidth; }\n\n /**\n * @returns {number|null} minHeight\n */\n get minHeight() { return this.#data.minHeight; }\n\n /**\n * @returns {number|null} minWidth\n */\n get minWidth() { return this.#data.minWidth; }\n\n /**\n * @returns {number|null} rotateX\n */\n get rotateX() { return this.#data.rotateX; }\n\n /**\n * @returns {number|null} rotateY\n */\n get rotateY() { return this.#data.rotateY; }\n\n /**\n * @returns {number|null} rotateZ\n */\n get rotateZ() { return this.#data.rotateZ; }\n\n /**\n * @returns {number|null} alias for rotateZ\n */\n get rotation() { return this.#data.rotateZ; }\n\n /**\n * @returns {number|null} scale\n */\n get scale() { return this.#data.scale; }\n\n /**\n * @returns {number|null} top\n */\n get top() { return this.#data.top; }\n\n /**\n * @returns {import('./').TJSTransformOrigin} transformOrigin\n */\n get transformOrigin() { return this.#data.transformOrigin; }\n\n /**\n * @returns {number|null} translateX\n */\n get translateX() { return this.#data.translateX; }\n\n /**\n * @returns {number|null} translateY\n */\n get translateY() { return this.#data.translateY; }\n\n /**\n * @returns {number|null} translateZ\n */\n get translateZ() { return this.#data.translateZ; }\n\n /**\n * @returns {number|'auto'|'inherit'|null} width\n */\n get width() { return this.#data.width; }\n\n /**\n * @returns {number|null} z-index\n */\n get zIndex() { return this.#data.zIndex; }\n\n /**\n * @param {number|string|null} height -\n */\n set height(height)\n {\n this.#stores.height.set(height);\n }\n\n /**\n * @param {number|string|null} left -\n */\n set left(left)\n {\n this.#stores.left.set(left);\n }\n\n /**\n * @param {number|string|null} maxHeight -\n */\n set maxHeight(maxHeight)\n {\n this.#stores.maxHeight.set(maxHeight);\n }\n\n /**\n * @param {number|string|null} maxWidth -\n */\n set maxWidth(maxWidth)\n {\n this.#stores.maxWidth.set(maxWidth);\n }\n\n /**\n * @param {number|string|null} minHeight -\n */\n set minHeight(minHeight)\n {\n this.#stores.minHeight.set(minHeight);\n }\n\n /**\n * @param {number|string|null} minWidth -\n */\n set minWidth(minWidth)\n {\n this.#stores.minWidth.set(minWidth);\n }\n\n /**\n * @param {number|string|null} rotateX -\n */\n set rotateX(rotateX)\n {\n this.#stores.rotateX.set(rotateX);\n }\n\n /**\n * @param {number|string|null} rotateY -\n */\n set rotateY(rotateY)\n {\n this.#stores.rotateY.set(rotateY);\n }\n\n /**\n * @param {number|string|null} rotateZ -\n */\n set rotateZ(rotateZ)\n {\n this.#stores.rotateZ.set(rotateZ);\n }\n\n /**\n * @param {number|string|null} rotateZ - alias for rotateZ\n */\n set rotation(rotateZ)\n {\n this.#stores.rotateZ.set(rotateZ);\n }\n\n /**\n * @param {number|string|null} scale -\n */\n set scale(scale)\n {\n this.#stores.scale.set(scale);\n }\n\n /**\n * @param {number|string|null} top -\n */\n set top(top)\n {\n this.#stores.top.set(top);\n }\n\n /**\n * @param {import('./').TJSTransformOrigin} transformOrigin -\n */\n set transformOrigin(transformOrigin)\n {\n if (transformOrigins.includes(transformOrigin)) { this.#stores.transformOrigin.set(transformOrigin); }\n }\n\n /**\n * @param {number|string|null} translateX -\n */\n set translateX(translateX)\n {\n this.#stores.translateX.set(translateX);\n }\n\n /**\n * @param {number|string|null} translateY -\n */\n set translateY(translateY)\n {\n this.#stores.translateY.set(translateY);\n }\n\n /**\n * @param {number|string|null} translateZ -\n */\n set translateZ(translateZ)\n {\n this.#stores.translateZ.set(translateZ);\n }\n\n /**\n * @param {number|string|null} width -\n */\n set width(width)\n {\n this.#stores.width.set(width);\n }\n\n /**\n * @param {number|string|null} zIndex -\n */\n set zIndex(zIndex)\n {\n this.#stores.zIndex.set(zIndex);\n }\n\n /**\n * Assigns current position to object passed into method.\n *\n * @param {object|TJSPositionData} [position] - Target to assign current position data.\n *\n * @param {import('./').TJSPositionGetOptions} [options] - Defines options for specific keys and substituting null\n * for numeric default values.\n *\n * @returns {TJSPositionData} Passed in object with current position data.\n */\n get(position = {}, options)\n {\n const keys = options?.keys;\n const excludeKeys = options?.exclude;\n const numeric = options?.numeric ?? false;\n\n if (isIterable(keys))\n {\n // Replace any null values potentially with numeric default values.\n if (numeric)\n {\n for (const key of keys) { position[key] = this[key] ?? numericDefaults[key]; }\n }\n else // Accept current values.\n {\n for (const key of keys) { position[key] = this[key]; }\n }\n\n // Remove any excluded keys.\n if (isIterable(excludeKeys))\n {\n for (const key of excludeKeys) { delete position[key]; }\n }\n\n return position;\n }\n else\n {\n const data = Object.assign(position, this.#data);\n\n // Remove any excluded keys.\n if (isIterable(excludeKeys))\n {\n for (const key of excludeKeys) { delete data[key]; }\n }\n\n // Potentially set numeric defaults.\n if (numeric) { setNumericDefaults(data); }\n\n return data;\n }\n }\n\n /**\n * @returns {TJSPositionData} Current position data.\n */\n toJSON()\n {\n return Object.assign({}, this.#data);\n }\n\n /**\n * All calculation and updates of position are implemented in {@link TJSPosition}. This allows position to be fully\n * reactive and in control of updating inline styles for the application.\n *\n * Note: the logic for updating position is improved and changes a few aspects from the default\n * {@link globalThis.Application.setPosition}. The gate on `popOut` is removed, so to ensure no positional\n * application occurs popOut applications can set `this.options.positionable` to false ensuring no positional inline\n * styles are applied.\n *\n * The initial set call on an application with a target element will always set width / height as this is\n * necessary for correct calculations.\n *\n * When a target element is present updated styles are applied after validation. To modify the behavior of set\n * implement one or more validator functions and add them from the application via\n * `this.position.validators.add()`.\n *\n * Updates to any target element are decoupled from the underlying TJSPosition data. This method returns this instance\n * that you can then await on the target element inline style update by using {@link TJSPosition.elementUpdated}.\n *\n * @param {import('./').TJSPositionDataExtended} [position] - TJSPosition data to set.\n *\n * @returns {TJSPosition} This TJSPosition instance.\n */\n set(position = {})\n {\n if (!isObject(position)) { throw new TypeError(`Position - set error: 'position' is not an object.`); }\n\n const parent = this.#parent;\n\n // An early out to prevent `set` from taking effect if not enabled.\n if (!this.#enabled)\n {\n return this;\n }\n\n // An early out to prevent `set` from taking effect if options `positionable` is false.\n if (parent !== void 0 && typeof parent?.options?.positionable === 'boolean' && !parent?.options?.positionable)\n {\n return this;\n }\n\n // Callers can specify to immediately update an associated element. This is useful if set is called from\n // requestAnimationFrame / rAF. Library integrations like GSAP invoke set from rAF.\n const immediateElementUpdate = position.immediateElementUpdate === true;\n\n const data = this.#data;\n const transforms = this.#transforms;\n\n // Find the target HTML element and verify that it is connected storing it in `el`.\n const targetEl = parent instanceof HTMLElement ? parent : parent?.elementTarget;\n const el = targetEl instanceof HTMLElement && targetEl.isConnected ? targetEl : void 0;\n\n const changeSet = this.#positionChangeSet;\n const styleCache = this.#styleCache;\n\n if (el)\n {\n // Cache the computed styles of the element.\n if (!styleCache.hasData(el))\n {\n styleCache.update(el);\n\n // Add will-change property if not already set in inline or computed styles.\n if (!styleCache.hasWillChange)\n ;\n\n // Update all properties / clear queued state.\n changeSet.set(true);\n this.#updateElementData.queued = false;\n }\n\n // Converts any relative string position data to numeric inputs.\n convertRelative(position, this);\n\n position = this.#updatePosition(position, parent, el, styleCache);\n\n // Check if a validator cancelled the update.\n if (position === null) { return this; }\n }\n\n if (Number.isFinite(position.left))\n {\n position.left = Math.round(position.left);\n\n if (data.left !== position.left) { data.left = position.left; changeSet.left = true; }\n }\n\n if (Number.isFinite(position.top))\n {\n position.top = Math.round(position.top);\n\n if (data.top !== position.top) { data.top = position.top; changeSet.top = true; }\n }\n\n if (Number.isFinite(position.maxHeight) || position.maxHeight === null)\n {\n position.maxHeight = typeof position.maxHeight === 'number' ? Math.round(position.maxHeight) : null;\n\n if (data.maxHeight !== position.maxHeight) { data.maxHeight = position.maxHeight; changeSet.maxHeight = true; }\n }\n\n if (Number.isFinite(position.maxWidth) || position.maxWidth === null)\n {\n position.maxWidth = typeof position.maxWidth === 'number' ? Math.round(position.maxWidth) : null;\n\n if (data.maxWidth !== position.maxWidth) { data.maxWidth = position.maxWidth; changeSet.maxWidth = true; }\n }\n\n if (Number.isFinite(position.minHeight) || position.minHeight === null)\n {\n position.minHeight = typeof position.minHeight === 'number' ? Math.round(position.minHeight) : null;\n\n if (data.minHeight !== position.minHeight) { data.minHeight = position.minHeight; changeSet.minHeight = true; }\n }\n\n if (Number.isFinite(position.minWidth) || position.minWidth === null)\n {\n position.minWidth = typeof position.minWidth === 'number' ? Math.round(position.minWidth) : null;\n\n if (data.minWidth !== position.minWidth) { data.minWidth = position.minWidth; changeSet.minWidth = true; }\n }\n\n if (Number.isFinite(position.rotateX) || position.rotateX === null)\n {\n if (data.rotateX !== position.rotateX)\n {\n data.rotateX = transforms.rotateX = position.rotateX;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.rotateY) || position.rotateY === null)\n {\n if (data.rotateY !== position.rotateY)\n {\n data.rotateY = transforms.rotateY = position.rotateY;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.rotateZ) || position.rotateZ === null)\n {\n if (data.rotateZ !== position.rotateZ)\n {\n data.rotateZ = transforms.rotateZ = position.rotateZ;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.scale) || position.scale === null)\n {\n position.scale = typeof position.scale === 'number' ? Math.max(0, Math.min(position.scale, 1000)) : null;\n\n if (data.scale !== position.scale)\n {\n data.scale = transforms.scale = position.scale;\n changeSet.transform = true;\n }\n }\n\n if ((typeof position.transformOrigin === 'string' && transformOrigins.includes(\n position.transformOrigin)) || position.transformOrigin === null)\n {\n if (data.transformOrigin !== position.transformOrigin)\n {\n data.transformOrigin = position.transformOrigin;\n changeSet.transformOrigin = true;\n }\n }\n\n if (Number.isFinite(position.translateX) || position.translateX === null)\n {\n if (data.translateX !== position.translateX)\n {\n data.translateX = transforms.translateX = position.translateX;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.translateY) || position.translateY === null)\n {\n if (data.translateY !== position.translateY)\n {\n data.translateY = transforms.translateY = position.translateY;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.translateZ) || position.translateZ === null)\n {\n if (data.translateZ !== position.translateZ)\n {\n data.translateZ = transforms.translateZ = position.translateZ;\n changeSet.transform = true;\n }\n }\n\n if (Number.isFinite(position.zIndex))\n {\n position.zIndex = Math.round(position.zIndex);\n\n if (data.zIndex !== position.zIndex) { data.zIndex = position.zIndex; changeSet.zIndex = true; }\n }\n\n if (Number.isFinite(position.width) || position.width === 'auto' || position.width === 'inherit' ||\n position.width === null)\n {\n position.width = typeof position.width === 'number' ? Math.round(position.width) : position.width;\n\n if (data.width !== position.width) { data.width = position.width; changeSet.width = true; }\n }\n\n if (Number.isFinite(position.height) || position.height === 'auto' || position.height === 'inherit' ||\n position.height === null)\n {\n position.height = typeof position.height === 'number' ? Math.round(position.height) : position.height;\n\n if (data.height !== position.height) { data.height = position.height; changeSet.height = true; }\n }\n\n if (el)\n {\n const defaultData = this.#state.getDefault();\n\n // Set default data after first set operation that has a target element.\n if (!isObject(defaultData)) { this.#state.save({ name: '#defaultData', ...Object.assign({}, data) }); }\n\n // If `immediateElementUpdate` is true in position data passed to `set` then update the element immediately.\n // This is for rAF based library integrations like GSAP.\n if (immediateElementUpdate)\n {\n UpdateElementManager.immediate(el, this.#updateElementData);\n this.#updateElementPromise = Promise.resolve(performance.now());\n }\n // Else if not queued then queue an update for the next rAF callback.\n else if (!this.#updateElementData.queued)\n {\n this.#updateElementPromise = UpdateElementManager.add(el, this.#updateElementData);\n }\n }\n else\n {\n // Notify main store subscribers.\n UpdateElementManager.updateSubscribers(this.#updateElementData);\n }\n\n return this;\n }\n\n /**\n * @param {import('svelte/store').Subscriber} handler - Callback function that is invoked on\n * update / changes. Receives a copy of the TJSPositionData.\n *\n * @returns {import('svelte/store').Unsubscriber} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n\n handler(Object.assign({}, this.#data)); // call handler with current value\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n\n /**\n * @param {import('./').TJSPositionDataExtended} opts -\n *\n * @param {number|null} opts.left -\n *\n * @param {number|null} opts.top -\n *\n * @param {number|null} opts.maxHeight -\n *\n * @param {number|null} opts.maxWidth -\n *\n * @param {number|null} opts.minHeight -\n *\n * @param {number|null} opts.minWidth -\n *\n * @param {number|'auto'|null} opts.width -\n *\n * @param {number|'auto'|null} opts.height -\n *\n * @param {number|null} opts.rotateX -\n *\n * @param {number|null} opts.rotateY -\n *\n * @param {number|null} opts.rotateZ -\n *\n * @param {number|null} opts.scale -\n *\n * @param {string} opts.transformOrigin -\n *\n * @param {number|null} opts.translateX -\n *\n * @param {number|null} opts.translateY -\n *\n * @param {number|null} opts.translateZ -\n *\n * @param {number|null} opts.zIndex -\n *\n * @param {number|null} opts.rotation - alias for rotateZ\n *\n * @param {*} opts.rest -\n *\n * @param {object} parent -\n *\n * @param {HTMLElement} el -\n *\n * @param {StyleCache} styleCache -\n *\n * @returns {null|TJSPositionData} Updated position data or null if validation fails.\n */\n #updatePosition({\n // Directly supported parameters\n left, top, maxWidth, maxHeight, minWidth, minHeight, width, height, rotateX, rotateY, rotateZ, scale,\n transformOrigin, translateX, translateY, translateZ, zIndex,\n\n // Aliased parameters\n rotation,\n\n ...rest\n } = {}, parent, el, styleCache)\n {\n let currentPosition = s_DATA_UPDATE.copy(this.#data);\n\n // Update width if an explicit value is passed, or if no width value is set on the element.\n if (el.style.width === '' || width !== void 0)\n {\n if (width === 'auto' || (currentPosition.width === 'auto' && width !== null))\n {\n currentPosition.width = 'auto';\n width = styleCache.offsetWidth;\n }\n else if (width === 'inherit' || (currentPosition.width === 'inherit' && width !== null))\n {\n currentPosition.width = 'inherit';\n width = styleCache.offsetWidth;\n }\n else\n {\n const newWidth = Number.isFinite(width) ? width : currentPosition.width;\n currentPosition.width = width = Number.isFinite(newWidth) ? Math.round(newWidth) : styleCache.offsetWidth;\n }\n }\n else\n {\n width = Number.isFinite(currentPosition.width) ? currentPosition.width : styleCache.offsetWidth;\n }\n\n // Update height if an explicit value is passed, or if no height value is set on the element.\n if (el.style.height === '' || height !== void 0)\n {\n if (height === 'auto' || (currentPosition.height === 'auto' && height !== null))\n {\n currentPosition.height = 'auto';\n height = styleCache.offsetHeight;\n }\n else if (height === 'inherit' || (currentPosition.height === 'inherit' && height !== null))\n {\n currentPosition.height = 'inherit';\n height = styleCache.offsetHeight;\n }\n else\n {\n const newHeight = Number.isFinite(height) ? height : currentPosition.height;\n currentPosition.height = height = Number.isFinite(newHeight) ? Math.round(newHeight) :\n styleCache.offsetHeight;\n }\n }\n else\n {\n height = Number.isFinite(currentPosition.height) ? currentPosition.height : styleCache.offsetHeight;\n }\n\n // Update left\n if (Number.isFinite(left))\n {\n currentPosition.left = left;\n }\n else if (!Number.isFinite(currentPosition.left))\n {\n // Potentially use any initial position helper if available or set to 0.\n currentPosition.left = typeof this.#options.initialHelper?.getLeft === 'function' ?\n this.#options.initialHelper.getLeft(width) : 0;\n }\n\n // Update top\n if (Number.isFinite(top))\n {\n currentPosition.top = top;\n }\n else if (!Number.isFinite(currentPosition.top))\n {\n // Potentially use any initial position helper if available or set to 0.\n currentPosition.top = typeof this.#options.initialHelper?.getTop === 'function' ?\n this.#options.initialHelper.getTop(height) : 0;\n }\n\n if (Number.isFinite(maxHeight) || maxHeight === null)\n {\n currentPosition.maxHeight = Number.isFinite(maxHeight) ? Math.round(maxHeight) : null;\n }\n\n if (Number.isFinite(maxWidth) || maxWidth === null)\n {\n currentPosition.maxWidth = Number.isFinite(maxWidth) ? Math.round(maxWidth) : null;\n }\n\n if (Number.isFinite(minHeight) || minHeight === null)\n {\n currentPosition.minHeight = Number.isFinite(minHeight) ? Math.round(minHeight) : null;\n }\n\n if (Number.isFinite(minWidth) || minWidth === null)\n {\n currentPosition.minWidth = Number.isFinite(minWidth) ? Math.round(minWidth) : null;\n }\n\n // Update rotate X/Y/Z, scale, z-index\n if (Number.isFinite(rotateX) || rotateX === null) { currentPosition.rotateX = rotateX; }\n if (Number.isFinite(rotateY) || rotateY === null) { currentPosition.rotateY = rotateY; }\n\n // Handle alias for rotateZ. First check if `rotateZ` is valid and different from the current value. Next check if\n // `rotation` is valid and use it for `rotateZ`.\n if (rotateZ !== currentPosition.rotateZ && (Number.isFinite(rotateZ) || rotateZ === null))\n {\n currentPosition.rotateZ = rotateZ;\n }\n else if (rotation !== currentPosition.rotateZ && (Number.isFinite(rotation) || rotation === null))\n {\n currentPosition.rotateZ = rotation;\n }\n\n if (Number.isFinite(translateX) || translateX === null) { currentPosition.translateX = translateX; }\n if (Number.isFinite(translateY) || translateY === null) { currentPosition.translateY = translateY; }\n if (Number.isFinite(translateZ) || translateZ === null) { currentPosition.translateZ = translateZ; }\n\n if (Number.isFinite(scale) || scale === null)\n {\n currentPosition.scale = typeof scale === 'number' ? Math.max(0, Math.min(scale, 1000)) : null;\n }\n\n if (typeof transformOrigin === 'string' || transformOrigin === null)\n {\n currentPosition.transformOrigin = transformOrigins.includes(transformOrigin) ? transformOrigin :\n null;\n }\n\n if (Number.isFinite(zIndex) || zIndex === null)\n {\n currentPosition.zIndex = typeof zIndex === 'number' ? Math.round(zIndex) : zIndex;\n }\n\n const validatorData = this.#validatorData;\n\n // If there are any validators allow them to potentially modify position data or reject the update.\n if (this.#validators.enabled && validatorData.length)\n {\n s_VALIDATION_DATA.parent = parent;\n\n s_VALIDATION_DATA.el = el;\n\n s_VALIDATION_DATA.computed = styleCache.computed;\n\n s_VALIDATION_DATA.transforms = this.#transforms;\n\n s_VALIDATION_DATA.height = height;\n\n s_VALIDATION_DATA.width = width;\n\n s_VALIDATION_DATA.marginLeft = styleCache.marginLeft;\n\n s_VALIDATION_DATA.marginTop = styleCache.marginTop;\n\n s_VALIDATION_DATA.maxHeight = styleCache.maxHeight ?? currentPosition.maxHeight;\n\n s_VALIDATION_DATA.maxWidth = styleCache.maxWidth ?? currentPosition.maxWidth;\n\n // Given a parent w/ reactive state and is minimized ignore styleCache min-width/height.\n const isMinimized = parent?.reactive?.minimized ?? false;\n\n // Note the use of || for accessing the style cache as the left hand is ignored w/ falsy values such as '0'.\n s_VALIDATION_DATA.minHeight = isMinimized ? currentPosition.minHeight ?? 0 :\n styleCache.minHeight || (currentPosition.minHeight ?? 0);\n\n s_VALIDATION_DATA.minWidth = isMinimized ? currentPosition.minWidth ?? 0 :\n styleCache.minWidth || (currentPosition.minWidth ?? 0);\n\n for (let cntr = 0; cntr < validatorData.length; cntr++)\n {\n s_VALIDATION_DATA.position = currentPosition;\n s_VALIDATION_DATA.rest = rest;\n currentPosition = validatorData[cntr].validator(s_VALIDATION_DATA);\n\n if (currentPosition === null) { return null; }\n }\n }\n\n // Return the updated position object.\n return currentPosition;\n }\n}\n\nconst s_DATA_UPDATE = new TJSPositionData();\n\n/**\n * @type {import('./').ValidationData}\n */\nconst s_VALIDATION_DATA = {\n position: void 0,\n parent: void 0,\n el: void 0,\n computed: void 0,\n transforms: void 0,\n height: void 0,\n width: void 0,\n marginLeft: void 0,\n marginTop: void 0,\n maxHeight: void 0,\n maxWidth: void 0,\n minHeight: void 0,\n minWidth: void 0,\n rest: void 0\n};\n\nObject.seal(s_VALIDATION_DATA);\n\n/**\n * Provides an action to apply a TJSPosition instance to a HTMLElement and invoke `position.parent`\n *\n * @param {HTMLElement} node - The node associated with the action.\n *\n * @param {import('..').TJSPosition} position - A position instance.\n *\n * @returns {import('svelte/action').ActionReturn} The action lifecycle methods.\n */\nfunction applyPosition(node, position)\n{\n if (hasSetter(position, 'parent')) { position.parent = node; }\n\n return {\n update: (newPosition) =>\n {\n // Sanity case to short circuit update if positions are the same instance.\n if (newPosition === position && newPosition.parent === position.parent) { return; }\n\n if (hasSetter(position, 'parent')) { position.parent = void 0; }\n\n position = newPosition;\n\n if (hasSetter(position, 'parent')) { position.parent = node; }\n },\n\n destroy: () => { if (hasSetter(position, 'parent')) { position.parent = void 0; } }\n };\n}\n\n/**\n * Provides an action to enable pointer dragging of an HTMLElement and invoke `position.set` on a given\n * {@link TJSPosition} instance provided. When the attached boolean store state changes the draggable\n * action is enabled or disabled.\n *\n * @param {HTMLElement} node - The node associated with the action.\n *\n * @param {object} params - Required parameters.\n *\n * @param {import('..').TJSPosition} params.position - A position instance.\n *\n * @param {boolean} [params.active=true] - A boolean value; attached to a readable store.\n *\n * @param {number} [params.button=0] - MouseEvent button; {@link https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button}.\n *\n * @param {import('svelte/store').Writable} [params.storeDragging] - A writable store that tracks \"dragging\"\n * state.\n *\n * @param {boolean} [params.ease=true] - When true easing is enabled.\n *\n * @param {object} [params.easeOptions] - Gsap `to / `quickTo` vars object.\n *\n * @param {Iterable} [params.hasTargetClassList] - When defined any event targets that have a class in this\n * list are allowed.\n *\n * @param {Iterable} [params.ignoreTargetClassList] - When defined any event targets that have a class in this\n * list are ignored.\n *\n * @returns {import('svelte/action').ActionReturn>} Lifecycle functions.\n */\nfunction draggable(node, { position, active = true, button = 0, storeDragging = void 0, ease = false,\n easeOptions = { duration: 0.1, ease: cubicOut }, hasTargetClassList, ignoreTargetClassList })\n{\n if (hasTargetClassList !== void 0 && !isIterable(hasTargetClassList))\n {\n throw new TypeError(`'hasTargetClassList' is not iterable.`);\n }\n\n if (ignoreTargetClassList !== void 0 && !isIterable(ignoreTargetClassList))\n {\n throw new TypeError(`'ignoreTargetClassList' is not iterable.`);\n }\n\n /**\n * Used for direct call to `position.set`.\n *\n * @type {{top: number, left: number}}\n */\n const positionData = { left: 0, top: 0 };\n\n /**\n * Duplicate the app / Positionable starting position to track differences.\n *\n * @type {object}\n */\n let initialPosition = null;\n\n /**\n * Stores the initial X / Y on drag down.\n *\n * @type {object}\n */\n let initialDragPoint = {};\n\n /**\n * Stores the current dragging state and gates the move pointer as the dragging store is not\n * set until the first pointer move.\n *\n * @type {boolean}\n */\n let dragging = false;\n\n /**\n * Stores the quickTo callback to use for optimized tweening when easing is enabled.\n *\n * @type {import('#runtime/svelte/store/position').quickToCallback}\n */\n let quickTo = position.animate.quickTo(['top', 'left'], easeOptions);\n\n /**\n * Remember event handlers associated with this action, so they may be later unregistered.\n *\n * @type {{ [key: string]: [string, Function, boolean] }}\n */\n const handlers = {\n dragDown: ['pointerdown', onDragPointerDown, false],\n dragMove: ['pointermove', onDragPointerChange, false],\n dragUp: ['pointerup', onDragPointerUp, false]\n };\n\n /**\n * Activates listeners.\n */\n function activateListeners()\n {\n // Drag handlers\n node.addEventListener(...handlers.dragDown);\n node.classList.add('draggable');\n }\n\n /**\n * Removes listeners.\n */\n function removeListeners()\n {\n if (typeof storeDragging?.set === 'function') { storeDragging.set(false); }\n\n // Drag handlers\n node.removeEventListener(...handlers.dragDown);\n node.removeEventListener(...handlers.dragMove);\n node.removeEventListener(...handlers.dragUp);\n node.classList.remove('draggable');\n }\n\n if (active)\n {\n activateListeners();\n }\n\n /**\n * Handle the initial pointer down that activates dragging behavior for the positionable.\n *\n * @param {PointerEvent} event - The pointer down event.\n */\n function onDragPointerDown(event)\n {\n if (event.button !== button || !event.isPrimary) { return; }\n\n // Do not process if the position system is not enabled.\n if (!position.enabled) { return; }\n\n // Potentially ignore this event if `ignoreTargetClassList` is defined and the `event.target` has a matching\n // class.\n if (ignoreTargetClassList !== void 0 && event.target instanceof HTMLElement)\n {\n for (const targetClass of ignoreTargetClassList)\n {\n if (event.target.classList.contains(targetClass)) { return; }\n }\n }\n\n // Potentially ignore this event if `hasTargetClassList` is defined and the `event.target` does not have any\n // matching class from the list.\n if (hasTargetClassList !== void 0 && event.target instanceof HTMLElement)\n {\n let foundTarget = false;\n\n for (const targetClass of hasTargetClassList)\n {\n if (event.target.classList.contains(targetClass))\n {\n foundTarget = true;\n break;\n }\n }\n\n if (!foundTarget) { return; }\n }\n\n event.preventDefault();\n\n dragging = false;\n\n // Record initial position.\n initialPosition = position.get();\n initialDragPoint = { x: event.clientX, y: event.clientY };\n\n // Add move and pointer up handlers.\n node.addEventListener(...handlers.dragMove);\n node.addEventListener(...handlers.dragUp);\n\n node.setPointerCapture(event.pointerId);\n }\n\n /**\n * Move the positionable.\n *\n * @param {PointerEvent} event - The pointer move event.\n */\n function onDragPointerChange(event)\n {\n // See chorded button presses for pointer events:\n // https://www.w3.org/TR/pointerevents3/#chorded-button-interactions\n // TODO: Support different button configurations for PointerEvents.\n if ((event.buttons & 1) === 0)\n {\n onDragPointerUp(event);\n return;\n }\n\n if (event.button !== -1 || !event.isPrimary) { return; }\n\n event.preventDefault();\n\n // Only set store dragging on first move event.\n if (!dragging && typeof storeDragging?.set === 'function')\n {\n dragging = true;\n storeDragging.set(true);\n }\n\n /** @type {number} */\n const newLeft = initialPosition.left + (event.clientX - initialDragPoint.x);\n /** @type {number} */\n const newTop = initialPosition.top + (event.clientY - initialDragPoint.y);\n\n if (ease)\n {\n quickTo(newTop, newLeft);\n }\n else\n {\n positionData.left = newLeft;\n positionData.top = newTop;\n\n position.set(positionData);\n }\n }\n\n /**\n * Finish dragging and set the final position and removing listeners.\n *\n * @param {PointerEvent} event - The pointer up event.\n */\n function onDragPointerUp(event)\n {\n event.preventDefault();\n\n dragging = false;\n if (typeof storeDragging?.set === 'function') { storeDragging.set(false); }\n\n node.removeEventListener(...handlers.dragMove);\n node.removeEventListener(...handlers.dragUp);\n }\n\n return {\n // The default of active being true won't automatically add listeners twice.\n update: (options) =>\n {\n if (typeof options.active === 'boolean')\n {\n active = options.active;\n if (active) { activateListeners(); }\n else { removeListeners(); }\n }\n\n if (typeof options.button === 'number')\n {\n button = options.button;\n }\n\n if (options.position !== void 0 && options.position !== position)\n {\n position = options.position;\n quickTo = position.animate.quickTo(['top', 'left'], easeOptions);\n }\n\n if (typeof options.ease === 'boolean') { ease = options.ease; }\n\n if (isObject(options.easeOptions))\n {\n easeOptions = options.easeOptions;\n quickTo.options(easeOptions);\n }\n\n if (options.hasTargetClassList !== void 0)\n {\n if (!isIterable(options.hasTargetClassList))\n {\n throw new TypeError(`'hasTargetClassList' is not iterable.`);\n }\n else\n {\n hasTargetClassList = options.hasTargetClassList;\n }\n }\n\n if (options.ignoreTargetClassList !== void 0)\n {\n if (!isIterable(options.ignoreTargetClassList))\n {\n throw new TypeError(`'ignoreTargetClassList' is not iterable.`);\n }\n else\n {\n ignoreTargetClassList = options.ignoreTargetClassList;\n }\n }\n },\n\n destroy: () => removeListeners()\n };\n}\n\nclass DraggableOptions\n{\n #ease = false;\n\n /**\n * @type {{ duration: number, ease: (t: number) => number | string }}\n */\n #easeOptions = { duration: 0.1, ease: cubicOut };\n\n /**\n * Stores the subscribers.\n *\n * @type {import('svelte/store').Subscriber[]}\n */\n #subscriptions = [];\n\n /**\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.ease] -\n *\n * @param {object} [opts.easeOptions] -\n */\n constructor({ ease, easeOptions } = {})\n {\n // Define the following getters directly on this instance and make them enumerable. This allows them to be\n // picked up w/ `Object.assign`.\n Object.defineProperty(this, 'ease', {\n get: () => { return this.#ease; },\n set: (newEase) =>\n {\n if (typeof newEase !== 'boolean') { throw new TypeError(`'ease' is not a boolean.`); }\n\n this.#ease = newEase;\n this.#updateSubscribers();\n },\n enumerable: true\n });\n\n Object.defineProperty(this, 'easeOptions', {\n get: () => { return this.#easeOptions; },\n set: (newEaseOptions) =>\n {\n if (!isObject(newEaseOptions))\n {\n throw new TypeError(`'easeOptions' is not an object.`);\n }\n\n if (newEaseOptions.duration !== void 0)\n {\n if (!Number.isFinite(newEaseOptions.duration))\n {\n throw new TypeError(`'easeOptions.duration' is not a finite number.`);\n }\n\n if (newEaseOptions.duration < 0) { throw new Error(`'easeOptions.duration' is less than 0.`); }\n\n this.#easeOptions.duration = newEaseOptions.duration;\n }\n\n if (newEaseOptions.ease !== void 0)\n {\n if (typeof newEaseOptions.ease !== 'function' && typeof newEaseOptions.ease !== 'string')\n {\n throw new TypeError(`'easeOptions.ease' is not a function or string.`);\n }\n\n this.#easeOptions.ease = newEaseOptions.ease;\n }\n\n this.#updateSubscribers();\n },\n enumerable: true\n });\n\n // Set default options.\n if (ease !== void 0) { this.ease = ease; }\n if (easeOptions !== void 0) { this.easeOptions = easeOptions; }\n }\n\n\n /**\n * @returns {number} Get ease duration\n */\n get easeDuration() { return this.#easeOptions.duration; }\n\n /**\n * @returns {string|Function} Get easing function value.\n */\n get easeValue() { return this.#easeOptions.ease; }\n\n\n /**\n * @param {number} duration - Set ease duration.\n */\n set easeDuration(duration)\n {\n if (!Number.isFinite(duration))\n {\n throw new TypeError(`'duration' is not a finite number.`);\n }\n\n if (duration < 0) { throw new Error(`'duration' is less than 0.`); }\n\n this.#easeOptions.duration = duration;\n this.#updateSubscribers();\n }\n\n /**\n * @param {string|Function} value - Get easing function value.\n */\n set easeValue(value)\n {\n if (typeof value !== 'function' && typeof value !== 'string')\n {\n throw new TypeError(`'value' is not a function or string.`);\n }\n\n this.#easeOptions.ease = value;\n this.#updateSubscribers();\n }\n\n /**\n * Resets all options data to default values.\n */\n reset()\n {\n this.#ease = false;\n this.#easeOptions = { duration: 0.1, ease: cubicOut };\n this.#updateSubscribers();\n }\n\n /**\n * Resets easing options to default values.\n */\n resetEase()\n {\n this.#easeOptions = { duration: 0.1, ease: cubicOut };\n this.#updateSubscribers();\n }\n\n /**\n *\n * @param {import('svelte/store').Subscriber} handler - Callback function that is invoked on\n * update / changes. Receives the DraggableOptions object / instance.\n *\n * @returns {import('svelte/store').Unsubscriber} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n\n handler(this); // call handler with current value\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n\n #updateSubscribers()\n {\n const subscriptions = this.#subscriptions;\n\n // Early out if there are no subscribers.\n if (subscriptions.length > 0)\n {\n for (let cntr = 0; cntr < subscriptions.length; cntr++) { subscriptions[cntr](this); }\n }\n }\n}\n\n/**\n * Define a function to get a DraggableOptions instance.\n *\n * @param {{ ease?: boolean, easeOptions?: object }} options - Draggable options.\n *\n * @returns {DraggableOptions} A new options instance.\n */\ndraggable.options = (options) => new DraggableOptions(options);\n\nexport { TJSPosition, TJSPositionData, applyPosition, draggable };\n//# sourceMappingURL=index.js.map\n","\n\n\n\n\n\n {@html icon}{#if label}{label}{/if}\n\n\n\n","\n\n{#key draggable}\n
\n {#if typeof $storeHeaderIcon === 'string'}\n icon\n {/if}\n

\n {localize($storeTitle)}\n

\n {#each buttonsLeft as button}\n \n {/each}\n \n {#each buttonsRight as button}\n \n {/each}\n
\n{/key}\n\n\n","\n\n\n
\n\n\n","\n\n
\n \n
\n\n\n","\n\n\n\n{#if inTransition !== TJSDefaultTransition.default || outTransition !== TJSDefaultTransition.default}\n \n
\n \n
\n \n
\n \n \n
\n{:else}\n \n
\n \n
\n \n
\n \n \n
\n{/if}\n\n\n","\n\n\n\n{#if inTransition !== TJSDefaultTransition.default || outTransition !== TJSDefaultTransition.default}\n \n
\n \n
\n \n
\n \n \n
\n{:else}\n \n
\n \n
\n \n
\n \n \n
\n{/if}\n\n\n","\n\n
\n
\n {#if typeof content === 'string'}\n {@html content}\n {:else if dialogClass}\n \n {/if}\n
\n\n {#if buttons.length}\n
\n {#each buttons as button (button.id)}\n \n {/each}\n
\n {/if}\n
\n\n\n","\n\n\n\n{#if modal}\n application.close()}>\n \n \n \n \n{:else}\n \n \n \n{/if}\n","import { cssVariables } from './cssVariables.js';\n\nexport { default as TJSComponentShell } from './TJSComponentShell.svelte';\nexport { default as TJSContainer } from './TJSContainer.svelte';\nexport { default as TJSGlassPane } from './TJSGlassPane.svelte';\nexport * from './application/index.js';\nexport * from './dialog/index.js';\n\n/**\n * Provides default CSS variables for core components.\n */\ncssVariables.setProperties({\n // Anchor text shadow / header buttons\n '--tjs-default-text-shadow-focus-hover': '0 0 8px var(--color-shadow-primary)',\n\n // TJSApplicationShell app background.\n '--tjs-app-background': `url(\"${globalThis.foundry.utils.getRoute('/ui/denim075.png')}\")`,\n}, false);\n","// Class for general global variables.\n\nexport const MODULE_ID = 'foundryvtt-actor-studio';\nexport const MODULE_CODE = 'RTAS';\nexport const LOG_PREFIX = 'ACTOR STUDIO |';\nexport const MYSTERY_MAN = 'icons/svg/mystery-man.svg';\nexport const NONE_ICON = 'icons/svg/cancel.svg';\n\nexport const enum DEFAULT_PACKS {\n RACES = 'dnd5e.races',\n RACE_FEATURES = 'dnd5e.races',\n CLASSES = 'dnd5e.classes',\n CLASS_FEATURES = 'dnd5e.classfeatures',\n SUBCLASSES = 'dnd5e.subclasses',\n ITEMS = 'dnd5e.items',\n SPELLS = 'dnd5e.spells',\n RULES = 'dnd5e.rules',\n BACKGROUNDS = 'dnd5e.backgrounds',\n}\n\nexport const sessionConstants = {\n appState: `${MODULE_ID}.settings.appState`\n};\n\nexport const DEFAULT_SOURCES = {\n races: [DEFAULT_PACKS.RACES],\n racialFeatures: [DEFAULT_PACKS.RACE_FEATURES],\n classes: [DEFAULT_PACKS.CLASSES],\n subclasses: [DEFAULT_PACKS.SUBCLASSES],\n backgrounds: [DEFAULT_PACKS.BACKGROUNDS],\n spells: [DEFAULT_PACKS.SPELLS],\n feats: [],\n items: [DEFAULT_PACKS.ITEMS],\n};\n\nexport const INTEGRATION = {\n TOKENIZER: {\n VERSION: '3.3.0',\n },\n};\n\nexport const MERGE_OPTIONS = {\n insertKeys: true,\n insertValues: true,\n overwrite: true,\n recursive: true,\n inplace: false,\n};\n\nexport const POINT_BUY_COSTS = {\n 8: 0,\n 9: 1,\n 10: 2,\n 11: 3,\n 12: 4,\n 13: 5,\n 14: 7,\n 15: 9\n}\n\nexport const STANDARD_ARRAY = {\n str: 15, \n dex: 14, \n con: 13, \n int: 12, \n wis: 10, \n cha: 8\n};\n\nexport type CLASS_LEVEL = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;\n\n","\n\n\n\n\n\n\n","import { linear } from 'svelte/easing';\n\nimport { lerp } from '@typhonjs-fvtt/runtime/math/interpolate';\nimport { isObject } from '@typhonjs-fvtt/runtime/util/object';\n\n/**\n * @template T\n *\n * Provides the ability the save / restore application state for positional and UI state such as minimized status.\n *\n * You can restore a saved state with animation; please see the options of {@link ApplicationState.restore}.\n */\nexport class ApplicationState\n{\n /** @type {T} */\n #application;\n\n /** @type {Map} */\n #dataSaved = new Map();\n\n /**\n * @param {T} application - The application.\n */\n constructor(application)\n {\n this.#application = application;\n\n Object.seal(this);\n }\n\n /**\n * Returns current application state along with any extra data passed into method.\n *\n * @param {object} [extra] - Extra data to add to application state.\n *\n * @returns {ApplicationStateData} Passed in object with current application state.\n */\n get(extra = {})\n {\n return Object.assign(extra, {\n position: this.#application?.position?.get(),\n beforeMinimized: this.#application?.position?.state.get({ name: '#beforeMinimized' }),\n options: Object.assign({}, this.#application?.options),\n ui: { minimized: this.#application?.reactive?.minimized }\n });\n }\n\n /**\n * Returns any stored save state by name.\n *\n * @param {object} options - Options.\n *\n * @param {string} options.name - Saved data set name.\n *\n * @returns {ApplicationStateData} The saved data set.\n */\n getSave({ name })\n {\n if (typeof name !== 'string')\n {\n throw new TypeError(`ApplicationState - getSave error: 'name' is not a string.`);\n }\n\n return this.#dataSaved.get(name);\n }\n\n /**\n * Removes and returns any application state by name.\n *\n * @param {object} options - Options.\n *\n * @param {string} options.name - Name to remove and retrieve.\n *\n * @returns {ApplicationStateData} Saved application data.\n */\n remove({ name })\n {\n if (typeof name !== 'string') { throw new TypeError(`ApplicationState - remove: 'name' is not a string.`); }\n\n const data = this.#dataSaved.get(name);\n this.#dataSaved.delete(name);\n\n return data;\n }\n\n /**\n * Restores a saved application state returning the data. Several optional parameters are available\n * to control whether the restore action occurs silently (no store / inline styles updates), animates\n * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to} allows\n * specification of the duration, easing, and interpolate functions along with configuring a Promise to be\n * returned if awaiting the end of the animation.\n *\n * @param {object} params - Parameters\n *\n * @param {string} params.name - Saved data set name.\n *\n * @param {boolean} [params.remove=false] - Remove data set.\n *\n * @param {boolean} [params.async=false] - If animating return a Promise that resolves with any saved data.\n *\n * @param {boolean} [params.animateTo=false] - Animate to restore data.\n *\n * @param {number} [params.duration=0.1] - Duration in seconds.\n *\n * @param {Function} [params.ease=linear] - Easing function.\n *\n * @param {Function} [params.interpolate=lerp] - Interpolation function.\n *\n * @returns {ApplicationStateData|Promise} Saved application data.\n */\n restore({ name, remove = false, async = false, animateTo = false, duration = 0.1, ease = linear,\n interpolate = lerp })\n {\n if (typeof name !== 'string')\n {\n throw new TypeError(`ApplicationState - restore error: 'name' is not a string.`);\n }\n\n const dataSaved = this.#dataSaved.get(name);\n\n if (dataSaved)\n {\n if (remove) { this.#dataSaved.delete(name); }\n\n if (async)\n {\n return this.set(dataSaved, { async, animateTo, duration, ease, interpolate }).then(() => dataSaved);\n }\n else\n {\n this.set(dataSaved, { async, animateTo, duration, ease, interpolate });\n }\n }\n\n return dataSaved;\n }\n\n /**\n * Saves current application state with the opportunity to add extra data to the saved state.\n *\n * @param {object} options - Options.\n *\n * @param {string} options.name - name to index this saved data.\n *\n * @param {...*} [options.extra] - Extra data to add to saved data.\n *\n * @returns {ApplicationStateData} Current application data\n */\n save({ name, ...extra })\n {\n if (typeof name !== 'string') { throw new TypeError(`ApplicationState - save error: 'name' is not a string.`); }\n\n const data = this.get(extra);\n\n this.#dataSaved.set(name, data);\n\n return data;\n }\n\n /**\n * Restores a saved application state returning the data. Several optional parameters are available\n * to control whether the restore action occurs silently (no store / inline styles updates), animates\n * to the stored data, or simply sets the stored data. Restoring via {@link AnimationAPI.to} allows\n * specification of the duration, easing, and interpolate functions along with configuring a Promise to be\n * returned if awaiting the end of the animation.\n *\n * Note: If serializing application state any minimized apps will use the before minimized state on initial render\n * of the app as it is currently not possible to render apps with Foundry VTT core API in the minimized state.\n *\n * TODO: THIS METHOD NEEDS TO BE REFACTORED WHEN TRL IS MADE INTO A STANDALONE FRAMEWORK.\n *\n * @param {ApplicationStateData} data - Saved data set name.\n *\n * @param {object} [opts] - Optional parameters\n *\n * @param {boolean} [opts.async=false] - If animating return a Promise that resolves with any saved data.\n *\n * @param {boolean} [opts.animateTo=false] - Animate to restore data.\n *\n * @param {number} [opts.duration=0.1] - Duration in seconds.\n *\n * @param {Function} [opts.ease=linear] - Easing function.\n *\n * @param {Function} [opts.interpolate=lerp] - Interpolation function.\n *\n * @returns {T | Promise} When synchronous the application or Promise when animating resolving with application.\n */\n set(data, { async = false, animateTo = false, duration = 0.1, ease = linear, interpolate = lerp } = {})\n {\n if (!isObject(data))\n {\n throw new TypeError(`ApplicationState - restore error: 'data' is not an object.`);\n }\n\n const application = this.#application;\n\n if (!isObject(data?.position))\n {\n console.warn(`ApplicationState.set warning: 'data.position' is not an object.`);\n return application;\n }\n\n // TODO: TAKE NOTE THAT WE ARE ACCESSING A FOUNDRY APP v1 GETTER HERE TO DETERMINE IF APPLICATION IS RENDERED.\n // TODO: THIS NEEDS TO BE REFACTORED WHEN CONVERTING TRL TO A GENERIC FRAMEWORK.\n const rendered = application.rendered;\n\n if (animateTo && !rendered)\n {\n console.warn(`ApplicationState.set warning: Application is not rendered and 'animateTo' is true.`);\n return application;\n }\n\n // Update data directly with no store or inline style updates.\n if (animateTo) // Animate to saved data.\n {\n // Provide special handling to potentially change transform origin as this parameter is not animated.\n if (data.position.transformOrigin !== application.position.transformOrigin)\n {\n application.position.transformOrigin = data.position.transformOrigin;\n }\n\n if (isObject(data?.ui))\n {\n const minimized = typeof data.ui?.minimized === 'boolean' ? data.ui.minimized : false;\n\n if (application?.reactive?.minimized && !minimized)\n {\n application.maximize({ animate: false, duration: 0 });\n }\n }\n\n const promise = application.position.animate.to(data.position,\n { duration, ease, interpolate }).finished.then((cancelled) =>\n {\n if (cancelled) { return application; }\n\n // Merge in saved options to application.\n if (isObject(data?.options))\n {\n application?.reactive.mergeOptions(data.options);\n }\n\n if (isObject(data?.ui))\n {\n const minimized = typeof data.ui?.minimized === 'boolean' ? data.ui.minimized : false;\n\n // Application is currently minimized and stored state is not, so reset minimized state without\n // animation.\n if (!application?.reactive?.minimized && minimized)\n {\n application.minimize({ animate: false, duration: 0 });\n }\n }\n\n if (isObject(data?.beforeMinimized))\n {\n application.position.state.set({ name: '#beforeMinimized', ...data.beforeMinimized });\n }\n\n return application;\n });\n\n // Return a Promise with the application that resolves after animation ends.\n if (async) { return promise; }\n }\n else\n {\n if (rendered)\n {\n // Merge in saved options to application.\n if (isObject(data?.options))\n {\n application?.reactive.mergeOptions(data.options);\n }\n\n if (isObject(data?.ui))\n {\n const minimized = typeof data.ui?.minimized === 'boolean' ? data.ui.minimized : false;\n\n // Application is currently minimized and stored state is not, so reset minimized state without\n // animation.\n if (application?.reactive?.minimized && !minimized)\n {\n application.maximize({ animate: false, duration: 0 });\n }\n else if (!application?.reactive?.minimized && minimized)\n {\n application.minimize({ animate: false, duration });\n }\n }\n\n if (isObject(data?.beforeMinimized))\n {\n application.position.state.set({ name: '#beforeMinimized', ...data.beforeMinimized });\n }\n\n // Default options is to set data for an immediate update.\n application.position.set(data.position);\n }\n else\n {\n // When not rendered set position to the 'beforeMinimized' data if it exists otherwise set w/ 'position'.\n // Currently, w/ Foundry core Application API it is impossible to initially render an app in the minimized\n // state.\n\n let positionData = data.position;\n\n if (isObject(data.beforeMinimized))\n {\n // Take before minimized data.\n positionData = data.beforeMinimized;\n\n // Apply position left / top to before minimized data. This covers the case when an app is minimized,\n // but then moved. This allows restoration of the before minimized parameters w/ the last position\n // location.\n positionData.left = data.position.left;\n positionData.top = data.position.top;\n }\n\n application.position.set(positionData);\n }\n }\n\n return application;\n }\n}\n\n/**\n * @typedef {object} ApplicationStateData\n *\n * @property {import('@typhonjs-fvtt/runtime/svelte/store/position').TJSPositionDataExtended} position Application position.\n *\n * @property {object} beforeMinimized Any application saved position state for #beforeMinimized\n *\n * @property {object} options Application options.\n *\n * @property {object} ui Application UI state.\n */\n","/**\n * Provides a mechanism to retrieve and query all mounted Svelte components including the main application shell.\n */\nexport class GetSvelteData\n{\n /** @type {import('./types').MountedAppShell[] | null[]} */\n #applicationShellHolder;\n\n /** @type {import('./types').SvelteData[]} */\n #svelteData;\n\n /**\n * Keep a direct reference to the SvelteData array in an associated {@link SvelteApplication}.\n *\n * @param {import('./types').MountedAppShell[] | null[]} applicationShellHolder - A reference to the\n * MountedAppShell array.\n *\n * @param {import('./types').SvelteData[]} svelteData - A reference to the SvelteData array of mounted components.\n */\n constructor(applicationShellHolder, svelteData)\n {\n this.#applicationShellHolder = applicationShellHolder;\n this.#svelteData = svelteData;\n }\n\n /**\n * Returns any mounted {@link MountedAppShell}.\n *\n * @returns {import('./types').MountedAppShell | null} Any mounted application shell.\n */\n get applicationShell() { return this.#applicationShellHolder[0]; }\n\n /**\n * Returns the indexed Svelte component.\n *\n * @param {number} index -\n *\n * @returns {object} The loaded Svelte component.\n */\n component(index)\n {\n const data = this.#svelteData[index];\n return data?.component ?? void 0;\n }\n\n /**\n * Returns the Svelte component entries iterator.\n *\n * @returns {IterableIterator<[number, import('svelte').SvelteComponent]>} Svelte component entries iterator.\n * @yields\n */\n *componentEntries()\n {\n for (let cntr = 0; cntr < this.#svelteData.length; cntr++)\n {\n yield [cntr, this.#svelteData[cntr].component];\n }\n }\n\n /**\n * Returns the Svelte component values iterator.\n *\n * @returns {IterableIterator} Svelte component values iterator.\n * @yields\n */\n *componentValues()\n {\n for (let cntr = 0; cntr < this.#svelteData.length; cntr++)\n {\n yield this.#svelteData[cntr].component;\n }\n }\n\n /**\n * Returns the indexed SvelteData entry.\n *\n * @param {number} index - The index of SvelteData instance to retrieve.\n *\n * @returns {import('./types').SvelteData} The loaded Svelte config + component.\n */\n data(index)\n {\n return this.#svelteData[index];\n }\n\n /**\n * Returns the {@link SvelteData} instance for a given component.\n *\n * @param {import('svelte').SvelteComponent} component - Svelte component.\n *\n * @returns {import('./types').SvelteData} - The loaded Svelte config + component.\n */\n dataByComponent(component)\n {\n for (const data of this.#svelteData)\n {\n if (data.component === component) { return data; }\n }\n\n return void 0;\n }\n\n /**\n * Returns the SvelteData entries iterator.\n *\n * @returns {IterableIterator<[number, import('./types').SvelteData]>} SvelteData entries iterator.\n */\n dataEntries()\n {\n return this.#svelteData.entries();\n }\n\n /**\n * Returns the SvelteData values iterator.\n *\n * @returns {IterableIterator} SvelteData values iterator.\n */\n dataValues()\n {\n return this.#svelteData.values();\n }\n\n /**\n * Returns the length of the mounted Svelte component list.\n *\n * @returns {number} Length of mounted Svelte component list.\n */\n get length()\n {\n return this.#svelteData.length;\n }\n}\n","import { writable, get } from 'svelte/store';\n\n/**\n * Generates derived, readable, writable helper functions wrapping the given Storage API provided with any additional\n * customization for data serialization. By default, JSON serialization is used.\n *\n * @param {object} opts - Generator options.\n *\n * @param {Storage} storage - The web storage source.\n *\n * @param {(value: any, ...rest: any[]) => string} [opts.serialize] - Replace with custom serialization;\n * default: `JSON.stringify`.\n *\n * @param {(value: string, ...rest: any[]) => any} [opts.deserialize] - Replace with custom deserialization;\n * default: `JSON.parse`.\n *\n * @returns {StorageStores} A complete set of store helper functions and associated storage API instance and\n * serialization strategy.\n */\nfunction storeGenerator({ storage, serialize = JSON.stringify, deserialize = JSON.parse }) {\n function isSimpleDeriver(deriver) {\n return deriver.length < 2;\n }\n function storageReadable(key, value, start) {\n return {\n subscribe: storageWritable(key, value, start).subscribe\n };\n }\n function storageWritable(key, value, start) {\n function wrap_start(ogSet) {\n return start(function wrap_set(new_value) {\n if (storage) {\n storage.setItem(key, serialize(new_value));\n }\n return ogSet(new_value);\n }, function wrap_update(fn) {\n set(fn(get(ogStore)));\n });\n }\n if (storage) {\n const storageValue = storage.getItem(key);\n try {\n if (storageValue) {\n value = deserialize(storageValue);\n }\n }\n catch (err) { /**/ }\n storage.setItem(key, serialize(value));\n }\n const ogStore = writable(value, start ? wrap_start : void 0);\n function set(new_value) {\n if (storage) {\n storage.setItem(key, serialize(new_value));\n }\n ogStore.set(new_value);\n }\n function update(fn) {\n set(fn(get(ogStore)));\n }\n function subscribe(run, invalidate) {\n return ogStore.subscribe(run, invalidate);\n }\n return { set, update, subscribe };\n }\n function storageDerived(key, stores, fn, initial_value) {\n const single = !Array.isArray(stores);\n const stores_array = single ? [stores] : stores;\n if (storage && storage.getItem(key)) {\n try {\n initial_value = deserialize(storage.getItem(key));\n }\n catch (err) { /**/ }\n }\n return storageReadable(key, initial_value, (set, update) => {\n let inited = false;\n const values = [];\n let pending = 0;\n let cleanup;\n const sync = () => {\n if (pending) {\n return;\n }\n cleanup?.();\n const input = single ? values[0] : values;\n if (isSimpleDeriver(fn)) {\n set(fn(input));\n }\n else {\n const result = fn(input, set, update);\n if (typeof result === 'function') {\n cleanup = result;\n }\n }\n };\n const unsubscribers = stores_array.map((store, i) => store.subscribe((value) => {\n values[i] = value;\n pending &= ~(1 << i);\n if (inited) {\n sync();\n }\n }, () => { pending |= (1 << i); }));\n inited = true;\n sync();\n return function stop() {\n // Equivalent to run_all from Svelte internals.\n unsubscribers.forEach((unsubscriber) => unsubscriber());\n cleanup?.();\n };\n });\n }\n return {\n readable: storageReadable,\n writable: storageWritable,\n derived: storageDerived,\n storage,\n serialize,\n deserialize\n };\n}\n\n/**\n * Provides all Storage API enabled `localStorage` store helper functions. Data is serialized as JSON.\n */\nconst localStores = storeGenerator({ storage: globalThis?.localStorage });\n/**\n * Provides the Storage API enabled derived `localStorage` store helper function. Data is serialized as JSON.\n */\nlocalStores.derived;\n/**\n * Provides the Storage API enabled readable `localStorage` store helper function. Data is serialized as JSON.\n */\nlocalStores.readable;\n/**\n * Provides the Storage API enabled writable `localStorage` store helper function. Data is serialized as JSON.\n */\nlocalStores.writable;\n\n/**\n * Provides all Storage API enabled `sessionStorage` store helper functions. Data is serialized as JSON.\n */\nconst sessionStores = storeGenerator({ storage: globalThis?.sessionStorage });\n/**\n * Provides the Storage API enabled derived `sessionStorage` store helper function. Data is serialized as JSON.\n */\nsessionStores.derived;\n/**\n * Provides the Storage API enabled readable `sessionStorage` store helper function. Data is serialized as JSON.\n */\nsessionStores.readable;\n/**\n * Provides the Storage API enabled writable `sessionStorage` store helper function. Data is serialized as JSON.\n */\nsessionStores.writable;\n\n/**\n * Provides the base Storage API store manager. It is recommended to use {@link TJSLocalStorage} &\n * {@link TJSSessionStorage} for standard browser local and session storage use cases. TJSWebStorage exists\n * to provide additional customization options for custom Storage API compatible storage instances and custom\n * serialization configuration.\n */\nclass TJSWebStorage\n{\n /** @type {import('./').StorageStores} */\n #storageStores;\n\n /**\n * @type {(Map any,\n * serialize?: (value: any, ...rest: any[]) => string\n * }>)}\n */\n #stores = new Map();\n\n /**\n * @param {import('./').StorageStores} storageStores - Provides a complete set of\n * storage API store helper functions and the associated storage API instance and serializations strategy.\n */\n constructor(storageStores)\n {\n this.#storageStores = storageStores;\n }\n\n\n /**\n * @param {string} key - Storage key.\n *\n * @returns {(value: string, ...rest: any[]) => any} Deserialize function.\n */\n #getDeserialize(key)\n {\n return this.#stores.get(key)?.deserialize ?? this.#storageStores.deserialize;\n }\n\n\n /**\n * @param {string} key - Storage key.\n *\n * @returns {(value: any, ...rest: any[]) => string} Serialize function.\n */\n #getSerialize(key)\n {\n return this.#stores.get(key)?.serialize ?? this.#storageStores.serialize;\n }\n\n /**\n * Creates a new store for the given key.\n *\n * @template T\n *\n * @param {string} key - Key to lookup in stores map.\n *\n * @param {T} [defaultValue] - A default value to set for the store.\n *\n * @param {import('./').StorageStores} [storageStores] - Additional store creation options.\n *\n * @returns {import('svelte/store').Writable} The new store.\n */\n #createStore(key, defaultValue = void 0, storageStores)\n {\n try\n {\n const value = this.#storageStores.storage.getItem(key);\n if (value !== null)\n {\n const deserialize = storageStores?.deserialize ?? this.#storageStores.deserialize;\n defaultValue = deserialize(value);\n }\n }\n catch (err) { /**/ }\n\n const writable = storageStores?.writable ?? this.#storageStores.writable;\n\n return writable(key, defaultValue);\n }\n\n /**\n * Gets a store from the `stores` Map or creates a new store for the key and a given default value.\n *\n * @template T\n *\n * @param {string} key - Key to lookup in stores map.\n *\n * @param {T} [defaultValue] - A default value to set for the store.\n *\n * @param {import('./').StorageStores} [storageStores] - Additional store creation options.\n *\n * @returns {import('svelte/store').Writable} The store for the given key.\n */\n #getStore(key, defaultValue = void 0, storageStores)\n {\n const storeEntry = this.#stores.get(key);\n if (storeEntry) { return storeEntry.store; }\n\n const store = this.#createStore(key, defaultValue, storageStores);\n\n // Set any key specific storage helper details.\n this.#stores.set(key, {\n store,\n deserialize: storageStores?.deserialize,\n serialize: storageStores?.serialize\n });\n\n return store;\n }\n\n /**\n * Get value from the storage API.\n *\n * @param {string} key - Key to lookup in storage API.\n *\n * @param {*} [defaultValue] - A default value to return if key not present in session storage.\n *\n * @returns {*} Value from session storage or if not defined any default value provided.\n */\n getItem(key, defaultValue)\n {\n let value = defaultValue;\n\n const storageValue = this.#storageStores.storage.getItem(key);\n\n if (storageValue !== null)\n {\n try\n {\n value = this.#getDeserialize(key)(storageValue);\n }\n catch (err)\n {\n value = defaultValue;\n }\n }\n else if (defaultValue !== void 0)\n {\n try\n {\n const newValue = this.#getSerialize(key)(defaultValue);\n\n // If there is no existing storage value and defaultValue is defined the storage value needs to be set.\n this.#storageStores.storage.setItem(key, newValue);\n }\n catch (err) { /* */ }\n }\n\n return value;\n }\n\n /**\n * Returns the backing Svelte store for the given key; potentially sets a default value if the key\n * is not already set.\n *\n * @template T\n *\n * @param {string} key - Key to lookup in storage API.\n *\n * @param {T} [defaultValue] - A default value to return if key not present in session storage.\n *\n * @param {import('./').StorageStores} [storageStores] - Additional store creation options.\n *\n * @returns {import('svelte/store').Writable} The Svelte store for this key.\n */\n getStore(key, defaultValue, storageStores)\n {\n return this.#getStore(key, defaultValue, storageStores);\n }\n\n /**\n * Sets the value for the given key in storage API.\n *\n * @param {string} key - Key to lookup in storage API.\n *\n * @param {*} value - A value to set for this key.\n */\n setItem(key, value)\n {\n const store = this.#getStore(key);\n store.set(value);\n }\n\n /**\n * Convenience method to swap a boolean value stored in storage API.\n *\n * @param {string} key - Key to lookup in storage API.\n *\n * @param {boolean} [defaultValue] - A default value to return if key not present in session storage.\n *\n * @returns {boolean} The boolean swap for the given key.\n */\n swapItemBoolean(key, defaultValue)\n {\n const store = this.#getStore(key, defaultValue);\n\n let currentValue = false;\n\n try\n {\n currentValue = !!this.#getDeserialize(key)(this.#storageStores.storage.getItem(key));\n }\n catch (err) { /**/ }\n\n const newValue = typeof currentValue === 'boolean' ? !currentValue : false;\n\n store.set(newValue);\n return newValue;\n }\n}\n\n/**\n * Provides a {@link TJSWebStorage} instance for standard browser local storage use cases.\n */\nclass TJSLocalStorage extends TJSWebStorage\n{\n constructor()\n {\n super(localStores);\n }\n}\n\n/**\n * Provides a {@link TJSWebStorage} instance for standard browser session storage use cases.\n */\nclass TJSSessionStorage extends TJSWebStorage\n{\n constructor()\n {\n super(sessionStores);\n }\n}\n\nexport { TJSLocalStorage, TJSSessionStorage, TJSWebStorage, localStores, sessionStores, storeGenerator };\n//# sourceMappingURL=index.js.map\n","import { derived, writable } from 'svelte/store';\n\nimport {\n TJSSessionStorage,\n TJSWebStorage } from '@typhonjs-fvtt/runtime/svelte/store/web-storage';\n\nimport { propertyStore } from '@typhonjs-fvtt/runtime/svelte/store/writable-derived';\n\nimport {\n deepMerge,\n safeAccess,\n safeSet } from '@typhonjs-fvtt/runtime/util/object';\n\nimport { subscribeIgnoreFirst } from '@typhonjs-fvtt/runtime/util/store';\n\n/**\n * Contains the reactive functionality / Svelte stores associated with SvelteApplication and retrievable by\n * {@link SvelteApplication.reactive}.\n *\n * There are several reactive getters for UI state such and for two-way bindings / stores see\n * {@link SvelteReactive.storeUIState}:\n * - {@link SvelteReactive.dragging}\n * - {@link SvelteReactive.minimized}\n * - {@link SvelteReactive.resizing}\n *\n * There are also reactive getters / setters for {@link SvelteApplicationOptions} and Foundry\n * {@link ApplicationOptions}. You can use the following as one way bindings and update the associated stores. For\n * two-way bindings / stores see {@link SvelteReactive.storeAppOptions}.\n *\n * - {@link SvelteReactive.draggable}\n * - {@link SvelteReactive.focusAuto}\n * - {@link SvelteReactive.focusKeep}\n * - {@link SvelteReactive.focusTrap}\n * - {@link SvelteReactive.headerButtonNoClose}\n * - {@link SvelteReactive.headerButtonNoLabel}\n * - {@link SvelteReactive.headerIcon}\n * - {@link SvelteReactive.headerNoTitleMinimized}\n * - {@link SvelteReactive.minimizable}\n * - {@link SvelteReactive.popOut}\n * - {@link SvelteReactive.positionable}\n * - {@link SvelteReactive.resizable}\n * - {@link SvelteReactive.title}\n *\n * An instance of TJSWebStorage (session) / TJSSessionStorage is accessible via {@link SvelteReactive.sessionStorage}.\n * Optionally you can pass in an existing TJSWebStorage instance that can be shared across multiple SvelteApplications\n * by setting {@link SvelteApplicationOptions.sessionStorage}.\n *\n * -------------------------------------------------------------------------------------------------------------------\n *\n * This API is not sealed, and it is recommended that you extend it with accessors to get / set data that is reactive\n * in your application. An example of setting an exported prop `document` from the main mounted application shell.\n *\n * @example\n * import { hasSetter } from '@typhonjs-fvtt/runtime/svelte/util';\n *\n * // Note: make a normal comment.\n * // * @member {object} document - Adds accessors to SvelteReactive to get / set the document associated with\n * // * Document with the mounted application shell Svelte component.\n * // *\n * // * @memberof SvelteReactive#\n * // *\n * Object.defineProperty(this.reactive, 'document', {\n * get: () => this.svelte?.applicationShell?.document,\n * set: (document) =>\n * {\n * const component = this.svelte?.applicationShell;\n * if (hasSetter(component, 'document')) { component.document = document; }\n * }\n * });\n */\nexport class SvelteReactive\n{\n /**\n * @type {import('../SvelteApplication').SvelteApplication}\n */\n #application;\n\n /**\n * @type {boolean}\n */\n #initialized = false;\n\n /** @type {import('@typhonjs-fvtt/runtime/svelte/store/web-storage').TJSWebStorage} */\n #sessionStorage;\n\n /**\n * The Application option store which is injected into mounted Svelte component context under the `external` key.\n *\n * @type {import('./types').StoreAppOptions}\n */\n #storeAppOptions;\n\n /**\n * Stores the update function for `#storeAppOptions`.\n *\n * @type {(this: void, updater: import('svelte/store').Updater) => void}\n */\n #storeAppOptionsUpdate;\n\n /**\n * Stores the UI state data to make it accessible via getters.\n *\n * @type {object}\n */\n #dataUIState;\n\n /**\n * The UI option store which is injected into mounted Svelte component context under the `external` key.\n *\n * @type {import('./types').StoreUIOptions}\n */\n #storeUIState;\n\n /**\n * Stores the update function for `#storeUIState`.\n *\n * @type {(this: void, updater: import('svelte/store').Updater) => void}\n */\n #storeUIStateUpdate;\n\n /**\n * Stores the unsubscribe functions from local store subscriptions.\n *\n * @type {import('svelte/store').Unsubscriber[]}\n */\n #storeUnsubscribe = [];\n\n /**\n * @param {import('../SvelteApplication').SvelteApplication} application - The host Foundry application.\n */\n constructor(application)\n {\n this.#application = application;\n const optionsSessionStorage = application?.options?.sessionStorage;\n\n if (optionsSessionStorage !== void 0 && !(optionsSessionStorage instanceof TJSWebStorage))\n {\n throw new TypeError(`'options.sessionStorage' is not an instance of TJSWebStorage.`);\n }\n\n // If no external web storage API instance is available then create a TJSSessionStorage instance.\n this.#sessionStorage = optionsSessionStorage !== void 0 ? optionsSessionStorage : new TJSSessionStorage();\n }\n\n /**\n * Initializes reactive support. Package private for internal use.\n *\n * @returns {SvelteReactiveStores | undefined} Internal methods to interact with Svelte stores.\n * @package\n * @internal\n */\n initialize()\n {\n if (this.#initialized) { return; }\n\n this.#initialized = true;\n\n this.#storesInitialize();\n\n return {\n appOptionsUpdate: this.#storeAppOptionsUpdate,\n uiStateUpdate: this.#storeUIStateUpdate,\n subscribe: this.#storesSubscribe.bind(this),\n unsubscribe: this.#storesUnsubscribe.bind(this)\n };\n }\n\n// Store getters -----------------------------------------------------------------------------------------------------\n\n /**\n * @returns {import('@typhonjs-fvtt/runtime/svelte/store/web-storage').TJSWebStorage} Returns TJSWebStorage (session) instance.\n */\n get sessionStorage()\n {\n return this.#sessionStorage;\n }\n\n /**\n * Returns the store for app options.\n *\n * @returns {import('./types').StoreAppOptions} App options store.\n */\n get storeAppOptions() { return this.#storeAppOptions; }\n\n /**\n * Returns the store for UI options.\n *\n * @returns {import('./types').StoreUIOptions} UI options store.\n */\n get storeUIState() { return this.#storeUIState; }\n\n// Only reactive getters ---------------------------------------------------------------------------------------------\n\n /**\n * Returns the current dragging UI state.\n *\n * @returns {boolean} Dragging UI state.\n */\n get dragging() { return this.#dataUIState.dragging; }\n\n /**\n * Returns the current minimized UI state.\n *\n * @returns {boolean} Minimized UI state.\n */\n get minimized() { return this.#dataUIState.minimized; }\n\n /**\n * Returns the current resizing UI state.\n *\n * @returns {boolean} Resizing UI state.\n */\n get resizing() { return this.#dataUIState.resizing; }\n\n// Reactive getter / setters -----------------------------------------------------------------------------------------\n\n /**\n * Returns the draggable app option.\n *\n * @returns {boolean} Draggable app option.\n */\n get draggable() { return this.#application?.options?.draggable; }\n\n /**\n * Returns the focusAuto app option.\n *\n * @returns {boolean} When true auto-management of app focus is enabled.\n */\n get focusAuto() { return this.#application?.options?.focusAuto; }\n\n /**\n * Returns the focusKeep app option.\n *\n * @returns {boolean} When `focusAuto` and `focusKeep` is true; keeps internal focus.\n */\n get focusKeep() { return this.#application?.options?.focusKeep; }\n\n /**\n * Returns the focusTrap app option.\n *\n * @returns {boolean} When true focus trapping / wrapping is enabled keeping focus inside app.\n */\n get focusTrap() { return this.#application?.options?.focusTrap; }\n\n /**\n * Returns the headerButtonNoClose app option.\n *\n * @returns {boolean} Remove the close the button in header app option.\n */\n get headerButtonNoClose() { return this.#application?.options?.headerButtonNoClose; }\n\n /**\n * Returns the headerButtonNoLabel app option.\n *\n * @returns {boolean} Remove the labels from buttons in header app option.\n */\n get headerButtonNoLabel() { return this.#application?.options?.headerButtonNoLabel; }\n\n /**\n * Returns the headerIcon app option.\n *\n * @returns {string|void} URL for header app icon.\n */\n get headerIcon() { return this.#application?.options?.headerIcon; }\n\n /**\n * Returns the headerNoTitleMinimized app option.\n *\n * @returns {boolean} When true removes the header title when minimized.\n */\n get headerNoTitleMinimized() { return this.#application?.options?.headerNoTitleMinimized; }\n\n /**\n * Returns the minimizable app option.\n *\n * @returns {boolean} Minimizable app option.\n */\n get minimizable() { return this.#application?.options?.minimizable; }\n\n /**\n * Returns the Foundry popOut state; {@link Application.popOut}\n *\n * @returns {boolean} Positionable app option.\n */\n get popOut() { return this.#application.popOut; }\n\n /**\n * Returns the positionable app option; {@link SvelteApplicationOptions.positionable}\n *\n * @returns {boolean} Positionable app option.\n */\n get positionable() { return this.#application?.options?.positionable; }\n\n /**\n * Returns the resizable option.\n *\n * @returns {boolean} Resizable app option.\n */\n get resizable() { return this.#application?.options?.resizable; }\n\n /**\n * Returns the title accessor from the parent Application class; {@link Application.title}\n * TODO: Application v2; note that super.title localizes `this.options.title`; IMHO it shouldn't.\n *\n * @returns {string} Title.\n */\n get title() { return this.#application.title; }\n\n /**\n * Sets `this.options.draggable` which is reactive for application shells.\n *\n * @param {boolean} draggable - Sets the draggable option.\n */\n set draggable(draggable)\n {\n if (typeof draggable === 'boolean') { this.setOptions('draggable', draggable); }\n }\n\n /**\n * Sets `this.options.focusAuto` which is reactive for application shells.\n *\n * @param {boolean} focusAuto - Sets the focusAuto option.\n */\n set focusAuto(focusAuto)\n {\n if (typeof focusAuto === 'boolean') { this.setOptions('focusAuto', focusAuto); }\n }\n\n /**\n * Sets `this.options.focusKeep` which is reactive for application shells.\n *\n * @param {boolean} focusKeep - Sets the focusKeep option.\n */\n set focusKeep(focusKeep)\n {\n if (typeof focusKeep === 'boolean') { this.setOptions('focusKeep', focusKeep); }\n }\n\n /**\n * Sets `this.options.focusTrap` which is reactive for application shells.\n *\n * @param {boolean} focusTrap - Sets the focusTrap option.\n */\n set focusTrap(focusTrap)\n {\n if (typeof focusTrap === 'boolean') { this.setOptions('focusTrap', focusTrap); }\n }\n\n /**\n * Sets `this.options.headerButtonNoClose` which is reactive for application shells.\n *\n * @param {boolean} headerButtonNoClose - Sets the headerButtonNoClose option.\n */\n set headerButtonNoClose(headerButtonNoClose)\n {\n if (typeof headerButtonNoClose === 'boolean') { this.setOptions('headerButtonNoClose', headerButtonNoClose); }\n }\n\n /**\n * Sets `this.options.headerButtonNoLabel` which is reactive for application shells.\n *\n * @param {boolean} headerButtonNoLabel - Sets the headerButtonNoLabel option.\n */\n set headerButtonNoLabel(headerButtonNoLabel)\n {\n if (typeof headerButtonNoLabel === 'boolean') { this.setOptions('headerButtonNoLabel', headerButtonNoLabel); }\n }\n\n /**\n * Sets `this.options.headerIcon` which is reactive for application shells.\n *\n * @param {string | undefined} headerIcon - Sets the headerButtonNoLabel option.\n */\n set headerIcon(headerIcon)\n {\n if (headerIcon === void 0 || typeof headerIcon === 'string') { this.setOptions('headerIcon', headerIcon); }\n }\n\n /**\n * Sets `this.options.headerNoTitleMinimized` which is reactive for application shells.\n *\n * @param {boolean} headerNoTitleMinimized - Sets the headerNoTitleMinimized option.\n */\n set headerNoTitleMinimized(headerNoTitleMinimized)\n {\n if (typeof headerNoTitleMinimized === 'boolean')\n {\n this.setOptions('headerNoTitleMinimized', headerNoTitleMinimized);\n }\n }\n\n /**\n * Sets `this.options.minimizable` which is reactive for application shells that are also pop out.\n *\n * @param {boolean} minimizable - Sets the minimizable option.\n */\n set minimizable(minimizable)\n {\n if (typeof minimizable === 'boolean') { this.setOptions('minimizable', minimizable); }\n }\n\n /**\n * Sets `this.options.popOut` which is reactive for application shells. This will add / remove this application\n * from `ui.windows`.\n *\n * @param {boolean} popOut - Sets the popOut option.\n */\n set popOut(popOut)\n {\n if (typeof popOut === 'boolean') { this.setOptions('popOut', popOut); }\n }\n\n /**\n * Sets `this.options.positionable` enabling / disabling {@link SvelteApplication.position}.\n *\n * @param {boolean} positionable - Sets the positionable option.\n */\n set positionable(positionable)\n {\n if (typeof positionable === 'boolean') { this.setOptions('positionable', positionable); }\n }\n\n /**\n * Sets `this.options.resizable` which is reactive for application shells.\n *\n * @param {boolean} resizable - Sets the resizable option.\n */\n set resizable(resizable)\n {\n if (typeof resizable === 'boolean') { this.setOptions('resizable', resizable); }\n }\n\n /**\n * Sets `this.options.title` which is reactive for application shells.\n *\n * Note: Will set empty string if title is undefined or null.\n *\n * @param {string | undefined | null} title - Application title; will be localized, so a translation key is fine.\n */\n set title(title)\n {\n if (typeof title === 'string')\n {\n this.setOptions('title', title);\n }\n else if (title === void 0 || title === null)\n {\n this.setOptions('title', '');\n }\n }\n\n // Reactive Options API -------------------------------------------------------------------------------------------\n\n /**\n * Provides a way to safely get this applications options given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * // TODO DOCUMENT the accessor in more detail.\n *\n * @param {string} accessor - The path / key to set. You can set multiple levels.\n *\n * @param {*} [defaultValue] - A default value returned if the accessor is not found.\n *\n * @returns {*} Value at the accessor.\n */\n getOptions(accessor, defaultValue)\n {\n return safeAccess(this.#application.options, accessor, defaultValue);\n }\n\n /**\n * Provides a way to merge `options` into this applications options and update the appOptions store.\n *\n * @param {object} options - The options object to merge with `this.options`.\n */\n mergeOptions(options)\n {\n this.#storeAppOptionsUpdate((instanceOptions) => deepMerge(instanceOptions, options));\n }\n\n /**\n * Provides a way to safely set this applications options given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * Additionally if an application shell Svelte component is mounted and exports the `appOptions` property then\n * the application options is set to `appOptions` potentially updating the application shell / Svelte component.\n *\n * // TODO DOCUMENT the accessor in more detail.\n *\n * @param {string} accessor - The path / key to set. You can set multiple levels.\n *\n * @param {any} value - Value to set.\n */\n setOptions(accessor, value)\n {\n const success = safeSet(this.#application.options, accessor, value);\n\n // If `this.options` modified then update the app options store.\n if (success)\n {\n this.#storeAppOptionsUpdate(() => this.#application.options);\n }\n }\n\n /**\n * Initializes the Svelte stores and derived stores for the application options and UI state.\n *\n * While writable stores are created the update method is stored in private variables locally and derived Readable\n * stores are provided for essential options which are commonly used.\n *\n * These stores are injected into all Svelte components mounted under the `external` context: `storeAppOptions` and\n * `storeUIState`.\n */\n #storesInitialize()\n {\n const writableAppOptions = writable(this.#application.options);\n\n // Keep the update function locally, but make the store essentially readable.\n this.#storeAppOptionsUpdate = writableAppOptions.update;\n\n /**\n * Create custom store. The main subscribe method for all app options changes is provided along with derived\n * writable stores for all reactive options.\n *\n * @type {import('./types').StoreAppOptions}\n */\n const storeAppOptions = {\n subscribe: writableAppOptions.subscribe,\n\n draggable: propertyStore(writableAppOptions, 'draggable'),\n focusAuto: propertyStore(writableAppOptions, 'focusAuto'),\n focusKeep: propertyStore(writableAppOptions, 'focusKeep'),\n focusTrap: propertyStore(writableAppOptions, 'focusTrap'),\n headerButtonNoClose: propertyStore(writableAppOptions, 'headerButtonNoClose'),\n headerButtonNoLabel: propertyStore(writableAppOptions, 'headerButtonNoLabel'),\n headerIcon: propertyStore(writableAppOptions, 'headerIcon'),\n headerNoTitleMinimized: propertyStore(writableAppOptions, 'headerNoTitleMinimized'),\n minimizable: propertyStore(writableAppOptions, 'minimizable'),\n popOut: propertyStore(writableAppOptions, 'popOut'),\n positionable: propertyStore(writableAppOptions, 'positionable'),\n resizable: propertyStore(writableAppOptions, 'resizable'),\n title: propertyStore(writableAppOptions, 'title')\n };\n\n Object.freeze(storeAppOptions);\n\n this.#storeAppOptions = storeAppOptions;\n\n this.#dataUIState = {\n dragging: false,\n headerButtons: [],\n minimized: this.#application._minimized,\n resizing: false\n };\n\n // Create a store for UI state data.\n const writableUIOptions = writable(this.#dataUIState);\n\n // Keep the update function locally, but make the store essentially readable.\n this.#storeUIStateUpdate = writableUIOptions.update;\n\n /**\n * @type {import('./types').StoreUIOptions}\n */\n const storeUIState = {\n subscribe: writableUIOptions.subscribe,\n\n dragging: propertyStore(writableUIOptions, 'dragging'),\n headerButtons: derived(writableUIOptions, ($options, set) => set($options.headerButtons)),\n minimized: derived(writableUIOptions, ($options, set) => set($options.minimized)),\n resizing: propertyStore(writableUIOptions, 'resizing')\n };\n\n Object.freeze(storeUIState);\n\n // Initialize the store with options set in the Application constructor.\n this.#storeUIState = storeUIState;\n }\n\n /**\n * Registers local store subscriptions for app options. `popOut` controls registering this app with `ui.windows`.\n *\n * @see SvelteApplication._injectHTML\n */\n #storesSubscribe()\n {\n // Register local subscriptions.\n\n // Handles updating header buttons to add / remove the close button.\n this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.headerButtonNoClose, (value) =>\n {\n this.updateHeaderButtons({ headerButtonNoClose: value });\n }));\n\n // Handles updating header buttons to add / remove button labels.\n this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.headerButtonNoLabel, (value) =>\n {\n this.updateHeaderButtons({ headerButtonNoLabel: value });\n }));\n\n // Handles adding / removing this application from `ui.windows` when popOut changes.\n this.#storeUnsubscribe.push(subscribeIgnoreFirst(this.#storeAppOptions.popOut, (value) =>\n {\n if (value && this.#application.rendered)\n {\n globalThis.ui.windows[this.#application.appId] = this.#application;\n }\n else\n {\n delete globalThis.ui.windows[this.#application.appId];\n }\n }));\n }\n\n /**\n * Unsubscribes from any locally monitored stores.\n *\n * @see SvelteApplication.close\n */\n #storesUnsubscribe()\n {\n this.#storeUnsubscribe.forEach((unsubscribe) => unsubscribe());\n this.#storeUnsubscribe = [];\n }\n\n /**\n * Updates the UI Options store with the current header buttons. You may dynamically add / remove header buttons\n * if using an application shell Svelte component. In either overriding `_getHeaderButtons` or responding to the\n * Hooks fired return a new button array and the uiOptions store is updated and the application shell will render\n * the new buttons.\n *\n * Optionally you can set in the SvelteApplication app options {@link SvelteApplicationOptions.headerButtonNoClose}\n * to remove the close button and {@link SvelteApplicationOptions.headerButtonNoLabel} to true and labels will be\n * removed from the header buttons.\n *\n * @param {object} [opts] - Optional parameters (for internal use)\n *\n * @param {boolean} [opts.headerButtonNoClose] - The value for `headerButtonNoClose`.\n *\n * @param {boolean} [opts.headerButtonNoLabel] - The value for `headerButtonNoLabel`.\n */\n updateHeaderButtons({ headerButtonNoClose = this.#application.options.headerButtonNoClose,\n headerButtonNoLabel = this.#application.options.headerButtonNoLabel } = {})\n {\n let buttons = this.#application._getHeaderButtons();\n\n // Remove close button if this.options.headerButtonNoClose is true;\n if (typeof headerButtonNoClose === 'boolean' && headerButtonNoClose)\n {\n buttons = buttons.filter((button) => button.class !== 'close');\n }\n\n // Remove labels if this.options.headerButtonNoLabel is true;\n if (typeof headerButtonNoLabel === 'boolean' && headerButtonNoLabel)\n {\n for (const button of buttons) { button.label = void 0; }\n }\n\n this.#storeUIStateUpdate((options) =>\n {\n options.headerButtons = buttons;\n return options;\n });\n }\n}\n\n/**\n * @typedef {object} SvelteReactiveStores\n *\n * @property {(this: void, updater: import('svelte/store').Updater) => void} appOptionsUpdate Update function\n * for app options store.\n *\n * @property {Function} subscribe Subscribes to local stores.\n *\n * @property {(this: void, updater: import('svelte/store').Updater) => void} uiStateUpdate Update function\n * for UI state stores.\n *\n * @property {Function} unsubscribe Unsubscribes from local stores.\n */\n","/**\n * Defines the application shell contract. If Svelte components export getter / setters for the following properties\n * then that component is considered an application shell.\n *\n * @type {string[]}\n */\nconst applicationShellContract = ['elementRoot'];\n\nObject.freeze(applicationShellContract);\n\nexport { applicationShellContract };\n","import { applicationShellContract } from './applicationShellContract.js';\n\n/**\n * Provides a method to determine if the passed in object / Svelte component follows the application shell contract.\n * This involves ensuring that the accessors defined in `applicationShellContract`.\n *\n * Note: A caveat is that when using Vite in a developer build components are wrapped in a proxy / ProxyComponent that\n * defines instance accessors versus on the prototype, so the check below ensures that all accessors in the contract are\n * either available on the prototype or directly on the instance.\n *\n * @param {*} component - Object / component to test.\n *\n * @returns {boolean} Whether the component is a ApplicationShell or TJSApplicationShell.\n */\nexport function isApplicationShell(component)\n{\n if (component === null || component === void 0) { return false; }\n\n let compHasContract = true;\n let protoHasContract = true;\n\n // Check for accessors on the instance.\n for (const accessor of applicationShellContract)\n {\n const descriptor = Object.getOwnPropertyDescriptor(component, accessor);\n if (descriptor === void 0 || descriptor.get === void 0 || descriptor.set === void 0) { compHasContract = false; }\n }\n\n // Get the prototype which is the parent SvelteComponent that has any getter / setters.\n const prototype = Object.getPrototypeOf(component);\n\n // Verify the application shell contract. If the accessors (getters / setters) are defined for\n // `applicationShellContract`.\n for (const accessor of applicationShellContract)\n {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, accessor);\n if (descriptor === void 0 || descriptor.get === void 0 || descriptor.set === void 0) { protoHasContract = false; }\n }\n\n return compHasContract || protoHasContract;\n}\n","import { parseTJSSvelteConfig } from '@typhonjs-fvtt/runtime/svelte/util';\n\nimport { isApplicationShell } from './isApplicationShell.js';\n\nimport { isObject } from '@typhonjs-fvtt/runtime/util/object';\n\n/**\n * Instantiates and attaches a Svelte component to the main inserted HTML.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {object} [opts.app] - The target application\n *\n * @param {HTMLElement} [opts.template] - Any HTML template.\n *\n * @param {import('@typhonjs-fvtt/runtime/svelte/util').TJSSvelteConfig} [opts.config] - Svelte component options\n *\n * @param {Function} [opts.elementRootUpdate] - A callback to assign to the external context.\n *\n * @returns {import('@typhonjs-fvtt/runtime/svelte/application').SvelteData} The config + instantiated Svelte component.\n */\nexport function loadSvelteConfig({ app, template, config, elementRootUpdate } = {})\n{\n const svelteOptions = isObject(config.options) ? config.options : {};\n\n let target;\n\n // A specific HTMLElement to append Svelte component.\n if (config.target instanceof HTMLElement)\n {\n target = config.target;\n }\n // A string target defines a selector to find in existing HTML.\n else if (template instanceof HTMLElement && typeof config.target === 'string')\n {\n target = template.querySelector(config.target);\n }\n else // No target defined, create a document fragment.\n {\n target = document.createDocumentFragment();\n }\n\n if (target === void 0)\n {\n console.log(\n `%c[TRL] loadSvelteConfig error - could not find target selector, '${config.target}', for config:\\n`,\n 'background: rgb(57,34,34)', config);\n\n throw new Error();\n }\n\n const NewSvelteComponent = config.class;\n\n const svelteConfig = parseTJSSvelteConfig({ ...config, target }, app);\n\n const externalContext = svelteConfig.context.get('#external');\n\n // Inject the Foundry application instance and `elementRootUpdate` to the external context.\n externalContext.application = app;\n externalContext.elementRootUpdate = elementRootUpdate;\n externalContext.sessionStorage = app.reactive.sessionStorage;\n\n let eventbus;\n\n // Potentially inject any TyphonJS eventbus and track the proxy in the SvelteData instance.\n if (isObject(app._eventbus) && typeof app._eventbus.createProxy === 'function')\n {\n eventbus = app._eventbus.createProxy();\n externalContext.eventbus = eventbus;\n }\n\n // Seal external context so that it can't be extended.\n Object.seal(externalContext);\n\n // TODO: Remove deprecation warning in the future -----------------------------------------------------------------\n\n svelteConfig.context.set('external', new Proxy({}, {\n get(targetUnused, prop)\n {\n console.warn(`[TRL] Deprecation warning: Please change getContext('external') to getContext('#external').`);\n return externalContext[prop];\n }\n }));\n\n // TODO: Remove deprecation warning in the future -----------------------------------------------------------------\n\n // Create the Svelte component.\n /**\n * @type {import('svelte').SvelteComponent}\n */\n const component = new NewSvelteComponent(svelteConfig);\n\n // Set any eventbus to the config.\n svelteConfig.eventbus = eventbus;\n\n /**\n * @type {HTMLElement}\n */\n let element;\n\n // We can directly get the root element from components which follow the application store contract.\n if (isApplicationShell(component))\n {\n element = component.elementRoot;\n }\n\n // Detect if target is a synthesized DocumentFragment with a child element. Child elements will be present\n // if the Svelte component mounts and renders initial content into the document fragment.\n if (target instanceof DocumentFragment && target.firstElementChild)\n {\n if (element === void 0) { element = target.firstElementChild; }\n template.append(target);\n }\n else if (config.target instanceof HTMLElement && element === void 0)\n {\n if (config.target instanceof HTMLElement && typeof svelteOptions.selectorElement !== 'string')\n {\n console.log(\n `%c[TRL] loadSvelteConfig error - HTMLElement target with no 'selectorElement' defined.\\n` +\n `\\nNote: If configuring an application shell and directly targeting a HTMLElement did you bind an` +\n `'elementRoot' and include ''?\\n` +\n `\\nOffending config:\\n`, 'background: rgb(57,34,34)', config);\n\n throw new Error();\n }\n\n // The target is an HTMLElement so find the Application element from `selectorElement` option.\n element = target.querySelector(svelteOptions.selectorElement);\n\n if (element === null || element === void 0)\n {\n console.log(\n `%c[TRL] loadSvelteConfig error - HTMLElement target with 'selectorElement', '${\n svelteOptions.selectorElement}', not found for config:\\n`,\n 'background: rgb(57,34,34)', config);\n\n throw new Error();\n }\n }\n\n // If the configuration / original target is an HTML element then do not inject HTML.\n const injectHTML = !(config.target instanceof HTMLElement);\n\n return { config: svelteConfig, component, element, injectHTML };\n}\n","/**\n * Provides an index of all visible rendered {@link SvelteApplication} instances in a given Svelte runtime. This allows\n * bulk operations to be performed across all apps.\n */\nexport class TJSAppIndex\n{\n /**\n * Stores all visible / rendered apps.\n *\n * @type {Map}\n */\n static #visibleApps = new Map();\n\n /**\n * Adds a SvelteApplication to all visible apps tracked.\n *\n * @param {import('@typhonjs-fvtt/runtime/svelte/application').SvelteApplication} app - A SvelteApplication\n *\n * @package\n */\n static add(app)\n {\n this.#visibleApps.set(app.id, app);\n }\n\n /**\n * Removes a SvelteApplication from all visible apps tracked.\n *\n * @param {import('@typhonjs-fvtt/runtime/svelte/application').SvelteApplication} app - A SvelteApplication\n *\n * @package\n */\n static delete(app)\n {\n this.#visibleApps.delete(app.id);\n }\n\n /**\n * Gets a particular app by ID.\n *\n * @param {string} key - App ID.\n *\n * @returns {import('@typhonjs-fvtt/runtime/svelte/application').SvelteApplication} Associated app.\n */\n static get(key)\n {\n return this.#visibleApps.get(key);\n }\n\n /**\n * Returns whether an associated app by ID is being tracked.\n *\n * @param {string} key - App ID.\n *\n * @returns {boolean} The given App ID is visible.\n */\n static has(key)\n {\n return this.#visibleApps.has(key);\n }\n\n /**\n * @returns {IterableIterator} All visible app IDs.\n */\n static keys()\n {\n return this.#visibleApps.keys();\n }\n\n /**\n * @returns {IterableIterator} All visible apps.\n */\n static values()\n {\n return this.#visibleApps.values();\n }\n}\n","import { TJSPosition } from '@typhonjs-fvtt/runtime/svelte/store/position';\n\nimport {\n isHMRProxy,\n outroAndDestroy } from '@typhonjs-fvtt/runtime/svelte/util';\n\nimport { A11yHelper } from '@typhonjs-fvtt/runtime/util/browser';\n\nimport {\n deepMerge,\n hasGetter,\n isIterable,\n isObject } from '@typhonjs-fvtt/runtime/util/object';\n\nimport {\n ApplicationState,\n GetSvelteData,\n loadSvelteConfig,\n isApplicationShell,\n SvelteReactive,\n TJSAppIndex } from './internal/index.js';\n\n/**\n * Provides a Svelte aware extension to the Foundry {@link Application} class to manage the app lifecycle\n * appropriately. You can declaratively load one or more components from `defaultOptions` using a\n * {@link TJSSvelteConfig} object in the SvelteApplicationOptions `options` {@link SvelteApplicationOptions.svelte}\n * property.\n */\nexport class SvelteApplication extends Application\n{\n /**\n * Stores the first mounted component which follows the application shell contract.\n *\n * @type {import('./internal/state-svelte/types').MountedAppShell[]|null[]} Application shell.\n */\n #applicationShellHolder = [null];\n\n /**\n * Stores and manages application state for saving / restoring / serializing.\n *\n * @type {ApplicationState}\n */\n #applicationState;\n\n /**\n * Stores the target element which may not necessarily be the main element.\n *\n * @type {HTMLElement}\n */\n #elementTarget = null;\n\n /**\n * Stores the content element which is set for application shells.\n *\n * @type {HTMLElement}\n */\n #elementContent = null;\n\n /**\n * Stores initial z-index from `_renderOuter` to set to target element / Svelte component.\n *\n * @type {number}\n */\n #initialZIndex = 95;\n\n /**\n * Stores on mount state which is checked in _render to trigger onSvelteMount callback.\n *\n * @type {boolean}\n */\n #onMount = false;\n\n /**\n * The position store.\n *\n * @type {TJSPosition}\n */\n #position;\n\n /**\n * Contains the Svelte stores and reactive accessors.\n *\n * @type {SvelteReactive}\n */\n #reactive;\n\n /**\n * Stores SvelteData entries with instantiated Svelte components.\n *\n * @type {import('./internal/state-svelte/types').SvelteData[]}\n */\n #svelteData = [];\n\n /**\n * Provides a helper class that combines multiple methods for interacting with the mounted components tracked in\n * #svelteData.\n *\n * @type {GetSvelteData}\n */\n #getSvelteData = new GetSvelteData(this.#applicationShellHolder, this.#svelteData);\n\n /**\n * Contains methods to interact with the Svelte stores.\n *\n * @type {import('./internal/state-reactive/SvelteReactive').SvelteReactiveStores}\n */\n #stores;\n\n /**\n * @param {import('@typhonjs-fvtt/runtime/svelte/application').SvelteApplicationOptions} options - The options for the application.\n *\n * @inheritDoc\n */\n constructor(options = {})\n {\n super(options);\n\n /** @type {ApplicationState} */\n this.#applicationState = new ApplicationState(this);\n\n // Initialize TJSPosition with the position object set by Application.\n this.#position = new TJSPosition(this, {\n ...this.position,\n ...this.options,\n initial: this.options.positionInitial,\n ortho: this.options.positionOrtho,\n validator: this.options.positionValidator\n });\n\n // Remove old position field.\n delete this.position;\n\n /**\n * Define accessors to retrieve TJSPosition by `this.position`.\n *\n * @member {TJSPosition} position - Adds accessors to SvelteApplication to get / set the position data.\n *\n * @memberof SvelteApplication#\n */\n Object.defineProperty(this, 'position', {\n get: () => this.#position,\n set: (position) => { if (isObject(position)) { this.#position.set(position); } }\n });\n\n this.#reactive = new SvelteReactive(this);\n\n this.#stores = this.#reactive.initialize();\n }\n\n /**\n * Specifies the default options that SvelteApplication supports.\n *\n * @returns {import('@typhonjs-fvtt/runtime/svelte/application').SvelteApplicationOptions} options - Application options.\n * @see https://foundryvtt.com/api/interfaces/client.ApplicationOptions.html\n *\n * @internal\n */\n static get defaultOptions()\n {\n return deepMerge(super.defaultOptions, {\n defaultCloseAnimation: true, // If false the default slide close animation is not run.\n draggable: true, // If true then application shells are draggable.\n focusAuto: true, // When true auto-management of app focus is enabled.\n focusKeep: false, // When `focusAuto` and `focusKeep` is true; keeps internal focus.\n focusSource: void 0, // Stores any A11yFocusSource data that is applied when app is closed.\n focusTrap: true, // When true focus trapping / wrapping is enabled keeping focus inside app.\n headerButtonNoClose: false, // If true then the close header button is removed.\n headerButtonNoLabel: false, // If true then header button labels are removed for application shells.\n headerIcon: void 0, // Sets a header icon given an image URL.\n headerNoTitleMinimized: false, // If true then header title is hidden when application is minimized.\n minHeight: MIN_WINDOW_HEIGHT, // Assigned to position. Number specifying minimum window height.\n minWidth: MIN_WINDOW_WIDTH, // Assigned to position. Number specifying minimum window width.\n positionable: true, // If false then `position.set` does not take effect.\n positionInitial: TJSPosition.Initial.browserCentered, // A helper for initial position placement.\n positionOrtho: true, // When true TJSPosition is optimized for orthographic use.\n positionValidator: TJSPosition.Validators.transformWindow, // A function providing the default validator.\n sessionStorage: void 0, // An instance of TJSWebStorage (session) to share across SvelteApplications.\n svelte: void 0, // A Svelte configuration object.\n transformOrigin: 'top left' // By default, 'top / left' respects rotation when minimizing.\n });\n }\n\n /**\n * Returns the content element if an application shell is mounted.\n *\n * @returns {HTMLElement} Content element.\n */\n get elementContent() { return this.#elementContent; }\n\n /**\n * Returns the target element or main element if no target defined.\n *\n * @returns {HTMLElement} Target element.\n */\n get elementTarget() { return this.#elementTarget; }\n\n /**\n * Returns the reactive accessors & Svelte stores for SvelteApplication.\n *\n * @returns {import('./internal/state-reactive/types').SvelteReactive} The reactive accessors & Svelte stores.\n */\n get reactive() { return this.#reactive; }\n\n /**\n * Returns the application state manager.\n *\n * @returns {import('./internal/state-app/types').ApplicationState} The application state manager.\n */\n get state() { return this.#applicationState; }\n\n /**\n * Returns the Svelte helper class w/ various methods to access mounted Svelte components.\n *\n * @returns {import('./internal/state-svelte/types').GetSvelteData} GetSvelteData\n */\n get svelte() { return this.#getSvelteData; }\n\n /**\n * In this case of when a template is defined in app options `html` references the inner HTML / template. However,\n * to activate classic v1 tabs for a Svelte component the element target is passed as an array simulating JQuery as\n * the element is retrieved immediately and the core listeners use standard DOM queries.\n *\n * @protected\n * @ignore\n * @internal\n */\n _activateCoreListeners(html)\n {\n super._activateCoreListeners(typeof this.options.template === 'string' ? html :\n [this.popOut ? this.#elementTarget?.firstChild : this.#elementTarget]);\n }\n\n /**\n * Provide an override to set this application as the active window regardless of z-index. Changes behaviour from\n * Foundry core. This is important / used for instance in dialog key handling for left / right button selection.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.force=false] - Force bring to top; will increment z-index by popOut order.\n *\n * @ignore\n * @internal\n */\n bringToTop({ force = false } = {})\n {\n if (force || this.popOut) { super.bringToTop(); }\n\n // If the activeElement is not `document.body` and not contained in this app via elementTarget then blur the\n // current active element and make `document.body`focused. This allows key to close all open apps / windows.\n if (document.activeElement !== document.body && !this.elementTarget.contains(document.activeElement))\n {\n // Blur current active element.\n if (document.activeElement instanceof HTMLElement) { document.activeElement.blur(); }\n\n // Make document body focused.\n document.body.focus();\n }\n\n globalThis.ui.activeWindow = this;\n }\n\n /**\n * Note: This method is fully overridden and duplicated as Svelte components need to be destroyed manually and the\n * best visual result is to destroy them after the default slide up animation occurs, but before the element\n * is removed from the DOM.\n *\n * If you destroy the Svelte components before the slide up animation the Svelte elements are removed immediately\n * from the DOM. The purpose of overriding ensures the slide up animation is always completed before\n * the Svelte components are destroyed and then the element is removed from the DOM.\n *\n * Close the application and un-register references to it within UI mappings.\n * This function returns a Promise which resolves once the window closing animation concludes\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {boolean} [options.force] - Force close regardless of render state.\n *\n * @returns {Promise} A Promise which resolves once the application is closed.\n *\n * @ignore\n * @internal\n */\n async close(options = {})\n {\n const states = Application.RENDER_STATES;\n if (!options.force && ![states.RENDERED, states.ERROR].includes(this._state)) { return; }\n\n // Unsubscribe from any local stores.\n this.#stores.unsubscribe();\n\n /**\n * @ignore\n * @internal\n */\n this._state = states.CLOSING;\n\n /**\n * Get the element.\n *\n * @type {HTMLElement}\n */\n const el = this.#elementTarget;\n if (!el) { return this._state = states.CLOSED; }\n\n // Make any window content overflow hidden to avoid any scrollbars appearing in default or Svelte outro\n // transitions.\n const content = el.querySelector('.window-content');\n if (content)\n {\n content.style.overflow = 'hidden';\n\n // Set all children of content to overflow hidden as if there is going to be additional scrolling elements\n // they are likely one level deep.\n for (let cntr = content.children.length; --cntr >= 0;)\n {\n content.children[cntr].style.overflow = 'hidden';\n }\n }\n\n // Dispatch Hooks for closing the base and subclass applications\n for (const cls of this.constructor._getInheritanceChain())\n {\n /**\n * A hook event that fires whenever this Application is closed.\n *\n * Note: JQuery wrapping as Foundry event arguments uses JQuery.\n */\n Hooks.call(`close${cls.name}`, this, $(el));\n }\n\n // If options `defaultCloseAnimation` is false then do not execute the standard slide up animation.\n // This allows Svelte components to provide any out transition. Application shells will automatically set\n // `defaultCloseAnimation` based on any out transition set or unset.\n const animate = typeof this.options.defaultCloseAnimation === 'boolean' ? this.options.defaultCloseAnimation :\n true;\n\n if (animate)\n {\n // Set min height for full slide.\n el.style.minHeight = '0';\n\n const { paddingBottom, paddingTop } = globalThis.getComputedStyle(el);\n\n // Slide-up application.\n await el.animate([\n { maxHeight: `${el.clientHeight}px`, paddingTop, paddingBottom },\n { maxHeight: 0, paddingTop: 0, paddingBottom: 0 }\n ], { duration: 250, easing: 'ease-in', fill: 'forwards' }).finished;\n }\n\n // Stores the Promises returned from running outro transitions and destroying each Svelte component.\n const svelteDestroyPromises = [];\n\n // Manually invoke the destroy callbacks for all Svelte components.\n for (const entry of this.#svelteData)\n {\n // Use `outroAndDestroy` to run outro transitions before destroying.\n svelteDestroyPromises.push(outroAndDestroy(entry.component));\n\n // If any proxy eventbus has been added then remove all event registrations from the component.\n const eventbus = entry.config.eventbus;\n if (isObject(eventbus) && typeof eventbus.off === 'function')\n {\n eventbus.off();\n entry.config.eventbus = void 0;\n }\n }\n\n // Await all Svelte components to destroy.\n await Promise.all(svelteDestroyPromises);\n\n // Remove from all visible apps tracked.\n TJSAppIndex.delete(this);\n\n // Reset SvelteData like this to maintain reference to GetSvelteData / `this.svelte`.\n this.#svelteData.length = 0;\n\n // Remove element from the DOM. Most SvelteComponents have already removed it.\n el.remove();\n\n // Silently restore any width / height state before minimized as applicable.\n this.position.state.restore({\n name: '#beforeMinimized',\n properties: ['width', 'height'],\n silent: true,\n remove: true\n });\n\n // Clean up data\n this.#applicationShellHolder[0] = null;\n\n /**\n * @ignore\n * @internal\n */\n this._element = null;\n this.#elementContent = null;\n this.#elementTarget = null;\n\n delete globalThis.ui.windows[this.appId];\n\n /**\n * @ignore\n * @internal\n */\n this._minimized = false;\n\n /**\n * @ignore\n * @internal\n */\n this._scrollPositions = null;\n\n /**\n * @ignore\n * @internal\n */\n this._state = states.CLOSED;\n\n this.#onMount = false;\n\n // Update the minimized UI store state.\n this.#stores.uiStateUpdate((storeOptions) => deepMerge(storeOptions, { minimized: this._minimized }));\n\n // Apply any stored focus options and then remove them from options.\n A11yHelper.applyFocusSource(this.options.focusSource);\n\n delete this.options.focusSource;\n }\n\n /**\n * Inject the Svelte components defined in `this.options.svelte`. The Svelte component can attach to the existing\n * pop-out of Application or provide no template and render into a document fragment which is then attached to the\n * DOM.\n *\n * @protected\n * @ignore\n * @internal\n */\n _injectHTML(html)\n {\n if (this.popOut && html.length === 0 && isIterable(this.options.svelte))\n {\n throw new Error(\n 'SvelteApplication - _injectHTML - A popout app with no template can only support one Svelte component.');\n }\n\n // Make sure the store is updated with the latest header buttons. Also allows filtering buttons before display.\n this.reactive.updateHeaderButtons();\n\n // Create a function to generate a callback for Svelte components to invoke to update the tracked elements for\n // application shells in the rare cases that the main element root changes. The update is only trigged on\n // successive changes of `elementRoot`. Returns a boolean to indicate the element roots are updated.\n const elementRootUpdate = () =>\n {\n let cntr = 0;\n\n return (elementRoot) =>\n {\n if (elementRoot !== null && elementRoot !== void 0 && cntr++ > 0)\n {\n this.#updateApplicationShell();\n return true;\n }\n\n return false;\n };\n };\n\n if (isIterable(this.options.svelte))\n {\n for (const svelteConfig of this.options.svelte)\n {\n const svelteData = loadSvelteConfig({\n app: this,\n template: html[0],\n config: svelteConfig,\n elementRootUpdate\n });\n\n if (isApplicationShell(svelteData.component))\n {\n if (this.svelte.applicationShell !== null)\n {\n throw new Error(\n `SvelteApplication - _injectHTML - An application shell is already mounted; offending config:\n ${JSON.stringify(svelteConfig)}`);\n }\n\n this.#applicationShellHolder[0] = svelteData.component;\n\n // If Vite / HMR / svelte_hmr is enabled then add a hook to receive callbacks when the ProxyComponent\n // refreshes. Update the element root accordingly and force an update to TJSPosition.\n // See this issue for info about `on_hmr`:\n // https://github.com/sveltejs/svelte-hmr/issues/57\n if (isHMRProxy(svelteData.component) && Array.isArray(svelteData.component?.$$?.on_hmr))\n {\n svelteData.component.$$.on_hmr.push(() => () => this.#updateApplicationShell());\n }\n }\n\n this.#svelteData.push(svelteData);\n }\n }\n else if (isObject(this.options.svelte))\n {\n const svelteData = loadSvelteConfig({\n app: this,\n template: html[0],\n config: this.options.svelte,\n elementRootUpdate\n });\n\n if (isApplicationShell(svelteData.component))\n {\n // A sanity check as shouldn't hit this case as only one component is being mounted.\n if (this.svelte.applicationShell !== null)\n {\n throw new Error(\n `SvelteApplication - _injectHTML - An application shell is already mounted; offending config:\n ${JSON.stringify(this.options.svelte)}`);\n }\n\n this.#applicationShellHolder[0] = svelteData.component;\n\n // If Vite / HMR / svelte_hmr is enabled then add a hook to receive callbacks when the ProxyComponent\n // refreshes. Update the element root accordingly and force an update to TJSPosition.\n // See this issue for info about `on_hmr`:\n // https://github.com/sveltejs/svelte-hmr/issues/57\n if (isHMRProxy(svelteData.component) && Array.isArray(svelteData.component?.$$?.on_hmr))\n {\n svelteData.component.$$.on_hmr.push(() => () => this.#updateApplicationShell());\n }\n }\n\n this.#svelteData.push(svelteData);\n }\n\n // Detect if this is a synthesized DocumentFragment.\n const isDocumentFragment = html.length && html[0] instanceof DocumentFragment;\n\n // If any of the Svelte components mounted directly targets an HTMLElement then do not inject HTML.\n let injectHTML = true;\n for (const svelteData of this.#svelteData)\n {\n if (!svelteData.injectHTML) { injectHTML = false; break; }\n }\n if (injectHTML) { super._injectHTML(html); }\n\n if (this.svelte.applicationShell !== null)\n {\n this._element = $(this.svelte.applicationShell.elementRoot);\n\n // Detect if the application shell exports an `elementContent` accessor.\n this.#elementContent = hasGetter(this.svelte.applicationShell, 'elementContent') ?\n this.svelte.applicationShell.elementContent : null;\n\n // Detect if the application shell exports an `elementTarget` accessor.\n this.#elementTarget = hasGetter(this.svelte.applicationShell, 'elementTarget') ?\n this.svelte.applicationShell.elementTarget : null;\n }\n else if (isDocumentFragment) // Set the element of the app to the first child element in order of Svelte components mounted.\n {\n for (const svelteData of this.#svelteData)\n {\n if (svelteData.element instanceof HTMLElement)\n {\n this._element = $(svelteData.element);\n break;\n }\n }\n }\n\n // Potentially retrieve a specific target element if `selectorTarget` is defined otherwise make the target the\n // main element.\n if (this.#elementTarget === null)\n {\n this.#elementTarget = typeof this.options.selectorTarget === 'string' ?\n this._element[0].querySelector(this.options.selectorTarget) : this._element[0];\n }\n\n if (this.#elementTarget === null || this.#elementTarget === void 0)\n {\n throw new Error(`SvelteApplication - _injectHTML: Target element '${this.options.selectorTarget}' not found.`);\n }\n\n // The initial zIndex may be set in application options or for popOut applications is stored by `_renderOuter`\n // in `this.#initialZIndex`.\n if (typeof this.options.positionable === 'boolean' && this.options.positionable)\n {\n this.#elementTarget.style.zIndex = typeof this.options.zIndex === 'number' ? this.options.zIndex :\n this.#initialZIndex ?? 95;\n }\n\n // Subscribe to local store handling.\n this.#stores.subscribe();\n }\n\n /**\n * Provides a mechanism to update the UI options store for maximized.\n *\n * Note: the sanity check is duplicated from {@link Application.maximize} the store is updated _before_\n * performing the rest of animations. This allows application shells to remove / show any resize handlers\n * correctly. Extra constraint data is stored in a saved position state in {@link SvelteApplication.minimize}\n * to animate the content area.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.animate=true] - When true perform default maximizing animation.\n *\n * @param {number} [opts.duration=0.1] - Controls content area animation duration in seconds.\n */\n async maximize({ animate = true, duration = 0.1 } = {})\n {\n if (!this.popOut || [false, null].includes(this._minimized)) { return; }\n\n this._minimized = null;\n\n const durationMS = duration * 1000; // For WAAPI.\n\n // Get content\n const element = this.elementTarget;\n const header = element.querySelector('.window-header');\n const content = element.querySelector('.window-content');\n\n // Get the complete position before minimized. Used to reset min width & height to initial values later.\n const positionBefore = this.position.state.get({ name: '#beforeMinimized' });\n\n // First animate / restore width / async.\n if (animate)\n {\n await this.position.state.restore({\n name: '#beforeMinimized',\n async: true,\n animateTo: true,\n properties: ['width'],\n duration: 0.1\n });\n }\n\n element.classList.remove('minimized');\n\n // Reset display none on all children of header.\n for (let cntr = header.children.length; --cntr >= 0;) { header.children[cntr].style.display = null; }\n\n content.style.display = null;\n\n let constraints;\n\n if (animate)\n {\n // Next animate / restore height synchronously and remove key. Retrieve constraints data for slide up animation\n // below.\n ({ constraints } = this.position.state.restore({\n name: '#beforeMinimized',\n animateTo: true,\n properties: ['height'],\n remove: true,\n duration\n }));\n }\n else\n {\n ({ constraints } = this.position.state.remove({ name: '#beforeMinimized' }));\n }\n\n // Slide down content with stored constraints.\n await content.animate([\n { maxHeight: 0, paddingTop: 0, paddingBottom: 0, offset: 0 },\n { ...constraints, offset: 1 },\n { maxHeight: '100%', offset: 1 },\n ], { duration: durationMS, fill: 'forwards' }).finished; // WAAPI in ms.\n\n // Restore previous min width & height from saved data, app options, or default Foundry values.\n this.position.set({\n minHeight: positionBefore.minHeight ?? this.options?.minHeight ?? MIN_WINDOW_HEIGHT,\n minWidth: positionBefore.minWidth ?? this.options?.minWidth ?? MIN_WINDOW_WIDTH,\n });\n\n // Remove inline styles that override any styles assigned to the app.\n element.style.minWidth = null;\n element.style.minHeight = null;\n\n this._minimized = false;\n\n // Using a 50ms timeout prevents any instantaneous display of scrollbars with the above maximize animation.\n setTimeout(() =>\n {\n content.style.overflow = null;\n\n // Reset all children of content removing overflow hidden.\n for (let cntr = content.children.length; --cntr >= 0;)\n {\n content.children[cntr].style.overflow = null;\n }\n }, 50);\n\n this.#stores.uiStateUpdate((options) => deepMerge(options, { minimized: false }));\n }\n\n /**\n * Provides a mechanism to update the UI options store for minimized.\n *\n * Note: the sanity check is duplicated from {@link Application.minimize} the store is updated _before_\n * performing the rest of animations. This allows application shells to remove / show any resize handlers\n * correctly. Extra constraint data is stored in a saved position state in {@link SvelteApplication.minimize}\n * to animate the content area.\n *\n * @param {object} [opts] - Optional parameters\n *\n * @param {boolean} [opts.animate=true] - When true perform default minimizing animation.\n *\n * @param {number} [opts.duration=0.1] - Controls content area animation duration in seconds.\n */\n async minimize({ animate = true, duration = 0.1 } = {})\n {\n if (!this.rendered || !this.popOut || [true, null].includes(this._minimized)) { return; }\n\n this.#stores.uiStateUpdate((options) => deepMerge(options, { minimized: true }));\n\n this._minimized = null;\n\n const durationMS = duration * 1000; // For WAAPI.\n\n const element = this.elementTarget;\n\n // Get content\n const header = element.querySelector('.window-header');\n const content = element.querySelector('.window-content');\n\n // Save current max / min height & width.\n const beforeMinWidth = this.position.minWidth;\n const beforeMinHeight = this.position.minHeight;\n\n // Set minimized min width & height for header bar.\n this.position.set({ minWidth: 100, minHeight: 30 });\n\n // Also set inline styles to override any styles scoped to the app.\n element.style.minWidth = '100px';\n element.style.minHeight = '30px';\n\n if (content)\n {\n content.style.overflow = 'hidden';\n\n // Set all children of content to overflow hidden as if there is going to be additional scrolling elements\n // they are likely one level deep.\n for (let cntr = content.children.length; --cntr >= 0;)\n {\n content.children[cntr].style.overflow = 'hidden';\n }\n }\n\n const { paddingBottom, paddingTop } = globalThis.getComputedStyle(content);\n\n // Extra data that is saved with the current position. Used during `maximize`.\n const constraints = {\n maxHeight: `${content.clientHeight}px`,\n paddingTop,\n paddingBottom\n };\n\n // Slide-up content\n if (animate)\n {\n const animation = content.animate([\n constraints,\n { maxHeight: 0, paddingTop: 0, paddingBottom: 0 }\n ], { duration: durationMS, fill: 'forwards' }); // WAAPI in ms.\n\n // Set display style to none when animation finishes.\n animation.finished.then(() => content.style.display = 'none');\n }\n else\n {\n setTimeout(() => content.style.display = 'none', durationMS);\n }\n\n // Save current position state and add the constraint data to use in `maximize`.\n const saved = this.position.state.save({ name: '#beforeMinimized', constraints });\n\n // Set the initial before min width & height.\n saved.minWidth = beforeMinWidth;\n saved.minHeight = beforeMinHeight;\n\n const headerOffsetHeight = header.offsetHeight;\n\n // minHeight needs to be adjusted to header height.\n this.position.minHeight = headerOffsetHeight;\n\n if (animate)\n {\n // First await animation of height upward.\n await this.position.animate.to({ height: headerOffsetHeight }, { duration }).finished;\n }\n\n // Set all header buttons besides close and the window title to display none.\n for (let cntr = header.children.length; --cntr >= 0;)\n {\n const className = header.children[cntr].className;\n\n if (className.includes('window-title') || className.includes('close')) { continue; }\n\n // v10+ of Foundry core styles automatically hides anything besides the window title and close button, so\n // explicitly set display to block.\n if (className.includes('keep-minimized'))\n {\n header.children[cntr].style.display = 'block';\n continue;\n }\n\n header.children[cntr].style.display = 'none';\n }\n\n if (animate)\n {\n // Await animation of width to the left / minimum width.\n await this.position.animate.to({ width: MIN_WINDOW_WIDTH }, { duration: 0.1 }).finished;\n }\n\n element.classList.add('minimized');\n\n this._minimized = true;\n }\n\n /**\n * Provides a callback after all Svelte components are initialized.\n *\n * @param {import('./internal/state-svelte/types').MountedAppShell} [mountedAppShell] - The mounted app shell\n * elements.\n */\n onSvelteMount(mountedAppShell) {} // eslint-disable-line no-unused-vars\n\n /**\n * Provides a callback after the main application shell is remounted. This may occur during HMR / hot module\n * replacement or directly invoked from the `elementRootUpdate` callback passed to the application shell component\n * context.\n *\n * @param {import('./internal/state-svelte/types').MountedAppShell} [mountedAppShell] - The mounted app shell\n * elements.\n */\n onSvelteRemount(mountedAppShell) {} // eslint-disable-line no-unused-vars\n\n /**\n * Override replacing HTML as Svelte components control the rendering process. Only potentially change the outer\n * application frame / title for pop-out applications.\n *\n * @protected\n * @ignore\n * @internal\n */\n _replaceHTML(element, html) // eslint-disable-line no-unused-vars\n {\n if (!element.length) { return; }\n\n this.reactive.updateHeaderButtons();\n }\n\n /**\n * Provides an override verifying that a new Application being rendered for the first time doesn't have a\n * corresponding DOM element already loaded. This is a check that only occurs when `this._state` is\n * `Application.RENDER_STATES.NONE`. It is useful in particular when SvelteApplication has a static ID\n * explicitly set in `this.options.id` and long intro / outro transitions are assigned. If a new application\n * sharing this static ID attempts to open / render for the first time while an existing DOM element sharing\n * this static ID exists then the initial render is cancelled below rather than crashing later in the render\n * cycle {@link TJSPosition.set}.\n *\n * @protected\n * @ignore\n * @internal\n */\n async _render(force = false, options = {})\n {\n // Store any focusSource instance.\n if (isObject(options?.focusSource)) { this.options.focusSource = options.focusSource; }\n\n if (this._state === Application.RENDER_STATES.NONE &&\n document.querySelector(`#${this.id}`) instanceof HTMLElement)\n {\n console.warn(`SvelteApplication - _render: A DOM element already exists for CSS ID '${this.id\n }'. Cancelling initial render for new application with appId '${this.appId}'.`);\n\n return;\n }\n\n await super._render(force, options);\n\n // Handle the same render exclusion tests that reject a render in Application.\n\n // Do not render under certain conditions.\n if ([Application.RENDER_STATES.CLOSING, Application.RENDER_STATES.RENDERING].includes(this._state)) { return; }\n\n // Applications which are not currently rendered must be forced.\n if (!force && (this._state <= Application.RENDER_STATES.NONE)) { return; }\n\n // It is necessary to directly invoke `position.set` as TJSPosition uses accessors and is not a bare object, so\n // the merging that occurs is `Application._render` does not take effect.\n if (!this._minimized) { this.#position.set(options); }\n\n if (!this.#onMount)\n {\n // Add to visible apps tracked.\n TJSAppIndex.add(this);\n\n this.onSvelteMount({ element: this._element[0], elementContent: this.#elementContent, elementTarget:\n this.#elementTarget });\n\n this.#onMount = true;\n }\n }\n\n /**\n * Render the inner application content. Only render a template if one is defined otherwise provide an empty\n * JQuery element per the core Foundry API.\n *\n * @protected\n * @ignore\n * @internal\n */\n async _renderInner(data)\n {\n const html = typeof this.template === 'string' ? await renderTemplate(this.template, data) :\n document.createDocumentFragment();\n\n return $(html);\n }\n\n /**\n * Stores the initial z-index set in `_renderOuter` which is used in `_injectHTML` to set the target element\n * z-index after the Svelte component is mounted.\n *\n * @protected\n * @ignore\n * @internal\n */\n async _renderOuter()\n {\n const html = await super._renderOuter();\n this.#initialZIndex = html[0].style.zIndex;\n return html;\n }\n\n /**\n * All calculation and updates of position are implemented in {@link TJSPosition.set}. This allows position to be fully\n * reactive and in control of updating inline styles for the application.\n *\n * This method remains for backward compatibility with Foundry. If you have a custom override quite likely you need\n * to update to using the {@link TJSPosition.validators} functionality.\n *\n * @param {import('@typhonjs-fvtt/runtime/svelte/store/position').TJSPositionDataExtended} [position] - TJSPosition data.\n *\n * @returns {TJSPosition} The updated position object for the application containing the new values.\n * @ignore\n */\n setPosition(position)\n {\n return this.position.set(position);\n }\n\n /**\n * This method is invoked by the `elementRootUpdate` callback that is added to the external context passed to\n * Svelte components. When invoked it updates the local element roots tracked by SvelteApplication.\n *\n * This method may also be invoked by HMR / hot module replacement via `svelte-hmr`.\n */\n #updateApplicationShell()\n {\n const applicationShell = this.svelte.applicationShell;\n\n if (applicationShell !== null)\n {\n this._element = $(applicationShell.elementRoot);\n\n // Detect if the application shell exports an `elementContent` accessor.\n this.#elementContent = hasGetter(applicationShell, 'elementContent') ?\n applicationShell.elementContent : null;\n\n // Detect if the application shell exports an `elementTarget` accessor.\n this.#elementTarget = hasGetter(applicationShell, 'elementTarget') ?\n applicationShell.elementTarget : null;\n\n if (this.#elementTarget === null)\n {\n this.#elementTarget = typeof this.options.selectorTarget === 'string' ?\n this._element[0].querySelector(this.options.selectorTarget) : this._element[0];\n }\n\n // The initial zIndex may be set in application options or for popOut applications is stored by `_renderOuter`\n // in `this.#initialZIndex`.\n if (typeof this.options.positionable === 'boolean' && this.options.positionable)\n {\n this.#elementTarget.style.zIndex = typeof this.options.zIndex === 'number' ? this.options.zIndex :\n this.#initialZIndex ?? 95;\n\n super.bringToTop();\n\n // Ensure that new root element has inline position styles set.\n this.position.set(this.position.get());\n }\n\n super._activateCoreListeners([this.popOut ? this.#elementTarget?.firstChild : this.#elementTarget]);\n\n this.onSvelteRemount({ element: this._element[0], elementContent: this.#elementContent, elementTarget:\n this.#elementTarget });\n }\n }\n}\n","/**\n * Provides management of a single Promise that can be shared and accessed across JS & Svelte components. This allows a\n * Promise to be created and managed as part of the TRL application lifecycle and accessed safely in various control\n * flow scenarios. When resolution of the current managed Promise starts further interaction is prevented.\n *\n * Note: to enable debugging / log statements set the static `logging` variable to true.\n */\nclass ManagedPromise\n{\n /** @type {boolean} */\n static #logging = false;\n\n /** @type {{ isProcessing?: boolean, promise?: Promise, reject: Function, resolve: Function }} */\n #current;\n\n /**\n * @returns {boolean} Whether global logging is enabled.\n */\n static get logging()\n {\n return this.#logging;\n }\n\n /**\n * @returns {boolean} Whether there is an active managed Promise.\n */\n get isActive()\n {\n return this.#current !== void 0;\n }\n\n /**\n * @returns {boolean} Whether there is an active managed Promise and resolution is currently being processed.\n */\n get isProcessing()\n {\n return this.#current !== void 0 ? this.#current.isProcessing : false;\n }\n\n /**\n * Sets global logging enabled state.\n *\n * @param {boolean} logging - New logging enabled state.\n */\n static set logging(logging)\n {\n if (typeof logging !== 'boolean')\n {\n throw new TypeError(`[TRL] ManagedPromise.logging error: 'logging' is not a boolean.`);\n }\n\n this.#logging = logging;\n }\n\n // ----------------------------------------------------------------------------------------------------------------\n\n /**\n * Resolves any current Promise with undefined and creates a new current Promise.\n *\n * @template T\n *\n * @param {object} opts - Options.\n *\n * @param {boolean} [opts.reuse=false] - When true if there is an existing live Promise it is returned immediately.\n *\n * @returns {Promise} The new current managed Promise.\n */\n create({ reuse = false } = {})\n {\n if (typeof reuse !== 'boolean')\n {\n throw new TypeError(`[TRL] ManagedPromise.create error: 'reuse' is not a boolean.`);\n }\n\n if (reuse && this.#current !== void 0 && this.#current.promise instanceof Promise)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.create info: Reusing / returning existing managed Promise.`);\n }\n\n return this.#current.promise;\n }\n\n if (this.#current !== void 0)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(\n `[TRL] ManagedPromise.create info: Creating a new Promise and resolving existing immediately.`);\n }\n\n this.#current.resolve(void 0);\n this.#current = void 0;\n }\n\n const promise = new Promise((resolve, reject) =>\n {\n this.#current = {\n isProcessing: false,\n reject,\n resolve\n };\n });\n\n this.#current.promise = promise;\n\n return promise;\n }\n\n /**\n * Gets the current Promise if any.\n *\n * @returns {Promise} Current Promise.\n */\n get()\n {\n return this.#current ? this.#current.promise : void 0;\n }\n\n /**\n * Rejects the current Promise if applicable.\n *\n * @param {*} [result] - Result to reject.\n *\n * @returns {boolean} Was the promise rejected.\n */\n reject(result = void 0)\n {\n // Early out as Promise resolution is currently processing.\n if (this.#current !== void 0 && this.#current.isProcessing)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.reject info: Currently processing promise.`);\n }\n\n return true;\n }\n\n if (this.#current !== void 0)\n {\n this.#current.isProcessing = true;\n\n if (result instanceof Promise)\n {\n result.then((value) =>\n {\n this.#current.reject(value);\n this.#current = void 0;\n }).catch((err) =>\n {\n this.#current.reject(err);\n this.#current = void 0;\n });\n }\n else\n {\n this.#current.reject(result);\n this.#current = void 0;\n }\n\n return true;\n }\n else\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.reject warning: No current managed Promise to reject.`);\n }\n\n return false;\n }\n }\n\n /**\n * Resolves the current Promise if applicable.\n *\n * @param {*} [result] - Result to resolve.\n *\n * @returns {boolean} Was the promise resolved.\n */\n resolve(result = void 0)\n {\n // Early out as Promise resolution is currently processing.\n if (this.#current !== void 0 && this.#current.isProcessing)\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.resolve info: Currently processing promise.`);\n }\n\n return true;\n }\n\n if (this.#current !== void 0)\n {\n if (result instanceof Promise)\n {\n this.#current.isProcessing = true;\n\n result.then((value) =>\n {\n this.#current.resolve(value);\n this.#current = void 0;\n }).catch((err) =>\n {\n this.#current.reject(err);\n this.#current = void 0;\n });\n }\n else\n {\n this.#current.resolve(result);\n this.#current = void 0;\n }\n\n return true;\n }\n else\n {\n if (ManagedPromise.#logging)\n {\n console.warn(`[TRL] ManagedPromise.resolve warning: No current managed Promise to resolve.`);\n }\n\n return false;\n }\n }\n}\n\nexport { ManagedPromise };\n//# sourceMappingURL=index.js.map\n","import {\n deepMerge,\n isObject,\n safeAccess,\n safeSet } from '@typhonjs-fvtt/runtime/util/object';\n\n/**\n * Provides storage for all dialog options through individual accessors and `get`, `merge`, `replace` and `set` methods\n * that safely access and update data changed to the mounted DialogShell component reactively.\n */\nexport class TJSDialogData\n{\n /**\n * @type {import('../../index.js').SvelteApplication}\n */\n #application;\n\n /**\n * Stores the dialog options data.\n *\n * @type {import('./types').TJSDialogOptions}\n */\n #internal = {};\n\n /**\n * @param {import('../../index.js').SvelteApplication} application - The host Foundry application.\n */\n constructor(application)\n {\n this.#application = application;\n }\n\n /**\n * @returns {Record} The dialog button configuration.\n */\n get buttons()\n {\n return this.#internal.buttons;\n }\n\n /**\n * Set the dialog button configuration.\n *\n * @param {string} buttons - New dialog button configuration.\n */\n set buttons(buttons)\n {\n this.#internal.buttons = buttons;\n this.#updateComponent();\n }\n\n /**\n * @returns {import('@typhonjs-fvtt/runtime/svelte/util').TJSSvelteConfig | string} The Svelte configuration object or HTML string\n * content.\n */\n get content()\n {\n return this.#internal.content;\n }\n\n /**\n * Set the Svelte configuration object or HTML string content.\n *\n * @param {import('@typhonjs-fvtt/runtime/svelte/util').TJSSvelteConfig | string} content - New Svelte configuration object or\n * HTML string content.\n */\n set content(content)\n {\n this.#internal.content = content;\n this.#updateComponent();\n }\n\n /**\n * @returns {string} The default button ID to focus initially.\n */\n get default()\n {\n return this.#internal.default;\n }\n\n /**\n * Set the default button ID to focus initially.\n *\n * @param {string} newDefault - New default button ID to focus initially.\n */\n set default(newDefault)\n {\n this.#internal.default = newDefault;\n this.#updateComponent();\n }\n\n /**\n * @returns {boolean} The dialog draggable state; draggable when true.\n */\n get draggable()\n {\n return this.#internal.draggable;\n }\n\n /**\n * Set the dialog state; draggable when true.\n *\n * @param {boolean} draggable - New dialog draggable state; draggable when true.\n */\n set draggable(draggable)\n {\n this.#internal.draggable = draggable;\n this.#updateComponent();\n }\n\n /**\n * @returns {boolean} When true auto-management of app focus is enabled.\n */\n get focusAuto()\n {\n return this.#internal.focusAuto;\n }\n\n /**\n * Set the dialog auto-management of app focus.\n *\n * @param {boolean} focusAuto - New dialog auto-management of app focus.\n */\n set focusAuto(focusAuto)\n {\n this.#internal.focusAuto = focusAuto;\n this.#updateComponent();\n }\n\n /**\n * @returns {boolean} When true the first focusable element that isn't a button is focused.\n */\n get focusFirst()\n {\n return this.#internal.focusFirst;\n }\n\n /**\n * Set the dialog first focusable element state.\n *\n * @param {boolean} focusFirst - New dialog first focusable element state.\n */\n set focusFirst(focusFirst)\n {\n this.#internal.focusFirst = focusFirst;\n this.#updateComponent();\n }\n\n /**\n * @returns {boolean} When `focusAuto` and `focusKeep` is true; keeps internal focus.\n */\n get focusKeep()\n {\n return this.#internal.focusKeep;\n }\n\n /**\n * Set the dialog `focusKeep` state. When `focusAuto` and `focusKeep` is true; keeps internal focus.\n *\n * @param {boolean} focusKeep - New dialog `focusKeep` state.\n */\n set focusKeep(focusKeep)\n {\n this.#internal.focusKeep = focusKeep;\n this.#updateComponent();\n }\n\n /**\n * @returns {boolean} When true the dialog is minimizable.\n */\n get minimizable()\n {\n return this.#internal.minimizable;\n }\n\n /**\n * Set the dialog `minimizable` state. When true the dialog is minimizable.\n *\n * @param {boolean} minimizable - New dialog `minimizable` state.\n */\n set minimizable(minimizable)\n {\n this.#internal.minimizable = minimizable;\n this.#updateComponent();\n }\n\n /**\n * @returns {boolean} When true a modal dialog is displayed.\n */\n get modal()\n {\n return this.#internal.modal;\n }\n\n /**\n * Set the dialog `modal` state. When true a modal dialog is displayed.\n *\n * @param {boolean} modal - New dialog `modal` state.\n */\n set modal(modal)\n {\n this.#internal.modal = modal;\n this.#updateComponent();\n }\n\n /**\n * @returns {import('./types').TJSDialogModalOptions} Additional options for modal dialog display.\n */\n get modalOptions()\n {\n return this.#internal.modalOptions;\n }\n\n /**\n * Set additional options for modal dialog display.\n *\n * @param {import('./types').TJSDialogModalOptions} modalOptions - New additional options for modal dialog display.\n */\n set modalOptions(modalOptions)\n {\n this.#internal.modalOptions = modalOptions;\n this.#updateComponent();\n }\n\n /**\n * @returns {boolean} When true and an error is raised in dialog callback functions post a UI error notification.\n */\n get notifyError()\n {\n return this.#internal.notifyError;\n }\n\n /**\n * Set the dialog `notifyError` state. When true and an error is raised in dialog callback functions post a UI error\n * notification.\n *\n * @param {boolean} notifyError - New dialog `notifyError` state.\n */\n set notifyError(notifyError)\n {\n this.#internal.notifyError = notifyError;\n this.#updateComponent();\n }\n\n /**\n * @returns {string | ((application: import('../../index.js').TJSDialog) => any)} Callback invoked when dialog is\n * closed; no button option selected. When defined as a string any matching function by name exported from\n * content Svelte component is invoked.\n */\n get onClose()\n {\n return this.#internal.onClose;\n }\n\n /**\n * Set callback invoked when dialog is closed; no button option selected. When defined as a string any matching\n * function by name exported from content Svelte component is invoked..\n *\n * @param {string | ((application: import('../../index.js').TJSDialog) => any)} onClose - New dialog `onClose` state.\n */\n set onClose(onClose)\n {\n this.#internal.onClose = onClose;\n this.#updateComponent();\n }\n\n /**\n * @returns {boolean} Dialog `rejectClose` state. When true and a Promise has been created by {@link TJSDialog.wait}\n * and the Promise is not in the process of being resolved or rejected on close of the dialog any `onClose`\n * function is invoked and any result that is undefined will cause the Promise to then be rejected..\n */\n get rejectClose()\n {\n return this.#internal.rejectClose;\n }\n\n /**\n * Set the dialog `rejectClose` state.\n *\n * @param {boolean} rejectClose - New dialog `rejectClose` state.\n */\n set rejectClose(rejectClose)\n {\n this.#internal.rejectClose = rejectClose;\n this.#updateComponent();\n }\n\n /**\n * @returns {boolean} When true the dialog is resizable.\n */\n get resizable()\n {\n return this.#internal.resizable;\n }\n\n /**\n * Set the dialog `resizable` state. When true the dialog is resizable.\n *\n * @param {boolean} resizable - New dialog `resizable` state.\n */\n set resizable(resizable)\n {\n this.#internal.resizable = resizable;\n this.#updateComponent();\n }\n\n /**\n * @returns {boolean} When true and resolving any Promises and there are undefined results from any button callbacks\n * the button ID is resolved.\n */\n get resolveId()\n {\n return this.#internal.resolveId;\n }\n\n /**\n * Set the dialog `resolveId` state. When true and resolving any Promises and there are undefined results from any\n * button callbacks the button ID is resolved.\n *\n * @param {boolean} resolveId - New dialog `resolveId` state.\n */\n set resolveId(resolveId)\n {\n this.#internal.resolveId = resolveId;\n this.#updateComponent();\n }\n\n /**\n * @returns {string} The dialog window title.\n */\n get title()\n {\n return this.#internal.title;\n }\n\n /**\n * Set the dialog window title.\n *\n * @param {string} title - New dialog window title.\n */\n set title(title)\n {\n this.#internal.title = title;\n this.#updateComponent();\n }\n\n /**\n * @returns {import('./types').TJSDialogTransitionOptions} Transition options for the dialog.\n */\n get transition()\n {\n return this.#internal.transition;\n }\n\n /**\n * Set transition options for the dialog.\n *\n * @param {import('./types').TJSDialogTransitionOptions} transition - New transition options for the dialog.\n */\n set transition(transition)\n {\n this.#internal.transition = transition;\n this.#updateComponent();\n }\n\n /**\n * @returns {number | null} A specific z-index for the dialog. Pass null for the dialog to act like other\n * applications in regard bringing to top when activated.\n */\n get zIndex()\n {\n return this.#internal.zIndex;\n }\n\n /**\n * Set specific z-index for the dialog.\n *\n * @param {number | null} zIndex - New z-index for the dialog.\n */\n set zIndex(zIndex)\n {\n this.#internal.zIndex = zIndex;\n this.#updateComponent();\n }\n\n /**\n * Provides a way to safely get this dialogs data given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * @param {string} accessor - The path / key to set. You can set multiple levels.\n *\n * @param {any} [defaultValue] - A default value returned if the accessor is not found.\n *\n * @returns {any} Value at the accessor.\n */\n get(accessor, defaultValue)\n {\n return safeAccess(this.#internal, accessor, defaultValue);\n }\n\n /**\n * @param {import('./types').TJSDialogOptions} data - Merge provided data object into Dialog data.\n */\n merge(data)\n {\n deepMerge(this.#internal, data);\n this.#updateComponent();\n }\n\n /**\n * Sets the dialog data; this is reactive.\n *\n * @param {import('./types').TJSDialogOptions} data - Dialog data.\n */\n replace(data)\n {\n if (!isObject(data)) { throw new TypeError(`TJSDialogData replace error: 'data' is not an object'.`); }\n\n this.#internal = {};\n\n // Merge new data and perform a reactive update.\n this.merge(data);\n }\n\n /**\n * Provides a way to safely set this dialogs data given an accessor string which describes the\n * entries to walk. To access deeper entries into the object format the accessor string with `.` between entries\n * to walk.\n *\n * Automatically the dialog data will be updated in the associated DialogShell Svelte component.\n *\n * @param {string} accessor - The path / key to set. You can set multiple levels.\n *\n * @param {any} value - Value to set.\n *\n * @returns {boolean} True if successful.\n */\n set(accessor, value)\n {\n const success = safeSet(this.#internal, accessor, value);\n\n // If `this.#internal` modified then update the app options store.\n if (success) { this.#updateComponent(); }\n\n return success;\n }\n\n /**\n * Updates the data in the Svelte dialog component.\n */\n #updateComponent()\n {\n const component = this.#application.svelte.component(0);\n if (component?.data) { component.data = this.#internal; }\n }\n}\n","import { DialogShell } from '@typhonjs-fvtt/runtime/svelte/component/core';\n\nimport { ManagedPromise } from '@typhonjs-fvtt/runtime/util/async';\n\nimport {\n deepMerge,\n isObject } from '@typhonjs-fvtt/runtime/util/object';\n\nimport { TJSDialogData } from './internal/state-dialog/index.js';\nimport { SvelteApplication } from './SvelteApplication.js';\n\n/**\n * Provides a reactive dialog implementation configured from a unique dialog options object. The dialog features a\n * bottom button bar for user selection.\n *\n * A glasspane / modal option with various styling and transition capabilities is available when setting `modal: true`.\n *\n * Most importantly the `content` attribute of dialog data can be a Svelte component configuration object to render\n * your custom component as the dialog content. When using a Svelte component as the content you can assign a string\n * to the various `on` dialog callbacks and an exported function from your component will be invoked to handle the\n * button callback. All dialog button callbacks and `onClose` callback receive a single argument which is the dialog /\n * application instance.\n *\n * When making a form with form validation or other dialog that you don't want to close immediately on button press you\n * can set `autoClose: false`, however you are 100% in control of resolving any Promise callbacks from button presses\n * and also closing the application. Each button can also be configured with `autoClose: false` in the button data.\n *\n * There is a handy Promise management capability to track a single Promise for the lifetime of a dialog available\n * at {@link TJSDialog.managedPromise}. By default when the user closes the dialog / application any managed Promise is\n * resolved with `null`. The managed Promise is available in any Svelte content component by using\n * `const managedPromise = getContext('#managedPromise')`. When handling any custom resolution particularly when\n * setting `autoClose: false` for a given button you are 100% in control of resolving or rejecting asynchronous data to\n * return from the dialog.\n *\n * To create and wait upon a managed promise for asynchronous return results use the static or member variation of\n * {@link TJSDialog.wait}.\n *\n * Please refer to {@link TJSDialogOptions} for the various options used to construct the dialog.\n *\n * There are a couple of static helper methods to quickly create standard dialogs such as a 'yes' / 'no' confirmation\n * dialog with {@link TJSDialog.confirm} and an 'ok' single button dialog with {@link TJSDialog.prompt}.\n *\n * TODO: document all extended dialog data parameters such as transition options / modal transitions.\n */\nexport class TJSDialog extends SvelteApplication\n{\n /** @type {TJSDialogData} */\n #data;\n\n /** @type {ManagedPromise} */\n #managedPromise;\n\n /**\n * @param {import('./internal/state-dialog/types').TJSDialogOptions} data - Dialog options.\n *\n * @param {import('./').SvelteApplicationOptions} [options] - SvelteApplication options.\n */\n constructor(data, options = {})\n {\n super(options);\n\n this.#managedPromise = new ManagedPromise();\n\n this.#data = new TJSDialogData(this);\n this.#data.replace(data);\n\n /**\n * @member {object} dialogComponent - A getter to SvelteData to retrieve any mounted Svelte component as the\n * dialog content.\n *\n * @memberof GetSvelteData#\n * @readonly\n */\n Object.defineProperty(this.svelte, 'dialogComponent', {\n get: () => this.svelte?.applicationShell?.dialogComponent,\n });\n }\n\n /**\n * Default options for TJSDialog. Provides a default width and setting `height` to `auto` to always display dialog\n * content even if it changes. The default `DialogShell` / `svelte` options should not be changed and instead mount\n * the dialog content component by supplying a Svelte configuration object to dialog data `content` field.\n *\n * @returns {import('./').SvelteApplicationOptions} Default options\n */\n static get defaultOptions()\n {\n return deepMerge(super.defaultOptions, {\n classes: ['dialog', 'tjs-dialog'],\n width: 400,\n height: 'auto',\n svelte: {\n class: DialogShell,\n intro: true,\n target: document.body,\n props: function() // `this` is the TJSDialog instance when invoked.\n {\n return {\n data: this.#data,\n managedPromise: this.#managedPromise\n };\n }\n }\n });\n }\n\n /**\n * Returns the dialog data.\n *\n * @returns {import('./internal/state-dialog/types').TJSDialogData} Dialog data.\n */\n get data() { return this.#data; }\n\n /**\n * @returns {import('@typhonjs-fvtt/runtime/util/async').ManagedPromise} Returns the managed promise.\n */\n get managedPromise() { return this.#managedPromise; }\n\n /**\n * Close the dialog and un-register references to it within UI mappings.\n * This function returns a Promise which resolves once the window closing animation concludes.\n *\n * @param {object} [options] - Optional parameters.\n *\n * @param {boolean} [options.force] - Force close regardless of render state.\n *\n * @returns {Promise} A Promise which resolves once the application is closed with the callback value or\n * `true`.\n */\n async close(options)\n {\n try\n {\n // Note: When handling a managed promise if a button selection has already been made the managed promise is\n // already processing and the resolution below is skipped.\n if (this.#managedPromise.isActive && !this.#managedPromise.isProcessing)\n {\n const result = TJSDialog.#invokeFn(this.#data.onClose, this, null);\n const rejectClose = typeof this.#data.rejectClose === 'boolean' ? this.#data.rejectClose : false;\n\n if (rejectClose && result === null)\n {\n this.#managedPromise.reject(new Error('TJSDialog was closed without a choice being made.'));\n }\n else\n {\n this.#managedPromise.resolve(result);\n }\n }\n }\n catch (err)\n {\n const notifyError = typeof this.#data.notifyError === 'boolean' ? this.#data.notifyError : true;\n if (notifyError)\n {\n // TODO: When app eventbus is available send event for UI notification instead of Foundry API usage.\n globalThis.ui.notifications.error(err, { console: false });\n }\n\n // If there is a managed Promise reject it or re-throw error.\n if (!this.#managedPromise.reject(err)) { throw err; }\n }\n finally\n {\n await super.close(options);\n }\n }\n\n /**\n * Brings to top or renders this dialog returning a Promise that is resolved any button pressed or when the dialog\n * is closed.\n *\n * Creates an anonymous data defined TJSDialog returning a Promise that can be awaited upon for the user to make a\n * choice.\n *\n * Note: `null` is returned if the dialog is closed without a user making a choice.\n *\n * @template T\n *\n * @param {object} [options] - Options.\n *\n * @param {boolean} [options.reuse=false] - When true if there is an existing managed Promise this allows multiple\n * sources to await on the same result.\n *\n * @returns {Promise} A promise for dialog resolution.\n */\n async wait(options)\n {\n // TODO: Direct usage of Foundry core Application API.\n if (this.rendered)\n {\n this.bringToTop();\n }\n else\n {\n this.render(true, { focus: true });\n }\n\n // Return a managed Promise which is automatically resolved on button press via `DialogContent` component or when\n // the dialog is closed.\n return this.#managedPromise.create(options);\n }\n\n // ---------------------------------------------------------------------------------------------------------------\n\n /**\n * A helper factory method to create simple confirmation dialog windows which consist of simple yes / no prompts.\n * If you require more flexibility, a custom TJSDialog instance is preferred. The default focused button is 'yes'.\n * You can change the default focused button by setting `default` to `yes` or `no`.\n *\n * @template T\n *\n * @param {import('./internal/state-dialog/types').TJSDialogOptions & {\n * onYes?: string|((application: TJSDialog) => any),\n * onNo?: string|((application: TJSDialog) => any)\n * }} [data] - Confirm dialog options.\n *\n * @param {string|((application: TJSDialog) => any)} [data.onYes] - Callback function upon `yes`; may be an async\n * function. When defined as a string any matching function by name exported from content Svelte component is\n * invoked.\n *\n * @param {string|((application: TJSDialog) => any)} [data.onNo] - Callback function upon `no`; may be an async\n * function. When defined as a string any matching function by name exported from content Svelte component is\n * invoked.\n *\n * @param {import('./').SvelteApplicationOptions} [options] SvelteApplication options passed to the TJSDialog\n * constructor.\n *\n * @returns {Promise} A promise which resolves with result of yes / no callbacks or true / false.\n *\n * @example\n * const result = await TJSDialog.confirm({\n * title: 'A Yes or No Question',\n * content: '

Choose wisely.

',\n * onYes: () => 'YES Result'\n * onNo: () => 'NO Result'\n * });\n *\n * // Logs 'YES result', 'NO Result', or null if the user closed the dialog without making a selection.\n * console.log(result);\n */\n static async confirm({ onYes, onNo, ...data } = {}, options = {})\n {\n // Allow overwriting of default icon and labels.\n const mergedButtons = deepMerge({\n yes: {\n icon: 'fas fa-check',\n label: 'Yes'\n },\n no: {\n icon: 'fas fa-times',\n label: 'No',\n }\n }, data.buttons ?? {});\n\n return this.wait({\n ...data,\n buttons: deepMerge(mergedButtons, {\n yes: {\n onPress: (application) => this.#invokeFn(onYes, application, true)\n },\n no: {\n onPress: (application) => this.#invokeFn(onNo, application, false)\n }\n }),\n default: data.default ?? 'yes'\n }, options);\n }\n\n /**\n * A helper method to invoke a callback function directly or lookup an exported function with the same name from any\n * content Svelte component to invoke. This is used internally to apply default values for `confirm` and `prompt`.\n *\n * @param {string|((application: TJSDialog) => any)} callback - Callback function to invoke; may be an async\n * function. When defined as a string any matching function by name exported from content Svelte component is\n * invoked.\n *\n * @param {TJSDialog} application - TJSDialog instance passed to callback.\n *\n * @param {*} [defaultResult] - An optional default result to return; undefined if not specified.\n *\n * @returns {*} Result.\n *\n * @internal\n */\n static #invokeFn(callback, application, defaultResult = void 0)\n {\n let result = defaultResult;\n\n switch (typeof callback)\n {\n case 'function':\n // Pass the dialog instance to the callback.\n result = callback(application);\n break;\n\n case 'string':\n {\n const dialogComponent = application?.svelte?.dialogComponent;\n\n // Attempt lookup by function name in dialog instance component.\n if (dialogComponent !== void 0 && typeof dialogComponent?.[callback] === 'function')\n {\n result = dialogComponent?.[callback](application);\n }\n else\n {\n if (dialogComponent === void 0)\n {\n console.warn(`[TRL] TJSDialog warning: 'onPress' defined as a string with no ` +\n `associated content Svelte component.`);\n }\n else if (typeof dialogComponent?.[callback] !== 'function')\n {\n console.warn(`[TRL] TJSDialog warning: The content Svelte component does not contain ` +\n `an associated function '${callback}'. Did you remember to add ` +\n `'' and export the function?`);\n }\n }\n break;\n }\n }\n\n return result;\n }\n\n /**\n * A helper factory method to display a basic \"prompt\" style TJSDialog with a single button.\n *\n * @template T\n *\n * @param {import('./internal/state-dialog/types').TJSDialogOptions & {\n * onOk?: string|((application: TJSDialog) => any),\n * label?: string,\n * icon?: string\n * }} [data] - Prompt dialog options that includes any TJSDialog options along with the following optional fields:\n *\n * @param {string|((application: TJSDialog) => any)} [data.onOk] - Callback function upon `ok`; may be an async\n * function. When defined as a string any matching function by name exported from content Svelte component is\n * invoked.\n *\n * @param {string} [data.label] - The OK prompt button text.\n *\n * @param {string} [data.icon=\"fas fa-check\"] - Set another icon besides `fas fa-check` for button.\n *\n * @param {import('./').SvelteApplicationOptions} [options] SvelteApplication options passed to the TJSDialog\n * constructor.\n *\n * @returns {Promise} The returned value from the provided callback function or `true` if the button\n * is pressed.\n *\n * @example\n * const result = await TJSDialog.prompt({\n * title: 'Are you OK?',\n * content: '

Are you OK?.

',\n * label: 'Feeling Fine!'\n * onOk: () => 'OK'\n * });\n *\n * // Logs 'OK' or null if the user closed the dialog without making a selection.\n * console.log(result);\n */\n static async prompt({ onOk, label, icon = 'fas fa-check', ...data } = {}, options = {})\n {\n return this.wait({\n ...data,\n buttons: {\n ok: {\n icon,\n label,\n onPress: (application) => this.#invokeFn(onOk, application, true)\n }\n },\n default: 'ok'\n }, options);\n }\n\n /**\n * Creates an anonymous data defined TJSDialog returning a Promise that can be awaited upon for the user to make a\n * choice.\n *\n * Note: By default `null` is returned if the dialog is closed without a user making a choice.\n *\n * @template T\n *\n * @param {import('./internal/state-dialog/types').TJSDialogOptions} data - Dialog data passed to the TJSDialog constructor.\n *\n * @param {import('./').SvelteApplicationOptions} [options] SvelteApplication options passed to the TJSDialog\n * constructor.\n *\n * @returns {Promise} A Promise that resolves to the chosen result.\n */\n static async wait(data, options = {})\n {\n if (!isObject(data)) { throw new TypeError(`TJSDialog.wait error: 'data' is not an object'.`); }\n\n // Instantiate and render the dialog.\n return new this({ ...data }, options).wait();\n }\n}\n","import { SvelteApplication } from './SvelteApplication.js';\nimport { TJSAppIndex } from './internal/index.js';\n\nexport * from './SvelteApplication.js';\nexport * from './TJSDialog.js';\n\n// Handle `hotReload` Foundry hook when running the Vite dev server. -------------------------------------------------\n\nif (import.meta.hot)\n{\n Hooks.on('hotReload', (data) =>\n {\n // Only handle JSON hot reload presumably specified in package manifest for language translation files.\n if (data?.extension === 'json')\n {\n // Postpone until next clock tick to allow Foundry to update localization first.\n setTimeout(() =>\n {\n for (const app of TJSAppIndex.values())\n {\n const appShell = app.svelte.applicationShell;\n\n // Retrieve the original `svelte-hmr` instrumented HMR component / not the proxy.\n const hmrComponent = appShell?.$$?.hmr_cmp;\n\n if (appShell && typeof hmrComponent?.$replace === 'function')\n {\n const svelteData = app.svelte.dataByComponent(appShell);\n if (svelteData)\n {\n try\n {\n // Replace with self; this will invoke `on_hmr` callback in associated SvelteApplication.\n hmrComponent.$replace(hmrComponent.constructor, {\n target: svelteData.config.target,\n anchor: svelteData.config.anchor,\n preserveLocalState: true,\n conservative: true\n });\n }\n catch (error)\n {\n const name = hmrComponent?.constructor?.name ?? 'Unknown';\n console.error(`TyphonJS Runtime Library error; Could not hot reload component: '${name}'`);\n console.error(error);\n }\n }\n }\n }\n }, 0);\n }\n\n return true;\n });\n}\n\n// Handle `PopOut!` module hooks to allow applications to popout to their own browser window -------------------------\n\nHooks.on('PopOut:loading', (app) =>\n{\n if (app instanceof SvelteApplication) { app.position.enabled = false; }\n});\n\nHooks.on('PopOut:popin', (app) =>\n{\n if (app instanceof SvelteApplication) { app.position.enabled = true; }\n});\n\nHooks.on('PopOut:close', (app) =>\n{\n if (app instanceof SvelteApplication) { app.position.enabled = true; }\n});\n\n// From: SvelteApplication.js ----------------------------------------------------------------------------------------\n\n/**\n * @typedef {object} SvelteApplicationOptions Options for SvelteApplication. Note: that this extends the Foundry\n * {@link ApplicationOptions}.\n *\n * @property {boolean} [defaultCloseAnimation=true] If false the default slide close animation is not run.\n *\n * @property {boolean} [draggable=true] If true then application shells are draggable.\n *\n * @property {boolean} [focusAuto=true] When true auto-management of app focus is enabled.\n *\n * @property {boolean} [focusKeep=false] When `focusAuto` and `focusKeep` is true; keeps internal focus.\n *\n * @property {import('@typhonjs-fvtt/runtime/util/browser').A11yFocusSource} [focusSource] - Defines A11yHelper focus source to\n * apply when application closes.\n *\n * @property {boolean} [focusTrap=true] When true focus trapping / wrapping is enabled keeping focus inside app.\n *\n * @property {boolean} [headerButtonNoClose=false] If true then the close header button is removed.\n *\n * @property {boolean} [headerButtonNoLabel=false] If true then header button labels are removed.\n *\n * @property {string} [headerIcon] Sets a header icon given an image URL.\n *\n * @property {boolean} [headerNoTitleMinimized=false] If true then header title is hidden when minimized.\n *\n * @property {number} [minHeight=MIN_WINDOW_HEIGHT] Assigned to position. Number specifying minimum\n * window height.\n *\n * @property {number} [minWidth=MIN_WINDOW_WIDTH] Assigned to position. Number specifying minimum\n * window width.\n *\n * @property {boolean} [positionable=true] If false then `position.set` does not take effect.\n *\n * @property {import('@typhonjs-fvtt/runtime/svelte/store/position').TJSPositionInitialHelper} [positionInitial] A helper for\n * initial position placement.\n *\n * @property {boolean} [positionOrtho=true] When true TJSPosition is optimized for orthographic use.\n *\n * @property {import('@typhonjs-fvtt/runtime/svelte/store/position').TJSPositionValidatorOptions} [positionValidator] A validator\n * function or data or list of validators.\n *\n * @property {import('@typhonjs-fvtt/runtime/svelte/store/web-storage').TJSWebStorage} [sessionStorage] An instance of\n * TJSWebStorage (session) to share across SvelteApplications.\n *\n * @property {import('@typhonjs-fvtt/runtime/svelte/util').TJSSvelteConfig} [svelte] A Svelte configuration object defining\n * the main component.\n *\n * @property {import('@typhonjs-fvtt/runtime/svelte/store/position').TJSTransformOrigin} [transformOrigin='top left'] By default,\n * 'top / left' respects rotation when minimizing.\n */\n","import { writable, get } from 'svelte/store';\nimport { Strings } from '@typhonjs-fvtt/runtime/util';\nimport { isIterable, safeAccess } from '@typhonjs-fvtt/runtime/util/object';\nimport { isWritableStore } from '@typhonjs-fvtt/runtime/util/store';\n\nclass DynReducerUtils {\n /**\n * Checks for array equality between two arrays of numbers.\n *\n * @param a - Array A\n *\n * @param b - Array B\n *\n * @returns Arrays are equal.\n */\n static arrayEquals(a, b) {\n if (a === b) {\n return true;\n }\n if (a === null || b === null) {\n return false;\n }\n /* c8 ignore next */\n if (a.length !== b.length) {\n return false;\n }\n for (let cntr = a.length; --cntr >= 0;) {\n /* c8 ignore next */\n if (a[cntr] !== b[cntr]) {\n return false;\n }\n }\n return true;\n }\n /**\n * Provides a solid string hashing algorithm.\n *\n * Sourced from: https://stackoverflow.com/a/52171480\n *\n * @param str - String to hash.\n *\n * @param seed - A seed value altering the hash.\n *\n * @returns Hash code.\n */\n static hashString(str, seed = 0) {\n let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\n for (let ch, i = 0; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n }\n /**\n * Converts an unknown value for hashing purposes in {@link AdapterIndexer.calcHashUpdate}.\n *\n * Currently objects / Map w/ object keys is not supported. Potentially can include `object-hash` to handle this\n * case, but it is not common to use objects as keys in Maps.\n *\n * @param value - An unknown value to convert to a number.\n */\n static hashUnknown(value) {\n if (value === null || value === void 0) {\n return 0;\n }\n let result = 0;\n switch (typeof value) {\n case 'boolean':\n result = value ? 1 : 0;\n break;\n case 'bigint':\n result = Number(BigInt.asIntN(64, value));\n break;\n case 'function':\n result = this.hashString(value.name);\n break;\n case 'number':\n result = Number.isFinite(value) ? value : 0;\n break;\n case 'object':\n // TODO: consider hashing an object IE `object-hash` and convert to number.\n break;\n case 'string':\n result = this.hashString(value);\n break;\n case 'symbol':\n result = this.hashString(Symbol.keyFor(value));\n break;\n }\n return result;\n }\n /**\n * @param target -\n *\n * @param Prototype -\n *\n * @returns target constructor function has Prototype.\n */\n static hasPrototype(target, Prototype) {\n /* c8 ignore next */\n if (typeof target !== 'function') {\n return false;\n }\n if (target === Prototype) {\n return true;\n }\n // Walk parent prototype chain. Check for descriptor at each prototype level.\n for (let proto = Object.getPrototypeOf(target); proto; proto = Object.getPrototypeOf(proto)) {\n if (proto === Prototype) {\n return true;\n }\n }\n return false;\n }\n /**\n * Provides a utility method to determine if the given data is iterable / implements iterator protocol.\n *\n * @param data - Data to verify as iterable.\n *\n * @returns Is data iterable.\n */\n static isIterable(data) {\n return data !== null && data !== void 0 && typeof data === 'object' &&\n typeof data[Symbol.iterator] === 'function';\n }\n}\n\n/**\n * Provides the `derived` API for all dynamic reducers.\n */\nclass AdapterDerived {\n #hostData;\n #DerivedReducerCtor;\n #parentIndex;\n #derived = new Map();\n #destroyed = false;\n /**\n * @param hostData - Hosted data structure.\n *\n * @param parentIndex - Any associated parent index API.\n *\n * @param DerivedReducerCtor - The default derived reducer constructor function.\n */\n constructor(hostData, parentIndex, DerivedReducerCtor) {\n this.#hostData = hostData;\n this.#parentIndex = parentIndex;\n this.#DerivedReducerCtor = DerivedReducerCtor;\n Object.freeze(this);\n }\n /**\n * Creates a new derived reducer.\n *\n * @param options - Options defining the new derived reducer.\n *\n * @returns Newly created derived reducer.\n */\n create(options) {\n if (this.#destroyed) {\n throw Error(`AdapterDerived.create error: this instance has been destroyed.`);\n }\n let name;\n let rest = {};\n let ctor;\n const DerivedReducerCtor = this.#DerivedReducerCtor;\n if (typeof options === 'string') {\n name = options;\n ctor = DerivedReducerCtor;\n }\n else if (typeof options === 'function' && DynReducerUtils.hasPrototype(options, DerivedReducerCtor)) {\n ctor = options;\n }\n else if (typeof options === 'object' && options !== null) {\n ({ name, ctor = DerivedReducerCtor, ...rest } = options);\n }\n else {\n throw new TypeError(`AdapterDerived.create error: 'options' does not conform to allowed parameters.`);\n }\n if (!DynReducerUtils.hasPrototype(ctor, DerivedReducerCtor)) {\n throw new TypeError(`AdapterDerived.create error: 'ctor' is not a '${DerivedReducerCtor?.name}'.`);\n }\n name = name ?? ctor?.name;\n if (typeof name !== 'string') {\n throw new TypeError(`AdapterDerived.create error: 'name' is not a string.`);\n }\n const derivedReducer = new ctor(this.#hostData, this.#parentIndex, rest);\n this.#derived.set(name, derivedReducer);\n return derivedReducer;\n }\n /**\n * Removes all derived reducers and associated subscriptions.\n */\n clear() {\n if (this.#destroyed) {\n return;\n }\n for (const reducer of this.#derived.values()) {\n reducer.destroy();\n }\n this.#derived.clear();\n }\n /**\n * Deletes and destroys a derived reducer by name.\n *\n * @param name - Name of the derived reducer.\n */\n delete(name) {\n if (this.#destroyed) {\n throw Error(`AdapterDerived.delete error: this instance has been destroyed.`);\n }\n const reducer = this.#derived.get(name);\n if (reducer) {\n reducer.destroy();\n }\n return this.#derived.delete(name);\n }\n /**\n * Removes all derived reducers, subscriptions, and cleans up all resources.\n */\n destroy() {\n if (this.#destroyed) {\n return;\n }\n this.clear();\n this.#hostData = [null];\n this.#parentIndex = null;\n this.#destroyed = true;\n }\n /**\n * Returns an existing derived reducer.\n *\n * @param name - Name of derived reducer.\n */\n get(name) {\n if (this.#destroyed) {\n throw Error(`AdapterDerived.get error: this instance has been destroyed.`);\n }\n return this.#derived.get(name);\n }\n /**\n * Updates all managed derived reducer indexes.\n *\n * @param [force] - Force an update to subscribers.\n */\n update(force = false) {\n if (this.#destroyed) {\n return;\n }\n for (const reducer of this.#derived.values()) {\n reducer.index.update(force);\n }\n }\n}\n\n/**\n * Provides the storage and sequencing of managed filters. Each filter added may be a bespoke function or a\n * {@link DynDataFilter} object containing an `id`, `filter`, and `weight` attributes; `filter` is the only required\n * attribute.\n *\n * The `id` attribute can be anything that creates a unique ID for the filter; recommended strings or numbers. This\n * allows filters to be removed by ID easily.\n *\n * The `weight` attribute is a number between 0 and 1 inclusive that allows filters to be added in a\n * predictable order which is especially handy if they are manipulated at runtime. A lower weighted filter always runs\n * before a higher weighted filter. For speed and efficiency always set the heavier / more inclusive filter with a\n * lower weight; an example of this is a keyword / name that will filter out many entries making any further filtering\n * faster. If no weight is specified the default of '1' is assigned and it is appended to the end of the filters list.\n *\n * This class forms the public API which is accessible from the `.filters` getter in the main reducer implementation.\n * ```\n * const dynArray = new DynArrayReducer([...]);\n * dynArray.filters.add(...);\n * dynArray.filters.clear();\n * dynArray.filters.length;\n * dynArray.filters.remove(...);\n * dynArray.filters.removeBy(...);\n * dynArray.filters.removeById(...);\n * ```\n */\nclass AdapterFilters {\n #filtersData;\n #indexUpdate;\n #mapUnsubscribe = new Map();\n /**\n * @param indexUpdate - update function for the indexer.\n *\n * @param filtersAdapter - Stores the filter function data.\n */\n constructor(indexUpdate, filtersAdapter) {\n this.#indexUpdate = indexUpdate;\n this.#filtersData = filtersAdapter;\n Object.freeze(this);\n }\n /**\n * @returns Returns the length of the filter data.\n */\n get length() { return this.#filtersData.filters.length; }\n /**\n * Provides an iterator for filters.\n *\n * @yields {DataFilter}\n */\n *[Symbol.iterator]() {\n if (this.#filtersData.filters.length === 0) {\n return;\n }\n for (const entry of this.#filtersData.filters) {\n yield { ...entry };\n }\n }\n /**\n * @param filters -\n */\n add(...filters) {\n /**\n * Tracks the number of filters added that have subscriber functionality.\n */\n let subscribeCount = 0;\n for (const filter of filters) {\n const filterType = typeof filter;\n if (filterType !== 'function' && (filterType !== 'object' || filter === null)) {\n throw new TypeError(`AdapterFilters error: 'filter' is not a function or object.`);\n }\n let data = void 0;\n let subscribeFn = void 0;\n if (filterType === 'function') {\n data = {\n id: void 0,\n filter,\n weight: 1\n };\n subscribeFn = filter.subscribe;\n }\n else if (filterType === 'object') {\n if ('filter' in filter) {\n if (typeof filter.filter !== 'function') {\n throw new TypeError(`AdapterFilters error: 'filter' attribute is not a function.`);\n }\n if (filter.weight !== void 0 && typeof filter.weight !== 'number' ||\n (filter.weight < 0 || filter.weight > 1)) {\n throw new TypeError(`AdapterFilters error: 'weight' attribute is not a number between '0 - 1' inclusive.`);\n }\n data = {\n id: filter.id !== void 0 ? filter.id : void 0,\n filter: filter.filter,\n weight: filter.weight || 1\n };\n subscribeFn = filter.filter.subscribe ?? filter.subscribe;\n }\n else {\n throw new TypeError(`AdapterFilters error: 'filter' attribute is not a function.`);\n }\n }\n // Find the index to insert where data.weight is less than existing values weight.\n const index = this.#filtersData.filters.findIndex((value) => {\n return data.weight < value.weight;\n });\n // If an index was found insert at that location.\n if (index >= 0) {\n this.#filtersData.filters.splice(index, 0, data);\n }\n else // push to end of filters.\n {\n this.#filtersData.filters.push(data);\n }\n if (typeof subscribeFn === 'function') {\n const unsubscribe = subscribeFn(this.#indexUpdate);\n // Ensure that unsubscribe is a function.\n if (typeof unsubscribe !== 'function') {\n throw new TypeError('AdapterFilters error: Filter has subscribe function, but no unsubscribe function is returned.');\n }\n // Ensure that the same filter is not subscribed to multiple times.\n if (this.#mapUnsubscribe.has(data.filter)) {\n throw new Error('AdapterFilters error: Filter added already has an unsubscribe function registered.');\n }\n this.#mapUnsubscribe.set(data.filter, unsubscribe);\n subscribeCount++;\n }\n }\n // Filters with subscriber functionality are assumed to immediately invoke the `subscribe` callback. If the\n // subscriber count is less than the amount of filters added then automatically trigger an index update manually.\n if (subscribeCount < filters.length) {\n this.#indexUpdate();\n }\n }\n /**\n * Clears and removes all filters.\n */\n clear() {\n this.#filtersData.filters.length = 0;\n // Unsubscribe from all filters with subscription support.\n for (const unsubscribe of this.#mapUnsubscribe.values()) {\n unsubscribe();\n }\n this.#mapUnsubscribe.clear();\n this.#indexUpdate();\n }\n /**\n * @param filters -\n */\n remove(...filters) {\n const length = this.#filtersData.filters.length;\n if (length === 0) {\n return;\n }\n for (const data of filters) {\n // Handle the case that the filter may either be a function or a filter entry / object.\n const actualFilter = typeof data === 'function' ? data : data !== null && typeof data === 'object' ?\n data.filter : void 0;\n if (!actualFilter) {\n continue;\n }\n for (let cntr = this.#filtersData.filters.length; --cntr >= 0;) {\n if (this.#filtersData.filters[cntr].filter === actualFilter) {\n this.#filtersData.filters.splice(cntr, 1);\n // Invoke any unsubscribe function for given filter then remove from tracking.\n let unsubscribe = void 0;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(actualFilter)) === 'function') {\n unsubscribe();\n this.#mapUnsubscribe.delete(actualFilter);\n }\n }\n }\n }\n // Update the index a filter was removed.\n if (length !== this.#filtersData.filters.length) {\n this.#indexUpdate();\n }\n }\n /**\n * Remove filters by the provided callback. The callback takes 3 parameters: `id`, `filter`, and `weight`.\n * Any truthy value returned will remove that filter.\n *\n * @param callback - Callback function to evaluate each filter entry.\n */\n removeBy(callback) {\n const length = this.#filtersData.filters.length;\n if (length === 0) {\n return;\n }\n if (typeof callback !== 'function') {\n throw new TypeError(`AdapterFilters error: 'callback' is not a function.`);\n }\n this.#filtersData.filters = this.#filtersData.filters.filter((data) => {\n const remove = callback.call(callback, { ...data });\n if (remove) {\n let unsubscribe;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.filter)) === 'function') {\n unsubscribe();\n this.#mapUnsubscribe.delete(data.filter);\n }\n }\n // Reverse remove boolean to properly filter / remove this filter.\n return !remove;\n });\n if (length !== this.#filtersData.filters.length) {\n this.#indexUpdate();\n }\n }\n /**\n * @param ids - Removes filters by ID.\n */\n removeById(...ids) {\n const length = this.#filtersData.filters.length;\n if (length === 0) {\n return;\n }\n this.#filtersData.filters = this.#filtersData.filters.filter((data) => {\n let remove = 0;\n for (const id of ids) {\n remove |= (data.id === id ? 1 : 0);\n }\n // If not keeping invoke any unsubscribe function for given filter then remove from tracking.\n if (!!remove) {\n let unsubscribe;\n if (typeof (unsubscribe = this.#mapUnsubscribe.get(data.filter)) === 'function') {\n unsubscribe();\n this.#mapUnsubscribe.delete(data.filter);\n }\n }\n return !remove; // Swap here to actually remove the item via array filter method.\n });\n if (length !== this.#filtersData.filters.length) {\n this.#indexUpdate();\n }\n }\n}\n\n/**\n * Provides construction and management of indexed data when there are parent indexes or filter / sort functions\n * applied.\n */\nclass AdapterIndexer {\n derivedAdapter;\n filtersData;\n hostData;\n hostUpdate;\n indexData;\n sortData;\n sortFn;\n destroyed = false;\n /**\n * @param hostData - Hosted data structure.\n *\n * @param hostUpdate - Host update function invoked on index updates.\n *\n * @param [parentIndexer] - Any associated parent index API.\n *\n * @returns Indexer adapter instance.\n */\n constructor(hostData, hostUpdate, parentIndexer) {\n this.hostData = hostData;\n this.hostUpdate = hostUpdate;\n this.indexData = { index: null, hash: null, reversed: false, parent: parentIndexer };\n }\n /**\n * @returns Returns whether the index is active.\n */\n get active() {\n return this.filtersData.filters.length > 0 || this.sortData.compareFn !== null ||\n this.indexData.parent?.active === true;\n }\n /**\n * @returns Returns length of reduced index.\n */\n get length() {\n return this.indexData.index ? this.indexData.index.length : 0;\n }\n /* c8 ignore start */\n /**\n * @returns Returns reversed state.\n */\n get reversed() { return this.indexData.reversed; }\n /* c8 ignore end */\n /**\n * @param reversed - New reversed state.\n */\n set reversed(reversed) { this.indexData.reversed = reversed; }\n // -------------------------------------------------------------------------------------------------------------------\n /**\n * Calculates a new hash value for the new index array if any. If the new index array is null then the hash value\n * is set to null. Set calculated new hash value to the index adapter hash value.\n *\n * After hash generation compare old and new hash values and perform an update if they are different. If they are\n * equal check for array equality between the old and new index array and perform an update if they are not equal.\n *\n * @param oldIndex - Old index array.\n *\n * @param oldHash - Old index hash value.\n *\n * @param [force=false] - When true forces an update to subscribers.\n */\n calcHashUpdate(oldIndex, oldHash, force = false) {\n // Use force if a boolean otherwise default to false.\n const actualForce = typeof force === 'boolean' ? force : /* c8 ignore next */ false;\n let newHash = null;\n const newIndex = this.indexData.index;\n if (newIndex) {\n for (let cntr = newIndex.length; --cntr >= 0;) {\n newHash ^= DynReducerUtils.hashUnknown(newIndex[cntr]) + 0x9e3779b9 + (newHash << 6) + (newHash >> 2);\n }\n }\n this.indexData.hash = newHash;\n if (actualForce || (oldHash === newHash ? !DynReducerUtils.arrayEquals(oldIndex, newIndex) : true)) {\n this.hostUpdate();\n }\n }\n /**\n * Destroys all resources.\n */\n destroy() {\n if (this.destroyed) {\n return;\n }\n this.indexData.index = null;\n this.indexData.hash = null;\n this.indexData.reversed = null;\n this.indexData.parent = null;\n this.destroyed = true;\n }\n /**\n * Store associated filter and sort data that are constructed after the indexer.\n *\n * @param filtersData - Associated AdapterFilters instance.\n *\n * @param sortData - Associated AdapterSort instance.\n *\n * @param derivedAdapter - Associated AdapterDerived instance.\n */\n initAdapters(filtersData, sortData, derivedAdapter) {\n this.filtersData = filtersData;\n this.sortData = sortData;\n this.derivedAdapter = derivedAdapter;\n this.sortFn = this.createSortFn();\n }\n}\n\n/**\n * Provides the storage and sequencing of a managed sort function. The sort function set may be a bespoke function or a\n * {@link DynDataSort} object containing an `compare`, and `subscribe` attributes; `compare` is the only required\n * attribute.\n *\n * Note: You can set a compare function that also has a subscribe function attached as the `subscribe` attribute.\n * If a subscribe function is provided the sort function can notify any updates that may change sort order and this\n * triggers an index update.\n *\n * This class forms the public API which is accessible from the `.sort` getter in the main reducer implementation.\n * ```\n * const dynArray = new DynArrayReducer([...]);\n * dynArray.sort.clear();\n * dynArray.sort.set(...);\n * ```\n */\nclass AdapterSort {\n #sortData;\n #indexUpdate;\n #unsubscribe;\n /**\n * @param indexUpdate - Function to update indexer.\n *\n * @param sortData - Storage for compare function.\n */\n constructor(indexUpdate, sortData) {\n this.#indexUpdate = indexUpdate;\n this.#sortData = sortData;\n Object.freeze(this);\n }\n /**\n * Clears & removes any assigned sort function and triggers an index update.\n */\n clear() {\n const oldCompareFn = this.#sortData.compareFn;\n this.#sortData.compareFn = null;\n if (typeof this.#unsubscribe === 'function') {\n this.#unsubscribe();\n this.#unsubscribe = void 0;\n }\n // Only update index if an old compare function is set.\n if (typeof oldCompareFn === 'function') {\n this.#indexUpdate();\n }\n }\n /**\n * @param data - A callback function that compares two values. Return > 0 to sort b before a;\n * < 0 to sort a before b; or 0 to keep original order of a & b.\n *\n * Note: You can set a compare function that also has a subscribe function attached as the `subscribe` attribute.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#parameters\n */\n set(data) {\n if (typeof this.#unsubscribe === 'function') {\n this.#unsubscribe();\n this.#unsubscribe = void 0;\n }\n let compareFn = void 0;\n let subscribeFn = void 0;\n switch (typeof data) {\n case 'function':\n compareFn = data;\n subscribeFn = data.subscribe;\n break;\n case 'object':\n // Early out if data is null / noop.\n if (data === null) {\n break;\n }\n if (typeof data.compare !== 'function') {\n throw new TypeError(`AdapterSort error: 'compare' attribute is not a function.`);\n }\n compareFn = data.compare;\n subscribeFn = data.compare.subscribe ?? data.subscribe;\n break;\n }\n if (typeof compareFn === 'function') {\n this.#sortData.compareFn = compareFn;\n }\n else {\n const oldCompareFn = this.#sortData.compareFn;\n this.#sortData.compareFn = null;\n // Update index if the old compare function exists.\n if (typeof oldCompareFn === 'function') {\n this.#indexUpdate();\n }\n return;\n }\n if (typeof subscribeFn === 'function') {\n this.#unsubscribe = subscribeFn(this.#indexUpdate);\n // Ensure that unsubscribe is a function.\n if (typeof this.#unsubscribe !== 'function') {\n throw new Error(`AdapterSort error: sort has 'subscribe' function, but no 'unsubscribe' function is returned.`);\n }\n }\n else {\n // A sort function with subscriber functionality are assumed to immediately invoke the `subscribe` callback.\n // Only manually update the index if there is no subscriber functionality.\n this.#indexUpdate();\n }\n }\n}\n\n/**\n * Provides the public API for accessing the index API.\n *\n * This class forms the public API which is accessible from the `.index` getter in the main reducer implementation.\n * ```\n * const dynArray = new DynArrayReducer([...]);\n * dynArray.index.active;\n * dynArray.index.hash;\n * dynArray.index.length;\n * dynArray.index.update(...);\n * ```\n */\nclass IndexerAPI {\n #indexData;\n /**\n * Provides a getter to determine if the index is active.\n */\n active;\n /**\n * Provides length of reduced / indexed elements.\n */\n length;\n /**\n * Manually invoke an update of the index.\n *\n * @param force - Force update to any subscribers.\n */\n update;\n constructor(adapterIndexer) {\n this.#indexData = adapterIndexer.indexData;\n this.update = adapterIndexer.update.bind(adapterIndexer);\n // Defines getters on the public API to get the index hash, active state, and index length.\n Object.defineProperties(this, {\n active: { get: () => adapterIndexer.active },\n length: { get: () => adapterIndexer.length }\n });\n Object.freeze(this);\n }\n /**\n * - Current hash value of the index.\n */\n get hash() {\n return this.#indexData.hash;\n }\n /**\n * Provides an iterator over the index array.\n *\n * @yields {K}\n */\n *[Symbol.iterator]() {\n const indexData = this.#indexData;\n if (!indexData.index) {\n return;\n }\n const reversed = indexData.reversed;\n const length = indexData.index.length;\n if (reversed) {\n for (let cntr = length; --cntr >= 0;) {\n yield indexData.index[cntr];\n }\n }\n else {\n for (let cntr = 0; cntr < length; cntr++) {\n yield indexData.index[cntr];\n }\n }\n }\n}\n\n/**\n * Provides the public API for derived reducers. There are several ways to create a derived reducer from utilizing the\n * default implementation or passing in a constructor function / class for a custom derived reducer.\n *\n * This class forms the public API which is accessible from the `.derived` getter in the main reducer implementation.\n * ```\n * const dynArray = new DynArrayReducer([...]);\n * dynArray.derived.clear();\n * dynArray.derived.create(...);\n * dynArray.derived.delete(...);\n * dynArray.derived.destroy();\n * dynArray.derived.get(...);\n * ```\n */\nclass DerivedAPI {\n /**\n * Removes all derived reducers and associated subscriptions.\n */\n clear;\n /**\n * @param options - Options for creating a reducer.\n *\n * @returns Newly created derived reducer.\n */\n create;\n /**\n * Deletes and destroys a derived reducer.\n *\n * @param name - Name of the derived reducer\n */\n delete;\n /**\n * Removes all derived reducers, associated subscriptions, and cleans up all resources.\n */\n destroy;\n /**\n * Returns an existing derived reducer.\n *\n * @param name - Name of derived reducer.\n */\n get;\n constructor(adapterDerived) {\n this.clear = adapterDerived.clear.bind(adapterDerived);\n this.create = adapterDerived.create.bind(adapterDerived);\n this.delete = adapterDerived.delete.bind(adapterDerived);\n this.destroy = adapterDerived.destroy.bind(adapterDerived);\n this.get = adapterDerived.get.bind(adapterDerived);\n Object.freeze(this);\n }\n}\n\n/**\n */\nlet Indexer$1 = class Indexer extends AdapterIndexer {\n /**\n * @inheritDoc\n */\n createSortFn() {\n return (a, b) => this.sortData.compareFn(this.hostData[0][a], this.hostData[0][b]);\n }\n /**\n * Provides the custom filter / reduce step that is ~25-40% faster than implementing with `Array.reduce`.\n *\n * Note: Other loop unrolling techniques like Duff's Device gave a slight faster lower bound on large data sets,\n * but the maintenance factor is not worth the extra complication.\n *\n * @returns New filtered index array.\n */\n reduceImpl() {\n const data = [];\n const array = this.hostData[0];\n if (!array) {\n return data;\n }\n const filters = this.filtersData.filters;\n let include = true;\n const parentIndex = this.indexData.parent;\n // Source index data is coming from an active parent index.\n if (DynReducerUtils.isIterable(parentIndex) && parentIndex.active) {\n for (const adjustedIndex of parentIndex) {\n const value = array[adjustedIndex];\n include = true;\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\n if (!filters[filCntr].filter(value)) {\n include = false;\n break;\n }\n }\n if (include) {\n data.push(adjustedIndex);\n }\n }\n }\n else {\n for (let cntr = 0, length = array.length; cntr < length; cntr++) {\n include = true;\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\n if (!filters[filCntr].filter(array[cntr])) {\n include = false;\n break;\n }\n }\n if (include) {\n data.push(cntr);\n }\n }\n }\n return data;\n }\n /**\n * Update the reducer indexes. If there are changes subscribers are notified. If data order is changed externally\n * pass in true to force an update to subscribers.\n *\n * @param [force=false] - When true forces an update to subscribers.\n */\n update(force = false) {\n if (this.destroyed) {\n return;\n }\n const oldIndex = this.indexData.index;\n const oldHash = this.indexData.hash;\n const array = this.hostData[0];\n const parentIndex = this.indexData.parent;\n // Clear index if there are no filters and no sort function or the index length doesn't match the item length.\n if ((this.filtersData.filters.length === 0 && !this.sortData.compareFn) ||\n (this.indexData.index && array?.length !== this.indexData.index.length)) {\n this.indexData.index = null;\n }\n // If there are filters build new index.\n if (this.filtersData.filters.length > 0) {\n this.indexData.index = this.reduceImpl();\n }\n // If the index isn't built yet and there is an active parent index then create it from the parent.\n if (!this.indexData.index && parentIndex?.active) {\n this.indexData.index = [...parentIndex];\n }\n if (this.sortData.compareFn && Array.isArray(array)) {\n // If there is no index then create one with keys matching host item length.\n if (!this.indexData.index) {\n this.indexData.index = [...Array(array.length).keys()];\n }\n this.indexData.index.sort(this.sortFn);\n }\n this.calcHashUpdate(oldIndex, oldHash, force);\n // Update all derived reducers.\n this.derivedAdapter?.update(force);\n }\n};\n\n/**\n * Provides the base implementation derived reducer for arrays / DynArrayReducer.\n */\nclass DynArrayReducerDerived {\n #array;\n #derived;\n #derivedPublicAPI;\n #filters;\n #filtersData = { filters: [] };\n #index;\n #indexPublicAPI;\n #reversed = false;\n #sort;\n #sortData = { compareFn: null };\n #subscriptions = [];\n #destroyed = false;\n /**\n * @param array - Data host array.\n *\n * @param parentIndex - Parent indexer.\n *\n * @param options - Any filters and sort functions to apply.\n */\n constructor(array, parentIndex, options) {\n this.#array = array;\n this.#index = new Indexer$1(this.#array, this.#updateSubscribers.bind(this), parentIndex);\n this.#indexPublicAPI = new IndexerAPI(this.#index);\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\n this.#derived = new AdapterDerived(this.#array, this.#indexPublicAPI, DynArrayReducerDerived);\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\n let filters = void 0;\n let sort = void 0;\n if (options !== void 0 && ('filters' in options || 'sort' in options)) {\n if (options.filters !== void 0) {\n if (DynReducerUtils.isIterable(options.filters)) {\n filters = options.filters;\n }\n else {\n throw new TypeError(`DerivedArrayReducer error (DataDerivedOptions): 'filters' attribute is not iterable.`);\n }\n }\n if (options.sort !== void 0) {\n if (typeof options.sort === 'function') {\n sort = options.sort;\n }\n else if (typeof options.sort === 'object' && options.sort !== null) {\n sort = options.sort;\n }\n else {\n throw new TypeError(`DerivedArrayReducer error (DataDerivedOptions): 'sort' attribute is not a function or object.`);\n }\n }\n }\n // Add any filters and sort function defined by DataDynArray.\n if (filters) {\n this.filters.add(...filters);\n }\n if (sort) {\n this.sort.set(sort);\n }\n // Invoke an custom initialization for child classes.\n this.initialize();\n }\n /**\n * Returns the internal data of this instance. Be careful!\n *\n * Note: if an array is set as initial data then that array is used as the internal data. If any changes are\n * performed to the data externally do invoke {@link IndexerAPI.update} with `true` to recalculate the index and\n * notify all subscribers.\n *\n * @returns The internal data.\n */\n get data() { return this.#array[0]; }\n /**\n * @returns Derived public API.\n */\n get derived() { return this.#derivedPublicAPI; }\n /**\n * @returns The filters adapter.\n */\n get filters() { return this.#filters; }\n /**\n * Returns the Indexer public API.\n *\n * @returns Indexer API - is also iterable.\n */\n get index() { return this.#indexPublicAPI; }\n /**\n * Returns whether this derived reducer is destroyed.\n */\n get destroyed() { return this.#destroyed; }\n /**\n * @returns Main data / items length or indexed length.\n */\n get length() {\n const array = this.#array[0];\n return this.#index.active ? this.index.length :\n array ? array.length : 0;\n }\n /**\n * @returns Gets current reversed state.\n */\n get reversed() { return this.#reversed; }\n /**\n * @returns The sort adapter.\n */\n get sort() { return this.#sort; }\n /**\n * Sets reversed state and notifies subscribers.\n *\n * @param reversed - New reversed state.\n */\n set reversed(reversed) {\n if (typeof reversed !== 'boolean') {\n throw new TypeError(`DerivedArrayReducer.reversed error: 'reversed' is not a boolean.`);\n }\n this.#reversed = reversed;\n this.#index.reversed = reversed;\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Removes all derived reducers, subscriptions, and cleans up all resources.\n */\n destroy() {\n this.#destroyed = true;\n // Remove any external data reference and perform a final update.\n this.#array = [null];\n this.#index.update(true);\n // Remove all subscriptions.\n this.#subscriptions.length = 0;\n this.#derived.destroy();\n this.#index.destroy();\n this.#filters.clear();\n this.#sort.clear();\n }\n /**\n * Provides a callback for custom derived reducers to initialize any data / custom configuration. This allows\n * child classes to avoid implementing the constructor.\n *\n * @protected\n */\n initialize() { }\n /**\n * Provides an iterator for data stored in DerivedArrayReducer.\n *\n * @yields {T}\n */\n *[Symbol.iterator]() {\n const array = this.#array[0];\n if (this.#destroyed || array === null || array?.length === 0) {\n return;\n }\n if (this.#index.active) {\n for (const entry of this.index) {\n yield array[entry];\n }\n }\n else {\n if (this.reversed) {\n for (let cntr = array.length; --cntr >= 0;) {\n yield array[cntr];\n }\n }\n else {\n for (let cntr = 0; cntr < array.length; cntr++) {\n yield array[cntr];\n }\n }\n }\n }\n // -------------------------------------------------------------------------------------------------------------------\n /**\n * Subscribe to this DerivedArrayReducer.\n *\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\n *\n * @returns Unsubscribe function.\n */\n subscribe(handler) {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n handler(this); // call handler with current value\n // Return unsubscribe function.\n return () => {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) {\n this.#subscriptions.splice(index, 1);\n }\n };\n }\n /**\n * Updates subscribers on changes.\n */\n #updateSubscribers() {\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\n this.#subscriptions[cntr](this);\n }\n }\n}\n\n/**\n * Provides a managed array with non-destructive reducing / filtering / sorting capabilities with subscription /\n * Svelte store support.\n */\nclass DynArrayReducer {\n #array = [null];\n #derived;\n #derivedPublicAPI;\n #filters;\n #filtersData = { filters: [] };\n #index;\n #indexPublicAPI;\n #reversed = false;\n #sort;\n #sortData = { compareFn: null };\n #subscriptions = [];\n #destroyed = false;\n /**\n * Initializes DynArrayReducer. Any iterable is supported for initial data. Take note that if `data` is an array it\n * will be used as the host array and not copied. All non-array iterables otherwise create a new array / copy.\n *\n * @param [data] - Data iterable to store if array or copy otherwise.\n */\n constructor(data) {\n let dataIterable = void 0;\n let filters = void 0;\n let sort = void 0;\n if (data === null) {\n throw new TypeError(`DynArrayReducer error: 'data' is not iterable.`);\n }\n if (data !== void 0 && typeof data !== 'object' && !DynReducerUtils.isIterable(data)) {\n throw new TypeError(`DynArrayReducer error: 'data' is not iterable.`);\n }\n if (data !== void 0 && Symbol.iterator in data) {\n dataIterable = data;\n }\n else if (data !== void 0 && ('data' in data || 'filters' in data || 'sort' in data)) {\n if (data.data !== void 0 && !DynReducerUtils.isIterable(data.data)) {\n throw new TypeError(`DynArrayReducer error (DataDynArray): 'data' attribute is not iterable.`);\n }\n dataIterable = data.data;\n if (data.filters !== void 0) {\n if (DynReducerUtils.isIterable(data.filters)) {\n filters = data.filters;\n }\n else {\n throw new TypeError(`DynArrayReducer error (DataDynArray): 'filters' attribute is not iterable.`);\n }\n }\n if (data.sort !== void 0) {\n if (typeof data.sort === 'function') {\n sort = data.sort;\n }\n else if (typeof data.sort === 'object' && data.sort !== null) {\n sort = data.sort;\n }\n else {\n throw new TypeError(`DynArrayReducer error (DataDynArray): 'sort' attribute is not a function or object.`);\n }\n }\n }\n // In the case of the main data being an array directly use the array otherwise create a copy.\n if (dataIterable) {\n this.#array[0] = Array.isArray(dataIterable) ? dataIterable : [...dataIterable];\n }\n this.#index = new Indexer$1(this.#array, this.#updateSubscribers.bind(this));\n this.#indexPublicAPI = new IndexerAPI(this.#index);\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\n this.#derived = new AdapterDerived(this.#array, this.#indexPublicAPI, DynArrayReducerDerived);\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\n // Add any filters and sort function defined by DataDynArray.\n if (filters) {\n this.filters.add(...filters);\n }\n if (sort) {\n this.sort.set(sort);\n }\n // Invoke an custom initialization for child classes.\n this.initialize();\n }\n /**\n * Returns the internal data of this instance. Be careful!\n *\n * Note: if an array is set as initial data then that array is used as the internal data. If any changes are\n * performed to the data externally do invoke {@link AdapterIndexer.index.update} with `true` to recalculate the\n * index and notify all subscribers.\n *\n * @returns The internal data.\n */\n get data() { return this.#array[0]; }\n /**\n * @returns Derived public API.\n */\n get derived() { return this.#derivedPublicAPI; }\n /**\n * @returns The filters adapter.\n */\n get filters() { return this.#filters; }\n /**\n * @returns Returns the Indexer public API.\n */\n get index() { return this.#indexPublicAPI; }\n /**\n * Returns whether this instance is destroyed.\n */\n get destroyed() { return this.#destroyed; }\n /**\n * Gets the main data / items length.\n *\n * @returns {number} Main data / items length.\n */\n get length() {\n const array = this.#array[0];\n return this.#index.active ? this.#indexPublicAPI.length :\n array ? array.length : 0;\n }\n /**\n * Gets current reversed state.\n *\n * @returns {boolean} Reversed state.\n */\n get reversed() { return this.#reversed; }\n /**\n * @returns The sort adapter.\n */\n get sort() { return this.#sort; }\n /**\n * Sets reversed state and notifies subscribers.\n *\n * @param reversed - New reversed state.\n */\n set reversed(reversed) {\n if (typeof reversed !== 'boolean') {\n throw new TypeError(`DynArrayReducer.reversed error: 'reversed' is not a boolean.`);\n }\n this.#reversed = reversed;\n this.#index.reversed = reversed;\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Removes all derived reducers, subscriptions, and cleans up all resources.\n */\n destroy() {\n if (this.#destroyed) {\n return;\n }\n this.#destroyed = true;\n this.#derived.destroy();\n // Set the backing data to null and provide a final update.\n this.#array = [null];\n this.index.update(true);\n // Remove all subscriptions.\n this.#subscriptions.length = 0;\n this.#index.destroy();\n this.#filters.clear();\n this.#sort.clear();\n }\n /**\n * Provides a callback for custom reducers to initialize any data / custom configuration. This allows\n * child classes to avoid implementing the constructor.\n *\n * @protected\n */\n initialize() { }\n /**\n * Removes internal data and pushes new data. This does not destroy any initial array set to internal data unless\n * `replace` is set to true.\n *\n * @param data - New data to set to internal data.\n *\n * @param replace=false - New data to set to internal data.\n */\n setData(data, replace = false) {\n if (data !== null && !DynReducerUtils.isIterable(data)) {\n throw new TypeError(`DynArrayReducer.setData error: 'data' is not iterable.`);\n }\n if (typeof replace !== 'boolean') {\n throw new TypeError(`DynArrayReducer.setData error: 'replace' is not a boolean.`);\n }\n const array = this.#array[0];\n // If the array isn't defined or 'replace' is true then replace internal data with new array or create an array\n // from an iterable.\n if (!Array.isArray(array) || replace) {\n if (data) {\n this.#array[0] = Array.isArray(data) ? data : [...data];\n }\n }\n else {\n if (data) {\n // Remove all entries in internal data. This will not replace any initially set array.\n array.length = 0;\n // Add all new data.\n array.push(...data);\n }\n else {\n this.#array[0] = null;\n }\n }\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Add a subscriber to this DynArrayReducer instance.\n *\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\n *\n * @returns Unsubscribe function.\n */\n subscribe(handler) {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n handler(this); // call handler with current value\n // Return unsubscribe function.\n return () => {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) {\n this.#subscriptions.splice(index, 1);\n }\n };\n }\n /**\n * Updates subscribers on changes.\n */\n #updateSubscribers() {\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\n this.#subscriptions[cntr](this);\n }\n }\n /**\n * Provides an iterator for data stored in DynArrayReducer.\n *\n * @yields {T}\n */\n *[Symbol.iterator]() {\n const array = this.#array[0];\n if (this.#destroyed || array === null || array?.length === 0) {\n return;\n }\n if (this.#index.active) {\n for (const entry of this.index) {\n yield array[entry];\n }\n }\n else {\n if (this.reversed) {\n for (let cntr = array.length; --cntr >= 0;) {\n yield array[cntr];\n }\n }\n else {\n for (let cntr = 0; cntr < array.length; cntr++) {\n yield array[cntr];\n }\n }\n }\n }\n}\n\n/**\n */\nclass Indexer extends AdapterIndexer {\n /**\n * @inheritDoc\n */\n createSortFn() {\n return (a, b) => this.sortData.compareFn(this.hostData[0].get(a), this.hostData[0].get(b));\n }\n /**\n * Provides the custom filter / reduce step that is ~25-40% faster than implementing with `Array.reduce`.\n *\n * Note: Other loop unrolling techniques like Duff's Device gave a slight faster lower bound on large data sets,\n * but the maintenance factor is not worth the extra complication.\n *\n * @returns New filtered index array.\n */\n reduceImpl() {\n const data = [];\n const map = this.hostData[0];\n if (!map) {\n return data;\n }\n const filters = this.filtersData.filters;\n let include = true;\n const parentIndex = this.indexData.parent;\n // Source index data is coming from an active parent index.\n if (DynReducerUtils.isIterable(parentIndex) && parentIndex.active) {\n for (const key of parentIndex) {\n const value = map.get(key);\n include = true;\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\n if (!filters[filCntr].filter(value)) {\n include = false;\n break;\n }\n }\n if (include) {\n data.push(key);\n }\n }\n }\n else {\n for (const key of map.keys()) {\n include = true;\n const value = map.get(key);\n for (let filCntr = 0, filLength = filters.length; filCntr < filLength; filCntr++) {\n if (!filters[filCntr].filter(value)) {\n include = false;\n break;\n }\n }\n if (include) {\n data.push(key);\n }\n }\n }\n return data;\n }\n /**\n * Update the reducer indexes. If there are changes subscribers are notified. If data order is changed externally\n * pass in true to force an update to subscribers.\n *\n * @param [force=false] - When true forces an update to subscribers.\n */\n update(force = false) {\n if (this.destroyed) {\n return;\n }\n const oldIndex = this.indexData.index;\n const oldHash = this.indexData.hash;\n const map = this.hostData[0];\n const parentIndex = this.indexData.parent;\n // Clear index if there are no filters and no sort function or the index length doesn't match the item length.\n if ((this.filtersData.filters.length === 0 && !this.sortData.compareFn) ||\n (this.indexData.index && map?.size !== this.indexData.index.length)) {\n this.indexData.index = null;\n }\n // If there are filters build new index.\n if (this.filtersData.filters.length > 0) {\n this.indexData.index = this.reduceImpl();\n }\n // If the index isn't built yet and there is an active parent index then create it from the parent.\n if (!this.indexData.index && parentIndex?.active) {\n this.indexData.index = [...parentIndex];\n }\n if (this.sortData.compareFn && map instanceof Map) {\n // If there is no index then create one with keys matching host item length.\n if (!this.indexData.index) {\n this.indexData.index = this.indexData.index = [...map.keys()];\n }\n this.indexData.index.sort(this.sortFn);\n }\n this.calcHashUpdate(oldIndex, oldHash, force);\n // Update all derived reducers.\n this.derivedAdapter?.update(force);\n }\n}\n\n/**\n * Provides the base implementation derived reducer for arrays / DynArrayReducer.\n */\nclass DynMapReducerDerived {\n #map;\n #derived;\n #derivedPublicAPI;\n #filters;\n #filtersData = { filters: [] };\n #index;\n #indexPublicAPI;\n #reversed = false;\n #sort;\n #sortData = { compareFn: null };\n #subscriptions = [];\n #destroyed = false;\n /**\n * @param map - Data host Map.\n *\n * @param parentIndex - Parent indexer.\n *\n * @param options - Any filters and sort functions to apply.\n */\n constructor(map, parentIndex, options) {\n this.#map = map;\n this.#index = new Indexer(this.#map, this.#updateSubscribers.bind(this), parentIndex);\n this.#indexPublicAPI = new IndexerAPI(this.#index);\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\n this.#derived = new AdapterDerived(this.#map, this.#indexPublicAPI, DynMapReducerDerived);\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\n let filters = void 0;\n let sort = void 0;\n if (options !== void 0 && ('filters' in options || 'sort' in options)) {\n if (options.filters !== void 0) {\n if (DynReducerUtils.isIterable(options.filters)) {\n filters = options.filters;\n }\n else {\n throw new TypeError(`DerivedMapReducer error (DataDerivedOptions): 'filters' attribute is not iterable.`);\n }\n }\n if (options.sort !== void 0) {\n if (typeof options.sort === 'function') {\n sort = options.sort;\n }\n else if (typeof options.sort === 'object' && options.sort !== null) {\n sort = options.sort;\n }\n else {\n throw new TypeError(`DerivedMapReducer error (DataDerivedOptions): 'sort' attribute is not a function or object.`);\n }\n }\n }\n // Add any filters and sort function defined by DataDynArray.\n if (filters) {\n this.filters.add(...filters);\n }\n if (sort) {\n this.sort.set(sort);\n }\n // Invoke an custom initialization for child classes.\n this.initialize();\n }\n /**\n * Returns the internal data of this instance. Be careful!\n *\n * Note: The returned map is the same map set by the main reducer. If any changes are performed to the data\n * externally do invoke {@link IndexerAPI.update} with `true` to recalculate the index and notify all subscribers.\n *\n * @returns The internal data.\n */\n get data() { return this.#map[0]; }\n /**\n * @returns Derived public API.\n */\n get derived() { return this.#derivedPublicAPI; }\n /**\n * @returns The filters adapter.\n */\n get filters() { return this.#filters; }\n /**\n * Returns the Indexer public API.\n *\n * @returns Indexer API - is also iterable.\n */\n get index() { return this.#indexPublicAPI; }\n /**\n * Returns whether this derived reducer is destroyed.\n */\n get destroyed() { return this.#destroyed; }\n /**\n * @returns Main data / items length or indexed length.\n */\n get length() {\n const map = this.#map[0];\n return this.#index.active ? this.index.length :\n map ? map.size : 0;\n }\n /**\n * @returns Gets current reversed state.\n */\n get reversed() { return this.#reversed; }\n /**\n * @returns The sort adapter.\n */\n get sort() { return this.#sort; }\n /**\n * Sets reversed state and notifies subscribers.\n *\n * @param reversed - New reversed state.\n */\n set reversed(reversed) {\n if (typeof reversed !== 'boolean') {\n throw new TypeError(`DerivedMapReducer.reversed error: 'reversed' is not a boolean.`);\n }\n this.#reversed = reversed;\n this.#index.reversed = reversed;\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Removes all derived reducers, subscriptions, and cleans up all resources.\n */\n destroy() {\n this.#destroyed = true;\n // Remove any external data reference and perform a final update.\n this.#map = [null];\n this.#index.update(true);\n // Remove all subscriptions.\n this.#subscriptions.length = 0;\n this.#derived.destroy();\n this.#index.destroy();\n this.#filters.clear();\n this.#sort.clear();\n }\n /**\n * Provides a callback for custom derived reducers to initialize any data / custom configuration. This allows\n * child classes to avoid implementing the constructor.\n *\n * @protected\n */\n initialize() { }\n /**\n * Provides an iterator for data stored in DerivedMapReducer.\n *\n * @yields {T}\n */\n *[Symbol.iterator]() {\n const map = this.#map[0];\n if (this.#destroyed || map === null || map?.size === 0) {\n return;\n }\n if (this.#index.active) {\n for (const key of this.index) {\n yield map.get(key);\n }\n }\n else {\n if (this.reversed) {\n // TODO: Not efficient due to creating temporary values array.\n const values = [...map.values()];\n for (let cntr = values.length; --cntr >= 0;) {\n yield values[cntr];\n }\n }\n else {\n for (const value of map.values()) {\n yield value;\n }\n }\n }\n }\n // -------------------------------------------------------------------------------------------------------------------\n /**\n * Subscribe to this DerivedMapReducer.\n *\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\n *\n * @returns Unsubscribe function.\n */\n subscribe(handler) {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n handler(this); // call handler with current value\n // Return unsubscribe function.\n return () => {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) {\n this.#subscriptions.splice(index, 1);\n }\n };\n }\n /**\n * Updates subscribers on changes.\n */\n #updateSubscribers() {\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\n this.#subscriptions[cntr](this);\n }\n }\n}\n\n/**\n * Provides a managed Map with non-destructive reducing / filtering / sorting capabilities with subscription /\n * Svelte store support.\n */\nclass DynMapReducer {\n #map = [null];\n #derived;\n #derivedPublicAPI;\n #filters;\n #filtersData = { filters: [] };\n #index;\n #indexPublicAPI;\n #reversed = false;\n #sort;\n #sortData = { compareFn: null };\n #subscriptions = [];\n #destroyed = false;\n /**\n * Initializes DynMapReducer. Any iterable is supported for initial data. Take note that if `data` is an array it\n * will be used as the host array and not copied. All non-array iterables otherwise create a new array / copy.\n *\n * @param [data] - Data iterable to store if array or copy otherwise.\n */\n constructor(data) {\n let dataMap = void 0;\n let filters = void 0;\n let sort = void 0;\n if (data === null) {\n throw new TypeError(`DynMapReducer error: 'data' is not an object or Map.`);\n }\n if (data !== void 0 && typeof data !== 'object' && !(data instanceof Map)) {\n throw new TypeError(`DynMapReducer error: 'data' is not an object or Map.`);\n }\n if (data !== void 0 && data instanceof Map) {\n dataMap = data;\n }\n else if (data !== void 0 && ('data' in data || 'filters' in data || 'sort' in data)) {\n if (data.data !== void 0 && !(data.data instanceof Map)) {\n throw new TypeError(`DynMapReducer error (DataDynMap): 'data' attribute is not a Map.`);\n }\n dataMap = data.data;\n if (data.filters !== void 0) {\n if (DynReducerUtils.isIterable(data.filters)) {\n filters = data.filters;\n }\n else {\n throw new TypeError(`DynMapReducer error (DataDynMap): 'filters' attribute is not iterable.`);\n }\n }\n if (data.sort !== void 0) {\n if (typeof data.sort === 'function') {\n sort = data.sort;\n }\n else if (typeof data.sort === 'object' && data.sort !== null) {\n sort = data.sort;\n }\n else {\n throw new TypeError(`DynMapReducer error (DataDynMap): 'sort' attribute is not a function or object.`);\n }\n }\n }\n // In the case of the main data being an array directly use the array otherwise create a copy.\n if (dataMap) {\n this.#map[0] = dataMap;\n }\n this.#index = new Indexer(this.#map, this.#updateSubscribers.bind(this));\n this.#indexPublicAPI = new IndexerAPI(this.#index);\n this.#filters = new AdapterFilters(this.#indexPublicAPI.update, this.#filtersData);\n this.#sort = new AdapterSort(this.#indexPublicAPI.update, this.#sortData);\n this.#derived = new AdapterDerived(this.#map, this.#indexPublicAPI, DynMapReducerDerived);\n this.#derivedPublicAPI = new DerivedAPI(this.#derived);\n this.#index.initAdapters(this.#filtersData, this.#sortData, this.#derived);\n // Add any filters and sort function defined by DataDynMap.\n if (filters) {\n this.filters.add(...filters);\n }\n if (sort) {\n this.sort.set(sort);\n }\n // Invoke an custom initialization for child classes.\n this.initialize();\n }\n /**\n * Returns the internal data of this instance. Be careful!\n *\n * Note: When a map is set as data then that map is used as the internal data. If any changes are\n * performed to the data externally do invoke {@link AdapterIndexer.index.update} with `true` to recalculate the\n * index and notify all subscribers.\n *\n * @returns The internal data.\n */\n get data() { return this.#map[0]; }\n /**\n * @returns Derived public API.\n */\n get derived() { return this.#derivedPublicAPI; }\n /**\n * @returns The filters adapter.\n */\n get filters() { return this.#filters; }\n /**\n * @returns Returns the Indexer public API.\n */\n get index() { return this.#indexPublicAPI; }\n /**\n * Returns whether this instance is destroyed.\n */\n get destroyed() { return this.#destroyed; }\n /**\n * Gets the main data / items length.\n *\n * @returns {number} Main data / items length.\n */\n get length() {\n const map = this.#map[0];\n return this.#index.active ? this.#indexPublicAPI.length :\n map ? map.size : 0;\n }\n /**\n * Gets current reversed state.\n *\n * @returns {boolean} Reversed state.\n */\n get reversed() { return this.#reversed; }\n /**\n * @returns The sort adapter.\n */\n get sort() { return this.#sort; }\n /**\n * Sets reversed state and notifies subscribers.\n *\n * @param reversed - New reversed state.\n */\n set reversed(reversed) {\n if (typeof reversed !== 'boolean') {\n throw new TypeError(`DynMapReducer.reversed error: 'reversed' is not a boolean.`);\n }\n this.#reversed = reversed;\n this.#index.reversed = reversed;\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Removes all derived reducers, subscriptions, and cleans up all resources.\n */\n destroy() {\n if (this.#destroyed) {\n return;\n }\n this.#destroyed = true;\n this.#derived.destroy();\n // Set the backing data to null and provide a final update.\n this.#map = [null];\n this.index.update(true);\n // Remove all subscriptions.\n this.#subscriptions.length = 0;\n this.#index.destroy();\n this.#filters.clear();\n this.#sort.clear();\n }\n /**\n * Provides a callback for custom reducers to initialize any data / custom configuration. This allows\n * child classes to avoid implementing the constructor.\n *\n * @protected\n */\n initialize() { }\n /**\n * Removes internal data and pushes new data. This does not destroy any initial array set to internal data unless\n * `replace` is set to true.\n *\n * @param data - New data to set to internal data.\n *\n * @param replace=false - New data to set to internal data.\n */\n setData(data, replace = false) {\n if (data !== null && !(data instanceof Map)) {\n throw new TypeError(`DynMapReducer.setData error: 'data' is not iterable.`);\n }\n if (typeof replace !== 'boolean') {\n throw new TypeError(`DynMapReducer.setData error: 'replace' is not a boolean.`);\n }\n const map = this.#map[0];\n // If the array isn't defined or 'replace' is true then replace internal data with new array or create an array\n // from an iterable.\n if (!(map instanceof Map) || replace) {\n this.#map[0] = data instanceof Map ? data : null;\n }\n else if (data instanceof Map && map instanceof Map) {\n // Create a set of all current entry IDs.\n const removeKeySet = new Set(map.keys());\n for (const key of data.keys()) {\n map.set(key, data.get(key));\n if (removeKeySet.has(key)) {\n removeKeySet.delete(key);\n }\n }\n // Remove entries that are no longer in data.\n for (const key of removeKeySet) {\n map.delete(key);\n }\n }\n else if (data === null) {\n this.#map[0] = null;\n }\n // Recalculate index and force an update to any subscribers.\n this.index.update(true);\n }\n /**\n * Add a subscriber to this DynMapReducer instance.\n *\n * @param handler - Callback function that is invoked on update / changes. Receives `this` reference.\n *\n * @returns Unsubscribe function.\n */\n subscribe(handler) {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n handler(this); // call handler with current value\n // Return unsubscribe function.\n return () => {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) {\n this.#subscriptions.splice(index, 1);\n }\n };\n }\n /**\n * Updates subscribers on changes.\n */\n #updateSubscribers() {\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) {\n this.#subscriptions[cntr](this);\n }\n }\n /**\n * Provides an iterator for data stored in DynMapReducer.\n *\n * @yields {T}\n */\n *[Symbol.iterator]() {\n const map = this.#map[0];\n if (this.#destroyed || map === null || map?.size === 0) {\n return;\n }\n if (this.#index.active) {\n for (const key of this.index) {\n yield map.get(key);\n }\n }\n else {\n if (this.reversed) {\n // TODO: Not efficient due to creating temporary values array.\n const values = [...map.values()];\n for (let cntr = values.length; --cntr >= 0;) {\n yield values[cntr];\n }\n }\n else {\n for (const value of map.values()) {\n yield value;\n }\n }\n }\n }\n}\n\n/**\n * Creates a filter function to compare objects by a give property key against a regex test. The returned function\n * is also a writable Svelte store that builds a regex from the stores value.\n *\n * This filter function can be used w/ a dynamic reducer and bound as a store to input elements.\n *\n * @param {string|Iterable} accessors - Property key / accessors to lookup key to compare. To access deeper\n * entries into the object format the accessor string with `.` between entries to walk.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.accessWarn=false] - When true warnings will be posted if accessor not retrieved.\n *\n * @param {boolean} [opts.caseSensitive=false] - When true regex test is case-sensitive.\n *\n * @param {import('svelte/store').Writable} [opts.store] - Use the provided store to instead of creating\n * a default writable store.\n *\n * @returns {((data: object) => boolean) & import('svelte/store').Writable} The query string filter.\n */\nfunction regexObjectQuery(accessors, { accessWarn = false, caseSensitive = false, store } = {})\n{\n let keyword = '';\n let regex;\n\n if (store !== void 0 && !isWritableStore(store))\n {\n throw new TypeError(`createObjectQuery error: 'store' is not a writable store.`);\n }\n\n const storeKeyword = store ? store : writable(keyword);\n\n // If an existing store is provided then set initial values.\n if (store)\n {\n const current = get(store);\n\n if (typeof current === 'string')\n {\n keyword = Strings.normalize(current);\n regex = new RegExp(Strings.escape(keyword), caseSensitive ? '' : 'i');\n }\n else\n {\n store.set(keyword);\n }\n }\n\n /**\n * If there is no filter keyword / regex then do not filter otherwise filter based on the regex\n * created from the search input element.\n *\n * @param {object} data - Data object to test against regex.\n *\n * @returns {boolean} AnimationStore filter state.\n */\n function filterQuery(data)\n {\n if (keyword === '' || !regex) { return true; }\n\n if (isIterable(accessors))\n {\n for (const accessor of accessors)\n {\n const value = safeAccess(data, accessor);\n if (typeof value !== 'string')\n {\n if (accessWarn)\n {\n console.warn(`regexObjectQuery warning: could not access string data from '${accessor}'.`);\n }\n\n continue;\n }\n\n if (regex.test(Strings.normalize(value))) { return true; }\n }\n\n return false;\n }\n else\n {\n const value = safeAccess(data, accessors);\n\n if (typeof value !== 'string')\n {\n if (accessWarn)\n {\n console.warn(`regexObjectQuery warning: could not access string data from '${accessors}'.`);\n }\n\n return false;\n }\n\n return regex.test(Strings.normalize(value));\n }\n }\n\n /**\n * Create a custom store that changes when the search keyword changes.\n *\n * @param {(string) => void} handler - A callback function that accepts strings.\n *\n * @returns {import('svelte/store').Unsubscriber} Store unsubscribe function.\n */\n filterQuery.subscribe = (handler) =>\n {\n return storeKeyword.subscribe(handler);\n };\n\n /**\n * Set\n *\n * @param {string} value - A new value for the keyword / regex test.\n */\n filterQuery.set = (value) =>\n {\n if (typeof value === 'string')\n {\n keyword = Strings.normalize(value);\n regex = new RegExp(Strings.escape(keyword), caseSensitive ? '' : 'i');\n storeKeyword.set(keyword);\n }\n };\n\n return filterQuery;\n}\n\nconst filters = /*#__PURE__*/Object.freeze({\n __proto__: null,\n regexObjectQuery: regexObjectQuery\n});\n\n/**\n * Provides helper functions to create dynamic store driven filters and sort functions for dynamic reducers. The\n * returned functions are also Svelte stores and can be added to a reducer as well as used as a store.\n */\nclass DynReducerHelper\n{\n /**\n * Returns the following filter functions:\n * - regexObjectQuery(accessors, options); suitable for object reducers matching one or more property keys /\n * accessors against the store value as a regex. To access deeper entries into the object format the accessor\n * string with `.` between entries to walk. Optional parameters include logging access warnings, case sensitivity,\n * and passing in an existing store.\n *\n * @returns {{\n * regexObjectQuery: (accessors: string|Iterable, options?: {accessWarn?: boolean, caseSensitive?: boolean, store?: import('svelte/store').Writable}) => (((data: {}) => boolean) & import('svelte/store').Writable)\n * }} All available filters.\n */\n static get filters() { return filters; }\n}\n\nexport { DynArrayReducer, DynArrayReducerDerived, DynMapReducer, DynMapReducerDerived, DynReducerHelper };\n//# sourceMappingURL=index.js.map\n","import { Hashing } from '@typhonjs-fvtt/runtime/util';\nimport { isPlainObject, isObject, hasPrototype } from '@typhonjs-fvtt/runtime/util/object';\nimport { DynMapReducer } from '@typhonjs-fvtt/runtime/svelte/store/reducer';\n\n/**\n * Provides management of reactive embedded collections.\n *\n * TODO: Consider subscribing to TJSDocument rather than exposing {@link EmbeddedStoreManager.handleDocChange} and\n * {@link EmbeddedStoreManager.handleUpdate}\n */\nclass EmbeddedStoreManager\n{\n /**\n * RegExp for detecting CRUD updates for renderContext.\n *\n * @type {RegExp}\n */\n static #renderContextRegex = /(?create|delete|update)(?\\.?)(?\\w+)/;\n\n /**\n * @type {Map>}\n */\n #name = new Map();\n\n /**\n * @type {foundry.abstract.Document[]}\n */\n #document;\n\n /**\n * @type {Map}\n */\n #collectionToDocName = new Map();\n\n /**\n * @type {Set}\n */\n #embeddedNames = new Set();\n\n /**\n * @param {foundry.abstract.Document[]} document - The associated document holder.\n */\n constructor(document)\n {\n this.#document = document;\n\n this.handleDocChange();\n\n Object.seal(this);\n }\n\n /**\n * @template [T=import('./types').NamedDocumentConstructor]\n *\n * @param {T} FoundryDoc - A Foundry document class / constructor.\n *\n * @param {import('#runtime/svelte/store/reducer').DynOptionsMapCreate} options - DynMapReducer\n * creation options.\n *\n * @returns {import('#runtime/svelte/store/reducer').DynMapReducer} DynMapReducer instance.\n */\n create(FoundryDoc, options)\n {\n const docName = FoundryDoc?.documentName;\n\n if (typeof docName !== 'string')\n {\n throw new TypeError(\n `EmbeddedStoreManager.create error: 'FoundryDoc' does not have a valid 'documentName' property.`);\n }\n\n /** @type {foundry.abstract.Document} */\n const doc = this.#document[0];\n\n let collection = null;\n\n if (doc)\n {\n try\n {\n collection = doc.getEmbeddedCollection(docName);\n }\n catch (err)\n {\n console.warn(`EmbeddedStoreManager.create error: No valid embedded collection for: ${docName}`);\n }\n }\n\n let embeddedData;\n\n if (!this.#name.has(docName))\n {\n embeddedData = {\n collection,\n stores: new Map()\n };\n\n this.#name.set(docName, embeddedData);\n }\n else\n {\n embeddedData = this.#name.get(docName);\n }\n\n /** @type {string} */\n let name;\n\n /** @type {import('#runtime/svelte/store/reducer').DynDataOptions} */\n let rest = {};\n\n /** @type {import('#runtime/svelte/store/reducer').IDynMapReducerCtor} */\n let ctor;\n\n if (typeof options === 'string')\n {\n name = options;\n ctor = DynMapReducer;\n }\n else if (typeof options === 'function' && hasPrototype(options, DynMapReducer))\n {\n ctor = options;\n }\n else if (isObject(options))\n {\n ({ name, ctor = DynMapReducer, ...rest } = options);\n }\n else\n {\n throw new TypeError(`EmbeddedStoreManager.create error: 'options' does not conform to allowed parameters.`);\n }\n\n if (!hasPrototype(ctor, DynMapReducer))\n {\n throw new TypeError(`EmbeddedStoreManager.create error: 'ctor' is not a 'DynMapReducer'.`);\n }\n\n name = name ?? ctor?.name;\n\n if (typeof name !== 'string')\n {\n throw new TypeError(`EmbeddedStoreManager.create error: 'name' is not a string.`);\n }\n\n if (embeddedData.stores.has(name))\n {\n return embeddedData.stores.get(name);\n }\n else\n {\n const storeOptions = collection ? { data: collection, ...rest } : { ...rest };\n const store = new ctor(storeOptions);\n embeddedData.stores.set(name, store);\n return store;\n }\n }\n\n /**\n * @template [T=import('./types').NamedDocumentConstructor]\n *\n * Destroys and removes embedded collection stores. Invoking this method with no parameters destroys all stores.\n * Invoking with an embedded name destroys all stores for that particular collection. If you provide an embedded and\n * store name just that particular store is destroyed and removed.\n *\n * @param {T} [FoundryDoc] - A Foundry document class / constructor.\n *\n * @param {string} [storeName] - Specific store name.\n *\n * @returns {boolean} One or more stores destroyed?\n */\n destroy(FoundryDoc, storeName)\n {\n let count = 0;\n\n // Destroy all embedded stores\n if (FoundryDoc === void 0)\n {\n for (const embeddedData of this.#name.values())\n {\n embeddedData.collection = null;\n for (const store of embeddedData.stores.values())\n {\n store.destroy();\n count++;\n }\n }\n\n this.#name.clear();\n }\n else\n {\n const docName = FoundryDoc?.documentName;\n\n if (typeof docName !== 'string')\n {\n throw new TypeError(\n `EmbeddedStoreManager.delete error: 'FoundryDoc' does not have a valid 'documentName' property.`);\n }\n\n if (storeName === void 0)\n {\n const embeddedData = this.#name.get(docName);\n if (embeddedData)\n {\n embeddedData.collection = null;\n for (const store of embeddedData.stores.values())\n {\n store.destroy();\n count++;\n }\n }\n\n this.#name.delete(docName);\n }\n else if (storeName === 'string')\n {\n const embeddedData = this.#name.get(docName);\n if (embeddedData)\n {\n const store = embeddedData.stores.get(storeName);\n if (store)\n {\n store.destroy();\n count++;\n }\n }\n }\n }\n\n return count > 0;\n }\n\n /**\n * @template [T=import('./types').NamedDocumentConstructor]\n *\n * @param {T} FoundryDoc - A Foundry document class / constructor.\n *\n * @param {string} storeName - Name of the embedded collection to retrieve.\n *\n * @returns {import('#runtime/svelte/store/reducer').DynMapReducer>} DynMapReducer\n * instance.\n */\n get(FoundryDoc, storeName)\n {\n const docName = FoundryDoc?.documentName;\n\n if (typeof docName !== 'string')\n {\n throw new TypeError(\n `EmbeddedStoreManager.get error: 'FoundryDoc' does not have a valid 'documentName' property.`);\n }\n\n if (!this.#name.has(docName)) { return void 0; }\n\n return this.#name.get(docName).stores.get(storeName);\n }\n\n /**\n * Updates all existing embedded collection stores with the associated embedded collection\n */\n handleDocChange()\n {\n const doc = this.#document[0];\n\n if (doc instanceof globalThis.foundry.abstract.Document)\n {\n const existingEmbeddedNames = new Set(this.#name.keys());\n\n /** @type {[string, string][]} */\n const embeddedNames = Object.entries(doc.constructor?.metadata?.embedded ?? []);\n\n this.#collectionToDocName.clear();\n\n // Remove all previously stored embedded name CRUD keys.\n this.#embeddedNames.clear();\n\n for (const [docName, collectionName] of embeddedNames)\n {\n // Remove processed embedded doc name from existingEmbeddedNames set.\n existingEmbeddedNames.delete(docName);\n\n // Update CRUD keys for v10.\n this.#embeddedNames.add(`create${docName}`);\n this.#embeddedNames.add(`delete${docName}`);\n this.#embeddedNames.add(`update${docName}`);\n\n // Update CRUD keys for v11.\n this.#embeddedNames.add(`create.${collectionName}`);\n this.#embeddedNames.add(`delete.${collectionName}`);\n this.#embeddedNames.add(`update.${collectionName}`);\n\n // Update CRUD keys for v12.\n this.#embeddedNames.add(`create${collectionName}`);\n this.#embeddedNames.add(`delete${collectionName}`);\n this.#embeddedNames.add(`update${collectionName}`);\n\n // v10 collection to doc name lookup.\n this.#collectionToDocName.set(docName, docName);\n this.#collectionToDocName.set(collectionName, docName);\n\n let collection = null;\n\n try\n {\n // Update any existing stores with the actual collection.\n collection = doc.getEmbeddedCollection(docName);\n }\n catch (err)\n {\n console.warn(`EmbeddedStoreManager.handleDocUpdate error: No valid embedded collection for: ${docName}`);\n }\n\n // Update EmbeddedData for new collection.\n const embeddedData = this.#name.get(docName);\n if (embeddedData)\n {\n embeddedData.collection = collection;\n\n // Update all existing stores.\n for (const store of embeddedData.stores.values()) { store.setData(collection, true); }\n }\n }\n\n // Update all existing embedded collections with null data that aren't processed above.\n for (const embeddedName of existingEmbeddedNames)\n {\n const embeddedData = this.#name.get(embeddedName);\n if (embeddedData)\n {\n embeddedData.collection = null;\n\n for (const store of embeddedData.stores.values()) { store.setData(null, true); }\n }\n }\n }\n else // Reset all embedded reducer stores to null data.\n {\n this.#collectionToDocName.clear();\n this.#embeddedNames.clear();\n\n for (const embeddedData of this.#name.values())\n {\n embeddedData.collection = null;\n\n for (const store of embeddedData.stores.values()) { store.setData(null, true); }\n }\n }\n }\n\n /**\n * Handles updates to embedded stores parsing the render context for valid embedded store types.\n *\n * On create, delete, update parse the type being modified then force index updates for the embedded type.\n *\n * @param {string} renderContext - render context update from document.\n */\n handleUpdate(renderContext)\n {\n if (!this.#embeddedNames.has(renderContext)) { return; }\n\n const match = EmbeddedStoreManager.#renderContextRegex.exec(renderContext);\n\n if (match)\n {\n const docOrCollectionName = match.groups.name;\n const embeddedName = this.#collectionToDocName.get(docOrCollectionName);\n\n if (!this.#name.has(embeddedName)) { return; }\n\n for (const store of this.#name.get(embeddedName).stores.values())\n {\n store.index.update(true);\n }\n }\n }\n}\n\n/**\n * @template T\n *\n * @typedef {object} EmbeddedCollectionData\n *\n * @property {foundry.abstract.Collection} collection -\n *\n * @property {Map>} stores -\n */\n\n/**\n * @template [T=globalThis.foundry.abstract.Document]\n *\n * Provides a wrapper implementing the Svelte store / subscriber protocol around any Document / ClientMixinDocument.\n * This makes documents reactive in a Svelte component, but otherwise provides subscriber functionality external to\n * Svelte.\n */\nclass TJSDocument\n{\n /**\n * @type {T[]}\n */\n #document = [void 0];\n\n /**\n * @type {EmbeddedStoreManager}\n */\n #embeddedStoreManager;\n\n /**\n * @type {import('./types').EmbeddedAPI}\n */\n #embeddedAPI;\n\n /**\n * @type {string}\n */\n #uuidv4;\n\n /**\n * @type {TJSDocumentOptions}\n */\n #options = { delete: void 0, preDelete: void 0 };\n\n /**\n * @type {((value: T, updateOptions?: TJSDocumentUpdateOptions) => void)[]}\n */\n #subscriptions = [];\n\n /**\n * @type {TJSDocumentUpdateOptions}\n */\n #updateOptions;\n\n /**\n * @param {T | TJSDocumentOptions} [document] - Document to wrap or TJSDocumentOptions.\n *\n * @param {TJSDocumentOptions} [options] - TJSDocument options.\n */\n constructor(document, options = {})\n {\n this.#uuidv4 = `tjs-document-${Hashing.uuidv4()}`;\n\n if (isPlainObject(document)) // Handle case when only options are passed into ctor.\n {\n this.setOptions(document);\n }\n else\n {\n this.setOptions(options);\n this.set(document);\n }\n }\n\n /**\n * @returns {import('./types').EmbeddedAPI} Embedded store manager.\n */\n get embedded()\n {\n if (!this.#embeddedAPI)\n {\n this.#embeddedStoreManager = new EmbeddedStoreManager(this.#document);\n\n /** @type {import('./types').EmbeddedAPI} */\n this.#embeddedAPI = {\n create: (doc, options) => this.#embeddedStoreManager.create(doc, options),\n destroy: (doc, storeName) => this.#embeddedStoreManager.destroy(doc, storeName),\n get: (doc, storeName) => this.#embeddedStoreManager.get(doc, storeName)\n };\n }\n\n return this.#embeddedAPI;\n }\n\n /**\n * Returns the options passed on last update.\n *\n * @returns {TJSDocumentUpdateOptions} Last update options.\n */\n get updateOptions() { return this.#updateOptions ?? {}; }\n\n /**\n * Returns the UUID assigned to this store.\n *\n * @returns {string} UUID\n */\n get uuidv4() { return this.#uuidv4; }\n\n /**\n * Handles cleanup when the document is deleted. Invoking any optional delete function set in the constructor.\n *\n * @returns {Promise}\n */\n async #deleted()\n {\n const doc = this.#document[0];\n\n // Check to see if the document is still in the associated collection to determine if actually deleted.\n if (doc instanceof globalThis.foundry.abstract.Document && !doc?.collection?.has(doc.id))\n {\n delete doc?.apps[this.#uuidv4];\n this.#setDocument(void 0);\n\n if (typeof this.#options.preDelete === 'function')\n {\n await this.#options.preDelete(doc);\n }\n\n this.#updateSubscribers(false, { action: 'delete', data: void 0 });\n\n if (typeof this.#options.delete === 'function')\n {\n await this.#options.delete(doc);\n }\n\n this.#updateOptions = void 0;\n }\n }\n\n /**\n * Completely removes all internal subscribers, any optional delete callback, and unregisters from the\n * ClientDocumentMixin `apps` tracking object.\n */\n destroy()\n {\n const doc = this.#document[0];\n\n if (this.#embeddedStoreManager)\n {\n this.#embeddedStoreManager.destroy();\n this.#embeddedStoreManager = void 0;\n this.#embeddedAPI = void 0;\n }\n\n if (doc instanceof globalThis.foundry.abstract.Document)\n {\n delete doc?.apps[this.#uuidv4];\n this.#setDocument(void 0);\n }\n\n this.#options.delete = void 0;\n this.#subscriptions.length = 0;\n }\n\n /**\n * @param {boolean} [force] - unused - signature from Foundry render function.\n *\n * @param {object} [options] - Options from render call; will have document update context.\n */\n #updateSubscribers(force = false, options = {}) // eslint-disable-line no-unused-vars\n {\n this.#updateOptions = options;\n\n const doc = this.#document[0];\n\n for (let cntr = 0; cntr < this.#subscriptions.length; cntr++) { this.#subscriptions[cntr](doc, options); }\n\n if (this.#embeddedStoreManager)\n {\n this.#embeddedStoreManager.handleUpdate(options.renderContext);\n }\n }\n\n /**\n * @returns {T} Current document\n */\n get() { return this.#document[0]; }\n\n /**\n * Attempts to create a Foundry UUID from standard drop data. This may not work for all systems.\n *\n * @param {object} data - Drop transfer data.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {boolean} [opts.actor=true] - Accept actor owned documents.\n *\n * @param {boolean} [opts.compendium=true] - Accept compendium documents.\n *\n * @param {boolean} [opts.world=true] - Accept world documents.\n *\n * @param {string[]|undefined} [opts.types] - Require the `data.type` to match entry in `types`.\n *\n * @returns {string|undefined} Foundry UUID for drop data.\n */\n static getUUIDFromDataTransfer(data, { actor = true, compendium = true, world = true, types = void 0 } = {})\n {\n if (!isObject(data)) { return void 0; }\n if (Array.isArray(types) && !types.includes(data.type)) { return void 0; }\n\n let uuid = void 0;\n\n if (typeof data.uuid === 'string') // v10 and above provides a full UUID.\n {\n const isCompendium = data.uuid.startsWith('Compendium');\n\n if (isCompendium && compendium)\n {\n uuid = data.uuid;\n }\n else if (world)\n {\n uuid = data.uuid;\n }\n }\n else // v9 and below parsing.\n {\n if (actor && world && data.actorId && data.type)\n {\n uuid = `Actor.${data.actorId}.${data.type}.${data.data._id}`;\n }\n else if (typeof data.id === 'string') // v9 and below uses `id`\n {\n if (compendium && typeof data.pack === 'string')\n {\n uuid = `Compendium.${data.pack}.${data.id}`;\n }\n else if (world)\n {\n uuid = `${data.type}.${data.id}`;\n }\n }\n }\n\n return uuid;\n }\n\n\n /**\n * @param {T | undefined} document - New document to set.\n *\n * @param {TJSDocumentUpdateOptions} [options] - New document update options to set.\n */\n set(document, options = {})\n {\n if (this.#document[0])\n {\n delete this.#document[0].apps[this.#uuidv4];\n }\n\n if (document !== void 0 && !(document instanceof globalThis.foundry.abstract.Document))\n {\n throw new TypeError(`TJSDocument set error: 'document' is not a valid Document or undefined.`);\n }\n\n if (!isObject(options))\n {\n throw new TypeError(`TJSDocument set error: 'options' is not an object.`);\n }\n\n if (document instanceof globalThis.foundry.abstract.Document)\n {\n document.apps[this.#uuidv4] = {\n close: this.#deleted.bind(this),\n render: this.#updateSubscribers.bind(this)\n };\n }\n\n this.#setDocument(document);\n this.#updateOptions = options;\n this.#updateSubscribers();\n }\n\n /**\n *\n * @param {T | undefined} doc -\n */\n #setDocument(doc)\n {\n this.#document[0] = doc;\n\n if (this.#embeddedStoreManager) { this.#embeddedStoreManager.handleDocChange(); }\n }\n\n /**\n * Potentially sets new document from data transfer object.\n *\n * @param {object} data - Document transfer data.\n *\n * @param {{ actor?: boolean, compendium?: boolean, world?: boolean, types?: string[] } & TJSDocumentOptions} [options] - Optional\n * parameters.\n *\n * @returns {Promise} Returns true if new document set from data transfer blob.\n */\n async setFromDataTransfer(data, options)\n {\n return this.setFromUUID(TJSDocument.getUUIDFromDataTransfer(data, options), options);\n }\n\n /**\n * Sets the document by Foundry UUID performing a lookup and setting the document if found.\n *\n * @param {string} uuid - A Foundry UUID to lookup.\n *\n * @param {TJSDocumentOptions} [options] - New document update options to set.\n *\n * @returns {Promise} True if successfully set document from UUID.\n */\n async setFromUUID(uuid, options = {})\n {\n if (typeof uuid !== 'string' || uuid.length === 0) { return false; }\n\n try\n {\n const doc = await globalThis.fromUuid(uuid);\n\n if (doc)\n {\n this.set(doc, options);\n return true;\n }\n }\n catch (err) { /**/ }\n\n return false;\n }\n\n /**\n * Sets options for this document wrapper / store.\n *\n * @param {TJSDocumentOptions} options - Options for TJSDocument.\n */\n setOptions(options)\n {\n if (!isObject(options))\n {\n throw new TypeError(`TJSDocument error: 'options' is not a plain object.`);\n }\n\n // Verify valid values -------------\n\n if (options.delete !== void 0 && typeof options.delete !== 'function')\n {\n throw new TypeError(`TJSDocument error: 'delete' attribute in options is not a function.`);\n }\n\n if (options.preDelete !== void 0 && typeof options.preDelete !== 'function')\n {\n throw new TypeError(`TJSDocument error: 'preDelete' attribute in options is not a function.`);\n }\n\n // Set any valid values -------------\n\n if (options.delete === void 0 || typeof options.delete === 'function')\n {\n this.#options.delete = options.delete;\n }\n\n if (options.preDelete === void 0 || typeof options.preDelete === 'function')\n {\n this.#options.preDelete = options.preDelete;\n }\n }\n\n /**\n * @param {(value: T, updateOptions?: TJSDocumentUpdateOptions) => void} handler - Callback function that is\n * invoked on update / changes.\n *\n * @returns {import('svelte/store').Unsubscriber} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // Add handler to the array of subscribers.\n\n const updateOptions = { action: 'subscribe', data: void 0 };\n\n handler(this.#document[0], updateOptions); // Call handler with current value and update options.\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n}\n\n/**\n * @typedef {object} TJSDocumentOptions\n *\n * @property {(doc: globalThis.foundry.abstract.Document) => void} [delete] Optional post delete function to invoke when\n * document is deleted _after_ subscribers have been notified.\n *\n * @property {(doc: globalThis.foundry.abstract.Document) => void} [preDelete] Optional pre delete function to invoke\n * when document is deleted _before_ subscribers are notified.\n */\n\n/**\n * @typedef TJSDocumentUpdateOptions Provides data regarding the latest document change.\n *\n * @property {string} [action] The update action. Useful for filtering.\n *\n * @property {string} [renderContext] The update action. Useful for filtering.\n *\n * @property {object[]|string[]} [data] Foundry data associated with document changes.\n */\n\n/**\n * Provides a wrapper implementing the Svelte store / subscriber protocol around any DocumentCollection. This makes\n * document collections reactive in a Svelte component, but otherwise provides subscriber functionality external to\n * Svelte.\n *\n * @template [T=DocumentCollection]\n */\nclass TJSDocumentCollection\n{\n #collection;\n #collectionCallback;\n #uuid;\n\n /**\n * @type {TJSDocumentCollectionOptions}\n */\n #options = { delete: void 0, preDelete: void 0 };\n\n /**\n * @type {((value: T, updateOptions?: TJSDocumentCollectionUpdateOptions) => void)[]}\n */\n #subscriptions = [];\n\n /**\n * @type {TJSDocumentCollectionUpdateOptions}\n */\n #updateOptions;\n\n /**\n * @param {T | TJSDocumentCollectionOptions} [collection] - Collection to wrap or TJSDocumentCollectionOptions.\n *\n * @param {TJSDocumentCollectionOptions} [options] - TJSDocumentCollection options.\n */\n constructor(collection, options = {})\n {\n this.#uuid = `tjs-collection-${Hashing.uuidv4()}`;\n\n if (isPlainObject(collection)) // Handle case when only options are passed into ctor.\n {\n this.setOptions(collection);\n }\n else\n {\n this.setOptions(options);\n this.set(collection);\n }\n }\n\n /**\n * Returns the options passed on last update.\n *\n * @returns {TJSDocumentCollectionUpdateOptions} Last update options.\n */\n get updateOptions() { return this.#updateOptions ?? {}; }\n\n /**\n * Returns the UUID assigned to this store.\n *\n * @returns {string} UUID\n */\n get uuid() { return this.#uuid; }\n\n /**\n * Handles cleanup when the collection is deleted. Invoking any optional delete function set in the constructor.\n *\n * @returns {Promise}\n */\n async #deleted()\n {\n const collection = this.#collection;\n\n if (collection instanceof DocumentCollection)\n {\n const index = collection?.apps?.findIndex((sub) => sub === this.#collectionCallback);\n if (index >= 0) { collection?.apps?.splice(index, 1); }\n\n this.#collection = void 0;\n }\n\n if (typeof this.#options.preDelete === 'function')\n {\n await this.#options.preDelete(collection);\n }\n\n this.#notify(false, { action: 'delete', documentType: collection.documentName, documents: [], data: [] });\n\n if (typeof this.#options.delete === 'function')\n {\n await this.#options.delete(collection);\n }\n\n this.#updateOptions = void 0;\n }\n\n /**\n * Completely removes all internal subscribers, any optional delete callback, and unregisters from the\n * DocumentCollection `apps` tracking array.\n */\n destroy()\n {\n const collection = this.#collection;\n\n if (collection instanceof DocumentCollection)\n {\n const index = collection?.apps?.findIndex((sub) => sub === this.#collectionCallback);\n if (index >= 0) { collection?.apps?.splice(index, 1); }\n\n this.#collection = void 0;\n }\n\n this.#options.delete = void 0;\n this.#subscriptions.length = 0;\n }\n\n /**\n * @param {boolean} [force] - unused - signature from Foundry render function.\n *\n * @param {object} [options] - Options from render call; will have collection update context.\n */\n #notify(force = false, options = {}) // eslint-disable-line no-unused-vars\n {\n this.#updateOptions = options;\n\n // Subscriptions are stored locally as on the browser Babel is still used for private class fields / Babel\n // support until 2023. IE not doing this will require several extra method calls otherwise.\n const subscriptions = this.#subscriptions;\n const collection = this.#collection;\n\n for (let cntr = 0; cntr < subscriptions.length; cntr++) { subscriptions[cntr](collection, options); }\n }\n\n /**\n * @returns {T} Current collection\n */\n get() { return this.#collection; }\n\n /**\n * @param {T | undefined} collection - New collection to set.\n *\n * @param {object} [options] - New collection update options to set.\n */\n set(collection, options = {})\n {\n if (this.#collection)\n {\n const index = this.#collection.apps.findIndex((sub) => sub === this.#collectionCallback);\n if (index >= 0) { this.#collection.apps.splice(index, 1); }\n\n this.#collectionCallback = void 0;\n }\n\n if (collection !== void 0 && !(collection instanceof DocumentCollection))\n {\n throw new TypeError(\n `TJSDocumentCollection set error: 'collection' is not a valid DocumentCollection or undefined.`);\n }\n\n if (!isObject(options))\n {\n throw new TypeError(`TJSDocument set error: 'options' is not an object.`);\n }\n\n if (collection instanceof DocumentCollection)\n {\n this.#collectionCallback = {\n close: this.#deleted.bind(this),\n render: this.#notify.bind(this)\n };\n\n collection?.apps?.push(this.#collectionCallback);\n }\n\n this.#collection = collection;\n this.#updateOptions = options;\n this.#notify();\n }\n\n /**\n * Sets options for this collection wrapper / store.\n *\n * @param {TJSDocumentCollectionOptions} options - Options for TJSDocumentCollection.\n */\n setOptions(options)\n {\n if (!isObject(options))\n {\n throw new TypeError(`TJSDocumentCollection error: 'options' is not an object.`);\n }\n\n // Verify valid values -------------\n\n if (options.delete !== void 0 && typeof options.delete !== 'function')\n {\n throw new TypeError(`TJSDocumentCollection error: 'delete' attribute in options is not a function.`);\n }\n\n if (options.preDelete !== void 0 && typeof options.preDelete !== 'function')\n {\n throw new TypeError(`TJSDocumentCollection error: 'preDelete' attribute in options is not a function.`);\n }\n\n // Set any valid values -------------\n\n if (options.delete === void 0 || typeof options.delete === 'function')\n {\n this.#options.delete = options.delete;\n }\n\n if (options.preDelete === void 0 || typeof options.preDelete === 'function')\n {\n this.#options.preDelete = options.preDelete;\n }\n }\n\n /**\n * @param {(value: T, updateOptions?: TJSDocumentCollectionUpdateOptions) => void} handler - Callback function\n * that is invoked on update / changes.\n *\n * @returns {import('svelte/store').Unsubscriber} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // Add handler to the array of subscribers.\n\n const collection = this.#collection;\n\n const documentType = collection?.documentName ?? void 0;\n\n const updateOptions = { action: 'subscribe', documentType, documents: [], data: [] };\n\n handler(collection, updateOptions); // Call handler with current value and update options.\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n}\n\nexport { TJSDocument, TJSDocumentCollection };\n//# sourceMappingURL=index.js.map\n","\n\nimport WelcomeAppShell from './WelcomeAppShell.svelte';\nimport { SvelteApplication } from \"@typhonjs-fvtt/runtime/svelte/application\";\nimport { TJSDocument } from \"@typhonjs-fvtt/runtime/svelte/store/fvtt/document\";\nimport { MODULE_ID, MODULE_CODE } from \"~/src/helpers/constants\"\nimport { version } from \"../../module.json\";\n\nexport default class WelcomeApplication extends SvelteApplication\n{\n /**\n * Default Application options\n *\n * @returns {object} options - Application options.\n * @see https://foundryvtt.com/api/interfaces/client.ApplicationOptions.html\n */\n static get defaultOptions()\n {\n return foundry.utils.mergeObject(super.defaultOptions, {\n id: 'foundryvtt-actor-studio-welcome',\n classes: [MODULE_CODE],\n resizable: true,\n minimizable: true,\n width: 220,\n height: 400,\n headerIcon: 'modules/foundryvtt-actor-studio/assets/actor-studio-logo-dragon-white.svg',\n title: game.i18n.localize('GAS.ActorStudio')+' v'+version,\n svelte: {\n class: WelcomeAppShell,\n target: document.body,\n intro: true,\n props: {\n version // A prop passed to HelloFoundryAppShell for the initial message displayed.\n }\n }\n });\n }\n}","import { MODULE_ID } from '~/src/helpers/constants';\n\nclass plugin {\n\n enabled\n constructor() {\n this.enabled = false\n }\n\n /**\n * Initializes the plugin by checking if Donation Tracker is enabled in settings.\n * Sets up a hook to notify when the GAS Plugin is loaded.\n */\n init() {\n this.enabled = game.settings.get(MODULE_ID, 'enable-donation-tracker')\n // @todo: https://github.com/geoidesic/foundryvtt-actor-studio/issues/32#issuecomment-2166888022\n Hooks.on('gas-plugin', () => {\n alert('GAS Plugin Loaded')\n })\n }\n\n\n /**\n * Retrieves the settings for each donation tracker rank, including the folder name and permission.\n * \n * @returns {Array} - An array of objects containing permission, rank, and folderName.\n */\n getDTSettings() {\n const membershipRanks = game.membership.RANKS\n const membershipFolderArray = Object.entries(membershipRanks).filter(([_, value]) => value !== -1);\n const settings = membershipFolderArray\n .map(([key, rank]) => { return { permission: key, rank, folderName: game.settings.get(MODULE_ID, `donation-tracker-rank-${key}`) } })\n return settings\n }\n\n /**\n * Checks if the current pack has DT folders or not.\n * Ignored rank access permissions.\n * @param {object} pack \n * @returns boolean\n */\n packHasDTFolders(pack) {\n const membershipRanks = game.membership.RANKS\n const membershipFolderArray = Object.entries(membershipRanks).filter(([_, value]) => value !== -1);\n\n const DTfolders = membershipFolderArray\n .map(([key, _]) => game.settings.get(MODULE_ID, `donation-tracker-rank-${key}`))\n // game.system.log.d('DTfolders', DTfolders)\n return DTfolders.length > 0\n }\n\n /**\n * Retrieves all folder names associated with donation tracker ranks.\n * @returns {Array} - An array of folder names tied to donation tracker ranks.\n */\n getAllowedDTFolderNames() {\n const membershipRanks = game.membership.RANKS\n // game.system.log.d('membershipRanks', membershipRanks)\n const membershipFolderArray = Object.entries(membershipRanks).filter(([_, value]) => value !== -1);\n // game.system.log.d('membershipFolderArray', membershipFolderArray)\n const allowedMembershipFolderNames = membershipFolderArray.filter(([key, _]) =>\n {\n // game.system.log.d('key', key);\n return game.membership.hasPermission(key)\n //-@why: #102, unregistered = \"member\"\n || (\n game.membership.membershipLevel == -1\n && key == 'member'\n )\n }\n )\n .map(([key, _]) => game.settings.get(MODULE_ID, `donation-tracker-rank-${key}`))\n // game.system.log.d('allowedMembershipFolderNames', allowedMembershipFolderNames)\n return allowedMembershipFolderNames\n }\n\n\n /**\n * Retrieves the root-level and subfolder DT folder IDs from a compendium pack that are allowed for the current user.\n * \n * @param {Object} pack - The compendium pack to search.\n * @returns {Array} - An array of allowed folder IDs including subfolders.\n */\n getDTFolderIdsFromPack(pack, filterByPermissions = true) {\n let allowedFolderIds = [];\n /**\n * Recursively retrieves folder IDs including subfolders.\n * \n * @param {Array} folders - An array of folder objects to search.\n * @returns {Array} - An array of allowed folder IDs.\n */\n const getFolderAndSubfolderIds = (folders) => {\n // game.system.log.d('folders', folders)\n for (let i = 0; i < folders.length; i++) {\n const folder = folders[i];\n // game.system.log.d('folder.id', folder.id)\n\n allowedFolderIds.push(folder.id);\n\n // If the folder has subfolders, recursively add their IDs\n // game.system.log.d(folder.id+'_folder.folders', folder.children)\n if (folder.children && folder.children.length > 0) {\n getFolderAndSubfolderIds(folder.children.map(f => f.folder));\n }\n\n // game.system.log.d('allowedFolderIds', allowedFolderIds)\n }\n };\n\n\n // game.system.log.d('>>>>>>>>>>>>> pack.name', pack.metadata.name)\n\n // game.system.log.d('filterByPermissions', filterByPermissions)\n //- Filter pack root folders based on the user's membership rank and get their IDs and subfolder IDs \n const validRootFolderNames = this.getAllowedDTFolderNames();\n // game.system.log.d('id', pack.metadata.id);\n // game.system.log.d('this.getDTFolderNames()', this.getAllowedDTFolderNames());\n // game.system.log.d('validRootFolderNames', validRootFolderNames)\n // game.system.log.d('pack.folders', pack.folders)\n // game.system.log.d('pack.folders.filtered', pack.folders.filter(f => validRootFolderNames.includes(f.name)))\n\n if (filterByPermissions) {\n getFolderAndSubfolderIds(pack.folders.filter(f => validRootFolderNames.includes(f.name)));\n } else {\n getFolderAndSubfolderIds(Array.from(pack.folders));\n }\n // game.system.log.d('allowedFolderIds', allowedFolderIds)\n return allowedFolderIds;\n }\n}\n\nexport default new plugin();","\nimport { LOG_PREFIX, MODULE_ID } from \"~/src/helpers/constants\"\nimport DTPlugin from \"~/src/plugins/donation-tracker\";\n\nexport const log = {\n ASSERT: 1, ERROR: 2, WARN: 3, INFO: 4, DEBUG: 5, VERBOSE: 6,\n set level(level) {\n this.a = (level >= this.ASSERT) ? console.assert.bind(window.console, LOG_PREFIX) : () => { };\n this.e = (level >= this.ERROR) ? console.error.bind(window.console, LOG_PREFIX) : () => { };\n this.w = (level >= this.WARN) ? console.warn.bind(window.console, LOG_PREFIX) : () => { };\n this.i = (level >= this.INFO) ? console.info.bind(window.console, LOG_PREFIX) : () => { };\n this.d = (level >= this.DEBUG) ? console.debug.bind(window.console, LOG_PREFIX) : () => { };\n this.v = (level >= this.VERBOSE) ? console.log.bind(window.console, LOG_PREFIX) : () => { };\n this.loggingLevel = level;\n },\n get level() { return this.loggingLevel; }\n};\n\n\n/**\n * Gets a rules from a journal by ID and Page\n *\n * @export\n * @async\n * @param {object} rule\n * @param {string} rule.journalId\n * @param {string} rule.pageId\n * @returns {string}\n */\nexport async function getRules(rule) {\n const { journalId, pageId } = rule;\n const rules = await game.packs.get('dnd5e.rules');\n const journal = await rules?.getDocument(journalId);\n const text = (journal)?.pages?.get(pageId).text;\n if (!text) {\n console.error(`Unable to find rule journal on compendium ${DEFAULT_PACKS.RULES}`);\n }\n return text;\n}\n\nexport function filterPackForDTPackItems(pack, entries) {\n // game.system.log.d('filterPackForDTPackItems', pack, entries);\n // game.system.log.d('filterPackForDTPackItems filter', entries.filter);\n if (game.modules.get('donation-tracker')?.active && game.settings.get(MODULE_ID, 'enable-donation-tracker')) {\n \n\n //- if the pack has no DT folders, include everything, @why: as this compendium is not managed by DT\n if (!DTPlugin.packHasDTFolders(pack)) {\n // game.system.log.d('packHasDTFolders false');\n return true;\n }\n // get dt folder id's from this pack\n const allowedDTFolderIds = DTPlugin.getDTFolderIdsFromPack(pack)\n // game.system.log.d('allowedDTFolderIds', allowedDTFolderIds);\n const allDTFolderIds = DTPlugin.getDTFolderIdsFromPack(pack, false)\n // game.system.log.d('allDTFolderIds', allDTFolderIds);\n \n const unregisteredAccess = game.settings.get(MODULE_ID, 'enable-donation-tracker-unregistered-access');\n\n if(game.user.isGM && game.membership.DEVELOPER_IS_ADMIN) return entries;\n // filter the index.entries accordingly\n entries = entries.filter(([key, value]) => {\n\n // game.system.log.d('key', key, value)\n //- if item is not in a folder\n // game.system.log.d(1)\n if (!value.folder) {\n return unregisteredAccess;\n }\n \n //- if the item is in a folder that is not a real folder (e.g. deleted folder)\n // game.system.log.d(2)\n if (!pack.folders.get(value.folder)) return false;\n \n //- if the item is in a DT folder tree, include it\n // game.system.log.d(4)\n if (allowedDTFolderIds.includes(value.folder)) return true;\n // game.system.log.d(5)\n \n //- if item is in a folder that is not a DT folder\n if(!allDTFolderIds.includes(value.folder)) {\n // game.system.log.d(6)\n return unregisteredAccess;\n }\n \n // game.system.log.d(7)\n\n return false;\n });\n }\n return entries;\n}\n\n\n/**\n * Extracts items from all compendium packs including subfolders.\n * Use this if you're happy with the default pack index.\n * @param {Array} packs compendium packs\n * @param {Array} keys pack data to extract\n * @returns {Array} extracted items\n */\nexport function extractItemsFromPacksSync(packs, keys) {\n const items = [];\n\n for (const pack of packs) {\n game.system.log.d('pack.metadata.name', pack.metadata.name);\n if (!pack.index) {\n ui.notifications.error(game.i18n.localize('GAS.Error.PackIndexNotFound'));\n }\n let entries = pack.index.entries()\n // @todo if DonationTracker enabled then https://github.com/geoidesic/foundryvtt-actor-studio/issues/32#issuecomment-2166888022\n entries = filterPackForDTPackItems(pack, entries);\n const packItems = extractMapIteratorObjectProperties(entries, keys);\n // game.system.log.d('packItems', packItems);\n items.push(...packItems);\n }\n return items;\n}\n\n/**\n * Extracts items from all compendium packs including subfolders.\n * Use this if you need extra index info (via async)\n * @param {Array} packs compendium packs\n * @param {Array} keys pack data to extract\n * @param {boolean|Array} nonIndexKeys pack data to extract that doesn't exist in the index, thus we need to generate a new index, which is an async process\n * @returns {Array} extracted items\n */\nexport async function extractItemsFromPacksAsync(packs, keys, nonIndexKeys = false) {\n const items = [];\n // game.system.log.d('extractItemsFromPacks packs', packs);\n // game.system.log.d('nonIndexKeys', nonIndexKeys);\n for (const pack of packs) {\n\n let index = await pack.getIndex({\n fields: nonIndexKeys,\n });\n\n if (!pack) continue;\n if (!index) {\n ui.notifications.error(game.i18n.localize('GAS.Error.PackIndexNotFound'));\n }\n\n // game.system.log.d('extractItemsFromPacks pack.name', pack.metadata.name);\n // game.system.log.d('extractItemsFromPacks pack', pack);\n // game.system.log.d('extractItemsFromPacks packindex', index);\n let entries = index.entries()\n // game.system.log.d('extractItemsFromPacks entries', entries);\n entries = filterPackForDTPackItems(pack, entries);\n // game.system.log.d('extractItemsFromPacks entries post', entries);\n \n const packItems = extractMapIteratorObjectProperties(entries, [...keys, ...nonIndexKeys]);\n items.push(...packItems);\n }\n game.system.log.d('items', items)\n return items;\n}\n\nexport function extractMapIteratorObjectProperties(mapIterator, keys) {\n const newArray = [];\n for (const [key, data] of mapIterator) {\n const newObj = {};\n keys.forEach((k) => {\n if (k.includes('->')) {\n const split = k.split('->');\n newObj[split[1]] = data[split[0]];\n } else if (k.includes('.')) {\n setNestedProperty(newObj, k, getNestedProperty(data, k))\n } else {\n newObj[k] = data[k];\n }\n });\n newObj.key = key;\n newArray.push(newObj);\n }\n return newArray;\n}\n\n\nexport function getNestedProperty(obj, path) {\n return path.split('.').reduce((acc, key) => acc && acc[key], obj);\n}\n\nexport function setNestedProperty(obj, path, value) {\n const keys = path.split('.');\n const lastKey = keys.pop();\n const lastObj = keys.reduce((acc, key) => acc[key] = acc[key] || {}, obj);\n lastObj[lastKey] = value;\n}\n\n\n\nexport function getFoldersFromMultiplePacks(packs, depth = 1) {\n const folders = [];\n for (const pack of packs) {\n const packFolders = getPackFolders(pack, depth);\n folders.push(...packFolders);\n }\n return folders;\n}\n\nexport function getPackFolders(pack, depth = 1) {\n const allRootFolders = extractMapIteratorObjectProperties(pack.folders.entries(), ['depth', 'name', '_id']);\n const foldersAtDepth = allRootFolders.filter(x => x.depth === depth);\n return foldersAtDepth\n}\n\nexport const getPacksFromSettings = (type) => {\n const settings = game.settings.get(MODULE_ID, 'compendiumSources');\n let filteredPackNames = settings[type];\n const packs = [];\n\n filteredPackNames = filteredPackNames.filter(packName => {\n const pack = game.packs.get(packName);\n if (pack) {\n packs.push(pack);\n return true;\n }\n return false;\n });\n\n // Update settings if any packs were removed\n if (filteredPackNames.length !== settings[type].length) {\n settings[type] = filteredPackNames;\n game.settings.set(MODULE_ID, 'compendiumSources', settings);\n }\n\n return packs;\n}\n\nexport const getAllPacksFromAllSettings = () => {\n const settings = game.settings.get(MODULE_ID, 'compendiumSources');\n const types = Object.keys(settings);\n const packs = [];\n for (const type of types) {\n const filteredPackNames = settings[type];\n for (const packName of filteredPackNames) {\n packs.push(game.packs.get(packName));\n }\n }\n return packs;\n}\n\nexport const getAllPackIdsFromAllSettings = () => {\n const packs = getAllPacksFromAllSettings();\n // game.system.log.d('getAllPackIdsFromAllSettings', packs);\n return packs.map(p => {\n return p.collection\n });\n}\n\nexport function getAdvancementValue(advancement, key) {\n if (game.version > 12) {\n return advancement[key] || null;\n } else {\n return advancement.configuration?.[key] || null\n }\n}\n\n\nexport function ucfirst(str) {\n if (!str) return str;\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\n}\n\n\nexport function camelCaseToTitleCase(camelCaseStr) {\n // Split the string at each uppercase letter\n const words = camelCaseStr.replace(/([A-Z])/g, ' $1').trim();\n\n // Capitalize the first letter of each word and join them with spaces\n const titleCaseStr = words.split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');\n\n return titleCaseStr;\n}\n\nexport const getCompendiumSource = (item) => {\n // game.system.log.d('getCompendiumSource', item);\n let sourceId;\n if (game.version < 12) {\n sourceId = item.flags.core.sourceId;\n } else {\n sourceId = item._stats.compendiumSource;\n }\n // game.system.log.d('sourceId', sourceId);\n return sourceId;\n}\n\nexport const prepareItemForDrop = async ({ itemData, isLevelUp, isMultiClass }) => {\n game.system.log.d('prepareItemForDrop');\n game.system.log.d('isLevelUp? ', isLevelUp);\n game.system.log.d('isMultiClass? ', isMultiClass);\n game.system.log.d('itemData', itemData);\n\n let item\n if (isLevelUp) {\n if (isMultiClass) {\n item = await Item.implementation.fromDropData({ type: 'Item', uuid: itemData.uuid });\n } else {\n item = await Item.implementation.fromDropData({ type: 'Item', uuid: getCompendiumSource(itemData) });\n }\n\n if (!item) {\n log.e('Item not found in compendium', itemData._stats.compendiumSource);\n ui.notifications.error(game.i18n.localize('GAS.Error.ItemNotFoundInCompendium'));\n return\n }\n } else {\n const dropData = {\n type: 'Item',\n uuid: itemData.uuid,\n }\n game.system.log.d('dropData', dropData);\n item = await Item.implementation.fromDropData(dropData);\n game.system.log.d('item', item);\n }\n return item;\n}\n\n//- used by dropItemRegistry\nexport const dropItemOnCharacter = async (actor, item) => {\n game.system.log.d('dropItemOnCharacter');\n game.system.log.d('dropItemOnCharacter item', item);\n game.system.log.d('actor.sheet._onDropItemCreate fn', actor.sheet._onDropItemCreate);\n return await actor.sheet._onDropItemCreate(item);\n}\n\nexport const itemHasAdvancementChoices = (item) => {\n let hasAdvancementChoices = false;\n if (!item?.system?.advancement.length) return false;\n for (const adv of item.system.advancement) {\n if (adv.configuration.choices) {\n hasAdvancementChoices = true;\n break;\n }\n }\n return hasAdvancementChoices;\n}\n\nexport const isAdvancementsForLevelInItem = (level, item) => {\n // where structure is like system.advancement = [{level: 1, ...}]\n const adv = item?.system?.advancement.find(adv => adv.level === level)\n if (adv) return true;\n return false\n}\n\n// truncate string\nexport function truncate(str, n) {\n return str.length > n ? str.substr(0, n - 1) + \"...\" : str;\n}\n\n/** @todo: these were from HCT. None of these apply to the current version of Actor Studio */\nexport function userHasRightPermissions() {\n const userRole = game.user.role;\n\n // create actor (REQUIRED)\n if (!((game).permissions.ACTOR_CREATE).includes(userRole)) {\n ui.notifications?.error(game.i18n.localize('GAS.Permissions.NeedCreateActorError'));\n return false;\n }\n\n // create item (optional)\n // if (!((game).permissions.ITEM_CREATE).includes(userRole)) {\n // ui.notifications?.warn(game.i18n.localize('GAS.Permissions.NeedCreateItemWarn'));\n // }\n\n // upload files (optional)\n // if (!((game).permissions.FILES_UPLOAD).includes(userRole)) {\n // ui.notifications?.warn(game.i18n.localize('GAS.Permissions.NeedFileUploadWarn'));\n // }\n\n // browse files (optional)\n // if (!((game).permissions.FILES_BROWSE).includes(userRole)) {\n // ui.notifications?.warn(game.i18n.localize('GAS.Permissions.NeedFileBrowseWarn'));\n // }\n return true;\n}","import { writable, get, derived } from 'svelte/store';;\nimport { dropItemOnCharacter, prepareItemForDrop, itemHasAdvancementChoices } from \"~/src/helpers/Utility\";\nconst initialTabs = [\n { label: \"Abilities\", id: \"abilities\", component: \"Abilities\" },\n { label: \"Race\", id: \"race\", component: \"Race\" },\n { label: \"Background\", id: \"background\", component: \"Background\" },\n { label: \"Class\", id: \"class\", component: \"Class\" },\n]\n\n// Tabs for level up\nconst upTabs = [\n { label: \"Level Up\", id: \"level-up\", component: \"LevelUp\" },\n\n]\n\nlet lastDrop = writable(false);\n\nconst arrayOfObjectsStore = () => {\n const store = writable([]); // stores an object with signature {actorId, itemData, id} \n const inProcess = writable(false); // stores the advancement application that's in process\n const { subscribe, set, update } = store;\n \n const remove = (id) => update(apps => apps.filter(app => app.id !== id));\n\n return {\n subscribe,\n add: (app) => {\n update(apps => {\n const filteredApps = apps.filter(existingApp => existingApp.id !== app.id); // Remove any app with the same id\n return [...filteredApps, app]; // Add the new app\n });\n game.system.log.d('currentStore.length', get(store).length);\n },\n \n \n remove,\n removeAll: () => set([]),\n advanceQueue: async (initial) => {\n // game.system.log.d('advanceQueue')\n // game.system.log.d('advanceQueue initial', initial || false)\n \n const currentStore = get(store);\n // game.system.log.d('currentStore.length', currentStore.length)\n // game.system.log.d('advanceQueue currentStore.length', currentStore.length)\n \n const next = currentStore[0] || false;\n // game.system.log.d(\"advanceQueue next\", next);\n // game.system.log.d('current item to advance: ', next.id)\n if (!next) {\n inProcess.set(false);\n game.system.log.d('end of queue')\n return false;\n }\n inProcess.set(next);\n remove(next.id);\n // game.system.log.d('advanceQueue currentStore.length', currentStore.length)\n // game.system.log.d('dropping item to character', next)\n // game.system.log.d(next.itemData);\n const item = await prepareItemForDrop(next)\n \n try {\n const result = await dropItemOnCharacter(next.actor, item);\n // game.system.log.d('dropItemOnCharacter result', result)\n } catch (error) {\n // game.system.log.e('dropItemOnCharacter error', error)\n }\n\n if(currentStore.length == 1) {\n if(!itemHasAdvancementChoices(next.itemData)) {\n return false\n }\n } \n if(currentStore.length == 0) return false\n return true;\n \n },\n currentProcess: derived(inProcess, $inProcess => $inProcess),\n updateCurrentProcess: (obj) => inProcess.update(p => ({...p, ...obj})),\n };\n}\n\nexport const race = writable(false); \nexport const subRace = writable(false); \nexport const characterClass = writable(false); \nexport const characterSubClass = writable(false); \nexport const background = writable(false); \nexport const abilities = writable(false); \nexport const spells = writable(false); \nexport const isLevelUp = writable(false); \nexport const pointBuy = writable(false); \nexport const abilityRolls = writable(false); \nexport const isStandardArrayValues = writable(false); \nexport const newClassLevel = writable(false); \nexport const level = writable(1); \nexport const activeTab = writable(''); \nexport const activeClass = writable(false); \nexport const isActorCreated = writable(false);\nexport const dropItemRegistry = arrayOfObjectsStore();\nexport const tabs = writable(initialTabs);\nexport const levelUpTabs = writable(upTabs);\nexport const actorInGame = writable(false);\nexport const abilityGenerationMethod = writable(null);\nexport const subClassesForClass = writable([]);\n\nexport const isMultiClass = derived([characterClass, activeClass, newClassLevel], ([$characterClass, $characterSubClass, $newClassLevel]) => {\n if($newClassLevel) return false;\n if($characterClass && !$newClassLevel) return true;\n});\n\n// Function to reset all stores\nexport function resetStores() {\n race.set(false);\n subRace.set(false);\n characterClass.set(false);\n characterSubClass.set(false);\n background.set(false);\n abilities.set(false);\n isLevelUp.set(false);\n pointBuy.set(false);\n isStandardArrayValues.set(false);\n abilityRolls.set({});\n newClassLevel.set(false);\n spells.set(false);\n level.set(1);\n activeTab.set('');\n activeClass.set(false);\n tabs.set(initialTabs);\n levelUpTabs.set(upTabs)\n dropItemRegistry.removeAll();\n isActorCreated.set(false);\n actorInGame.set(false);\n abilityGenerationMethod.set(null);\n subClassesForClass.set([]);\n\n}","export default function preventDefault(event) {\n event.preventDefault();\n return;\n}","import { tick } from 'svelte';\nimport { subscribeFirstRest } from '@typhonjs-fvtt/runtime/util/store';\nimport { Timing } from '@typhonjs-fvtt/runtime/util';\nimport { isObject } from '@typhonjs-fvtt/runtime/util/object';\n\n/**\n * Defines an `Element.animate` animation from provided keyframes and options.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.duration=600] - Duration in milliseconds.\n *\n * @param {Array|object} opts.keyframes - An array of keyframe objects or a keyframe object whose properties are\n * arrays of values to iterate over.\n *\n * @param {object} [opts.options] - An object containing one or more timing properties. When defined it is used\n * instead of duration.\n *\n * @param {string} [opts.event='click'] - DOM event to bind element to respond with the ripple effect.\n *\n * @param {number} [opts.debounce=undefined] - Add a debounce to incoming events in milliseconds.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/animate\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Keyframe_Formats\n *\n * @returns {import('svelte/action').Action} Actual action.\n */\nfunction animate({ duration = 600, keyframes = [], options, event = 'click', debounce } = {})\n{\n return (element) =>\n {\n /**\n * Creates WAAPI animation.\n */\n function createAnimation()\n {\n element.animate(keyframes, isObject(options) ? options : duration);\n }\n\n const eventFn = Number.isInteger(debounce) && debounce > 0 ? Timing.debounce(createAnimation, debounce) :\n createAnimation;\n\n element.addEventListener(event, eventFn);\n\n return {\n destroy: () => element.removeEventListener(event, eventFn)\n };\n };\n}\n\n/**\n * Combines multiple composable actions.\n *\n * Note: The update function passes the same variable to all update functions of each action.\n *\n * @param {...import('svelte/action').Action} actions - One or more composable action functions to combine.\n *\n * @returns {import('svelte/action').Action} Composed action.\n */\nfunction composable(...actions)\n{\n return (element, options) =>\n {\n let lifecycle = actions.map((action) => action(element, options));\n\n return {\n destroy: () =>\n {\n for (const action of lifecycle)\n {\n if (typeof action.destroy === 'function') { action.destroy(); }\n }\n\n lifecycle = void 0;\n },\n update: (parameters) =>\n {\n for (const action of lifecycle)\n {\n if (typeof action.update === 'function') { action.update(parameters); }\n }\n }\n };\n };\n}\n\n/**\n * Defines the classic Material Design ripple effect as an action. `ripple` is a wrapper around the returned action.\n * This allows it to be easily used as a prop.\n *\n * Note: A negative one translateZ transform is applied to the added spans allowing other content to be layered on top\n * with a positive translateZ.\n *\n * Styling: There is a single CSS variable `--tjs-action-ripple-background` that can be set to control the background.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.duration=600] - Duration in milliseconds.\n *\n * @param {string} [opts.background='rgba(255, 255, 255, 0.7)'] - A valid CSS background attribute.\n *\n * @param {Iterable} [opts.events=['click', 'keyup']] - DOM event to bind element to respond with the ripple\n * effect.\n *\n * @param {string} [opts.keyCode='Enter'] - Key code to trigger for any applicable key events.\n *\n * @param {number} [opts.debounce=undefined] - Add a debounce to incoming events in milliseconds.\n *\n * @returns {import('svelte/action').Action} Actual action.\n */\nfunction ripple({ duration = 600, background = 'rgba(255, 255, 255, 0.7)', events = ['click', 'keyup'],\n keyCode = 'Enter', debounce } = {})\n{\n return (element) =>\n {\n /**\n * Creates the ripple effect.\n *\n * @param {MouseEvent|KeyboardEvent} e -\n */\n function createRipple(e)\n {\n const elementRect = element.getBoundingClientRect();\n\n const diameter = Math.max(elementRect.width, elementRect.height);\n const radius = diameter / 2;\n\n // Find the adjusted click location relative to center or if no `clientX/Y` parameters choose center.\n const left = e.clientX ? `${e.clientX - (elementRect.left + radius)}px` : '0';\n const top = e.clientY ? `${e.clientY - (elementRect.top + radius)}px` : '0';\n\n const span = document.createElement('span');\n\n span.style.position = 'absolute';\n span.style.width = `${diameter}px`;\n span.style.height = `${diameter}px`;\n span.style.left = left;\n span.style.top = top;\n\n span.style.background = `var(--tjs-action-ripple-background, ${background})`;\n span.style.borderRadius = '50%';\n span.style.pointerEvents = 'none';\n span.style.transform = 'translateZ(-1px)';\n\n element.prepend(span);\n\n const animation = span.animate([\n { // from\n transform: 'scale(.7)',\n opacity: 0.5,\n filter: 'blur(2px)'\n },\n { // to\n transform: 'scale(4)',\n opacity: 0,\n filter: 'blur(5px)'\n }\n ],\n duration);\n\n animation.onfinish = () =>\n {\n if (span && span.isConnected) { span.remove(); }\n };\n }\n\n /**\n * Handles any key event and only triggers the ripple effect if key code matches.\n *\n * @param {KeyboardEvent} event -\n */\n function keyHandler(event)\n {\n if (event?.code === keyCode) { createRipple(event); }\n }\n\n const eventFn = Number.isInteger(debounce) && debounce > 0 ? Timing.debounce(createRipple, debounce) :\n createRipple;\n\n const keyEventFn = Number.isInteger(debounce) && debounce > 0 ? Timing.debounce(keyHandler, debounce) :\n keyHandler;\n\n for (const event of events)\n {\n if (['keydown', 'keyup'].includes(event))\n {\n element.addEventListener(event, keyEventFn);\n }\n else\n {\n element.addEventListener(event, eventFn);\n }\n }\n\n return {\n destroy: () =>\n {\n for (const event of events)\n {\n if (['keydown', 'keyup'].includes(event))\n {\n element.removeEventListener(event, keyEventFn);\n }\n else\n {\n element.removeEventListener(event, eventFn);\n }\n }\n }\n };\n };\n}\n\n/**\n * Defines the classic Material Design ripple effect as an action that is attached to an elements focus and blur events.\n * `rippleFocus` is a wrapper around the returned action. This allows it to be easily used as a prop.\n *\n * Note: A negative one translateZ transform is applied to the added span allowing other content to be layered on top\n * with a positive translateZ.\n *\n * If providing the `selectors` option a target child element will be registered for the focus events otherwise the\n * first child is targeted with a final fallback of the element assigned to this action.\n *\n * Styling: There is a single CSS variable `--tjs-action-ripple-background-focus` that can be set to control the\n * background with a fallback to `--tjs-action-ripple-background`.\n *\n * @param {object} [opts] - Optional parameters.\n *\n * @param {number} [opts.duration=600] - Duration in milliseconds.\n *\n * @param {string} [opts.background='rgba(255, 255, 255, 0.7)'] - A valid CSS background attribute.\n *\n * @param {string} [opts.selectors] - A valid CSS selectors string.\n *\n * @returns {import('svelte/action').Action} Actual action.\n */\nfunction rippleFocus({ duration = 300, background = 'rgba(255, 255, 255, 0.7)', selectors } = {})\n{\n return (element) =>\n {\n const targetEl = typeof selectors === 'string' ? element.querySelector(selectors) :\n element.firstChild instanceof HTMLElement ? element.firstChild : element;\n\n let span = void 0;\n let clientX = -1;\n let clientY = -1;\n\n /**\n * WAAPI ripple animation on blur.\n */\n function blurRipple()\n {\n // When clicking outside the browser window or to another tab `document.activeElement` remains\n // the same despite blur being invoked; IE the target element.\n if (!(span instanceof HTMLElement) || document.activeElement === targetEl)\n {\n return;\n }\n\n const animation = span.animate(\n [\n { // from\n transform: 'scale(3)',\n opacity: 0.3,\n },\n { // to\n transform: 'scale(.7)',\n opacity: 0.0,\n }\n ],\n {\n duration,\n fill: 'forwards'\n });\n\n animation.onfinish = () =>\n {\n clientX = clientY = -1;\n if (span && span.isConnected) { span.remove(); }\n span = void 0;\n };\n }\n\n /**\n * WAAPI ripple animation on focus.\n */\n function focusRipple()\n {\n // If already focused and the span exists do not create another ripple effect.\n if (span instanceof HTMLElement) { return; }\n\n const elementRect = element.getBoundingClientRect();\n\n // The order of events don't always occur with a pointer event first. In this case use the center of the\n // element as the click point. Mostly this is seen when the focused target element has a followup event off\n // the app / screen. If the next pointer down occurs on the target element the focus callback occurs before\n // pointer down in Chrome and Firefox.\n const actualX = clientX >= 0 ? clientX : elementRect.left + (elementRect.width / 2);\n const actualY = clientX >= 0 ? clientY : elementRect.top + (elementRect.height / 2);\n\n const diameter = Math.max(elementRect.width, elementRect.height);\n const radius = diameter / 2;\n const left = `${actualX - (elementRect.left + radius)}px`;\n const top = `${actualY - (elementRect.top + radius)}px`;\n\n span = document.createElement('span');\n\n span.style.position = 'absolute';\n span.style.width = `${diameter}px`;\n span.style.height = `${diameter}px`;\n span.style.left = left;\n span.style.top = top;\n\n span.style.background =\n `var(--tjs-action-ripple-background-focus, var(--tjs-action-ripple-background, ${background}))`;\n\n span.style.borderRadius = '50%';\n span.style.pointerEvents = 'none';\n span.style.transform = 'translateZ(-1px)';\n\n element.prepend(span);\n\n span.animate([\n { // from\n transform: 'scale(.7)',\n opacity: 0.5,\n },\n { // to\n transform: 'scale(3)',\n opacity: 0.3,\n }\n ],\n {\n duration,\n fill: 'forwards'\n });\n }\n\n /**\n * Store the pointer down location for the origination of the ripple.\n *\n * @param {PointerEvent} e - A PointerEvent.\n */\n function onPointerDown(e)\n {\n clientX = e.clientX;\n clientY = e.clientY;\n }\n\n targetEl.addEventListener('pointerdown', onPointerDown);\n targetEl.addEventListener('blur', blurRipple);\n targetEl.addEventListener('focus', focusRipple);\n\n return {\n destroy: () =>\n {\n targetEl.removeEventListener('pointerdown', onPointerDown);\n targetEl.removeEventListener('blur', blurRipple);\n targetEl.removeEventListener('focus', focusRipple);\n }\n };\n };\n}\n\n/**\n * Provides a toggle action for `details` HTML elements. The boolean store provided controls animation.\n *\n * It is not necessary to bind the store to the `open` attribute of the associated details element.\n *\n * When the action is triggered to close the details element a data attribute `closing` is set to `true`. This allows\n * any associated closing transitions to start immediately.\n *\n * @param {HTMLDetailsElement} details - The details element.\n *\n * @param {object} opts - Options parameters.\n *\n * @param {import('svelte/store').Writable} opts.store - A boolean store.\n *\n * @param {boolean} [opts.clickActive] - When false click events are not handled.\n *\n * @returns {import('svelte/action').ActionReturn} Lifecycle functions.\n */\nfunction toggleDetails(details, { store, clickActive = true } = {})\n{\n /** @type {HTMLElement} */\n const summary = details.querySelector('summary');\n\n /** @type {Animation} */\n let animation;\n\n /** @type {boolean} */\n let open = details.open; // eslint-disable-line no-shadow\n\n // The store sets initial open state and handles animation on further changes.\n const unsubscribe = subscribeFirstRest(store, (value) => { open = value; details.open = open; }, async (value) =>\n {\n open = value;\n\n // Await `tick` to allow any conditional logic in the template to complete updating before handling animation.\n await tick();\n\n handleAnimation();\n });\n\n /**\n * @param {number} a -\n *\n * @param {number} b -\n *\n * @param {boolean} value -\n */\n function animate(a, b, value)\n {\n details.style.overflow = 'hidden';\n\n // Must guard when `b - a === 0`; add a small epsilon and wrap with Math.max.\n const duration = Math.max(0, 30 * Math.log(Math.abs(b - a) + Number.EPSILON));\n\n animation = details.animate(\n {\n height: [`${a}px`, `${b}px`]\n },\n {\n duration,\n easing: 'ease-out'\n }\n );\n\n animation.onfinish = () =>\n {\n details.open = value;\n details.dataset.closing = 'false';\n details.style.overflow = '';\n };\n }\n\n /**\n * Handles animation coordination based on current state.\n */\n function handleAnimation()\n {\n if (open)\n {\n const a = details.offsetHeight;\n if (animation) { animation.cancel(); }\n details.open = true;\n const b = details.offsetHeight;\n\n animate(a, b, true);\n }\n else\n {\n const a = details.offsetHeight;\n const b = summary.offsetHeight;\n\n details.dataset.closing = 'true';\n\n animate(a, b, false);\n }\n }\n\n /**\n * @param {MouseEvent} e - A mouse event.\n */\n function handleClick(e)\n {\n if (clickActive)\n {\n e.preventDefault();\n\n // Simply set the store to the opposite of current open state and the callback above handles animation.\n store.set(!open);\n }\n }\n\n summary.addEventListener('click', handleClick);\n\n return {\n destroy()\n {\n unsubscribe();\n summary.removeEventListener('click', handleClick);\n }\n };\n}\n\nexport { animate, composable, ripple, rippleFocus, toggleDetails };\n//# sourceMappingURL=index.js.map\n","\n\n\n
\n \n
\n \n {#each tabs as tab, idx}\n {\n activeTab = tab.id;\n }}\n on:mousedown={preventDefault}\n use:efx\n >\n {tab.label}\n \n {/each}\n
\n\n \n
\n {#each tabs as tab}\n {#if tab.id === activeTab && tabComponents[tab.component]}\n \n {/if}\n {/each}\n
\n
\n\n\n","\n
\n
{$progress}% Complete
\n
{$progress}% Complete
\n
\n","\n\n\n\n\n","\n\n\n\n\n\n\n\n\n\n\n\n","import PCAppShell from './PCAppShell.svelte';\nimport { SvelteApplication } from \"@typhonjs-fvtt/runtime/svelte/application\";\nimport { TJSDocument } from \"@typhonjs-fvtt/runtime/svelte/store/fvtt/document\";\nimport { MODULE_ID, MODULE_CODE } from \"~/src/helpers/constants\"\n\nexport default class PCApplication extends SvelteApplication {\n /**\n * Document store that monitors updates to any assigned document.\n *\n * @type {TJSDocument}\n */\n #documentStore = new TJSDocument(void 0, { delete: this.close.bind(this) });\n\n /**\n * Holds the document unsubscription function.\n *\n * @type {Function}\n */\n #storeUnsubscribe;\n\n constructor(object, levelUp = false) {\n super(object);\n\n // Define document store property\n Object.defineProperty(this.reactive, \"document\", {\n get: () => this.#documentStore.get(),\n set: (document) => {\n this.#documentStore.set(document);\n },\n });\n this.reactive.document = object;\n this.levelUp = levelUp\n }\n\n\n\n /**\n * Default Application options\n *\n * @returns {object} options - Application options.\n * @see https://foundryvtt.com/api/Application.html#options\n */\n static get defaultOptions() {\n const title = this.title;\n return foundry.utils.mergeObject(super.defaultOptions, {\n id: 'foundryvtt-actor-studio-pc-sheet',\n title: game.i18n.localize('GAS.ActorStudio') + ' - ' + game.i18n.localize('GAS.PCTitle'),\n classes: [MODULE_CODE],\n width: game.settings.get(MODULE_ID, 'windowX') || 700,\n height: game.settings.get(MODULE_ID, 'windowX') || 800,\n headerIcon: 'modules/foundryvtt-actor-studio/assets/actor-studio-logo-dragon-white.svg',\n minWidth: 500,\n padding: 0,\n resizable: true,\n focusAuto: false,\n minimizable: true,\n svelte: {\n class: PCAppShell,\n target: document.body,\n props: function () {\n return { documentStore: this.#documentStore, document: this.reactive.document, levelUp: this.levelUp };\n },\n },\n });\n }\n\n /**\n * Drag&Drop handling\n */\n _canDragStart(selector) {\n return true;\n }\n _canDragDrop(selector) {\n return this.reactive.document.isOwner || game.user.isGM;\n }\n _onDragOver(event) { }\n\n _onDragStart(event) {\n\n }\n\n async _onDrop(event) {\n\n }\n\n async close(options = {}) {\n await super.close(options);\n\n if (this.#storeUnsubscribe) {\n this.#storeUnsubscribe();\n this.#storeUnsubscribe = void 0;\n }\n }\n\n /**\n * Handles any changes to document.\n *\n * @param {foundry.abstract.Document} doc -\n *\n * @param {object} options -\n */\n async #handleDocUpdate(doc, options) {\n const { action, data, documentType } = options;\n if ((action === void 0 || action === \"update\" || action === \"subscribe\") && doc) {\n const tokenText = doc.flags?.[MODULE_ID]?.tokenName ? ` (${doc.flags[MODULE_ID].tokenName})` : \"\";\n this.reactive.title = `${game.i18n.localize('GAS.ActorStudio') + ' - ' + game.i18n.localize('GAS.PCTitle')} - ${doc.name} ${tokenText}`;\n }\n }\n\n render(force = false, options = {}) {\n if (!this.#storeUnsubscribe) {\n this.#storeUnsubscribe = this.#documentStore.subscribe(this.#handleDocUpdate.bind(this));\n }\n super.render(force, options);\n return this;\n }\n\n}","import { MODULE_ID } from '~/src/helpers/constants';\nimport PCApplication from '~/src/app/PCApplication.js';\n\nconst pulseKeyframes = `\n@keyframes pulse {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n}\n`;\n\nexport function registerSettings() {\n game.settings.register(MODULE_ID, 'enableLevelUp', {\n name: game.i18n.localize('GAS.Setting.EnableLevelUp.Name'),\n hint: game.i18n.localize('GAS.Setting.EnableLevelUp.Hint'),\n scope: 'world',\n config: true,\n default: true,\n type: Boolean,\n });\n}\n\nexport function dnd5eSheet2UI(app, html, data) {\n\n const actor = data.actor;\n // game.system.log.d(actor);\n\n const sheetheader = html.find('.sheet-header');\n const buttons = sheetheader.find('.sheet-header-buttons')\n\n if (!game.settings.get(MODULE_ID, 'milestoneLeveling') && (actor.system.details.xp.max - actor.system.details.xp.value > 0)) return;\n\n buttons.css('gap', '0.35rem');\n const levelUpButton = $(`\n \n `);\n\n levelUpButton.on('click', async (event) => {\n //- render the level up UI\n new PCApplication(app.actor, true).render(true, { focus: true });\n })\n \n\n $('\r\n","\r\n\r\n\r\n
\r\n \r\n \r\n \r\n \r\n \r\n\r\n {#if localOptions.focusIndicator}\r\n
\r\n {/if}\r\n\r\n \r\n {#if isSvelteComponent(folder?.slotLabel?.class)}\r\n \r\n {:else}\r\n
{localize(label)}
\r\n {/if}\r\n
\r\n\r\n \r\n {#if isSvelteComponent(folder?.slotSummaryEnd?.class)}\r\n \r\n {/if}\r\n \r\n
\r\n\r\n
\r\n {#if visible}\r\n \r\n {#if isSvelteComponent(folder?.slotDefault?.class)}\r\n \r\n {/if}\r\n \r\n {/if}\r\n
\r\n
\r\n\r\n\r\n","\r\n\r\n
\r\n \r\n
\r\n\r\n\r\n","\r\n\r\n
\r\n \r\n
\r\n\r\n\r\n","\r\n\r\n\r\n","// Protect for absent global `ProseMirror` on Foundry v9.\r\nconst ProseMirrorKeyMaps = globalThis.ProseMirror ? globalThis.ProseMirror.ProseMirrorKeyMaps : class {};\r\n\r\n/**\r\n * Provides an additional key mapping to `Escape` to destroy / cancel the active editor.\r\n */\r\nclass TJSKeyMaps extends ProseMirrorKeyMaps\r\n{\r\n /** @type {Function} */\r\n #onQuit;\r\n\r\n /**\r\n * @param {globalThis.Schema} schema - The ProseMirror schema to build keymaps for.\r\n *\r\n * @param {object} [options] - Additional options to configure the plugin's behaviour.\r\n *\r\n * @param {Function} [options.onSave] - A function to call when Ctrl+S is pressed.\r\n *\r\n * @param {Function} [options.onQuit] - A function to call when Ctrl+Q is pressed.\r\n */\r\n constructor(schema, options)\r\n {\r\n super(schema, options);\r\n\r\n if (typeof options.onQuit === 'function') { this.#onQuit = options.onQuit; }\r\n }\r\n\r\n // eslint-disable-next jsdoc/check-types\r\n /**\r\n * Swaps the Foundry default `Escape` / selectParentNode to `Mod-p` and enables `onQuit` function for `Escape`.\r\n *\r\n * @returns { {[key: string]: globalThis.ProseMirrorCommand} } ProseMirror keymap data.\r\n */\r\n buildMapping()\r\n {\r\n const mapping = super.buildMapping();\r\n\r\n // Add onQuit callback if defined.\r\n if (this.#onQuit)\r\n {\r\n // Swap Foundry core mapping for `Escape` / selectParentNode to `Mod-p`.\r\n if (mapping['Escape']) { mapping['Mod-p'] = mapping['Escape']; }\r\n\r\n mapping['Escape'] = () => this.#onQuit();\r\n }\r\n\r\n return mapping;\r\n }\r\n}\n\n// Protect for absent global `ProseMirror` on Foundry v9.\r\nconst Plugin = globalThis.ProseMirror ? globalThis.ProseMirror.Plugin : class {};\r\n\r\n/**\r\n * A ProseMirror plugin to transform pasted text that is a raw document UUID into a document link suitable for\r\n * `TextEditor.enrichHTML`.\r\n */\r\nclass TJSPasteUUID\r\n{\r\n /**\r\n * Defines a regex to check for the shape of a raw Foundry document UUID.\r\n *\r\n * @type {RegExp}\r\n */\r\n static #s_UUID_REGEX = /(\\.).*([a-zA-Z0-9]{16})/;\r\n\r\n /**\r\n * @returns {Plugin} PM Plugin.\r\n */\r\n static build()\r\n {\r\n const instance = new this();\r\n return new Plugin({\r\n // key: new PluginKey('tjsPasteRawUUID'), // TODO: Add back when exported by Foundry / ProseMirror bundle.\r\n props: {\r\n transformPastedText: (text) => instance.#transformUUID(text)\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Transforms pasted text. Check if pasted test matches the shape of a raw UUID. If so do a lookup and if a\r\n * document is retrieved transform it to a document link.\r\n *\r\n * @param {string} text - pasted text to transform.\r\n *\r\n * @returns {string} Potentially transformed pasted text.\r\n */\r\n #transformUUID(text)\r\n {\r\n if (typeof text === 'string')\r\n {\r\n if (TJSPasteUUID.#s_UUID_REGEX.test(text))\r\n {\r\n const uuidDoc = globalThis.fromUuidSync(text);\r\n if (uuidDoc)\r\n {\r\n text = `@UUID[${text}]{${typeof uuidDoc.name === 'string' ? uuidDoc.name : 'Unknown'}}`;\r\n }\r\n }\r\n }\r\n\r\n return text;\r\n }\r\n}\n\nexport { TJSKeyMaps, TJSPasteUUID };\n//# sourceMappingURL=index.js.map\n","\r\n\r\n
\r\n \r\n \r\n
\r\n\r\n\r\n","\r\n\r\n
\r\n \r\n
\r\n {#if setting.componentType === 'checkbox'}\r\n \r\n {:else if setting.componentType === 'number'}\r\n \r\n {:else if setting.componentType === 'range'}\r\n \r\n {$store}\r\n {:else if setting.componentType === 'select'}\r\n \r\n {:else if setting.componentType === 'text'}\r\n \r\n {/if}\r\n {#if setting.filePicker}\r\n \r\n {/if}\r\n
\r\n {#if setting.hint}\r\n

{setting.hint}

\r\n {/if}\r\n
\r\n\r\n\r\n","\r\n\r\n
\r\n \r\n
\r\n {#if uiSettings.topLevel.length}\r\n
\r\n {#each uiSettings.topLevel as setting (setting.key)}\r\n \r\n {/each}\r\n
\r\n {/if}\r\n {#each uiSettings.folders as folder}\r\n
\r\n \r\n {#each folder.settings as setting (setting.key)}\r\n \r\n {/each}\r\n \r\n
\r\n {/each}\r\n {#each uiSettings.sections as section}\r\n
\r\n {#if section.folder}\r\n \r\n \r\n\r\n \r\n {#if isSvelteComponent(section?.folder?.summaryEnd?.class)}\r\n \r\n {/if}\r\n \r\n \r\n {:else}\r\n \r\n {/if}\r\n
\r\n {/each}\r\n
\r\n \r\n
\r\n\r\n\r\n","import { SvelteApplication } from '@typhonjs-fvtt/runtime/svelte/application';\r\nimport { isObject } from '@typhonjs-fvtt/runtime/util/object';\r\n\r\nimport { FoundryStyles } from '@typhonjs-fvtt/svelte-standard/fvtt';\r\n\r\nimport { cssVariables } from '../internal/index.js'; // TODO: Figure out better build to use #internal again.\r\n\r\nexport * from './button/index.js';\r\nexport * from './color/index.js';\r\nexport * from './container/index.js';\r\nexport * from './editor/index.js';\r\nexport * from './folder/index.js';\r\nexport * from './form/index.js';\r\nexport * from './label/index.js';\r\nexport * from './layers/index.js';\r\nexport * from './menu/index.js';\r\nexport * from './settings/index.js';\r\n\r\n// -------------------------------------------------------------------------------------------------------------------\r\n\r\n/**\r\n * Assign all TyphonJS thematic CSS variables.\r\n */\r\n\r\ncssVariables.setProperties({\r\n // For components w/ transparent background checkered pattern.\r\n '--tjs-checkerboard-background-dark': 'rgb(205, 205, 205)',\r\n '--tjs-checkerboard-background-10': `url('data:image/svg+xml;utf8,') 0 0 / 10px 10px, var(--tjs-checkerboard-background-dark, rgb(205, 205, 205))`\r\n}, false);\r\n\r\n// -------------------------------------------------------------------------------------------------------------------\r\n\r\n/**\r\n * Assign all TyphonJS CSS variables to Foundry defaults.\r\n */\r\n\r\ncssVariables.setProperties({\r\n '--tjs-action-ripple-background': 'rgba(0, 0, 0, 0.35)'\r\n}, false);\r\n\r\n// -------------------------------------------------------------------------------------------------------------------\r\n\r\ncssVariables.setProperties({\r\n '--tjs-icon-button-background-hover': 'rgba(0, 0, 0, 0.10)',\r\n '--tjs-icon-button-background-selected': 'rgba(0, 0, 0, 0.20)',\r\n}, false);\r\n\r\n{\r\n /**\r\n * All input related components including: TJSSelect,\r\n */\r\n const props = FoundryStyles.getProperties('input[type=\"text\"], input[type=\"number\"]');\r\n\r\n if (isObject(props))\r\n {\r\n cssVariables.setProperties({\r\n '--tjs-input-background': 'background' in props ? props.background : 'rgba(0, 0, 0, 0.05)',\r\n '--tjs-input-border': 'border' in props ? props.border : '1px solid var(--color-border-light-tertiary)',\r\n '--tjs-input-border-radius': 'border-radius' in props ? props['border-radius'] : '3px',\r\n '--tjs-input-height': 'height' in props ? props.height : 'var(--form-field-height)',\r\n '--tjs-input-min-width': 'min-width' in props ? props['min-width'] : '20px',\r\n '--tjs-input-padding': 'padding' in props ? props['padding'] : '1px 3px',\r\n '--tjs-input-width': 'width' in props ? props.width : 'calc(100% - 2px)',\r\n\r\n // Set default values that are only to be referenced and not set.\r\n '--_tjs-default-input-height': 'height' in props ? props.height : 'var(--form-field-height)',\r\n\r\n // Set directly / no lookup:\r\n '--tjs-input-border-color': 'var(--color-border-light-tertiary)',\r\n }, false);\r\n }\r\n}\r\n\r\ncssVariables.setProperties({\r\n // `popup` is for components that are slightly elevated, but connected to an application;\r\n // see: TJSMenu / TJSContextMenu / TJSColordPicker\r\n '--tjs-default-popup-background': 'var(--color-text-dark-header, #23221d)',\r\n '--tjs-default-popup-border': '1px solid var(--color-border-dark, #000)',\r\n '--tjs-default-popup-box-shadow': '0 0 2px var(--color-shadow-dark, #000)',\r\n '--tjs-default-popup-primary-color': 'var(--color-text-light-primary, #b5b3a4)',\r\n '--tjs-default-popup-highlight-color': 'var(--color-text-light-highlight, #f0f0e0)',\r\n\r\n // `popover` is for components that are elevated and independent; see: TJSContextMenu\r\n '--tjs-default-popover-border': '1px solid var(--color-border-dark, #000)',\r\n '--tjs-default-popover-box-shadow': '0 0 10px var(--color-shadow-dark, #000)',\r\n}, false);\r\n\r\n// Handle `PopOut!` module hooks to allow applications to popout to their own browser window -------------------------\r\n\r\nHooks.on('PopOut:loading', (app, popout) =>\r\n{\r\n if (app instanceof SvelteApplication)\r\n {\r\n // Clone and load `svelte-standard` CSS variables into new window document.\r\n popout.document.addEventListener('DOMContentLoaded', () => cssVariables.clone(popout.document));\r\n }\r\n});\r\n","import { writable } from 'svelte/store';\nimport { isObject, isIterable } from '@typhonjs-fvtt/runtime/util/object';\nimport { isWritableStore, subscribeIgnoreFirst } from '@typhonjs-fvtt/runtime/util/store';\nimport { ripple, rippleFocus } from '@typhonjs-fvtt/runtime/svelte/action/animate';\nimport { isSvelteComponent } from '@typhonjs-fvtt/runtime/svelte/util';\nimport { TJSDialog } from '@typhonjs-fvtt/runtime/svelte/application';\nimport { localize } from '@typhonjs-fvtt/runtime/svelte/helper';\n\n/**\n * Controls preparation and processing of registered game settings w/ TJSGameSettings. Game settings are parsed\n * for UI display by TJSSettingsEdit. The store `showSettings` is utilized in TJSSettingsSwap component to provide\n * an easy way to flip between settings component or any main slotted component.\n */\nclass UIControl\n{\n /** @type {import('./types').TJSSettingsCustomSection[]} */\n #sections = [];\n\n /** @type {import('./').TJSGameSettings} */\n #settings;\n\n /** @type {boolean} */\n #showSettings = false;\n\n /** @type {Function} */\n #showSettingsSet;\n\n /** @type {{showSettings: import('svelte/store').Readable}} */\n #stores;\n\n /**\n * @param {import('./').TJSGameSettings} settings -\n */\n constructor(settings)\n {\n this.#settings = settings;\n\n const showSettings = writable(this.#showSettings);\n this.#showSettingsSet = showSettings.set;\n\n this.#stores = {\n showSettings: { subscribe: showSettings.subscribe }\n };\n\n Object.freeze(this.#stores);\n }\n\n /**\n * @returns {boolean} Current `showSettings` state.\n */\n get showSettings()\n {\n return this.#showSettings;\n }\n\n /**\n * @returns {{ showSettings: import('svelte/store').Readable }} Returns the managed stores.\n */\n get stores()\n {\n return this.#stores;\n }\n\n /**\n * Sets current `showSettings` state.\n *\n * @param {boolean} showSettings - New `showSettings` state.\n */\n set showSettings(showSettings)\n {\n this.#showSettings = showSettings;\n this.#showSettingsSet(this.#showSettings);\n }\n\n /**\n * Adds a custom section / folder defined by the provided TJSSettingsCustomSection options object.\n *\n * @param {import('./types').TJSSettingsCustomSection} options - The configuration object for the custom section.\n */\n addSection(options)\n {\n if (!isObject(options)) { throw new TypeError(`'options' is not an object.`); }\n\n if (!isSvelteComponent(options.class)) { throw new TypeError(`'options.class' is not a Svelte component.`); }\n\n if (options.props !== void 0 && !isObject(options.props))\n {\n throw new TypeError(`'options.props' is not an object.`);\n }\n\n if (options.folder !== void 0)\n {\n const folder = options.folder;\n\n if (typeof folder !== 'string' && !isObject(folder))\n {\n throw new TypeError(`'options.folder' is not a string or object.`);\n }\n\n if (isObject(folder))\n {\n if (typeof folder.label !== 'string') { throw new TypeError(`'options.folder.label' is not a string.`); }\n\n // Validate custom component set as folder summary end.\n if (folder.summaryEnd !== void 0)\n {\n if (!isObject(folder.summaryEnd))\n {\n throw new TypeError(`'options.folder.summaryEnd' is not an object.`);\n }\n\n if (!isSvelteComponent(folder.summaryEnd.class))\n {\n throw new TypeError(`'options.folder.summaryEnd.class' is not a Svelte component.`);\n }\n\n if (folder.summaryEnd.props !== void 0 && !isObject(folder.summaryEnd.props))\n {\n throw new TypeError(`'options.folder.summaryEnd.props' is not an object.`);\n }\n }\n\n // Validate that folder inline styles is an object.\n if (folder.styles !== void 0 && !isObject(folder.styles))\n {\n throw new TypeError(`'options.folder.styles' is not an object.`);\n }\n }\n }\n\n // Validate that section inline styles is an object.\n if (options.styles !== void 0 && !isObject(options.styles))\n {\n throw new TypeError(`'options.styles' is not an object.`);\n }\n\n this.#sections.push(options);\n }\n\n /**\n * Creates the UISettingsData object by parsing stored settings in\n *\n * @param {import('./types').TJSSettingsCreateOptions} [options] - Optional parameters.\n *\n * @returns {import('./types').TJSSettingsUIData} Parsed UI settings data.\n */\n create(options)\n {\n const settings = this.#parseSettings(options);\n const destroy = () => this.#destroy(settings);\n\n return {\n ...settings,\n destroy\n };\n }\n\n /**\n * Destroy callback. Checks for any `requiresReload` parameter in each setting comparing against initial value\n * when `settings` is created and current value. If there is a difference then show a modal dialog asking the user\n * if they want to reload for those settings to take effect.\n *\n * @param {import('./types').TJSSettingsUIData} settings - The UI data object initiated w/ `create`.\n */\n #destroy(settings)\n {\n let requiresClientReload = false;\n let requiresWorldReload = false;\n\n if (Array.isArray(settings.topLevel))\n {\n for (const setting of settings.topLevel)\n {\n const current = globalThis.game.settings.get(setting.namespace, setting.key);\n if (current === setting.initialValue) { continue; }\n\n requiresClientReload ||= (setting.scope === 'client') && setting.requiresReload;\n requiresWorldReload ||= (setting.scope === 'world') && setting.requiresReload;\n }\n }\n\n if (Array.isArray(settings.folders))\n {\n for (const folder of settings.folders)\n {\n if (Array.isArray(folder.settings))\n {\n for (const setting of folder.settings)\n {\n const current = globalThis.game.settings.get(setting.namespace, setting.key);\n if (current === setting.initialValue) { continue; }\n\n requiresClientReload ||= (setting.scope === 'client') && setting.requiresReload;\n requiresWorldReload ||= (setting.scope === 'world') && setting.requiresReload;\n }\n }\n }\n }\n\n if (requiresClientReload || requiresWorldReload) { this.#reloadConfirm({ world: requiresWorldReload }); }\n\n this.#showSettings = false;\n this.#showSettingsSet(this.#showSettings);\n }\n\n /**\n * @param {import('./types').TJSSettingsCreateOptions} [options] - Optional parameters.\n *\n * @returns {import('./types').TJSSettingsUIData} Parsed UI settings data.\n */\n #parseSettings({ efx = 'ripple', storage } = {})\n {\n const namespace = this.#settings.namespace;\n\n if (storage && typeof namespace !== 'string')\n {\n console.warn(\n `TJSGameSettings warning: 'options.storage' defined, but 'namespace' not defined in TJSGameSettings.`);\n }\n\n const hasStorage = storage && typeof namespace === 'string';\n\n const uiSettings = [];\n\n const canConfigure = globalThis.game.user.can('SETTINGS_MODIFY');\n\n for (const setting of this.#settings)\n {\n if (!setting.config || (!canConfigure && (setting.scope !== 'client'))) { continue; }\n\n let options;\n\n if (isObject(setting.choices))\n {\n options = Object.entries(setting.choices).map((entry) => ({ value: entry[0], label: localize(entry[1]) }));\n }\n\n let range;\n if (isObject(setting.range))\n {\n range = {};\n\n // TODO Better error messages.\n // Verify range data.\n if (typeof setting.range.min !== 'number') { throw new TypeError(`Setting 'range.min' is not a number.`); }\n if (typeof setting.range.max !== 'number') { throw new TypeError(`Setting 'range.max' is not a number.`); }\n if (setting.range.step !== void 0 && typeof setting.range.step !== 'number')\n {\n throw new TypeError(`Setting 'range.step' is not a number.`);\n }\n\n range.min = setting.range.min;\n range.max = setting.range.max;\n range.step = setting.range.step ? setting.range.step : 1;\n }\n\n // Default to `String` if no type is provided.\n const type = setting.type instanceof Function ? setting.type.name : 'String';\n\n // Only configure file picker if setting type is a string.\n let filePicker;\n if (type === 'String')\n {\n filePicker = setting.filePicker === true ? 'any' : setting.filePicker;\n }\n\n let buttonData;\n if (filePicker)\n {\n buttonData = {\n icon: 'fas fa-file-import fa-fw',\n efx: efx === 'ripple' ? ripple() : void 0,\n title: 'FILES.BrowseTooltip',\n styles: { 'margin-left': '0.25em' }\n };\n }\n\n const store = this.#settings.getStore(setting.key);\n\n let selectData;\n\n /** @type {string} */\n let componentType = 'text';\n\n if (setting.type === Boolean)\n {\n componentType = 'checkbox';\n }\n else if (options !== void 0)\n {\n componentType = 'select';\n\n selectData = {\n store,\n efx: efx === 'ripple' ? rippleFocus() : void 0,\n type: componentType,\n options\n };\n }\n else if (setting.type === Number)\n {\n componentType = isObject(setting.range) ? 'range' : 'number';\n }\n\n let inputData;\n if (componentType === 'text' || componentType === 'number')\n {\n inputData = {\n store,\n efx: efx === 'ripple' ? rippleFocus() : void 0,\n type: componentType\n };\n }\n\n uiSettings.push({\n id: `${setting.namespace}.${setting.key}`,\n namespace: setting.namespace,\n folder: setting.folder,\n key: setting.key,\n name: localize(setting.name),\n hint: localize(setting.hint),\n type,\n componentType,\n filePicker,\n range,\n store,\n initialValue: globalThis.game.settings.get(setting.namespace, setting.key),\n scope: setting.scope,\n requiresReload: typeof setting.requiresReload === 'boolean' ? setting.requiresReload : false,\n buttonData,\n inputData,\n selectData\n });\n }\n\n // If storage is available then create a key otherwise create a dummy store, so `applyScrolltop` works.\n const storeScrollbar = hasStorage ? storage.getStore(`${namespace}-settings-scrollbar`) : writable(0);\n\n const topLevel = [];\n\n const folderData = {};\n\n // Sort into folders\n for (const setting of uiSettings)\n {\n if (typeof setting.folder === 'string')\n {\n const folderName = localize(setting.folder);\n\n // Create folder array if one doesn't exist already.\n if (!Array.isArray(folderData[folderName])) { folderData[folderName] = []; }\n folderData[folderName].push(setting);\n }\n else // Add to 'toplevel' settings\n {\n topLevel.push(setting);\n }\n }\n\n // Convert folderData object to array.\n const folders = Object.entries(folderData).map((entry) =>\n {\n return {\n label: entry[0],\n store: hasStorage ? storage.getStore(`${namespace}-settings-folder-${entry[0]}`) : void 0,\n settings: entry[1],\n };\n });\n\n const sections = [];\n\n // Parse custom component sections\n for (const section of this.#sections)\n {\n const parsedSection = {\n class: section.class,\n props: section.props,\n styles: section.styles\n };\n\n if (typeof section.folder === 'string')\n {\n const label = localize(section.folder);\n\n parsedSection.folder = {\n label,\n store: hasStorage ? storage.getStore(`${namespace}-settings-folder-${label}`) : void 0\n };\n }\n else if (isObject(section.folder))\n {\n const label = localize(section.folder.label);\n\n parsedSection.folder = {\n label,\n store: hasStorage ? storage.getStore(`${namespace}-settings-folder-${label}`) : void 0,\n summaryEnd: section.folder.summaryEnd,\n styles: section.folder.styles\n };\n }\n\n sections.push(parsedSection);\n }\n\n return {\n storeScrollbar,\n topLevel,\n folders,\n sections\n };\n }\n\n async #reloadConfirm({ world = false } = {})\n {\n let title = localize('SETTINGS.ReloadPromptTitle');\n let label = localize('SETTINGS.ReloadPromptBody');\n\n // Foundry v9 doesn't have the reload lang keys, so substitute just for English translation.\n // TODO: FOUNDRY_V9 - remove when support for v9 is dropped.\n title = title !== 'SETTINGS.ReloadPromptTitle' ? title : 'Reload Application?';\n label = label !== 'SETTINGS.ReloadPromptBody' ? label :\n 'Some of the changed settings require a reload of the application to take effect. Would you like to reload now?';\n\n const reload = await TJSDialog.confirm({\n modal: true,\n draggable: false,\n title,\n content: `

${label}

`\n });\n\n if (!reload) { return; }\n\n // Reload all connected clients. Note: Foundry v9 might not support this event.\n if (world && globalThis.game.user.isGM) { globalThis.game.socket.emit('reload'); }\n\n // Reload locally.\n window.location.reload();\n }\n\n /**\n * Convenience method to swap `showSettings`.\n *\n * @returns {boolean} New `showSettings` state.\n */\n swapShowSettings()\n {\n this.#showSettings = !this.#showSettings;\n this.#showSettingsSet(this.#showSettings);\n return this.#showSettings;\n }\n}\n\n/**\n * Registers game settings and creates a backing Svelte store for each setting. The Svelte store will update the\n * Foundry game settings and vice versa when changes occur to the Foundry game settings the updated data is set to the\n * store.\n *\n * Note: It is possible to add multiple `onChange` callbacks on registration.\n *\n * TODO: A possible future extension is to offer type checking against the setting type by creating a customized\n * writable store that has an overloaded `set` method to provide type checking.\n */\nclass TJSGameSettings\n{\n /** @type {string} */\n #namespace;\n\n /** @type {GameSettingData[]} */\n #settings = [];\n\n /**\n * @type {Map}\n */\n #stores = new Map();\n\n /** @type {import('./types').UIControl} */\n #uiControl;\n\n /**\n * Creates the TJSGameSettings instance.\n *\n * @param {string} namespace - The namespace for all settings.\n */\n constructor(namespace)\n {\n if (typeof namespace !== 'string') { throw new TypeError(`'namespace' is not a string.`); }\n\n this.#namespace = namespace;\n this.#uiControl = new UIControl(this);\n }\n\n /**\n * Creates a new writable for the given key.\n *\n * @param {*} initialValue - An initial value to set to new stores.\n *\n * @returns {import('svelte/store').Writable} The new writable.\n */\n static #createStore(initialValue)\n {\n return writable(initialValue);\n }\n\n /**\n * Provides an iterator / generator to return stored settings data.\n *\n * @returns {IterableIterator} An iterator of all game setting data.\n * @yields {GameSettingData}\n */\n *[Symbol.iterator]()\n {\n for (const setting of this.#settings)\n {\n yield setting;\n }\n }\n\n /**\n * @returns {string} Returns namespace set in constructor.\n */\n get namespace()\n {\n return this.#namespace;\n }\n\n /**\n * @returns {import('./types').UIControl} The associated UIControl.\n */\n get uiControl()\n {\n return this.#uiControl;\n }\n\n /**\n * Gets a store from the `stores` Map or creates a new store for the key.\n *\n * @param {string} key - Key to lookup in stores map.\n *\n * @param {string} [initialValue] - An initial value to set to new stores.\n *\n * @returns {import('svelte/store').Writable} The store for the given key.\n */\n #getStore(key, initialValue)\n {\n let store = this.#stores.get(key);\n if (store === void 0)\n {\n store = TJSGameSettings.#createStore(initialValue);\n this.#stores.set(key, store);\n }\n\n return store;\n }\n\n /**\n * Returns a readable Game Settings store for the associated key.\n *\n * @param {string} key - Game setting key.\n *\n * @returns {import('svelte/store').Readable | undefined} The associated store for the given game setting key.\n */\n getReadableStore(key)\n {\n if (!this.#stores.has(key))\n {\n console.warn(`TJSGameSettings - getReadableStore: '${key}' is not a registered setting.`);\n return;\n }\n\n const store = this.#getStore(key);\n\n return { subscribe: store.subscribe };\n }\n\n /**\n * Returns a writable Game Settings store for the associated key.\n *\n * @param {string} key - Game setting key.\n *\n * @returns {import('svelte/store').Writable | undefined} The associated store for the given game setting key.\n */\n getStore(key)\n {\n return this.getWritableStore(key);\n }\n\n /**\n * Returns a writable Game Settings store for the associated key.\n *\n * @param {string} key - Game setting key.\n *\n * @returns {import('svelte/store').Writable | undefined} The associated store for the given game setting key.\n */\n getWritableStore(key)\n {\n if (!this.#stores.has(key))\n {\n console.warn(`TJSGameSettings - getWritableStore: '${key}' is not a registered setting.`);\n return;\n }\n\n return this.#getStore(key);\n }\n\n /**\n * Registers a setting with TJSGameSettings and Foundry core.\n *\n * Note: The specific store subscription handler assigned to the passed in store or store created for the setting\n * internally is returned from this function. In some cases when setting up custom stores particularly of object\n * types with several child property stores (`propertyStore`) it is necessary to only update the setting store and\n * not all subscribers to the custom store as the `propertyStore` instances are also subscribers to the custom store.\n *\n * This allows the custom store in the `set` implementation to mainly only trigger the TJSGameSettings subscriber\n * handler on updates and not all the connected `propertyStore` instances.\n *\n * @param {GameSetting} setting - A GameSetting instance to set to Foundry game settings.\n *\n * @param {boolean} coreConfig - When false this overrides the `setting.options.config` parameter when\n * registering the setting with Foundry. This allows the settings to be displayed\n * in the app itself, but removed from the standard Foundry configuration location.\n *\n * @returns {Function} The specific store subscription handler assigned to the passed in store.\n */\n register(setting, coreConfig = true)\n {\n if (!isObject(setting))\n {\n throw new TypeError(`TJSGameSettings - register: setting is not an object.`);\n }\n\n if (!isObject(setting.options))\n {\n throw new TypeError(`TJSGameSettings - register: 'setting.options' attribute is not an object.`);\n }\n\n if (typeof coreConfig !== 'boolean')\n {\n throw new TypeError(`TJSGameSettings - register: 'coreConfig' is not an boolean.`);\n }\n\n if (setting.store !== void 0 && !isWritableStore(setting.store))\n {\n throw new TypeError(\n `TJSGameSettings - register: 'setting.store' attribute is not a writable store.`);\n }\n\n const namespace = setting.namespace;\n const key = setting.key;\n const folder = setting.folder;\n\n // The `config` parameter passed to Foundry core.\n const foundryConfig = coreConfig ? setting.options.config : false;\n\n if (typeof namespace !== 'string')\n {\n throw new TypeError(`TJSGameSettings - register: 'namespace' attribute is not a string.`);\n }\n\n if (typeof key !== 'string')\n {\n throw new TypeError(`TJSGameSettings - register: 'key' attribute is not a string.`);\n }\n\n if (folder !== void 0 && typeof folder !== 'string')\n {\n throw new TypeError(`TJSGameSettings - register: 'folder' attribute is not a string.`);\n }\n\n const store = setting.store;\n\n /**\n * @type {GameSettingOptions}\n */\n const options = setting.options;\n\n const onchangeFunctions = [];\n\n // When true prevents local store subscription from a loop when values are object data.\n let gateSet = false;\n\n // Provides an `onChange` callback to update the associated store.\n onchangeFunctions.push((value) =>\n {\n const callbackStore = this.#getStore(key);\n if (callbackStore && !gateSet)\n {\n gateSet = true;\n callbackStore.set(value);\n gateSet = false;\n }\n });\n\n // Handle loading any existing `onChange` callbacks.\n if (isIterable(options?.onChange))\n {\n for (const entry of options.onChange)\n {\n if (typeof entry === 'function') { onchangeFunctions.push(entry); }\n }\n }\n else if (typeof options.onChange === 'function')\n {\n onchangeFunctions.push(options.onChange);\n }\n\n // Provides the final onChange callback that iterates over all the stored onChange callbacks.\n const onChange = (value) =>\n {\n for (const entry of onchangeFunctions) { entry(value); }\n };\n\n globalThis.game.settings.register(namespace, key, { ...options, config: foundryConfig, onChange });\n\n // Set new store value with existing setting or default value.\n const targetStore = store ? store : this.#getStore(key, globalThis.game.settings.get(namespace, key));\n\n // If a store instance is passed into register then initialize it with game settings data.\n if (store)\n {\n this.#stores.set(key, targetStore);\n store.set(globalThis.game.settings.get(namespace, key));\n }\n\n const storeHandler = async (value) =>\n {\n if (!gateSet && globalThis.game.settings.get(namespace, key) !== value)\n {\n gateSet = true;\n await globalThis.game.settings.set(namespace, key, value);\n }\n\n gateSet = false;\n };\n\n // Subscribe to self to set associated game setting on updates after verifying that the new value does not match\n // existing game setting.\n subscribeIgnoreFirst(targetStore, storeHandler);\n\n this.#settings.push({\n namespace,\n key,\n folder,\n ...options\n });\n\n return storeHandler;\n }\n\n /**\n * Registers multiple settings.\n *\n * Please refer to the note in {@link TJSGameSettings.register} about the returned object of store subscriber handler\n * functions.\n *\n * @param {Iterable} settings - An iterable list of game setting configurations to register.\n *\n * @param {boolean} coreConfig - When false this overrides the `setting.options.config` parameter when\n * registering the setting with Foundry. This allows the settings to be displayed\n * in the app itself, but removed from the standard Foundry configuration location.\n *\n * @returns { {[key: string]: Function} } An object containing all TJSGameSetting store subscriber handlers for each\n * setting `key` added.\n */\n registerAll(settings, coreConfig)\n {\n /** @type { {[key: string]: Function} } */\n const storeHandlers = {};\n\n if (!isIterable(settings)) { throw new TypeError(`TJSGameSettings - registerAll: settings is not iterable.`); }\n\n for (const entry of settings)\n {\n if (!isObject(entry))\n {\n throw new TypeError(`TJSGameSettings - registerAll: entry in settings is not an object.`);\n }\n\n if (typeof entry.namespace !== 'string')\n {\n throw new TypeError(`TJSGameSettings - registerAll: entry in settings missing 'namespace' attribute.`);\n }\n\n if (typeof entry.key !== 'string')\n {\n throw new TypeError(`TJSGameSettings - registerAll: entry in settings missing 'key' attribute.`);\n }\n\n if (!isObject(entry.options))\n {\n throw new TypeError(`TJSGameSettings - registerAll: entry in settings missing 'options' attribute.`);\n }\n\n storeHandlers[entry.key] = this.register(entry, coreConfig);\n }\n\n return storeHandlers;\n }\n}\n\n/**\n * @typedef {object} GameSettingOptions\n *\n * @property {object} [choices] If choices are defined, the resulting setting will be a select menu.\n *\n * @property {boolean} [config=true] Specifies that the setting appears in the configuration view.\n *\n * @property {*} [default] A default value for the setting.\n *\n * @property {string} [hint] A description of the registered setting and its behavior.\n *\n * @property {string} name The displayed name of the setting.\n *\n * @property {Function|Iterable} [onChange] An onChange callback function or iterable list of callbacks to\n * directly receive callbacks from Foundry on setting change.\n *\n * @property {{min: number, max: number, step: number}} [range] If range is specified, the resulting setting will be\n * a range slider.\n *\n * @property {boolean} [requiresReload=false] If true then a prompt to reload after changes occurs.\n *\n * @property {('client' | 'world')} [scope='client'] Scope for setting.\n *\n * @property {object|Function} type A constructable object or function.\n */\n\n/**\n * @typedef {object} GameSetting Defines a game setting.\n *\n * @property {string} namespace The setting namespace; usually the ID of the module / system.\n *\n * @property {string} key The setting key to register.\n *\n * @property {string} folder The name of the TJSSvgFolder to put this setting in to group them.\n *\n * @property {import('svelte/store').Writable} [store] An existing store instance to use.\n *\n * @property {GameSettingOptions} options Configuration for setting data.\n */\n\n/**\n * @typedef {GameSettingOptions} GameSettingData Stores the primary TJS game setting keys w/ GameSettingOptions.\n *\n * @property {string} namespace The setting namespace; usually the ID of the module / system.\n *\n * @property {string} key The setting key to register.\n *\n * @property {string} folder The name of the TJSSvgFolder to put this setting in to group them.\n */\n\n/**\n * Provides an accessible JS object that is updated reactively from all or subset of TJSGameSettings stores.\n * Accessors are provided to directly get / set current setting data. Using a setter will update the setting and backing\n * store.\n *\n * Note: You can create a JSDoc / `@typedef` to apply with `@type` and achieve typing support in IDEs for the\n * customizable live settings instance. Please see the example at the end of this source file on how to accomplish this\n * task.\n *\n * TJSLiveGameSettings is also a readable Svelte store essentially providing a customizable derived store of all\n * settings tracked.\n *\n * Note: When using from JS a second subscriber function argument is the key that was updated.\n * From Svelte: Use 'lastKey' accessor to retrieve the last updated key.\n */\nclass TJSLiveGameSettings\n{\n /**\n * Stores the current parsed game setting data.\n *\n * @type {{}}\n */\n #currentData = {};\n\n /**\n * Map of all game settings stores and unsubscribe functions currently subscribed.\n *\n * @type {Map}\n */\n #gameSettings = new Map();\n\n /**\n * Stores readable subscribers of this instance.\n *\n * Note: When using from JS a second argument is the key that was updated.\n * From Svelte: Use 'lastKey' accessor to retrieve the last updated key.\n *\n * @type {((value: TJSLiveGameSettings, key?: string) => void)[]}\n */\n #subscriptions = [];\n\n /**\n * Stores the last updated key.\n *\n * @type {string}\n */\n #lastKey = void 0;\n\n /**\n * Creates a live binding against the setting stores. All settings are configured by default, but can also be\n * filtered by setting key with inclusive / exclusive Sets.\n *\n * @param {TJSGameSettings} gameSettings - A game settings instance to subscribe to...\n *\n * @param {object} [options] - TJSLiveGameSettings options.\n *\n * @param {Set} [options.include] - A Set of setting keys to include from subscribing.\n *\n * @param {Set} [options.exclude] - A Set of setting keys to exclude from subscribing.\n */\n constructor(gameSettings, { include, exclude } = {})\n {\n if (!(gameSettings instanceof TJSGameSettings))\n {\n throw new TypeError(`'gameSettings' is not a TJSGameSettings instance.`);\n }\n\n if (include !== void 0 && !(include instanceof Set)) { throw new TypeError(`'options.include' is not a Set.`); }\n if (exclude !== void 0 && !(exclude instanceof Set)) { throw new TypeError(`'options.exclude' is not a Set.`); }\n\n for (const setting of gameSettings)\n {\n const key = setting.key;\n\n // Skip any keys that are in the include set.\n if (include !== void 0 && !include.has(key)) { continue; }\n\n // Skip any keys that are in the exclude set.\n if (exclude !== void 0 && exclude.has(key)) { continue; }\n\n if (typeof this[key] === 'function' || key === 'lastKey')\n {\n console.warn(`TJSLiveGameSettings warning: key (${key}) shadows a function. Skipping key.`);\n }\n\n const store = gameSettings.getStore(key);\n\n // Update this instance storing setting data by key.\n this.#gameSettings.set(key, {\n store,\n unsubscribe: store.subscribe((data) =>\n {\n if (this.#currentData !== void 0) { this.#currentData[key] = data; }\n\n this.#lastKey = key;\n\n // Notify any child instance that a particular key has updated.\n this._update(key);\n\n // Notify any readable store subscribers.\n this.#updateSubscribers(key);\n })\n });\n\n // Define new accessors for setting key.\n Object.defineProperty(this, key, {\n get: () =>\n {\n if (this.#currentData === void 0)\n {\n throw new Error(`This instance of TJSLiveGameSettings has been destroyed.`);\n }\n else\n {\n return this.#currentData[key];\n }\n },\n set: (data) =>\n {\n if (this.#currentData === void 0)\n {\n throw new Error(`This instance of TJSLiveGameSettings has been destroyed.`);\n }\n else\n {\n this.#gameSettings.get(key).store.set(data);\n }\n }\n });\n }\n\n Object.seal(this);\n }\n\n /**\n * @returns {string} Last updated setting key.\n */\n get lastKey()\n {\n return this.#lastKey;\n }\n\n // ----------------------------------------------------------------------------------------------------------------\n\n /**\n * Destroys this instance of TJSLiveGameSettings and unsubscribes from all game setting stores.\n */\n destroy()\n {\n for (const data of this.#gameSettings)\n {\n if (typeof data.unsubscribe === 'function') { data.unsubscribe(); }\n }\n\n this.#gameSettings.clear();\n this.#currentData = void 0;\n }\n\n /**\n * Returns an iterator / generator of all setting entries.\n *\n * @returns {IterableIterator<[key: string, value: any]>} An iterator returning setting entries.\n * @yields {[key: string, value: any]}\n */\n *entries()\n {\n if (this.#currentData === void 0) { throw new Error(`This instance of TJSLiveGameSettings has been destroyed.`); }\n\n for (const key in this.#currentData)\n {\n yield [key, this.#currentData[key]];\n }\n }\n\n /**\n * Returns an iterator / generator of all setting keys.\n *\n * @returns {IterableIterator} An iterator returning setting keys.\n * @yields {string}\n */\n *keys()\n {\n if (this.#currentData === void 0) { throw new Error(`This instance of TJSLiveGameSettings has been destroyed.`); }\n\n for (const key in this.#currentData)\n {\n yield key;\n }\n }\n\n /**\n * Returns a string / JSON stringify of the current setting data.\n *\n * @returns {string} Tracked setting data.\n */\n toString()\n {\n if (this.#currentData === void 0) { throw new Error(`This instance of TJSLiveGameSettings has been destroyed.`); }\n\n return JSON.stringify(this.#currentData);\n }\n\n /**\n * Override to respond to setting update.\n *\n * @param {string} key - The setting / local key that updated.\n *\n * @protected\n */\n _update(key) {} // eslint-disable-line no-unused-vars\n\n /**\n * Returns an iterator / generator of all values.\n *\n * @returns {IterableIterator} An iterator returning setting values.\n * @yields {any}\n */\n *values()\n {\n if (this.#currentData === void 0) { throw new Error(`This instance of TJSLiveGameSettings has been destroyed.`); }\n\n for (const key in this.#currentData)\n {\n yield this.#currentData[key];\n }\n }\n\n // Readable store implementation ----------------------------------------------------------------------------------\n\n /**\n * @param {(value: TJSLiveGameSettings, key?: string) => void} handler - Callback function that is invoked on\n * update / changes.\n *\n * @returns {import('svelte/store').Unsubscriber} Unsubscribe function.\n */\n subscribe(handler)\n {\n this.#subscriptions.push(handler); // add handler to the array of subscribers\n\n handler(this, void 0); // call handler with current value\n\n // Return unsubscribe function.\n return () =>\n {\n const index = this.#subscriptions.findIndex((sub) => sub === handler);\n if (index >= 0) { this.#subscriptions.splice(index, 1); }\n };\n }\n\n /**\n * Updates subscribers.\n *\n * @param {string} key - The key that was updated.\n */\n #updateSubscribers(key)\n {\n const subscriptions = this.#subscriptions;\n for (let cntr = 0; cntr < subscriptions.length; cntr++) { subscriptions[cntr](this, key); }\n }\n}\n\nexport { TJSGameSettings, TJSLiveGameSettings };\n//# sourceMappingURL=index.js.map\n","import { TJSGameSettings } from '#runtime/svelte/store/fvtt/settings';\nimport { camelCaseToTitleCase } from '~/src/helpers/Utility'\n\nimport { MODULE_ID } from '~/src/helpers/constants';\nclass DonationTrackerGameSettings extends TJSGameSettings {\n constructor() {\n super(MODULE_ID);\n }\n\n init() {\n game.system.log.i('Registering Actor Studio Donation Tracker integration')\n const namespace = this.namespace;\n const allSettings = [];\n\n allSettings.push({\n namespace,\n key: \"enable-donation-tracker\",\n options: {\n name: game.i18n.localize('GAS.Setting.DonationTrackerEnabled.Name'),\n hint: game.i18n.localize('GAS.Setting.DonationTrackerEnabled.Hint'),\n scope: \"world\",\n config: true,\n type: Boolean,\n default: true,\n onchange: () => {\n }\n }\n });\n\n allSettings.push({\n namespace,\n key: \"enable-donation-tracker-unregistered-access\",\n options: {\n name: game.i18n.localize('GAS.Setting.DonationTracker_UnregisteredAccess.Name'),\n hint: game.i18n.localize('GAS.Setting.DonationTracker_UnregisteredAccess.Hint'),\n scope: \"world\",\n config: true,\n type: Boolean,\n default: false,\n onchange: () => {\n }\n }\n });\n\n const membershipRanks = game.membership?.RANKS || []\n // game.system.log.d('membershipRanks', membershipRanks)\n\n if ( Object.keys(membershipRanks).length > 0) {\n // game.system.log.d('Registering Donation Tracker Ranks')\n for (const [rank, value] of Object.entries(membershipRanks)) {\n // game.system.log.d('rank', rank)\n if(value === -1) continue;\n allSettings.push({\n namespace,\n key: `donation-tracker-rank-${rank}`,\n options: {\n name: `${camelCaseToTitleCase(rank)}`,\n hint: `${game.i18n.localize('GAS.Setting.DonationTrackerRank.Hint')}: ${camelCaseToTitleCase(rank)}`,\n scope: \"world\",\n config: true,\n type: String,\n default: `${camelCaseToTitleCase(rank)}`,\n onchange: () => {\n }\n }\n });\n }\n }\n // game.system.log.d('allSettings', allSettings)\n this.registerAll(allSettings, !game.user.isGM);\n }\n}\n\nexport default new DonationTrackerGameSettings();\n","\n\n\n\n\n \n \n \n\n\n\n","import { SvelteApplication } from '#runtime/svelte/application';\n\nimport DonationTrackerSettingsAppShell from './DonationTrackerSettingsAppShell.svelte';\n\n\nexport default class DonationTrackerSettingsApp extends SvelteApplication\n{\n /** @inheritDoc */\n constructor(options)\n {\n super(options);\n }\n\n /**\n *\n */\n static get defaultOptions()\n {\n return foundry.utils.mergeObject(super.defaultOptions, {\n title: 'GAS.Setting.DonationTracker.Name',\n id: 'gas-donation-tracker-settings',\n resizable: true,\n minimizable: true,\n width: 600,\n height: 400,\n minWidth: 550,\n headerIcon: 'modules/foundryvtt-actor-studio/assets/actor-studio-logo-dragon-white.svg',\n\n svelte: {\n class: DonationTrackerSettingsAppShell,\n target: document.body\n }\n });\n }\n}","import DonationTrackerSettingsApp from './DonationTrackerSettingsApp.js';\n\nexport default class DonationTrackerSettingsButton extends FormApplication\n{\n static #dtSettingsApp;\n\n static showSettings()\n {\n this.#dtSettingsApp = this.#dtSettingsApp ? this.#dtSettingsApp : new DonationTrackerSettingsApp();\n this.#dtSettingsApp.render(true, { focus: true });\n\n return this.#dtSettingsApp;\n }\n\n /**\n * @inheritDoc\n */\n constructor(options = {})\n {\n super({}, options);\n DonationTrackerSettingsButton.showSettings();\n }\n\n async _updateObject(event, formData) {}\n render() { this.close(); }\n}","import CompendiumSourcesSubmenu from './compendiumSourcesSubmenu';\nimport DonationTrackerSettingsButton from './DonationTrackerSettingsButton';\nimport { MODULE_ID, LOG_PREFIX, DEFAULT_SOURCES } from '../helpers/constants';\n\n// settings not shown on the Module Settings - not modifiable by users\nexport const enum PrivateSettingKeys {\n LAST_MIGRATION = 'lastMigration',\n}\n\nexport const enum SourceType {\n RACES = 'races',\n RACIAL_FEATURES = 'racialFeatures',\n CLASSES = 'classes',\n CLASS_FEATURES = 'classFeatures',\n SUBCLASSES = 'subclasses',\n BACKGROUNDS = 'backgrounds',\n SPELLS = 'spells',\n FEATS = 'feats',\n ITEMS = 'items',\n}\n\nexport type Source = {\n [key in SourceType]: any;\n};\n\nexport function registerSettings(app): void {\n game.system.log.d(\"Building module settings\");\n\n Handlebars.registerHelper('checkedIf', function (condition) {\n return condition ? 'checked' : '';\n });\n\n /** Disabled settings */\n // defaultStartingGoldDice();\n // showRollsAsChatMessages();\n // individualPanelScrolls();\n // tokenDisplayNameMode();\n // tokenDisplayBarsMode();\n // equipmentBlacklist();\n // subraceNameBlacklist();\n // buttonOnDialogInsteadOfActorsDirectory();\n // trimSubclasses();\n // custom packs\n // integrations\n // useTokenizerIfAvailable();\n // private settings\n // lastMigration();\n // abilityScoreMethods();\n\n /** World Settings */\n debugSetting();\n debugHooksSetting();\n sourcesConfiguration();\n allowManualInput();\n allowStandardArray();\n allowPointBuy();\n pointBuyLimit();\n allowRolling(app);\n abilityRollFormula();\n donationTracker();\n showButtonInSideBar(app);\n forceDnd5eLevelUpAutomation();\n milestoneLeveling();\n windowX();\n windowY();\n\n /** User settings */\n dontShowWelcome();\n}\n\nfunction sourcesConfiguration() {\n game.settings.register(MODULE_ID, 'compendiumSources', {\n scope: 'world',\n config: false,\n type: Object,\n default: DEFAULT_SOURCES,\n });\n // Define a settings submenu which handles advanced configuration needs\n game.settings.registerMenu(MODULE_ID, 'compendiumSources', {\n name: game.i18n.localize('GAS.Setting.Sources.Name'),\n hint: game.i18n.localize('GAS.Setting.Sources.Hint'),\n label: game.i18n.localize('GAS.Setting.Sources.Label'),\n icon: 'fas fa-atlas',\n type: CompendiumSourcesSubmenu,\n restricted: true,\n });\n}\n\nfunction equipmentBlacklist() {\n game.settings.register(MODULE_ID, 'equipmentsBlackList', {\n name: game.i18n.localize('GAS.Setting.EquipmentBlacklist.Name'),\n hint: game.i18n.localize('GAS.Setting.EquipmentBlacklist.Hint'),\n scope: 'world',\n config: true,\n default:\n 'Potion of Climbing; Potion of Healing; Spell Scroll 1st Level; Spell Scroll Cantrip Level; Unarmed Strike',\n type: String,\n });\n}\n\nfunction subraceNameBlacklist() {\n game.settings.register(MODULE_ID, 'subracesBlacklist', {\n name: game.i18n.localize('GAS.Setting.SubraceNameBlacklist.Name'),\n hint: game.i18n.localize('GAS.Setting.SubraceNameBlacklist.Hint'),\n scope: 'world',\n config: true,\n default: 'Gnome Cunning; Halfling Nimbleness',\n type: String,\n });\n}\n\nfunction trimSubclasses() {\n game.settings.register(MODULE_ID, 'trimSubclasses', {\n name: game.i18n.localize('GAS.Setting.TrimSubclasses.Name'),\n hint: game.i18n.localize('GAS.Setting.TrimSubclasses.Hint'),\n scope: 'world',\n config: true,\n default: true,\n type: Boolean,\n });\n}\n\nfunction milestoneLeveling() {\n game.settings.register(MODULE_ID, 'milestoneLeveling', {\n name: game.i18n.localize('GAS.Setting.milestoneLeveling.Name'),\n hint: game.i18n.localize('GAS.Setting.milestoneLeveling.Hint'),\n scope: 'world',\n config: true,\n default: false,\n type: Boolean,\n });\n}\n\nfunction forceDnd5eLevelUpAutomation() {\n game.settings.register(MODULE_ID, 'forceDnd5eLevelUpAutomation', {\n name: game.i18n.localize('GAS.Setting.forceDnd5eLevelUpAutomation.Name'),\n hint: game.i18n.localize('GAS.Setting.forceDnd5eLevelUpAutomation.Hint'),\n scope: 'world',\n config: true,\n default: true,\n type: Boolean,\n });\n}\n\nfunction dontShowWelcome() {\n game.settings.register(MODULE_ID, 'dontShowWelcome', {\n name: game.i18n.localize('GAS.Setting.DontShowWelcome.Name'),\n hint: game.i18n.localize('GAS.Setting.DontShowWelcome.Hint'),\n scope: 'user',\n config: true,\n default: false,\n type: Boolean,\n });\n}\n\nfunction defaultStartingGoldDice() {\n game.settings.register(MODULE_ID, 'defaultGoldDice', {\n name: game.i18n.localize('GAS.Setting.DefaultGoldDice.Name'),\n hint: game.i18n.localize('GAS.Setting.DefaultGoldDice.Hint'),\n scope: 'world',\n config: true,\n default: '5d4 * 10',\n type: String,\n });\n}\n\nfunction useTokenizerIfAvailable() {\n game.settings.register(MODULE_ID, 'useTokenizer', {\n name: game.i18n.localize('GAS.Setting.UseTokenizer.Name'),\n hint: game.i18n.localize('GAS.Setting.UseTokenizer.Hint'),\n scope: 'world',\n config: true,\n type: Boolean,\n default: false,\n });\n}\n\nfunction buttonOnDialogInsteadOfActorsDirectory() {\n game.settings.register(MODULE_ID, 'buttonOnDialog', {\n name: game.i18n.localize('GAS.Setting.ButtonOnDialogInsteadOfActorsDirectory.Name'),\n hint: game.i18n.localize('GAS.Setting.ButtonOnDialogInsteadOfActorsDirectory.Hint'),\n scope: 'world',\n config: true,\n type: Boolean,\n default: false,\n });\n}\n\nfunction tokenDisplayBarsMode() {\n game.settings.register(MODULE_ID, 'displayBarsMode', {\n name: game.i18n.localize('GAS.Setting.TokenBarMode.Name'),\n scope: 'world',\n config: true,\n type: Number,\n choices: {\n 0: 'Never Displayed',\n 10: 'When Controlled',\n 20: 'Hover by Owner',\n 30: 'Hover by Anyone',\n 40: 'Always for Owner',\n 50: 'Always for Anyone',\n },\n default: 20,\n });\n}\n\nfunction tokenDisplayNameMode() {\n game.settings.register(MODULE_ID, 'displayNameMode', {\n name: game.i18n.localize('GAS.Setting.TokenNameMode.Name'),\n scope: 'world',\n config: true,\n type: Number,\n choices: {\n 0: 'Never Displayed',\n 10: 'When Controlled',\n 20: 'Hover by Owner',\n 30: 'Hover by Anyone',\n 40: 'Always for Owner',\n 50: 'Always for Anyone',\n },\n default: 20,\n });\n}\n\nfunction showRollsAsChatMessages() {\n game.settings.register(MODULE_ID, 'showRolls', {\n name: game.i18n.localize('GAS.Setting.ShowRolls.Name'),\n hint: game.i18n.localize('GAS.Setting.ShowRolls.Hint'),\n scope: 'world',\n config: true,\n type: Boolean,\n default: true,\n });\n}\n\nfunction individualPanelScrolls() {\n game.settings.register(MODULE_ID, 'individualScrolls', {\n name: game.i18n.localize('GAS.Setting.IndividualPanelScroll.Name'),\n hint: game.i18n.localize('GAS.Setting.IndividualPanelScroll.Hint'),\n scope: 'client',\n config: true,\n type: Boolean,\n default: false,\n });\n}\n\n\nfunction pointBuyLimit() {\n game.settings.register(MODULE_ID, 'pointBuyLimit', {\n name: game.i18n.localize('GAS.Setting.AbilityEntry.PointBuyLimit.Name'),\n hint: game.i18n.localize('GAS.Setting.AbilityEntry.PointBuyLimit.Hint'),\n scope: 'world',\n config: true,\n default: 27,\n type: Number,\n });\n}\nfunction windowX() {\n game.settings.register(MODULE_ID, 'windowX', {\n name: game.i18n.localize('GAS.Setting.WindowX.Name'),\n hint: game.i18n.localize('GAS.Setting.WindowX.Hint'),\n scope: 'world',\n config: true,\n default: 700,\n type: Number,\n });\n}\nfunction windowY() {\n game.settings.register(MODULE_ID, 'windowY', {\n name: game.i18n.localize('GAS.Setting.WindowY.Name'),\n hint: game.i18n.localize('GAS.Setting.WindowY.Hint'),\n scope: 'world',\n config: true,\n default: 800,\n type: Number,\n });\n}\n\nfunction abilityRollFormula() {\n game.settings.register(MODULE_ID, 'abiiltyRollFormula', {\n name: game.i18n.localize('GAS.Setting.AbilityEntry.AbilityRollFormula.Name'),\n hint: game.i18n.localize('GAS.Setting.AbilityEntry.AbilityRollFormula.Hint'),\n scope: 'world',\n config: true,\n default: '4d6kh3',\n type: String,\n onChange: () => { console.log('allowPointBuy') },\n updateSetting: () => { console.log('updateSetting'); },\n });\n}\n\n\nfunction allowManualInput() {\n game.settings.register(MODULE_ID, 'allowManualInput', {\n name: game.i18n.localize('GAS.Setting.AbilityEntry.AllowManualInput.Name'),\n hint: game.i18n.localize('GAS.Setting.AbilityEntry.AllowManualInput.Hint'),\n scope: 'world',\n config: true,\n type: Boolean,\n default: true,\n });\n}\n\nfunction allowStandardArray() {\n game.settings.register(MODULE_ID, 'allowStandardArray', {\n name: game.i18n.localize('GAS.Setting.AbilityEntry.AllowStandardArray.Name'),\n hint: game.i18n.localize('GAS.Setting.AbilityEntry.AllowStandardArray.Hint'),\n scope: 'world',\n config: true,\n default: false,\n type: Boolean,\n });\n}\n\nfunction allowPointBuy() {\n game.settings.register(MODULE_ID, 'allowPointBuy', {\n name: game.i18n.localize('GAS.Setting.AbilityEntry.AllowPointBuy.Name'),\n hint: game.i18n.localize('GAS.Setting.AbilityEntry.AllowPointBuy.Hint'),\n scope: 'world',\n config: true,\n default: false,\n onChange: () => { console.log('allowPointBuy') },\n updateSetting: () => { console.log('updateSetting'); },\n type: Boolean,\n });\n}\n\nfunction allowRolling(app) {\n game.settings.register(MODULE_ID, 'allowRolling', {\n name: game.i18n.localize('GAS.Setting.AbilityEntry.AllowRolling.Name'),\n hint: game.i18n.localize('GAS.Setting.AbilityEntry.AllowRolling.Hint'),\n scope: 'world',\n config: true,\n default: false,\n onChange: () => { console.log('allowPointBuy') },\n updateSetting: () => { console.log('updateSetting'); },\n type: Boolean,\n });\n}\n\nfunction showButtonInSideBar(app) {\n game.settings.register(MODULE_ID, 'showButtonInSideBar', {\n name: game.i18n.localize('GAS.Setting.showButtonInSideBar.Name'),\n hint: game.i18n.localize('GAS.Setting.showButtonInSideBar.Hint'),\n scope: 'world',\n config: true,\n default: false,\n type: Boolean,\n });\n}\nfunction debugSetting() {\n game.settings.register(MODULE_ID, 'debug', {\n name: game.i18n.localize('GAS.Setting.debug.Name'),\n hint: game.i18n.localize('GAS.Setting.debug.Hint'),\n scope: 'world',\n config: true,\n default: false,\n type: Boolean,\n });\n}\nfunction debugHooksSetting() {\n game.settings.register(MODULE_ID, 'debug.hooks', {\n name: game.i18n.localize('GAS.Setting.debugHooks.Name'),\n hint: game.i18n.localize('GAS.Setting.debugHooks.Hint'),\n scope: 'world',\n config: true,\n default: false,\n type: Boolean,\n });\n}\n\nfunction donationTracker() {\n if (!game.modules.get('donation-tracker')?.active) return;\n\n Hooks.on('actor-studio-donation-tracker:settings', () => {\n if (game.user.isGM) { DonationTrackerSettingsButton.showSettings(); }\n });\n\n game.settings.registerMenu(MODULE_ID, 'DonationTracker', {\n name: game.i18n.localize('GAS.Setting.DonationTracker.Name'),\n hint: game.i18n.localize('GAS.Setting.DonationTracker.Hint'),\n label: game.i18n.localize('GAS.Setting.DonationTracker.Label'),\n icon: 'fas fa-coins',\n type: DonationTrackerSettingsButton,\n restricted: true,\n onChange: () => {\n Hooks.call('actor-studio-donation-tracker:settings');\n }\n });\n\n}\n\n// PRIVATE SETTINGS\n\nfunction lastMigration() {\n game.settings.register(MODULE_ID, PrivateSettingKeys.LAST_MIGRATION, {\n scope: 'world',\n config: false,\n default: 0,\n type: Number,\n });\n}\n","import '../styles/Variables.scss'; // Import any styles as this includes them in the build.\nimport '../styles/init.sass'; // Import any styles as this includes them in the build.\n\nimport WelcomeApplication from './app/WelcomeApplication.js';\nimport PCApplication from './app/PCApplication.js';\nimport dnd5e from \"~/config/systems/dnd5e.json\";\nimport packageJson from '../package.json';\nimport manifestJson from '../module.json';\n\nimport { MODULE_ID } from '~/src/helpers/constants';\nimport { userHasRightPermissions, log, getAllPackIdsFromAllSettings } from '~/src/helpers/Utility'\nimport { tabs, activeTab, dropItemRegistry, isLevelUp, levelUpTabs } from '~/src/helpers/store.js';\nimport { initLevelup } from '~/src/plugins/level-up';\nimport { get } from 'svelte/store';\nimport { registerSettings } from '~/src/settings';\nimport DonationTrackerGameSettings from '~/src/settings/DonationTrackerGameSettings.js';\n\n\n\nHooks.once(\"init\", (app, html, data) => {\n\n game.system.log = log;\n log.level = log.DEBUG;\n\n game.system.log.i(`Starting System ${MODULE_ID}`);\n game.system.log.i('Initialising for foundry version:', game.version);\n game.system.log.i('Initialising module manifest version:', manifestJson.version);\n game.system.log.i('Initialising module package version:', packageJson.version);\n game.system.log.i('Initialising game module version:', game.modules.get(MODULE_ID).version);\n\n initLevelup();\n registerSettings(app);\n \n if(game.settings.get(MODULE_ID, 'debug')) {\n log.level = log.VERBOSE;\n } else {\n log.level = log.INFO;\n }\n\n if(game.settings.get(MODULE_ID, 'debug.hooks')) {\n CONFIG.debug.hooks = true;\n }\n\n game.system.log.d('Debug mode is', game.settings.get(MODULE_ID, 'debug') ? 'enabled' : 'disabled');\n game.system.log.d('Debug extended mode is', game.settings.get(MODULE_ID, 'debug.hooks') ? 'enabled' : 'disabled');\n game.system.log.d('Log level: ',log.level)\n\n Hooks.call(\"gas.initIsComplete\");\n\n});\n\nHooks.once(\"ready\", (app, html, data) => {\n \n if (!game.settings.get(MODULE_ID, 'dontShowWelcome')) {\n new WelcomeApplication().render(true, { focus: true });\n }\n\n Hooks.call(\"gas.readyIsComplete\");\n});\n\n//- donation-tracker integration\nHooks.once(\"membershipReady\", (app, html, data) => {\n const dtExists = game.modules.get('donation-tracker')?.active\n game.system.log.i('Checking for Donation Tracker module: ', dtExists ? 'Found' : 'Not Found');\n if (dtExists) {\n DonationTrackerGameSettings.init();\n }\n if (game.settings.get(MODULE_ID, 'forceDnd5eLevelUpAutomation')) {\n game.settings.set(\"dnd5e\", \"disableAdvancements\", false);\n }\n});\n\nconst isAppElementAppended = (appId) => {\n const panelElement = $('#foundryvtt-actor-studio-pc-sheet .window-content main section.a .tab-content .content');\n return panelElement.find(`[data-appid=\"${appId}\"]`).length > 0;\n};\n\nconst generateUniqueId = () => `app-${Math.random().toString(36).substr(2, 9)}`;\n\n\nHooks.on('renderAdvancementManager', async (app, html, data) => {\n // game.system.log.d('renderAdvancementManager')\n // Check if your application is currently open by looking for its specific DOM element\n const currentProcess = get(dropItemRegistry.currentProcess)\n // const methods = Object.getOwnPropertyNames(app).filter(item => typeof app[item] === 'function');\n\n // game.system.log.d('currentProcess', currentProcess)\n // game.system.log.d('app._stepIndex', app._stepIndex)\n\n if (currentProcess.id && app._stepIndex === 0) {\n const appElement = $('#foundryvtt-actor-studio-pc-sheet');\n if (appElement.length) {\n dropItemRegistry.updateCurrentProcess({ app, html, data })\n const advancementsTab = get(isLevelUp) ? get(levelUpTabs).find(x => x.id === \"advancements\") : get(tabs).find(x => x.id === \"advancements\");\n // console.log('advancementsTab', advancementsTab)\n if (advancementsTab) {\n Hooks.call(\"gas.renderAdvancement\");\n } else {\n game.system.log.i('Advancements tab not found, adding it to the tabs')\n // @why,- add the advancements tab to the store, which will trigger it's component to render, which will in turn call gas.renderAdvancement\n if(get(isLevelUp)) {\n await levelUpTabs.update(t => [...t, { label: \"Advancements\", id: \"advancements\", component: \"Advancements\" }]);\n } else {\n await tabs.update(t => [...t, { label: \"Advancements\", id: \"advancements\", component: \"Advancements\" }]);\n }\n activeTab.set('advancements');\n }\n }\n }\n});\n\nHooks.on(\"renderFolderConfig\", (app, html, folder) => {\n game.system.log.d(\"folder\", folder);\n})\nHooks.on(\"renderActorSheet\", (app, html, actor) => {\n // game.system.log.d(\"actor\", actor);\n})\nHooks.on(\"renderItemSheet5e\", (app, html, item) => {\n game.system.log.d(\"item\", item);\n})\n\nHooks.on(\"dropActorSheetData\", (actor, type, info) => {\n // game.system.log.d(\"dropActorSheetData\", actor, type, info);\n})\n\nHooks.on('gas.renderAdvancement', () => {\n // game.system.log.d('gas.renderAdvancement')\n // game.system.log.d('Advancements tab found, rendering the advancment workflow')\n\n const currentProcess = get(dropItemRegistry.currentProcess);\n // Get all stored advancement apps\n if (currentProcess) {\n const panelElement = $('#foundryvtt-actor-studio-pc-sheet .window-content main section.a .tab-content .content');\n // Move each app's dialog to your application's content area\n // Check if the app's element is already appended\n if (!isAppElementAppended(currentProcess.id)) {\n const element = currentProcess.app.element\n element.removeClass(); // Remove all classes from the root element itself\n element.addClass('gas-advancements')\n element.attr('gas-appid', currentProcess.id);\n // Move each app's dialog to your application's content area\n element.appendTo(panelElement);\n }\n }\n});\n\nHooks.on('dnd5e.preAdvancementManagerComplete', (...args) => {\n // game.system.log.d(args)\n})\n\nHooks.on('closeAdvancementManager', async (...args) => {\n // Define a function to check if the panel is empty\n const isPanelEmpty = () => $('#foundryvtt-actor-studio-pc-sheet .window-content main section.a .tab-content .container .content')?.html()?.trim() === '';\n // Define a function to wait for the panel to become empty\n const waitForPanelEmpty = async () => {\n while (!isPanelEmpty()) {\n // Wait for a short delay before checking again\n await new Promise(resolve => setTimeout(resolve, 100)); // Adjust the delay as needed\n }\n };\n\n // Wait for the panel to become empty\n await waitForPanelEmpty();\n\n\n // Once the panel is empty, proceed with the queue\n const queue = await dropItemRegistry.advanceQueue();\n // game.system.log.d('closeAdvancementManager queue', queue)\n if (!queue) {\n Hooks.call(\"gas.close\");\n }\n});\n\nHooks.on('renderSettingsConfig', (app, html, context) => {\n if (game.user.isGM) {\n $(`section[data-tab=\"${MODULE_ID}\"] h2`, html).after(`

${game.i18n.localize('GAS.Setting.World')}

`)\n }\n $(`[data-setting-id=\"${MODULE_ID}.allowManualInput\"]`, html).before(`

${game.i18n.localize('GAS.Setting.AbilityScoreEntryOptions')}

`)\n $(`[data-setting-id=\"${MODULE_ID}.dontShowWelcome\"]`, html).before(`

${game.i18n.localize('GAS.Setting.User')}

`)\n})\n\n\nHooks.on('renderCompendium', async (app, html, data) => {\n // game.system.log.d('renderCompendium', app, html, data)\n if (game.modules.get('donation-tracker')?.active && game.settings.get(MODULE_ID, 'enable-donation-tracker')) {\n\n const pack = app.collection\n if (pack.locked) return\n if (pack.metadata.path.includes('systems/')) return\n const allPacks = getAllPackIdsFromAllSettings();\n const actionButtons = html.find('.action-buttons')\n const DTaction = actionButtons.find('button.gas-add-dt-folders');\n\n // don't render the button if it already exists\n if (DTaction.length) {\n game.system.log.i('Donation Tracker button already exists, skipping')\n return;\n }\n\n // if the metadata.id of the pack matches any of the packs that are mapped to Actor Studio Sources, then render the DT folders button\n if (!allPacks.includes(pack.metadata.id)) {\n // @why commented out? Apparently these were annoying\n // game.system.log.i('Pack is not mapped to Actor Studio Sources, skipping')\n // ui.notifications.warn(`Pack ${pack.metadata.label} is not mapped to Actor Studio Sources. Please map it to enable the Donation Tracker feature.`)\n return;\n }\n\n // if the DTfolders already exist, don't render the button\n const membershipRanks = game.membership.RANKS\n for (const [rank, value] of Object.entries(membershipRanks)) {\n if (value === -1) continue;\n const folder = pack.folders.find(f => f.name === game.settings.get(MODULE_ID, `donation-tracker-rank-${rank}`))\n if (folder) {\n game.system.log.i('Donation Tracker folders already exist, skipping')\n return;\n }\n }\n\n async function addDonationTrackerFolders() {\n const membershipRanks = game.membership.RANKS\n for (const [rank, value] of Object.entries(membershipRanks)) {\n if (value === -1) continue;\n const folder = pack.folders.find(f => f.name === game.settings.get(MODULE_ID, `donation-tracker-rank-${rank}`))\n if (!folder) {\n // pack.folders.createDocument({ name: game.settings.get(MODULE_ID, `donation-tracker-rank-${rank}`), type: \"JournalEntry\" });\n const folderCls = getDocumentClass(\"Folder\");\n // const myFolder = await folderCls.create({ name: game.settings.get(MODULE_ID, `donation-tracker-rank-${rank}`), type: \"JournalEntry\" });\n await folderCls.create({ name: game.settings.get(MODULE_ID, `donation-tracker-rank-${rank}`), type: \"Item\" }, { pack: pack.metadata.id });\n }\n }\n }\n\n const button = $(``);\n button.on('click', addDonationTrackerFolders)\n actionButtons.append(button)\n\n }\n\n})\n\nfunction isActorTypeValid(actorTypes, type) {\n // Check if the type exists as a key in the object and its value is true\n return actorTypes.hasOwnProperty(type) && actorTypes[type] === true;\n}\n\nfunction getActorStudioButton(buttonId) {\n const gasButton = $(\n ``,\n );\n return gasButton;\n}\n\n\n\nHooks.on('renderApplication', (app, html, data) => {\n const createNewActorLocalized = game.i18n.format('DOCUMENT.Create', { type: game.i18n.localize('DOCUMENT.Actor') });\n if (app.title === createNewActorLocalized) {\n game.system.log.i('Adding Create New Actor button');\n\n const select = $('select', html);\n const systemActorDocumentTypes = dnd5e.actorTypes\n\n function updateButton() {\n const actorType = select.val();\n // game.system.log.d('actorType', actorType)\n if (isActorTypeValid(systemActorDocumentTypes, actorType)) {\n if (!$('#gas-dialog-button', html).length) {\n const $gasButton = getActorStudioButton('gas-dialog-button');\n // game.system.log.d('html', html)\n $('button', html).last().after($gasButton); // Ensure button is added after the Create New Actor confirm button\n\n const handleButtonClick = function (e) {\n if (e.type === 'mousedown' || e.type === 'keydown' && (e.key === 'Enter' || e.key === ' ')) {\n if (userHasRightPermissions()) {\n const actorName = $('input', html).val();\n const folderName = $('select[name=\"folder\"]', html).val();\n // game.system.log.d('actorType', actorType);\n try {\n // new PCApplication(new Actor.implementation({ name: actorName, flags: { [MODULE_ID]: {folderName}}, type: actorType })).render(true, { focus: true });\n new PCApplication(new Actor.implementation({ name: actorName, folder: folderName, type: actorType })).render(true, { focus: true });\n app.close();\n } catch (error) {\n ui.notifications.error(error.message);\n }\n }\n }\n };\n\n $gasButton.on('mousedown', handleButtonClick);\n $gasButton.on('keydown', handleButtonClick);\n\n }\n } else {\n $('#gas-dialog-button', html).remove(); // Remove button if actorType is not \"character\"\n }\n }\n\n // Initial check\n updateButton();\n\n // Update button when the select value changes\n select.on('change', updateButton);\n }\n})\n\n\nHooks.on('renderActorDirectory', async (app) => {\n if (!game.modules.get(MODULE_ID)?.active) return;\n // Add Actor Studio button to the sidebar\n if (app.constructor.name === \"ActorDirectory\") {\n if (!game.settings.get(MODULE_ID, 'showButtonInSideBar')) return;\n if ($('#gas-sidebar-button').length) return;\n const $gasButton = getActorStudioButton('gas-sidebar-button');\n $(app._element).find('header.directory-header').append($gasButton);\n\n const handleButtonClick = function (e) {\n if (e.type === 'mousedown' || e.type === 'keydown' && (e.key === 'Enter' || e.key === ' ')) {\n if (userHasRightPermissions()) {\n try {\n // new PCApplication(new Actor.implementation({ name: actorName, flags: { [MODULE_ID]: {folderName}}, type: actorType })).render(true, { focus: true });\n new PCApplication(new Actor.implementation({ name: game.user.name, folder: '', type: 'character' })).render(true, { focus: true });\n app.close();\n } catch (error) {\n ui.notifications.error(error.message);\n }\n }\n }\n };\n\n $gasButton.on('mousedown', handleButtonClick);\n $gasButton.on('keydown', handleButtonClick);\n }\n})"],"names":["url","now","element","text","type","hash","detach","linear","tick","create_each_block","insert","update","instance","create_fragment","document","version","cssVariables","styles","ctx","background","id","dispatch","set","subscribe","run","children","get","duration","ease","interpolate","options","parent","active","create_if_block","s_REGEX_HTML","title","draggable","booleanStore","dragDefault","storeResizing","create_if_block_1","preventDefault","autoClose","dontShowWelcome","promise","writable","log","level","isLevelUp","isMultiClass","tabs","activeTab","initialTabs","create_if_block_2","create_if_block_4","create_if_block_3","race","characterClass","characterSubClass","abilityGenerationMethod","pointBuy","abilityRolls","isStandardArrayValues","value","registerSettings","DonationTrackerGameSettings","membershipRanks","actorTypes"],"mappings":"AACO,SAAS,OAAO;AAAE;AAElB,MAAM,WAAW,CAAC,MAAM;AASxB,SAAS,OAAO,KAAK,KAAK;AAEhC,aAAW,KAAK,IAAK,KAAI,CAAC,IAAI,IAAI,CAAC;AACnC;AAAA;AAAA,IAA6B;AAAA;AAC9B;AAQO,SAAS,WAAW,OAAO;AACjC,SACC,CAAC,CAAC,UACD,OAAO,UAAU,YAAY,OAAO,UAAU,eAC/C;AAAA,EAA4B,MAAO,SAAU;AAE/C;AASO,SAAS,IAAI,IAAI;AACvB,SAAO,GAAE;AACV;AAEO,SAAS,eAAe;AAC9B,SAAO,uBAAO,OAAO,IAAI;AAC1B;AAMO,SAAS,QAAQ,KAAK;AAC5B,MAAI,QAAQ,GAAG;AAChB;AAMO,SAAS,YAAY,OAAO;AAClC,SAAO,OAAO,UAAU;AACzB;AAGO,SAAS,eAAe,GAAG,GAAG;AACpC,SAAO,KAAK,IAAI,KAAK,IAAI,MAAM,KAAM,KAAK,OAAO,MAAM,YAAa,OAAO,MAAM;AAClF;AAEA,IAAI;AAOG,SAAS,cAAc,aAAaA,MAAK;AAC/C,MAAI,gBAAgBA,KAAK,QAAO;AAChC,MAAI,CAAC,sBAAsB;AAC1B,2BAAuB,SAAS,cAAc,GAAG;AAAA,EACjD;AAED,uBAAqB,OAAOA;AAC5B,SAAO,gBAAgB,qBAAqB;AAC7C;AAqCO,S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32,33,34,35,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,64,72,73,74,75,76,77,78,79,80,81,82,83,84]} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 0fe408f..74a3893 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,2 +1,2 @@ -import "./index-Df9cbNxR.js"; +import "./index-DP0Ud7KH.js"; //# sourceMappingURL=index.js.map diff --git a/module.json b/module.json index dde952b..1130569 100644 --- a/module.json +++ b/module.json @@ -1,65 +1,65 @@ { - "title": "Actor Studio", - "description": "Easily create Heroes, Villains and everything in between.", - "version": "1.5.7", - "styles": [ - "dist/style.css" - ], - "esmodules": [ - "index.js" - ], - "languages": [ - { - "lang": "en", - "name": "English", - "path": "lang/en.json", - "flags": {} + "title": "Actor Studio", + "description": "Easily create Heroes, Villains and everything in between.", + "version": "1.5.8", + "styles": [ + "dist/style.css" + ], + "esmodules": [ + "index.js" + ], + "languages": [ + { + "lang": "en", + "name": "English", + "path": "lang/en.json", + "flags": {} + }, + { + "lang": "zh-tw", + "name": "正體中文", + "path": "lang/zh-tw.json", + "flags": {} + } + ], + "url": "https://github.com/geoidesic/foundryvtt-actor-studio", + "manifest": "https://github.com/geoidesic/foundryvtt-actor-studio/releases/download/1.5.7/module.json", + "download": "https://github.com/geoidesic/foundryvtt-actor-studio/releases/download/1.5.7/module.zip", + "authors": [ + { + "name": "Noel da Costa", + "url": "https://www.arc2.co.uk", + "discord": "geoidesic", + "flags": {} + } + ], + "compatibility": { + "minimum": "11", + "verified": "12", + "maximum": "12" }, - { - "lang": "zh-tw", - "name": "正體中文", - "path": "lang/zh-tw.json", - "flags": {} - } - ], - "url": "https://github.com/geoidesic/foundryvtt-actor-studio", - "manifest": "https://github.com/geoidesic/foundryvtt-actor-studio/releases/latest/download/module.json", - "download": "https://github.com/geoidesic/foundryvtt-actor-studio/releases/download/1.5.7/module.zip", - "authors": [ - { - "name": "Noel da Costa", - "url": "https://www.arc2.co.uk", - "discord": "geoidesic", - "flags": {} - } - ], - "compatibility": { - "minimum": "11", - "verified": "12", - "maximum": "12" - }, - "flags": { - "hotReload": { - "extensions": [ - "json" - ], - "paths": [ - "lang" - ] - } - }, - "relationships": { - "systems": [ - { - "id": "dnd5e", - "type": "system", - "compatibility": { - "minimum": "3.0.0", - "verified": "4", - "maximum": "5" + "flags": { + "hotReload": { + "extensions": [ + "json" + ], + "paths": [ + "lang" + ] } - } - ] - }, - "id": "foundryvtt-actor-studio" + }, + "relationships": { + "systems": [ + { + "id": "dnd5e", + "type": "system", + "compatibility": { + "minimum": "3.0.0", + "verified": "4", + "maximum": "5" + } + } + ] + }, + "id": "foundryvtt-actor-studio" } \ No newline at end of file diff --git a/src/components/molecules/dnd5e/AbilityEntry/Roll.svelte b/src/components/molecules/dnd5e/AbilityEntry/Roll.svelte index 4f4294b..785c182 100644 --- a/src/components/molecules/dnd5e/AbilityEntry/Roll.svelte +++ b/src/components/molecules/dnd5e/AbilityEntry/Roll.svelte @@ -48,7 +48,7 @@