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 div.content\n .flexrow\n .flex2.pr-sm.col-a\n h3.left {localize('GAS.Tabs.Abilities.HowCalculated')}\n +if(\"options.length > 1\")\n IconSelect.icon-select({options} {active} {placeHolder} handler=\"{selectHandler}\" id=\"ability-generation-method-select\" bind:value=\"{$abilityGenerationMethod}\" )\n +else()\n ol.properties-list\n +each(\"options as option\")\n li {option.label}\n +if(\"$abilityGenerationMethod\")\n svelte:component(this=\"{abilityModule}\")\n .flex0.border-right.right-border-gradient-mask \n .flex3.left.pl-md.scroll.col-b {@html richHTML}\n\n\n\n"],"names":["ctx"],"mappings":";;;;;;;;;;;;IA8FqY,IAAO,CAAA;AAAA,EAAA;;iCAAZ,QAAI,KAAA,GAAA;;;;;;;;;;;;AAAlC,aAAwF,Q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A,MACN,SAAS,KAAK,SAAS,IAAI,WAAW,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/AbilityScoreImprovement.svelte"],"sourcesContent":["\n\n\n.advancement.mt-sm(data-type=\"{advancement.type}\")\n +each(\"improvements as improvement\")\n .flexrow\n .flex.left\n span.label {improvement.label}\n .flex0.right\n +if(\"Number(improvement.value) > 0\")\n span +\n span.value {improvement.value}\n\n\n"],"names":["ctx","fixed"],"mappings":";;;;;;;;;;;;;;AA2C6P,aAAc,QAAA,MAAA,MAAA;AAAA;;;;;;;;;;;;AAAzG,MAAA;AAAA;AAAA,IAAA,OAAY,QAAK;AAAA;;;AAA4C,MAAA,UAAA;AAAA;AAAA,IAAO,IAAY,CAAA,EAAA;AAAA,EAAK,IAAI;;AAA0C,MAAA;AAAA;AAAA,IAAA,OAAY,QAAK;AAAA;;;;;;;;;;;;;;;;;;;;AAArN,aAAyO,QAAA,MAAA,MAAA;AAApN,aAA2E,MAAA,IAAA;AAApD,aAA8C,MAAA,KAAA;;AAAM,aAAmI,MAAA,IAAA;;AAApD,aAA8C,MAAA,KAAA;;;;AAA5J,UAAA;AAAA,MAAA,KAAA,cAAA;AAAA,MAAAA,QAAY,QAAK,IAAA,UAAA,IAAA,QAAA;AAA4C,UAAA;AAAA,MAAA,EAAA,WAAA;AAAA;AAAA,QAAOA,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0jBF.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.container\n //- button for debugging only\n //- button.btn.btn-primary.mt-sm(on:click=\"{addAdvancement}\") Add Advancement\n .content\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\ndiv.content\n .flexrow\n .flex2.pr-sm.col-a\n .flexrow\n .flex0.required(class=\"{$background ? '' : 'active'}\") *\n .flex3 \n IconSelect.icon-select({options} {active} {placeHolder} handler=\"{selectHandler}\" id=\"background-select\" bind:value )\n \n +if(\"advancementArray.length\")\n h3.left {localize('GAS.Advancements')}\n ul.icon-list\n +each(\"advancementArray as advancement\")\n //- @todo: this should be broken out into components for each advancement.type\n li.left\n .flexrow(data-tooltip=\"{getAdvancementValue(advancement, 'hint')}\" data-tooltip-class=\"gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip\")\n .flex0.relative.image\n img.icon(src=\"{advancement.icon}\" alt=\"{advancement.title}\")\n .flex2 {advancement.title}\n .flexrow\n //- pre advancement {advancement.type}\n svelte:component(this=\"{advancementComponents[advancement.type]}\" advancement=\"{advancement}\")\n\n .flex0.border-right.right-border-gradient-mask \n .flex3.left.pl-md.scroll.col-b {@html richHTML}\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,OAAA,aAAA;AAAS,WAAA,KAAA,OAAA;AAAA,MAAA,QAAY,KAAK;;;;2DAAlN;AAAA;AAAA,QAAoB,IAAW,EAAA;AAAA,QAAE;AAAA,MAAM,CAAA;;;;;;AAA5F,aAAod,QAAA,IAAA,MAAA;AAAnc,aAAiT,IA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S;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/Tabs/Class.svelte"],"sourcesContent":["\n\n\n .content\n .flexrow\n .flex2.pr-sm.col-a\n .flexrow\n .flex0.required(class=\"{$characterClass ? '' : 'active'}\") *\n .flex3 \n IconSelect.icon-select(active=\"{classProp}\" options=\"{filteredClassIndex}\" placeHolder=\"{classesPlaceholder}\" handler=\"{selectClassHandler}\" id=\"characterClass-select\" bind:value=\"{classValue}\" )\n +if(\"$characterClass\")\n +if(\"subclasses.length\")\n h3.left.mt-md {localize('GAS.SubClass')}\n .flexrow\n .flex0.required(class=\"{$characterSubClass ? '' : 'active'}\") *\n .flex3\n IconSelect.icon-select(active=\"{subClassProp}\" options=\"{subclasses}\" placeHolder=\"{subclassesPlaceholder}\" handler=\"{selectSubClassHandler}\" id=\"subClass-select\" bind:value=\"{subclassValue}\" truncateWidth=\"17\" )\n h3.left.mt-sm {localize('GAS.Tabs.Classes.FilterByLevel')}\n .flexrow\n .flex2.left\n TJSSelect( options=\"{levelOptions}\" store=\"{level}\" on:change=\"{levelSelectHandler}\" styles=\"{selectStyles}\" )\n +if(\"classAdvancementArrayFiltered\")\n h3.left.mt-sm.flexrow\n .flex {localize('GAS.Tabs.Classes.Class')} {localize('GAS.Advancements')}\n .flex0.div.badge.right.inset.ml-sm.mb-xs {localize('GAS.Level')} {$level}\n ul.icon-list\n +if(\"!classAdvancementArrayFiltered.length\")\n li.left {localize('GAS.NoAdvancements')}\n +else()\n +each(\"classAdvancementArrayFiltered as advancement\")\n //- @todo: this should be broken out into components for each advancement.type\n li.left(data-type=\"{advancement.type}\")\n .flexrow(data-tooltip=\"{getAdvancementValue(advancement)}\" data-tooltip-class=\"gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip\")\n .flex0.relative.image\n img.icon(src=\"{advancement.icon}\" alt=\"{advancement.title}\")\n .flex2 {advancement.title}\n .flexrow\n //- pre advancement.type {advancement.type}\n svelte:component(this=\"{classAdvancementComponents[advancement.type]}\" advancement=\"{advancement}\")\n \n +if(\"subclasses.length\")\n //- h3.left.mt-sm Description\n //- .left.sub-class(bind:innerHTML=\"{richSubClassHTML}\" contenteditable)\n +if(\"subClassAdvancementArrayFiltered\")\n h3.left.mt-sm.flexrow\n .flex {localize('GAS.Tabs.Classes.SubClass')} {localize('GAS.Advancements')}\n .flex0.div.badge.right.inset.ml-sm.mb-xs {localize('GAS.Level')} {$level}\n ul.icon-list\n +if(\"!subClassAdvancementArrayFiltered.length\")\n li.left {localize('GAS.NoAdvancements')}\n +else()\n +each(\"subClassAdvancementArrayFiltered as advancement\")\n //- @todo: this should be broken out into components for each advancement.type\n li.left(data-type=\"{advancement.type}\")\n .flexrow(data-tooltip=\"{getAdvancementValue(advancement)}\" data-tooltip-locked=\"true\" data-tooltip-class=\"gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip\" )\n .flex0.relative.image\n img.icon(src=\"{advancement.icon}\" alt=\"{advancement.title}\")\n .flex2 {advancement.title}\n .flexrow\n svelte:component(this=\"{subClassAdvancementComponents[advancement.type]}\" advancement=\"{advancement}\")\n \n .flex0.border-right.right-border-gradient-mask \n .flex3.left.pl-md.scroll.col-b {@html combinedHtml}\n\n\n\n\n"],"names":["ctx"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2Nqb,MAAA;AAAA;AAAA,IAAA,OAAW,UAAM,kBAAA,GAAA;AAAA;;;;;QAA2iB,IAAY,EAAA;AAAA;AAAA,aAAW;AAAA;;QAAkD,IAAY,EAAA;AAAA;AAAA;;;;;IAA1C,IAAkB,EAAA;AAAA,EAAA;;;IAAwD,IAA6B,CAAA,KAAA,kBAAA,GAAA;AAAA;AAAw5B,MAAA;AAAA;AAAA,IAAA,OAAW,UAAM,kBAAA,GAAA;AAAA;;;;;AAA7qC,SAAA,cAAA,GAAA,SAAS,gCAAgC,CAAA;;;;;;;;;;;;;;AAAjE,aAAwE,QAAA,IAAA,MAAA;AAAA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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 div.content\n .flexrow\n .flex2.pr-sm.col-a\n h3.left {localize('GAS.Tabs.Abilities.HowCalculated')}\n +if(\"options.length > 1\")\n IconSelect.icon-select({options} {active} {placeHolder} handler=\"{selectHandler}\" id=\"ability-generation-method-select\" bind:value=\"{$abilityGenerationMethod}\" )\n +else()\n ol.properties-list\n +each(\"options as option\")\n li {option.label}\n +if(\"$abilityGenerationMethod\")\n svelte:component(this=\"{abilityModule}\")\n .flex0.border-right.right-border-gradient-mask \n .flex3.left.pl-md.scroll.col-b {@html richHTML}\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;AAAA;;;;;;;;;;;;;;;;;;;;;;;QAAxBA,KAAwB,CAAA;;;;;;;;;;;;;;;;;;;;;AAAiF,MAAA;AAAA;AAAA,IAAA,QAAO,QAAK;AAAA;;;;;;;;AAAjB,aAAuB,QAAA,IAAA,MAAA;;;;AAAlB,UAAA;AAAA,MAAA,KAAA,aAAA;AAAA,MAAAA,SAAO,QAAK,IAAA,UAAA,GAAA,OAAA;AAAA;;;;;;;;;;;;;;IAA8E,IAAa,CAAA;AAAA;;;;;;;;;;;;;;;;;;;;MAAbA,KAAa,CAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAjXA,KAAO,CAAA,EAAC,SA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SAAQ;AAAA;;;sBAE7B,WAAW,OAAO,WAAW,EAAE;AAAA;;;AA4B3B,UAAA,QAAQ,WAAW,GAAC;AAEzB,wBAAA,yBAAA,2BAA2B,QAAQ,CAAC,EAAE,OAAK,wBAAA;AAAA;;;;AAG5C,mBAAA,GAAE,gBAAgB,2BAA2B,sBAAsB,QAAQ,KAAK,YAAU,OAAO,UAAU,wBAAwB,EAAE,IAAI,IAAI,IAAI;AAAA;;kBAlC/I,wBAAqB,CAAA,CAAA;kBAErB,UAAO;AAAA;MAEN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,MACN,SAAS,KAAK,SAAS,IAAI,WAAW,kBAAkB;AAAA;;MAGxD,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,MACN,SAAS,KAAK,SAAS,IAAI,WAAW,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/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 .advancement.mt-sm(data-type=\"{advancement.type}\")\n +if(\"advancement.title === 'Size'\")\n .flexrow\n .flex.left {getAdvancementValue(advancement)}\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\ndiv.custom-select({...$$restProps} {id} role=\"combobox\" aria-expanded=\"{isOpen}\" aria-haspopup=\"listbox\" aria-controls=\"options-list\" tabindex=\"0\")\n div.selected-option(on:click=\"{toggleDropdown}\" on:keydown=\"{handleKeydown}\" role=\"button\" aria-expanded=\"{isOpen}\" aria-haspopup=\"listbox\" tabindex=\"0\" class:selected=\"{isOpen}\")\n +if(\"placeHolder && !value\")\n div.placeholder {placeHolder}\n +each(\"options as option, index\")\n +if(\"option && option?.value === value\")\n +if(\"!noImg && !textOnly(option) && shrinkIfNoIcon\")\n div.option-icon(class=\"{option.img ? option.img : ''}\")\n +if(\"option.icon != undefined\")\n i(class=\"{option.icon}\")\n +else\n img(src=\"{option.img}\" alt=\"{option.label}\")\n div.option-label {truncate(option.label, truncateWidth)}\n div.chevron-icon\n i(class=\"fas fa-chevron-down\")\n\n +if(\"isOpen\")\n div.options-dropdown.dropshadow(id=\"options-list\" role=\"listbox\")\n +each(\"options as option, index\")\n +if(\"option && option?.value !== value\")\n div.option(role=\"option\" on:click=\"{handleSelect(option)}\" on:keydown=\"{handleKeydown}\" tabindex=\"0\")\n +if(\"!textOnly(option) && shrinkIfNoIcon\")\n div.option-icon(class=\"{option.img ? option.img : ''}\")\n +if(\"option.icon != undefined\")\n i(class=\"{option.icon}\")\n +else\n img(src=\"{option.img}\" alt=\"{option.label}\")\n div.option-label {option.label}\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;A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000..9bb3bf4
--- /dev/null
+++ b/dist/ItemChoice-CRxi93V_.js
@@ -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 .advancement.mt-sm(data-type=\"{advancement.type}\")\n +if(\"advancement.title === 'Cantrip'\")\n .flexrow\n .flex.left {getAdvancementValue(advancement, 'hint')}\n +else()\n .flexrow\n h3.flex.left\n span Choose \n span {count} \n span from: \n ul.icon-list\n +each(\"advancement.configuration.pool as pool\")\n +await(\"fromUuid(pool.uuid)\")\n +then(\"item\")\n li.left\n .flexrow\n .flex0.relative.image\n img.icon(src=\"{item.img}\" alt=\"{item.name}\")\n .flex2 {item.name}\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,KAAW,CAAA,EAAC,cAAc;AAAA,QAAI;;mCAAnC,QAAI,KAAA,GAAA;;;;;;;;;;;;;wCAAJ;AAAA;;;;;;;;;;;;;;gBAA1M;AAAA;AAAA,IAAoB,IAAW,CAAA;AAAA,IAAE;AAAA,EAAM,IAAA;;;;;;;;;;;AAApF,aAAkG,QAAA,MAAA,MAAA;AAA7E,a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AA,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 .advancement.mt-sm(data-type=\"{advancement.type}\")\n ul.icon-list\n +each(\"items as item\")\n li.left\n +await(\"TextEditor.enrichHTML(item?.system?.description?.value || '')\")\n +then(\"Html\")\n .flexrow.gap-4\n //- (data-tooltip=\"{Html || null}\" data-tooltip-class=\"gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip\")\n .flex0.relative.image\n img.icon(src=\"{item?.img}\" alt=\"{item?.name}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;;"}
\ 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+if(\"src && level && classKey\")\n .flexrow.class-row\n .flex0.icon\n img(height=\"40\" width=\"40\" src=\"{src}\")\n .flex3.flexrow\n .flex3.left.pa-xs {ucfirst(classKey)} \n .flex0.right.mr-sm\n .lozenge.pa-xs {level} \n .flex0.right.pr-md.py-xs\n +if(\"!$activeClass\")\n i(class=\"fas fa-plus\")\n +if(\"$activeClass && !$isMultiClass\")\n i(class=\"fas fa-times\" on:click!=\"{cancelLevelUp}\")\n\n\n\n","\n\n\n .content\n //- pre isMultiClass {$isMultiClass}\n //- pre activeClass {$activeClass}\n //- pre characterClass {$characterClass}\n //- pre newClassLevel {$newClassLevel}\n .flexrow\n .flex2.pr-sm.col-a\n h1.flex Existing Classes\n +each(\"classKeys as classKey, index\")\n //- pre classKey {classKey}\n //- pre getCharacterClass(classKey) {getCharacterClass(classKey).system.img}\n //- pre getCharacterClass(classKey)?.system?.img {getCharacterClass(classKey)?.system?.img}\n +if(\"$activeClass && !$newClassLevel\")\n .class-row(class=\"{existingClassesCssClassForRow(classKey)}\")\n LevelUpButtonInnards(src=\"{getCharacterClass(classKey)?.img}\" level=\"{classLevels[index]}\" classKey=\"{classKey}\") \n +else()\n .class-row(class=\"{existingClassesCssClassForRow(classKey)}\" role=\"button\" aria-role=\"button\" aria-label=\"{localize('GAS.LevelUp.Button')+' '+classKey}\" data-tooltip=\"{localize('GAS.LevelUp.Button')+' '+classKey}\" on:mousedown!=\"{clickAddLevel(classKey)}\")\n LevelUpButtonInnards(src=\"{getCharacterClass(classKey)?.img}\" level=\"{classLevels[index]}\" classKey=\"{classKey}\") \n +if(\"!$newClassLevel\") \n h1.flexrow.mt-md\n .flex2.left Add Multiclass\n +if(\"classProp\")\n .flex0\n button.pr-none.mt-sm.gold-button(type=\"button\" role=\"button\" on:mousedown=\"{clickCancelMulticlass}\")\n i(class=\"fas fa-times\")\n IconSelect.icon-select( options=\"{filteredClassIndex}\" placeHolder=\"{classesPlaceholder}\" handler=\"{selectClassHandler}\" id=\"characterClass-select\" bind:value=\"{classValue}\" )\n +if(\"$characterClass\")\n //- +if(\"subclasses.length\")\n //- h3.left.mt-md Subclass\n //- IconSelect.icon-select(active=\"{subClassProp}\" options=\"{subclasses}\" placeHolder=\"{subclassesPlaceholder}\" handler=\"{selectSubClassHandler}\" id=\"subClass-select\" bind:value=\"{subclassValue}\" truncateWidth=\"17\" )\n //- h3.left.mt-sm {localize('GAS.Tabs.Classes.FilterByLevel')}\n +if(\"activeClassObj\")\n h3 {activeClassObj.name} {levelOptions[1].label}\n //- .flexrow\n //- .flex2.left\n //- TJSSelect( options=\"{levelOptions}\" store=\"{level}\" on:change=\"{levelSelectHandler}\" styles=\"{selectStyles}\" )\n LevelUpExisting(classAdvancementArrayFiltered=\"{classAdvancementArrayFiltered}\" level=\"{getLevel(activeClassKey)}\")\n //- +if(\"subclasses.length\")\n //- +if(\"$characterSubClass\")\n //- //- h3.left.mt-sm Description\n //- //- .left.sub-class(bind:innerHTML=\"{richSubClassHTML}\" contenteditable)\n //- +if(\"subClassAdvancementArrayFiltered\")\n //- h3.left.mt-sm.flexrow\n //- .flex {localize('GAS.Tabs.Classes.SubClass')} {localize('GAS.Advancements')}\n //- .flex0.div.badge.right.inset.ml-sm.mb-xs {localize('GAS.Level')} {$level}\n //- ul.icon-list\n //- +if(\"!subClassAdvancementArrayFiltered.length\")\n //- li.left {localize('GAS.NoAdvancements')}\n //- +else()\n //- +each(\"subClassAdvancementArrayFiltered as advancement\")\n //- //- @todo: this should be broken out into components for each advancement.type\n //- li.left(data-type=\"{advancement.type}\")\n //- .flexrow(data-tooltip=\"{advancement.configuration?.hint || null}\" data-tooltip-locked=\"true\" data-tooltip-class=\"gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip\" )\n //- .flex0.relative.image\n //- img.icon(src=\"{advancement.icon}\" alt=\"{advancement.title}\")\n //- .flex2 {advancement.title}\n //- .flexrow\n //- svelte:component(this=\"{subClassAdvancementComponents[advancement.type]}\" advancement=\"{advancement}\")\n \n .flex0.border-right.right-border-gradient-mask \n .flex3.left.pl-md.scroll.col-b {@html combinedHtml}\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,CAAA,GAAA;;;AAAmE,UAAA;AAAA,MAAA,KAAA,cAAA,WAAA;AAAA;AAAA,QAAQA,KAAQ,CAAA;AAAA,MAAA,IAAA,IAAA,UAAA,IAAA,QAAA;;;;;QAAoEA,KAAK,CAAA;AAAA,MAAA;;MAAyDA,KAAY,CAAA,GAAA;;;;;;;;;;;AAAsC;AAAA;AAAA,QAAAA;QAAiBA,KAAa,CAAA;AAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAnE,aAA2B,QAAA,GAAA,MAAA;AAAA;;;;;;;;;;;;;;;;;;AAAyC,aAAuD,QAAA,GAAA,MAAA;;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;;;;AAK/E,yCAAmC,oBAAoB,aAAa,OACnE,OAAO,QAAQ,mBAAmB,YAAY,IAAI,EAC/C,OAAS,CAAA,CAAA,IAAI,KAAK,MAAM,MAAM,UAAU,MAAM,EAC9C,IAAM,CAAA,CAAA,IAAI,KAAK,OAAY,EAAA,GAAA,OAAO,GAAE,EAAA;;;;sBAGxC,gCAAgC,iBAAiB,aAAa,OAC7D,OAAO,QAAQ,gBAAgB,YAAY,IAAI,EAC5C,OAAS,CAAA,CAAA,IAAI,KAAK,MAAM,MAAM,UAAU,MAAM,EAE9C,IAAM,CAAA,CAAA,IAAI,KAAK,OAAY,EAAA,GAAA,OAAO,GAAE,EAAA;;;;AAG1C,mBAAA,GAAE,YAAY,OAAO,KAAK,OAAO,QAAQ,CAAA;AAAA;;;sBACvC,cAAc,UAAU,IAAK,cAAQ;AAChC,cAAA,WAAW,OAAO,SAAS,QAAQ;eAClC,SAAS,QAAQ,eAAe,SAAS,OAAO,SAAS,IAAI,SAAS,OAAO;AAAA;;;;sBAGnF,iBAAiB,OAAO,SAAS,cAAc,CAAA;AAAA;;;uBAC/C,mBAAmB,UAAU,QAAQ,cAAc,CAAA;AAAA;;;AAChC,kBAAY,gBAAgB;AAAA;;;sBAC/C,qBAAqB,iBACnB,OAAQ,OAAC;eACD,EAAE,QAAQ;AAAA,MAIlB,CAAA,EAAA,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 .component\n +if(\"classAdvancementArrayFiltered\")\n ul.icon-list\n +if(\"!classAdvancementArrayFiltered.length\")\n li.left {localize('GAS.NoAdvancements')}\n +else()\n +each(\"classAdvancementArrayFiltered as advancement\")\n //- @todo: this should be broken out into components for each advancement.type\n li.left(data-type=\"{advancement.type}\")\n .flexrow(data-tooltip=\"{getAdvancementValue(advancement, 'hint')}\" data-tooltip-class=\"gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip\")\n .flex0.relative.image\n img.icon(src=\"{advancement.icon}\" alt=\"{advancement.title}\")\n .flex2 {advancement.title}\n .flexrow\n svelte:component(this=\"{classAdvancementComponents[advancement.type]}\" advancement=\"{advancement}\")\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,QAAA;;mCAAlC,QAAI,KAAA,GAAA;;;;;;;;;;;;;4BAAJ,QAAI,IAAA,YAAA,QAAA,KAAA,GAAA;;;;;;;;qCAAJ,QAAI,KAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAAjD,SAAA,cAAA,GAAA,SAAS,oBAAoB,CAAA;;;;AAA/C,aAAsD,QAAA,IAAA,MAAA;AAAA;;;;;;;;;;;;;;;;;;;AAA8X,MAAA;AAAA;AAAA,IAAA,OAAY,QAAK;AAAA;;;;;;;;;IAA2D,IAA0B,CAAA;AAAA;AAAA,MAAC,I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B,CAAA;AAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAxB5C,gCAA6B,GAAA,IAAA;AAC7B,MAAA,EAAA,QAAQ,EAAC,IAAA;QAEd,0BAAuB,YAAA;AAChB,eAAA,oBAAoB,+BAA6B;;cAElD,SAAM,MAAA,qCAAA,uBAAA,OAAA,EAAA,wEAAA,MAAA,OAAA,uCAAA,GAAA,qDAAA,MAAA,OAAA,oBAAA,GAAA,2DAAA,MAAA,OAAA,0BAAA,GAAA,0DAAA,MAAA,OAAA,yBAAA,GAAA,2DAAA,MAAA,OAAA,0BAAA,GAAA,qDAAA,MAAA,OAAA,oBAAA,GAAA,sDAAA,MAAA,OAAA,qBAAA,EAAA,CAAA,GAAA,yCAAA,iBAAA,IAAA,WAAA,CAAA;AAGZ,qBAAA,GAAA,2BAA2B,iBAAiB,IAAI,IAAI,OAAO,SAAO,0BAAA;AAAA,eAC3D,OAAK;AACZ,YAAI,EAAC,gCAAiC,iBAAiB,IAAI,KAAK,KAAK;AAAA;;;AAO3E,UAAO,YAAA;UACC,KAAI;UACJ,wBAAuB;AAAA;;;;;kBAJ5B,6BAA0B,CAAA,CAAA;;;;;;;;;;;;"}
\ No newline at end of file
diff --git a/dist/ManualEntry-1SM2AKew.js b/dist/ManualEntry-1SM2AKew.js
new file mode 100644
index 0000000..b774338
--- /dev/null
+++ b/dist/ManualEntry-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.attribute-entry.mt-sm\n h5.flexrow.mb-sm\n .flex2.left Ability\n .flex1.center Race / Feat\n .flex1.center Base Score\n .flex1.center Score\n .flex1.center Modifier\n .indent\n +each(\"systemAbilitiesArray as ability, index\")\n .flexrow.mb-sm\n .flex2.left {ability[1].label}\n .flex1.center.align-text-with-input\n +if(\"abilityAdvancements?.[ability[1].abbreviation] > 0\")\n span +\n span {abilityAdvancements?.[ability[1].abbreviation] || 0}\n .flex1.center\n input.center.small(name=\"{ability[1].abbreviation}\" id=\"{ability[1].abbreviation}\" type=\"number\" value=\"{$doc.system.abilities[ability[1].abbreviation]?.value}\" on:input!=\"{updateDebounce(ability[1].abbreviation, event)}\")\n .flex1.center.align-text-with-input {(Number(abilityAdvancements?.[ability[1].abbreviation]) || 0) + Number($doc.system.abilities[ability[1].abbreviation]?.value || 0)}\n .flex1.center.align-text-with-input \n +if(\"$doc.system.abilities[ability[1].abbreviation]?.mod > 0\")\n span +\n span {$doc.system.abilities[ability[1].abbreviation]?.mod}\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,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,GAA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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.attribute-entry.mt-sm\n h5.flexrow.mb-sm\n .flex2.left Ability\n .flex1.center Race / Feat\n .flex1.center Base Score\n .flex1.center Score\n .flex1.center Modifier\n .indent\n +each(\"systemAbilitiesArray as ability, index\")\n .flexrow.mb-sm\n .flex2.left {ability[1].label}\n .flex1.center.align-text-with-input\n +if(\"abilityAdvancements?.[ability[1].abbreviation] > 0\")\n span +\n span {abilityAdvancements?.[ability[1].abbreviation] || 0}\n .flex1.center.relative\n input.left.small.mainscore(disabled type=\"number\" value=\"{$doc.system.abilities[ability[1].abbreviation]?.value}\" name=\"{ability[1].abbreviation}\" id=\"{ability[1].abbreviation}\" )\n .controls\n .up.chevron\n i.fas.fa-chevron-up(alt=\"Decrease\" on:click!=\"{updateDebounce(ability[1].abbreviation, {target: {value: Number($doc.system.abilities[ability[1].abbreviation]?.value) + 1}})}\")\n .down.chevron\n i.fas.fa-chevron-down(alt=\"Increase\" on:click!=\"{updateDebounce(ability[1].abbreviation, {target: {value: Number($doc.system.abilities[ability[1].abbreviation]?.value) - 1}})}\")\n .flex1.center.align-text-with-input {(Number(abilityAdvancements?.[ability[1].abbreviation]) || 0) + Number($doc.system.abilities[ability[1].abbreviation]?.value || 0)}\n .flex1.center.align-text-with-input \n +if(\"$doc.system.abilities[ability[1].abbreviation]?.mod > 0\")\n span +\n span {$doc.system.abilities[ability[1].abbreviation]?.mod}\n hr\n .flexrow.justify-flexrow-vertical\n .flex1 Points total: \n .flex\n +if(\"isNaN(scoreTotal)\")\n span.red(data-tooltip=\"{localize('GAS.Setting.AbilityEntry.AllowPointBuy.InvalidTotal')}\") N/A\n +else()\n input.score.center.small( disabled class=\"{pointBuyClass}\" type=\"number\" value=\"{scoreTotal}\") \n .flex0 / \n .flex1 \n input.center.small(disabled type=\"number\" value=\"{pointBuyLimit}\") \n \n +if(\"isNaN(scoreTotal)\")\n hr\n button.btn.btn-primary(on:click=\"{reset}\") Reset scores\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,IAAI,CAAA,EAAC,OAAO;AAAA;AAAA,MAAU,IAAO,EAAA,EAAC,CAAC,EAAE;AAAA,IAAY,GAAG,SAAS;AAAA,EAAC,IAAA;;;;;;IAAgJ,IAAI,CAAA,EA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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\ndiv.content\n .flexrow\n .flex2.pr-sm.col-a\n .flexrow\n .flex0.required(class=\"{$race ? '' : 'active'}\") *\n .flex3 \n IconSelect.mb-md.icon-select({options} {active} {placeHolder} handler=\"{selectHandler}\" id=\"race-select\" bind:value )\n +if(\"value\")\n +if(\"source\")\n //- h3.left {localize('GAS.Source')}\n ol.properties-list\n li {book} {page} {type.value ? ', ' + type.value : ''} \n\n +if(\"filteredMovement\")\n h3.left {localize('GAS.Tabs.Races.Movement')}\n ol.properties-list\n +each(\"filteredMovement as movement\")\n li.left {movement.label} : {movement.value} {units}\n +if(\"filteredSenses\")\n h3.left {localize('GAS.Tabs.Races.Senses')}\n ol.properties-list\n +each(\"filteredSenses as senses\")\n li.left {senses.label} : {senses.value} {units}\n +if(\"advancementArray\")\n h3.left {localize('GAS.Advancements')}\n ul.icon-list\n +each(\"advancementArray as advancement\")\n //- @todo: this should be broken out into components for each advancement.type\n li.left\n .flexrow(data-tooltip=\"{getAdvancementValue(advancement, 'hint')}\" data-tooltip-class=\"gas-tooltip dnd5e2 dnd5e-tooltip item-tooltip\")\n .flex0.relative.image\n img.icon(src=\"{advancement.icon}\" alt=\"{advancement.title}\")\n .flex2 {advancement.title}\n .flexrow\n svelte:component(this=\"{advancementComponents[advancement.type]}\" advancement=\"{advancement}\")\n \n \n \n .flex0.border-right.right-border-gradient-mask \n .flex3.left.pl-md.scroll.col-b {@html richHTML}\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;AAA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ACV,OACE,CAAAC,WACG,EAAAA,OAAM,QAAQ,WAAWA,OAAM,SAAS,qBAAoB;;;;AAIrE,WAAK,OAAO,IAAI,EAAE,gBAAgB;AAAA;;AA/BpC,eAAA,IAAE,UAAU,eAAe;mBAIzB,wBAAqB,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
\ No newline 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.attribute-entry.mt-sm\n +each(\"Object.keys($abilityRolls) as roll, ability\")\n //- pre abilityRolls {ability}: {roll}\n h5.flexrow.mb-sm\n .flex2.left Ability\n .flex1.center Race / Feat\n .flex1.center Base Score\n .flex1.center Score\n .flex1.center Modifier\n .indent\n +each(\"systemAbilitiesArray as ability, index\")\n .flexrow.mb-sm\n .flex2.left {ability[1].label}\n .flex1.center.align-text-with-input\n +if(\"abilityAdvancements?.[ability[1].abbreviation] > 0\")\n span +\n span {abilityAdvancements?.[ability[1].abbreviation] || 0}\n .flex1.center.relative\n input.center.small(disabled type=\"number\" value=\"{$doc.system.abilities[ability[1].abbreviation]?.value}\" name=\"{ability[1].abbreviation}\" id=\"{ability[1].abbreviation}\")\n .flex1.center.align-text-with-input {(Number(abilityAdvancements?.[ability[1].abbreviation]) || 0) + Number($doc.system.abilities[ability[1].abbreviation]?.value || 0)}\n .flex1.center.align-text-with-input \n +if(\"$doc.system.abilities[ability[1].abbreviation]?.mod > 0\")\n span +\n span {$doc.system.abilities[ability[1].abbreviation]?.mod}\n .flex0.center.justify-flexrow-vertical.controls(class=\"{$abilityRolls[ability[1].abbreviation] ? '' : 'active'}\" alt=\"Roll\" on:click!=\"{roll(ability[1].abbreviation)}\")\n i.fas.fa-dice\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,IAA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AAO,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\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 .advancement.mt-sm(data-type=\"{advancement.type}\")\n +if(\"advancement.title === 'Size'\")\n .flexrow\n +if(\"getAdvancementValue(advancement, 'hint')\")\n .flex.left {getAdvancementValue(advancement, 'hint')}\n +if(\"sizes?.size > 0\")\n .flex0\n +each(\"sizes as size\")\n .flex0.right.badge {game.system.config.actorSizes[size].label}\n \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 div.content\n .flexrow\n .flex2.pr-sm.col-a\n .flex0.border-right.right-border-gradient-mask \n .flex3.left.pl-md.scroll.col-b {@html richHTML}\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 @@
+{"version":3,"file":"StandardArray-CBELG86I.js","sources":["../src/components/molecules/dnd5e/AbilityEntry/StandardArray.svelte"],"sourcesContent":["\n\n\n.attribute-entry.mt-sm\n h5.flexrow.mb-sm\n .flex2.left Ability\n .flex1.center Race / Feat\n .flex1.center Base Score\n .flex1.center Score\n .flex1.center Modifier\n .indent\n +each(\"systemAbilitiesArray as ability, index\")\n .flexrow.mb-sm\n .flex2.left {ability[1].label}\n .flex1.center.align-text-with-input\n +if(\"abilityAdvancements?.[ability[1].abbreviation] > 0\")\n span +\n span {abilityAdvancements?.[ability[1].abbreviation] || 0}\n .flex1.center.relative\n input.left.small.mainscore(disabled type=\"number\" value=\"{$doc.system.abilities[ability[1].abbreviation]?.value}\")\n .controls\n .up.chevron\n +if(\"index != 0\")\n i.fas.fa-chevron-up(alt=\"Decrease\" on:click!=\"{updateDebounce(ability[1].abbreviation, 1)}\")\n .down.chevron\n +if(\"index != 5\")\n i.fas.fa-chevron-down(alt=\"Increase\" on:click!=\"{updateDebounce(ability[1].abbreviation, -1)}\")\n .flex1.center.align-text-with-input {(Number(abilityAdvancements?.[ability[1].abbreviation]) || 0) + Number($doc.system.abilities[ability[1].abbreviation]?.value || 0)}\n .flex1.center.align-text-with-input \n +if(\"$doc.system.abilities[ability[1].abbreviation]?.mod > 0\")\n span +\n span {$doc.system.abilities[ability[1].abbreviation]?.mod}\n +if(\"!$isStandardArrayValues\")\n hr\n button.btn.btn-primary(on:click=\"{reset}\") Reset to Standard Array\n\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9B,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 .advancement.mt-sm(data-type=\"{advancement.type}\")\n \n //- pre {JSON.stringify(advancement)}\n\n +if(\"grants.length > 0\")\n +each(\"grants as grant\")\n .flexrow\n .flex.left {grant.label}\n +if(\"grant.value\")\n .flex0.right.badge.inset.nowrap {grant.value}\n\n //- pre choices {JSON.stringify(choices)}\n \n +if(\"choices.length > 0\")\n +each(\"choices as choice\")\n\n //- pre choice {JSON.stringify(choice)}\n //- pre choice.pool {JSON.stringify(choice.pool)}\n\n\n +if(\"!fromAll(choice.pool)\")\n .flexrow\n h3.flex\n span Choose \n span {choice.count} \n span of the following:\n\n //- pre choice.pool {JSON.stringify(choice.pool)}\n \n +each(\"choice.pool as pool\")\n \n //- pre {JSON.stringify(pool)}\n\n .flexrow\n .flex.left {pool.label}\n +if(\"pool.value\")\n +if(\"pool.type == 'tool'\")\n .flex0.right.badge.inset.nowrap {game.system.config.toolProficiencies[pool.value] }\n \n +else()\n .flex0.right.badge.inset {ucfirst(pool.value)}\n +else()\n .flexrow\n .flex \n span Choose \n span {choice.count} \n .flex0.badge.inset.right any\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;;;;;;;;;;;AAA/E,aAA0J,QAAA,MAAA,MAAA;AAArI,aAA0C,MAAA,IAAA;;;;;AAAlB,UAAA;AAAA,MAAA,KAAA,aAAA;AAAA,MAAAA,SAAM,QAAK,IAAA,UAAA,GAAA,OAAA;AAAY;AAAA;AAAA,QAAAA,SAAM;AAAA,QAAK;;;;;;;;;;;;;;;;;;;;;;;;;IAAsH,IAAO,CAAA;AAAA,EAAA;;iCAAZ,QAAI,KAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;UAACA,KAAO,CAAA;AAAA,QAAA;;mCAAZ,QAAI,KAAA,GAAA;;;;;;;;;;;;;wCAAJ;AAAA;;;;;;;;;;;;;;;;;;;;;;;AAAslB,YAAA,cAAA;AAAA,MAAA,OAAO,KAAK;;;;;;;;AAApF,aAAuJ,QAAA,MAAA,MAAA;AAAlI,aAA8E,MAAA,IAAA;AAA3D,aAAyB,MAAA,KA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AAO,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;AAAA,MACd;AACD,YAAM,EAAC;AACP,oBAAc,OAAO,CAAC;AACtB,YAAM,EAAE,KAAK,MAAK,GAAI,KAAK,MAAM;AACjC,oBAAc;AAAA,IACd;AACD,SAAK,QAAQ;AACb,QAAI,KAAK,OAAQ,MAAK,OAAO,KAAK,IAAI;AACtC,QAAI,aAAa;AAChB;IACA;AAAA,EACD;AACD,MAAI,WAAW,OAAO,GAAG;AACxB,UAAM,oBAAoB;AAC1B,YAAQ;AAAA,MACP,CAAC,UAAU;AACV,8BAAsB,iBAAiB;AACvC,eAAO,KAAK,MAAM,GAAG,KAAK,OAAO,KAAK;AACtC,8BAAsB,IAAI;AAAA,MAC1B;AAAA,MACD,CAAC,UAAU;AACV,8BAAsB,iBAAiB;AACvC,eAAO,KAAK,OAAO,GAAG,KAAK,OAAO,KAAK;AACvC,8BAAsB,IAAI;AAC1B,YAAI,CAAC,KAAK,UAAU;AACnB,gBAAM;AAAA,QACN;AAAA,MACD;AAAA,IACJ;AAEE,QAAI,KAAK,YAAY,KAAK,SAAS;AAClC,aAAO,KAAK,SAAS,CAAC;AACtB,aAAO;AAAA,IACP;AAAA,EACH,OAAQ;AACN,QAAI,KAAK,YAAY,KAAK,MAAM;AAC/B,aAAO,KAAK,MAAM,GAAG,KAAK,OAAO,OAAO;AACxC,aAAO;AAAA,IACP;AACD,SAAK;AAAA,IAA6B;AAAA,EAClC;AACF;AAGO,SAAS,0BAA0B,MAAM,KAAK,OAAO;AAC3D,QAAM,YAAY,IAAI;AACtB,QAAM,EAAE,SAAU,IAAG;AACrB,MAAI,KAAK,YAAY,KAAK,MAAM;AAC/B,cAAU,KAAK,KAAK,IAAI;AAAA,EACxB;AACD,MAAI,KAAK,YAAY,KAAK,OAAO;AAChC,cAAU,KAAK,KAAK,IAAI;AAAA,EACxB;AACD,OAAK,MAAM,EAAE,WAAW,KAAK;AAC9B;","x_google_ignoreList":[0]}
\ No newline at end of file
diff --git a/dist/index-DP0Ud7KH.js b/dist/index-DP0Ud7KH.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